Skip to content

Commit cbd2799

Browse files
committed
refactor: enable logging in IterableApi methods by removing commented-out IterableLogger calls
1 parent 3990876 commit cbd2799

1 file changed

Lines changed: 58 additions & 57 deletions

File tree

src/core/classes/IterableApi.ts

Lines changed: 58 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import type { IterableInboxImpressionRowInfo } from '../../inbox/types/IterableI
1111
import { IterableAttributionInfo } from './IterableAttributionInfo';
1212
import type { IterableCommerceItem } from './IterableCommerceItem';
1313
import { IterableConfig } from './IterableConfig';
14+
import { IterableLogger } from './IterableLogger';
1415

1516
/**
1617
* Contains functions that directly interact with the native layer.
@@ -39,7 +40,7 @@ export class IterableApi {
3940
version: string;
4041
}
4142
): Promise<boolean> {
42-
// IterableLogger.log('initializeWithApiKey: ', apiKey);
43+
IterableLogger.log('initializeWithApiKey: ', apiKey);
4344
return RNIterableAPI.initializeWithApiKey(apiKey, config.toDict(), version);
4445
}
4546

@@ -61,7 +62,7 @@ export class IterableApi {
6162
apiEndPoint: string;
6263
}
6364
): Promise<boolean> {
64-
// IterableLogger.log('initialize2WithApiKey: ', apiKey);
65+
IterableLogger.log('initialize2WithApiKey: ', apiKey);
6566
return RNIterableAPI.initialize2WithApiKey(
6667
apiKey,
6768
config.toDict(),
@@ -86,7 +87,7 @@ export class IterableApi {
8687
* related action will be taken
8788
*/
8889
static setEmail(email: string | null, authToken?: string | null) {
89-
// IterableLogger.log('setEmail: ', email);
90+
IterableLogger.log('setEmail: ', email);
9091
return RNIterableAPI.setEmail(email, authToken);
9192
}
9293

@@ -96,7 +97,7 @@ export class IterableApi {
9697
* @returns The email associated with the current user
9798
*/
9899
static getEmail() {
99-
// IterableLogger.log('getEmail');
100+
IterableLogger.log('getEmail');
100101
return RNIterableAPI.getEmail();
101102
}
102103

@@ -115,23 +116,23 @@ export class IterableApi {
115116
userId: string | null | undefined,
116117
authToken?: string | null
117118
) {
118-
// IterableLogger.log('setUserId: ', userId);
119+
IterableLogger.log('setUserId: ', userId);
119120
return RNIterableAPI.setUserId(userId, authToken);
120121
}
121122

122123
/**
123124
* Get the `userId` associated with the current user.
124125
*/
125126
static getUserId() {
126-
// IterableLogger.log('getUserId');
127+
IterableLogger.log('getUserId');
127128
return RNIterableAPI.getUserId();
128129
}
129130

130131
/**
131132
* Disable the device for the current user.
132133
*/
133134
static disableDeviceForCurrentUser() {
134-
// IterableLogger.log('disableDeviceForCurrentUser');
135+
IterableLogger.log('disableDeviceForCurrentUser');
135136
return RNIterableAPI.disableDeviceForCurrentUser();
136137
}
137138

@@ -142,7 +143,7 @@ export class IterableApi {
142143
* @param mergeNestedObjects - Whether to merge nested objects
143144
*/
144145
static updateUser(dataFields: unknown, mergeNestedObjects: boolean) {
145-
// IterableLogger.log('updateUser: ', dataFields, mergeNestedObjects);
146+
IterableLogger.log('updateUser: ', dataFields, mergeNestedObjects);
146147
return RNIterableAPI.updateUser(dataFields, mergeNestedObjects);
147148
}
148149

@@ -153,7 +154,7 @@ export class IterableApi {
153154
* @param authToken - The new auth token (JWT) to set with the new email, optional - If null/undefined, no JWT-related action will be taken
154155
*/
155156
static updateEmail(email: string, authToken?: string | null) {
156-
// IterableLogger.log('updateEmail: ', email, authToken);
157+
IterableLogger.log('updateEmail: ', email, authToken);
157158
return RNIterableAPI.updateEmail(email, authToken);
158159
}
159160

@@ -186,14 +187,14 @@ export class IterableApi {
186187
appAlreadyRunning: boolean;
187188
dataFields?: unknown;
188189
}) {
189-
// IterableLogger.log(
190-
// 'trackPushOpenWithCampaignId: ',
191-
// campaignId,
192-
// templateId,
193-
// messageId,
194-
// appAlreadyRunning,
195-
// dataFields
196-
// );
190+
IterableLogger.log(
191+
'trackPushOpenWithCampaignId: ',
192+
campaignId,
193+
templateId,
194+
messageId,
195+
appAlreadyRunning,
196+
dataFields
197+
);
197198
return RNIterableAPI.trackPushOpenWithCampaignId(
198199
campaignId,
199200
templateId,
@@ -220,7 +221,7 @@ export class IterableApi {
220221
items: IterableCommerceItem[];
221222
dataFields?: unknown;
222223
}) {
223-
// IterableLogger.log('trackPurchase: ', total, items, dataFields);
224+
IterableLogger.log('trackPurchase: ', total, items, dataFields);
224225
return RNIterableAPI.trackPurchase(total, items, dataFields);
225226
}
226227

@@ -239,7 +240,7 @@ export class IterableApi {
239240
message: IterableInAppMessage;
240241
location: IterableInAppLocation;
241242
}) {
242-
// IterableLogger.log('trackInAppOpen: ', message, location);
243+
IterableLogger.log('trackInAppOpen: ', message, location);
243244
return RNIterableAPI.trackInAppOpen(message.messageId, location);
244245
}
245246

@@ -262,7 +263,7 @@ export class IterableApi {
262263
location: IterableInAppLocation;
263264
clickedUrl: string;
264265
}) {
265-
// IterableLogger.log('trackInAppClick: ', message, location, clickedUrl);
266+
IterableLogger.log('trackInAppClick: ', message, location, clickedUrl);
266267
return RNIterableAPI.trackInAppClick(
267268
message.messageId,
268269
location,
@@ -291,13 +292,13 @@ export class IterableApi {
291292
source: IterableInAppCloseSource;
292293
clickedUrl?: string;
293294
}) {
294-
// IterableLogger.log(
295-
// 'trackInAppClose: ',
296-
// message,
297-
// location,
298-
// source,
299-
// clickedUrl
300-
// );
295+
IterableLogger.log(
296+
'trackInAppClose: ',
297+
message,
298+
location,
299+
source,
300+
clickedUrl
301+
);
301302
return RNIterableAPI.trackInAppClose(
302303
message.messageId,
303304
location,
@@ -320,7 +321,7 @@ export class IterableApi {
320321
name: string;
321322
dataFields?: unknown;
322323
}) {
323-
// IterableLogger.log('trackEvent: ', name, dataFields);
324+
IterableLogger.log('trackEvent: ', name, dataFields);
324325
return RNIterableAPI.trackEvent(name, dataFields);
325326
}
326327

@@ -336,7 +337,7 @@ export class IterableApi {
336337
* @param pauseRetry - Whether to pause or resume the automatic retrying of authentication requests
337338
*/
338339
static pauseAuthRetries(pauseRetry: boolean) {
339-
// IterableLogger.log('pauseAuthRetries: ', pauseRetry);
340+
IterableLogger.log('pauseAuthRetries: ', pauseRetry);
340341
return RNIterableAPI.pauseAuthRetries(pauseRetry);
341342
}
342343

@@ -346,7 +347,7 @@ export class IterableApi {
346347
* @param authToken - The auth token to pass along
347348
*/
348349
static passAlongAuthToken(authToken: string | null | undefined) {
349-
// IterableLogger.log('passAlongAuthToken: ', authToken);
350+
IterableLogger.log('passAlongAuthToken: ', authToken);
350351
return RNIterableAPI.passAlongAuthToken(authToken);
351352
}
352353

@@ -368,7 +369,7 @@ export class IterableApi {
368369
location: IterableInAppLocation,
369370
source: IterableInAppDeleteSource
370371
) {
371-
// IterableLogger.log('inAppConsume: ', message, location, source);
372+
IterableLogger.log('inAppConsume: ', message, location, source);
372373
return RNIterableAPI.inAppConsume(message.messageId, location, source);
373374
}
374375

@@ -378,7 +379,7 @@ export class IterableApi {
378379
* @returns A Promise that resolves to an array of in-app messages.
379380
*/
380381
static getInAppMessages(): Promise<IterableInAppMessage[]> {
381-
// IterableLogger.log('getInAppMessages');
382+
IterableLogger.log('getInAppMessages');
382383
return RNIterableAPI.getInAppMessages() as unknown as Promise<
383384
IterableInAppMessage[]
384385
>;
@@ -391,7 +392,7 @@ export class IterableApi {
391392
* @returns A Promise that resolves to an array of messages marked as `saveToInbox`.
392393
*/
393394
static getInboxMessages(): Promise<IterableInAppMessage[]> {
394-
// IterableLogger.log('getInboxMessages');
395+
IterableLogger.log('getInboxMessages');
395396
return RNIterableAPI.getInboxMessages() as unknown as Promise<
396397
IterableInAppMessage[]
397398
>;
@@ -410,7 +411,7 @@ export class IterableApi {
410411
messageId: string,
411412
consume: boolean
412413
): Promise<string | null> {
413-
// IterableLogger.log('showMessage: ', messageId, consume);
414+
IterableLogger.log('showMessage: ', messageId, consume);
414415
return RNIterableAPI.showMessage(messageId, consume);
415416
}
416417

@@ -426,7 +427,7 @@ export class IterableApi {
426427
location: number,
427428
source: number
428429
): void {
429-
// IterableLogger.log('removeMessage: ', messageId, location, source);
430+
IterableLogger.log('removeMessage: ', messageId, location, source);
430431
return RNIterableAPI.removeMessage(messageId, location, source);
431432
}
432433

@@ -437,7 +438,7 @@ export class IterableApi {
437438
* @param read - Whether the message is read.
438439
*/
439440
static setReadForMessage(messageId: string, read: boolean): void {
440-
// IterableLogger.log('setReadForMessage: ', messageId, read);
441+
IterableLogger.log('setReadForMessage: ', messageId, read);
441442
return RNIterableAPI.setReadForMessage(messageId, read);
442443
}
443444

@@ -447,7 +448,7 @@ export class IterableApi {
447448
* @param autoDisplayPaused - Whether to pause or unpause the automatic display of incoming in-app messages
448449
*/
449450
static setAutoDisplayPaused(autoDisplayPaused: boolean): void {
450-
// IterableLogger.log('setAutoDisplayPaused: ', autoDisplayPaused);
451+
IterableLogger.log('setAutoDisplayPaused: ', autoDisplayPaused);
451452
return RNIterableAPI.setAutoDisplayPaused(autoDisplayPaused);
452453
}
453454

@@ -461,7 +462,7 @@ export class IterableApi {
461462
static getHtmlInAppContentForMessage(
462463
messageId: string
463464
): Promise<IterableHtmlInAppContent> {
464-
// IterableLogger.log('getHtmlInAppContentForMessage: ', messageId);
465+
IterableLogger.log('getHtmlInAppContentForMessage: ', messageId);
465466
return RNIterableAPI.getHtmlInAppContentForMessage(messageId);
466467
}
467468

@@ -471,7 +472,7 @@ export class IterableApi {
471472
* @param inAppShowResponse - The response to an in-app message.
472473
*/
473474
static setInAppShowResponse(inAppShowResponse: IterableInAppShowResponse) {
474-
// IterableLogger.log('setInAppShowResponse: ', inAppShowResponse);
475+
IterableLogger.log('setInAppShowResponse: ', inAppShowResponse);
475476
return RNIterableAPI.setInAppShowResponse(inAppShowResponse);
476477
}
477478

@@ -481,15 +482,15 @@ export class IterableApi {
481482
* @param visibleRows - The visible rows.
482483
*/
483484
static startSession(visibleRows: IterableInboxImpressionRowInfo[]) {
484-
// IterableLogger.log('startSession: ', visibleRows);
485+
IterableLogger.log('startSession: ', visibleRows);
485486
return RNIterableAPI.startSession(visibleRows);
486487
}
487488

488489
/**
489490
* End a session.
490491
*/
491492
static endSession() {
492-
// IterableLogger.log('endSession');
493+
IterableLogger.log('endSession');
493494
return RNIterableAPI.endSession();
494495
}
495496

@@ -499,7 +500,7 @@ export class IterableApi {
499500
* @param visibleRows - The visible rows.
500501
*/
501502
static updateVisibleRows(visibleRows: IterableInboxImpressionRowInfo[] = []) {
502-
// IterableLogger.log('updateVisibleRows: ', visibleRows);
503+
IterableLogger.log('updateVisibleRows: ', visibleRows);
503504
return RNIterableAPI.updateVisibleRows(visibleRows);
504505
}
505506

@@ -515,7 +516,7 @@ export class IterableApi {
515516
* @param items - The items.
516517
*/
517518
static updateCart(items: IterableCommerceItem[]) {
518-
// IterableLogger.log('updateCart: ', items);
519+
IterableLogger.log('updateCart: ', items);
519520
return RNIterableAPI.updateCart(items);
520521
}
521522

@@ -525,7 +526,7 @@ export class IterableApi {
525526
*/
526527
static wakeApp() {
527528
if (Platform.OS === 'android') {
528-
// IterableLogger.log('wakeApp');
529+
IterableLogger.log('wakeApp');
529530
return RNIterableAPI.wakeApp();
530531
}
531532
}
@@ -536,7 +537,7 @@ export class IterableApi {
536537
* @param link - The link.
537538
*/
538539
static handleAppLink(link: string) {
539-
// IterableLogger.log('handleAppLink: ', link);
540+
IterableLogger.log('handleAppLink: ', link);
540541
return RNIterableAPI.handleAppLink(link);
541542
}
542543

@@ -565,15 +566,15 @@ export class IterableApi {
565566
campaignId: number;
566567
templateId: number;
567568
}) {
568-
// IterableLogger.log(
569-
// 'updateSubscriptions: ',
570-
// emailListIds,
571-
// unsubscribedChannelIds,
572-
// unsubscribedMessageTypeIds,
573-
// subscribedMessageTypeIds,
574-
// campaignId,
575-
// templateId
576-
// );
569+
IterableLogger.log(
570+
'updateSubscriptions: ',
571+
emailListIds,
572+
unsubscribedChannelIds,
573+
unsubscribedMessageTypeIds,
574+
subscribedMessageTypeIds,
575+
campaignId,
576+
templateId
577+
);
577578
return RNIterableAPI.updateSubscriptions(
578579
emailListIds,
579580
unsubscribedChannelIds,
@@ -588,15 +589,15 @@ export class IterableApi {
588589
* Get the last push payload.
589590
*/
590591
static getLastPushPayload() {
591-
// IterableLogger.log('getLastPushPayload');
592+
IterableLogger.log('getLastPushPayload');
592593
return RNIterableAPI.getLastPushPayload();
593594
}
594595

595596
/**
596597
* Get the attribution info.
597598
*/
598599
static getAttributionInfo() {
599-
// IterableLogger.log('getAttributionInfo');
600+
IterableLogger.log('getAttributionInfo');
600601
// FIXME: What if this errors?
601602
return RNIterableAPI.getAttributionInfo().then(
602603
(
@@ -625,7 +626,7 @@ export class IterableApi {
625626
* @param attributionInfo - The attribution info.
626627
*/
627628
static setAttributionInfo(attributionInfo?: IterableAttributionInfo) {
628-
// IterableLogger.log('setAttributionInfo: ', attributionInfo);
629+
IterableLogger.log('setAttributionInfo: ', attributionInfo);
629630
return RNIterableAPI.setAttributionInfo(attributionInfo);
630631
}
631632

0 commit comments

Comments
 (0)