@mparticle/web-rokt-kit 1.4.0 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +26 -1
- package/dist/Rokt-Kit.common.js +23 -12
- package/dist/Rokt-Kit.iife.js +23 -12
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1 +1,26 @@
|
|
|
1
|
-
#
|
|
1
|
+
# mParticle Rokt Kit Integration
|
|
2
|
+
|
|
3
|
+
# Usage
|
|
4
|
+
JS kits are automatically included with your mParticle.js file when loading mParticle via the [snippet](https://docs.mparticle.com/developers/sdk/web/getting-started/#add-the-sdk-snippet).
|
|
5
|
+
|
|
6
|
+
If loading mParticle via [npm](https://docs.mparticle.com/developers/sdk/web/self-hosting/), you will have to manually include the Rokt kit via npm.
|
|
7
|
+
|
|
8
|
+
```
|
|
9
|
+
npm i @mparticle/web-rokt-kit
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
# License
|
|
13
|
+
|
|
14
|
+
Copyright 2025 mParticle, Inc.
|
|
15
|
+
|
|
16
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
17
|
+
you may not use this file except in compliance with the License.
|
|
18
|
+
You may obtain a copy of the License at
|
|
19
|
+
|
|
20
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
21
|
+
|
|
22
|
+
Unless required by applicable law or agreed to in writing, software
|
|
23
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
24
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
25
|
+
See the License for the specific language governing permissions and
|
|
26
|
+
limitations under the License.
|
package/dist/Rokt-Kit.common.js
CHANGED
|
@@ -17,8 +17,6 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
17
17
|
// See the License for the specific language governing permissions and
|
|
18
18
|
// limitations under the License.
|
|
19
19
|
|
|
20
|
-
var roktLauncherScript = 'https://apps.rokt.com/wsdk/integrations/launcher.js';
|
|
21
|
-
|
|
22
20
|
var name = 'Rokt';
|
|
23
21
|
var moduleId = 181;
|
|
24
22
|
|
|
@@ -34,6 +32,20 @@ var constructor = function () {
|
|
|
34
32
|
self.filteredUser = {};
|
|
35
33
|
self.userAttributes = {};
|
|
36
34
|
|
|
35
|
+
/**
|
|
36
|
+
* Generates the Rokt launcher script URL with optional domain override
|
|
37
|
+
* @param {string} domain - The CNAME domain to use for overriding the launcher url
|
|
38
|
+
* @returns {string} The complete launcher script URL
|
|
39
|
+
*/
|
|
40
|
+
function generateLauncherScript(_domain) {
|
|
41
|
+
// Override domain if a customer is using a CNAME
|
|
42
|
+
// If a customer is using a CNAME, a domain will be passed. If not, we use the default domain.
|
|
43
|
+
var domain = typeof _domain !== 'undefined' ? _domain : 'apps.rokt.com';
|
|
44
|
+
var protocol = 'https://';
|
|
45
|
+
var launcherPath = '/wsdk/integrations/launcher.js';
|
|
46
|
+
|
|
47
|
+
return [protocol, domain, launcherPath].join('');
|
|
48
|
+
}
|
|
37
49
|
/**
|
|
38
50
|
* Passes attributes to the Rokt Web SDK for client-side hashing
|
|
39
51
|
* @see https://docs.rokt.com/developers/integration-guides/web/library/integration-launcher#hash-attributes
|
|
@@ -59,17 +71,17 @@ var constructor = function () {
|
|
|
59
71
|
var accountId = settings.accountId;
|
|
60
72
|
self.userAttributes = filteredUserAttributes;
|
|
61
73
|
self.onboardingExpProvider = settings.onboardingExpProvider;
|
|
62
|
-
|
|
63
|
-
var managerOptions = window.mParticle.Rokt.managerOptions || {};
|
|
64
|
-
var sandbox = managerOptions.sandbox || false;
|
|
65
|
-
|
|
74
|
+
var domain = window.mParticle.Rokt.domain;
|
|
66
75
|
var launcherOptions = window.mParticle.Rokt.launcherOptions || {};
|
|
67
76
|
launcherOptions.integrationName = generateIntegrationName(
|
|
68
77
|
launcherOptions.integrationName
|
|
69
78
|
);
|
|
70
79
|
|
|
71
80
|
if (testMode) {
|
|
72
|
-
|
|
81
|
+
self.testHelpers = {
|
|
82
|
+
generateLauncherScript: generateLauncherScript,
|
|
83
|
+
};
|
|
84
|
+
attachLauncher(accountId, launcherOptions);
|
|
73
85
|
return;
|
|
74
86
|
}
|
|
75
87
|
|
|
@@ -77,7 +89,7 @@ var constructor = function () {
|
|
|
77
89
|
var target = document.head || document.body;
|
|
78
90
|
var script = document.createElement('script');
|
|
79
91
|
script.type = 'text/javascript';
|
|
80
|
-
script.src =
|
|
92
|
+
script.src = generateLauncherScript(domain);
|
|
81
93
|
script.async = true;
|
|
82
94
|
script.crossOrigin = 'anonymous';
|
|
83
95
|
script.fetchPriority = 'high';
|
|
@@ -90,7 +102,7 @@ var constructor = function () {
|
|
|
90
102
|
typeof window.Rokt.createLauncher === 'function' &&
|
|
91
103
|
window.Rokt.currentLauncher === undefined
|
|
92
104
|
) {
|
|
93
|
-
attachLauncher(accountId,
|
|
105
|
+
attachLauncher(accountId, launcherOptions);
|
|
94
106
|
} else {
|
|
95
107
|
console.error(
|
|
96
108
|
'Rokt object is not available after script load.'
|
|
@@ -180,11 +192,10 @@ var constructor = function () {
|
|
|
180
192
|
delete self.userAttributes[key];
|
|
181
193
|
}
|
|
182
194
|
|
|
183
|
-
function attachLauncher(accountId,
|
|
195
|
+
function attachLauncher(accountId, launcherOptions) {
|
|
184
196
|
var options = mergeObjects(
|
|
185
197
|
{
|
|
186
198
|
accountId: accountId,
|
|
187
|
-
sandbox: sandbox,
|
|
188
199
|
},
|
|
189
200
|
launcherOptions || {}
|
|
190
201
|
);
|
|
@@ -288,7 +299,7 @@ var constructor = function () {
|
|
|
288
299
|
|
|
289
300
|
function generateIntegrationName(customIntegrationName) {
|
|
290
301
|
var coreSdkVersion = window.mParticle.getVersion();
|
|
291
|
-
var kitVersion = "1.
|
|
302
|
+
var kitVersion = "1.5.0";
|
|
292
303
|
var name = 'mParticle_' + 'wsdkv_' + coreSdkVersion + '_kitv_' + kitVersion;
|
|
293
304
|
|
|
294
305
|
if (customIntegrationName) {
|
package/dist/Rokt-Kit.iife.js
CHANGED
|
@@ -16,8 +16,6 @@ var RoktKit = (function (exports) {
|
|
|
16
16
|
// See the License for the specific language governing permissions and
|
|
17
17
|
// limitations under the License.
|
|
18
18
|
|
|
19
|
-
var roktLauncherScript = 'https://apps.rokt.com/wsdk/integrations/launcher.js';
|
|
20
|
-
|
|
21
19
|
var name = 'Rokt';
|
|
22
20
|
var moduleId = 181;
|
|
23
21
|
|
|
@@ -33,6 +31,20 @@ var RoktKit = (function (exports) {
|
|
|
33
31
|
self.filteredUser = {};
|
|
34
32
|
self.userAttributes = {};
|
|
35
33
|
|
|
34
|
+
/**
|
|
35
|
+
* Generates the Rokt launcher script URL with optional domain override
|
|
36
|
+
* @param {string} domain - The CNAME domain to use for overriding the launcher url
|
|
37
|
+
* @returns {string} The complete launcher script URL
|
|
38
|
+
*/
|
|
39
|
+
function generateLauncherScript(_domain) {
|
|
40
|
+
// Override domain if a customer is using a CNAME
|
|
41
|
+
// If a customer is using a CNAME, a domain will be passed. If not, we use the default domain.
|
|
42
|
+
var domain = typeof _domain !== 'undefined' ? _domain : 'apps.rokt.com';
|
|
43
|
+
var protocol = 'https://';
|
|
44
|
+
var launcherPath = '/wsdk/integrations/launcher.js';
|
|
45
|
+
|
|
46
|
+
return [protocol, domain, launcherPath].join('');
|
|
47
|
+
}
|
|
36
48
|
/**
|
|
37
49
|
* Passes attributes to the Rokt Web SDK for client-side hashing
|
|
38
50
|
* @see https://docs.rokt.com/developers/integration-guides/web/library/integration-launcher#hash-attributes
|
|
@@ -58,17 +70,17 @@ var RoktKit = (function (exports) {
|
|
|
58
70
|
var accountId = settings.accountId;
|
|
59
71
|
self.userAttributes = filteredUserAttributes;
|
|
60
72
|
self.onboardingExpProvider = settings.onboardingExpProvider;
|
|
61
|
-
|
|
62
|
-
var managerOptions = window.mParticle.Rokt.managerOptions || {};
|
|
63
|
-
var sandbox = managerOptions.sandbox || false;
|
|
64
|
-
|
|
73
|
+
var domain = window.mParticle.Rokt.domain;
|
|
65
74
|
var launcherOptions = window.mParticle.Rokt.launcherOptions || {};
|
|
66
75
|
launcherOptions.integrationName = generateIntegrationName(
|
|
67
76
|
launcherOptions.integrationName
|
|
68
77
|
);
|
|
69
78
|
|
|
70
79
|
if (testMode) {
|
|
71
|
-
|
|
80
|
+
self.testHelpers = {
|
|
81
|
+
generateLauncherScript: generateLauncherScript,
|
|
82
|
+
};
|
|
83
|
+
attachLauncher(accountId, launcherOptions);
|
|
72
84
|
return;
|
|
73
85
|
}
|
|
74
86
|
|
|
@@ -76,7 +88,7 @@ var RoktKit = (function (exports) {
|
|
|
76
88
|
var target = document.head || document.body;
|
|
77
89
|
var script = document.createElement('script');
|
|
78
90
|
script.type = 'text/javascript';
|
|
79
|
-
script.src =
|
|
91
|
+
script.src = generateLauncherScript(domain);
|
|
80
92
|
script.async = true;
|
|
81
93
|
script.crossOrigin = 'anonymous';
|
|
82
94
|
script.fetchPriority = 'high';
|
|
@@ -89,7 +101,7 @@ var RoktKit = (function (exports) {
|
|
|
89
101
|
typeof window.Rokt.createLauncher === 'function' &&
|
|
90
102
|
window.Rokt.currentLauncher === undefined
|
|
91
103
|
) {
|
|
92
|
-
attachLauncher(accountId,
|
|
104
|
+
attachLauncher(accountId, launcherOptions);
|
|
93
105
|
} else {
|
|
94
106
|
console.error(
|
|
95
107
|
'Rokt object is not available after script load.'
|
|
@@ -179,11 +191,10 @@ var RoktKit = (function (exports) {
|
|
|
179
191
|
delete self.userAttributes[key];
|
|
180
192
|
}
|
|
181
193
|
|
|
182
|
-
function attachLauncher(accountId,
|
|
194
|
+
function attachLauncher(accountId, launcherOptions) {
|
|
183
195
|
var options = mergeObjects(
|
|
184
196
|
{
|
|
185
197
|
accountId: accountId,
|
|
186
|
-
sandbox: sandbox,
|
|
187
198
|
},
|
|
188
199
|
launcherOptions || {}
|
|
189
200
|
);
|
|
@@ -287,7 +298,7 @@ var RoktKit = (function (exports) {
|
|
|
287
298
|
|
|
288
299
|
function generateIntegrationName(customIntegrationName) {
|
|
289
300
|
var coreSdkVersion = window.mParticle.getVersion();
|
|
290
|
-
var kitVersion = "1.
|
|
301
|
+
var kitVersion = "1.5.0";
|
|
291
302
|
var name = 'mParticle_' + 'wsdkv_' + coreSdkVersion + '_kitv_' + kitVersion;
|
|
292
303
|
|
|
293
304
|
if (customIntegrationName) {
|