Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/hotfix/lock-components' into fea…
Browse files Browse the repository at this point in the history
…t.lock-components-version-sdk-2708
  • Loading branch information
saikumarrs committed Dec 6, 2024
2 parents 83279ae + bad60a8 commit d0bde6d
Show file tree
Hide file tree
Showing 24 changed files with 83 additions and 85 deletions.
12 changes: 6 additions & 6 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.65.0",
"version": "3.66.0",
"private": true,
"description": "Monorepo for RudderStack Analytics JS SDK",
"workspaces": [
Expand Down
6 changes: 6 additions & 0 deletions packages/analytics-js-plugins/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

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

## [3.6.17](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/[email protected]...@rudderstack/[email protected]) (2024-11-30)

### Dependency Updates

* `@rudderstack/analytics-js` updated to version `3.11.13`
* `@rudderstack/analytics-js-cookies` updated to version `0.4.15`
## [3.6.16](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/[email protected]...@rudderstack/[email protected]) (2024-11-22)

### Dependency Updates
Expand Down
7 changes: 3 additions & 4 deletions packages/analytics-js-plugins/CHANGELOG_LATEST.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
## [3.6.16](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/[email protected].15...@rudderstack/[email protected].16) (2024-11-22)
## [3.6.17](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/[email protected].16...@rudderstack/[email protected].17) (2024-11-30)

### Dependency Updates

* `@rudderstack/analytics-js-common` updated to version `3.14.12`
* `@rudderstack/analytics-js` updated to version `3.11.12`
* `@rudderstack/analytics-js-cookies` updated to version `0.4.14`
* `@rudderstack/analytics-js` updated to version `3.11.13`
* `@rudderstack/analytics-js-cookies` updated to version `0.4.15`
2 changes: 1 addition & 1 deletion packages/analytics-js-plugins/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rudderstack/analytics-js-plugins",
"version": "3.6.16",
"version": "3.6.17",
"private": true,
"description": "RudderStack JavaScript SDK plugins",
"main": "dist/npm/modern/cjs/index.cjs",
Expand Down
6 changes: 3 additions & 3 deletions packages/analytics-js-plugins/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@
"github": {
"executor": "@jscutlery/semver:github",
"options": {
"tag": "@rudderstack/[email protected].16",
"title": "@rudderstack/[email protected].16",
"discussion-category": "@rudderstack/[email protected].16",
"tag": "@rudderstack/[email protected].17",
"title": "@rudderstack/[email protected].17",
"discussion-category": "@rudderstack/[email protected].17",
"notesFile": "./packages/analytics-js-plugins/CHANGELOG_LATEST.md"
}
}
Expand Down
10 changes: 10 additions & 0 deletions packages/analytics-js/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@

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

## [3.11.14](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/[email protected]...@rudderstack/[email protected]) (2024-11-30)

### Dependency Updates

* `@rudderstack/analytics-js-plugins` updated to version `3.6.17`

### Bug Fixes

* preload events not processed with detached load call ([#1953](https://github.com/rudderlabs/rudder-sdk-js/issues/1953)) ([6b0f66f](https://github.com/rudderlabs/rudder-sdk-js/commit/6b0f66f61745542f2b01c02c99b7514fd468db80))

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

### Dependency Updates
Expand Down
11 changes: 7 additions & 4 deletions packages/analytics-js/CHANGELOG_LATEST.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
## [3.11.13](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/[email protected].12...@rudderstack/[email protected].13) (2024-11-22)
## [3.11.14](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/[email protected].13...@rudderstack/[email protected].14) (2024-11-30)

### Dependency Updates

* `@rudderstack/analytics-js-cookies` updated to version `0.4.15`
* `@rudderstack/analytics-js-common` updated to version `3.14.12`
* `@rudderstack/analytics-js-plugins` updated to version `3.6.16`
* `@rudderstack/analytics-js-plugins` updated to version `3.6.17`

### Bug Fixes

* preload events not processed with detached load call ([#1953](https://github.com/rudderlabs/rudder-sdk-js/issues/1953)) ([6b0f66f](https://github.com/rudderlabs/rudder-sdk-js/commit/6b0f66f61745542f2b01c02c99b7514fd468db80))

28 changes: 6 additions & 22 deletions packages/analytics-js/__tests__/app/RudderAnalytics.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,27 +55,6 @@ describe('Core - Rudder Analytics Facade', () => {
]);
});

it('should return an empty array when globalThis.rudderanalytics is not an array', () => {
const rudderAnalyticsInstance = new RudderAnalytics();
(globalThis as typeof window).rudderanalytics = undefined;
const result = rudderAnalyticsInstance.getPreloadedEvents();
expect(result).toEqual([]);
});

it('should return buffered events array when globalThis.rudderanalytics is an array', () => {
const bufferedEvents = [
['track'],
['consent', { sendPageEvent: true }],
['load', 'dummyWriteKey', 'dummyDataPlaneUrl', { option1: true }],
['consent', { sendPageEvent: false }],
['track'],
];
(window as any).rudderanalytics = bufferedEvents;
const rudderAnalyticsInstance = new RudderAnalytics();
const result = rudderAnalyticsInstance.getPreloadedEvents();
expect(result).toEqual(bufferedEvents);
});

it('should return the global singleton if it exists', () => {
const globalSingleton = rudderAnalytics;
rudderAnalytics = new RudderAnalytics();
Expand Down Expand Up @@ -850,7 +829,12 @@ describe('Core - Rudder Analytics Facade', () => {
enabled: true,
},
});
expect(rudderAnalyticsInstance.trackPageLifecycleEvents).toHaveBeenCalledWith([], {
expect(rudderAnalyticsInstance.trackPageLifecycleEvents).toHaveBeenCalledWith([
['consent', { sendPageEvent: true }],
['consent', { sendPageEvent: false }],
['track'],
['track'],
], {
autoTrack: {
enabled: true,
},
Expand Down
2 changes: 1 addition & 1 deletion packages/analytics-js/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rudderstack/analytics-js",
"version": "3.11.13",
"version": "3.11.14",
"description": "RudderStack JavaScript SDK",
"main": "dist/npm/modern/cjs/index.cjs",
"module": "dist/npm/modern/esm/index.mjs",
Expand Down
6 changes: 3 additions & 3 deletions packages/analytics-js/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@
"github": {
"executor": "@jscutlery/semver:github",
"options": {
"tag": "@rudderstack/[email protected].13",
"title": "@rudderstack/[email protected].13",
"discussion-category": "@rudderstack/[email protected].13",
"tag": "@rudderstack/[email protected].14",
"title": "@rudderstack/[email protected].14",
"discussion-category": "@rudderstack/[email protected].14",
"notesFile": "./packages/analytics-js/CHANGELOG_LATEST.md"
}
}
Expand Down
23 changes: 8 additions & 15 deletions packages/analytics-js/src/app/RudderAnalytics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import {
promotePreloadedConsentEventsToTop,
} from '../components/preloadBuffer';
import type { PreloadedEventCall } from '../components/preloadBuffer/types';
import { setExposedGlobal } from '../components/utilities/globals';
import { getExposedGlobal, setExposedGlobal } from '../components/utilities/globals';
import type { IAnalytics } from '../components/core/IAnalytics';
import { Analytics } from '../components/core/Analytics';
import { defaultLogger } from '../services/Logger/Logger';
Expand Down Expand Up @@ -158,7 +158,9 @@ class RudderAnalytics implements IRudderAnalytics<IAnalytics> {
}

this.setDefaultInstanceKey(writeKey);
const preloadedEventsArray = this.getPreloadedEvents();
// Get the preloaded events array from global buffer instead of window.rudderanalytics
// as the constructor must have already pushed the events to the global buffer
const preloadedEventsArray = getExposedGlobal(GLOBAL_PRELOAD_BUFFER) as PreloadedEventCall[];

// Track page loaded lifecycle event if enabled
this.trackPageLifecycleEvents(preloadedEventsArray, loadOptions);
Expand All @@ -179,17 +181,6 @@ class RudderAnalytics implements IRudderAnalytics<IAnalytics> {
}
}

/**
* A function to get preloaded events array from global object
* @returns preloaded events array
*/
// eslint-disable-next-line class-methods-use-this
getPreloadedEvents() {
return Array.isArray((globalThis as typeof window).rudderanalytics)
? ((globalThis as typeof window).rudderanalytics as unknown as PreloadedEventCall[])
: ([] as PreloadedEventCall[]);
}

/**
* A function to track page lifecycle events like page loaded and page unloaded
* @param preloadedEventsArray
Expand Down Expand Up @@ -298,15 +289,17 @@ class RudderAnalytics implements IRudderAnalytics<IAnalytics> {
* remaining preloaded events array in global object
*/
triggerBufferedLoadEvent() {
const preloadedEventsArray = this.getPreloadedEvents();
const preloadedEventsArray = Array.isArray((globalThis as typeof window).rudderanalytics)
? ((globalThis as typeof window).rudderanalytics as unknown as PreloadedEventCall[])
: ([] as PreloadedEventCall[]);

// Get any load method call that is buffered if any
// BTW, load method is also removed from the array
// So, the Analytics object can directly consume the remaining events
const loadEvent: PreloadedEventCall = getPreloadedLoadEvent(preloadedEventsArray);

// Set the final preloaded events array in global object
setExposedGlobal(GLOBAL_PRELOAD_BUFFER, clone(preloadedEventsArray));
setExposedGlobal(GLOBAL_PRELOAD_BUFFER, clone([...preloadedEventsArray]));

// Process load method if present in the buffered requests
if (loadEvent.length > 0) {
Expand Down
5 changes: 5 additions & 0 deletions packages/loading-scripts/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

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

## [3.0.57](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/[email protected]...@rudderstack/[email protected]) (2024-11-30)

### Dependency Updates

* `@rudderstack/analytics-js` updated to version `3.11.14`
## [3.0.56](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/[email protected]...@rudderstack/[email protected]) (2024-11-22)

### Dependency Updates
Expand Down
4 changes: 2 additions & 2 deletions packages/loading-scripts/CHANGELOG_LATEST.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## [3.0.56](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/[email protected].55...@rudderstack/[email protected].56) (2024-11-22)
## [3.0.57](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/[email protected].56...@rudderstack/[email protected].57) (2024-11-30)

### Dependency Updates

* `@rudderstack/analytics-js` updated to version `3.11.13`
* `@rudderstack/analytics-js` updated to version `3.11.14`
2 changes: 1 addition & 1 deletion packages/loading-scripts/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rudderstack/analytics-js-loading-scripts",
"version": "3.0.56",
"version": "3.0.57",
"private": true,
"description": "Loading script for RudderStack JavaScript SDK",
"main": "./src/index.js",
Expand Down
6 changes: 3 additions & 3 deletions packages/loading-scripts/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@
"github": {
"executor": "@jscutlery/semver:github",
"options": {
"tag": "@rudderstack/[email protected].56",
"title": "@rudderstack/[email protected].56",
"discussion-category": "@rudderstack/[email protected].56",
"tag": "@rudderstack/[email protected].57",
"title": "@rudderstack/[email protected].57",
"discussion-category": "@rudderstack/[email protected].57",
"notesFile": "./packages/loading-scripts/CHANGELOG_LATEST.md"
}
}
Expand Down
10 changes: 10 additions & 0 deletions packages/sanity-suite/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@

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

## [3.1.48](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/[email protected]...@rudderstack/[email protected]) (2024-11-30)

### Dependency Updates

* `@rudderstack/analytics-js` updated to version `3.11.14`

### Bug Fixes

* preload events not processed with detached load call ([#1953](https://github.com/rudderlabs/rudder-sdk-js/issues/1953)) ([6b0f66f](https://github.com/rudderlabs/rudder-sdk-js/commit/6b0f66f61745542f2b01c02c99b7514fd468db80))

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

### Dependency Updates
Expand Down
2 changes: 1 addition & 1 deletion packages/sanity-suite/__fixtures__/sourceConfig1.json
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@
"piiProperty": ""
}
],
"overrideClientAndSessionId": true,
"overrideClientAndSessionId": false,
"oneTrustCookieCategories": [
{
"oneTrustCookieCategory": ""
Expand Down
2 changes: 1 addition & 1 deletion packages/sanity-suite/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rudderstack/analytics-js-sanity-suite",
"version": "3.1.47",
"version": "3.1.48",
"private": true,
"description": "Sanity suite for testing JS SDK package",
"main": "./dist/v3/cdn/testBook.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@
window.manualLoad(
$('#writeKey').val(),
$('#dataplaneURL').val(),
JSON.parse($('#loadOptions').val() ? $('#loadOptions').val() : {}),
JSON.parse($('#loadOptions').val() ? $('#loadOptions').val() : {})
);
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@
window.manualLoad(
$('#writeKey').val(),
$('#dataplaneURL').val(),
JSON.parse($('#loadOptions').val() ? $('#loadOptions').val() : {}),
JSON.parse($('#loadOptions').val() ? $('#loadOptions').val() : {})
);
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,12 @@ const ignoredProperties = [
{
key: `message.integrations.Google Analytics 4 (GA4).sessionId`,
type: 'number',
optional: true,
},
{
key: `message.integrations.Google Analytics 4 (GA4).clientId`,
type: 'string',
optional: true,
},
{
key: `message.integrations.Google Analytics 4 (GA4).sessionNumber`,
Expand Down
14 changes: 0 additions & 14 deletions packages/sanity-suite/src/testBook/TestBook.js
Original file line number Diff line number Diff line change
Expand Up @@ -319,10 +319,6 @@ class TestBook {
const statusElement = document.getElementById(`test-case-status-${testCaseId}`);
statusElement.textContent = assertionResult;
statusElement.className = `badge badge-${assertionResult} testCaseStatus`;
statusElement.scrollIntoView({
behavior: 'smooth',
block: 'center',
});

const viewDiffElement = document.getElementById(`view-diff-${testCaseId}`);
if (assertionResult === 'success') {
Expand Down Expand Up @@ -360,16 +356,6 @@ class TestBook {
const resultStatusElement = document.getElementById('resultStatus');
resultStatusElement.innerHTML = finalStatus;
resultStatusElement.className = `badge badge-${finalStatus}`;

// We need to use a timeout to ensure the scrollIntoView is called after the
// last test case result scrolling has been completed
// Otherwise the scrollIntoView will not work as expected
setTimeout(() => {
resultStatusElement.scrollIntoView({
behavior: 'smooth',
block: 'center',
});
}, 1000);
}

executeNextTestCase() {
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.65.0
sonar.projectVersion=3.66.0

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

0 comments on commit d0bde6d

Please sign in to comment.