diff --git a/package-lock.json b/package-lock.json index 4bd742333..aea3e6589 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 162750fef..5c02e069d 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.md b/packages/analytics-js-plugins/CHANGELOG.md index a96d39ac9..75ebe00aa 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/CHANGELOG_LATEST.md b/packages/analytics-js-plugins/CHANGELOG_LATEST.md index 6c0ad1498..96932b175 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/package.json b/packages/analytics-js-plugins/package.json index bdfb36e52..3f8ae93db 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", diff --git a/packages/analytics-js-plugins/project.json b/packages/analytics-js-plugins/project.json index c79b679d2..97b0520dd 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-plugins/src/deviceModeDestinations/constants.ts b/packages/analytics-js-plugins/src/deviceModeDestinations/constants.ts index 65b0ce0a0..b2bb0d2fd 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 84077655f..bd6d8dfc1 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)); + } }); /** diff --git a/packages/analytics-js/CHANGELOG.md b/packages/analytics-js/CHANGELOG.md index 9f74d3751..efe9d7de5 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/CHANGELOG_LATEST.md b/packages/analytics-js/CHANGELOG_LATEST.md index d2f505033..806f96b39 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/package.json b/packages/analytics-js/package.json index 27c472d22..37034e3a7 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", diff --git a/packages/analytics-js/project.json b/packages/analytics-js/project.json index 8919ca54f..48428fafc 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.md b/packages/loading-scripts/CHANGELOG.md index 4566f85dc..35985b017 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/CHANGELOG_LATEST.md b/packages/loading-scripts/CHANGELOG_LATEST.md index 33d46af6c..56fddae53 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/package.json b/packages/loading-scripts/package.json index 7cc58e8a9..5379a0709 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", diff --git a/packages/loading-scripts/project.json b/packages/loading-scripts/project.json index d4d6ba90b..1c320a0fc 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/packages/sanity-suite/CHANGELOG.md b/packages/sanity-suite/CHANGELOG.md index 25416a7d8..b188a88be 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 e6e376142..de0ccbc38 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", diff --git a/sonar-project.properties b/sonar-project.properties index 623e1517c..b0c0e92d4 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