Skip to content

Commit a9f46c1

Browse files
committed
refactor: remove default constants module and instantiate defaults directly in relevant classes
1 parent 2e9d116 commit a9f46c1

7 files changed

Lines changed: 18 additions & 20 deletions

File tree

src/core/classes/Iterable.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,16 @@ import type { IterableCommerceItem } from './IterableCommerceItem';
2323
import { IterableConfig } from './IterableConfig';
2424
import { IterableLogger } from './IterableLogger';
2525
import type { IterableAuthFailure } from '../types/IterableAuthFailure';
26-
import {
27-
defaultAuthManager,
28-
defaultConfig,
29-
defaultInAppManager,
30-
defaultLogger,
31-
} from '../constants/defaults';
3226
import { IterableApi } from './IterableApi';
3327
import { IterableAuthManager } from './IterableAuthManager';
3428

3529
const RNEventEmitter = new NativeEventEmitter(RNIterableAPI);
3630

31+
const defaultConfig = new IterableConfig();
32+
const defaultLogger = new IterableLogger(defaultConfig);
33+
const defaultInAppManager = new IterableInAppManager(defaultLogger);
34+
const defaultAuthManager = new IterableAuthManager(defaultLogger);
35+
3736
/* eslint-disable tsdoc/syntax */
3837
/**
3938
* The main class for the Iterable React Native SDK.

src/core/classes/IterableApi.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ import { Platform } from 'react-native';
22

33
import RNIterableAPI from '../../api';
44
import { IterableConfig } from './IterableConfig';
5-
import type { IterableLogger } from './IterableLogger';
6-
import { defaultLogger } from '../constants/defaults';
5+
import { IterableLogger } from './IterableLogger';
76
import { IterableAttributionInfo } from './IterableAttributionInfo';
87
import type { IterableCommerceItem } from './IterableCommerceItem';
98
import type { IterableInAppMessage } from '../../inApp/classes/IterableInAppMessage';
@@ -14,6 +13,9 @@ import type { IterableHtmlInAppContent } from '../../inApp/classes/IterableHtmlI
1413
import type { IterableInAppShowResponse } from '../../inApp/enums/IterableInAppShowResponse';
1514
import type { IterableInboxImpressionRowInfo } from '../../inbox/types/IterableInboxImpressionRowInfo';
1615

16+
const defaultConfig = new IterableConfig();
17+
const defaultLogger = new IterableLogger(defaultConfig);
18+
1719
export class IterableApi {
1820
static logger: IterableLogger = defaultLogger;
1921

src/core/classes/IterableAuthManager.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
import { defaultLogger } from '../constants/defaults';
21
import { IterableLogger } from './IterableLogger';
32
import { IterableApi } from './IterableApi';
3+
import { IterableConfig } from './IterableConfig';
4+
5+
const defaultConfig = new IterableConfig();
6+
const defaultLogger = new IterableLogger(defaultConfig);
47

58
/**
69
* Manages the authentication for the Iterable SDK.

src/core/constants/defaults.ts

Lines changed: 0 additions & 9 deletions
This file was deleted.

src/core/constants/index.ts

Whitespace-only changes.

src/inApp/classes/IterableHtmlInAppContent.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { IterableEdgeInsets } from '../../core';
1+
import { IterableEdgeInsets } from '../../core/classes/IterableEdgeInsets';
22

33
import { IterableInAppContentType } from '../enums';
44
import type {

src/inApp/classes/IterableInAppManager.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
import { IterableApi } from '../../core/classes/IterableApi';
2+
import { IterableConfig } from '../../core/classes/IterableConfig';
23
import { IterableLogger } from '../../core/classes/IterableLogger';
3-
import { defaultLogger } from '../../core/constants/defaults';
44
import type { IterableInAppDeleteSource } from '../enums/IterableInAppDeleteSource';
55
import type { IterableInAppLocation } from '../enums/IterableInAppLocation';
66
import type { IterableHtmlInAppContent } from './IterableHtmlInAppContent';
77
import type { IterableInAppMessage } from './IterableInAppMessage';
88

9+
const defaultConfig = new IterableConfig();
10+
const defaultLogger = new IterableLogger(defaultConfig);
11+
912
/**
1013
* Manages in-app messages for the current user.
1114
*

0 commit comments

Comments
 (0)