react-native-firework-sdk 1.1.1 → 1.2.0-beta.11

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 (147) hide show
  1. package/android/build.gradle +1 -1
  2. package/android/gradlew +0 -0
  3. package/android/src/main/AndroidManifest.xml +6 -1
  4. package/android/src/main/java/com/fireworksdk/bridge/FireworkSDKPackage.kt +3 -1
  5. package/android/src/main/java/com/fireworksdk/bridge/components/videofeed/FWVideoFeed.kt +19 -6
  6. package/android/src/main/java/com/fireworksdk/bridge/models/FWEventName.kt +1 -0
  7. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoFeedConfigModel.kt +2 -1
  8. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoFeedPropsModel.kt +1 -0
  9. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoFeedSource.kt +1 -0
  10. package/android/src/main/java/com/fireworksdk/bridge/reactnative/FWInitializationProvider.kt +99 -0
  11. package/android/src/main/java/com/fireworksdk/bridge/reactnative/manager/FWVideoFeedManager.kt +6 -0
  12. package/android/src/main/java/com/fireworksdk/bridge/reactnative/models/FWNavigatorInterface.kt +10 -0
  13. package/android/src/main/java/com/fireworksdk/bridge/reactnative/models/FWVideoShoppingInterface.kt +2 -2
  14. package/android/src/main/java/com/fireworksdk/bridge/reactnative/models/FireworkSDKInterface.kt +3 -1
  15. package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FWNavigatorModule.kt +59 -0
  16. package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FWVideoShoppingModule.kt +4 -15
  17. package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FireworkSDKModule.kt +41 -7
  18. package/android/src/main/java/com/fireworksdk/bridge/reactnative/pages/FWContainerActivity.kt +66 -0
  19. package/android/src/main/java/com/fireworksdk/bridge/reactnative/utils/FWDataUtils.kt +119 -0
  20. package/android/src/main/java/com/fireworksdk/bridge/reactnative/utils/FWEventUtils.kt +50 -3
  21. package/android/src/main/java/com/fireworksdk/bridge/utils/FWBundleUtils.kt +86 -0
  22. package/android/src/main/java/com/fireworksdk/bridge/utils/FWDateUtils.kt +15 -0
  23. package/android/src/main/java/com/fireworksdk/bridge/utils/FWVideoPlayerUtils.kt +12 -2
  24. package/android/src/main/res/layout/fw_bridge_fragment_container.xml +8 -0
  25. package/ios/Components/VideoFeed.swift +6 -25
  26. package/ios/Components/VideoFeedManager.m +1 -0
  27. package/ios/FireworkSdk.xcodeproj/project.pbxproj +202 -18
  28. package/ios/Models/NativeToRN/FireworkEventName.swift +1 -0
  29. package/ios/Models/RNToNative/RCTConvert+FireworkSDKModule.swift +0 -20
  30. package/ios/Models/RNToNative/RCTConvert+VideoFeed.swift +2 -1
  31. package/ios/Modules/FWNavigatorModule/FWNavigatorContainerViewController.swift +32 -0
  32. package/ios/Modules/FWNavigatorModule/FWNavigatorModule.m +17 -0
  33. package/ios/Modules/FWNavigatorModule/FWNavigatorModule.swift +89 -0
  34. package/ios/Modules/FWNavigatorModule/FWNavigatorProtocol.swift +13 -0
  35. package/ios/Modules/FireworkSDKModule/FireworkSDKModule+CTA.swift +24 -1
  36. package/ios/Modules/FireworkSDKModule/FireworkSDKModule.m +3 -1
  37. package/ios/Modules/FireworkSDKModule/FireworkSDKModule.swift +51 -31
  38. package/ios/Modules/Shopping/CartViewController.swift +6 -1
  39. package/ios/Modules/Shopping/ShoppingModule.m +1 -2
  40. package/ios/Modules/Shopping/ShoppingModule.swift +10 -12
  41. package/lib/commonjs/FWNavigator.js +66 -0
  42. package/lib/commonjs/FWNavigator.js.map +1 -0
  43. package/lib/commonjs/FireworkSDK.js +59 -5
  44. package/lib/commonjs/FireworkSDK.js.map +1 -1
  45. package/lib/commonjs/LiveStream.js +2 -2
  46. package/lib/commonjs/LiveStream.js.map +1 -1
  47. package/lib/commonjs/VideoShopping.js +4 -18
  48. package/lib/commonjs/VideoShopping.js.map +1 -1
  49. package/lib/commonjs/components/FWVideoFeed.js.map +1 -1
  50. package/lib/commonjs/components/VideoFeed.js +33 -1
  51. package/lib/commonjs/components/VideoFeed.js.map +1 -1
  52. package/lib/commonjs/constants/FWErrorMessage.js.map +1 -1
  53. package/lib/commonjs/index.js +10 -8
  54. package/lib/commonjs/index.js.map +1 -1
  55. package/lib/commonjs/models/FWEventName.js +3 -2
  56. package/lib/commonjs/models/FWEventName.js.map +1 -1
  57. package/lib/commonjs/models/NewNativeContainerProps.js +2 -0
  58. package/lib/commonjs/models/{AdConfig.js.map → NewNativeContainerProps.js.map} +0 -0
  59. package/lib/commonjs/models/VideoFeedSource.js +0 -4
  60. package/lib/commonjs/modules/FWNavigatorModule.js +22 -0
  61. package/lib/commonjs/modules/FWNavigatorModule.js.map +1 -0
  62. package/lib/commonjs/modules/FireworkSDKModule.js.map +1 -1
  63. package/lib/commonjs/modules/LiveStreamModule.js.map +1 -1
  64. package/lib/commonjs/modules/ShoppingModule.js.map +1 -1
  65. package/lib/commonjs/utils/FWLoggerUtil.js +45 -0
  66. package/lib/commonjs/utils/FWLoggerUtil.js.map +1 -0
  67. package/lib/module/FWNavigator.js +49 -0
  68. package/lib/module/FWNavigator.js.map +1 -0
  69. package/lib/module/FireworkSDK.js +54 -5
  70. package/lib/module/FireworkSDK.js.map +1 -1
  71. package/lib/module/LiveStream.js +4 -4
  72. package/lib/module/LiveStream.js.map +1 -1
  73. package/lib/module/VideoShopping.js +4 -18
  74. package/lib/module/VideoShopping.js.map +1 -1
  75. package/lib/module/components/FWVideoFeed.js +1 -1
  76. package/lib/module/components/FWVideoFeed.js.map +1 -1
  77. package/lib/module/components/VideoFeed.js +33 -1
  78. package/lib/module/components/VideoFeed.js.map +1 -1
  79. package/lib/module/constants/FWErrorMessage.js.map +1 -1
  80. package/lib/module/index.js +3 -5
  81. package/lib/module/index.js.map +1 -1
  82. package/lib/module/models/FWEventName.js +3 -2
  83. package/lib/module/models/FWEventName.js.map +1 -1
  84. package/lib/module/models/NewNativeContainerProps.js +2 -0
  85. package/lib/module/models/{AdConfig.js.map → NewNativeContainerProps.js.map} +0 -0
  86. package/lib/module/models/VideoFeedSource.js +1 -1
  87. package/lib/module/modules/FWNavigatorModule.js +13 -0
  88. package/lib/module/modules/FWNavigatorModule.js.map +1 -0
  89. package/lib/module/modules/FireworkSDKModule.js.map +1 -1
  90. package/lib/module/modules/LiveStreamModule.js.map +1 -1
  91. package/lib/module/modules/ShoppingModule.js.map +1 -1
  92. package/lib/module/utils/FWLoggerUtil.js +36 -0
  93. package/lib/module/utils/FWLoggerUtil.js.map +1 -0
  94. package/lib/typescript/FWNavigator.d.ts +24 -0
  95. package/lib/typescript/FireworkSDK.d.ts +21 -4
  96. package/lib/typescript/LiveStream.d.ts +1 -1
  97. package/lib/typescript/VideoShopping.d.ts +2 -9
  98. package/lib/typescript/components/VideoFeed.d.ts +8 -1
  99. package/lib/typescript/constants/FWErrorMessage.d.ts +1 -1
  100. package/lib/typescript/index.d.ts +6 -5
  101. package/lib/typescript/models/FWEventName.d.ts +4 -3
  102. package/lib/typescript/models/FeedItemDetails.d.ts +1 -1
  103. package/lib/typescript/models/NewNativeContainerProps.d.ts +6 -0
  104. package/lib/typescript/models/VideoFeedConfiguration.d.ts +4 -0
  105. package/lib/typescript/models/VideoFeedSource.d.ts +1 -2
  106. package/lib/typescript/modules/FWNavigatorModule.d.ts +11 -0
  107. package/lib/typescript/modules/FireworkSDKModule.d.ts +5 -4
  108. package/lib/typescript/modules/ShoppingModule.d.ts +2 -2
  109. package/lib/typescript/utils/FWLoggerUtil.d.ts +6 -0
  110. package/package.json +3 -1
  111. package/react-native-firework-sdk.podspec +1 -1
  112. package/src/FWNavigator.tsx +49 -0
  113. package/src/FireworkSDK.ts +57 -8
  114. package/src/LiveStream.ts +9 -7
  115. package/src/VideoShopping.ts +10 -21
  116. package/src/components/FWVideoFeed.tsx +5 -5
  117. package/src/components/VideoFeed.tsx +48 -14
  118. package/src/constants/FWErrorMessage.ts +1 -3
  119. package/src/index.tsx +9 -10
  120. package/src/models/AdBadgeConfiguration.ts +1 -1
  121. package/src/models/FWError.ts +1 -1
  122. package/src/models/FWEventName.ts +3 -2
  123. package/src/models/FWEvents.ts +1 -1
  124. package/src/models/FeedItemDetails.ts +2 -2
  125. package/src/models/LiveStreamEventDetails.ts +1 -1
  126. package/src/models/LiveStreamMessageDetails.ts +1 -1
  127. package/src/models/NewNativeContainerProps.ts +4 -0
  128. package/src/models/VideoFeedConfiguration.ts +6 -2
  129. package/src/models/VideoFeedSource.ts +6 -2
  130. package/src/models/VideoPlayerConfiguration.ts +2 -2
  131. package/src/modules/FWNavigatorModule.ts +22 -0
  132. package/src/modules/FireworkSDKModule.ts +5 -6
  133. package/src/modules/LiveStreamModule.ts +1 -5
  134. package/src/modules/ShoppingModule.ts +5 -2
  135. package/src/utils/FWLoggerUtil.ts +40 -0
  136. package/android/src/main/java/com/fireworksdk/bridge/reactnative/pages/FWVideoShoppingCartActivity.kt +0 -43
  137. package/ios/Modules/FireworkSDKModule/MobileADConfiguration.swift +0 -17
  138. package/lib/commonjs/components/CartContainer.js +0 -35
  139. package/lib/commonjs/components/CartContainer.js.map +0 -1
  140. package/lib/commonjs/models/AdConfig.js +0 -2
  141. package/lib/module/components/CartContainer.js +0 -18
  142. package/lib/module/components/CartContainer.js.map +0 -1
  143. package/lib/module/models/AdConfig.js +0 -2
  144. package/lib/typescript/components/CartContainer.d.ts +0 -3
  145. package/lib/typescript/models/AdConfig.d.ts +0 -10
  146. package/src/components/CartContainer.tsx +0 -20
  147. package/src/models/AdConfig.ts +0 -10
@@ -1,4 +1,4 @@
1
- import type VideoFeedSource from '../models/VideoFeedSource';
1
+ import type { VideoFeedSource } from '../models/VideoFeedSource';
2
2
  export default interface FeedItemDetails {
3
3
  /**
4
4
  * The index of the thumbnail tapped in the feed.
@@ -0,0 +1,6 @@
1
+ export declare type NewNativeContainerProps = {
2
+ initialRouteName?: string;
3
+ initialParams?: {
4
+ [key: string]: any;
5
+ };
6
+ };
@@ -33,4 +33,8 @@ export default interface VideoFeedConfiguration {
33
33
  * Indicates if the video feed shows ad badge.
34
34
  */
35
35
  showAdBadge?: boolean;
36
+ /**
37
+ * Custom layout name for video feed item. Only supported on Android.
38
+ */
39
+ customLayoutName?: string;
36
40
  }
@@ -1,2 +1 @@
1
- declare type VideoFeedSource = 'discover' | 'channel' | 'playlist' | 'playlistGroup';
2
- export default VideoFeedSource;
1
+ export declare type VideoFeedSource = 'discover' | 'channel' | 'playlist' | 'playlistGroup' | 'dynamicContent';
@@ -0,0 +1,11 @@
1
+ import { NativeEventEmitter, NativeModule } from 'react-native';
2
+ interface IFWNavigatorModule extends NativeModule {
3
+ pushNativeContainer(props: {
4
+ [key: string]: any;
5
+ }): Promise<boolean>;
6
+ popNativeContainer(): Promise<boolean>;
7
+ }
8
+ declare const FWNavigatorModuleEventEmitter: NativeEventEmitter;
9
+ export { FWNavigatorModuleEventEmitter };
10
+ declare const _default: IFWNavigatorModule;
11
+ export default _default;
@@ -1,16 +1,17 @@
1
1
  import { NativeEventEmitter, NativeModule } from 'react-native';
2
- import type AdBadgeConfiguration from 'src/models/AdBadgeConfiguration';
3
- import type AdConfig from '../models/AdConfig';
2
+ import type AdBadgeConfiguration from '../models/AdBadgeConfiguration';
4
3
  import type VideoPlayerConfiguration from '../models/VideoPlayerConfiguration';
5
4
  interface IFireworkSDKModule extends NativeModule {
6
- init(userId?: string, adConfig?: AdConfig): void;
5
+ init(userId?: string): void;
7
6
  openVideoPlayer(url: string, config?: VideoPlayerConfiguration): void;
8
7
  setCustomCTAClickEnabled(enabled: boolean): void;
8
+ setCustomCTALinkContentPageRouteName(name?: string): Promise<any>;
9
9
  setShareBaseURL(url?: string): Promise<any>;
10
10
  setVideoPlaybackEventEnabled(enabled: boolean): void;
11
11
  setAdBadgeConfiguration(config?: AdBadgeConfiguration): Promise<any>;
12
+ setAppComponentName(name?: string): Promise<any>;
12
13
  }
13
14
  declare const FireworkSDKModuleEventEmitter: NativeEventEmitter;
14
- export { FireworkSDKModuleEventEmitter, };
15
+ export { FireworkSDKModuleEventEmitter };
15
16
  declare const _default: IFireworkSDKModule;
16
17
  export default _default;
@@ -1,13 +1,13 @@
1
1
  import { NativeEventEmitter, NativeModule } from 'react-native';
2
2
  import type Product from '../models/Product';
3
3
  import type ProductInfoViewConfiguration from '../models/ProductInfoViewConfiguration';
4
+ import type { NewNativeContainerProps } from 'src/models/NewNativeContainerProps';
4
5
  interface IShoppingModule extends NativeModule {
5
6
  init(): void;
6
7
  updateVideoProducts(products: Product[], callbackId: number | string): void;
7
8
  updateProductViewConfig(config: ProductInfoViewConfiguration, callbackId: number | string): void;
8
9
  updateAddToCartStatus(res: string, tips: string, callbackId: number | string): void;
9
- jumpToCartPage(callbackId: number | string): void;
10
- exitCartPage(): void;
10
+ jumpToCartPage(callbackId: number | string, props: NewNativeContainerProps): void;
11
11
  setCartIconVisible(visible: boolean): void;
12
12
  setCartItemCount(count: number): void;
13
13
  }
@@ -0,0 +1,6 @@
1
+ export default class FWLoggerUtil {
2
+ static enabled: boolean;
3
+ static log(message: string): void;
4
+ static logNativeMessage(nativeMessage: string): void;
5
+ private static toISOString;
6
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-firework-sdk",
3
- "version": "1.1.1",
3
+ "version": "1.2.0-beta.11",
4
4
  "description": "Firework React Native SDK",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -86,6 +86,8 @@
86
86
  "prettier"
87
87
  ],
88
88
  "rules": {
89
+ "react-native/no-inline-styles": "off",
90
+ "radix": "off",
89
91
  "prettier/prettier": [
90
92
  "error",
91
93
  {
@@ -28,6 +28,6 @@ cp $module_header_path "${PODS_ROOT}/Headers/Public/react_native_firework_sdk/"'
28
28
 
29
29
  s.dependency "React-Core"
30
30
 
31
- s.dependency "FireworkVideo","0.15.0"
31
+ s.dependency "FireworkVideo","0.16.0"
32
32
 
33
33
  end
@@ -0,0 +1,49 @@
1
+ import { FWEventName } from './models/FWEventName';
2
+ import FWNavigatorModule, {
3
+ FWNavigatorModuleEventEmitter,
4
+ } from './modules/FWNavigatorModule';
5
+ import FWLoggerUtil from './utils/FWLoggerUtil';
6
+
7
+ type FWNativeContainerProps = {
8
+ [key: string]: any;
9
+ };
10
+
11
+ /**
12
+ * You can use this class for pushing RN page from the native page.
13
+ */
14
+ class FWNavigator {
15
+ private static _instance?: FWNavigator;
16
+
17
+ public static getInstance(): FWNavigator {
18
+ if (!FWNavigator._instance) {
19
+ FWNavigator._instance = new FWNavigator();
20
+ }
21
+ return FWNavigator._instance!;
22
+ }
23
+
24
+ private constructor() {
25
+ FWNavigatorModuleEventEmitter.addListener(FWEventName.LogMessage, () => {});
26
+ }
27
+
28
+ /**
29
+ * Push a new native container. We will render your app component in new native container.
30
+ * Please set your app component name through FireworkSDK.getInstance().appComponentName before calling this method
31
+ * @param {FWNativeContainerProps} props We will pass the props to your app component.
32
+ * @returns {Promise<boolean>} The result of pushing RN page from native page.
33
+ */
34
+ public pushNativeContainer(props: FWNativeContainerProps): Promise<boolean> {
35
+ FWLoggerUtil.log(`Enter pushNewNativeContainer`);
36
+
37
+ return FWNavigatorModule.pushNativeContainer(props);
38
+ }
39
+
40
+ /**
41
+ * Pop top-most native container. The native container embed the RN page.
42
+ * @returns {Promise<boolean>} The result of poping top-most native container.
43
+ */
44
+ public popNativeContainer(): Promise<boolean> {
45
+ return FWNavigatorModule.popNativeContainer();
46
+ }
47
+ }
48
+
49
+ export default FWNavigator;
@@ -2,7 +2,6 @@ import type { NativeEventEmitter } from 'react-native';
2
2
  import LiveStream from './LiveStream';
3
3
 
4
4
  import type AdBadgeConfiguration from './models/AdBadgeConfiguration';
5
- import type AdConfig from './models/AdConfig';
6
5
  import { FWEventName } from './models/FWEventName';
7
6
  import type {
8
7
  CustomCTAClickEvent,
@@ -11,13 +10,20 @@ import type {
11
10
  VideoPlaybackEvent,
12
11
  } from './models/FWEvents';
13
12
  import type VideoPlayerConfiguration from './models/VideoPlayerConfiguration';
14
- import FireworkSDKModule, { FireworkSDKModuleEventEmitter } from './modules/FireworkSDKModule';
13
+ import FireworkSDKModule, {
14
+ FireworkSDKModuleEventEmitter,
15
+ } from './modules/FireworkSDKModule';
15
16
  import LiveStreamModule from './modules/LiveStreamModule';
16
17
  import ShoppingModule from './modules/ShoppingModule';
17
18
  import VideoShopping from './VideoShopping';
19
+ import FWNavigator from './FWNavigator';
20
+ import FWLoggerUtil from './utils/FWLoggerUtil';
18
21
 
19
22
  export type SDKInitCallback = (event: SDKInitEvent) => void;
20
23
  export type CustomCTAClickCallback = (event: CustomCTAClickEvent) => void;
24
+ export type CustomCTALinkContentRender = (
25
+ event: CustomCTAClickEvent
26
+ ) => React.ReactNode | null;
21
27
  export type VideoPlaybackCallback = (event: VideoPlaybackEvent) => void;
22
28
  export type VideoFeedClickCallback = (event: VideoFeedClickEvent) => void;
23
29
 
@@ -44,11 +50,24 @@ class FireworkSDK {
44
50
  return this._onCustomCTAClick;
45
51
  }
46
52
  public set onCustomCTAClick(value: CustomCTAClickCallback | undefined) {
53
+ FWLoggerUtil.log(`Set onCustomCTAClick callback ${!!value}`);
47
54
  this._onCustomCTAClick = value;
48
55
  FireworkSDKModule.setCustomCTAClickEnabled(value ? true : false);
49
56
  }
50
57
  private _onCustomCTAClick: CustomCTAClickCallback | undefined;
51
58
 
59
+ /**
60
+ * The custom CTA link content page route name.
61
+ */
62
+ public get customCTALinkContentPageRouteName(): string | undefined {
63
+ return this._customCTALinkContentPageRouteName;
64
+ }
65
+ public set customCTALinkContentPageRouteName(value: string | undefined) {
66
+ this._customCTALinkContentPageRouteName = value;
67
+ FireworkSDKModule.setCustomCTALinkContentPageRouteName(value ?? '');
68
+ }
69
+ private _customCTALinkContentPageRouteName: string | undefined;
70
+
52
71
  /**
53
72
  * The callback of video playback.
54
73
  */
@@ -69,7 +88,7 @@ class FireworkSDK {
69
88
  }
70
89
  public set shareBaseURL(value: string | undefined) {
71
90
  this._shareBaseURL = value;
72
- FireworkSDKModule.setShareBaseURL(value).then(() => {
91
+ FireworkSDKModule.setShareBaseURL(value ?? '').then(() => {
73
92
  this.eventEmitter.emit(FWEventName.ShareBaseURLUpdated);
74
93
  });
75
94
  }
@@ -83,11 +102,23 @@ class FireworkSDK {
83
102
  }
84
103
  public set adBadgeConfiguration(value: AdBadgeConfiguration | undefined) {
85
104
  this._adBadgeConfiguration = value;
86
- FireworkSDKModule.setAdBadgeConfiguration(value).then(() => {
105
+ FireworkSDKModule.setAdBadgeConfiguration(value ?? {}).then(() => {
87
106
  this.eventEmitter.emit(FWEventName.AdBadgeConfigurationUpdated);
88
107
  });
89
108
  }
90
- private _adBadgeConfiguration?: AdBadgeConfiguration | undefined;
109
+ private _adBadgeConfiguration: AdBadgeConfiguration | undefined;
110
+
111
+ /**
112
+ * The app component name.
113
+ */
114
+ public get appComponentName(): string | undefined {
115
+ return this._appComponentName;
116
+ }
117
+ public set appComponentName(value: string | undefined) {
118
+ this._appComponentName = value;
119
+ FireworkSDKModule.setAppComponentName(value ?? '');
120
+ }
121
+ private _appComponentName: string | undefined;
91
122
 
92
123
  private get eventEmitter(): NativeEventEmitter {
93
124
  return FireworkSDKModuleEventEmitter;
@@ -107,6 +138,13 @@ class FireworkSDK {
107
138
  return LiveStream.getInstance();
108
139
  }
109
140
 
141
+ /**
142
+ * Get FWNavigator object.
143
+ */
144
+ public get navigator(): FWNavigator {
145
+ return FWNavigator.getInstance();
146
+ }
147
+
110
148
  /**
111
149
  * Get global single instance of FireworkSDK class.
112
150
  * @returns FireworkSDK
@@ -121,24 +159,36 @@ class FireworkSDK {
121
159
 
122
160
  private constructor() {
123
161
  this.eventEmitter.addListener(FWEventName.SDKInit, (event) => {
162
+ FWLoggerUtil.log(`Receive SDKInit event ${event?.error}`);
163
+
124
164
  if (this.onSDKInit) {
125
165
  this.onSDKInit(event ?? {});
126
166
  }
127
167
  });
128
168
 
169
+ this.eventEmitter.addListener(FWEventName.LogMessage, (event) => {
170
+ FWLoggerUtil.logNativeMessage(event.message);
171
+ });
172
+
129
173
  this.eventEmitter.addListener(FWEventName.CustomCTAClick, (event) => {
174
+ FWLoggerUtil.log(`Receive CustomCTAClick url ${event?.url}`);
175
+
130
176
  if (this.onCustomCTAClick) {
131
177
  this.onCustomCTAClick(event ?? {});
132
178
  }
133
179
  });
134
180
 
135
181
  this.eventEmitter.addListener(FWEventName.VideoPlayback, (event) => {
182
+ FWLoggerUtil.log(`Receive VideoPlayback event ${event?.eventName}`);
183
+
136
184
  if (this.onVideoPlayback) {
137
185
  this.onVideoPlayback(event ?? {});
138
186
  }
139
187
  });
140
188
 
141
189
  this.eventEmitter.addListener(FWEventName.VideoFeedClick, (event) => {
190
+ FWLoggerUtil.log(`Receive VideoFeedClick event ${event?.info.id}`);
191
+
142
192
  if (this.onVideoFeedClick) {
143
193
  this.onVideoFeedClick(event ?? {});
144
194
  }
@@ -148,10 +198,9 @@ class FireworkSDK {
148
198
  /**
149
199
  * Initializes Firework SDK.
150
200
  * @param {string?} userId An id to uniquely identify device or user.
151
- * @param {AdConfig?} adConfig Configuration of Ad.
152
201
  */
153
- public init(userId?: string, adConfig?: AdConfig) {
154
- FireworkSDKModule.init(userId, adConfig);
202
+ public init(userId?: string) {
203
+ FireworkSDKModule.init(userId);
155
204
  ShoppingModule.init();
156
205
  LiveStreamModule.init();
157
206
  }
package/src/LiveStream.ts CHANGED
@@ -1,10 +1,12 @@
1
- import type { NativeEventEmitter } from "react-native";
2
- import { FWEventName } from "./models/FWEventName";
3
- import type { LiveStreamChatEvent, LiveStreamEvent } from "./models/FWEvents";
4
- import { LiveStreamModuleEventEmitter } from "./modules/LiveStreamModule";
1
+ import type { NativeEventEmitter } from 'react-native';
2
+ import { FWEventName } from './models/FWEventName';
3
+ import type { LiveStreamChatEvent, LiveStreamEvent } from './models/FWEvents';
4
+ import { LiveStreamModuleEventEmitter } from './modules/LiveStreamModule';
5
5
 
6
6
  export type onLiveStreamEventCallback = (event: LiveStreamEvent) => void;
7
- export type onLiveStreamChatEventCallback = (event: LiveStreamChatEvent) => void;
7
+ export type onLiveStreamChatEventCallback = (
8
+ event: LiveStreamChatEvent
9
+ ) => void;
8
10
 
9
11
  /**
10
12
  * The entry class of live stream.
@@ -34,13 +36,13 @@ class LiveStream {
34
36
  }
35
37
 
36
38
  private constructor() {
37
- this.eventEmitter.addListener(FWEventName.onLiveStreamEvent, (event) => {
39
+ this.eventEmitter.addListener(FWEventName.LiveStream, (event) => {
38
40
  if (this.onLiveStreamEvent) {
39
41
  this.onLiveStreamEvent(event ?? {});
40
42
  }
41
43
  });
42
44
 
43
- this.eventEmitter.addListener(FWEventName.onLiveStreamChatEvent, (event) => {
45
+ this.eventEmitter.addListener(FWEventName.LiveStreamChat, (event) => {
44
46
  if (this.onLiveStreamChatEvent) {
45
47
  this.onLiveStreamChatEvent(event ?? {});
46
48
  }
@@ -9,14 +9,17 @@ import type {
9
9
  import { FWEventName } from './models/FWEventName';
10
10
  import type Product from './models/Product';
11
11
  import type ProductInfoViewConfiguration from './models/ProductInfoViewConfiguration';
12
- import ShoppingModule, { ShoppingModuleEventEmitter } from './modules/ShoppingModule';
12
+ import ShoppingModule, {
13
+ ShoppingModuleEventEmitter,
14
+ } from './modules/ShoppingModule';
15
+ import type { NewNativeContainerProps } from './models/NewNativeContainerProps';
13
16
 
14
17
  export type AddToCartCallback = (
15
18
  event: AddToCartEvent
16
19
  ) => Promise<AddToCartResult | undefined | null>;
17
20
 
18
21
  export type ClickCartIconCallback = () => Promise<
19
- React.ReactNode | undefined | null
22
+ NewNativeContainerProps | undefined | null
20
23
  >;
21
24
 
22
25
  export type UpdateProductDetailsCallback = (
@@ -64,7 +67,7 @@ class VideoShopping {
64
67
  public onWillDisplayProduct?: WillDisplayProductCallback;
65
68
 
66
69
  /**
67
- * Defaults to true. You can hide the cart icon by setting this property to false.
70
+ * Defaults to true. You can hide the cart icon by setting this property to false.
68
71
  */
69
72
  public get cartIconVisible(): boolean {
70
73
  return this._cartIconVisible;
@@ -75,8 +78,6 @@ class VideoShopping {
75
78
  }
76
79
  private _cartIconVisible: boolean = true;
77
80
 
78
- public currentCartPage?: React.ReactNode;
79
-
80
81
  private get eventEmitter(): NativeEventEmitter {
81
82
  return ShoppingModuleEventEmitter;
82
83
  }
@@ -108,16 +109,7 @@ class VideoShopping {
108
109
  }
109
110
 
110
111
  /**
111
- * Exit Cart Page.
112
112
  *
113
- * The host app can call this method to exit their cart page.
114
- */
115
- public exitCartPage() {
116
- ShoppingModule.exitCartPage();
117
- }
118
-
119
- /**
120
- *
121
113
  * @param {number} count The number of items in the host app cart
122
114
  */
123
115
  public setCartItemCount(count: number) {
@@ -133,7 +125,7 @@ class VideoShopping {
133
125
  ShoppingModule.updateAddToCartStatus(
134
126
  result.res,
135
127
  result.tips,
136
- callbackId!,
128
+ callbackId!
137
129
  );
138
130
  }
139
131
  }
@@ -143,11 +135,9 @@ class VideoShopping {
143
135
  if (this.onClickCartIcon) {
144
136
  const callbackId = event.callbackId;
145
137
  delete event.callbackId;
146
- const cartPage = await this.onClickCartIcon();
147
- this.currentCartPage = cartPage;
148
-
149
- if (cartPage) {
150
- ShoppingModule.jumpToCartPage(callbackId!);
138
+ const props = await this.onClickCartIcon();
139
+ if (callbackId) {
140
+ ShoppingModule.jumpToCartPage(callbackId, props ?? {});
151
141
  }
152
142
  }
153
143
  }
@@ -161,7 +151,6 @@ class VideoShopping {
161
151
  const productList = await this.onUpdateProductDetails(
162
152
  event as UpdateProductDetailsEvent
163
153
  );
164
- console.log('handleUpdateProductDetailsEvent productList', JSON.stringify(productList));
165
154
  if (productList) {
166
155
  ShoppingModule.updateVideoProducts(productList, callbackId!);
167
156
  }
@@ -1,10 +1,10 @@
1
- import { requireNativeComponent, UIManager } from 'react-native'
2
- import { LINKING_ERROR } from "../constants/FWErrorMessage";
1
+ import { requireNativeComponent, UIManager } from 'react-native';
2
+ import { LINKING_ERROR } from '../constants/FWErrorMessage';
3
3
  const NativeComponentName = 'FWVideoFeed';
4
4
  const FWVideoFeed =
5
5
  UIManager.getViewManagerConfig(NativeComponentName) != null
6
6
  ? requireNativeComponent<any>(NativeComponentName)
7
7
  : () => {
8
- throw new Error(LINKING_ERROR);
9
- };
10
- export default FWVideoFeed
8
+ throw new Error(LINKING_ERROR);
9
+ };
10
+ export default FWVideoFeed;
@@ -13,7 +13,7 @@ import FireworkSDK from '../FireworkSDK';
13
13
  import type FWError from '../models/FWError';
14
14
  import { FWEventName } from '../models/FWEventName';
15
15
  import type VideoFeedConfiguration from '../models/VideoFeedConfiguration';
16
- import type VideoFeedSource from '../models/VideoFeedSource';
16
+ import type { VideoFeedSource } from '../models/VideoFeedSource';
17
17
  import type VideoPlayerConfiguration from '../models/VideoPlayerConfiguration';
18
18
  import { FireworkSDKModuleEventEmitter } from '../modules/FireworkSDKModule';
19
19
  import FWVideoFeed from './FWVideoFeed';
@@ -42,6 +42,12 @@ export interface IVideoFeedProps {
42
42
  * PlaylistGroup Id for selected content. Required when the source is set as playlistGroup.
43
43
  */
44
44
  playlistGroup?: string;
45
+
46
+ /**
47
+ * The parameters to be passed to a dynamic content feed. Required when the source is set as dynamicContent.
48
+ */
49
+ dynamicContentParameters?: { [key: string]: string[] };
50
+
45
51
  /**
46
52
  * One of three available display modes. Defaults to row.
47
53
  */
@@ -100,23 +106,25 @@ export default class VideoFeed extends React.Component<IVideoFeedProps> {
100
106
  this.props.onVideoFeedLoadFinished();
101
107
  }
102
108
  }
103
- };
109
+ };
104
110
 
105
111
  componentDidMount() {
106
- const subscriptionOfShareBaseURLUpdated = FireworkSDKModuleEventEmitter.addListener(
107
- FWEventName.ShareBaseURLUpdated,
108
- () => {
109
- this.setState({});
110
- }
111
- );
112
+ const subscriptionOfShareBaseURLUpdated =
113
+ FireworkSDKModuleEventEmitter.addListener(
114
+ FWEventName.ShareBaseURLUpdated,
115
+ () => {
116
+ this.setState({});
117
+ }
118
+ );
112
119
  this.subscriptions.push(subscriptionOfShareBaseURLUpdated);
113
120
 
114
- const subscriptionOfAdBadgeConfigurationUpdated = FireworkSDKModuleEventEmitter.addListener(
115
- FWEventName.AdBadgeConfigurationUpdated,
116
- () => {
117
- this.setState({});
118
- }
119
- );
121
+ const subscriptionOfAdBadgeConfigurationUpdated =
122
+ FireworkSDKModuleEventEmitter.addListener(
123
+ FWEventName.AdBadgeConfigurationUpdated,
124
+ () => {
125
+ this.setState({});
126
+ }
127
+ );
120
128
  this.subscriptions.push(subscriptionOfAdBadgeConfigurationUpdated);
121
129
  }
122
130
 
@@ -139,12 +147,15 @@ export default class VideoFeed extends React.Component<IVideoFeedProps> {
139
147
  } = this.props;
140
148
  const titleHidden = videoFeedConfiguration?.title?.hidden ?? false;
141
149
  const titlePosition = videoFeedConfiguration?.titlePosition ?? 'nested';
150
+ const customLayoutName = videoFeedConfiguration?.customLayoutName ?? '';
142
151
  const shareBaseURL = FireworkSDK.getInstance().shareBaseURL ?? '';
143
152
  const adBadgeConfiguration =
144
153
  FireworkSDK.getInstance().adBadgeConfiguration ?? {};
145
154
  const adBadgeTextType = adBadgeConfiguration.badgeTextType ?? '';
146
155
  const backgroundColorOfAdBadge = adBadgeConfiguration.backgroundColor ?? '';
147
156
  const textColorOfAdBadge = adBadgeConfiguration.textColor ?? '';
157
+ const dynamicContentParametersString =
158
+ this._generateDynamicContentParametersString();
148
159
 
149
160
  let key = `source:${source}`;
150
161
  key += `_channel:${channel}`;
@@ -153,10 +164,12 @@ export default class VideoFeed extends React.Component<IVideoFeedProps> {
153
164
  key += `_mode:${mode}`;
154
165
  key += `_titleHidden:${titleHidden}`;
155
166
  key += `_titlePosition:${titlePosition}`;
167
+ key += `_customLayoutName:${customLayoutName}`;
156
168
  key += `_shareBaseURL:${shareBaseURL}`;
157
169
  key += `_adBadgeTextType:${adBadgeTextType}`;
158
170
  key += `_backgroundColorOfAdBadge:${backgroundColorOfAdBadge}`;
159
171
  key += `_textColorOfAdBadge:${textColorOfAdBadge}`;
172
+ key += `_dynamicContentParameters:${dynamicContentParametersString}`;
160
173
 
161
174
  return (
162
175
  <FWVideoFeed
@@ -169,4 +182,25 @@ export default class VideoFeed extends React.Component<IVideoFeedProps> {
169
182
  />
170
183
  );
171
184
  }
185
+
186
+ private _generateDynamicContentParametersString(): string {
187
+ const { dynamicContentParameters } = this.props;
188
+ if (!dynamicContentParameters) {
189
+ return '';
190
+ }
191
+
192
+ let resultString = '';
193
+ const sortedKeyList = Object.keys(dynamicContentParameters).sort();
194
+ for (const key of sortedKeyList) {
195
+ const value = dynamicContentParameters[key];
196
+ const valueString = value.join(',');
197
+ if (resultString.length > 0) {
198
+ resultString += '_';
199
+ }
200
+
201
+ resultString += `${key}:${valueString}`;
202
+ }
203
+
204
+ return resultString;
205
+ }
172
206
  }
@@ -6,6 +6,4 @@ const LINKING_ERROR =
6
6
  '- You rebuilt the app after installing the package\n' +
7
7
  '- You are not using Expo managed workflow\n';
8
8
 
9
- export {
10
- LINKING_ERROR,
11
- };
9
+ export { LINKING_ERROR };
package/src/index.tsx CHANGED
@@ -1,15 +1,14 @@
1
- import { AppRegistry } from 'react-native';
2
-
3
- import CartContainer from './components/CartContainer';
4
1
  import type { IVideoFeedProps, VideoFeedMode } from './components/VideoFeed';
5
2
  import VideoFeed from './components/VideoFeed';
6
3
  import type {
7
4
  CustomCTAClickCallback,
5
+ CustomCTALinkContentRender,
8
6
  SDKInitCallback,
9
7
  VideoFeedClickCallback,
10
8
  VideoPlaybackCallback,
11
9
  } from './FireworkSDK';
12
10
  import FireworkSDK from './FireworkSDK';
11
+ import FWNavigator from './FWNavigator';
13
12
  import type {
14
13
  onLiveStreamChatEventCallback,
15
14
  onLiveStreamEventCallback,
@@ -17,7 +16,6 @@ import type {
17
16
  import LiveStream from './LiveStream';
18
17
  import type AdBadgeConfiguration from './models/AdBadgeConfiguration';
19
18
  import type { AdBadgeTextType } from './models/AdBadgeConfiguration';
20
- import type AdConfig from './models/AdConfig';
21
19
  import type AddToCartResult from './models/AddToCartResult';
22
20
  import type FeedItemDetails from './models/FeedItemDetails';
23
21
  import type FWError from './models/FWError';
@@ -31,10 +29,11 @@ import type {
31
29
  VideoPlaybackEvent,
32
30
  WillDisplayProductEvent,
33
31
  } from './models/FWEvents';
32
+ import LiveStreamChatEventName from './models/LiveStreamChatEventName';
34
33
  import type LiveStreamEventDetails from './models/LiveStreamEventDetails';
35
34
  import LiveStreamEventName from './models/LiveStreamEventName';
36
35
  import type LiveStreamMessageDetails from './models/LiveStreamMessageDetails';
37
- import LiveStreamChatEventName from './models/LiveStreamChatEventName';
36
+ import type { NewNativeContainerProps } from './models/NewNativeContainerProps';
38
37
  import type Product from './models/Product';
39
38
  import type ProductInfoViewConfiguration from './models/ProductInfoViewConfiguration';
40
39
  import type { AddToCartButtonConfiguration } from './models/ProductInfoViewConfiguration';
@@ -46,7 +45,7 @@ import type {
46
45
  VideoFeedTitleConfiguration,
47
46
  VideoFeedTitlePosition,
48
47
  } from './models/VideoFeedConfiguration';
49
- import type VideoFeedSource from './models/VideoFeedSource';
48
+ import type { VideoFeedSource } from './models/VideoFeedSource';
50
49
  import type VideoPlaybackDetails from './models/VideoPlaybackDetails';
51
50
  import type { VideoPlayerSize } from './models/VideoPlaybackDetails';
52
51
  import VideoPlaybackEventName from './models/VideoPlaybackEventName';
@@ -65,14 +64,11 @@ import type {
65
64
  } from './VideoShopping';
66
65
  import VideoShopping from './VideoShopping';
67
66
 
68
- AppRegistry.registerComponent('FWShoppingCartPage', () => CartContainer);
69
-
70
67
  export default FireworkSDK;
71
68
 
72
69
  export {
73
70
  AdBadgeConfiguration,
74
71
  AdBadgeTextType,
75
- AdConfig,
76
72
  AddToCartButtonConfiguration,
77
73
  AddToCartCallback,
78
74
  AddToCartEvent,
@@ -80,16 +76,19 @@ export {
80
76
  ClickCartIconCallback,
81
77
  CustomCTAClickCallback,
82
78
  CustomCTAClickEvent,
79
+ CustomCTALinkContentRender,
83
80
  FeedItemDetails,
84
81
  FWError,
82
+ FWNavigator,
85
83
  IVideoFeedProps,
86
84
  LiveStream,
87
85
  LiveStreamChatEvent,
86
+ LiveStreamChatEventName,
88
87
  LiveStreamEvent,
89
88
  LiveStreamEventDetails,
90
89
  LiveStreamEventName,
91
90
  LiveStreamMessageDetails,
92
- LiveStreamChatEventName,
91
+ NewNativeContainerProps,
93
92
  onLiveStreamChatEventCallback,
94
93
  onLiveStreamEventCallback,
95
94
  Product,
@@ -13,4 +13,4 @@ export default interface AdBadgeConfiguration {
13
13
  * The color of the ad badge text. Only supported on iOS.
14
14
  */
15
15
  textColor?: string;
16
- }
16
+ }