diff --git a/package-lock.json b/package-lock.json index a0e9e2df1..1c553b7ca 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@rudderstack/analytics-js-monorepo", - "version": "3.24.0", + "version": "3.25.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@rudderstack/analytics-js-monorepo", - "version": "3.24.0", + "version": "3.25.0", "hasInstallScript": true, "license": "Elastic-2.0", "workspaces": [ diff --git a/package.json b/package.json index 73014ea2b..69ea8d595 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@rudderstack/analytics-js-monorepo", - "version": "3.24.0", + "version": "3.25.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 527378a04..642215c28 100644 --- a/packages/analytics-js-plugins/CHANGELOG.md +++ b/packages/analytics-js-plugins/CHANGELOG.md @@ -2,6 +2,11 @@ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). +## [3.4.4](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/analytics-js-plugins@3.4.3...@rudderstack/analytics-js-plugins@3.4.4) (2024-07-23) + +### Dependency Updates + +* `@rudderstack/analytics-js` updated to version `3.4.3` ## [3.4.3](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/analytics-js-plugins@3.4.2...@rudderstack/analytics-js-plugins@3.4.3) (2024-07-23) ### Dependency Updates diff --git a/packages/analytics-js-plugins/CHANGELOG_LATEST.md b/packages/analytics-js-plugins/CHANGELOG_LATEST.md index 97ee0484c..e29cc2873 100644 --- a/packages/analytics-js-plugins/CHANGELOG_LATEST.md +++ b/packages/analytics-js-plugins/CHANGELOG_LATEST.md @@ -1,5 +1,5 @@ -## [3.4.3](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/analytics-js-plugins@3.4.2...@rudderstack/analytics-js-plugins@3.4.3) (2024-07-23) +## [3.4.4](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/analytics-js-plugins@3.4.3...@rudderstack/analytics-js-plugins@3.4.4) (2024-07-23) ### Dependency Updates -* `@rudderstack/analytics-js` updated to version `3.4.2` +* `@rudderstack/analytics-js` updated to version `3.4.3` diff --git a/packages/analytics-js-plugins/package.json b/packages/analytics-js-plugins/package.json index b61566d3f..118f129aa 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.3", + "version": "3.4.4", "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 d8d9991e9..d20940e54 100644 --- a/packages/analytics-js-plugins/project.json +++ b/packages/analytics-js-plugins/project.json @@ -52,9 +52,9 @@ "github": { "executor": "@jscutlery/semver:github", "options": { - "tag": "@rudderstack/analytics-js-plugins@3.4.3", - "title": "@rudderstack/analytics-js-plugins@3.4.3", - "discussion-category": "@rudderstack/analytics-js-plugins@3.4.3", + "tag": "@rudderstack/analytics-js-plugins@3.4.4", + "title": "@rudderstack/analytics-js-plugins@3.4.4", + "discussion-category": "@rudderstack/analytics-js-plugins@3.4.4", "notesFile": "./packages/analytics-js-plugins/CHANGELOG_LATEST.md" } } diff --git a/packages/analytics-js/CHANGELOG.md b/packages/analytics-js/CHANGELOG.md index 182ca91b3..67ac42950 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.4](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/analytics-js@3.7.3...@rudderstack/analytics-js@3.7.4) (2024-07-23) + +### Dependency Updates + +* `@rudderstack/analytics-js-plugins` updated to version `3.7.3` + +### Bug Fixes + +* filter non errors ([#1800](https://github.com/rudderlabs/rudder-sdk-js/issues/1800)) ([73de1cc](https://github.com/rudderlabs/rudder-sdk-js/commit/73de1ccc264e9afcbae3e6d7f66e120aca81e49a)) + ## [3.7.3](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/analytics-js@3.7.2...@rudderstack/analytics-js@3.7.3) (2024-07-23) ### Dependency Updates diff --git a/packages/analytics-js/CHANGELOG_LATEST.md b/packages/analytics-js/CHANGELOG_LATEST.md index 40e637c4e..744b4fc08 100644 --- a/packages/analytics-js/CHANGELOG_LATEST.md +++ b/packages/analytics-js/CHANGELOG_LATEST.md @@ -1,10 +1,10 @@ -## [3.7.3](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/analytics-js@3.7.2...@rudderstack/analytics-js@3.7.3) (2024-07-23) +## [3.7.4](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/analytics-js@3.7.3...@rudderstack/analytics-js@3.7.4) (2024-07-23) ### Dependency Updates -* `@rudderstack/analytics-js-plugins` updated to version `3.7.2` +* `@rudderstack/analytics-js-plugins` updated to version `3.7.3` ### Bug Fixes -* filter unhandled errors by message ([#1797](https://github.com/rudderlabs/rudder-sdk-js/issues/1797)) ([2f45d00](https://github.com/rudderlabs/rudder-sdk-js/commit/2f45d001e7d9dbb70b12b017fc73bc740135e870)) +* filter non errors ([#1800](https://github.com/rudderlabs/rudder-sdk-js/issues/1800)) ([73de1cc](https://github.com/rudderlabs/rudder-sdk-js/commit/73de1ccc264e9afcbae3e6d7f66e120aca81e49a)) diff --git a/packages/analytics-js/__tests__/services/ErrorHandler/ErrorHandler.test.ts b/packages/analytics-js/__tests__/services/ErrorHandler/ErrorHandler.test.ts index 8984f0cfb..34167240f 100644 --- a/packages/analytics-js/__tests__/services/ErrorHandler/ErrorHandler.test.ts +++ b/packages/analytics-js/__tests__/services/ErrorHandler/ErrorHandler.test.ts @@ -267,12 +267,12 @@ describe('ErrorHandler', () => { it('should attach error listeners', () => { const unhandledRejectionListener = jest.spyOn(window, 'addEventListener'); errorHandlerInstance.attachErrorListeners(); - expect(unhandledRejectionListener).toHaveBeenCalledTimes(1); + expect(unhandledRejectionListener).toHaveBeenCalledTimes(2); expect(unhandledRejectionListener).toHaveBeenCalledWith('error', expect.any(Function)); - // expect(unhandledRejectionListener).toHaveBeenCalledWith( - // 'unhandledrejection', - // expect.any(Function), - // ); + expect(unhandledRejectionListener).toHaveBeenCalledWith( + 'unhandledrejection', + expect.any(Function), + ); }); it('should notify buffered errors once Error reporting plugin is loaded', () => { diff --git a/packages/analytics-js/__tests__/services/ErrorHandler/processError.test.ts b/packages/analytics-js/__tests__/services/ErrorHandler/processError.test.ts index 81c246313..af249ebdd 100644 --- a/packages/analytics-js/__tests__/services/ErrorHandler/processError.test.ts +++ b/packages/analytics-js/__tests__/services/ErrorHandler/processError.test.ts @@ -95,7 +95,7 @@ describe('ErrorHandler - getNormalizedErrorForUnhandledError', () => { expect(normalizedError).toBeUndefined(); }); - it('should return error instance for Event argument value with SDK script target', () => { + it.skip('should return error instance for Event argument value with SDK script target', () => { const event = new Event('dummyError'); const targetElement = document.createElement('script'); targetElement.dataset.loader = 'RS_JS_SDK'; diff --git a/packages/analytics-js/package.json b/packages/analytics-js/package.json index eadc7e8ed..9dae91f88 100644 --- a/packages/analytics-js/package.json +++ b/packages/analytics-js/package.json @@ -1,6 +1,6 @@ { "name": "@rudderstack/analytics-js", - "version": "3.7.3", + "version": "3.7.4", "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 675be5639..90e3cb1ad 100644 --- a/packages/analytics-js/project.json +++ b/packages/analytics-js/project.json @@ -60,9 +60,9 @@ "github": { "executor": "@jscutlery/semver:github", "options": { - "tag": "@rudderstack/analytics-js@3.7.3", - "title": "@rudderstack/analytics-js@3.7.3", - "discussion-category": "@rudderstack/analytics-js@3.7.3", + "tag": "@rudderstack/analytics-js@3.7.4", + "title": "@rudderstack/analytics-js@3.7.4", + "discussion-category": "@rudderstack/analytics-js@3.7.4", "notesFile": "./packages/analytics-js/CHANGELOG_LATEST.md" } } diff --git a/packages/analytics-js/src/services/ErrorHandler/ErrorHandler.ts b/packages/analytics-js/src/services/ErrorHandler/ErrorHandler.ts index 9e0a41f44..110c8e7a4 100644 --- a/packages/analytics-js/src/services/ErrorHandler/ErrorHandler.ts +++ b/packages/analytics-js/src/services/ErrorHandler/ErrorHandler.ts @@ -64,17 +64,12 @@ class ErrorHandler implements IErrorHandler { this.onError(event, undefined, undefined, undefined, ErrorType.UNHANDLEDEXCEPTION); }); - // TODO: uncomment this when we have a way to handle unhandledrejection for non-Error objects - // (globalThis as typeof window).addEventListener( - // 'unhandledrejection', - // (event: PromiseRejectionEvent) => { - // if (!(event.reason instanceof Error)) { - // // Prevent the default handling by the browser - // event.preventDefault(); - // } - // this.onError(event, undefined, undefined, undefined, ErrorType.UNHANDLEDREJECTION); - // }, - // ); + (globalThis as typeof window).addEventListener( + 'unhandledrejection', + (event: PromiseRejectionEvent) => { + this.onError(event, undefined, undefined, undefined, ErrorType.UNHANDLEDREJECTION); + }, + ); } else { this.logger?.debug(`Failed to attach global error listeners.`); } @@ -159,7 +154,7 @@ class ErrorHandler implements IErrorHandler { error: normalizedError, errorState, }); - } else { + } else if (normalizedError) { this.notifyError(normalizedError, errorState); } } diff --git a/packages/analytics-js/src/services/ErrorHandler/processError.ts b/packages/analytics-js/src/services/ErrorHandler/processError.ts index 3f1aebed9..8b329763c 100644 --- a/packages/analytics-js/src/services/ErrorHandler/processError.ts +++ b/packages/analytics-js/src/services/ErrorHandler/processError.ts @@ -39,26 +39,26 @@ const getNormalizedErrorForUnhandledError = (error: SDKError): SDKError | undefi return error; } // TODO: remove this block once all device mode integrations start using the v3 script loader module (TS) - if (error instanceof Event) { - const eventTarget = error.target as ErrorTarget; - // Discard all the non-script loading errors - if (eventTarget && eventTarget.localName !== 'script') { - return undefined; - } - // Discard script errors that are not originated at SDK or from native SDKs - if ( - eventTarget?.dataset && - (eventTarget.dataset.loader !== LOAD_ORIGIN || - eventTarget.dataset.isnonnativesdk !== 'true') - ) { - return undefined; - } - const errorMessage = `Error in loading a third-party script from URL ${eventTarget?.src} with ID ${eventTarget?.id}.`; - return Object.create(error, { - message: { value: errorMessage }, - }); - } - return error; + // if (error instanceof Event) { + // const eventTarget = error.target as ErrorTarget; + // // Discard all the non-script loading errors + // if (eventTarget && eventTarget.localName !== 'script') { + // return undefined; + // } + // // Discard script errors that are not originated at SDK or from native SDKs + // if ( + // eventTarget?.dataset && + // (eventTarget.dataset.loader !== LOAD_ORIGIN || + // eventTarget.dataset.isnonnativesdk !== 'true') + // ) { + // return undefined; + // } + // const errorMessage = `Error in loading a third-party script from URL ${eventTarget?.src} with ID ${eventTarget?.id}.`; + // return Object.create(error, { + // message: { value: errorMessage }, + // }); + // } + return undefined; } catch (e) { return e; } diff --git a/packages/loading-scripts/CHANGELOG.md b/packages/loading-scripts/CHANGELOG.md index 0ec0db50a..d13cef75c 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.21](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/analytics-js-loading-scripts@3.0.20...@rudderstack/analytics-js-loading-scripts@3.0.21) (2024-07-23) + +### Dependency Updates + +* `@rudderstack/analytics-js` updated to version `3.0.20` ## [3.0.20](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/analytics-js-loading-scripts@3.0.19...@rudderstack/analytics-js-loading-scripts@3.0.20) (2024-07-23) ### Dependency Updates diff --git a/packages/loading-scripts/CHANGELOG_LATEST.md b/packages/loading-scripts/CHANGELOG_LATEST.md index c4c73f576..38900a27e 100644 --- a/packages/loading-scripts/CHANGELOG_LATEST.md +++ b/packages/loading-scripts/CHANGELOG_LATEST.md @@ -1,5 +1,5 @@ -## [3.0.20](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/analytics-js-loading-scripts@3.0.19...@rudderstack/analytics-js-loading-scripts@3.0.20) (2024-07-23) +## [3.0.21](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/analytics-js-loading-scripts@3.0.20...@rudderstack/analytics-js-loading-scripts@3.0.21) (2024-07-23) ### Dependency Updates -* `@rudderstack/analytics-js` updated to version `3.0.19` +* `@rudderstack/analytics-js` updated to version `3.0.20` diff --git a/packages/loading-scripts/package.json b/packages/loading-scripts/package.json index 6452e364f..5bb91e1f2 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.20", + "version": "3.0.21", "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 60b6aed72..71f837327 100644 --- a/packages/loading-scripts/project.json +++ b/packages/loading-scripts/project.json @@ -52,9 +52,9 @@ "github": { "executor": "@jscutlery/semver:github", "options": { - "tag": "@rudderstack/analytics-js-loading-scripts@3.0.20", - "title": "@rudderstack/analytics-js-loading-scripts@3.0.20", - "discussion-category": "@rudderstack/analytics-js-loading-scripts@3.0.20", + "tag": "@rudderstack/analytics-js-loading-scripts@3.0.21", + "title": "@rudderstack/analytics-js-loading-scripts@3.0.21", + "discussion-category": "@rudderstack/analytics-js-loading-scripts@3.0.21", "notesFile": "./packages/loading-scripts/CHANGELOG_LATEST.md" } } diff --git a/packages/sanity-suite/CHANGELOG.md b/packages/sanity-suite/CHANGELOG.md index ef60ed47b..8ea319fa8 100644 --- a/packages/sanity-suite/CHANGELOG.md +++ b/packages/sanity-suite/CHANGELOG.md @@ -2,6 +2,11 @@ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). +## [3.1.11](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/analytics-js-sanity-suite@3.1.10...@rudderstack/analytics-js-sanity-suite@3.1.11) (2024-07-23) + +### Dependency Updates + +* `@rudderstack/analytics-js` updated to version `3.1.10` ## [3.1.10](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/analytics-js-sanity-suite@3.1.9...@rudderstack/analytics-js-sanity-suite@3.1.10) (2024-07-23) ### Dependency Updates diff --git a/packages/sanity-suite/package.json b/packages/sanity-suite/package.json index d0b03770b..3d7104185 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.10", + "version": "3.1.11", "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 bd2feebff..9619ed1f7 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.24.0 +sonar.projectVersion=3.25.0 # Meta-data for the project sonar.links.scm=https://github.com/rudderlabs/rudder-sdk-js