@trycourier/courier-react-native 5.6.17 → 5.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +66 -135
- package/android/build.gradle +1 -1
- package/android/src/main/java/com/courierreactnative/CourierClientModule.kt +1 -0
- package/android/src/main/java/com/courierreactnative/CourierSharedModule.kt +3 -0
- package/android/src/main/java/com/courierreactnative/Utils.kt +11 -1
- package/courier-react-native.podspec +1 -1
- package/ios/CourierClientModule.swift +1 -0
- package/ios/CourierReactNativeDelegate.m +1 -1
- package/ios/CourierReactNativeEventEmitter.swift +1 -1
- package/ios/CourierReactNativeModule.m +1 -0
- package/ios/CourierSharedModule.swift +10 -3
- package/ios/Utils.swift +10 -0
- package/lib/commonjs/Broadcaster.js +5 -5
- package/lib/commonjs/Broadcaster.js.map +1 -1
- package/lib/commonjs/CourierApiUrls.js +29 -0
- package/lib/commonjs/CourierApiUrls.js.map +1 -0
- package/lib/commonjs/Modules.js.map +1 -1
- package/lib/commonjs/client/BrandClient.js.map +1 -1
- package/lib/commonjs/client/ClientModule.js.map +1 -1
- package/lib/commonjs/client/CourierClient.js +4 -1
- package/lib/commonjs/client/CourierClient.js.map +1 -1
- package/lib/commonjs/client/InboxClient.js.map +1 -1
- package/lib/commonjs/client/PreferenceClient.js.map +1 -1
- package/lib/commonjs/client/TokenClient.js.map +1 -1
- package/lib/commonjs/client/TrackingClient.js.map +1 -1
- package/lib/commonjs/index.js +22 -2
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/models/CourierAuthenticationListener.js.map +1 -1
- package/lib/commonjs/models/CourierPushListener.js.map +1 -1
- package/lib/commonjs/models/CourierUserPreferences.js +13 -13
- package/lib/commonjs/models/CourierUserPreferences.js.map +1 -1
- package/lib/commonjs/models/InboxAction.js.map +1 -1
- package/lib/commonjs/models/InboxMessage.js.map +1 -1
- package/lib/commonjs/utils.js.map +1 -1
- package/lib/commonjs/views/CourierInboxView.js +13 -13
- package/lib/commonjs/views/CourierInboxView.js.map +1 -1
- package/lib/commonjs/views/CourierPreferencesView.js +4 -4
- package/lib/commonjs/views/CourierPreferencesView.js.map +1 -1
- package/lib/module/Broadcaster.js +7 -7
- package/lib/module/Broadcaster.js.map +1 -1
- package/lib/module/CourierApiUrls.js +20 -0
- package/lib/module/CourierApiUrls.js.map +1 -0
- package/lib/module/Modules.js +1 -1
- package/lib/module/Modules.js.map +1 -1
- package/lib/module/client/BrandClient.js +1 -1
- package/lib/module/client/BrandClient.js.map +1 -1
- package/lib/module/client/ClientModule.js +1 -1
- package/lib/module/client/ClientModule.js.map +1 -1
- package/lib/module/client/CourierClient.js +10 -7
- package/lib/module/client/CourierClient.js.map +1 -1
- package/lib/module/client/InboxClient.js +1 -1
- package/lib/module/client/InboxClient.js.map +1 -1
- package/lib/module/client/PreferenceClient.js +1 -1
- package/lib/module/client/PreferenceClient.js.map +1 -1
- package/lib/module/client/TokenClient.js +1 -1
- package/lib/module/client/TokenClient.js.map +1 -1
- package/lib/module/client/TrackingClient.js +1 -1
- package/lib/module/client/TrackingClient.js.map +1 -1
- package/lib/module/index.js +5 -2
- package/lib/module/index.js.map +1 -1
- package/lib/module/models/CourierAuthenticationListener.js +1 -1
- package/lib/module/models/CourierAuthenticationListener.js.map +1 -1
- package/lib/module/models/CourierInboxListener.js +1 -1
- package/lib/module/models/CourierPushListener.js.map +1 -1
- package/lib/module/models/CourierUserPreferences.js +13 -13
- package/lib/module/models/CourierUserPreferences.js.map +1 -1
- package/lib/module/models/InboxAction.js.map +1 -1
- package/lib/module/models/InboxMessage.js +1 -1
- package/lib/module/models/InboxMessage.js.map +1 -1
- package/lib/module/utils.js.map +1 -1
- package/lib/module/views/CourierInboxView.js +18 -18
- package/lib/module/views/CourierInboxView.js.map +1 -1
- package/lib/module/views/CourierPreferencesView.js +7 -7
- package/lib/module/views/CourierPreferencesView.js.map +1 -1
- package/lib/typescript/src/Broadcaster.d.ts +7 -7
- package/lib/typescript/src/Broadcaster.d.ts.map +1 -1
- package/lib/typescript/src/CourierApiUrls.d.ts +11 -0
- package/lib/typescript/src/CourierApiUrls.d.ts.map +1 -0
- package/lib/typescript/src/Modules.d.ts.map +1 -1
- package/lib/typescript/src/client/BrandClient.d.ts +1 -1
- package/lib/typescript/src/client/BrandClient.d.ts.map +1 -1
- package/lib/typescript/src/client/ClientModule.d.ts +1 -1
- package/lib/typescript/src/client/ClientModule.d.ts.map +1 -1
- package/lib/typescript/src/client/CourierClient.d.ts +9 -6
- package/lib/typescript/src/client/CourierClient.d.ts.map +1 -1
- package/lib/typescript/src/client/InboxClient.d.ts +1 -1
- package/lib/typescript/src/client/InboxClient.d.ts.map +1 -1
- package/lib/typescript/src/client/PreferenceClient.d.ts +1 -1
- package/lib/typescript/src/client/PreferenceClient.d.ts.map +1 -1
- package/lib/typescript/src/client/TokenClient.d.ts +1 -1
- package/lib/typescript/src/client/TokenClient.d.ts.map +1 -1
- package/lib/typescript/src/client/TrackingClient.d.ts +1 -1
- package/lib/typescript/src/client/TrackingClient.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +6 -2
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/models/Android_CourierSheet.d.ts +1 -1
- package/lib/typescript/src/models/Android_CourierSheet.d.ts.map +1 -1
- package/lib/typescript/src/models/CourierAuthenticationListener.d.ts +1 -1
- package/lib/typescript/src/models/CourierAuthenticationListener.d.ts.map +1 -1
- package/lib/typescript/src/models/CourierBrand.d.ts.map +1 -1
- package/lib/typescript/src/models/CourierButton.d.ts +1 -1
- package/lib/typescript/src/models/CourierButton.d.ts.map +1 -1
- package/lib/typescript/src/models/CourierFont.d.ts.map +1 -1
- package/lib/typescript/src/models/CourierInboxListener.d.ts +1 -1
- package/lib/typescript/src/models/CourierInboxMessages.d.ts +1 -1
- package/lib/typescript/src/models/CourierInboxTheme.d.ts +3 -3
- package/lib/typescript/src/models/CourierInboxTheme.d.ts.map +1 -1
- package/lib/typescript/src/models/CourierInfoViewStyle.d.ts +2 -2
- package/lib/typescript/src/models/CourierInfoViewStyle.d.ts.map +1 -1
- package/lib/typescript/src/models/CourierPreferencesTheme.d.ts +6 -6
- package/lib/typescript/src/models/CourierPreferencesTheme.d.ts.map +1 -1
- package/lib/typescript/src/models/CourierPushListener.d.ts.map +1 -1
- package/lib/typescript/src/models/CourierUserPreferences.d.ts +1 -1
- package/lib/typescript/src/models/CourierUserPreferences.d.ts.map +1 -1
- package/lib/typescript/src/models/InboxAction.d.ts.map +1 -1
- package/lib/typescript/src/models/InboxMessage.d.ts +1 -1
- package/lib/typescript/src/models/InboxMessage.d.ts.map +1 -1
- package/lib/typescript/src/models/InboxMessageEvent.d.ts.map +1 -1
- package/lib/typescript/src/models/InboxMessageSet.d.ts +1 -1
- package/lib/typescript/src/models/iOS_CourierCell.d.ts.map +1 -1
- package/lib/typescript/src/models/iOS_CourierSheet.d.ts +1 -1
- package/lib/typescript/src/models/iOS_CourierSheet.d.ts.map +1 -1
- package/lib/typescript/src/utils.d.ts.map +1 -1
- package/lib/typescript/src/views/CourierInboxView.d.ts +5 -5
- package/lib/typescript/src/views/CourierInboxView.d.ts.map +1 -1
- package/lib/typescript/src/views/CourierPreferencesView.d.ts +3 -3
- package/lib/typescript/src/views/CourierPreferencesView.d.ts.map +1 -1
- package/package.json +8 -4
- package/src/Broadcaster.tsx +21 -15
- package/src/CourierApiUrls.tsx +30 -0
- package/src/Modules.tsx +22 -13
- package/src/client/BrandClient.tsx +6 -6
- package/src/client/ClientModule.tsx +4 -6
- package/src/client/CourierClient.tsx +20 -13
- package/src/client/InboxClient.tsx +40 -13
- package/src/client/PreferenceClient.tsx +47 -21
- package/src/client/TokenClient.tsx +14 -7
- package/src/client/TrackingClient.tsx +7 -6
- package/src/index.tsx +208 -115
- package/src/models/Android_CourierSheet.tsx +5 -5
- package/src/models/CourierAuthenticationListener.tsx +5 -9
- package/src/models/CourierBrand.tsx +6 -6
- package/src/models/CourierButton.tsx +5 -5
- package/src/models/CourierDevice.tsx +1 -1
- package/src/models/CourierFont.tsx +4 -4
- package/src/models/CourierInboxListener.tsx +3 -3
- package/src/models/CourierInboxMessages.tsx +2 -2
- package/src/models/CourierInboxTheme.tsx +55 -42
- package/src/models/CourierInfoViewStyle.tsx +5 -5
- package/src/models/CourierPaging.tsx +1 -1
- package/src/models/CourierPreferencesTheme.tsx +32 -27
- package/src/models/CourierPushListener.tsx +9 -7
- package/src/models/CourierPushProvider.tsx +1 -1
- package/src/models/CourierTrackingEvent.tsx +6 -6
- package/src/models/CourierUserPreferences.tsx +32 -28
- package/src/models/InboxAction.tsx +2 -6
- package/src/models/InboxMessage.tsx +4 -5
- package/src/models/InboxMessageEvent.tsx +7 -1
- package/src/models/InboxMessageFeed.tsx +1 -1
- package/src/models/InboxMessageSet.tsx +1 -1
- package/src/models/iOS_CourierCell.tsx +10 -5
- package/src/models/iOS_CourierSheet.tsx +4 -4
- package/src/utils.tsx +4 -7
- package/src/views/CourierInboxView.tsx +79 -71
- package/src/views/CourierPreferencesView.tsx +34 -35
- package/lib/example/src/App.js +0 -11
- package/lib/example/src/Emitter.js +0 -11
- package/lib/example/src/Env.js +0 -6
- package/lib/example/src/Home.js +0 -67
- package/lib/example/src/Poke.js +0 -75
- package/lib/example/src/Tabs.js +0 -36
- package/lib/example/src/Utils.js +0 -71
- package/lib/example/src/pages/Auth.js +0 -224
- package/lib/example/src/pages/Inbox.js +0 -38
- package/lib/example/src/pages/Preferences.js +0 -13
- package/lib/example/src/pages/PreferencesStack.js +0 -11
- package/lib/example/src/pages/Push.js +0 -93
- package/lib/example/src/pages/Styles.js +0 -26
- package/lib/example/src/pages/Tests.js +0 -1068
- package/lib/example/src/pages/inbox/InboxCustom.js +0 -141
- package/lib/example/src/pages/inbox/InboxDefault.js +0 -22
- package/lib/example/src/pages/inbox/InboxStyled.js +0 -220
- package/lib/example/src/pages/preferences/PreferencesCustom.js +0 -91
- package/lib/example/src/pages/preferences/PreferencesDefault.js +0 -17
- package/lib/example/src/pages/preferences/PreferencesDetail.js +0 -127
- package/lib/example/src/pages/preferences/PreferencesStyled.js +0 -110
- package/lib/package.json +0 -171
- package/lib/src/Broadcaster.js +0 -24
- package/lib/src/Modules.js +0 -26
- package/lib/src/client/BrandClient.js +0 -17
- package/lib/src/client/ClientModule.js +0 -14
- package/lib/src/client/CourierClient.js +0 -31
- package/lib/src/client/InboxClient.js +0 -99
- package/lib/src/client/PreferenceClient.js +0 -63
- package/lib/src/client/TokenClient.js +0 -27
- package/lib/src/client/TrackingClient.js +0 -17
- package/lib/src/index.js +0 -567
- package/lib/src/models/Android_CourierSheet.js +0 -1
- package/lib/src/models/CourierAuthenticationListener.js +0 -14
- package/lib/src/models/CourierBrand.js +0 -1
- package/lib/src/models/CourierButton.js +0 -1
- package/lib/src/models/CourierDevice.js +0 -1
- package/lib/src/models/CourierFont.js +0 -1
- package/lib/src/models/CourierInboxListener.js +0 -20
- package/lib/src/models/CourierInboxMessages.js +0 -1
- package/lib/src/models/CourierInboxTheme.js +0 -1
- package/lib/src/models/CourierInfoViewStyle.js +0 -1
- package/lib/src/models/CourierPaging.js +0 -1
- package/lib/src/models/CourierPreferencesTheme.js +0 -1
- package/lib/src/models/CourierPushListener.js +0 -14
- package/lib/src/models/CourierPushProvider.js +0 -8
- package/lib/src/models/CourierTrackingEvent.js +0 -8
- package/lib/src/models/CourierUserPreferences.js +0 -51
- package/lib/src/models/InboxAction.js +0 -1
- package/lib/src/models/InboxMessage.js +0 -1
- package/lib/src/models/InboxMessageFeed.js +0 -1
- package/lib/src/models/InboxMessageSet.js +0 -1
- package/lib/src/models/iOS_CourierCell.js +0 -1
- package/lib/src/models/iOS_CourierSheet.js +0 -1
- package/lib/src/utils.js +0 -27
- package/lib/src/views/CourierInboxView.js +0 -75
- package/lib/src/views/CourierPreferencesView.js +0 -33
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { CourierFont } from
|
|
1
|
+
import { CourierFont } from './CourierFont';
|
|
2
2
|
|
|
3
3
|
export interface CourierButton {
|
|
4
|
-
font?: CourierFont
|
|
5
|
-
backgroundColor?: string
|
|
6
|
-
cornerRadius?: number
|
|
7
|
-
}
|
|
4
|
+
font?: CourierFont;
|
|
5
|
+
backgroundColor?: string;
|
|
6
|
+
cornerRadius?: number;
|
|
7
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export interface CourierFont {
|
|
2
|
-
family?: string
|
|
3
|
-
size?: number
|
|
4
|
-
color?: string
|
|
5
|
-
}
|
|
2
|
+
family?: string;
|
|
3
|
+
size?: number;
|
|
4
|
+
color?: string;
|
|
5
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import Courier from
|
|
2
|
-
import { EmitterSubscription } from
|
|
1
|
+
import Courier from '..';
|
|
2
|
+
import { EmitterSubscription } from 'react-native';
|
|
3
3
|
|
|
4
4
|
export class CourierInboxListener {
|
|
5
5
|
readonly listenerId: string;
|
|
@@ -20,4 +20,4 @@ export class CourierInboxListener {
|
|
|
20
20
|
// Remove this listener from native code
|
|
21
21
|
await Courier.shared.removeInboxListener({ listenerId: this.listenerId });
|
|
22
22
|
}
|
|
23
|
-
}
|
|
23
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { InboxMessage } from
|
|
1
|
+
import { InboxMessage } from './InboxMessage';
|
|
2
2
|
|
|
3
3
|
export interface CourierGetInboxMessagesResponse {
|
|
4
4
|
data?: GetInboxMessagesData;
|
|
@@ -25,4 +25,4 @@ export interface CourierGetInboxMessageResponse {
|
|
|
25
25
|
|
|
26
26
|
export interface GetInboxMessageData {
|
|
27
27
|
message: InboxMessage;
|
|
28
|
-
}
|
|
28
|
+
}
|
|
@@ -1,74 +1,87 @@
|
|
|
1
|
-
import { CourierButton } from
|
|
2
|
-
import { CourierFont } from
|
|
3
|
-
import { CourierInfoViewStyle } from
|
|
1
|
+
import { CourierButton } from './CourierButton';
|
|
2
|
+
import { CourierFont } from './CourierFont';
|
|
3
|
+
import { CourierInfoViewStyle } from './CourierInfoViewStyle';
|
|
4
4
|
|
|
5
5
|
export interface CourierInboxButtonStyle {
|
|
6
|
-
unread?: CourierButton
|
|
7
|
-
read?: CourierButton
|
|
6
|
+
unread?: CourierButton;
|
|
7
|
+
read?: CourierButton;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
export interface CourierInboxTextStyle {
|
|
11
|
-
unread?: CourierFont
|
|
12
|
-
read?: CourierFont
|
|
11
|
+
unread?: CourierFont;
|
|
12
|
+
read?: CourierFont;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
export interface CourierInboxUnreadIndicatorStyle {
|
|
16
|
-
indicator?: 'dot' | 'line'
|
|
17
|
-
color?: string
|
|
16
|
+
indicator?: 'dot' | 'line';
|
|
17
|
+
color?: string;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
export interface CourierInboxTabIndicatorStyle {
|
|
21
|
-
font?: CourierFont
|
|
22
|
-
color?: string
|
|
21
|
+
font?: CourierFont;
|
|
22
|
+
color?: string;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
export interface CourierInboxTabItemStyle {
|
|
26
|
-
font?: CourierFont
|
|
27
|
-
indicator?: CourierInboxTabIndicatorStyle
|
|
26
|
+
font?: CourierFont;
|
|
27
|
+
indicator?: CourierInboxTabIndicatorStyle;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
export interface CourierInboxTabStyle {
|
|
31
|
-
selected?: CourierInboxTabItemStyle
|
|
32
|
-
unselected?: CourierInboxTabItemStyle
|
|
31
|
+
selected?: CourierInboxTabItemStyle;
|
|
32
|
+
unselected?: CourierInboxTabItemStyle;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
export interface CourierSwipeActionStyle {
|
|
36
|
-
icon?: string
|
|
37
|
-
color?: string
|
|
36
|
+
icon?: string;
|
|
37
|
+
color?: string;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
export interface CourierReadingSwipeActionStyle {
|
|
41
|
-
read?: CourierSwipeActionStyle
|
|
42
|
-
unread?: CourierSwipeActionStyle
|
|
41
|
+
read?: CourierSwipeActionStyle;
|
|
42
|
+
unread?: CourierSwipeActionStyle;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
export interface CourierArchivingSwipeActionStyle {
|
|
46
|
-
archive?: CourierSwipeActionStyle
|
|
46
|
+
archive?: CourierSwipeActionStyle;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
export interface CourierInboxTheme {
|
|
50
|
-
brandId?: string
|
|
51
|
-
tabIndicatorColor?: string
|
|
52
|
-
tabStyle?: CourierInboxTabStyle
|
|
53
|
-
readingSwipeActionStyle?: CourierReadingSwipeActionStyle
|
|
54
|
-
archivingSwipeActionStyle?: CourierArchivingSwipeActionStyle
|
|
55
|
-
loadingIndicatorColor?: string
|
|
56
|
-
unreadIndicatorStyle?: CourierInboxUnreadIndicatorStyle
|
|
57
|
-
titleStyle?: CourierInboxTextStyle
|
|
58
|
-
timeStyle?: CourierInboxTextStyle
|
|
59
|
-
bodyStyle?: CourierInboxTextStyle
|
|
60
|
-
buttonStyle?: CourierInboxButtonStyle
|
|
61
|
-
infoViewStyle?: CourierInfoViewStyle
|
|
50
|
+
brandId?: string;
|
|
51
|
+
tabIndicatorColor?: string;
|
|
52
|
+
tabStyle?: CourierInboxTabStyle;
|
|
53
|
+
readingSwipeActionStyle?: CourierReadingSwipeActionStyle;
|
|
54
|
+
archivingSwipeActionStyle?: CourierArchivingSwipeActionStyle;
|
|
55
|
+
loadingIndicatorColor?: string;
|
|
56
|
+
unreadIndicatorStyle?: CourierInboxUnreadIndicatorStyle;
|
|
57
|
+
titleStyle?: CourierInboxTextStyle;
|
|
58
|
+
timeStyle?: CourierInboxTextStyle;
|
|
59
|
+
bodyStyle?: CourierInboxTextStyle;
|
|
60
|
+
buttonStyle?: CourierInboxButtonStyle;
|
|
61
|
+
infoViewStyle?: CourierInfoViewStyle;
|
|
62
62
|
iOS?: {
|
|
63
|
-
messageAnimationStyle?:
|
|
63
|
+
messageAnimationStyle?:
|
|
64
|
+
| 'fade'
|
|
65
|
+
| 'right'
|
|
66
|
+
| 'left'
|
|
67
|
+
| 'top'
|
|
68
|
+
| 'bottom'
|
|
69
|
+
| 'none'
|
|
70
|
+
| 'middle'
|
|
71
|
+
| 'automatic';
|
|
64
72
|
cellStyles?: {
|
|
65
|
-
separatorStyle?: 'none' | 'singleLine' | 'singleLineEtched'
|
|
66
|
-
separatorInsets?: {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
73
|
+
separatorStyle?: 'none' | 'singleLine' | 'singleLineEtched';
|
|
74
|
+
separatorInsets?: {
|
|
75
|
+
top?: number;
|
|
76
|
+
left?: number;
|
|
77
|
+
bottom?: number;
|
|
78
|
+
right?: number;
|
|
79
|
+
};
|
|
80
|
+
separatorColor?: string;
|
|
81
|
+
selectionStyle?: 'none' | 'blue' | 'gray' | 'default';
|
|
82
|
+
};
|
|
83
|
+
};
|
|
71
84
|
android?: {
|
|
72
|
-
dividerItemDecoration?: 'none' | 'vertical'
|
|
73
|
-
}
|
|
74
|
-
}
|
|
85
|
+
dividerItemDecoration?: 'none' | 'vertical';
|
|
86
|
+
};
|
|
87
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { CourierButton } from
|
|
2
|
-
import { CourierFont } from
|
|
1
|
+
import { CourierButton } from './CourierButton';
|
|
2
|
+
import { CourierFont } from './CourierFont';
|
|
3
3
|
|
|
4
4
|
export interface CourierInfoViewStyle {
|
|
5
|
-
font?: CourierFont
|
|
6
|
-
button?: CourierButton
|
|
7
|
-
}
|
|
5
|
+
font?: CourierFont;
|
|
6
|
+
button?: CourierButton;
|
|
7
|
+
}
|
|
@@ -1,34 +1,39 @@
|
|
|
1
|
-
import { Android_CourierSheet } from
|
|
2
|
-
import { CourierButton } from
|
|
3
|
-
import { CourierFont } from
|
|
4
|
-
import { CourierInfoViewStyle } from
|
|
5
|
-
import { iOS_CourierCell } from
|
|
6
|
-
import { iOS_CourierSheet } from
|
|
1
|
+
import { Android_CourierSheet } from './Android_CourierSheet';
|
|
2
|
+
import { CourierButton } from './CourierButton';
|
|
3
|
+
import { CourierFont } from './CourierFont';
|
|
4
|
+
import { CourierInfoViewStyle } from './CourierInfoViewStyle';
|
|
5
|
+
import { iOS_CourierCell } from './iOS_CourierCell';
|
|
6
|
+
import { iOS_CourierSheet } from './iOS_CourierSheet';
|
|
7
7
|
|
|
8
|
-
export type CourierPreferencesChannel =
|
|
8
|
+
export type CourierPreferencesChannel =
|
|
9
|
+
| 'direct_message'
|
|
10
|
+
| 'email'
|
|
11
|
+
| 'push'
|
|
12
|
+
| 'sms'
|
|
13
|
+
| 'webhook';
|
|
9
14
|
|
|
10
|
-
export type CourierPreferencesMode =
|
|
15
|
+
export type CourierPreferencesMode =
|
|
11
16
|
| { type: 'topic' }
|
|
12
|
-
| { type: 'channels'
|
|
17
|
+
| { type: 'channels'; channels: CourierPreferencesChannel[] };
|
|
13
18
|
|
|
14
19
|
export interface CourierPreferencesTheme {
|
|
15
|
-
brandId?: string
|
|
16
|
-
loadingIndicatorColor?: string
|
|
17
|
-
sectionTitleFont?: CourierFont
|
|
18
|
-
topicTitleFont?: CourierFont
|
|
19
|
-
topicSubtitleFont?: CourierFont
|
|
20
|
-
topicButton?: CourierButton
|
|
21
|
-
sheetTitleFont?: CourierFont
|
|
22
|
-
infoViewStyle?: CourierInfoViewStyle
|
|
20
|
+
brandId?: string;
|
|
21
|
+
loadingIndicatorColor?: string;
|
|
22
|
+
sectionTitleFont?: CourierFont;
|
|
23
|
+
topicTitleFont?: CourierFont;
|
|
24
|
+
topicSubtitleFont?: CourierFont;
|
|
25
|
+
topicButton?: CourierButton;
|
|
26
|
+
sheetTitleFont?: CourierFont;
|
|
27
|
+
infoViewStyle?: CourierInfoViewStyle;
|
|
23
28
|
iOS?: {
|
|
24
|
-
topicCellStyles?: iOS_CourierCell
|
|
25
|
-
sheetSettingStyles?: iOS_CourierSheet
|
|
26
|
-
sheetCornerRadius?: number
|
|
27
|
-
sheetCellStyles?: iOS_CourierCell
|
|
28
|
-
}
|
|
29
|
+
topicCellStyles?: iOS_CourierCell;
|
|
30
|
+
sheetSettingStyles?: iOS_CourierSheet;
|
|
31
|
+
sheetCornerRadius?: number;
|
|
32
|
+
sheetCellStyles?: iOS_CourierCell;
|
|
33
|
+
};
|
|
29
34
|
android?: {
|
|
30
|
-
topicDividerItemDecoration?: 'none' | 'vertical'
|
|
31
|
-
sheetDividerItemDecoration?: 'none' | 'vertical'
|
|
32
|
-
sheetSettingStyles?: Android_CourierSheet
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
+
topicDividerItemDecoration?: 'none' | 'vertical';
|
|
36
|
+
sheetDividerItemDecoration?: 'none' | 'vertical';
|
|
37
|
+
sheetSettingStyles?: Android_CourierSheet;
|
|
38
|
+
};
|
|
39
|
+
}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
export class CourierPushListener {
|
|
2
|
+
readonly listenerId: string;
|
|
3
|
+
public onPushNotificationClicked?: (push: any) => void;
|
|
4
|
+
public onPushNotificationDelivered?: (push: any) => void;
|
|
2
5
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
constructor(
|
|
7
|
+
id: string,
|
|
8
|
+
onPushNotificationClicked?: (push: any) => void,
|
|
9
|
+
onPushNotificationDelivered?: (push: any) => void
|
|
10
|
+
) {
|
|
8
11
|
this.listenerId = id;
|
|
9
12
|
this.onPushNotificationClicked = onPushNotificationClicked;
|
|
10
13
|
this.onPushNotificationDelivered = onPushNotificationDelivered;
|
|
@@ -14,5 +17,4 @@ export class CourierPushListener {
|
|
|
14
17
|
this.onPushNotificationClicked = undefined;
|
|
15
18
|
this.onPushNotificationDelivered = undefined;
|
|
16
19
|
}
|
|
17
|
-
|
|
18
|
-
}
|
|
20
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export enum CourierTrackingEvent {
|
|
2
|
-
Clicked =
|
|
3
|
-
Delivered =
|
|
4
|
-
Opened =
|
|
5
|
-
Read =
|
|
6
|
-
Unread =
|
|
7
|
-
}
|
|
2
|
+
Clicked = 'CLICKED',
|
|
3
|
+
Delivered = 'DELIVERED',
|
|
4
|
+
Opened = 'OPENED',
|
|
5
|
+
Read = 'READ',
|
|
6
|
+
Unread = 'UNREAD',
|
|
7
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CourierPaging } from
|
|
1
|
+
import { CourierPaging } from './CourierPaging';
|
|
2
2
|
|
|
3
3
|
export interface CourierUserPreferences {
|
|
4
4
|
items: CourierUserPreferencesTopic[];
|
|
@@ -22,56 +22,60 @@ export interface GetCourierUserPreferencesTopic {
|
|
|
22
22
|
|
|
23
23
|
// Additional interfaces for CourierUserPreferencesStatus and CourierUserPreferencesChannel would be needed based on their definitions
|
|
24
24
|
export enum CourierUserPreferencesStatus {
|
|
25
|
-
OptedIn =
|
|
26
|
-
OptedOut =
|
|
27
|
-
Required =
|
|
28
|
-
Unknown =
|
|
25
|
+
OptedIn = 'OPTED_IN',
|
|
26
|
+
OptedOut = 'OPTED_OUT',
|
|
27
|
+
Required = 'REQUIRED',
|
|
28
|
+
Unknown = 'UNKNOWN',
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
// Function to get the title of the enum value
|
|
32
|
-
export function getCourierUserPreferencesStatusTitle(
|
|
32
|
+
export function getCourierUserPreferencesStatusTitle(
|
|
33
|
+
status: CourierUserPreferencesStatus
|
|
34
|
+
): string {
|
|
33
35
|
switch (status) {
|
|
34
36
|
case CourierUserPreferencesStatus.OptedIn:
|
|
35
|
-
return
|
|
37
|
+
return 'Opted In';
|
|
36
38
|
case CourierUserPreferencesStatus.OptedOut:
|
|
37
|
-
return
|
|
39
|
+
return 'Opted Out';
|
|
38
40
|
case CourierUserPreferencesStatus.Required:
|
|
39
|
-
return
|
|
41
|
+
return 'Required';
|
|
40
42
|
case CourierUserPreferencesStatus.Unknown:
|
|
41
|
-
return
|
|
43
|
+
return 'Unknown';
|
|
42
44
|
default:
|
|
43
|
-
return
|
|
45
|
+
return 'Unknown';
|
|
44
46
|
}
|
|
45
47
|
}
|
|
46
48
|
|
|
47
49
|
export enum CourierUserPreferencesChannel {
|
|
48
|
-
DirectMessage =
|
|
49
|
-
Inbox =
|
|
50
|
-
Email =
|
|
51
|
-
Push =
|
|
52
|
-
Sms =
|
|
53
|
-
Webhook =
|
|
54
|
-
Unknown =
|
|
50
|
+
DirectMessage = 'direct_message',
|
|
51
|
+
Inbox = 'inbox',
|
|
52
|
+
Email = 'email',
|
|
53
|
+
Push = 'push',
|
|
54
|
+
Sms = 'sms',
|
|
55
|
+
Webhook = 'webhook',
|
|
56
|
+
Unknown = 'unknown',
|
|
55
57
|
}
|
|
56
58
|
|
|
57
59
|
// Function to get the title of the enum value
|
|
58
|
-
export function getCourierUserPreferencesChannelTitle(
|
|
60
|
+
export function getCourierUserPreferencesChannelTitle(
|
|
61
|
+
channel: CourierUserPreferencesChannel
|
|
62
|
+
): string {
|
|
59
63
|
switch (channel) {
|
|
60
64
|
case CourierUserPreferencesChannel.DirectMessage:
|
|
61
|
-
return
|
|
65
|
+
return 'In App Messages';
|
|
62
66
|
case CourierUserPreferencesChannel.Inbox:
|
|
63
|
-
return
|
|
67
|
+
return 'Inbox';
|
|
64
68
|
case CourierUserPreferencesChannel.Email:
|
|
65
|
-
return
|
|
69
|
+
return 'Emails';
|
|
66
70
|
case CourierUserPreferencesChannel.Push:
|
|
67
|
-
return
|
|
71
|
+
return 'Push Notifications';
|
|
68
72
|
case CourierUserPreferencesChannel.Sms:
|
|
69
|
-
return
|
|
73
|
+
return 'Text Messages';
|
|
70
74
|
case CourierUserPreferencesChannel.Webhook:
|
|
71
|
-
return
|
|
75
|
+
return 'Webhooks';
|
|
72
76
|
case CourierUserPreferencesChannel.Unknown:
|
|
73
|
-
return
|
|
77
|
+
return 'Unknown';
|
|
74
78
|
default:
|
|
75
|
-
return
|
|
79
|
+
return 'Unknown';
|
|
76
80
|
}
|
|
77
|
-
}
|
|
81
|
+
}
|
|
@@ -16,14 +16,10 @@ export class InboxAction {
|
|
|
16
16
|
static fromJson(jsonString: string): InboxAction {
|
|
17
17
|
try {
|
|
18
18
|
const parsed = JSON.parse(jsonString);
|
|
19
|
-
return new InboxAction(
|
|
20
|
-
parsed.content,
|
|
21
|
-
parsed.href,
|
|
22
|
-
parsed.data
|
|
23
|
-
);
|
|
19
|
+
return new InboxAction(parsed.content, parsed.href, parsed.data);
|
|
24
20
|
} catch (error) {
|
|
25
21
|
console.log(`Error parsing action: ${error}`);
|
|
26
22
|
throw error;
|
|
27
23
|
}
|
|
28
24
|
}
|
|
29
|
-
}
|
|
25
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import Courier from
|
|
2
|
-
import { InboxAction } from
|
|
1
|
+
import Courier from '..';
|
|
2
|
+
import { InboxAction } from './InboxAction';
|
|
3
3
|
|
|
4
4
|
export class InboxMessage {
|
|
5
5
|
readonly messageId: string;
|
|
@@ -19,7 +19,7 @@ export class InboxMessage {
|
|
|
19
19
|
constructor(
|
|
20
20
|
messageId: string,
|
|
21
21
|
title: string | null = null,
|
|
22
|
-
body: string | null = null,
|
|
22
|
+
body: string | null = null,
|
|
23
23
|
preview: string | null = null,
|
|
24
24
|
created: string | null = null,
|
|
25
25
|
actions: InboxAction[] | null = null,
|
|
@@ -101,5 +101,4 @@ export class InboxMessage {
|
|
|
101
101
|
async markAsClicked() {
|
|
102
102
|
await Courier.shared.clickMessage({ messageId: this.messageId });
|
|
103
103
|
}
|
|
104
|
-
|
|
105
|
-
}
|
|
104
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export type InboxMessageFeed = 'feed' | 'archive';
|
|
1
|
+
export type InboxMessageFeed = 'feed' | 'archive';
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
export interface iOS_CourierCell {
|
|
2
|
-
separatorStyle?: 'none' | 'singleLine' | 'singleLineEtched'
|
|
3
|
-
separatorInsets?: {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
separatorStyle?: 'none' | 'singleLine' | 'singleLineEtched';
|
|
3
|
+
separatorInsets?: {
|
|
4
|
+
top?: number;
|
|
5
|
+
left?: number;
|
|
6
|
+
bottom?: number;
|
|
7
|
+
right?: number;
|
|
8
|
+
};
|
|
9
|
+
separatorColor?: string;
|
|
10
|
+
selectionStyle?: 'none' | 'blue' | 'gray' | 'default';
|
|
11
|
+
}
|
package/src/utils.tsx
CHANGED
|
@@ -1,23 +1,21 @@
|
|
|
1
1
|
import packageJson from '../package.json';
|
|
2
2
|
|
|
3
3
|
export namespace Events {
|
|
4
|
-
|
|
5
4
|
export namespace Log {
|
|
6
5
|
export const DEBUG_LOG = 'courierDebugEvent';
|
|
7
6
|
}
|
|
8
|
-
|
|
7
|
+
|
|
9
8
|
export namespace Push {
|
|
10
9
|
export const CLICKED = 'pushNotificationClicked';
|
|
11
10
|
export const DELIVERED = 'pushNotificationDelivered';
|
|
12
11
|
}
|
|
13
|
-
|
|
14
12
|
}
|
|
15
13
|
|
|
16
14
|
export class CourierUtils {
|
|
17
|
-
|
|
18
15
|
static generateUUID(): string {
|
|
19
16
|
let uuid = '';
|
|
20
|
-
const characters =
|
|
17
|
+
const characters =
|
|
18
|
+
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
|
21
19
|
const charactersLength = characters.length;
|
|
22
20
|
for (let i = 0; i < 16; i++) {
|
|
23
21
|
uuid += characters.charAt(Math.floor(Math.random() * charactersLength));
|
|
@@ -28,5 +26,4 @@ export class CourierUtils {
|
|
|
28
26
|
static getPackageVersion(): string {
|
|
29
27
|
return packageJson.version;
|
|
30
28
|
}
|
|
31
|
-
|
|
32
|
-
}
|
|
29
|
+
}
|