Skip to content

Commit 4a857d6

Browse files
chore(build): Generate latest bundle [skip ci]
1 parent 279a969 commit 4a857d6

2 files changed

Lines changed: 86 additions & 20 deletions

File tree

dist/Rokt-Kit.common.js

Lines changed: 43 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
1919

2020
var name = 'Rokt';
2121
var moduleId = 181;
22+
var EVENT_NAME_SELECT_PLACEMENTS = 'selectPlacements';
2223

2324
var constructor = function () {
2425
var self = this;
@@ -62,6 +63,14 @@ var constructor = function () {
6263
return baseUrl + '?extensions=' + extensions.join(',');
6364
}
6465

66+
/**
67+
* Checks if Rokt launcher is available and ready to attach
68+
* @returns {boolean} True if launcher can be attached
69+
*/
70+
function isLauncherReadyToAttach() {
71+
return window.Rokt && typeof window.Rokt.createLauncher === 'function';
72+
}
73+
6574
/**
6675
* Passes attributes to the Rokt Web SDK for client-side hashing
6776
* @see https://docs.rokt.com/developers/integration-guides/web/library/integration-launcher#hash-attributes
@@ -124,7 +133,9 @@ var constructor = function () {
124133
return;
125134
}
126135

127-
if (!window.Rokt || !(window.Rokt && window.Rokt.currentLauncher)) {
136+
if (isLauncherReadyToAttach()) {
137+
attachLauncher(accountId, launcherOptions);
138+
} else {
128139
var target = document.head || document.body;
129140
var script = document.createElement('script');
130141
script.type = 'text/javascript';
@@ -135,12 +146,7 @@ var constructor = function () {
135146
script.id = 'rokt-launcher';
136147

137148
script.onload = function () {
138-
// Once the script loads, ensure the Rokt object is available
139-
if (
140-
window.Rokt &&
141-
typeof window.Rokt.createLauncher === 'function' &&
142-
window.Rokt.currentLauncher === undefined
143-
) {
149+
if (isLauncherReadyToAttach()) {
144150
attachLauncher(accountId, launcherOptions);
145151
} else {
146152
console.error(
@@ -155,8 +161,6 @@ var constructor = function () {
155161

156162
target.appendChild(script);
157163
captureTiming(PerformanceMarks.RoktScriptAppended);
158-
} else {
159-
console.warn('Unable to find Rokt on the page');
160164
}
161165
}
162166
/**
@@ -259,9 +263,38 @@ var constructor = function () {
259263
attributes: selectPlacementsAttributes,
260264
});
261265

266+
// Log custom event for selectPlacements call
267+
logSelectPlacementsEvent(selectPlacementsAttributes);
268+
262269
return self.launcher.selectPlacements(selectPlacementsOptions);
263270
}
264271

272+
/**
273+
* Logs a custom event when selectPlacements is called
274+
* This enables visibility and troubleshooting
275+
* @param {Object} attributes - The attributes sent to Rokt
276+
*/
277+
function logSelectPlacementsEvent(attributes) {
278+
if (
279+
!window.mParticle ||
280+
typeof window.mParticle.logEvent !== 'function'
281+
) {
282+
return;
283+
}
284+
285+
if (!isObject(attributes)) {
286+
return;
287+
}
288+
289+
var EVENT_TYPE_OTHER = window.mParticle.EventType.Other;
290+
291+
window.mParticle.logEvent(
292+
EVENT_NAME_SELECT_PLACEMENTS,
293+
EVENT_TYPE_OTHER,
294+
attributes
295+
);
296+
}
297+
265298
/**
266299
* Enables optional Integration Launcher extensions before selecting placements
267300
* @param {string} extensionName - Name of the extension to enable
@@ -478,7 +511,7 @@ var constructor = function () {
478511

479512
function generateIntegrationName(customIntegrationName) {
480513
var coreSdkVersion = window.mParticle.getVersion();
481-
var kitVersion = "1.13.1";
514+
var kitVersion = "1.14.0";
482515
var name = 'mParticle_' + 'wsdkv_' + coreSdkVersion + '_kitv_' + kitVersion;
483516

484517
if (customIntegrationName) {

dist/Rokt-Kit.iife.js

Lines changed: 43 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ var RoktKit = (function (exports) {
1818

1919
var name = 'Rokt';
2020
var moduleId = 181;
21+
var EVENT_NAME_SELECT_PLACEMENTS = 'selectPlacements';
2122

2223
var constructor = function () {
2324
var self = this;
@@ -61,6 +62,14 @@ var RoktKit = (function (exports) {
6162
return baseUrl + '?extensions=' + extensions.join(',');
6263
}
6364

65+
/**
66+
* Checks if Rokt launcher is available and ready to attach
67+
* @returns {boolean} True if launcher can be attached
68+
*/
69+
function isLauncherReadyToAttach() {
70+
return window.Rokt && typeof window.Rokt.createLauncher === 'function';
71+
}
72+
6473
/**
6574
* Passes attributes to the Rokt Web SDK for client-side hashing
6675
* @see https://docs.rokt.com/developers/integration-guides/web/library/integration-launcher#hash-attributes
@@ -123,7 +132,9 @@ var RoktKit = (function (exports) {
123132
return;
124133
}
125134

126-
if (!window.Rokt || !(window.Rokt && window.Rokt.currentLauncher)) {
135+
if (isLauncherReadyToAttach()) {
136+
attachLauncher(accountId, launcherOptions);
137+
} else {
127138
var target = document.head || document.body;
128139
var script = document.createElement('script');
129140
script.type = 'text/javascript';
@@ -134,12 +145,7 @@ var RoktKit = (function (exports) {
134145
script.id = 'rokt-launcher';
135146

136147
script.onload = function () {
137-
// Once the script loads, ensure the Rokt object is available
138-
if (
139-
window.Rokt &&
140-
typeof window.Rokt.createLauncher === 'function' &&
141-
window.Rokt.currentLauncher === undefined
142-
) {
148+
if (isLauncherReadyToAttach()) {
143149
attachLauncher(accountId, launcherOptions);
144150
} else {
145151
console.error(
@@ -154,8 +160,6 @@ var RoktKit = (function (exports) {
154160

155161
target.appendChild(script);
156162
captureTiming(PerformanceMarks.RoktScriptAppended);
157-
} else {
158-
console.warn('Unable to find Rokt on the page');
159163
}
160164
}
161165
/**
@@ -258,9 +262,38 @@ var RoktKit = (function (exports) {
258262
attributes: selectPlacementsAttributes,
259263
});
260264

265+
// Log custom event for selectPlacements call
266+
logSelectPlacementsEvent(selectPlacementsAttributes);
267+
261268
return self.launcher.selectPlacements(selectPlacementsOptions);
262269
}
263270

271+
/**
272+
* Logs a custom event when selectPlacements is called
273+
* This enables visibility and troubleshooting
274+
* @param {Object} attributes - The attributes sent to Rokt
275+
*/
276+
function logSelectPlacementsEvent(attributes) {
277+
if (
278+
!window.mParticle ||
279+
typeof window.mParticle.logEvent !== 'function'
280+
) {
281+
return;
282+
}
283+
284+
if (!isObject(attributes)) {
285+
return;
286+
}
287+
288+
var EVENT_TYPE_OTHER = window.mParticle.EventType.Other;
289+
290+
window.mParticle.logEvent(
291+
EVENT_NAME_SELECT_PLACEMENTS,
292+
EVENT_TYPE_OTHER,
293+
attributes
294+
);
295+
}
296+
264297
/**
265298
* Enables optional Integration Launcher extensions before selecting placements
266299
* @param {string} extensionName - Name of the extension to enable
@@ -477,7 +510,7 @@ var RoktKit = (function (exports) {
477510

478511
function generateIntegrationName(customIntegrationName) {
479512
var coreSdkVersion = window.mParticle.getVersion();
480-
var kitVersion = "1.13.1";
513+
var kitVersion = "1.14.0";
481514
var name = 'mParticle_' + 'wsdkv_' + coreSdkVersion + '_kitv_' + kitVersion;
482515

483516
if (customIntegrationName) {

0 commit comments

Comments
 (0)