From 248ae4e726bafdf031e883a8d992efde7d3b44fd Mon Sep 17 00:00:00 2001 From: SbDove <100377552+SbDove@users.noreply.github.com> Date: Mon, 2 Dec 2024 10:32:36 -0800 Subject: [PATCH 1/4] Update to properly set integration attribute --- dist/ID5Kit.common.js | 21 ++++++++++----------- dist/ID5Kit.iife.js | 21 ++++++++++----------- src/common.js | 2 +- test/end-to-end-testapp/settings.js | 3 ++- test/src/tests.js | 2 +- 5 files changed, 24 insertions(+), 25 deletions(-) diff --git a/dist/ID5Kit.common.js b/dist/ID5Kit.common.js index 5b02144..f992768 100644 --- a/dist/ID5Kit.common.js +++ b/dist/ID5Kit.common.js @@ -1028,16 +1028,16 @@ Common.prototype.exampleMethod = function () { }; Common.prototype.logId5Id = function (id5Id) { - //Checks and saves ID5 ID if it is new - if (id5Id !== this.id5Id) { - this.id5Id = id5Id; - this.id5IdSent = false; + if (!id5Id) { + return; } - //Sets user attribute if ID is unsent. - //This function will be updated once the decryption architecture is finalized. - //TO-DO: Log the ID5 ID to correct location + var integrationAttributes = { + encryptedId5Id: id5Id, + id5IdType: this.id5IdType, + }; + window.mParticle.setIntegrationAttribute(248, integrationAttributes); }; Common.prototype.buildPartnerData = function (mParticleUser) { @@ -1307,6 +1307,9 @@ var initialization = { */ initForwarder: function(forwarderSettings, testMode, userAttributes, userIdentities, processEvent, eventQueue, isInitialized, common) { /* `forwarderSettings` contains your SDK specific settings such as apiKey that your customer needs in order to initialize your SDK properly */ + common.partnerId = forwarderSettings.partnerId; + common.id5IdType = forwarderSettings.id5IdType; + common.moduleId = this.moduleId; if (!testMode) { /* Load your Web SDK here using a variant of your snippet from your readme that your customers would generally put into their tags @@ -1317,10 +1320,6 @@ var initialization = { id5Script.src = 'https://cdn.id5-sync.com/api/1.0/id5-api.js'; (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(id5Script); - common.id5Id = null; - common.id5IdSent = false; - common.partnerId = forwarderSettings.partnerId; - id5Script.onload = function() { var id5Instance = window.ID5.init({partnerId: common.partnerId}); diff --git a/dist/ID5Kit.iife.js b/dist/ID5Kit.iife.js index 87fffda..28e849a 100644 --- a/dist/ID5Kit.iife.js +++ b/dist/ID5Kit.iife.js @@ -1027,16 +1027,16 @@ var ID5Kit = (function (exports) { }; Common.prototype.logId5Id = function (id5Id) { - //Checks and saves ID5 ID if it is new - if (id5Id !== this.id5Id) { - this.id5Id = id5Id; - this.id5IdSent = false; + if (!id5Id) { + return; } - //Sets user attribute if ID is unsent. - //This function will be updated once the decryption architecture is finalized. - //TO-DO: Log the ID5 ID to correct location + var integrationAttributes = { + encryptedId5Id: id5Id, + id5IdType: this.id5IdType, + }; + window.mParticle.setIntegrationAttribute(248, integrationAttributes); }; Common.prototype.buildPartnerData = function (mParticleUser) { @@ -1306,6 +1306,9 @@ var ID5Kit = (function (exports) { */ initForwarder: function(forwarderSettings, testMode, userAttributes, userIdentities, processEvent, eventQueue, isInitialized, common) { /* `forwarderSettings` contains your SDK specific settings such as apiKey that your customer needs in order to initialize your SDK properly */ + common.partnerId = forwarderSettings.partnerId; + common.id5IdType = forwarderSettings.id5IdType; + common.moduleId = this.moduleId; if (!testMode) { /* Load your Web SDK here using a variant of your snippet from your readme that your customers would generally put into their tags @@ -1316,10 +1319,6 @@ var ID5Kit = (function (exports) { id5Script.src = 'https://cdn.id5-sync.com/api/1.0/id5-api.js'; (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(id5Script); - common.id5Id = null; - common.id5IdSent = false; - common.partnerId = forwarderSettings.partnerId; - id5Script.onload = function() { var id5Instance = window.ID5.init({partnerId: common.partnerId}); diff --git a/src/common.js b/src/common.js index d26463c..c1106ec 100644 --- a/src/common.js +++ b/src/common.js @@ -15,7 +15,7 @@ Common.prototype.logId5Id = function (id5Id) { id5IdType: this.id5IdType, }; - window.mParticle.setIntegrationAttributes(this.moduleId, integrationAttributes); + window.mParticle.setIntegrationAttribute(248, integrationAttributes); }; Common.prototype.buildPartnerData = function (mParticleUser) { diff --git a/test/end-to-end-testapp/settings.js b/test/end-to-end-testapp/settings.js index 11cc53f..87759fa 100644 --- a/test/end-to-end-testapp/settings.js +++ b/test/end-to-end-testapp/settings.js @@ -1,5 +1,6 @@ var SDKsettings = { - partnerId: 1234 + partnerId: 1747, + id5IdType: "Other" /* fill in SDKsettings with any particular settings or options your sdk requires in order to initialize, this may be apiKey, projectId, primaryCustomerType, etc. These are passed into the src/initialization.js file as the diff --git a/test/src/tests.js b/test/src/tests.js index 8f49b73..d70352c 100644 --- a/test/src/tests.js +++ b/test/src/tests.js @@ -43,7 +43,7 @@ describe('ID5 Forwarder', function () { } }; - mParticle.setIntegrationAttributes = function(id, attributes) { + mParticle.setIntegrationAttribute = function(id, attributes) { integrationAttributes[id] = attributes; } From 9b3ef54534b6f02a9ef1d15b8fca80f063e2424e Mon Sep 17 00:00:00 2001 From: SbDove <100377552+SbDove@users.noreply.github.com> Date: Mon, 2 Dec 2024 10:43:40 -0800 Subject: [PATCH 2/4] Revert to using const --- src/common.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common.js b/src/common.js index c1106ec..c032e87 100644 --- a/src/common.js +++ b/src/common.js @@ -15,7 +15,7 @@ Common.prototype.logId5Id = function (id5Id) { id5IdType: this.id5IdType, }; - window.mParticle.setIntegrationAttribute(248, integrationAttributes); + window.mParticle.setIntegrationAttribute(this.moduleId, integrationAttributes); }; Common.prototype.buildPartnerData = function (mParticleUser) { From 37368897c6a2c79e3485d9afd60a3b6aea3f0c60 Mon Sep 17 00:00:00 2001 From: SbDove <100377552+SbDove@users.noreply.github.com> Date: Mon, 2 Dec 2024 10:44:38 -0800 Subject: [PATCH 3/4] Revert build files --- dist/ID5Kit.common.js | 2 +- dist/ID5Kit.iife.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dist/ID5Kit.common.js b/dist/ID5Kit.common.js index f992768..75d6d4f 100644 --- a/dist/ID5Kit.common.js +++ b/dist/ID5Kit.common.js @@ -1037,7 +1037,7 @@ Common.prototype.logId5Id = function (id5Id) { id5IdType: this.id5IdType, }; - window.mParticle.setIntegrationAttribute(248, integrationAttributes); + window.mParticle.setIntegrationAttribute(this.moduleId, integrationAttributes); }; Common.prototype.buildPartnerData = function (mParticleUser) { diff --git a/dist/ID5Kit.iife.js b/dist/ID5Kit.iife.js index 28e849a..177195e 100644 --- a/dist/ID5Kit.iife.js +++ b/dist/ID5Kit.iife.js @@ -1036,7 +1036,7 @@ var ID5Kit = (function (exports) { id5IdType: this.id5IdType, }; - window.mParticle.setIntegrationAttribute(248, integrationAttributes); + window.mParticle.setIntegrationAttribute(this.moduleId, integrationAttributes); }; Common.prototype.buildPartnerData = function (mParticleUser) { From 7548b256d1e06efa1af08bbc92b1e878d0b14c15 Mon Sep 17 00:00:00 2001 From: SbDove <100377552+SbDove@users.noreply.github.com> Date: Mon, 2 Dec 2024 10:45:27 -0800 Subject: [PATCH 4/4] Revert to testing partnerId --- test/end-to-end-testapp/settings.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/end-to-end-testapp/settings.js b/test/end-to-end-testapp/settings.js index 87759fa..65b82e8 100644 --- a/test/end-to-end-testapp/settings.js +++ b/test/end-to-end-testapp/settings.js @@ -1,5 +1,5 @@ var SDKsettings = { - partnerId: 1747, + partnerId: 1234, id5IdType: "Other" /* fill in SDKsettings with any particular settings or options your sdk requires in order to initialize, this may be apiKey, projectId, primaryCustomerType, etc. These are passed