Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
33dcd4b
Refactor file structure: move `IterableInbox` to `inbox` directory an…
lposen Nov 7, 2024
a1d215f
Update imports for IterableInboxCustomizations to reflect new file st…
lposen Nov 7, 2024
e5ff188
Refactor file structure: move inbox-related components to `inbox` dir…
lposen Nov 7, 2024
827462a
Refactor imports: consolidate IterableInApp classes into a single inA…
lposen Nov 7, 2024
27f1bf0
Refactor in-app structure: separate classes into individual files, in…
lposen Nov 7, 2024
507902a
Refactor inbox structure: move components to a new `components` direc…
lposen Nov 7, 2024
fd2ea12
Refactor Iterable module: rename AuthResponseCallback to IterableAuth…
lposen Nov 7, 2024
5af5f45
Refactor event names: rename EventName to IterableEventName in Iterab…
lposen Nov 7, 2024
7cf303c
Refactor enums: move IterableAuthResponseResult, IterableEventName, a…
lposen Nov 7, 2024
95c4988
Refactor Iterable module: move IterableActionContext to a new file, u…
lposen Nov 7, 2024
3a52215
Refactor Iterable module: update imports for IterableAuthResponse and…
lposen Nov 7, 2024
9ac9906
Refactor Iterable module: update imports for IterableActionContext, I…
lposen Nov 7, 2024
20b10a3
Refactor Iterable module: move IterablePushPlatform enum to a separat…
lposen Nov 7, 2024
f7066e7
Refactor imports in IterableLogger, IterableUtil, and IterableInAppMe…
lposen Nov 7, 2024
5a1eea0
Refactor Iterable module: update imports for consistency and rename t…
lposen Nov 7, 2024
1db7ca4
Refactor imports in Iterable module: update paths to use absolute imp…
lposen Nov 7, 2024
04dc426
Refactor imports and restructure files in Iterable module: consolidat…
lposen Nov 7, 2024
1393e4b
Undid local path changes as they do not work with the build
lposen Nov 7, 2024
6cfa8a2
Fix import path for package.json in Iterable class to ensure correct …
lposen Nov 7, 2024
4688446
Refactor types in inbox module: change type aliases to interfaces for…
lposen Nov 7, 2024
f96f5c9
Merge branch '2.0.0-alpha/MOB-10131-remove-duplicate-code' into 2.0.0…
lposen Nov 14, 2024
3d92e26
Changed file order as it was messing with mocks
lposen Nov 14, 2024
e6d729f
Merge branch '2.0.0-alpha/MOB-9995-reorganize-source-code' of github.…
lposen Nov 14, 2024
65aa68c
Merge branch '2.0.0-alpha/MOB-10131-remove-duplicate-code' into 2.0.0…
lposen Nov 15, 2024
4216fa7
Remove default exports from Iterable classes and enums
lposen Nov 15, 2024
8ea2a20
Merge branch '2.0.0-alpha/MOB-10131-remove-duplicate-code' into 2.0.0…
lposen Nov 25, 2024
a20baec
Merge branch '2.0.0-alpha/MOB-10131-remove-duplicate-code' into 2.0.0…
lposen Nov 26, 2024
c8ece69
Merge branch '2.0.0-alpha/MOB-10131-remove-duplicate-code' into 2.0.0…
lposen Nov 27, 2024
a7dccb5
Merge branch '2.0.0-alpha/master' into 2.0.0-alpha/MOB-9995-reorganiz…
lposen Dec 3, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 0 additions & 53 deletions src/IterableAction.ts

This file was deleted.

132 changes: 0 additions & 132 deletions src/IterableInAppClasses.ts

This file was deleted.

4 changes: 2 additions & 2 deletions src/__mocks__/MockRNIterableAPI.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { IterableAttributionInfo } from '../Iterable';
import { IterableInAppMessage } from '../IterableInAppMessage';
import { IterableAttributionInfo } from '../core';
import { IterableInAppMessage } from '../inApp';

export class MockRNIterableAPI {
static email?: string;
Expand Down
2 changes: 2 additions & 0 deletions src/__mocks__/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './MockLinking';
export * from './MockRNIterableAPI';
35 changes: 17 additions & 18 deletions src/__tests__/Iterable.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,21 @@ import { NativeEventEmitter } from 'react-native';

import { MockLinking } from '../__mocks__/MockLinking';
import { MockRNIterableAPI } from '../__mocks__/MockRNIterableAPI';
import { TestHelper } from './TestHelper';

import { IterableLogger } from '../core';
// import from the same location that consumers import from
import {
Iterable,
IterableAction,
IterableActionContext,
IterableActionSource,
IterableConfig,
IterableLogLevel,
} from '../index';
import {
EventName,
IterableAttributionInfo,
IterableCommerceItem,
} from '../Iterable';
import { IterableDataRegion } from '../IterableDataRegion';
import { IterableLogger } from '../IterableLogger';
IterableConfig,
IterableDataRegion,
IterableEventName,
IterableLogLevel,
} from '..';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this just look at the index file for the imports? Nice simplification.

import { TestHelper } from './TestHelper';

describe('Iterable', () => {
beforeEach(() => {
Expand Down Expand Up @@ -253,7 +250,7 @@ describe('Iterable', () => {
);
// sets up event emitter
const nativeEmitter = new NativeEventEmitter();
nativeEmitter.removeAllListeners(EventName.handleUrlCalled);
nativeEmitter.removeAllListeners(IterableEventName.handleUrlCalled);
// sets up config file and urlHandler function
// urlHandler set to return false
const config = new IterableConfig();
Expand All @@ -276,7 +273,7 @@ describe('Iterable', () => {
context: { action: actionDict, source: 'inApp' },
};
// WHEN handleUrlCalled event is emitted
nativeEmitter.emit(EventName.handleUrlCalled, dict);
nativeEmitter.emit(IterableEventName.handleUrlCalled, dict);
// THEN urlHandler and MockLinking is called with expected url
return await TestHelper.delayed(0, () => {
expect(config.urlHandler).toBeCalledWith(expectedUrl, dict.context);
Expand All @@ -289,7 +286,7 @@ describe('Iterable', () => {
);
// sets up event emitter
const nativeEmitter = new NativeEventEmitter();
nativeEmitter.removeAllListeners(EventName.handleUrlCalled);
nativeEmitter.removeAllListeners(IterableEventName.handleUrlCalled);
// sets up config file and urlHandler function
// urlHandler set to return false
const config = new IterableConfig();
Expand All @@ -312,7 +309,7 @@ describe('Iterable', () => {
context: { action: actionDict, source: 'inApp' },
};
// WHEN handleUrlCalled event is emitted
nativeEmitter.emit(EventName.handleUrlCalled, dict);
nativeEmitter.emit(IterableEventName.handleUrlCalled, dict);
// THEN urlHandler is called and MockLinking.openURL is not called
return await TestHelper.delayed(0, () => {
expect(config.urlHandler).toBeCalledWith(expectedUrl, dict.context);
Expand All @@ -325,7 +322,7 @@ describe('Iterable', () => {
);
// sets up event emitter
const nativeEmitter = new NativeEventEmitter();
nativeEmitter.removeAllListeners(EventName.handleUrlCalled);
nativeEmitter.removeAllListeners(IterableEventName.handleUrlCalled);
// sets up config file and urlHandler function
// urlHandler set to return true
const config = new IterableConfig();
Expand All @@ -348,7 +345,7 @@ describe('Iterable', () => {
context: { action: actionDict, source: 'inApp' },
};
// WHEN handleUrlCalled event is emitted
nativeEmitter.emit(EventName.handleUrlCalled, dict);
nativeEmitter.emit(IterableEventName.handleUrlCalled, dict);
// THEN urlHandler is called and MockLinking.openURL is not called
return await TestHelper.delayed(0, () => {
expect(config.urlHandler).toBeCalledWith(expectedUrl, dict.context);
Expand All @@ -361,7 +358,9 @@ describe('Iterable', () => {
);
// sets up event emitter
const nativeEmitter = new NativeEventEmitter();
nativeEmitter.removeAllListeners(EventName.handleCustomActionCalled);
nativeEmitter.removeAllListeners(
IterableEventName.handleCustomActionCalled
);
// sets up config file and customActionHandler function
// customActionHandler set to return true
const config = new IterableConfig();
Expand All @@ -382,7 +381,7 @@ describe('Iterable', () => {
context: { action: actionDict, source: IterableActionSource.inApp },
};
// WHEN handleCustomActionCalled event is emitted
nativeEmitter.emit(EventName.handleCustomActionCalled, dict);
nativeEmitter.emit(IterableEventName.handleCustomActionCalled, dict);
// THEN customActionHandler is called with expected action and expected context
const expectedAction = new IterableAction(actionName, actionData);
const expectedContext = new IterableActionContext(
Expand Down
21 changes: 11 additions & 10 deletions src/__tests__/IterableInApp.test.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
import { NativeEventEmitter } from 'react-native';

import { IterableLogger } from '../core';
import { MockRNIterableAPI } from '../__mocks__/MockRNIterableAPI';

import { Iterable, EventName } from '../Iterable';
import { IterableConfig } from '../IterableConfig';
import { IterableInAppMessage } from '../IterableInAppMessage';
import {
Iterable,
IterableConfig,
IterableEventName,
IterableInAppCloseSource,
IterableInAppDeleteSource,
IterableInAppLocation,
IterableInAppMessage,
IterableInAppShowResponse,
IterableInAppTrigger,
IterableInAppTriggerType,
IterableInboxMetadata,
IterableInAppCloseSource,
IterableInAppShowResponse,
IterableInAppDeleteSource,
} from '../IterableInAppClasses';
import { IterableLogger } from '../IterableLogger';
} from '..';

describe('Iterable In App', () => {
beforeEach(() => {
Expand Down Expand Up @@ -137,7 +138,7 @@ describe('Iterable In App', () => {
test('inAppHandler_messageAndEventEmitted_methodCalledWithMessage', () => {
// sets up event emitter
const nativeEmitter = new NativeEventEmitter();
nativeEmitter.removeAllListeners(EventName.handleInAppCalled);
nativeEmitter.removeAllListeners(IterableEventName.handleInAppCalled);

// sets up config file and inAppHandler function
const config = new IterableConfig();
Expand Down Expand Up @@ -170,7 +171,7 @@ describe('Iterable In App', () => {
);

// WHEN handleInAppCalled event is emitted
nativeEmitter.emit(EventName.handleInAppCalled, messageDict);
nativeEmitter.emit(IterableEventName.handleInAppCalled, messageDict);

// THEN inAppHandler and MockRNIterableAPI.setInAppShowResponse is called with message
expect(config.inAppHandler).toBeCalledWith(expectedMessage);
Expand Down
Loading
Loading