Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion src/__mocks__/MockRNIterableAPI.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IterableAttributionInfo } from '../IterableAttributionInfo';
import { IterableAttributionInfo } from '../core/classes/IterableAttributionInfo';
import { IterableInAppMessage } from 'inApp';

export class MockRNIterableAPI {
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/Iterable.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
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 { IterableLogger } from '../IterableLogger';
import { IterableLogger } from '../core/classes/IterableLogger';

describe('Iterable', () => {
beforeEach(() => {
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/IterableInApp.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
IterableInAppTriggerType,
IterableInboxMetadata,
} from '..';
import { IterableLogger } from '../IterableLogger';
import { IterableLogger } from '../core/classes/IterableLogger';

describe('Iterable In App', () => {
beforeEach(() => {
Expand Down
3 changes: 2 additions & 1 deletion src/Iterable.ts → src/core/classes/Iterable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@ import {
Platform,
} from 'react-native';

import { IterableAuthResponseResult, IterableEventName } from './enums';
import { IterableAuthResponseResult, IterableEventName } from 'core/enums';
import {
IterableInAppCloseSource,
IterableInAppDeleteSource,
IterableInAppLocation,
IterableInAppManager,
IterableInAppMessage,
} from 'inApp';

import { IterableAction } from './IterableAction';
import { IterableActionContext } from './IterableActionContext';
import { IterableAttributionInfo } from './IterableAttributionInfo';
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { IterableActionSource } from './enums';
import type { IterableActionSource } from 'core/enums';
import { IterableAction } from './IterableAction';

/**
Expand Down
File renamed without changes.
File renamed without changes.
9 changes: 5 additions & 4 deletions src/IterableConfig.ts → src/core/classes/IterableConfig.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import { IterableAction } from './IterableAction';
import type { IterableActionContext } from './IterableActionContext';
import type { IterableAuthResponse } from './IterableAuthResponse';
import {
IterableDataRegion,
IterableLogLevel,
IterablePushPlatform,
} from './enums';
} from 'core/enums';
import { IterableInAppMessage, IterableInAppShowResponse } from 'inApp';

Copy link
Contributor

Choose a reason for hiding this comment

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

Why was this deleted?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's such a simple type that it's not really needed

import { IterableAction } from './IterableAction';
import type { IterableActionContext } from './IterableActionContext';
import type { IterableAuthResponse } from './IterableAuthResponse';

/**
* An IterableConfig object sets various properties of the SDK.
* An IterableConfig object is passed into the static initialize method on the Iterable class when initializing the SDK.
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
10 changes: 10 additions & 0 deletions src/core/classes/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
export * from './Iterable';
export * from './IterableAction';
export * from './IterableActionContext';
export * from './IterableAttributionInfo';
export * from './IterableAuthResponse';
export * from './IterableCommerceItem';
export * from './IterableConfig';
export * from './IterableEdgeInsets';
export * from './IterableLogger';
export * from './IterableUtil';
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 3 additions & 0 deletions src/core/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export * from './classes';
export * from './enums';
export * from './hooks';
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice reorganization. Didn't know you could have nested index files.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { IterableEdgeInsets } from '../IterableEdgeInsets';
import { IterableEdgeInsets } from 'core';

import type { IterableInAppContent } from './types';
import { IterableInAppContentType } from './enums';
import { IterableInAppContentType } from 'inApp/enums';
import type { IterableInAppContent } from 'inApp/types';

// TODO: Add description
export class IterableHtmlInAppContent implements IterableInAppContent {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import { NativeModules } from 'react-native';

import { Iterable } from '../Iterable';

import { Iterable } from 'core';
import type {
IterableInAppDeleteSource,
IterableInAppLocation,
} from 'inApp/enums';
import { IterableHtmlInAppContent } from './IterableHtmlInAppContent';
import { IterableInAppMessage } from './IterableInAppMessage';
import type { IterableInAppLocation, IterableInAppDeleteSource } from './enums';

// TODO: Create a loader for this
const RNIterableAPI = NativeModules.RNIterableAPI;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { type ViewToken } from 'react-native';

import { IterableUtil } from '../IterableUtil';

import { IterableInboxMetadata } from './IterableInboxMetadata';
import { IterableInAppTriggerType } from './enums';
import { IterableUtil } from 'core';
import { IterableInAppTriggerType } from 'inApp/enums';
import { IterableInAppTrigger } from './IterableInAppTrigger';
import { IterableInboxMetadata } from './IterableInboxMetadata';

/**
* Iterable in-app message
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { IterableInAppTriggerType } from './enums';
import type { IterableInAppTriggerType } from 'inApp/enums';

// TODO: Add description
export class IterableInAppTrigger {
Expand Down
5 changes: 5 additions & 0 deletions src/inApp/classes/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export * from './IterableHtmlInAppContent';
export * from './IterableInAppManager';
export * from './IterableInAppMessage';
export * from './IterableInAppTrigger';
export * from './IterableInboxMetadata';
6 changes: 1 addition & 5 deletions src/inApp/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
export * from './classes';
export * from './enums';
export * from './IterableHtmlInAppContent';
export * from './IterableInAppManager';
export * from './IterableInAppMessage';
export * from './IterableInAppTrigger';
export * from './IterableInboxMetadata';
export * from './types';
2 changes: 1 addition & 1 deletion src/inApp/types/IterableInAppContent.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { IterableInAppContentType } from '../enums';
import type { IterableInAppContentType } from 'inApp/enums';

// TODO: Add description
export interface IterableInAppContent {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { NativeModules } from 'react-native';

import { Iterable } from 'core';
import {
IterableHtmlInAppContent,
IterableInAppDeleteSource,
Expand All @@ -10,7 +11,6 @@ import type {
IterableInboxImpressionRowInfo,
IterableInboxRowViewModel,
} from 'inbox/types';
import { Iterable } from '../Iterable';

const RNIterableAPI = NativeModules.RNIterableAPI;

Expand Down
1 change: 1 addition & 0 deletions src/inbox/classes/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './IterableInboxDataModel';
8 changes: 3 additions & 5 deletions src/inbox/components/IterableInbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,13 @@ import {
} from 'react-native';
import { SafeAreaView } from 'react-native-safe-area-context';

import { Iterable } from '../../Iterable';
import { useAppStateListener, useDeviceOrientation } from '../../hooks';
import { Iterable, useAppStateListener, useDeviceOrientation } from 'core';
import { IterableInAppDeleteSource, IterableInAppLocation } from 'inApp';

import IterableInboxDataModel from 'inbox/IterableInboxDataModel';
import { IterableInboxDataModel } from 'inbox/classes';
import type {
IterableInboxCustomizations,
IterableInboxImpressionRowInfo,
IterableInboxRowViewModel,
IterableInboxCustomizations,
} from 'inbox/types';
import { IterableInboxEmptyState } from './IterableInboxEmptyState';
import { IterableInboxMessageDisplay } from './IterableInboxMessageDisplay';
Expand Down
2 changes: 1 addition & 1 deletion src/inbox/components/IterableInboxMessageCell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
type ViewStyle,
} from 'react-native';

import { IterableInboxDataModel } from 'inbox/IterableInboxDataModel';
import { IterableInboxDataModel } from 'inbox/classes';
import type {
IterableInboxRowViewModel,
IterableInboxCustomizations,
Expand Down
12 changes: 7 additions & 5 deletions src/inbox/components/IterableInboxMessageDisplay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,19 @@ import {
import Icon from 'react-native-vector-icons/Ionicons';
import { WebView } from 'react-native-webview';

import { IterableActionSource } from '../../enums';
import {
Iterable,
IterableAction,
IterableActionContext,
IterableActionSource,
IterableEdgeInsets,
} from 'core';
import {
IterableHtmlInAppContent,
IterableInAppCloseSource,
IterableInAppLocation,
} from 'inApp';
import { Iterable } from '../../Iterable';
import { IterableAction } from '../../IterableAction';
import { IterableEdgeInsets } from '../../IterableEdgeInsets';
import { type IterableInboxRowViewModel } from 'inbox/types';
import IterableActionContext from '../../IterableActionContext';

// TODO: Comment
export interface IterableInboxMessageDisplayProps {
Expand Down
2 changes: 1 addition & 1 deletion src/inbox/components/IterableInboxMessageList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { useCallback, useRef, useState } from 'react';
import { type ViewabilityConfig, type ViewToken, FlatList } from 'react-native';

import { IterableInAppMessage } from 'inApp';
import { IterableInboxDataModel } from 'inbox/IterableInboxDataModel';
import { IterableInboxDataModel } from 'inbox/classes';
import type {
IterableInboxImpressionRowInfo,
IterableInboxRowViewModel,
Expand Down
2 changes: 2 additions & 0 deletions src/inbox/components/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
export * from './IterableInbox';
export * from './IterableInboxEmptyState';
export * from './IterableInboxMessageCell';
export * from './IterableInboxMessageDisplay';
export * from './IterableInboxMessageList';
1 change: 1 addition & 0 deletions src/inbox/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export * from './classes';
export * from './components';
export * from './types';
24 changes: 13 additions & 11 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,22 @@
* React Native module for Iterable.
* @module react-native-iterable-sdk
*/
export {
Iterable,
IterableAction,
IterableActionContext,
IterableAttributionInfo,
IterableCommerceItem,
IterableConfig,
IterableEdgeInsets,
} from 'core/classes';
export {
IterableActionSource,
IterableDataRegion,
IterableEventName,
IterableLogLevel,
} from './enums';
export { useAppStateListener, useDeviceOrientation } from './hooks';
} from 'core/enums';
export { useAppStateListener, useDeviceOrientation } from 'core/hooks';
export {
IterableHtmlInAppContent,
IterableInAppCloseSource,
Expand All @@ -22,7 +31,7 @@ export {
IterableInAppTriggerType,
IterableInboxMetadata,
type IterableInAppContent,
} from './inApp';
} from 'inApp';
export {
IterableInbox,
IterableInboxEmptyState,
Expand All @@ -31,11 +40,4 @@ export {
type IterableInboxRowViewModel as InboxRowViewModel,
type IterableInboxCustomizations,
type IterableInboxProps,
} from './inbox';
export { Iterable } from './Iterable';
export { IterableAction } from './IterableAction';
export { IterableActionContext } from './IterableActionContext';
export { IterableAttributionInfo } from './IterableAttributionInfo';
export { IterableCommerceItem } from './IterableCommerceItem';
export { IterableConfig } from './IterableConfig';
export { IterableEdgeInsets } from './IterableEdgeInsets';
} from 'inbox';
2 changes: 2 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
"rootDir": ".",
"paths": {
"@iterable/react-native-sdk": ["./src/index"],
"core/*": ["./src/core/*"],
"core": ["./src/core/index"],
"inbox/*": ["./src/inbox/*"],
"inbox": ["./src/inbox/index"],
"inApp/*": ["./src/inApp/*"],
Expand Down