Skip to content

Commit 5ad8831

Browse files
authored
feat: Add domain to RoktManager to support CNAME for Rokt (#1039)
1 parent 994dbaa commit 5ad8831

3 files changed

Lines changed: 21 additions & 0 deletions

File tree

src/mp-instance.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1406,6 +1406,7 @@ function completeSDKInitialization(apiKey, config, mpInstance) {
14061406
const roktOptions: IRoktOptions = {
14071407
sandbox: config?.isDevelopmentMode,
14081408
launcherOptions: config?.launcherOptions,
1409+
domain: config?.domain,
14091410
};
14101411
// https://go.mparticle.com/work/SQDSDKS-7339
14111412
mpInstance._RoktManager.init(

src/roktManager.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ export interface IRoktKit {
5858
export interface IRoktOptions {
5959
sandbox?: boolean;
6060
launcherOptions?: IRoktLauncherOptions;
61+
domain?: string;
6162
}
6263

6364
export type IRoktLauncherOptions = Dictionary<any>;
@@ -81,6 +82,7 @@ export default class RoktManager {
8182
private identityService: SDKIdentityApi;
8283
private launcherOptions?: IRoktLauncherOptions;
8384
private logger: SDKLoggerApi;
85+
private domain?: string;
8486
/**
8587
* Initializes the RoktManager with configuration settings and user data.
8688
*
@@ -126,6 +128,10 @@ export default class RoktManager {
126128
// Launcher options are set here for the kit to pick up and pass through
127129
// to the Rokt Launcher.
128130
this.launcherOptions = { sandbox, ...options?.launcherOptions };
131+
132+
if (options?.domain) {
133+
this.domain = options.domain;
134+
}
129135
}
130136

131137
public attachKit(kit: IRoktKit): void {

test/jest/roktManager.spec.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,20 @@ describe('RoktManager', () => {
308308

309309
expect(roktManager['launcherOptions']).toEqual(expectedOptions);
310310
});
311+
312+
it('should set the domain property when passed in options', () => {
313+
const domain = 'custom.domain.com';
314+
roktManager.init(
315+
{} as IKitConfigs,
316+
undefined,
317+
mockMPInstance.Identity,
318+
mockMPInstance.Logger,
319+
{
320+
domain,
321+
}
322+
);
323+
expect(roktManager['domain']).toBe(domain);
324+
});
311325
});
312326

313327
describe('#attachKit', () => {

0 commit comments

Comments
 (0)