Skip to content

Commit cbaff08

Browse files
Jaissica HoraJaissica Hora
authored andcommitted
feat: updated use method in rokt kit
1 parent 855f170 commit cbaff08

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

src/Rokt-Kit.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,25 @@ var constructor = function () {
242242
return self.launcher.selectPlacements(selectPlacementsOptions);
243243
}
244244

245+
/**
246+
* Enables optional Integration Launcher extensions before selecting placements
247+
* @see https://docs.rokt.com/developers/integration-guides/web/library/integration-launcher/#use
248+
* @param {string} extensionName - Name of the extension to enable
249+
* @returns {Promise<*>} A Promise resolving to the extension API if available
250+
*/
251+
function use(extensionName) {
252+
if (!isKitReady()) {
253+
console.error('Rokt Kit: Not initialized');
254+
return Promise.reject(new Error('Rokt Kit: Not initialized'));
255+
}
256+
if (!extensionName || typeof extensionName !== 'string') {
257+
return Promise.reject(
258+
new Error('Rokt Kit: Invalid extension name')
259+
);
260+
}
261+
return self.launcher.use(extensionName);
262+
}
263+
245264
/**
246265
* Sets extension data for Rokt Web SDK
247266
* @param {Object} partnerExtensionData - The extension data object containing:
@@ -375,6 +394,7 @@ var constructor = function () {
375394
// Called by the mParticle Rokt Manager
376395
this.selectPlacements = selectPlacements;
377396
this.hashAttributes = hashAttributes;
397+
this.use = use;
378398

379399
// Kit Callback Methods
380400
this.init = initForwarder;

0 commit comments

Comments
 (0)