@trycourier/courier-react-native 5.6.16 → 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.
Files changed (222) hide show
  1. package/README.md +66 -135
  2. package/android/build.gradle +1 -1
  3. package/android/src/main/java/com/courierreactnative/CourierClientModule.kt +1 -0
  4. package/android/src/main/java/com/courierreactnative/CourierSharedModule.kt +3 -0
  5. package/android/src/main/java/com/courierreactnative/Utils.kt +11 -1
  6. package/courier-react-native.podspec +1 -1
  7. package/ios/CourierClientModule.swift +1 -0
  8. package/ios/CourierReactNativeDelegate.m +1 -1
  9. package/ios/CourierReactNativeEventEmitter.swift +1 -1
  10. package/ios/CourierReactNativeModule.m +1 -0
  11. package/ios/CourierSharedModule.swift +10 -3
  12. package/ios/Utils.swift +10 -0
  13. package/lib/commonjs/Broadcaster.js +5 -5
  14. package/lib/commonjs/Broadcaster.js.map +1 -1
  15. package/lib/commonjs/CourierApiUrls.js +29 -0
  16. package/lib/commonjs/CourierApiUrls.js.map +1 -0
  17. package/lib/commonjs/Modules.js.map +1 -1
  18. package/lib/commonjs/client/BrandClient.js.map +1 -1
  19. package/lib/commonjs/client/ClientModule.js.map +1 -1
  20. package/lib/commonjs/client/CourierClient.js +4 -1
  21. package/lib/commonjs/client/CourierClient.js.map +1 -1
  22. package/lib/commonjs/client/InboxClient.js.map +1 -1
  23. package/lib/commonjs/client/PreferenceClient.js.map +1 -1
  24. package/lib/commonjs/client/TokenClient.js.map +1 -1
  25. package/lib/commonjs/client/TrackingClient.js.map +1 -1
  26. package/lib/commonjs/index.js +22 -2
  27. package/lib/commonjs/index.js.map +1 -1
  28. package/lib/commonjs/models/CourierAuthenticationListener.js.map +1 -1
  29. package/lib/commonjs/models/CourierPushListener.js.map +1 -1
  30. package/lib/commonjs/models/CourierUserPreferences.js +13 -13
  31. package/lib/commonjs/models/CourierUserPreferences.js.map +1 -1
  32. package/lib/commonjs/models/InboxAction.js.map +1 -1
  33. package/lib/commonjs/models/InboxMessage.js.map +1 -1
  34. package/lib/commonjs/utils.js.map +1 -1
  35. package/lib/commonjs/views/CourierInboxView.js +13 -13
  36. package/lib/commonjs/views/CourierInboxView.js.map +1 -1
  37. package/lib/commonjs/views/CourierPreferencesView.js +4 -4
  38. package/lib/commonjs/views/CourierPreferencesView.js.map +1 -1
  39. package/lib/module/Broadcaster.js +7 -7
  40. package/lib/module/Broadcaster.js.map +1 -1
  41. package/lib/module/CourierApiUrls.js +20 -0
  42. package/lib/module/CourierApiUrls.js.map +1 -0
  43. package/lib/module/Modules.js +1 -1
  44. package/lib/module/Modules.js.map +1 -1
  45. package/lib/module/client/BrandClient.js +1 -1
  46. package/lib/module/client/BrandClient.js.map +1 -1
  47. package/lib/module/client/ClientModule.js +1 -1
  48. package/lib/module/client/ClientModule.js.map +1 -1
  49. package/lib/module/client/CourierClient.js +10 -7
  50. package/lib/module/client/CourierClient.js.map +1 -1
  51. package/lib/module/client/InboxClient.js +1 -1
  52. package/lib/module/client/InboxClient.js.map +1 -1
  53. package/lib/module/client/PreferenceClient.js +1 -1
  54. package/lib/module/client/PreferenceClient.js.map +1 -1
  55. package/lib/module/client/TokenClient.js +1 -1
  56. package/lib/module/client/TokenClient.js.map +1 -1
  57. package/lib/module/client/TrackingClient.js +1 -1
  58. package/lib/module/client/TrackingClient.js.map +1 -1
  59. package/lib/module/index.js +5 -2
  60. package/lib/module/index.js.map +1 -1
  61. package/lib/module/models/CourierAuthenticationListener.js +1 -1
  62. package/lib/module/models/CourierAuthenticationListener.js.map +1 -1
  63. package/lib/module/models/CourierInboxListener.js +1 -1
  64. package/lib/module/models/CourierPushListener.js.map +1 -1
  65. package/lib/module/models/CourierUserPreferences.js +13 -13
  66. package/lib/module/models/CourierUserPreferences.js.map +1 -1
  67. package/lib/module/models/InboxAction.js.map +1 -1
  68. package/lib/module/models/InboxMessage.js +1 -1
  69. package/lib/module/models/InboxMessage.js.map +1 -1
  70. package/lib/module/utils.js.map +1 -1
  71. package/lib/module/views/CourierInboxView.js +18 -18
  72. package/lib/module/views/CourierInboxView.js.map +1 -1
  73. package/lib/module/views/CourierPreferencesView.js +7 -7
  74. package/lib/module/views/CourierPreferencesView.js.map +1 -1
  75. package/lib/typescript/src/Broadcaster.d.ts +7 -7
  76. package/lib/typescript/src/Broadcaster.d.ts.map +1 -1
  77. package/lib/typescript/src/CourierApiUrls.d.ts +11 -0
  78. package/lib/typescript/src/CourierApiUrls.d.ts.map +1 -0
  79. package/lib/typescript/src/Modules.d.ts.map +1 -1
  80. package/lib/typescript/src/client/BrandClient.d.ts +1 -1
  81. package/lib/typescript/src/client/BrandClient.d.ts.map +1 -1
  82. package/lib/typescript/src/client/ClientModule.d.ts +1 -1
  83. package/lib/typescript/src/client/ClientModule.d.ts.map +1 -1
  84. package/lib/typescript/src/client/CourierClient.d.ts +9 -6
  85. package/lib/typescript/src/client/CourierClient.d.ts.map +1 -1
  86. package/lib/typescript/src/client/InboxClient.d.ts +1 -1
  87. package/lib/typescript/src/client/InboxClient.d.ts.map +1 -1
  88. package/lib/typescript/src/client/PreferenceClient.d.ts +1 -1
  89. package/lib/typescript/src/client/PreferenceClient.d.ts.map +1 -1
  90. package/lib/typescript/src/client/TokenClient.d.ts +1 -1
  91. package/lib/typescript/src/client/TokenClient.d.ts.map +1 -1
  92. package/lib/typescript/src/client/TrackingClient.d.ts +1 -1
  93. package/lib/typescript/src/client/TrackingClient.d.ts.map +1 -1
  94. package/lib/typescript/src/index.d.ts +6 -2
  95. package/lib/typescript/src/index.d.ts.map +1 -1
  96. package/lib/typescript/src/models/Android_CourierSheet.d.ts +1 -1
  97. package/lib/typescript/src/models/Android_CourierSheet.d.ts.map +1 -1
  98. package/lib/typescript/src/models/CourierAuthenticationListener.d.ts +1 -1
  99. package/lib/typescript/src/models/CourierAuthenticationListener.d.ts.map +1 -1
  100. package/lib/typescript/src/models/CourierBrand.d.ts.map +1 -1
  101. package/lib/typescript/src/models/CourierButton.d.ts +1 -1
  102. package/lib/typescript/src/models/CourierButton.d.ts.map +1 -1
  103. package/lib/typescript/src/models/CourierFont.d.ts.map +1 -1
  104. package/lib/typescript/src/models/CourierInboxListener.d.ts +1 -1
  105. package/lib/typescript/src/models/CourierInboxMessages.d.ts +1 -1
  106. package/lib/typescript/src/models/CourierInboxTheme.d.ts +3 -3
  107. package/lib/typescript/src/models/CourierInboxTheme.d.ts.map +1 -1
  108. package/lib/typescript/src/models/CourierInfoViewStyle.d.ts +2 -2
  109. package/lib/typescript/src/models/CourierInfoViewStyle.d.ts.map +1 -1
  110. package/lib/typescript/src/models/CourierPreferencesTheme.d.ts +6 -6
  111. package/lib/typescript/src/models/CourierPreferencesTheme.d.ts.map +1 -1
  112. package/lib/typescript/src/models/CourierPushListener.d.ts.map +1 -1
  113. package/lib/typescript/src/models/CourierUserPreferences.d.ts +1 -1
  114. package/lib/typescript/src/models/CourierUserPreferences.d.ts.map +1 -1
  115. package/lib/typescript/src/models/InboxAction.d.ts.map +1 -1
  116. package/lib/typescript/src/models/InboxMessage.d.ts +1 -1
  117. package/lib/typescript/src/models/InboxMessage.d.ts.map +1 -1
  118. package/lib/typescript/src/models/InboxMessageEvent.d.ts.map +1 -1
  119. package/lib/typescript/src/models/InboxMessageSet.d.ts +1 -1
  120. package/lib/typescript/src/models/iOS_CourierCell.d.ts.map +1 -1
  121. package/lib/typescript/src/models/iOS_CourierSheet.d.ts +1 -1
  122. package/lib/typescript/src/models/iOS_CourierSheet.d.ts.map +1 -1
  123. package/lib/typescript/src/utils.d.ts.map +1 -1
  124. package/lib/typescript/src/views/CourierInboxView.d.ts +5 -5
  125. package/lib/typescript/src/views/CourierInboxView.d.ts.map +1 -1
  126. package/lib/typescript/src/views/CourierPreferencesView.d.ts +3 -3
  127. package/lib/typescript/src/views/CourierPreferencesView.d.ts.map +1 -1
  128. package/package.json +8 -4
  129. package/src/Broadcaster.tsx +21 -15
  130. package/src/CourierApiUrls.tsx +30 -0
  131. package/src/Modules.tsx +22 -13
  132. package/src/client/BrandClient.tsx +6 -6
  133. package/src/client/ClientModule.tsx +4 -6
  134. package/src/client/CourierClient.tsx +20 -13
  135. package/src/client/InboxClient.tsx +40 -13
  136. package/src/client/PreferenceClient.tsx +47 -21
  137. package/src/client/TokenClient.tsx +14 -7
  138. package/src/client/TrackingClient.tsx +7 -6
  139. package/src/index.tsx +208 -115
  140. package/src/models/Android_CourierSheet.tsx +5 -5
  141. package/src/models/CourierAuthenticationListener.tsx +5 -9
  142. package/src/models/CourierBrand.tsx +6 -6
  143. package/src/models/CourierButton.tsx +5 -5
  144. package/src/models/CourierDevice.tsx +1 -1
  145. package/src/models/CourierFont.tsx +4 -4
  146. package/src/models/CourierInboxListener.tsx +3 -3
  147. package/src/models/CourierInboxMessages.tsx +2 -2
  148. package/src/models/CourierInboxTheme.tsx +55 -42
  149. package/src/models/CourierInfoViewStyle.tsx +5 -5
  150. package/src/models/CourierPaging.tsx +1 -1
  151. package/src/models/CourierPreferencesTheme.tsx +32 -27
  152. package/src/models/CourierPushListener.tsx +9 -7
  153. package/src/models/CourierPushProvider.tsx +1 -1
  154. package/src/models/CourierTrackingEvent.tsx +6 -6
  155. package/src/models/CourierUserPreferences.tsx +32 -28
  156. package/src/models/InboxAction.tsx +2 -6
  157. package/src/models/InboxMessage.tsx +4 -5
  158. package/src/models/InboxMessageEvent.tsx +7 -1
  159. package/src/models/InboxMessageFeed.tsx +1 -1
  160. package/src/models/InboxMessageSet.tsx +1 -1
  161. package/src/models/iOS_CourierCell.tsx +10 -5
  162. package/src/models/iOS_CourierSheet.tsx +4 -4
  163. package/src/utils.tsx +4 -7
  164. package/src/views/CourierInboxView.tsx +79 -71
  165. package/src/views/CourierPreferencesView.tsx +34 -35
  166. package/lib/example/src/App.js +0 -11
  167. package/lib/example/src/Emitter.js +0 -11
  168. package/lib/example/src/Env.js +0 -6
  169. package/lib/example/src/Home.js +0 -67
  170. package/lib/example/src/Poke.js +0 -75
  171. package/lib/example/src/Tabs.js +0 -36
  172. package/lib/example/src/Utils.js +0 -71
  173. package/lib/example/src/pages/Auth.js +0 -224
  174. package/lib/example/src/pages/Inbox.js +0 -38
  175. package/lib/example/src/pages/Preferences.js +0 -13
  176. package/lib/example/src/pages/PreferencesStack.js +0 -11
  177. package/lib/example/src/pages/Push.js +0 -93
  178. package/lib/example/src/pages/Styles.js +0 -26
  179. package/lib/example/src/pages/Tests.js +0 -1068
  180. package/lib/example/src/pages/inbox/InboxCustom.js +0 -141
  181. package/lib/example/src/pages/inbox/InboxDefault.js +0 -22
  182. package/lib/example/src/pages/inbox/InboxStyled.js +0 -220
  183. package/lib/example/src/pages/preferences/PreferencesCustom.js +0 -91
  184. package/lib/example/src/pages/preferences/PreferencesDefault.js +0 -17
  185. package/lib/example/src/pages/preferences/PreferencesDetail.js +0 -127
  186. package/lib/example/src/pages/preferences/PreferencesStyled.js +0 -110
  187. package/lib/package.json +0 -171
  188. package/lib/src/Broadcaster.js +0 -24
  189. package/lib/src/Modules.js +0 -26
  190. package/lib/src/client/BrandClient.js +0 -17
  191. package/lib/src/client/ClientModule.js +0 -14
  192. package/lib/src/client/CourierClient.js +0 -31
  193. package/lib/src/client/InboxClient.js +0 -99
  194. package/lib/src/client/PreferenceClient.js +0 -63
  195. package/lib/src/client/TokenClient.js +0 -27
  196. package/lib/src/client/TrackingClient.js +0 -17
  197. package/lib/src/index.js +0 -567
  198. package/lib/src/models/Android_CourierSheet.js +0 -1
  199. package/lib/src/models/CourierAuthenticationListener.js +0 -14
  200. package/lib/src/models/CourierBrand.js +0 -1
  201. package/lib/src/models/CourierButton.js +0 -1
  202. package/lib/src/models/CourierDevice.js +0 -1
  203. package/lib/src/models/CourierFont.js +0 -1
  204. package/lib/src/models/CourierInboxListener.js +0 -20
  205. package/lib/src/models/CourierInboxMessages.js +0 -1
  206. package/lib/src/models/CourierInboxTheme.js +0 -1
  207. package/lib/src/models/CourierInfoViewStyle.js +0 -1
  208. package/lib/src/models/CourierPaging.js +0 -1
  209. package/lib/src/models/CourierPreferencesTheme.js +0 -1
  210. package/lib/src/models/CourierPushListener.js +0 -14
  211. package/lib/src/models/CourierPushProvider.js +0 -8
  212. package/lib/src/models/CourierTrackingEvent.js +0 -8
  213. package/lib/src/models/CourierUserPreferences.js +0 -51
  214. package/lib/src/models/InboxAction.js +0 -1
  215. package/lib/src/models/InboxMessage.js +0 -1
  216. package/lib/src/models/InboxMessageFeed.js +0 -1
  217. package/lib/src/models/InboxMessageSet.js +0 -1
  218. package/lib/src/models/iOS_CourierCell.js +0 -1
  219. package/lib/src/models/iOS_CourierSheet.js +0 -1
  220. package/lib/src/utils.js +0 -27
  221. package/lib/src/views/CourierInboxView.js +0 -75
  222. package/lib/src/views/CourierPreferencesView.js +0 -33
@@ -1,7 +1,7 @@
1
- import { CourierFont } from "./CourierFont"
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
+ }
@@ -5,4 +5,4 @@ export interface CourierDevice {
5
5
  platform?: string;
6
6
  manufacturer?: string;
7
7
  model?: string;
8
- }
8
+ }
@@ -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 "react-native";
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 "./InboxMessage";
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 "./CourierButton"
2
- import { CourierFont } from "./CourierFont"
3
- import { CourierInfoViewStyle } from "./CourierInfoViewStyle"
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?: 'fade' | 'right' | 'left' | 'top' | 'bottom' | 'none' | 'middle' | 'automatic',
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?: { top?: number, left?: number, bottom?: number, right?: number },
67
- separatorColor?: string,
68
- selectionStyle?: 'none' | 'blue' | 'gray' | 'default',
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 "./CourierButton"
2
- import { CourierFont } from "./CourierFont"
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,4 +1,4 @@
1
1
  export interface CourierPaging {
2
2
  cursor?: string;
3
3
  more: boolean;
4
- }
4
+ }
@@ -1,34 +1,39 @@
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";
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 = 'direct_message' | 'email' | 'push' | 'sms' | 'webhook';
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', channels: CourierPreferencesChannel[] };
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
- readonly listenerId: string
4
- public onPushNotificationClicked?: (push: any) => void
5
- public onPushNotificationDelivered?: (push: any) => void
6
-
7
- constructor(id: string, onPushNotificationClicked?: (push: any) => void, onPushNotificationDelivered?: (push: any) => void) {
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
+ }
@@ -4,4 +4,4 @@ export enum CourierPushProvider {
4
4
  EXPO = 'expo',
5
5
  ONE_SIGNAL = 'onesignal',
6
6
  PUSHER_BEAMS = 'pusher-beams',
7
- }
7
+ }
@@ -1,7 +1,7 @@
1
1
  export enum CourierTrackingEvent {
2
- Clicked = "CLICKED",
3
- Delivered = "DELIVERED",
4
- Opened = "OPENED",
5
- Read = "READ",
6
- Unread = "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 "./CourierPaging";
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 = "OPTED_IN",
26
- OptedOut = "OPTED_OUT",
27
- Required = "REQUIRED",
28
- Unknown = "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(status: CourierUserPreferencesStatus): string {
32
+ export function getCourierUserPreferencesStatusTitle(
33
+ status: CourierUserPreferencesStatus
34
+ ): string {
33
35
  switch (status) {
34
36
  case CourierUserPreferencesStatus.OptedIn:
35
- return "Opted In";
37
+ return 'Opted In';
36
38
  case CourierUserPreferencesStatus.OptedOut:
37
- return "Opted Out";
39
+ return 'Opted Out';
38
40
  case CourierUserPreferencesStatus.Required:
39
- return "Required";
41
+ return 'Required';
40
42
  case CourierUserPreferencesStatus.Unknown:
41
- return "Unknown";
43
+ return 'Unknown';
42
44
  default:
43
- return "Unknown";
45
+ return 'Unknown';
44
46
  }
45
47
  }
46
48
 
47
49
  export enum CourierUserPreferencesChannel {
48
- DirectMessage = "direct_message",
49
- Inbox = "inbox",
50
- Email = "email",
51
- Push = "push",
52
- Sms = "sms",
53
- Webhook = "webhook",
54
- Unknown = "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(channel: CourierUserPreferencesChannel): string {
60
+ export function getCourierUserPreferencesChannelTitle(
61
+ channel: CourierUserPreferencesChannel
62
+ ): string {
59
63
  switch (channel) {
60
64
  case CourierUserPreferencesChannel.DirectMessage:
61
- return "In App Messages";
65
+ return 'In App Messages';
62
66
  case CourierUserPreferencesChannel.Inbox:
63
- return "Inbox";
67
+ return 'Inbox';
64
68
  case CourierUserPreferencesChannel.Email:
65
- return "Emails";
69
+ return 'Emails';
66
70
  case CourierUserPreferencesChannel.Push:
67
- return "Push Notifications";
71
+ return 'Push Notifications';
68
72
  case CourierUserPreferencesChannel.Sms:
69
- return "Text Messages";
73
+ return 'Text Messages';
70
74
  case CourierUserPreferencesChannel.Webhook:
71
- return "Webhooks";
75
+ return 'Webhooks';
72
76
  case CourierUserPreferencesChannel.Unknown:
73
- return "Unknown";
77
+ return 'Unknown';
74
78
  default:
75
- return "Unknown";
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 "./InboxAction";
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,7 @@
1
- export type InboxMessageEvent = 'added' | 'read' | 'unread' | 'opened' | 'archived' | 'clicked';
1
+ export type InboxMessageEvent =
2
+ | 'added'
3
+ | 'read'
4
+ | 'unread'
5
+ | 'opened'
6
+ | 'archived'
7
+ | 'clicked';
@@ -1 +1 @@
1
- export type InboxMessageFeed = 'feed' | 'archive';
1
+ export type InboxMessageFeed = 'feed' | 'archive';
@@ -1,4 +1,4 @@
1
- import { InboxMessage } from "./InboxMessage";
1
+ import { InboxMessage } from './InboxMessage';
2
2
 
3
3
  export interface InboxMessageSet {
4
4
  messages: InboxMessage[];
@@ -1,6 +1,11 @@
1
1
  export interface iOS_CourierCell {
2
- separatorStyle?: 'none' | 'singleLine' | 'singleLineEtched'
3
- separatorInsets?: { top?: number, left?: number, bottom?: number, right?: number }
4
- separatorColor?: string
5
- selectionStyle?: 'none' | 'blue' | 'gray' | 'default'
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
+ }
@@ -1,6 +1,6 @@
1
- import { CourierFont } from "./CourierFont"
1
+ import { CourierFont } from './CourierFont';
2
2
 
3
3
  export interface iOS_CourierSheet {
4
- font?: CourierFont
5
- toggleColor?: string
6
- }
4
+ font?: CourierFont;
5
+ toggleColor?: string;
6
+ }
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 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
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
+ }