Skip to content

Commit

Permalink
chore(release): pulling release/3.5.0 into main (#1681)
Browse files Browse the repository at this point in the history
  • Loading branch information
MoumitaM authored Apr 3, 2024
2 parents 08ab4c1 + cd08e3c commit 4fa8cbb
Show file tree
Hide file tree
Showing 14 changed files with 117 additions and 37 deletions.
9 changes: 5 additions & 4 deletions examples/integrations/Ninetailed/sample-apps/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
There are 3 sample apps:
1. NPM package: This is for Production Use Case where rudderstack would be installed using npm install command and the app will intialise its instance.

2. V1.1 CDN: This app can be used for any environment either for dev, staging or prod by providing the right configurations in config.js file.This uses the legacy SDK.
1. NPM package: This is for Production Use Case where rudderstack would be installed using npm install command and the app will initialise its instance.

3. V3 CDN: This app can be used for any environment either for dev, staging or prod by providing the right configurations in config.js file. This uses the V3 SDK.
2. V1.1 CDN: This app can be used for any environment either for dev, staging or prod by providing the right configurations in config.js file .This uses the legacy SDK.

For Customers: NPM one is advised and other ones are just testing purposes mainly for developers
3. V3 CDN: This app can be used for any environment either for dev, staging or prod by providing the right configurations in config.js file . This uses the V3 SDK.

For Customers: The NPM package is recommended for production use. The other versions are intended primarily for testing and development purposes.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ See the section about [running tests](https://facebook.github.io/create-react-ap
Builds the app for production to the `build` folder.\
It correctly bundles React in production mode and optimizes the build for the best performance.

The build is minified and the filenames include the hashes.\
The build is minified, and the filenames include the hashes.\
Your app is ready to be deployed!

See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
Expand All @@ -35,9 +35,9 @@ See the section about [deployment](https://facebook.github.io/create-react-app/d

If you aren't satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.

Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own.
Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc.) right into your project so you have full control over them. All the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point, you're on your own.

You don't have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it.
You don't have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However, we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it.

## Learn More

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
const DATAPLANE_URL='http://localhost:8080'
const WRITE_KEY='2F4kphApmhq8LvdG4GUhYwsMH4P'
const CONFIG_URL='https://api.dev.rudderlabs.com'
const DATAPLANE_URL = 'http://localhost:8080';
const WRITE_KEY = 'dummyWriteKey';
const CONFIG_URL = 'https://api.dev.rudderlabs.com';
module.exports = {
DATAPLANE_URL,
WRITE_KEY,
CONFIG_URL
}
DATAPLANE_URL,
WRITE_KEY,
CONFIG_URL,
};
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rudderstack/analytics-js-monorepo",
"version": "3.4.0",
"version": "3.5.0",
"private": true,
"description": "Monorepo for RudderStack Analytics JS SDK",
"workspaces": [
Expand Down
8 changes: 8 additions & 0 deletions packages/analytics-js-integrations/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).

## [3.0.3](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/[email protected]...@rudderstack/[email protected]) (2024-04-02)


### Bug Fixes

* ninetailed: modify page support ([#1677](https://github.com/rudderlabs/rudder-sdk-js/issues/1677)) ([e45ef06](https://github.com/rudderlabs/rudder-sdk-js/commit/e45ef06186cb4dc1d0568f2b39d8e786d278390a))
* updated isLoaded and isReady conditions for mixpanel ([#1650](https://github.com/rudderlabs/rudder-sdk-js/issues/1650)) ([80c76a1](https://github.com/rudderlabs/rudder-sdk-js/commit/80c76a1f7f27a93930a6146730ac94d945b19b25))

## [3.0.2](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/[email protected]...@rudderstack/[email protected]) (2024-03-22)

### Dependency Updates
Expand Down
9 changes: 6 additions & 3 deletions packages/analytics-js-integrations/CHANGELOG_LATEST.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
## [3.0.2](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/[email protected].1...@rudderstack/[email protected].2) (2024-03-22)
## [3.0.3](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/[email protected].2...@rudderstack/[email protected].3) (2024-04-02)

### Dependency Updates

* `@rudderstack/analytics-js-common` updated to version `3.0.1`
### Bug Fixes

* ninetailed: modify page support ([#1677](https://github.com/rudderlabs/rudder-sdk-js/issues/1677)) ([e45ef06](https://github.com/rudderlabs/rudder-sdk-js/commit/e45ef06186cb4dc1d0568f2b39d8e786d278390a))
* updated isLoaded and isReady conditions for mixpanel ([#1650](https://github.com/rudderlabs/rudder-sdk-js/issues/1650)) ([80c76a1](https://github.com/rudderlabs/rudder-sdk-js/commit/80c76a1f7f27a93930a6146730ac94d945b19b25))

Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ afterEach(() => {
});

describe('Init tests', () => {
beforeEach(() => {
window.mixpanel = [];
});
let mixpanel;

test('Persistence type is missing', () => {
Expand All @@ -27,6 +30,7 @@ describe('Init tests', () => {
cross_subdomain_cookie: false,
secure_cookie: false,
persistence: 'cookie',
loaded: expect.any(Function),
});
});

Expand All @@ -40,6 +44,7 @@ describe('Init tests', () => {
cross_subdomain_cookie: false,
secure_cookie: false,
persistence: 'cookie',
loaded: expect.any(Function),
});
});

Expand All @@ -54,6 +59,7 @@ describe('Init tests', () => {
secure_cookie: false,
persistence: 'localStorage',
persistence_name: 'abc',
loaded: expect.any(Function),
});
});

Expand All @@ -67,11 +73,57 @@ describe('Init tests', () => {
cross_subdomain_cookie: false,
secure_cookie: false,
disable_persistence: true,
loaded: expect.any(Function),
});
});
});

describe('isLoaded and isReady tests', () => {
let mixpanel;

const loadSDK = () => {
setTimeout(() => {
mixpanel.isNativeSDKLoaded = true; // Change to true after 5 seconds
}, 5000); // 5 seconds
};

test('isLoaded test', () => {
mixpanel = new Mixpanel({ persistence: 'none' }, { logLevel: 'debug' });

loadSDK(); // Call loadSDK to set isNativeSDKLoaded after 5 seconds

return new Promise(resolve => {
const interval = setInterval(() => {
if (mixpanel.isLoaded()) {
clearInterval(interval);
expect(mixpanel.isLoaded()).toBe(true);
resolve(); // Resolve the promise once the expectation is met
}
}, 1000);
});
});

test('isReady test', () => {
mixpanel = new Mixpanel({ persistence: 'none' }, { logLevel: 'debug' });

loadSDK(); // Call loadSDK to set isNativeSDKLoaded after 5 seconds

return new Promise(resolve => {
const interval = setInterval(() => {
if (mixpanel.isReady()) {
clearInterval(interval);
expect(mixpanel.isReady()).toBe(true);
resolve(); // Resolve the promise once the expectation is met
}
}, 1000);
});
});
});

describe('Page tests', () => {
beforeEach(() => {
window.mixpanel = [];
});
let mixpanel;
test('should return a custom generated event name when useUserDefinedPageEventName setting is enabled and event template is provided', () => {
mixpanel = new Mixpanel(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ describe('Ninetailed Event APIs', () => {
describe('Page', () => {
let nt;
beforeEach(() => {
nt = new Ninetailed({}, { loglevel: 'DEBUG' }, destinationInfo);
nt = new Ninetailed({ sendPageInDevice: true }, { loglevel: 'DEBUG' }, destinationInfo);
window.ninetailed.page = jest.fn();
});
afterAll(() => {
Expand Down Expand Up @@ -79,6 +79,15 @@ describe('Ninetailed Event APIs', () => {
});
expect(window.ninetailed.page.mock.calls[0][0]).toEqual(undefined);
});
test('send page events toggle off', () => {
nt = new Ninetailed({ sendPageInDevice: false }, { loglevel: 'DEBUG' }, destinationInfo);
nt.page({
message: {
context: {},
},
});
expect(window.ninetailed.page).toHaveBeenCalledTimes(0);
});
});
describe('Track', () => {
let nt;
Expand Down
2 changes: 1 addition & 1 deletion packages/analytics-js-integrations/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rudderstack/analytics-js-integrations",
"version": "3.0.2",
"version": "3.0.3",
"private": true,
"description": "RudderStack JavaScript SDK device mode integrations",
"main": "dist/npm/modern/cjs/index.js",
Expand Down
6 changes: 3 additions & 3 deletions packages/analytics-js-integrations/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,9 @@
"github": {
"executor": "@jscutlery/semver:github",
"options": {
"tag": "@rudderstack/[email protected].2",
"title": "@rudderstack/[email protected].2",
"discussion-category": "@rudderstack/[email protected].2",
"tag": "@rudderstack/[email protected].3",
"title": "@rudderstack/[email protected].3",
"discussion-category": "@rudderstack/[email protected].3",
"notesFile": "./packages/analytics-js-integrations/CHANGELOG_LATEST.md"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ class Mixpanel {
this.ignoreDnt = config.ignoreDnt || false;
this.useUserDefinedPageEventName = config.useUserDefinedPageEventName || false;
this.userDefinedPageEventTemplate = config.userDefinedPageEventTemplate;
this.isNativeSDKLoaded = false;
}

init() {
Expand Down Expand Up @@ -93,16 +94,19 @@ class Mixpanel {
if (this.ignoreDnt) {
options.ignore_dnt = true;
}
options.loaded = () => {
this.isNativeSDKLoaded = true;

Check warning on line 98 in packages/analytics-js-integrations/src/integrations/Mixpanel/browser.js

View check run for this annotation

Codecov / codecov/patch

packages/analytics-js-integrations/src/integrations/Mixpanel/browser.js#L98

Added line #L98 was not covered by tests
};
window.mixpanel.init(this.token, options);
window.mixpanel.register({ mp_lib: 'Rudderstack: web' });
}

isLoaded() {
window.mixpanel.register({ mp_lib: 'Rudderstack: web' });
return !!window?.mixpanel?.config;
return this.isNativeSDKLoaded;
}

isReady() {
return !!window?.mixpanel?.config;
return this.isLoaded();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class Ninetailed {
}
this.analytics = analytics;
this.name = NAME;
this.sendPageEvents = config.sendPageInDevice;
({
shouldApplyDeviceModeTransformation: this.shouldApplyDeviceModeTransformation,
propagateEventsUntransformedOnError: this.propagateEventsUntransformedOnError,
Expand Down Expand Up @@ -51,14 +52,16 @@ class Ninetailed {
window.ninetailed.track(event, properties);
}
page(rudderElement) {
const { message } = rudderElement;
const { properties } = message;
if (properties) {
properties.url = window.location.href;
window.ninetailed.page(properties);
return;
if (this.sendPageEvents) {
const { message } = rudderElement;
const { properties } = message;
if (properties) {
properties.url = window.location.href;
window.ninetailed.page(properties);
return;
}
window.ninetailed.page();
}
window.ninetailed.page();
}
}

Expand Down
2 changes: 1 addition & 1 deletion sonar-project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ sonar.qualitygate.wait=false
sonar.projectKey=rudderlabs_rudder-sdk-js
sonar.organization=rudderlabs
sonar.projectName=rudder-sdk-js
sonar.projectVersion=3.4.0
sonar.projectVersion=3.5.0

# Meta-data for the project
sonar.links.scm=https://github.com/rudderlabs/rudder-sdk-js
Expand Down

0 comments on commit 4fa8cbb

Please sign in to comment.