From 1aca5a0351b44d0dd1d2b91fa7475f86f330ba3f Mon Sep 17 00:00:00 2001 From: Sai Kumar Battinoju <88789928+saikumarrs@users.noreply.github.com> Date: Thu, 10 Oct 2024 12:21:42 +0530 Subject: [PATCH 1/6] fix: avoid using requestAnimationFrame for polling (#1878) --- .../src/deviceModeDestinations/constants.ts | 8 ++++- .../src/deviceModeDestinations/utils.ts | 34 +++++++++++-------- 2 files changed, 27 insertions(+), 15 deletions(-) diff --git a/packages/analytics-js-plugins/src/deviceModeDestinations/constants.ts b/packages/analytics-js-plugins/src/deviceModeDestinations/constants.ts index 65b0ce0a05..b2bb0d2fd6 100644 --- a/packages/analytics-js-plugins/src/deviceModeDestinations/constants.ts +++ b/packages/analytics-js-plugins/src/deviceModeDestinations/constants.ts @@ -1,6 +1,12 @@ const READY_CHECK_TIMEOUT_MS = 11 * 1000; // 11 seconds const SCRIPT_LOAD_TIMEOUT_MS = 10 * 1000; // 10 seconds +const READY_CHECK_INTERVAL_MS = 100; // 100 milliseconds const DEVICE_MODE_DESTINATIONS_PLUGIN = 'DeviceModeDestinationsPlugin'; -export { READY_CHECK_TIMEOUT_MS, DEVICE_MODE_DESTINATIONS_PLUGIN, SCRIPT_LOAD_TIMEOUT_MS }; +export { + READY_CHECK_TIMEOUT_MS, + DEVICE_MODE_DESTINATIONS_PLUGIN, + SCRIPT_LOAD_TIMEOUT_MS, + READY_CHECK_INTERVAL_MS, +}; diff --git a/packages/analytics-js-plugins/src/deviceModeDestinations/utils.ts b/packages/analytics-js-plugins/src/deviceModeDestinations/utils.ts index 84077655f5..bd6d8dfc19 100644 --- a/packages/analytics-js-plugins/src/deviceModeDestinations/utils.ts +++ b/packages/analytics-js-plugins/src/deviceModeDestinations/utils.ts @@ -19,7 +19,11 @@ import type { AnonymousIdOptions } from '@rudderstack/analytics-js-common/types/ import { checks } from '../shared-chunks/common'; import { eventMethodOverloads, destinations } from '../shared-chunks/deviceModeDestinations'; import type { DeviceModeDestinationsAnalyticsInstance } from './types'; -import { DEVICE_MODE_DESTINATIONS_PLUGIN, READY_CHECK_TIMEOUT_MS } from './constants'; +import { + DEVICE_MODE_DESTINATIONS_PLUGIN, + READY_CHECK_INTERVAL_MS, + READY_CHECK_TIMEOUT_MS, +} from './constants'; import { DESTINATION_INIT_ERROR, DESTINATION_INTEGRATIONS_DATA_ERROR, @@ -137,24 +141,26 @@ const createDestinationInstance = ( return deviceModeDestination; }; -const isDestinationReady = (dest: Destination) => +const isDestinationReady = (dest: Destination, time = 0) => new Promise((resolve, reject) => { const instance = dest.instance as DeviceModeDestination; - let handleNumber: number; - const checkReady = () => { - if (instance.isLoaded() && (!instance.isReady || instance.isReady())) { - resolve(true); - } else { - handleNumber = globalThis.requestAnimationFrame(checkReady); - } - }; - checkReady(); - setTimeout(() => { - globalThis.cancelAnimationFrame(handleNumber); + if (instance.isLoaded() && (!instance.isReady || instance.isReady())) { + resolve(true); + } else if (time >= READY_CHECK_TIMEOUT_MS) { reject( new Error(DESTINATION_READY_TIMEOUT_ERROR(READY_CHECK_TIMEOUT_MS, dest.userFriendlyId)), ); - }, READY_CHECK_TIMEOUT_MS); + } else { + const curTime = Date.now(); + wait(READY_CHECK_INTERVAL_MS) + .then(() => { + const elapsedTime = Date.now() - curTime; + isDestinationReady(dest, time + elapsedTime) + .then(resolve) + .catch(err => reject(err)); + }) + .catch(err => reject(err)); + } }); /** From b6a7f4443eee25385466f10575b40dd2d497bbf2 Mon Sep 17 00:00:00 2001 From: GitHub actions Date: Thu, 10 Oct 2024 06:53:30 +0000 Subject: [PATCH 2/6] chore(@rudderstack/analytics-js): release version 3.7.16 --- packages/analytics-js/CHANGELOG.md | 10 ++++++++++ packages/analytics-js/package.json | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/packages/analytics-js/CHANGELOG.md b/packages/analytics-js/CHANGELOG.md index 9f74d37513..efe9d7de57 100644 --- a/packages/analytics-js/CHANGELOG.md +++ b/packages/analytics-js/CHANGELOG.md @@ -2,6 +2,16 @@ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). +## [3.7.16](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/analytics-js@3.7.15...@rudderstack/analytics-js@3.7.16) (2024-10-10) + +### Dependency Updates + +* `@rudderstack/analytics-js-plugins` updated to version `3.4.15` + +### Bug Fixes + +* source config fixture and local storage issue ([cbf0833](https://github.com/rudderlabs/rudder-sdk-js/commit/cbf08337f2a4dfdb0566ef60ef0dcf4c53ce8e00)) + ## [3.7.15](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/analytics-js@3.7.14...@rudderstack/analytics-js@3.7.15) (2024-10-03) ### Dependency Updates diff --git a/packages/analytics-js/package.json b/packages/analytics-js/package.json index 27c472d227..37034e3a76 100644 --- a/packages/analytics-js/package.json +++ b/packages/analytics-js/package.json @@ -1,6 +1,6 @@ { "name": "@rudderstack/analytics-js", - "version": "3.7.15", + "version": "3.7.16", "description": "RudderStack JavaScript SDK", "main": "dist/npm/modern/cjs/index.cjs", "module": "dist/npm/modern/esm/index.mjs", From 3966b8dad019d1271dc39e3ea7879b3a93bfbf35 Mon Sep 17 00:00:00 2001 From: GitHub actions Date: Thu, 10 Oct 2024 06:53:31 +0000 Subject: [PATCH 3/6] chore(@rudderstack/analytics-js-plugins): release version 3.4.16 --- packages/analytics-js-plugins/CHANGELOG.md | 10 ++++++++++ packages/analytics-js-plugins/package.json | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/packages/analytics-js-plugins/CHANGELOG.md b/packages/analytics-js-plugins/CHANGELOG.md index a96d39ac94..75ebe00aac 100644 --- a/packages/analytics-js-plugins/CHANGELOG.md +++ b/packages/analytics-js-plugins/CHANGELOG.md @@ -2,6 +2,16 @@ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). +## [3.4.16](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/analytics-js-plugins@3.4.15...@rudderstack/analytics-js-plugins@3.4.16) (2024-10-10) + +### Dependency Updates + +* `@rudderstack/analytics-js` updated to version `3.7.16` + +### Bug Fixes + +* avoid using requestAnimationFrame for polling ([#1878](https://github.com/rudderlabs/rudder-sdk-js/issues/1878)) ([1aca5a0](https://github.com/rudderlabs/rudder-sdk-js/commit/1aca5a0351b44d0dd1d2b91fa7475f86f330ba3f)) + ## [3.4.15](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/analytics-js-plugins@3.4.14...@rudderstack/analytics-js-plugins@3.4.15) (2024-10-03) ### Dependency Updates diff --git a/packages/analytics-js-plugins/package.json b/packages/analytics-js-plugins/package.json index bdfb36e525..3f8ae93db4 100644 --- a/packages/analytics-js-plugins/package.json +++ b/packages/analytics-js-plugins/package.json @@ -1,6 +1,6 @@ { "name": "@rudderstack/analytics-js-plugins", - "version": "3.4.15", + "version": "3.4.16", "private": true, "description": "RudderStack JavaScript SDK plugins", "main": "dist/npm/modern/cjs/index.cjs", From ec7c060ef7cc17b9e1ceff36f29d50969fed56d9 Mon Sep 17 00:00:00 2001 From: GitHub actions Date: Thu, 10 Oct 2024 06:53:32 +0000 Subject: [PATCH 4/6] chore(@rudderstack/analytics-js-sanity-suite): release version 3.1.24 --- packages/sanity-suite/CHANGELOG.md | 10 ++++++++++ packages/sanity-suite/package.json | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/packages/sanity-suite/CHANGELOG.md b/packages/sanity-suite/CHANGELOG.md index 25416a7d85..b188a88beb 100644 --- a/packages/sanity-suite/CHANGELOG.md +++ b/packages/sanity-suite/CHANGELOG.md @@ -2,6 +2,16 @@ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). +## [3.1.24](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/analytics-js-sanity-suite@3.1.23...@rudderstack/analytics-js-sanity-suite@3.1.24) (2024-10-10) + +### Dependency Updates + +* `@rudderstack/analytics-js` updated to version `3.7.16` + +### Bug Fixes + +* source config fixture and local storage issue ([cbf0833](https://github.com/rudderlabs/rudder-sdk-js/commit/cbf08337f2a4dfdb0566ef60ef0dcf4c53ce8e00)) + ## [3.1.23](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/analytics-js-sanity-suite@3.1.22...@rudderstack/analytics-js-sanity-suite@3.1.23) (2024-10-03) ### Dependency Updates diff --git a/packages/sanity-suite/package.json b/packages/sanity-suite/package.json index e6e3761421..de0ccbc38c 100644 --- a/packages/sanity-suite/package.json +++ b/packages/sanity-suite/package.json @@ -1,6 +1,6 @@ { "name": "@rudderstack/analytics-js-sanity-suite", - "version": "3.1.23", + "version": "3.1.24", "private": true, "description": "Sanity suite for testing JS SDK package", "main": "./dist/v3/cdn/testBook.js", From f59820704150279f2be6df132e788fca45b62d8e Mon Sep 17 00:00:00 2001 From: GitHub actions Date: Thu, 10 Oct 2024 06:53:33 +0000 Subject: [PATCH 5/6] chore(@rudderstack/analytics-js-loading-scripts): release version 3.0.33 --- packages/loading-scripts/CHANGELOG.md | 5 +++++ packages/loading-scripts/package.json | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/loading-scripts/CHANGELOG.md b/packages/loading-scripts/CHANGELOG.md index 4566f85dc8..35985b017d 100644 --- a/packages/loading-scripts/CHANGELOG.md +++ b/packages/loading-scripts/CHANGELOG.md @@ -2,6 +2,11 @@ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). +## [3.0.33](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/analytics-js-loading-scripts@3.0.32...@rudderstack/analytics-js-loading-scripts@3.0.33) (2024-10-10) + +### Dependency Updates + +* `@rudderstack/analytics-js` updated to version `3.7.16` ## [3.0.32](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/analytics-js-loading-scripts@3.0.31...@rudderstack/analytics-js-loading-scripts@3.0.32) (2024-10-03) ### Dependency Updates diff --git a/packages/loading-scripts/package.json b/packages/loading-scripts/package.json index 7cc58e8a9e..5379a07092 100644 --- a/packages/loading-scripts/package.json +++ b/packages/loading-scripts/package.json @@ -1,6 +1,6 @@ { "name": "@rudderstack/analytics-js-loading-scripts", - "version": "3.0.32", + "version": "3.0.33", "private": true, "description": "Loading script for RudderStack JavaScript SDK", "main": "./src/index.js", From 73579b0b8885561239cb9daaee51df31f65fd670 Mon Sep 17 00:00:00 2001 From: GitHub actions Date: Thu, 10 Oct 2024 06:53:44 +0000 Subject: [PATCH 6/6] chore(monorepo): sync versions and generate release logs --- package-lock.json | 12 ++++++------ package.json | 2 +- packages/analytics-js-plugins/CHANGELOG_LATEST.md | 10 +++++++--- packages/analytics-js-plugins/project.json | 6 +++--- packages/analytics-js/CHANGELOG_LATEST.md | 4 ++-- packages/analytics-js/project.json | 6 +++--- packages/loading-scripts/CHANGELOG_LATEST.md | 4 ++-- packages/loading-scripts/project.json | 6 +++--- sonar-project.properties | 2 +- 9 files changed, 28 insertions(+), 24 deletions(-) diff --git a/package-lock.json b/package-lock.json index 4bd7423338..aea3e65897 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@rudderstack/analytics-js-monorepo", - "version": "3.39.0", + "version": "3.40.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@rudderstack/analytics-js-monorepo", - "version": "3.39.0", + "version": "3.40.0", "hasInstallScript": true, "license": "Elastic-2.0", "workspaces": [ @@ -25265,7 +25265,7 @@ }, "packages/analytics-js": { "name": "@rudderstack/analytics-js", - "version": "3.7.15", + "version": "3.7.16", "license": "Elastic-2.0", "dependencies": { "@preact/signals-core": "1.8.0", @@ -25325,7 +25325,7 @@ }, "packages/analytics-js-plugins": { "name": "@rudderstack/analytics-js-plugins", - "version": "3.4.15", + "version": "3.4.16", "license": "Elastic-2.0", "dependencies": { "@rudderstack/analytics-js-common": "*", @@ -25369,7 +25369,7 @@ }, "packages/loading-scripts": { "name": "@rudderstack/analytics-js-loading-scripts", - "version": "3.0.32", + "version": "3.0.33", "license": "Elastic-2.0", "dependencies": { "@rudderstack/analytics-js": "*" @@ -25378,7 +25378,7 @@ }, "packages/sanity-suite": { "name": "@rudderstack/analytics-js-sanity-suite", - "version": "3.1.23", + "version": "3.1.24", "license": "Elastic-2.0", "dependencies": { "@rudderstack/analytics-js": "*", diff --git a/package.json b/package.json index 162750feff..5c02e069d6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@rudderstack/analytics-js-monorepo", - "version": "3.39.0", + "version": "3.40.0", "private": true, "description": "Monorepo for RudderStack Analytics JS SDK", "workspaces": [ diff --git a/packages/analytics-js-plugins/CHANGELOG_LATEST.md b/packages/analytics-js-plugins/CHANGELOG_LATEST.md index 6c0ad1498a..96932b1758 100644 --- a/packages/analytics-js-plugins/CHANGELOG_LATEST.md +++ b/packages/analytics-js-plugins/CHANGELOG_LATEST.md @@ -1,6 +1,10 @@ -## [3.4.15](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/analytics-js-plugins@3.4.14...@rudderstack/analytics-js-plugins@3.4.15) (2024-10-03) +## [3.4.16](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/analytics-js-plugins@3.4.15...@rudderstack/analytics-js-plugins@3.4.16) (2024-10-10) ### Dependency Updates -* `@rudderstack/analytics-js` updated to version `3.7.14` -* `@rudderstack/analytics-js-cookies` updated to version `0.3.9` +* `@rudderstack/analytics-js` updated to version `3.7.16` + +### Bug Fixes + +* avoid using requestAnimationFrame for polling ([#1878](https://github.com/rudderlabs/rudder-sdk-js/issues/1878)) ([1aca5a0](https://github.com/rudderlabs/rudder-sdk-js/commit/1aca5a0351b44d0dd1d2b91fa7475f86f330ba3f)) + diff --git a/packages/analytics-js-plugins/project.json b/packages/analytics-js-plugins/project.json index c79b679d2f..97b0520dd0 100644 --- a/packages/analytics-js-plugins/project.json +++ b/packages/analytics-js-plugins/project.json @@ -51,9 +51,9 @@ "github": { "executor": "@jscutlery/semver:github", "options": { - "tag": "@rudderstack/analytics-js-plugins@3.4.15", - "title": "@rudderstack/analytics-js-plugins@3.4.15", - "discussion-category": "@rudderstack/analytics-js-plugins@3.4.15", + "tag": "@rudderstack/analytics-js-plugins@3.4.16", + "title": "@rudderstack/analytics-js-plugins@3.4.16", + "discussion-category": "@rudderstack/analytics-js-plugins@3.4.16", "notesFile": "./packages/analytics-js-plugins/CHANGELOG_LATEST.md" } } diff --git a/packages/analytics-js/CHANGELOG_LATEST.md b/packages/analytics-js/CHANGELOG_LATEST.md index d2f5050337..806f96b39f 100644 --- a/packages/analytics-js/CHANGELOG_LATEST.md +++ b/packages/analytics-js/CHANGELOG_LATEST.md @@ -1,4 +1,4 @@ -## [3.7.15](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/analytics-js@3.7.14...@rudderstack/analytics-js@3.7.15) (2024-10-03) +## [3.7.16](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/analytics-js@3.7.15...@rudderstack/analytics-js@3.7.16) (2024-10-10) ### Dependency Updates @@ -6,5 +6,5 @@ ### Bug Fixes -* storage access error when cookies are blocked ([#1872](https://github.com/rudderlabs/rudder-sdk-js/issues/1872)) ([966dbc2](https://github.com/rudderlabs/rudder-sdk-js/commit/966dbc2996b0ee292a553058ef435154de73f42e)) +* source config fixture and local storage issue ([cbf0833](https://github.com/rudderlabs/rudder-sdk-js/commit/cbf08337f2a4dfdb0566ef60ef0dcf4c53ce8e00)) diff --git a/packages/analytics-js/project.json b/packages/analytics-js/project.json index 8919ca54f5..48428fafc4 100644 --- a/packages/analytics-js/project.json +++ b/packages/analytics-js/project.json @@ -59,9 +59,9 @@ "github": { "executor": "@jscutlery/semver:github", "options": { - "tag": "@rudderstack/analytics-js@3.7.15", - "title": "@rudderstack/analytics-js@3.7.15", - "discussion-category": "@rudderstack/analytics-js@3.7.15", + "tag": "@rudderstack/analytics-js@3.7.16", + "title": "@rudderstack/analytics-js@3.7.16", + "discussion-category": "@rudderstack/analytics-js@3.7.16", "notesFile": "./packages/analytics-js/CHANGELOG_LATEST.md" } } diff --git a/packages/loading-scripts/CHANGELOG_LATEST.md b/packages/loading-scripts/CHANGELOG_LATEST.md index 33d46af6c3..56fddae534 100644 --- a/packages/loading-scripts/CHANGELOG_LATEST.md +++ b/packages/loading-scripts/CHANGELOG_LATEST.md @@ -1,5 +1,5 @@ -## [3.0.32](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/analytics-js-loading-scripts@3.0.31...@rudderstack/analytics-js-loading-scripts@3.0.32) (2024-10-03) +## [3.0.33](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/analytics-js-loading-scripts@3.0.32...@rudderstack/analytics-js-loading-scripts@3.0.33) (2024-10-10) ### Dependency Updates -* `@rudderstack/analytics-js` updated to version `3.7.15` +* `@rudderstack/analytics-js` updated to version `3.7.16` diff --git a/packages/loading-scripts/project.json b/packages/loading-scripts/project.json index d4d6ba90b4..1c320a0fc5 100644 --- a/packages/loading-scripts/project.json +++ b/packages/loading-scripts/project.json @@ -51,9 +51,9 @@ "github": { "executor": "@jscutlery/semver:github", "options": { - "tag": "@rudderstack/analytics-js-loading-scripts@3.0.32", - "title": "@rudderstack/analytics-js-loading-scripts@3.0.32", - "discussion-category": "@rudderstack/analytics-js-loading-scripts@3.0.32", + "tag": "@rudderstack/analytics-js-loading-scripts@3.0.33", + "title": "@rudderstack/analytics-js-loading-scripts@3.0.33", + "discussion-category": "@rudderstack/analytics-js-loading-scripts@3.0.33", "notesFile": "./packages/loading-scripts/CHANGELOG_LATEST.md" } } diff --git a/sonar-project.properties b/sonar-project.properties index 623e1517c7..b0c0e92d43 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -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.39.0 +sonar.projectVersion=3.40.0 # Meta-data for the project sonar.links.scm=https://github.com/rudderlabs/rudder-sdk-js