From 849461b056ea6f5ff09007ceac59ec892d8045b1 Mon Sep 17 00:00:00 2001 From: Jaissica Hora Date: Tue, 9 Sep 2025 15:57:26 -0400 Subject: [PATCH 1/8] feat: added use method for rokt kit --- snippet.js | 1 + snippet.rokt.js | 1 + src/roktManager.ts | 14 +++++ test/jest/roktManager.spec.ts | 98 +++++++++++++++++++++++++---------- test/snippet/tests-snippet.js | 2 + 5 files changed, 89 insertions(+), 27 deletions(-) diff --git a/snippet.js b/snippet.js index c8c3112fa..1388d54fb 100644 --- a/snippet.js +++ b/snippet.js @@ -49,6 +49,7 @@ 'selectPlacements', 'hashAttributes', 'setExtensionData', + 'use', ]; // iterates through methods above to create stubs diff --git a/snippet.rokt.js b/snippet.rokt.js index a4155927a..2b179c9c3 100644 --- a/snippet.rokt.js +++ b/snippet.rokt.js @@ -49,6 +49,7 @@ 'selectPlacements', 'hashAttributes', 'setExtensionData', + 'use', ]; // iterates through methods above to create stubs diff --git a/src/roktManager.ts b/src/roktManager.ts index 9a2527f6c..fc668eaad 100644 --- a/src/roktManager.ts +++ b/src/roktManager.ts @@ -38,6 +38,7 @@ export interface IRoktSelection { export interface IRoktLauncher { selectPlacements: (options: IRoktSelectPlacementsOptions) => Promise; hashAttributes: (attributes: IRoktPartnerAttributes) => Promise>; + use: (name: string) => Promise; } export interface IRoktMessage { @@ -62,6 +63,7 @@ export interface IRoktKit { hashAttributes: (attributes: IRoktPartnerAttributes) => Promise>; selectPlacements: (options: IRoktSelectPlacementsOptions) => Promise; setExtensionData(extensionData: IRoktPartnerExtensionData): void; + use: (name: string) => Promise; launcherOptions?: Dictionary; } @@ -251,6 +253,18 @@ export default class RoktManager { } } + public use(name: string): Promise { + if (!this.isReady()) { + return this.deferredCall('use', name); + } + + try { + return this.kit.use(name); + } catch (error) { + return Promise.reject(error instanceof Error ? error : new Error('Unknown error occurred')); + } + } + public getLocalSessionAttributes(): LocalSessionAttributes { return this.store.getLocalSessionAttributes(); } diff --git a/test/jest/roktManager.spec.ts b/test/jest/roktManager.spec.ts index 3529b5909..4a46ce208 100644 --- a/test/jest/roktManager.spec.ts +++ b/test/jest/roktManager.spec.ts @@ -84,13 +84,15 @@ describe('RoktManager', () => { const kit: IRoktKit = { launcher: { selectPlacements: jest.fn(), - hashAttributes: jest.fn() + hashAttributes: jest.fn(), + use: jest.fn(), }, filters: undefined, filteredUser: undefined, hashAttributes: jest.fn(), selectPlacements: jest.fn(), setExtensionData: jest.fn(), + use: jest.fn(), userAttributes: undefined, }; @@ -106,13 +108,15 @@ describe('RoktManager', () => { const kit: IRoktKit = { launcher: { selectPlacements: jest.fn(), - hashAttributes: jest.fn() + hashAttributes: jest.fn(), + use: jest.fn(), }, filters: undefined, filteredUser: undefined, hashAttributes: jest.fn(), selectPlacements: jest.fn(), setExtensionData: jest.fn(), + use: jest.fn(), userAttributes: undefined, }; @@ -145,13 +149,15 @@ describe('RoktManager', () => { const kit: IRoktKit = { launcher: { selectPlacements: jest.fn(), - hashAttributes: jest.fn() + hashAttributes: jest.fn(), + use: jest.fn(), }, filters: undefined, filteredUser: undefined, hashAttributes: jest.fn(), selectPlacements: jest.fn(), setExtensionData: jest.fn(), + use: jest.fn(), userAttributes: undefined, }; @@ -177,7 +183,8 @@ describe('RoktManager', () => { const kit: Partial = { launcher: { selectPlacements: jest.fn(), - hashAttributes: jest.fn() + hashAttributes: jest.fn(), + use: jest.fn(), }, // We are mocking the hashAttributes method to return the @@ -364,14 +371,16 @@ describe('RoktManager', () => { const kit: IRoktKit = { launcher: { selectPlacements: jest.fn(), - hashAttributes: jest.fn() + hashAttributes: jest.fn(), + use: jest.fn(), }, filters: undefined, filteredUser: undefined, userAttributes: undefined, selectPlacements: jest.fn(), hashAttributes: jest.fn(), - setExtensionData: jest.fn() + setExtensionData: jest.fn(), + use: jest.fn(), }; roktManager.attachKit(kit); @@ -384,14 +393,16 @@ describe('RoktManager', () => { const kit: IRoktKit = { launcher: { selectPlacements: jest.fn(), - hashAttributes: jest.fn() + hashAttributes: jest.fn(), + use: jest.fn(), }, filters: undefined, selectPlacements: jest.fn(), hashAttributes: jest.fn(), filteredUser: undefined, userAttributes: undefined, - setExtensionData: jest.fn() + setExtensionData: jest.fn(), + use: jest.fn(), }; @@ -420,7 +431,8 @@ describe('RoktManager', () => { const kit: IRoktKit = { launcher: { selectPlacements: jest.fn(), - hashAttributes: jest.fn() + hashAttributes: jest.fn(), + use: jest.fn(), }, filters: undefined, filteredUser: undefined, @@ -428,6 +440,7 @@ describe('RoktManager', () => { selectPlacements: jest.fn(), hashAttributes: jest.fn(), setExtensionData: jest.fn(), + use: jest.fn(), }; roktManager.attachKit(kit); @@ -444,14 +457,16 @@ describe('RoktManager', () => { const kit: IRoktKit = { launcher: { selectPlacements: jest.fn(), - hashAttributes: jest.fn() + hashAttributes: jest.fn(), + use: jest.fn(), }, filters: undefined, filteredUser: undefined, userAttributes: undefined, - selectPlacements: jest.fn(), + selectPlacements: jest.fn(), hashAttributes: jest.fn(), setExtensionData: jest.fn(), + use: jest.fn(), }; roktManager.attachKit(kit); @@ -489,7 +504,8 @@ describe('RoktManager', () => { const kit: IRoktKit = { launcher: { selectPlacements: jest.fn(), - hashAttributes: jest.fn() + hashAttributes: jest.fn(), + use: jest.fn(), }, filters: undefined, filteredUser: undefined, @@ -497,6 +513,7 @@ describe('RoktManager', () => { selectPlacements: jest.fn().mockResolvedValue(expectedResult), hashAttributes: jest.fn(), setExtensionData: jest.fn(), + use: jest.fn(), }; const options = { @@ -535,7 +552,8 @@ describe('RoktManager', () => { const kit: IRoktKit = { launcher: { selectPlacements: jest.fn(), - hashAttributes: jest.fn() + hashAttributes: jest.fn(), + use: jest.fn(), }, filters: undefined, filteredUser: undefined, @@ -551,6 +569,7 @@ describe('RoktManager', () => { }), hashAttributes: jest.fn(), setExtensionData: jest.fn(), + use: jest.fn(), }; roktManager.attachKit(kit); @@ -574,7 +593,8 @@ describe('RoktManager', () => { const kit: IRoktKit = { launcher: { selectPlacements: jest.fn(), - hashAttributes: jest.fn() + hashAttributes: jest.fn(), + use: jest.fn(), }, filters: undefined, filteredUser: undefined, @@ -582,6 +602,7 @@ describe('RoktManager', () => { setExtensionData: jest.fn(), hashAttributes: jest.fn(), userAttributes: undefined, + use: jest.fn(), }; roktManager.attachKit(kit); @@ -602,7 +623,8 @@ describe('RoktManager', () => { const kit: IRoktKit = { launcher: { selectPlacements: jest.fn(), - hashAttributes: jest.fn() + hashAttributes: jest.fn(), + use: jest.fn(), }, filters: undefined, filteredUser: undefined, @@ -610,6 +632,7 @@ describe('RoktManager', () => { selectPlacements: jest.fn(), hashAttributes: jest.fn(), setExtensionData: jest.fn(), + use: jest.fn(), }; roktManager.attachKit(kit); @@ -632,7 +655,8 @@ describe('RoktManager', () => { const kit: IRoktKit = { launcher: { selectPlacements: jest.fn(), - hashAttributes: jest.fn() + hashAttributes: jest.fn(), + use: jest.fn(), }, filters: undefined, filteredUser: undefined, @@ -640,6 +664,7 @@ describe('RoktManager', () => { setExtensionData: jest.fn(), hashAttributes: jest.fn(), userAttributes: undefined, + use: jest.fn(), }; roktManager.attachKit(kit); @@ -661,11 +686,13 @@ describe('RoktManager', () => { const kit: Partial = { launcher: { selectPlacements: jest.fn(), - hashAttributes: jest.fn() + hashAttributes: jest.fn(), + use: jest.fn(), }, hashAttributes: jest.fn(), selectPlacements: jest.fn(), - setExtensionData: jest.fn() + setExtensionData: jest.fn(), + use: jest.fn(), }; roktManager.kit = kit as IRoktKit; @@ -708,11 +735,13 @@ describe('RoktManager', () => { const kit: Partial = { launcher: { selectPlacements: jest.fn(), - hashAttributes: jest.fn() + hashAttributes: jest.fn(), + use: jest.fn(), }, hashAttributes: jest.fn(), selectPlacements: jest.fn(), setExtensionData: jest.fn(), + use: jest.fn(), }; roktManager.kit = kit as IRoktKit; @@ -735,11 +764,13 @@ describe('RoktManager', () => { const kit: Partial = { launcher: { selectPlacements: jest.fn(), - hashAttributes: jest.fn() + hashAttributes: jest.fn(), + use: jest.fn(), }, selectPlacements: jest.fn(), hashAttributes: jest.fn(), setExtensionData: jest.fn(), + use: jest.fn(), }; roktManager.kit = kit as IRoktKit; @@ -784,11 +815,13 @@ describe('RoktManager', () => { const kit: Partial = { launcher: { selectPlacements: jest.fn(), - hashAttributes: jest.fn() + hashAttributes: jest.fn(), + use: jest.fn(), }, selectPlacements: jest.fn(), hashAttributes: jest.fn(), setExtensionData: jest.fn(), + use: jest.fn(), }; roktManager.kit = kit as IRoktKit; @@ -813,11 +846,13 @@ describe('RoktManager', () => { const kit: Partial = { launcher: { selectPlacements: jest.fn(), - hashAttributes: jest.fn() + hashAttributes: jest.fn(), + use: jest.fn(), }, selectPlacements: jest.fn().mockResolvedValue({}), hashAttributes: jest.fn(), setExtensionData: jest.fn(), + use: jest.fn(), }; roktManager.kit = kit as IRoktKit; @@ -865,11 +900,13 @@ describe('RoktManager', () => { const kit: Partial = { launcher: { selectPlacements: jest.fn(), - hashAttributes: jest.fn() + hashAttributes: jest.fn(), + use: jest.fn(), }, selectPlacements: jest.fn(), hashAttributes: jest.fn(), setExtensionData: jest.fn(), + use: jest.fn(), }; roktManager.kit = kit as IRoktKit; @@ -905,11 +942,13 @@ describe('RoktManager', () => { const kit: Partial = { launcher: { selectPlacements: jest.fn(), - hashAttributes: jest.fn() + hashAttributes: jest.fn(), + use: jest.fn(), }, selectPlacements: jest.fn(), hashAttributes: jest.fn(), setExtensionData: jest.fn(), + use: jest.fn(), }; roktManager.kit = kit as IRoktKit; @@ -949,11 +988,13 @@ describe('RoktManager', () => { const kit: Partial = { launcher: { selectPlacements: jest.fn(), - hashAttributes: jest.fn() + hashAttributes: jest.fn(), + use: jest.fn(), }, selectPlacements: jest.fn().mockResolvedValue({}), hashAttributes: jest.fn(), setExtensionData: jest.fn(), + use: jest.fn(), }; roktManager.kit = kit as IRoktKit; @@ -1000,6 +1041,7 @@ describe('RoktManager', () => { launcher: { hashAttributes: jest.fn(), selectPlacements: jest.fn(), + use: jest.fn(), }, setExtensionData: jest.fn() }; @@ -1039,7 +1081,8 @@ describe('RoktManager', () => { const kit: Partial = { launcher: { hashAttributes: jest.fn(), - selectPlacements: jest.fn() + selectPlacements: jest.fn(), + use: jest.fn(), }, setExtensionData: jest.fn() }; @@ -1055,7 +1098,8 @@ describe('RoktManager', () => { const kit: Partial = { launcher: { hashAttributes: jest.fn(), - selectPlacements: jest.fn() + selectPlacements: jest.fn(), + use: jest.fn(), }, setExtensionData: jest.fn() }; diff --git a/test/snippet/tests-snippet.js b/test/snippet/tests-snippet.js index 3a623a023..30d14aa03 100644 --- a/test/snippet/tests-snippet.js +++ b/test/snippet/tests-snippet.js @@ -140,9 +140,11 @@ describe('snippet', function() { mParticle.Rokt.hashAttributes(); mParticle.Rokt.selectPlacements(); mParticle.Rokt.setExtensionData(); + mParticle.Rokt.use(); mParticle.config.rq[0][0].should.equal('Rokt.hashAttributes'); mParticle.config.rq[1][0].should.equal('Rokt.selectPlacements'); mParticle.config.rq[2][0].should.equal('Rokt.setExtensionData'); + mParticle.config.rq[3][0].should.equal('Rokt.use'); done(); }); }); From 228688601cf856d591f99fcefec7c5719381f4fa Mon Sep 17 00:00:00 2001 From: Jaissica Date: Wed, 10 Sep 2025 08:59:44 -0400 Subject: [PATCH 2/8] Update test/jest/roktManager.spec.ts Co-authored-by: Robert Ing --- test/jest/roktManager.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/jest/roktManager.spec.ts b/test/jest/roktManager.spec.ts index 4a46ce208..9d945cb26 100644 --- a/test/jest/roktManager.spec.ts +++ b/test/jest/roktManager.spec.ts @@ -463,7 +463,7 @@ describe('RoktManager', () => { filters: undefined, filteredUser: undefined, userAttributes: undefined, - selectPlacements: jest.fn(), + selectPlacements: jest.fn(), hashAttributes: jest.fn(), setExtensionData: jest.fn(), use: jest.fn(), From 7d0c49305f1a21c6799021df5fb034beed025fcb Mon Sep 17 00:00:00 2001 From: Jaissica Hora Date: Wed, 10 Sep 2025 11:56:24 -0400 Subject: [PATCH 3/8] chore: updated error message --- src/roktManager.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/roktManager.ts b/src/roktManager.ts index fc668eaad..1e896802a 100644 --- a/src/roktManager.ts +++ b/src/roktManager.ts @@ -261,7 +261,7 @@ export default class RoktManager { try { return this.kit.use(name); } catch (error) { - return Promise.reject(error instanceof Error ? error : new Error('Unknown error occurred')); + return Promise.reject(error instanceof Error ? error : new Error('Error using extension: ' + name)); } } From e3cb5994a5bec97f7f6126a49f84ec94c1abee89 Mon Sep 17 00:00:00 2001 From: Jaissica Hora Date: Thu, 11 Sep 2025 17:04:32 -0400 Subject: [PATCH 4/8] feat: added terminate and getVersionId function --- snippet.js | 2 + snippet.rokt.js | 2 + src/roktManager.ts | 28 +++++++++ test/jest/roktManager.spec.ts | 108 ++++++++++++++++++++++++++++++---- test/snippet/tests-snippet.js | 4 ++ 5 files changed, 134 insertions(+), 10 deletions(-) diff --git a/snippet.js b/snippet.js index 1388d54fb..83ff6ffcf 100644 --- a/snippet.js +++ b/snippet.js @@ -50,6 +50,8 @@ 'hashAttributes', 'setExtensionData', 'use', + 'getVersion', + 'terminate', ]; // iterates through methods above to create stubs diff --git a/snippet.rokt.js b/snippet.rokt.js index 2b179c9c3..2b7dd533e 100644 --- a/snippet.rokt.js +++ b/snippet.rokt.js @@ -50,6 +50,8 @@ 'hashAttributes', 'setExtensionData', 'use', + 'getVersion', + 'terminate', ]; // iterates through methods above to create stubs diff --git a/src/roktManager.ts b/src/roktManager.ts index 1e896802a..a84f46b01 100644 --- a/src/roktManager.ts +++ b/src/roktManager.ts @@ -39,6 +39,8 @@ export interface IRoktLauncher { selectPlacements: (options: IRoktSelectPlacementsOptions) => Promise; hashAttributes: (attributes: IRoktPartnerAttributes) => Promise>; use: (name: string) => Promise; + getVersion: () => Promise; + terminate: () => Promise; } export interface IRoktMessage { @@ -63,6 +65,8 @@ export interface IRoktKit { hashAttributes: (attributes: IRoktPartnerAttributes) => Promise>; selectPlacements: (options: IRoktSelectPlacementsOptions) => Promise; setExtensionData(extensionData: IRoktPartnerExtensionData): void; + terminate: () => Promise; + getVersion: () => Promise; use: (name: string) => Promise; launcherOptions?: Dictionary; } @@ -265,6 +269,30 @@ export default class RoktManager { } } + public terminate(): Promise { + if (!this.isReady()) { + return this.deferredCall('terminate', {}); + } + + try { + return this.kit.terminate(); + } catch (error) { + return Promise.reject(error instanceof Error ? error : new Error('Error terminating')); + } + } + + public getVersion(): Promise { + if (!this.isReady()) { + return this.deferredCall('getVersion', {}); + } + + try { + return this.kit.launcher.getVersion(); + } catch (error) { + return Promise.reject(error instanceof Error ? error : new Error('Error getting the version')); + } + } + public getLocalSessionAttributes(): LocalSessionAttributes { return this.store.getLocalSessionAttributes(); } diff --git a/test/jest/roktManager.spec.ts b/test/jest/roktManager.spec.ts index 9d945cb26..b8efb1d97 100644 --- a/test/jest/roktManager.spec.ts +++ b/test/jest/roktManager.spec.ts @@ -86,12 +86,16 @@ describe('RoktManager', () => { selectPlacements: jest.fn(), hashAttributes: jest.fn(), use: jest.fn(), + getVersion: jest.fn(), + terminate: jest.fn(), }, filters: undefined, filteredUser: undefined, hashAttributes: jest.fn(), selectPlacements: jest.fn(), setExtensionData: jest.fn(), + getVersion: jest.fn(), + terminate: jest.fn(), use: jest.fn(), userAttributes: undefined, }; @@ -110,6 +114,8 @@ describe('RoktManager', () => { selectPlacements: jest.fn(), hashAttributes: jest.fn(), use: jest.fn(), + getVersion: jest.fn(), + terminate: jest.fn(), }, filters: undefined, filteredUser: undefined, @@ -117,6 +123,8 @@ describe('RoktManager', () => { selectPlacements: jest.fn(), setExtensionData: jest.fn(), use: jest.fn(), + getVersion: jest.fn(), + terminate: jest.fn(), userAttributes: undefined, }; @@ -151,6 +159,8 @@ describe('RoktManager', () => { selectPlacements: jest.fn(), hashAttributes: jest.fn(), use: jest.fn(), + getVersion: jest.fn(), + terminate: jest.fn(), }, filters: undefined, filteredUser: undefined, @@ -158,6 +168,8 @@ describe('RoktManager', () => { selectPlacements: jest.fn(), setExtensionData: jest.fn(), use: jest.fn(), + getVersion: jest.fn(), + terminate: jest.fn(), userAttributes: undefined, }; @@ -185,6 +197,8 @@ describe('RoktManager', () => { selectPlacements: jest.fn(), hashAttributes: jest.fn(), use: jest.fn(), + getVersion: jest.fn(), + terminate: jest.fn(), }, // We are mocking the hashAttributes method to return the @@ -373,6 +387,8 @@ describe('RoktManager', () => { selectPlacements: jest.fn(), hashAttributes: jest.fn(), use: jest.fn(), + getVersion: jest.fn(), + terminate: jest.fn(), }, filters: undefined, filteredUser: undefined, @@ -381,6 +397,8 @@ describe('RoktManager', () => { hashAttributes: jest.fn(), setExtensionData: jest.fn(), use: jest.fn(), + getVersion: jest.fn(), + terminate: jest.fn(), }; roktManager.attachKit(kit); @@ -395,6 +413,8 @@ describe('RoktManager', () => { selectPlacements: jest.fn(), hashAttributes: jest.fn(), use: jest.fn(), + getVersion: jest.fn(), + terminate: jest.fn(), }, filters: undefined, selectPlacements: jest.fn(), @@ -403,6 +423,8 @@ describe('RoktManager', () => { userAttributes: undefined, setExtensionData: jest.fn(), use: jest.fn(), + getVersion: jest.fn(), + terminate: jest.fn(), }; @@ -433,6 +455,8 @@ describe('RoktManager', () => { selectPlacements: jest.fn(), hashAttributes: jest.fn(), use: jest.fn(), + getVersion: jest.fn(), + terminate: jest.fn(), }, filters: undefined, filteredUser: undefined, @@ -441,6 +465,8 @@ describe('RoktManager', () => { hashAttributes: jest.fn(), setExtensionData: jest.fn(), use: jest.fn(), + getVersion: jest.fn(), + terminate: jest.fn(), }; roktManager.attachKit(kit); @@ -459,6 +485,8 @@ describe('RoktManager', () => { selectPlacements: jest.fn(), hashAttributes: jest.fn(), use: jest.fn(), + getVersion: jest.fn(), + terminate: jest.fn(), }, filters: undefined, filteredUser: undefined, @@ -467,6 +495,8 @@ describe('RoktManager', () => { hashAttributes: jest.fn(), setExtensionData: jest.fn(), use: jest.fn(), + getVersion: jest.fn(), + terminate: jest.fn(), }; roktManager.attachKit(kit); @@ -506,6 +536,8 @@ describe('RoktManager', () => { selectPlacements: jest.fn(), hashAttributes: jest.fn(), use: jest.fn(), + getVersion: jest.fn(), + terminate: jest.fn(), }, filters: undefined, filteredUser: undefined, @@ -514,6 +546,8 @@ describe('RoktManager', () => { hashAttributes: jest.fn(), setExtensionData: jest.fn(), use: jest.fn(), + getVersion: jest.fn(), + terminate: jest.fn(), }; const options = { @@ -554,6 +588,8 @@ describe('RoktManager', () => { selectPlacements: jest.fn(), hashAttributes: jest.fn(), use: jest.fn(), + getVersion: jest.fn(), + terminate: jest.fn(), }, filters: undefined, filteredUser: undefined, @@ -570,6 +606,8 @@ describe('RoktManager', () => { hashAttributes: jest.fn(), setExtensionData: jest.fn(), use: jest.fn(), + getVersion: jest.fn(), + terminate: jest.fn(), }; roktManager.attachKit(kit); @@ -595,6 +633,8 @@ describe('RoktManager', () => { selectPlacements: jest.fn(), hashAttributes: jest.fn(), use: jest.fn(), + getVersion: jest.fn(), + terminate: jest.fn(), }, filters: undefined, filteredUser: undefined, @@ -603,6 +643,8 @@ describe('RoktManager', () => { hashAttributes: jest.fn(), userAttributes: undefined, use: jest.fn(), + getVersion: jest.fn(), + terminate: jest.fn(), }; roktManager.attachKit(kit); @@ -625,6 +667,8 @@ describe('RoktManager', () => { selectPlacements: jest.fn(), hashAttributes: jest.fn(), use: jest.fn(), + getVersion: jest.fn(), + terminate: jest.fn(), }, filters: undefined, filteredUser: undefined, @@ -633,6 +677,8 @@ describe('RoktManager', () => { hashAttributes: jest.fn(), setExtensionData: jest.fn(), use: jest.fn(), + getVersion: jest.fn(), + terminate: jest.fn(), }; roktManager.attachKit(kit); @@ -657,6 +703,8 @@ describe('RoktManager', () => { selectPlacements: jest.fn(), hashAttributes: jest.fn(), use: jest.fn(), + getVersion: jest.fn(), + terminate: jest.fn(), }, filters: undefined, filteredUser: undefined, @@ -665,6 +713,8 @@ describe('RoktManager', () => { hashAttributes: jest.fn(), userAttributes: undefined, use: jest.fn(), + getVersion: jest.fn(), + terminate: jest.fn(), }; roktManager.attachKit(kit); @@ -688,11 +738,15 @@ describe('RoktManager', () => { selectPlacements: jest.fn(), hashAttributes: jest.fn(), use: jest.fn(), + getVersion: jest.fn(), + terminate: jest.fn(), }, hashAttributes: jest.fn(), selectPlacements: jest.fn(), setExtensionData: jest.fn(), use: jest.fn(), + getVersion: jest.fn(), + terminate: jest.fn(), }; roktManager.kit = kit as IRoktKit; @@ -737,11 +791,15 @@ describe('RoktManager', () => { selectPlacements: jest.fn(), hashAttributes: jest.fn(), use: jest.fn(), + getVersion: jest.fn(), + terminate: jest.fn(), }, hashAttributes: jest.fn(), selectPlacements: jest.fn(), setExtensionData: jest.fn(), use: jest.fn(), + getVersion: jest.fn(), + terminate: jest.fn(), }; roktManager.kit = kit as IRoktKit; @@ -766,11 +824,15 @@ describe('RoktManager', () => { selectPlacements: jest.fn(), hashAttributes: jest.fn(), use: jest.fn(), + getVersion: jest.fn(), + terminate: jest.fn(), }, selectPlacements: jest.fn(), hashAttributes: jest.fn(), setExtensionData: jest.fn(), use: jest.fn(), + getVersion: jest.fn(), + terminate: jest.fn(), }; roktManager.kit = kit as IRoktKit; @@ -817,11 +879,15 @@ describe('RoktManager', () => { selectPlacements: jest.fn(), hashAttributes: jest.fn(), use: jest.fn(), + getVersion: jest.fn(), + terminate: jest.fn(), }, selectPlacements: jest.fn(), hashAttributes: jest.fn(), setExtensionData: jest.fn(), use: jest.fn(), + getVersion: jest.fn(), + terminate: jest.fn(), }; roktManager.kit = kit as IRoktKit; @@ -848,11 +914,15 @@ describe('RoktManager', () => { selectPlacements: jest.fn(), hashAttributes: jest.fn(), use: jest.fn(), + getVersion: jest.fn(), + terminate: jest.fn(), }, - selectPlacements: jest.fn().mockResolvedValue({}), + getVersion: jest.fn(), hashAttributes: jest.fn(), + selectPlacements: jest.fn().mockResolvedValue({}), setExtensionData: jest.fn(), use: jest.fn(), + terminate: jest.fn(), }; roktManager.kit = kit as IRoktKit; @@ -899,14 +969,18 @@ describe('RoktManager', () => { const kit: Partial = { launcher: { - selectPlacements: jest.fn(), hashAttributes: jest.fn(), + selectPlacements: jest.fn(), use: jest.fn(), + terminate: jest.fn(), + getVersion: jest.fn(), }, selectPlacements: jest.fn(), hashAttributes: jest.fn(), setExtensionData: jest.fn(), use: jest.fn(), + getVersion: jest.fn(), + terminate: jest.fn(), }; roktManager.kit = kit as IRoktKit; @@ -944,11 +1018,15 @@ describe('RoktManager', () => { selectPlacements: jest.fn(), hashAttributes: jest.fn(), use: jest.fn(), + getVersion: jest.fn(), + terminate: jest.fn(), }, - selectPlacements: jest.fn(), + getVersion: jest.fn(), hashAttributes: jest.fn(), + selectPlacements: jest.fn(), setExtensionData: jest.fn(), use: jest.fn(), + terminate: jest.fn(), }; roktManager.kit = kit as IRoktKit; @@ -987,14 +1065,18 @@ describe('RoktManager', () => { it('should log error when identify fails with a 500 but continue execution', async () => { const kit: Partial = { launcher: { - selectPlacements: jest.fn(), + getVersion: jest.fn(), hashAttributes: jest.fn(), - use: jest.fn(), + selectPlacements: jest.fn(), + terminate: jest.fn(), + use: jest.fn(), }, - selectPlacements: jest.fn().mockResolvedValue({}), + getVersion: jest.fn(), hashAttributes: jest.fn(), + selectPlacements: jest.fn().mockResolvedValue({}), setExtensionData: jest.fn(), - use: jest.fn(), + terminate: jest.fn(), + use: jest.fn(), }; roktManager.kit = kit as IRoktKit; @@ -1041,7 +1123,9 @@ describe('RoktManager', () => { launcher: { hashAttributes: jest.fn(), selectPlacements: jest.fn(), - use: jest.fn(), + use: jest.fn(), + getVersion: jest.fn(), + terminate: jest.fn(), }, setExtensionData: jest.fn() }; @@ -1082,7 +1166,9 @@ describe('RoktManager', () => { launcher: { hashAttributes: jest.fn(), selectPlacements: jest.fn(), - use: jest.fn(), + use: jest.fn(), + getVersion: jest.fn(), + terminate: jest.fn(), }, setExtensionData: jest.fn() }; @@ -1099,7 +1185,9 @@ describe('RoktManager', () => { launcher: { hashAttributes: jest.fn(), selectPlacements: jest.fn(), - use: jest.fn(), + use: jest.fn(), + getVersion: jest.fn(), + terminate: jest.fn(), }, setExtensionData: jest.fn() }; diff --git a/test/snippet/tests-snippet.js b/test/snippet/tests-snippet.js index 30d14aa03..270aaef56 100644 --- a/test/snippet/tests-snippet.js +++ b/test/snippet/tests-snippet.js @@ -141,10 +141,14 @@ describe('snippet', function() { mParticle.Rokt.selectPlacements(); mParticle.Rokt.setExtensionData(); mParticle.Rokt.use(); + mParticle.Rokt.getVersion(); + mParticle.Rokt.terminate(); mParticle.config.rq[0][0].should.equal('Rokt.hashAttributes'); mParticle.config.rq[1][0].should.equal('Rokt.selectPlacements'); mParticle.config.rq[2][0].should.equal('Rokt.setExtensionData'); mParticle.config.rq[3][0].should.equal('Rokt.use'); + mParticle.config.rq[4][0].should.equal('Rokt.getVersion'); + mParticle.config.rq[5][0].should.equal('Rokt.terminate'); done(); }); }); From 12f6f49539011f8766cddb74c3ad17c8b8498730 Mon Sep 17 00:00:00 2001 From: Jaissica Hora Date: Fri, 12 Sep 2025 09:09:58 -0400 Subject: [PATCH 5/8] test: added tests for getVersion, use, terminate method in roktManager --- src/roktManager.ts | 2 +- test/jest/roktManager.spec.ts | 283 ++++++++++++++++++++++++++++++++++ 2 files changed, 284 insertions(+), 1 deletion(-) diff --git a/src/roktManager.ts b/src/roktManager.ts index a84f46b01..f67335cbd 100644 --- a/src/roktManager.ts +++ b/src/roktManager.ts @@ -287,7 +287,7 @@ export default class RoktManager { } try { - return this.kit.launcher.getVersion(); + return this.kit.getVersion(); } catch (error) { return Promise.reject(error instanceof Error ? error : new Error('Error getting the version')); } diff --git a/test/jest/roktManager.spec.ts b/test/jest/roktManager.spec.ts index b8efb1d97..ac3242687 100644 --- a/test/jest/roktManager.spec.ts +++ b/test/jest/roktManager.spec.ts @@ -1214,6 +1214,289 @@ describe('RoktManager', () => { }); }); + describe('#terminate', () => { + it('should call kit.terminate when already attached', async () => { + const kit: IRoktKit = { + launcher: { + selectPlacements: jest.fn(), + hashAttributes: jest.fn(), + use: jest.fn(), + getVersion: jest.fn(), + terminate: jest.fn(), + }, + filters: undefined, + filteredUser: undefined, + userAttributes: undefined, + selectPlacements: jest.fn(), + hashAttributes: jest.fn(), + setExtensionData: jest.fn(), + use: jest.fn(), + getVersion: jest.fn(), + terminate: jest.fn(), + }; + + roktManager.attachKit(kit); + + roktManager.terminate(); + expect(kit.terminate).toHaveBeenCalled(); + }); + + it('should queue the terminate method if no launcher or kit is attached', () => { + roktManager.terminate(); + + expect(roktManager['kit']).toBeNull(); + expect(roktManager['messageQueue'].size).toBe(1); + const queuedMessage = Array.from(roktManager['messageQueue'].values())[0]; + expect(queuedMessage.methodName).toBe('terminate'); + expect(queuedMessage.payload).toEqual({}); + }); + + it('should process queued terminate once the launcher and kit are attached', async () => { + const kit: IRoktKit = { + launcher: { + selectPlacements: jest.fn(), + hashAttributes: jest.fn(), + use: jest.fn(), + getVersion: jest.fn(), + terminate: jest.fn(), + }, + filters: undefined, + filteredUser: undefined, + userAttributes: undefined, + selectPlacements: jest.fn(), + hashAttributes: jest.fn(), + setExtensionData: jest.fn(), + use: jest.fn(), + getVersion: jest.fn(), + terminate: jest.fn(), + }; + + roktManager.terminate(); + + expect(roktManager['kit']).toBeNull(); + expect(roktManager['messageQueue'].size).toBe(1); + const queuedMessage = Array.from(roktManager['messageQueue'].values())[0]; + expect(queuedMessage.methodName).toBe('terminate'); + expect(queuedMessage.payload).toEqual({}); + + roktManager.attachKit(kit); + expect(roktManager['kit']).not.toBeNull(); + expect(roktManager['messageQueue'].size).toBe(0); + expect(kit.terminate).toHaveBeenCalled(); + }); + + it('should pass through to kit.launcher.terminate', async () => { + const kit: Partial = { + launcher: { + selectPlacements: jest.fn(), + hashAttributes: jest.fn(), + use: jest.fn(), + getVersion: jest.fn(), + terminate: jest.fn(), + }, + terminate: jest.fn().mockImplementation(() => (kit.launcher).terminate()), + }; + + roktManager.attachKit(kit as IRoktKit); + + roktManager.terminate(); + expect(kit.terminate).toHaveBeenCalled(); + expect(kit.launcher.terminate).toHaveBeenCalled(); + }); + }); + + describe('#getVersion', () => { + it('should call kit.getVersion', async () => { + const kit: IRoktKit = { + launcher: { + selectPlacements: jest.fn(), + hashAttributes: jest.fn(), + use: jest.fn(), + getVersion: jest.fn().mockResolvedValue('1.1'), + terminate: jest.fn(), + }, + getVersion: jest.fn().mockImplementation(() => kit.launcher.getVersion()), + filters: undefined, + filteredUser: undefined, + userAttributes: undefined, + hashAttributes: jest.fn(), + selectPlacements: jest.fn(), + setExtensionData: jest.fn(), + use: jest.fn(), + terminate: jest.fn(), + }; + + roktManager.attachKit(kit); + + const version = await roktManager.getVersion(); + expect(kit.getVersion).toHaveBeenCalled(); + expect(version).toBe('1.1'); + }); + + it('should queue the getVersion method if no launcher or kit is attached', () => { + roktManager.getVersion(); + + expect(roktManager['kit']).toBeNull(); + expect(roktManager['messageQueue'].size).toBe(1); + const queuedMessage = Array.from(roktManager['messageQueue'].values())[0]; + expect(queuedMessage.methodName).toBe('getVersion'); + expect(queuedMessage.payload).toEqual({}); + }); + + it('should process queued getVersion calls once the launcher and kit are attached', () => { + const kit: IRoktKit = { + launcher: { + selectPlacements: jest.fn(), + hashAttributes: jest.fn(), + use: jest.fn(), + getVersion: jest.fn(), + terminate: jest.fn(), + }, + selectPlacements: jest.fn(), + hashAttributes: jest.fn(), + setExtensionData: jest.fn(), + use: jest.fn(), + terminate: jest.fn(), + getVersion: jest.fn(), + filters: undefined, + filteredUser: undefined, + userAttributes: undefined, + }; + + roktManager.getVersion(); + + expect(roktManager['kit']).toBeNull(); + expect(roktManager['messageQueue'].size).toBe(1); + const queuedMessage = Array.from(roktManager['messageQueue'].values())[0]; + expect(queuedMessage.methodName).toBe('getVersion'); + expect(queuedMessage.payload).toEqual({}); + + roktManager.attachKit(kit); + expect(roktManager['kit']).not.toBeNull(); + expect(roktManager['messageQueue'].size).toBe(0); + expect(kit.getVersion).toHaveBeenCalled(); + }); + + it('should pass through to kit.launcher.getVersion and return the version', async () => { + const kit: Partial = { + launcher: { + selectPlacements: jest.fn(), + hashAttributes: jest.fn(), + use: jest.fn(), + getVersion: jest.fn().mockResolvedValue('1.1'), + terminate: jest.fn(), + }, + getVersion: jest.fn().mockImplementation(() => (kit.launcher).getVersion()), + }; + + roktManager.attachKit(kit as IRoktKit); + + const version = await roktManager.getVersion(); + expect(kit.getVersion).toHaveBeenCalled(); + expect(kit.launcher.getVersion).toHaveBeenCalled(); + expect(version).toBe('1.1'); + }); + }); + + describe('#use', () => { + it('should call kit.use with provided name', async () => { + const kit: IRoktKit = { + launcher: { + selectPlacements: jest.fn(), + hashAttributes: jest.fn(), + use: jest.fn(), + getVersion: jest.fn(), + terminate: jest.fn(), + }, + filters: undefined, + filteredUser: undefined, + userAttributes: undefined, + selectPlacements: jest.fn(), + hashAttributes: jest.fn(), + setExtensionData: jest.fn(), + use: jest.fn(), + getVersion: jest.fn(), + terminate: jest.fn(), + }; + + roktManager.attachKit(kit); + + roktManager.use('ThankYouPageJourney'); + expect(kit.use).toHaveBeenCalledWith('ThankYouPageJourney'); + }); + + it('should queue the use method if no launcher or kit is attached', () => { + roktManager.use('ThankYouPageJourney'); + + expect(roktManager['kit']).toBeNull(); + expect(roktManager['messageQueue'].size).toBe(1); + const queuedMessage = Array.from(roktManager['messageQueue'].values())[0]; + expect(queuedMessage.methodName).toBe('use'); + expect(queuedMessage.payload).toBe('ThankYouPageJourney'); + }); + + it('should process queued use calls once the launcher and kit are attached', async () => { + const kit: IRoktKit = { + launcher: { + selectPlacements: jest.fn(), + hashAttributes: jest.fn(), + use: jest.fn(), + getVersion: jest.fn(), + terminate: jest.fn(), + }, + filters: undefined, + filteredUser: undefined, + userAttributes: undefined, + selectPlacements: jest.fn(), + hashAttributes: jest.fn(), + setExtensionData: jest.fn(), + use: jest.fn(), + getVersion: jest.fn(), + terminate: jest.fn(), + }; + + roktManager.use('ThankYouPageJourney'); + + expect(roktManager['kit']).toBeNull(); + expect(roktManager['messageQueue'].size).toBe(1); + const queuedMessage = Array.from(roktManager['messageQueue'].values())[0]; + expect(queuedMessage.methodName).toBe('use'); + expect(queuedMessage.payload).toBe('ThankYouPageJourney'); + expect(kit.use).not.toHaveBeenCalled(); + + roktManager.attachKit(kit); + + expect(roktManager['messageQueue'].size).toBe(0); + expect(roktManager['kit']).not.toBeNull(); + expect(kit.use).toHaveBeenCalledWith('ThankYouPageJourney'); + }); + + it('should pass through to kit.launcher.use and return the value', async () => { + const kit: Partial = { + launcher: { + selectPlacements: jest.fn(), + hashAttributes: jest.fn(), + use: jest.fn().mockResolvedValue('test-use'), + getVersion: jest.fn(), + terminate: jest.fn(), + }, + selectPlacements: jest.fn(), + hashAttributes: jest.fn(), + setExtensionData: jest.fn(), + use: jest.fn().mockImplementation((name: string) => (kit.launcher).use(name)), + getVersion: jest.fn(), + terminate: jest.fn(), + }; + + roktManager.attachKit(kit as IRoktKit); + + const result = await roktManager.use('ThankYouPageJourney'); + expect(kit.use).toHaveBeenCalledWith('ThankYouPageJourney'); + expect(kit.launcher.use).toHaveBeenCalledWith('ThankYouPageJourney'); + expect(result).toBe('test-use'); + }); + }); + describe('#deferredCall', () => { it('should create a deferred promise with unique messageId', () => { const testPayload = { test: 'data' }; From a9759935cde20566d229f9ba3c4e39bbf2c0a11e Mon Sep 17 00:00:00 2001 From: Jaissica Date: Fri, 12 Sep 2025 12:39:22 -0400 Subject: [PATCH 6/8] fix: update snippet, README and clean up generic types --- README.md | 2 +- snippet.min.js | 2 +- snippet.rokt.min.js | 2 +- src/roktManager.ts | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 49f00c01f..6b8805fb8 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,7 @@ window.mParticle = { }; //load the SDK -(function(e){window.mParticle=window.mParticle||{};window.mParticle.EventType={Unknown:0,Navigation:1,Location:2,Search:3,Transaction:4,UserContent:5,UserPreference:6,Social:7,Other:8,Media:9};window.mParticle.eCommerce={Cart:{}};window.mParticle.Identity={};window.mParticle.Rokt={};window.mParticle.config=window.mParticle.config||{};window.mParticle.config.rq=[];window.mParticle.config.snippetVersion=2.5;window.mParticle.ready=function(e){window.mParticle.config.rq.push(e)};var t=["endSession","logError","logBaseEvent","logEvent","logForm","logLink","logPageView","setSessionAttribute","setAppName","setAppVersion","setOptOut","setPosition","startNewSession","startTrackingLocation","stopTrackingLocation"];var i=["setCurrencyCode","logCheckout"];var n=["identify","login","logout","modify"];var o=["selectPlacements","hashAttributes","setExtensionData"];t.forEach(function(e){window.mParticle[e]=r(e)});i.forEach(function(e){window.mParticle.eCommerce[e]=r(e,"eCommerce")});n.forEach(function(e){window.mParticle.Identity[e]=r(e,"Identity")});o.forEach(function(e){window.mParticle.Rokt[e]=r(e,"Rokt")});function r(t,i){return function(){if(i){t=i+"."+t}var e=Array.prototype.slice.call(arguments);e.unshift(t);window.mParticle.config.rq.push(e)}}var c,a,s=window.mParticle.config,l=s.isDevelopmentMode?1:0,w="?env="+l,d=window.mParticle.config.dataPlan;if(d){c=d.planId;a=d.planVersion;if(c){if(a&&(a<1||a>1e3)){a=null}w+="&plan_id="+c+(a?"&plan_version="+a:"")}}var m=window.mParticle.config.versions;var f=[];if(m){Object.keys(m).forEach(function(e){f.push(e+"="+m[e])})}var p=document.createElement("script");p.type="text/javascript";p.async=true;p.src=("https:"==document.location.protocol?"https://jssdkcdns":"http://jssdkcdn")+".mparticle.com/js/v2/"+e+"/mparticle.js"+w+"&"+f.join("&");var P=document.getElementsByTagName("script")[0];P.parentNode.insertBefore(p,P)})("REPLACE WITH API KEY"); +(function(e){window.mParticle=window.mParticle||{};window.mParticle.EventType={Unknown:0,Navigation:1,Location:2,Search:3,Transaction:4,UserContent:5,UserPreference:6,Social:7,Other:8,Media:9};window.mParticle.eCommerce={Cart:{}};window.mParticle.Identity={};window.mParticle.Rokt={};window.mParticle.config=window.mParticle.config||{};window.mParticle.config.rq=[];window.mParticle.config.snippetVersion=2.5;window.mParticle.ready=function(e){window.mParticle.config.rq.push(e)};var t=["endSession","logError","logBaseEvent","logEvent","logForm","logLink","logPageView","setSessionAttribute","setAppName","setAppVersion","setOptOut","setPosition","startNewSession","startTrackingLocation","stopTrackingLocation"];var i=["setCurrencyCode","logCheckout"];var n=["identify","login","logout","modify"];var o=["selectPlacements","hashAttributes","setExtensionData","use","getVersion","terminate"];t.forEach(function(e){window.mParticle[e]=r(e)});i.forEach(function(e){window.mParticle.eCommerce[e]=r(e,"eCommerce")});n.forEach(function(e){window.mParticle.Identity[e]=r(e,"Identity")});o.forEach(function(e){window.mParticle.Rokt[e]=r(e,"Rokt")});function r(t,i){return function(){if(i){t=i+"."+t}var e=Array.prototype.slice.call(arguments);e.unshift(t);window.mParticle.config.rq.push(e)}}var a,c,s=window.mParticle.config,l=s.isDevelopmentMode?1:0,w="?env="+l,d=window.mParticle.config.dataPlan;if(d){a=d.planId;c=d.planVersion;if(a){if(c&&(c<1||c>1e3)){c=null}w+="&plan_id="+a+(c?"&plan_version="+c:"")}}var m=window.mParticle.config.versions;var f=[];if(m){Object.keys(m).forEach(function(e){f.push(e+"="+m[e])})}var p=document.createElement("script");p.type="text/javascript";p.async=true;p.src=("https:"==document.location.protocol?"https://jssdkcdns":"http://jssdkcdn")+".mparticle.com/js/v2/"+e+"/mparticle.js"+w+"&"+f.join("&");var P=document.getElementsByTagName("script")[0];P.parentNode.insertBefore(p,P)})("REPLACE WITH API KEY"); ``` diff --git a/snippet.min.js b/snippet.min.js index 18a002388..e517aca73 100644 --- a/snippet.min.js +++ b/snippet.min.js @@ -1 +1 @@ -(function(e){window.mParticle=window.mParticle||{};window.mParticle.EventType={Unknown:0,Navigation:1,Location:2,Search:3,Transaction:4,UserContent:5,UserPreference:6,Social:7,Other:8,Media:9};window.mParticle.eCommerce={Cart:{}};window.mParticle.Identity={};window.mParticle.Rokt={};window.mParticle.config=window.mParticle.config||{};window.mParticle.config.rq=[];window.mParticle.config.snippetVersion=2.5;window.mParticle.ready=function(e){window.mParticle.config.rq.push(e)};var t=["endSession","logError","logBaseEvent","logEvent","logForm","logLink","logPageView","setSessionAttribute","setAppName","setAppVersion","setOptOut","setPosition","startNewSession","startTrackingLocation","stopTrackingLocation"];var i=["setCurrencyCode","logCheckout"];var n=["identify","login","logout","modify"];var o=["selectPlacements","hashAttributes","setExtensionData"];t.forEach(function(e){window.mParticle[e]=r(e)});i.forEach(function(e){window.mParticle.eCommerce[e]=r(e,"eCommerce")});n.forEach(function(e){window.mParticle.Identity[e]=r(e,"Identity")});o.forEach(function(e){window.mParticle.Rokt[e]=r(e,"Rokt")});function r(t,i){return function(){if(i){t=i+"."+t}var e=Array.prototype.slice.call(arguments);e.unshift(t);window.mParticle.config.rq.push(e)}}var c,a,s=window.mParticle.config,l=s.isDevelopmentMode?1:0,w="?env="+l,d=window.mParticle.config.dataPlan;if(d){c=d.planId;a=d.planVersion;if(c){if(a&&(a<1||a>1e3)){a=null}w+="&plan_id="+c+(a?"&plan_version="+a:"")}}var m=window.mParticle.config.versions;var f=[];if(m){Object.keys(m).forEach(function(e){f.push(e+"="+m[e])})}var p=document.createElement("script");p.type="text/javascript";p.async=true;p.src=("https:"==document.location.protocol?"https://jssdkcdns":"http://jssdkcdn")+".mparticle.com/js/v2/"+e+"/mparticle.js"+w+"&"+f.join("&");var P=document.getElementsByTagName("script")[0];P.parentNode.insertBefore(p,P)})("REPLACE WITH API KEY"); \ No newline at end of file +(function(e){window.mParticle=window.mParticle||{};window.mParticle.EventType={Unknown:0,Navigation:1,Location:2,Search:3,Transaction:4,UserContent:5,UserPreference:6,Social:7,Other:8,Media:9};window.mParticle.eCommerce={Cart:{}};window.mParticle.Identity={};window.mParticle.Rokt={};window.mParticle.config=window.mParticle.config||{};window.mParticle.config.rq=[];window.mParticle.config.snippetVersion=2.5;window.mParticle.ready=function(e){window.mParticle.config.rq.push(e)};var t=["endSession","logError","logBaseEvent","logEvent","logForm","logLink","logPageView","setSessionAttribute","setAppName","setAppVersion","setOptOut","setPosition","startNewSession","startTrackingLocation","stopTrackingLocation"];var i=["setCurrencyCode","logCheckout"];var n=["identify","login","logout","modify"];var o=["selectPlacements","hashAttributes","setExtensionData","use","getVersion","terminate"];t.forEach(function(e){window.mParticle[e]=r(e)});i.forEach(function(e){window.mParticle.eCommerce[e]=r(e,"eCommerce")});n.forEach(function(e){window.mParticle.Identity[e]=r(e,"Identity")});o.forEach(function(e){window.mParticle.Rokt[e]=r(e,"Rokt")});function r(t,i){return function(){if(i){t=i+"."+t}var e=Array.prototype.slice.call(arguments);e.unshift(t);window.mParticle.config.rq.push(e)}}var a,c,s=window.mParticle.config,l=s.isDevelopmentMode?1:0,w="?env="+l,d=window.mParticle.config.dataPlan;if(d){a=d.planId;c=d.planVersion;if(a){if(c&&(c<1||c>1e3)){c=null}w+="&plan_id="+a+(c?"&plan_version="+c:"")}}var m=window.mParticle.config.versions;var f=[];if(m){Object.keys(m).forEach(function(e){f.push(e+"="+m[e])})}var p=document.createElement("script");p.type="text/javascript";p.async=true;p.src=("https:"==document.location.protocol?"https://jssdkcdns":"http://jssdkcdn")+".mparticle.com/js/v2/"+e+"/mparticle.js"+w+"&"+f.join("&");var P=document.getElementsByTagName("script")[0];P.parentNode.insertBefore(p,P)})("REPLACE WITH API KEY"); \ No newline at end of file diff --git a/snippet.rokt.min.js b/snippet.rokt.min.js index 6132dea65..e01c44ecb 100644 --- a/snippet.rokt.min.js +++ b/snippet.rokt.min.js @@ -1 +1 @@ -(function(e){window.mParticle=window.mParticle||{};window.mParticle.EventType={Unknown:0,Navigation:1,Location:2,Search:3,Transaction:4,UserContent:5,UserPreference:6,Social:7,Other:8,Media:9};window.mParticle.eCommerce={Cart:{}};window.mParticle.Identity={};window.mParticle.Rokt={};window.mParticle.config=window.mParticle.config||{};window.mParticle.config.rq=[];window.mParticle.config.snippetVersion=2.6;window.mParticle.ready=function(e){window.mParticle.config.rq.push(e)};var i=["endSession","logError","logBaseEvent","logEvent","logForm","logLink","logPageView","setSessionAttribute","setAppName","setAppVersion","setOptOut","setPosition","startNewSession","startTrackingLocation","stopTrackingLocation"];var t=["setCurrencyCode","logCheckout"];var n=["identify","login","logout","modify"];var o=["selectPlacements","hashAttributes","setExtensionData"];i.forEach(function(e){window.mParticle[e]=r(e)});t.forEach(function(e){window.mParticle.eCommerce[e]=r(e,"eCommerce")});n.forEach(function(e){window.mParticle.Identity[e]=r(e,"Identity")});o.forEach(function(e){window.mParticle.Rokt[e]=r(e,"Rokt")});function r(i,t){return function(){if(t){i=t+"."+i}var e=Array.prototype.slice.call(arguments);e.unshift(i);window.mParticle.config.rq.push(e)}}var a=window.mParticle.config,c=a.isDevelopmentMode?1:0,s="?env="+c,l=a.dataPlan;if(l){var w=l.planId,d=l.planVersion;if(w){if(d&&(d<1||d>1e3)){d=null}s+="&plan_id="+w+(d?"&plan_version="+d:"")}}var m=a.versions;var f=[];if(m){Object.keys(m).forEach(function(e){f.push(e+"="+m[e])})}var p=document.createElement("script");p.type="text/javascript";p.async=true;window.ROKT_DOMAIN=ROKT_DOMAIN||"https://apps.rokt-api.com";window.mParticle.config.domain=ROKT_DOMAIN.split("//")[1];p.src=ROKT_DOMAIN+"/js/v2/"+e+"/app.js"+s+"&"+f.join("&");var P=document.getElementsByTagName("script")[0];P.parentNode.insertBefore(p,P)})("REPLACE WITH API KEY"); \ No newline at end of file +(function(e){window.mParticle=window.mParticle||{};window.mParticle.EventType={Unknown:0,Navigation:1,Location:2,Search:3,Transaction:4,UserContent:5,UserPreference:6,Social:7,Other:8,Media:9};window.mParticle.eCommerce={Cart:{}};window.mParticle.Identity={};window.mParticle.Rokt={};window.mParticle.config=window.mParticle.config||{};window.mParticle.config.rq=[];window.mParticle.config.snippetVersion=2.6;window.mParticle.ready=function(e){window.mParticle.config.rq.push(e)};var i=["endSession","logError","logBaseEvent","logEvent","logForm","logLink","logPageView","setSessionAttribute","setAppName","setAppVersion","setOptOut","setPosition","startNewSession","startTrackingLocation","stopTrackingLocation"];var t=["setCurrencyCode","logCheckout"];var n=["identify","login","logout","modify"];var o=["selectPlacements","hashAttributes","setExtensionData","use","getVersion","terminate"];i.forEach(function(e){window.mParticle[e]=r(e)});t.forEach(function(e){window.mParticle.eCommerce[e]=r(e,"eCommerce")});n.forEach(function(e){window.mParticle.Identity[e]=r(e,"Identity")});o.forEach(function(e){window.mParticle.Rokt[e]=r(e,"Rokt")});function r(i,t){return function(){if(t){i=t+"."+i}var e=Array.prototype.slice.call(arguments);e.unshift(i);window.mParticle.config.rq.push(e)}}var a=window.mParticle.config,c=a.isDevelopmentMode?1:0,s="?env="+c,l=a.dataPlan;if(l){var w=l.planId,m=l.planVersion;if(w){if(m&&(m<1||m>1e3)){m=null}s+="&plan_id="+w+(m?"&plan_version="+m:"")}}var d=a.versions;var f=[];if(d){Object.keys(d).forEach(function(e){f.push(e+"="+d[e])})}var p=document.createElement("script");p.type="text/javascript";p.async=true;window.ROKT_DOMAIN=ROKT_DOMAIN||"https://apps.rokt-api.com";window.mParticle.config.domain=ROKT_DOMAIN.split("//")[1];p.src=ROKT_DOMAIN+"/js/v2/"+e+"/app.js"+s+"&"+f.join("&");var P=document.getElementsByTagName("script")[0];P.parentNode.insertBefore(p,P)})("REPLACE WITH API KEY"); \ No newline at end of file diff --git a/src/roktManager.ts b/src/roktManager.ts index f67335cbd..c426fb54e 100644 --- a/src/roktManager.ts +++ b/src/roktManager.ts @@ -38,7 +38,7 @@ export interface IRoktSelection { export interface IRoktLauncher { selectPlacements: (options: IRoktSelectPlacementsOptions) => Promise; hashAttributes: (attributes: IRoktPartnerAttributes) => Promise>; - use: (name: string) => Promise; + use: (name: string) => Promise; getVersion: () => Promise; terminate: () => Promise; } @@ -67,7 +67,7 @@ export interface IRoktKit { setExtensionData(extensionData: IRoktPartnerExtensionData): void; terminate: () => Promise; getVersion: () => Promise; - use: (name: string) => Promise; + use: (name: string) => Promise; launcherOptions?: Dictionary; } @@ -257,7 +257,7 @@ export default class RoktManager { } } - public use(name: string): Promise { + public use(name: string): Promise { if (!this.isReady()) { return this.deferredCall('use', name); } From 49874ef74ec46f7ca83ad93c6d95200ead80b21e Mon Sep 17 00:00:00 2001 From: Jaissica Date: Mon, 15 Sep 2025 09:28:31 -0400 Subject: [PATCH 7/8] chore: bump up snippet version --- README.md | 3 +-- snippet.js | 2 +- snippet.min.js | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 6b8805fb8..68f01852c 100644 --- a/README.md +++ b/README.md @@ -46,8 +46,7 @@ window.mParticle = { }; //load the SDK -(function(e){window.mParticle=window.mParticle||{};window.mParticle.EventType={Unknown:0,Navigation:1,Location:2,Search:3,Transaction:4,UserContent:5,UserPreference:6,Social:7,Other:8,Media:9};window.mParticle.eCommerce={Cart:{}};window.mParticle.Identity={};window.mParticle.Rokt={};window.mParticle.config=window.mParticle.config||{};window.mParticle.config.rq=[];window.mParticle.config.snippetVersion=2.5;window.mParticle.ready=function(e){window.mParticle.config.rq.push(e)};var t=["endSession","logError","logBaseEvent","logEvent","logForm","logLink","logPageView","setSessionAttribute","setAppName","setAppVersion","setOptOut","setPosition","startNewSession","startTrackingLocation","stopTrackingLocation"];var i=["setCurrencyCode","logCheckout"];var n=["identify","login","logout","modify"];var o=["selectPlacements","hashAttributes","setExtensionData","use","getVersion","terminate"];t.forEach(function(e){window.mParticle[e]=r(e)});i.forEach(function(e){window.mParticle.eCommerce[e]=r(e,"eCommerce")});n.forEach(function(e){window.mParticle.Identity[e]=r(e,"Identity")});o.forEach(function(e){window.mParticle.Rokt[e]=r(e,"Rokt")});function r(t,i){return function(){if(i){t=i+"."+t}var e=Array.prototype.slice.call(arguments);e.unshift(t);window.mParticle.config.rq.push(e)}}var a,c,s=window.mParticle.config,l=s.isDevelopmentMode?1:0,w="?env="+l,d=window.mParticle.config.dataPlan;if(d){a=d.planId;c=d.planVersion;if(a){if(c&&(c<1||c>1e3)){c=null}w+="&plan_id="+a+(c?"&plan_version="+c:"")}}var m=window.mParticle.config.versions;var f=[];if(m){Object.keys(m).forEach(function(e){f.push(e+"="+m[e])})}var p=document.createElement("script");p.type="text/javascript";p.async=true;p.src=("https:"==document.location.protocol?"https://jssdkcdns":"http://jssdkcdn")+".mparticle.com/js/v2/"+e+"/mparticle.js"+w+"&"+f.join("&");var P=document.getElementsByTagName("script")[0];P.parentNode.insertBefore(p,P)})("REPLACE WITH API KEY"); - +(function(e){window.mParticle=window.mParticle||{};window.mParticle.EventType={Unknown:0,Navigation:1,Location:2,Search:3,Transaction:4,UserContent:5,UserPreference:6,Social:7,Other:8,Media:9};window.mParticle.eCommerce={Cart:{}};window.mParticle.Identity={};window.mParticle.Rokt={};window.mParticle.config=window.mParticle.config||{};window.mParticle.config.rq=[];window.mParticle.config.snippetVersion=2.6;window.mParticle.ready=function(e){window.mParticle.config.rq.push(e)};var t=["endSession","logError","logBaseEvent","logEvent","logForm","logLink","logPageView","setSessionAttribute","setAppName","setAppVersion","setOptOut","setPosition","startNewSession","startTrackingLocation","stopTrackingLocation"];var i=["setCurrencyCode","logCheckout"];var n=["identify","login","logout","modify"];var o=["selectPlacements","hashAttributes","setExtensionData","use","getVersion","terminate"];t.forEach(function(e){window.mParticle[e]=r(e)});i.forEach(function(e){window.mParticle.eCommerce[e]=r(e,"eCommerce")});n.forEach(function(e){window.mParticle.Identity[e]=r(e,"Identity")});o.forEach(function(e){window.mParticle.Rokt[e]=r(e,"Rokt")});function r(t,i){return function(){if(i){t=i+"."+t}var e=Array.prototype.slice.call(arguments);e.unshift(t);window.mParticle.config.rq.push(e)}}var a,c,s=window.mParticle.config,l=s.isDevelopmentMode?1:0,w="?env="+l,d=window.mParticle.config.dataPlan;if(d){a=d.planId;c=d.planVersion;if(a){if(c&&(c<1||c>1e3)){c=null}w+="&plan_id="+a+(c?"&plan_version="+c:"")}}var m=window.mParticle.config.versions;var f=[];if(m){Object.keys(m).forEach(function(e){f.push(e+"="+m[e])})}var p=document.createElement("script");p.type="text/javascript";p.async=true;p.src=("https:"==document.location.protocol?"https://jssdkcdns":"http://jssdkcdn")+".mparticle.com/js/v2/"+e+"/mparticle.js"+w+"&"+f.join("&");var P=document.getElementsByTagName("script")[0];P.parentNode.insertBefore(p,P)})("REPLACE WITH API KEY"); ``` You can then log events, for example, as follows: diff --git a/snippet.js b/snippet.js index 83ff6ffcf..8603556d4 100644 --- a/snippet.js +++ b/snippet.js @@ -19,7 +19,7 @@ window.mParticle.Rokt = {}; window.mParticle.config = window.mParticle.config || {}; window.mParticle.config.rq = []; - window.mParticle.config.snippetVersion = 2.5; + window.mParticle.config.snippetVersion = 2.6; window.mParticle.ready = function(f) { window.mParticle.config.rq.push(f); }; diff --git a/snippet.min.js b/snippet.min.js index e517aca73..ec29c84fc 100644 --- a/snippet.min.js +++ b/snippet.min.js @@ -1 +1 @@ -(function(e){window.mParticle=window.mParticle||{};window.mParticle.EventType={Unknown:0,Navigation:1,Location:2,Search:3,Transaction:4,UserContent:5,UserPreference:6,Social:7,Other:8,Media:9};window.mParticle.eCommerce={Cart:{}};window.mParticle.Identity={};window.mParticle.Rokt={};window.mParticle.config=window.mParticle.config||{};window.mParticle.config.rq=[];window.mParticle.config.snippetVersion=2.5;window.mParticle.ready=function(e){window.mParticle.config.rq.push(e)};var t=["endSession","logError","logBaseEvent","logEvent","logForm","logLink","logPageView","setSessionAttribute","setAppName","setAppVersion","setOptOut","setPosition","startNewSession","startTrackingLocation","stopTrackingLocation"];var i=["setCurrencyCode","logCheckout"];var n=["identify","login","logout","modify"];var o=["selectPlacements","hashAttributes","setExtensionData","use","getVersion","terminate"];t.forEach(function(e){window.mParticle[e]=r(e)});i.forEach(function(e){window.mParticle.eCommerce[e]=r(e,"eCommerce")});n.forEach(function(e){window.mParticle.Identity[e]=r(e,"Identity")});o.forEach(function(e){window.mParticle.Rokt[e]=r(e,"Rokt")});function r(t,i){return function(){if(i){t=i+"."+t}var e=Array.prototype.slice.call(arguments);e.unshift(t);window.mParticle.config.rq.push(e)}}var a,c,s=window.mParticle.config,l=s.isDevelopmentMode?1:0,w="?env="+l,d=window.mParticle.config.dataPlan;if(d){a=d.planId;c=d.planVersion;if(a){if(c&&(c<1||c>1e3)){c=null}w+="&plan_id="+a+(c?"&plan_version="+c:"")}}var m=window.mParticle.config.versions;var f=[];if(m){Object.keys(m).forEach(function(e){f.push(e+"="+m[e])})}var p=document.createElement("script");p.type="text/javascript";p.async=true;p.src=("https:"==document.location.protocol?"https://jssdkcdns":"http://jssdkcdn")+".mparticle.com/js/v2/"+e+"/mparticle.js"+w+"&"+f.join("&");var P=document.getElementsByTagName("script")[0];P.parentNode.insertBefore(p,P)})("REPLACE WITH API KEY"); \ No newline at end of file +(function(e){window.mParticle=window.mParticle||{};window.mParticle.EventType={Unknown:0,Navigation:1,Location:2,Search:3,Transaction:4,UserContent:5,UserPreference:6,Social:7,Other:8,Media:9};window.mParticle.eCommerce={Cart:{}};window.mParticle.Identity={};window.mParticle.Rokt={};window.mParticle.config=window.mParticle.config||{};window.mParticle.config.rq=[];window.mParticle.config.snippetVersion=2.6;window.mParticle.ready=function(e){window.mParticle.config.rq.push(e)};var t=["endSession","logError","logBaseEvent","logEvent","logForm","logLink","logPageView","setSessionAttribute","setAppName","setAppVersion","setOptOut","setPosition","startNewSession","startTrackingLocation","stopTrackingLocation"];var i=["setCurrencyCode","logCheckout"];var n=["identify","login","logout","modify"];var o=["selectPlacements","hashAttributes","setExtensionData","use","getVersion","terminate"];t.forEach(function(e){window.mParticle[e]=r(e)});i.forEach(function(e){window.mParticle.eCommerce[e]=r(e,"eCommerce")});n.forEach(function(e){window.mParticle.Identity[e]=r(e,"Identity")});o.forEach(function(e){window.mParticle.Rokt[e]=r(e,"Rokt")});function r(t,i){return function(){if(i){t=i+"."+t}var e=Array.prototype.slice.call(arguments);e.unshift(t);window.mParticle.config.rq.push(e)}}var a,c,s=window.mParticle.config,l=s.isDevelopmentMode?1:0,w="?env="+l,d=window.mParticle.config.dataPlan;if(d){a=d.planId;c=d.planVersion;if(a){if(c&&(c<1||c>1e3)){c=null}w+="&plan_id="+a+(c?"&plan_version="+c:"")}}var m=window.mParticle.config.versions;var f=[];if(m){Object.keys(m).forEach(function(e){f.push(e+"="+m[e])})}var p=document.createElement("script");p.type="text/javascript";p.async=true;p.src=("https:"==document.location.protocol?"https://jssdkcdns":"http://jssdkcdn")+".mparticle.com/js/v2/"+e+"/mparticle.js"+w+"&"+f.join("&");var P=document.getElementsByTagName("script")[0];P.parentNode.insertBefore(p,P)})("REPLACE WITH API KEY"); \ No newline at end of file From c624db92e4d3b7f5e4344b678633bc3095defb09 Mon Sep 17 00:00:00 2001 From: Jaissica Date: Mon, 15 Sep 2025 09:35:44 -0400 Subject: [PATCH 8/8] chore: bump up snippet version to 2.7 --- README.md | 2 +- snippet.js | 2 +- snippet.min.js | 2 +- snippet.rokt.js | 2 +- snippet.rokt.min.js | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 68f01852c..410419d5f 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,7 @@ window.mParticle = { }; //load the SDK -(function(e){window.mParticle=window.mParticle||{};window.mParticle.EventType={Unknown:0,Navigation:1,Location:2,Search:3,Transaction:4,UserContent:5,UserPreference:6,Social:7,Other:8,Media:9};window.mParticle.eCommerce={Cart:{}};window.mParticle.Identity={};window.mParticle.Rokt={};window.mParticle.config=window.mParticle.config||{};window.mParticle.config.rq=[];window.mParticle.config.snippetVersion=2.6;window.mParticle.ready=function(e){window.mParticle.config.rq.push(e)};var t=["endSession","logError","logBaseEvent","logEvent","logForm","logLink","logPageView","setSessionAttribute","setAppName","setAppVersion","setOptOut","setPosition","startNewSession","startTrackingLocation","stopTrackingLocation"];var i=["setCurrencyCode","logCheckout"];var n=["identify","login","logout","modify"];var o=["selectPlacements","hashAttributes","setExtensionData","use","getVersion","terminate"];t.forEach(function(e){window.mParticle[e]=r(e)});i.forEach(function(e){window.mParticle.eCommerce[e]=r(e,"eCommerce")});n.forEach(function(e){window.mParticle.Identity[e]=r(e,"Identity")});o.forEach(function(e){window.mParticle.Rokt[e]=r(e,"Rokt")});function r(t,i){return function(){if(i){t=i+"."+t}var e=Array.prototype.slice.call(arguments);e.unshift(t);window.mParticle.config.rq.push(e)}}var a,c,s=window.mParticle.config,l=s.isDevelopmentMode?1:0,w="?env="+l,d=window.mParticle.config.dataPlan;if(d){a=d.planId;c=d.planVersion;if(a){if(c&&(c<1||c>1e3)){c=null}w+="&plan_id="+a+(c?"&plan_version="+c:"")}}var m=window.mParticle.config.versions;var f=[];if(m){Object.keys(m).forEach(function(e){f.push(e+"="+m[e])})}var p=document.createElement("script");p.type="text/javascript";p.async=true;p.src=("https:"==document.location.protocol?"https://jssdkcdns":"http://jssdkcdn")+".mparticle.com/js/v2/"+e+"/mparticle.js"+w+"&"+f.join("&");var P=document.getElementsByTagName("script")[0];P.parentNode.insertBefore(p,P)})("REPLACE WITH API KEY"); +(function(e){window.mParticle=window.mParticle||{};window.mParticle.EventType={Unknown:0,Navigation:1,Location:2,Search:3,Transaction:4,UserContent:5,UserPreference:6,Social:7,Other:8,Media:9};window.mParticle.eCommerce={Cart:{}};window.mParticle.Identity={};window.mParticle.Rokt={};window.mParticle.config=window.mParticle.config||{};window.mParticle.config.rq=[];window.mParticle.config.snippetVersion=2.7;window.mParticle.ready=function(e){window.mParticle.config.rq.push(e)};var t=["endSession","logError","logBaseEvent","logEvent","logForm","logLink","logPageView","setSessionAttribute","setAppName","setAppVersion","setOptOut","setPosition","startNewSession","startTrackingLocation","stopTrackingLocation"];var i=["setCurrencyCode","logCheckout"];var n=["identify","login","logout","modify"];var o=["selectPlacements","hashAttributes","setExtensionData","use","getVersion","terminate"];t.forEach(function(e){window.mParticle[e]=r(e)});i.forEach(function(e){window.mParticle.eCommerce[e]=r(e,"eCommerce")});n.forEach(function(e){window.mParticle.Identity[e]=r(e,"Identity")});o.forEach(function(e){window.mParticle.Rokt[e]=r(e,"Rokt")});function r(t,i){return function(){if(i){t=i+"."+t}var e=Array.prototype.slice.call(arguments);e.unshift(t);window.mParticle.config.rq.push(e)}}var a,c,s=window.mParticle.config,l=s.isDevelopmentMode?1:0,w="?env="+l,d=window.mParticle.config.dataPlan;if(d){a=d.planId;c=d.planVersion;if(a){if(c&&(c<1||c>1e3)){c=null}w+="&plan_id="+a+(c?"&plan_version="+c:"")}}var m=window.mParticle.config.versions;var f=[];if(m){Object.keys(m).forEach(function(e){f.push(e+"="+m[e])})}var p=document.createElement("script");p.type="text/javascript";p.async=true;p.src=("https:"==document.location.protocol?"https://jssdkcdns":"http://jssdkcdn")+".mparticle.com/js/v2/"+e+"/mparticle.js"+w+"&"+f.join("&");var P=document.getElementsByTagName("script")[0];P.parentNode.insertBefore(p,P)})("REPLACE WITH API KEY"); ``` You can then log events, for example, as follows: diff --git a/snippet.js b/snippet.js index 8603556d4..0fbe70c2b 100644 --- a/snippet.js +++ b/snippet.js @@ -19,7 +19,7 @@ window.mParticle.Rokt = {}; window.mParticle.config = window.mParticle.config || {}; window.mParticle.config.rq = []; - window.mParticle.config.snippetVersion = 2.6; + window.mParticle.config.snippetVersion = 2.7; window.mParticle.ready = function(f) { window.mParticle.config.rq.push(f); }; diff --git a/snippet.min.js b/snippet.min.js index ec29c84fc..c217982ee 100644 --- a/snippet.min.js +++ b/snippet.min.js @@ -1 +1 @@ -(function(e){window.mParticle=window.mParticle||{};window.mParticle.EventType={Unknown:0,Navigation:1,Location:2,Search:3,Transaction:4,UserContent:5,UserPreference:6,Social:7,Other:8,Media:9};window.mParticle.eCommerce={Cart:{}};window.mParticle.Identity={};window.mParticle.Rokt={};window.mParticle.config=window.mParticle.config||{};window.mParticle.config.rq=[];window.mParticle.config.snippetVersion=2.6;window.mParticle.ready=function(e){window.mParticle.config.rq.push(e)};var t=["endSession","logError","logBaseEvent","logEvent","logForm","logLink","logPageView","setSessionAttribute","setAppName","setAppVersion","setOptOut","setPosition","startNewSession","startTrackingLocation","stopTrackingLocation"];var i=["setCurrencyCode","logCheckout"];var n=["identify","login","logout","modify"];var o=["selectPlacements","hashAttributes","setExtensionData","use","getVersion","terminate"];t.forEach(function(e){window.mParticle[e]=r(e)});i.forEach(function(e){window.mParticle.eCommerce[e]=r(e,"eCommerce")});n.forEach(function(e){window.mParticle.Identity[e]=r(e,"Identity")});o.forEach(function(e){window.mParticle.Rokt[e]=r(e,"Rokt")});function r(t,i){return function(){if(i){t=i+"."+t}var e=Array.prototype.slice.call(arguments);e.unshift(t);window.mParticle.config.rq.push(e)}}var a,c,s=window.mParticle.config,l=s.isDevelopmentMode?1:0,w="?env="+l,d=window.mParticle.config.dataPlan;if(d){a=d.planId;c=d.planVersion;if(a){if(c&&(c<1||c>1e3)){c=null}w+="&plan_id="+a+(c?"&plan_version="+c:"")}}var m=window.mParticle.config.versions;var f=[];if(m){Object.keys(m).forEach(function(e){f.push(e+"="+m[e])})}var p=document.createElement("script");p.type="text/javascript";p.async=true;p.src=("https:"==document.location.protocol?"https://jssdkcdns":"http://jssdkcdn")+".mparticle.com/js/v2/"+e+"/mparticle.js"+w+"&"+f.join("&");var P=document.getElementsByTagName("script")[0];P.parentNode.insertBefore(p,P)})("REPLACE WITH API KEY"); \ No newline at end of file +(function(e){window.mParticle=window.mParticle||{};window.mParticle.EventType={Unknown:0,Navigation:1,Location:2,Search:3,Transaction:4,UserContent:5,UserPreference:6,Social:7,Other:8,Media:9};window.mParticle.eCommerce={Cart:{}};window.mParticle.Identity={};window.mParticle.Rokt={};window.mParticle.config=window.mParticle.config||{};window.mParticle.config.rq=[];window.mParticle.config.snippetVersion=2.7;window.mParticle.ready=function(e){window.mParticle.config.rq.push(e)};var t=["endSession","logError","logBaseEvent","logEvent","logForm","logLink","logPageView","setSessionAttribute","setAppName","setAppVersion","setOptOut","setPosition","startNewSession","startTrackingLocation","stopTrackingLocation"];var i=["setCurrencyCode","logCheckout"];var n=["identify","login","logout","modify"];var o=["selectPlacements","hashAttributes","setExtensionData","use","getVersion","terminate"];t.forEach(function(e){window.mParticle[e]=r(e)});i.forEach(function(e){window.mParticle.eCommerce[e]=r(e,"eCommerce")});n.forEach(function(e){window.mParticle.Identity[e]=r(e,"Identity")});o.forEach(function(e){window.mParticle.Rokt[e]=r(e,"Rokt")});function r(t,i){return function(){if(i){t=i+"."+t}var e=Array.prototype.slice.call(arguments);e.unshift(t);window.mParticle.config.rq.push(e)}}var a,c,s=window.mParticle.config,l=s.isDevelopmentMode?1:0,w="?env="+l,d=window.mParticle.config.dataPlan;if(d){a=d.planId;c=d.planVersion;if(a){if(c&&(c<1||c>1e3)){c=null}w+="&plan_id="+a+(c?"&plan_version="+c:"")}}var m=window.mParticle.config.versions;var f=[];if(m){Object.keys(m).forEach(function(e){f.push(e+"="+m[e])})}var p=document.createElement("script");p.type="text/javascript";p.async=true;p.src=("https:"==document.location.protocol?"https://jssdkcdns":"http://jssdkcdn")+".mparticle.com/js/v2/"+e+"/mparticle.js"+w+"&"+f.join("&");var P=document.getElementsByTagName("script")[0];P.parentNode.insertBefore(p,P)})("REPLACE WITH API KEY"); \ No newline at end of file diff --git a/snippet.rokt.js b/snippet.rokt.js index 2b7dd533e..aa66583f0 100644 --- a/snippet.rokt.js +++ b/snippet.rokt.js @@ -19,7 +19,7 @@ window.mParticle.Rokt = {}; window.mParticle.config = window.mParticle.config || {}; window.mParticle.config.rq = []; - window.mParticle.config.snippetVersion = 2.6; + window.mParticle.config.snippetVersion = 2.7; window.mParticle.ready = function(f) { window.mParticle.config.rq.push(f); }; diff --git a/snippet.rokt.min.js b/snippet.rokt.min.js index e01c44ecb..e2c8c1f4d 100644 --- a/snippet.rokt.min.js +++ b/snippet.rokt.min.js @@ -1 +1 @@ -(function(e){window.mParticle=window.mParticle||{};window.mParticle.EventType={Unknown:0,Navigation:1,Location:2,Search:3,Transaction:4,UserContent:5,UserPreference:6,Social:7,Other:8,Media:9};window.mParticle.eCommerce={Cart:{}};window.mParticle.Identity={};window.mParticle.Rokt={};window.mParticle.config=window.mParticle.config||{};window.mParticle.config.rq=[];window.mParticle.config.snippetVersion=2.6;window.mParticle.ready=function(e){window.mParticle.config.rq.push(e)};var i=["endSession","logError","logBaseEvent","logEvent","logForm","logLink","logPageView","setSessionAttribute","setAppName","setAppVersion","setOptOut","setPosition","startNewSession","startTrackingLocation","stopTrackingLocation"];var t=["setCurrencyCode","logCheckout"];var n=["identify","login","logout","modify"];var o=["selectPlacements","hashAttributes","setExtensionData","use","getVersion","terminate"];i.forEach(function(e){window.mParticle[e]=r(e)});t.forEach(function(e){window.mParticle.eCommerce[e]=r(e,"eCommerce")});n.forEach(function(e){window.mParticle.Identity[e]=r(e,"Identity")});o.forEach(function(e){window.mParticle.Rokt[e]=r(e,"Rokt")});function r(i,t){return function(){if(t){i=t+"."+i}var e=Array.prototype.slice.call(arguments);e.unshift(i);window.mParticle.config.rq.push(e)}}var a=window.mParticle.config,c=a.isDevelopmentMode?1:0,s="?env="+c,l=a.dataPlan;if(l){var w=l.planId,m=l.planVersion;if(w){if(m&&(m<1||m>1e3)){m=null}s+="&plan_id="+w+(m?"&plan_version="+m:"")}}var d=a.versions;var f=[];if(d){Object.keys(d).forEach(function(e){f.push(e+"="+d[e])})}var p=document.createElement("script");p.type="text/javascript";p.async=true;window.ROKT_DOMAIN=ROKT_DOMAIN||"https://apps.rokt-api.com";window.mParticle.config.domain=ROKT_DOMAIN.split("//")[1];p.src=ROKT_DOMAIN+"/js/v2/"+e+"/app.js"+s+"&"+f.join("&");var P=document.getElementsByTagName("script")[0];P.parentNode.insertBefore(p,P)})("REPLACE WITH API KEY"); \ No newline at end of file +(function(e){window.mParticle=window.mParticle||{};window.mParticle.EventType={Unknown:0,Navigation:1,Location:2,Search:3,Transaction:4,UserContent:5,UserPreference:6,Social:7,Other:8,Media:9};window.mParticle.eCommerce={Cart:{}};window.mParticle.Identity={};window.mParticle.Rokt={};window.mParticle.config=window.mParticle.config||{};window.mParticle.config.rq=[];window.mParticle.config.snippetVersion=2.7;window.mParticle.ready=function(e){window.mParticle.config.rq.push(e)};var i=["endSession","logError","logBaseEvent","logEvent","logForm","logLink","logPageView","setSessionAttribute","setAppName","setAppVersion","setOptOut","setPosition","startNewSession","startTrackingLocation","stopTrackingLocation"];var t=["setCurrencyCode","logCheckout"];var n=["identify","login","logout","modify"];var o=["selectPlacements","hashAttributes","setExtensionData","use","getVersion","terminate"];i.forEach(function(e){window.mParticle[e]=r(e)});t.forEach(function(e){window.mParticle.eCommerce[e]=r(e,"eCommerce")});n.forEach(function(e){window.mParticle.Identity[e]=r(e,"Identity")});o.forEach(function(e){window.mParticle.Rokt[e]=r(e,"Rokt")});function r(i,t){return function(){if(t){i=t+"."+i}var e=Array.prototype.slice.call(arguments);e.unshift(i);window.mParticle.config.rq.push(e)}}var a=window.mParticle.config,c=a.isDevelopmentMode?1:0,s="?env="+c,l=a.dataPlan;if(l){var w=l.planId,m=l.planVersion;if(w){if(m&&(m<1||m>1e3)){m=null}s+="&plan_id="+w+(m?"&plan_version="+m:"")}}var d=a.versions;var f=[];if(d){Object.keys(d).forEach(function(e){f.push(e+"="+d[e])})}var p=document.createElement("script");p.type="text/javascript";p.async=true;window.ROKT_DOMAIN=ROKT_DOMAIN||"https://apps.rokt-api.com";window.mParticle.config.domain=ROKT_DOMAIN.split("//")[1];p.src=ROKT_DOMAIN+"/js/v2/"+e+"/app.js"+s+"&"+f.join("&");var P=document.getElementsByTagName("script")[0];P.parentNode.insertBefore(p,P)})("REPLACE WITH API KEY"); \ No newline at end of file