Skip to content

Commit c93096d

Browse files
fix: Rename isWebSdkLoggingEnabled to isLoggingEnabled
Update property name to match server configuration property. This fixes the issue where logging was not appearing for CNAME customers when isLoggingEnabled was set to true. Changes: - Renamed config property in ReportingLogger, SDKConfig, and SDKInitConfig - Updated all test files to use new property name - All Jest tests passing (28 tests)
1 parent 82a8d4a commit c93096d

5 files changed

Lines changed: 24 additions & 24 deletions

File tree

src/logging/reportingLogger.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export class ReportingLogger {
2727
private store: IStore | null;
2828
private readonly loggingUrl: string;
2929
private readonly errorUrl: string;
30-
private readonly isWebSdkLoggingEnabled: boolean;
30+
private readonly isLoggingEnabled: boolean;
3131

3232
constructor(
3333
config: SDKConfig | SDKInitConfig | any,
@@ -38,7 +38,7 @@ export class ReportingLogger {
3838
) {
3939
this.loggingUrl = `https://${config.loggingUrl || Constants.DefaultBaseUrls.loggingUrl}`;
4040
this.errorUrl = `https://${config.errorUrl || Constants.DefaultBaseUrls.errorUrl}`;
41-
this.isWebSdkLoggingEnabled = config.isWebSdkLoggingEnabled || false;
41+
this.isLoggingEnabled = config.isLoggingEnabled || false;
4242
this.store = store ?? null;
4343
this.isEnabled = this.isReportingEnabled();
4444
this.rateLimiter = rateLimiter ?? new RateLimiter();
@@ -118,7 +118,7 @@ export class ReportingLogger {
118118
return typeof window !== 'undefined' && Boolean(window['ROKT_DOMAIN']);
119119
}
120120

121-
private isFeatureFlagEnabled = (): boolean => this.isWebSdkLoggingEnabled;
121+
private isFeatureFlagEnabled = (): boolean => this.isLoggingEnabled;
122122

123123
private isDebugModeEnabled(): boolean {
124124
return (

src/sdkRuntimeModels.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ export interface SDKInitConfig
339339
identityCallback?: IdentityCallback;
340340

341341
launcherOptions?: IRoktLauncherOptions;
342-
isWebSdkLoggingEnabled?: boolean;
342+
isLoggingEnabled?: boolean;
343343

344344
rq?: Function[] | any[];
345345
logger?: IConsoleLogger;

src/store.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ export interface SDKConfig {
9898
requiredWebviewBridgeName?: string;
9999
loggingUrl?: string;
100100
errorUrl?: string;
101-
isWebSdkLoggingEnabled?: boolean;
101+
isLoggingEnabled?: boolean;
102102
}
103103

104104
function createSDKConfig(config: SDKInitConfig): SDKConfig {

test/jest/logging-integration.spec.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ describe('Logging Integration', () => {
3131

3232
Object.defineProperty(window, 'mParticle', {
3333
writable: true,
34-
value: { config: { isWebSdkLoggingEnabled: true } }
34+
value: { config: { isLoggingEnabled: true } }
3535
});
3636

3737
Object.defineProperty(window, 'ROKT_DOMAIN', {
@@ -53,7 +53,7 @@ describe('Logging Integration', () => {
5353

5454
// Create ReportingLogger with Store
5555
const reportingLogger = new ReportingLogger(
56-
{ loggingUrl, errorUrl, isWebSdkLoggingEnabled: true } as SDKConfig,
56+
{ loggingUrl, errorUrl, isLoggingEnabled: true } as SDKConfig,
5757
sdkVersion,
5858
mockStore as IStore,
5959
'test-guid'
@@ -103,7 +103,7 @@ describe('Logging Integration', () => {
103103
};
104104

105105
const reportingLogger = new ReportingLogger(
106-
{ loggingUrl, errorUrl, isWebSdkLoggingEnabled: true } as SDKConfig,
106+
{ loggingUrl, errorUrl, isLoggingEnabled: true } as SDKConfig,
107107
sdkVersion,
108108
mockStore as IStore
109109
);
@@ -126,7 +126,7 @@ describe('Logging Integration', () => {
126126
};
127127

128128
const reportingLogger = new ReportingLogger(
129-
{ loggingUrl, errorUrl, isWebSdkLoggingEnabled: true } as SDKConfig,
129+
{ loggingUrl, errorUrl, isLoggingEnabled: true } as SDKConfig,
130130
sdkVersion,
131131
initialStore as IStore
132132
);
@@ -173,7 +173,7 @@ describe('Logging Integration', () => {
173173
};
174174

175175
const reportingLogger = new ReportingLogger(
176-
{ loggingUrl, errorUrl, isWebSdkLoggingEnabled: true } as SDKConfig,
176+
{ loggingUrl, errorUrl, isLoggingEnabled: true } as SDKConfig,
177177
sdkVersion,
178178
mockStore as IStore
179179
);
@@ -198,7 +198,7 @@ describe('Logging Integration', () => {
198198
};
199199

200200
const reportingLogger = new ReportingLogger(
201-
{ loggingUrl, errorUrl, isWebSdkLoggingEnabled: true } as SDKConfig,
201+
{ loggingUrl, errorUrl, isLoggingEnabled: true } as SDKConfig,
202202
sdkVersion,
203203
mockStore as IStore
204204
);
@@ -221,7 +221,7 @@ describe('Logging Integration', () => {
221221
};
222222

223223
const reportingLogger = new ReportingLogger(
224-
{ loggingUrl, errorUrl, isWebSdkLoggingEnabled: true } as SDKConfig,
224+
{ loggingUrl, errorUrl, isLoggingEnabled: true } as SDKConfig,
225225
sdkVersion,
226226
mockStore as IStore
227227
);

test/jest/reportingLogger.spec.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ describe('ReportingLogger', () => {
3535

3636
Object.defineProperty(window, 'mParticle', {
3737
writable: true,
38-
value: { config: { isWebSdkLoggingEnabled: true } }
38+
value: { config: { isLoggingEnabled: true } }
3939
});
4040

4141
Object.defineProperty(window, 'ROKT_DOMAIN', {
@@ -44,7 +44,7 @@ describe('ReportingLogger', () => {
4444
});
4545

4646
logger = new ReportingLogger(
47-
{ loggingUrl, errorUrl, isWebSdkLoggingEnabled: true } as SDKConfig,
47+
{ loggingUrl, errorUrl, isLoggingEnabled: true } as SDKConfig,
4848
sdkVersion,
4949
mockStore as IStore,
5050
'test-launcher-instance-guid'
@@ -99,7 +99,7 @@ describe('ReportingLogger', () => {
9999
value: undefined
100100
});
101101
logger = new ReportingLogger(
102-
{ loggingUrl, errorUrl, isWebSdkLoggingEnabled: true } as SDKConfig,
102+
{ loggingUrl, errorUrl, isLoggingEnabled: true } as SDKConfig,
103103
sdkVersion,
104104
mockStore as IStore,
105105
'test-launcher-instance-guid'
@@ -111,14 +111,14 @@ describe('ReportingLogger', () => {
111111
it('does not log if feature flag and debug mode off', () => {
112112
Object.defineProperty(window, 'mParticle', {
113113
writable: true,
114-
value: { config: { isWebSdkLoggingEnabled: false } }
114+
value: { config: { isLoggingEnabled: false } }
115115
});
116116
Object.defineProperty(window, 'location', {
117117
writable: true,
118118
value: { href: 'https://e.com', search: '' }
119119
});
120120
logger = new ReportingLogger(
121-
{ loggingUrl, errorUrl, isWebSdkLoggingEnabled: false } as SDKConfig,
121+
{ loggingUrl, errorUrl, isLoggingEnabled: false } as SDKConfig,
122122
sdkVersion,
123123
mockStore as IStore,
124124
'test-launcher-instance-guid'
@@ -130,14 +130,14 @@ describe('ReportingLogger', () => {
130130
it('logs if debug mode on even if feature flag off', () => {
131131
Object.defineProperty(window, 'mParticle', {
132132
writable: true,
133-
value: { config: { isWebSdkLoggingEnabled: false } }
133+
value: { config: { isLoggingEnabled: false } }
134134
});
135135
Object.defineProperty(window, 'location', {
136136
writable: true,
137137
value: { href: 'https://e.com', search: '?mp_enable_logging=true' }
138138
});
139139
logger = new ReportingLogger(
140-
{ loggingUrl, errorUrl, isWebSdkLoggingEnabled: false } as SDKConfig,
140+
{ loggingUrl, errorUrl, isLoggingEnabled: false } as SDKConfig,
141141
sdkVersion,
142142
mockStore as IStore,
143143
'test-launcher-instance-guid'
@@ -156,7 +156,7 @@ describe('ReportingLogger', () => {
156156
value: { href: 'https://e.com', search: '?mp_enable_logging=true' }
157157
});
158158
logger = new ReportingLogger(
159-
{ loggingUrl, errorUrl, isWebSdkLoggingEnabled: false } as SDKConfig,
159+
{ loggingUrl, errorUrl, isLoggingEnabled: false } as SDKConfig,
160160
sdkVersion,
161161
mockStore as IStore,
162162
'test-launcher-instance-guid'
@@ -173,7 +173,7 @@ describe('ReportingLogger', () => {
173173
}),
174174
};
175175
logger = new ReportingLogger(
176-
{ loggingUrl, errorUrl, isWebSdkLoggingEnabled: true } as SDKConfig,
176+
{ loggingUrl, errorUrl, isLoggingEnabled: true } as SDKConfig,
177177
sdkVersion,
178178
mockStore as IStore,
179179
'test-launcher-instance-guid',
@@ -201,7 +201,7 @@ describe('ReportingLogger', () => {
201201
value: undefined
202202
});
203203
logger = new ReportingLogger(
204-
{ loggingUrl, errorUrl, isWebSdkLoggingEnabled: true } as SDKConfig,
204+
{ loggingUrl, errorUrl, isLoggingEnabled: true } as SDKConfig,
205205
sdkVersion,
206206
mockStore as IStore,
207207
'test-launcher-instance-guid'
@@ -217,7 +217,7 @@ describe('ReportingLogger', () => {
217217

218218
it('can set store after initialization', () => {
219219
const loggerWithoutStore = new ReportingLogger(
220-
{ loggingUrl, errorUrl, isWebSdkLoggingEnabled: true } as SDKConfig,
220+
{ loggingUrl, errorUrl, isLoggingEnabled: true } as SDKConfig,
221221
sdkVersion,
222222
undefined,
223223
'test-launcher-instance-guid'
@@ -255,7 +255,7 @@ describe('ReportingLogger', () => {
255255

256256
it('omits rokt-launcher-instance-guid header when launcherInstanceGuid is undefined', () => {
257257
logger = new ReportingLogger(
258-
{ loggingUrl, errorUrl, isWebSdkLoggingEnabled: true } as SDKConfig,
258+
{ loggingUrl, errorUrl, isLoggingEnabled: true } as SDKConfig,
259259
sdkVersion,
260260
mockStore as IStore,
261261
undefined

0 commit comments

Comments
 (0)