react-native-firework-sdk 2.10.1 → 2.11.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 (158) hide show
  1. package/android/gradle.properties +1 -1
  2. package/android/src/main/java/com/fireworksdk/bridge/components/storyblock/StoryBlockFragment.kt +18 -1
  3. package/android/src/main/java/com/fireworksdk/bridge/components/videofeed/FWVideoFeed.kt +4 -0
  4. package/android/src/main/java/com/fireworksdk/bridge/models/FWSDKInitOptionsModel.kt +0 -1
  5. package/android/src/main/java/com/fireworksdk/bridge/models/FWSDKInitOptionsModelDeserializer.kt +0 -3
  6. package/android/src/main/java/com/fireworksdk/bridge/models/FWSDKInitOptionsModelSerializer.kt +0 -2
  7. package/android/src/main/java/com/fireworksdk/bridge/models/FWSdkInitResultModel.kt +6 -0
  8. package/android/src/main/java/com/fireworksdk/bridge/models/FWTrackPurchaseModel.kt +9 -0
  9. package/android/src/main/java/com/fireworksdk/bridge/models/FWTrackPurchaseModelDeserializer.kt +45 -0
  10. package/android/src/main/java/com/fireworksdk/bridge/models/FWTrackPurchaseModelSerializer.kt +34 -0
  11. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoFeedItemDetailsModel.kt +1 -0
  12. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoPlaybackDetails.kt +1 -0
  13. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoPlayerConfigModel.kt +2 -1
  14. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoPlayerConfigModelDeserializer.kt +4 -1
  15. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoPlayerConfigModelSerializer.kt +2 -0
  16. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoPlayerLogoConfigurationModel.kt +8 -0
  17. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoPlayerLogoConfigurationModelDeserializer.kt +23 -0
  18. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoPlayerLogoConfigurationModelSerializer.kt +18 -0
  19. package/android/src/main/java/com/fireworksdk/bridge/models/enums/FWEventName.kt +2 -0
  20. package/android/src/main/java/com/fireworksdk/bridge/models/enums/FWVideoPlayerLogoOption.kt +19 -0
  21. package/android/src/main/java/com/fireworksdk/bridge/reactnative/FWReactNativeSDK.kt +103 -0
  22. package/android/src/main/java/com/fireworksdk/bridge/reactnative/manager/FWStoryBlockManager.kt +12 -0
  23. package/android/src/main/java/com/fireworksdk/bridge/reactnative/manager/FWVideoFeedManager.kt +8 -0
  24. package/android/src/main/java/com/fireworksdk/bridge/reactnative/models/FireworkSDKInterface.kt +2 -0
  25. package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FWVideoShoppingModule.kt +22 -9
  26. package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FireworkSDKModule.kt +74 -122
  27. package/android/src/main/java/com/fireworksdk/bridge/reactnative/utils/FWEventUtils.kt +34 -9
  28. package/android/src/main/java/com/fireworksdk/bridge/utils/FWConfigUtil.kt +13 -0
  29. package/android/src/main/java/com/fireworksdk/bridge/utils/FWFragmentUtil.kt +3 -3
  30. package/android/src/main/java/com/fireworksdk/bridge/utils/FWGlobalDataUtil.kt +5 -2
  31. package/android/src/main/java/com/fireworksdk/bridge/utils/FWModelUtils.kt +64 -0
  32. package/ios/Components/ReplayBadgeConfiguration.swift +12 -0
  33. package/ios/Components/StoryBlock.swift +31 -0
  34. package/ios/Components/StoryBlockConfiguration.swift +1 -0
  35. package/ios/Components/StoryBlockManager.m +24 -0
  36. package/ios/Components/StoryBlockManager.swift +6 -3
  37. package/ios/Components/VideoFeed.swift +18 -3
  38. package/ios/Components/VideoFeedConfiguration.swift +1 -0
  39. package/ios/Components/VideoFeedManager.m +4 -1
  40. package/ios/Components/VideoFeedManager.swift +6 -3
  41. package/ios/Components/VideoPlayerConfiguration.swift +1 -0
  42. package/ios/FWReactNativeSDK.swift +14 -0
  43. package/ios/FireworkSdk.xcodeproj/project.pbxproj +4 -0
  44. package/ios/Modules/FireworkSDKModule/FireworkSDKModule+CTA.swift +17 -15
  45. package/ios/Modules/FireworkSDKModule/FireworkSDKModule+EventTracking.swift +1 -11
  46. package/ios/Modules/FireworkSDKModule/FireworkSDKModule.m +1 -0
  47. package/ios/Modules/FireworkSDKModule/FireworkSDKModule.swift +80 -81
  48. package/ios/Modules/FireworkSDKModule/SDKInitOptions.swift +9 -5
  49. package/ios/Modules/Shopping/ShoppingModule.swift +10 -74
  50. package/lib/commonjs/FireworkSDK.js +30 -25
  51. package/lib/commonjs/FireworkSDK.js.map +1 -1
  52. package/lib/commonjs/VideoShopping.js +6 -12
  53. package/lib/commonjs/VideoShopping.js.map +1 -1
  54. package/lib/commonjs/components/StoryBlock.js +54 -3
  55. package/lib/commonjs/components/StoryBlock.js.map +1 -1
  56. package/lib/commonjs/components/VideoFeed.js +46 -4
  57. package/lib/commonjs/components/VideoFeed.js.map +1 -1
  58. package/lib/commonjs/index.js.map +1 -1
  59. package/lib/commonjs/models/FWNativeErrorAction.js +14 -0
  60. package/lib/commonjs/models/FWNativeErrorAction.js.map +1 -0
  61. package/lib/commonjs/models/ReplayBadgeConfiguration.js +2 -0
  62. package/lib/commonjs/models/ReplayBadgeConfiguration.js.map +1 -0
  63. package/lib/commonjs/modules/FireworkSDKModule.js.map +1 -1
  64. package/lib/module/FireworkSDK.js +29 -25
  65. package/lib/module/FireworkSDK.js.map +1 -1
  66. package/lib/module/VideoShopping.js +6 -12
  67. package/lib/module/VideoShopping.js.map +1 -1
  68. package/lib/module/components/StoryBlock.js +53 -3
  69. package/lib/module/components/StoryBlock.js.map +1 -1
  70. package/lib/module/components/VideoFeed.js +42 -4
  71. package/lib/module/components/VideoFeed.js.map +1 -1
  72. package/lib/module/index.js.map +1 -1
  73. package/lib/module/models/FWNativeErrorAction.js +7 -0
  74. package/lib/module/models/FWNativeErrorAction.js.map +1 -0
  75. package/lib/module/models/ReplayBadgeConfiguration.js +2 -0
  76. package/lib/module/models/ReplayBadgeConfiguration.js.map +1 -0
  77. package/lib/module/modules/FireworkSDKModule.js.map +1 -1
  78. package/lib/typescript/VideoShopping.d.ts +2 -2
  79. package/lib/typescript/components/StoryBlock.d.ts +18 -1
  80. package/lib/typescript/components/VideoFeed.d.ts +7 -1
  81. package/lib/typescript/index.d.ts +2 -2
  82. package/lib/typescript/models/FWEvents.d.ts +26 -3
  83. package/lib/typescript/models/FWNativeErrorAction.d.ts +4 -0
  84. package/lib/typescript/models/FeedItemDetails.d.ts +6 -1
  85. package/lib/typescript/models/ReplayBadgeConfiguration.d.ts +7 -0
  86. package/lib/typescript/models/StoryBlockConfiguration.d.ts +6 -1
  87. package/lib/typescript/models/VideoFeedConfiguration.d.ts +6 -0
  88. package/lib/typescript/models/VideoPlayerConfiguration.d.ts +6 -1
  89. package/lib/typescript/modules/FireworkSDKModule.d.ts +1 -0
  90. package/package.json +1 -5
  91. package/react-native-firework-sdk.podspec +3 -5
  92. package/src/FireworkSDK.ts +27 -24
  93. package/src/VideoShopping.ts +9 -11
  94. package/src/components/StoryBlock.tsx +69 -7
  95. package/src/components/VideoFeed.tsx +57 -12
  96. package/src/index.ts +2 -0
  97. package/src/models/FWEvents.ts +28 -3
  98. package/src/models/FWNativeErrorAction.ts +4 -0
  99. package/src/models/FeedItemDetails.ts +7 -1
  100. package/src/models/ReplayBadgeConfiguration.ts +7 -0
  101. package/src/models/StoryBlockConfiguration.ts +6 -1
  102. package/src/models/VideoFeedConfiguration.ts +6 -0
  103. package/src/models/VideoPlayerConfiguration.ts +6 -1
  104. package/src/modules/FireworkSDKModule.ts +1 -0
  105. package/FireworkVideoUI.xcframework/Info.plist +0 -40
  106. package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/FireworkVideoUI +0 -0
  107. package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Headers/FireworkVideoUI-Swift.h +0 -280
  108. package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Headers/FireworkVideoUI.h +0 -18
  109. package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Info.plist +0 -0
  110. package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios.abi.json +0 -1313
  111. package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios.private.swiftinterface +0 -42
  112. package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
  113. package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios.swiftinterface +0 -42
  114. package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Modules/module.modulemap +0 -11
  115. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/FireworkVideoUI +0 -0
  116. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Headers/FireworkVideoUI-Swift.h +0 -556
  117. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Headers/FireworkVideoUI.h +0 -18
  118. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Info.plist +0 -0
  119. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios-simulator.abi.json +0 -1313
  120. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +0 -42
  121. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
  122. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios-simulator.swiftinterface +0 -42
  123. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/x86_64-apple-ios-simulator.abi.json +0 -1313
  124. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +0 -42
  125. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
  126. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +0 -42
  127. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/module.modulemap +0 -11
  128. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/_CodeSignature/CodeResources +0 -245
  129. package/ios/FireworkVideoUI/FireworkVideoUI/FireworkVideoUI.docc/FireworkVideoUI.md +0 -13
  130. package/ios/FireworkVideoUI/FireworkVideoUI/FireworkVideoUI.h +0 -18
  131. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/AppLanguageManager.swift +0 -154
  132. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/Foundation/Bundle+AppLanguage.swift +0 -73
  133. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/Foundation/NumberFormatter+AppLanguage.swift +0 -25
  134. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/Foundation/URLSession+AppLanguage.swift +0 -52
  135. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/UIKit/UIImageView+AppLanguage.swift +0 -60
  136. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/UIKit/UILabel+AppLanguage.swift +0 -98
  137. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/UIKit/UITextField+AppLanguage.swift +0 -97
  138. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/UIKit/UITextView+AppLanguage.swift +0 -97
  139. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/UIKit/UIView+AppLanguage.swift +0 -71
  140. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/UIKit/UIViewController+AppLanguage.swift +0 -48
  141. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/UIKit/UIWindow+AppLanguage.swift +0 -26
  142. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/LanguageUtil.swift +0 -43
  143. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/LayoutFlip/Extensions/Foundation/NSObject+LayoutFlip.swift +0 -42
  144. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/LayoutFlip/Extensions/UIKit/CALayer+LayoutFlip.swift +0 -149
  145. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/LayoutFlip/Extensions/UIKit/UILabel+LayoutFlip.swift +0 -35
  146. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/LayoutFlip/Extensions/UIKit/UIView+LayoutFlip.swift +0 -202
  147. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/LayoutFlip/LayoutFlipManager.swift +0 -59
  148. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/Utils/Extensions/Foundation/DispatchQueue+Once.swift +0 -32
  149. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/Utils/Extensions/Foundation/String+Base64.swift +0 -18
  150. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/Utils/Extensions/UIKit/UIView+UIHierarchy.swift +0 -46
  151. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/Utils/Swizzle.swift +0 -37
  152. package/ios/FireworkVideoUI/FireworkVideoUI.xcodeproj/project.pbxproj +0 -766
  153. package/ios/FireworkVideoUI/FireworkVideoUI.xcworkspace/contents.xcworkspacedata +0 -10
  154. package/ios/FireworkVideoUI/FireworkVideoUI.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
  155. package/ios/FireworkVideoUI/FireworkVideoUITests/FireworkVideoUITests.swift +0 -37
  156. package/ios/FireworkVideoUI/Podfile +0 -15
  157. package/ios/FireworkVideoUI/Podfile.lock +0 -16
  158. package/ios/scripts/react_native_firework_sdk_pods.rb +0 -27
@@ -190,8 +190,8 @@ class FireworkSDK {
190
190
  this.eventEmitter.addListener(FWEventName.SDKInit, (event) => {
191
191
  FWLoggerUtil.log(`Receive SDKInit event ${event?.error}`);
192
192
 
193
- if (this.onSDKInit) {
194
- this.onSDKInit(event ?? {});
193
+ if (this.onSDKInit && event) {
194
+ this.onSDKInit(event);
195
195
  }
196
196
  });
197
197
 
@@ -205,21 +205,18 @@ class FireworkSDK {
205
205
  `Receive CustomCTAClick callbackId: ${event?.callbackId}`
206
206
  );
207
207
 
208
- if (this.onCustomCTAClick) {
209
- if (event) {
210
- if (event.callbackId) {
211
- const callbackId = event.callbackId;
212
- delete event.callbackId;
213
- if (Platform.OS === 'ios') {
214
- event.playerHandler = {
215
- pause: () => FireworkSDKModule.pausePlayer(callbackId),
216
- resume: () => FireworkSDKModule.resumePlayer(callbackId),
217
- };
218
- }
208
+ if (this.onCustomCTAClick && event) {
209
+ if (event.callbackId) {
210
+ const callbackId = event.callbackId;
211
+ delete event.callbackId;
212
+ if (Platform.OS === 'ios') {
213
+ event.playerHandler = {
214
+ pause: () => FireworkSDKModule.pausePlayer(callbackId),
215
+ resume: () => FireworkSDKModule.resumePlayer(callbackId),
216
+ };
219
217
  }
220
218
  }
221
-
222
- this.onCustomCTAClick(event ?? {});
219
+ this.onCustomCTAClick(event);
223
220
  }
224
221
  });
225
222
 
@@ -228,16 +225,16 @@ class FireworkSDK {
228
225
  `Receive VideoPlayback event eventName: ${event?.eventName}`
229
226
  );
230
227
 
231
- if (this.onVideoPlayback) {
232
- this.onVideoPlayback(event ?? {});
228
+ if (this.onVideoPlayback && event) {
229
+ this.onVideoPlayback(event);
233
230
  }
234
231
  });
235
232
 
236
233
  this.eventEmitter.addListener(FWEventName.VideoFeedClick, (event) => {
237
234
  FWLoggerUtil.log(`Receive VideoFeedClick event id: ${event?.info.id}`);
238
235
 
239
- if (this.onVideoFeedClick) {
240
- this.onVideoFeedClick(event ?? {});
236
+ if (this.onVideoFeedClick && event) {
237
+ this.onVideoFeedClick(event);
241
238
  }
242
239
  });
243
240
 
@@ -278,6 +275,14 @@ class FireworkSDK {
278
275
  * You only need to call this method when you call init method in native side instead of JS side.
279
276
  */
280
277
  public async markInitCalled(): Promise<void> {
278
+ FWLoggerUtil.log('Call FireworkSDK markInitCalled method');
279
+
280
+ const hasCalledSDKInitFromNative = await FireworkSDKModule.markInitCalled();
281
+ if (hasCalledSDKInitFromNative) {
282
+ await ShoppingModule.init();
283
+ await LiveStreamModule.init();
284
+ }
285
+
281
286
  FWGlobalState.getInstance().resolveSdkInitCalled();
282
287
  }
283
288
 
@@ -303,12 +308,10 @@ class FireworkSDK {
303
308
  public async trackPurchase(
304
309
  parameters: TrackPurchaseParameters
305
310
  ): Promise<void> {
306
- if (Platform.OS === 'ios') {
307
- if (!FWGlobalState.getInstance().sdkInitCalled) {
308
- await FWGlobalState.getInstance().sdkInitCalledPromise;
309
- }
310
- FireworkSDKModule.trackPurchase(parameters);
311
+ if (!FWGlobalState.getInstance().sdkInitCalled) {
312
+ await FWGlobalState.getInstance().sdkInitCalledPromise;
311
313
  }
314
+ FireworkSDKModule.trackPurchase(parameters);
312
315
  }
313
316
 
314
317
  /**
@@ -2,6 +2,7 @@ import { NativeEventEmitter, Platform } from 'react-native';
2
2
 
3
3
  import { FWEventName } from './models/FWEventName';
4
4
  import type {
5
+ CustomClickCartIconEvent,
5
6
  CustomClickLinkButtonEvent,
6
7
  CustomTapProductCardEvent,
7
8
  ShoppingCTAEvent,
@@ -20,7 +21,9 @@ export type ShoppingCTACallback = (
20
21
  event: ShoppingCTAEvent
21
22
  ) => Promise<ShoppingCTAResult> | ShoppingCTAResult;
22
23
 
23
- export type CustomClickCartIconCallback = () => Promise<void> | void;
24
+ export type CustomClickCartIconCallback = (
25
+ event: CustomClickCartIconEvent
26
+ ) => Promise<void> | void;
24
27
 
25
28
  export type UpdateProductDetailsCallbackResult = Product[] | undefined | null;
26
29
  export type UpdateProductDetailsCallback = (
@@ -186,9 +189,9 @@ class VideoShopping {
186
189
  }
187
190
  );
188
191
 
189
- this.eventEmitter.addListener(FWEventName.ClickCartIcon, () => {
192
+ this.eventEmitter.addListener(FWEventName.ClickCartIcon, (event) => {
190
193
  FWLoggerUtil.log('Receive ClickCartIcon event');
191
- this.handleClickCartIconEvent();
194
+ this.handleClickCartIconEvent(event);
192
195
  });
193
196
 
194
197
  this.eventEmitter.addListener(FWEventName.UpdateProductDetails, (event) => {
@@ -213,10 +216,6 @@ class VideoShopping {
213
216
  this.eventEmitter.addListener(FWEventName.CustomProductCardTap, (event) => {
214
217
  FWLoggerUtil.log(`Receive CustomProductCardTap event url: ${event?.url}`);
215
218
  if (event) {
216
- if (!event.video) {
217
- event.video = { videoId: '' };
218
- }
219
-
220
219
  if (event.callbackId) {
221
220
  const callbackId = event.callbackId;
222
221
  delete event.callbackId;
@@ -227,9 +226,8 @@ class VideoShopping {
227
226
  };
228
227
  }
229
228
  }
229
+ this.handleCustomProductCardTapEvent(event);
230
230
  }
231
-
232
- this.handleCustomProductCardTapEvent(event ?? {});
233
231
  });
234
232
  }
235
233
 
@@ -269,9 +267,9 @@ class VideoShopping {
269
267
  }
270
268
  }
271
269
 
272
- private async handleClickCartIconEvent() {
270
+ private async handleClickCartIconEvent(event: any) {
273
271
  if (this.onCustomClickCartIcon) {
274
- this.onCustomClickCartIcon();
272
+ this.onCustomClickCartIcon(event as CustomClickCartIconEvent);
275
273
  }
276
274
  }
277
275
 
@@ -47,6 +47,18 @@ export interface IStoryBlockMethods {
47
47
  * Only supported on Android.
48
48
  */
49
49
  openFullscreen: () => void;
50
+ /**
51
+ * Triggered when the story block enters the viewport.
52
+ * Only supported on iOS.
53
+ * It is recommended that the host app is triggered when listening for scrolling.
54
+ */
55
+ onViewportEntered: () => void;
56
+ /**
57
+ * Triggered when the story block leaves the viewport.
58
+ * Only supported on iOS.
59
+ * It is recommended that the host app is triggered when listening for scrolling.
60
+ */
61
+ onViewportLeft: () => void;
50
62
  }
51
63
 
52
64
  /**
@@ -113,7 +125,6 @@ export interface IStoryBlockProps {
113
125
  * 1. Loading successfully but the back end returns an empty list.
114
126
  * 2. The load failed and list is empty.
115
127
  * onStoryBlockLoadFinished will also be triggered when onStoryBlockEmpty is triggered.
116
- * Only supported on Android.
117
128
  */
118
129
  onStoryBlockEmpty?: (error?: FWError) => void;
119
130
  /**
@@ -124,6 +135,12 @@ export interface IStoryBlockProps {
124
135
  * Stop Picture in Picture callback. Only supported on iOS.
125
136
  */
126
137
  onStoryBlockDidStopPictureInPicture?: (error?: FWError) => void;
138
+ /**
139
+ *
140
+ * The host app could use this callback to get feed id.
141
+ * The feed id can be used for conversion tracking.
142
+ */
143
+ onStoryBlockGetFeedId?: (feedId: string) => void;
127
144
  }
128
145
 
129
146
  const StoryBlock: ForwardRefRenderFunction<
@@ -223,6 +240,21 @@ const StoryBlock: ForwardRefRenderFunction<
223
240
  }
224
241
  };
225
242
 
243
+ const handleStoryBlockGetFeedId = (event: NativeSyntheticEvent<any>) => {
244
+ FWLoggerUtil.log(
245
+ `StoryBlock handleStoryBlockGetFeedId ${JSON.stringify(
246
+ event.nativeEvent
247
+ )}`
248
+ );
249
+ const { onStoryBlockGetFeedId } = props;
250
+
251
+ const { feedId } = event.nativeEvent;
252
+
253
+ if (onStoryBlockGetFeedId) {
254
+ onStoryBlockGetFeedId(feedId ?? '');
255
+ }
256
+ };
257
+
226
258
  const generateDynamicContentParametersString = (): string => {
227
259
  const { dynamicContentParameters } = props;
228
260
 
@@ -328,6 +360,9 @@ const StoryBlock: ForwardRefRenderFunction<
328
360
  storyBlockConfiguration?.ctaHighlightDelay?.value?.toFixed(5);
329
361
  const shareBaseURL = storyBlockConfiguration?.shareBaseURL;
330
362
  const buttonConfiguration = storyBlockConfiguration?.buttonConfiguration;
363
+ const videoPlayerLogoConfigurationJsonKey = gennerateJsonKey(
364
+ storyBlockConfiguration?.videoPlayerLogoConfiguration
365
+ );
331
366
  const ctaWidth = storyBlockConfiguration?.ctaWidth;
332
367
  const showVideoDetailTitle = storyBlockConfiguration?.showVideoDetailTitle;
333
368
 
@@ -337,6 +372,9 @@ const StoryBlock: ForwardRefRenderFunction<
337
372
  const productInfoViewConfigurationJsonKey = gennerateJsonKey(
338
373
  FireworkSDK.getInstance().shopping.productInfoViewConfiguration
339
374
  );
375
+ const replayBadgeConfigurationJsonKey = gennerateJsonKey(
376
+ storyBlockConfiguration?.replayBadgeConfiguration
377
+ );
340
378
 
341
379
  let key = `gShareBaseURL:${gShareBaseURL}`;
342
380
  if (Platform.OS === 'ios') {
@@ -391,18 +429,24 @@ const StoryBlock: ForwardRefRenderFunction<
391
429
  key += `_buttonConfiguration.pauseButton:${generateButtonInfoString(
392
430
  buttonConfiguration?.pauseButton
393
431
  )}`;
432
+ if (Platform.OS === 'android') {
433
+ key += `_videoPlayerLogoConfiguration:${videoPlayerLogoConfigurationJsonKey}`;
434
+ }
394
435
  key += `_showVideoDetailTitle:${showVideoDetailTitle}`;
395
436
 
396
437
  key += `_requiresAds:${requiresAds}`;
397
438
  key += `_adsFetchTimeout:${adsFetchTimeout}`;
398
439
  key += `_vastAttributes:${vastAttributesString}`;
399
- key += `_productInfoViewConfigurationJsonKey:${productInfoViewConfigurationJsonKey}`;
440
+ key += `_productInfoViewConfiguration:${productInfoViewConfigurationJsonKey}`;
441
+ key += `_replayBadgeConfiguration:${replayBadgeConfigurationJsonKey}`;
400
442
 
401
443
  return key;
402
444
  };
403
445
 
404
446
  const key = generateKey();
405
447
 
448
+ console.log('story block key', key);
449
+
406
450
  useImperativeHandle(
407
451
  forwardedRef,
408
452
  () => {
@@ -414,12 +458,14 @@ const StoryBlock: ForwardRefRenderFunction<
414
458
  if (Platform.OS === 'android') {
415
459
  commandId = commandId.toString();
416
460
  }
417
-
418
- UIManager.dispatchViewManagerCommand(
419
- findNodeHandle(nativeNodeHandle),
420
- commandId,
421
- []
461
+ let reactTag: number | null = findNodeHandle(nativeNodeHandle);
462
+ FWLoggerUtil.log(
463
+ `StoryBlock sendCommand: ${command} commandId: ${commandId} nativeNodeHandle: ${nativeNodeHandle} reactTag: ${reactTag}`
422
464
  );
465
+ if (!nativeNodeHandle || !reactTag) {
466
+ return;
467
+ }
468
+ UIManager.dispatchViewManagerCommand(reactTag, commandId, []);
423
469
  };
424
470
  return {
425
471
  play: () => {
@@ -431,6 +477,18 @@ const StoryBlock: ForwardRefRenderFunction<
431
477
  openFullscreen: () => {
432
478
  sendCommand('openFullscreen');
433
479
  },
480
+ onViewportEntered: () => {
481
+ if (Platform.OS !== 'ios') {
482
+ return;
483
+ }
484
+ sendCommand('onViewportEntered');
485
+ },
486
+ onViewportLeft: () => {
487
+ if (Platform.OS !== 'ios') {
488
+ return;
489
+ }
490
+ sendCommand('onViewportLeft');
491
+ },
434
492
  };
435
493
  },
436
494
  []
@@ -497,6 +555,9 @@ const StoryBlock: ForwardRefRenderFunction<
497
555
  setTimeout(() => {
498
556
  const viewId = findNodeHandle(nativeComponentRef.current);
499
557
  FWLoggerUtil.log(`StoryBlock createFragment viewId: ${viewId}`);
558
+ if (!viewId) {
559
+ return;
560
+ }
500
561
  UIManager.dispatchViewManagerCommand(
501
562
  viewId,
502
563
  UIManager.getViewManagerConfig(
@@ -535,6 +596,7 @@ const StoryBlock: ForwardRefRenderFunction<
535
596
  onStoryBlockDidStopPictureInPicture={
536
597
  handleStoryBlockDidStopPictureInPicture
537
598
  }
599
+ onStoryBlockGetFeedId={handleStoryBlockGetFeedId}
538
600
  />
539
601
  );
540
602
  };
@@ -12,17 +12,19 @@ import {
12
12
 
13
13
  import FireworkSDK from '../FireworkSDK';
14
14
  import type AdConfiguration from '../models/AdConfiguration';
15
+ import type ButtonInfo from '../models/ButtonInfo';
15
16
  import type FWError from '../models/FWError';
16
17
  import { FWEventName } from '../models/FWEventName';
18
+ import { FWNativeErrorAction } from '../models/FWNativeErrorAction';
17
19
  import type VideoFeedConfiguration from '../models/VideoFeedConfiguration';
18
20
  import type { VideoFeedSource } from '../models/VideoFeedSource';
19
21
  import type VideoPlayerConfiguration from '../models/VideoPlayerConfiguration';
22
+ import type VideoPlayerNativeConfiguration from '../models/VideoPlayerNativeConfiguration';
20
23
  import { FireworkSDKModuleEventEmitter } from '../modules/FireworkSDKModule';
21
24
  import FWGlobalState from '../utils/FWGlobalState';
25
+ import gennerateJsonKey from '../utils/FWJsonUtil';
22
26
  import FWLoggerUtil from '../utils/FWLoggerUtil';
23
27
  import FWVideoFeed from './FWVideoFeed';
24
- import type VideoPlayerNativeConfiguration from '../models/VideoPlayerNativeConfiguration';
25
- import type ButtonInfo from '../models/ButtonInfo';
26
28
 
27
29
  export type VideoFeedMode = 'row' | 'column' | 'grid';
28
30
 
@@ -101,7 +103,6 @@ export interface IVideoFeedProps {
101
103
  * 1. Loading successfully but the back end returns an empty list.
102
104
  * 2. The load failed and list is empty.
103
105
  * onVideoFeedLoadFinished will also be triggered when onVideoFeedEmpty is triggered.
104
- * Only supported on Android.
105
106
  */
106
107
  onVideoFeedEmpty?: (error?: FWError) => void;
107
108
  /**
@@ -112,6 +113,12 @@ export interface IVideoFeedProps {
112
113
  * Stop Picture in Picture callback. Only supported on iOS.
113
114
  */
114
115
  onVideoFeedDidStopPictureInPicture?: (error?: FWError) => void;
116
+ /**
117
+ *
118
+ * The host app could use this callback to get feed id.
119
+ * The feed id can be used for conversion tracking.
120
+ */
121
+ onVideoFeedGetFeedId?: (feedId: string) => void;
115
122
  }
116
123
 
117
124
  interface IVideoFeedState {
@@ -154,12 +161,14 @@ class VideoFeed extends React.Component<IVideoFeedProps, IVideoFeedState> {
154
161
  if (Platform.OS === 'android') {
155
162
  commandId = commandId.toString();
156
163
  }
157
-
158
- UIManager.dispatchViewManagerCommand(
159
- findNodeHandle(nativeNodeHandle),
160
- commandId,
161
- []
164
+ let reactTag: number | null = findNodeHandle(nativeNodeHandle);
165
+ FWLoggerUtil.log(
166
+ `StoryBlock refresh commandId: ${commandId} nativeNodeHandle: ${nativeNodeHandle} reactTag: ${reactTag}`
162
167
  );
168
+ if (!nativeNodeHandle || !reactTag) {
169
+ return;
170
+ }
171
+ UIManager.dispatchViewManagerCommand(reactTag, commandId, []);
163
172
  };
164
173
 
165
174
  private _onVideoFeedLoadFinished = (event: NativeSyntheticEvent<any>) => {
@@ -168,7 +177,7 @@ class VideoFeed extends React.Component<IVideoFeedProps, IVideoFeedState> {
168
177
  );
169
178
  const { onVideoFeedLoadFinished, onVideoFeedEmpty } = this.props;
170
179
 
171
- const { name, reason } = event.nativeEvent;
180
+ const { name, reason, action } = event.nativeEvent;
172
181
 
173
182
  if (onVideoFeedLoadFinished) {
174
183
  if (name) {
@@ -177,8 +186,17 @@ class VideoFeed extends React.Component<IVideoFeedProps, IVideoFeedState> {
177
186
  error.reason = reason;
178
187
  }
179
188
  onVideoFeedLoadFinished(error);
180
- if (!this._loaded) {
181
- onVideoFeedEmpty?.(error);
189
+ if (Platform.OS === 'android') {
190
+ if (
191
+ action === FWNativeErrorAction.loadingFirstPage ||
192
+ !this._loaded
193
+ ) {
194
+ onVideoFeedEmpty?.(error);
195
+ }
196
+ } else {
197
+ if (!this._loaded) {
198
+ onVideoFeedEmpty?.(error);
199
+ }
182
200
  }
183
201
  } else {
184
202
  onVideoFeedLoadFinished();
@@ -248,6 +266,19 @@ class VideoFeed extends React.Component<IVideoFeedProps, IVideoFeedState> {
248
266
  }
249
267
  };
250
268
 
269
+ private _onVideoFeedGetFeedId = (event: NativeSyntheticEvent<any>) => {
270
+ FWLoggerUtil.log(
271
+ `VideoFeed onVideoFeedGetFeedId ${JSON.stringify(event.nativeEvent)}`
272
+ );
273
+ const { onVideoFeedGetFeedId } = this.props;
274
+
275
+ const { feedId } = event.nativeEvent;
276
+
277
+ if (onVideoFeedGetFeedId) {
278
+ onVideoFeedGetFeedId(feedId ?? '');
279
+ }
280
+ };
281
+
251
282
  /**
252
283
  * @ignore
253
284
  */
@@ -387,11 +418,19 @@ class VideoFeed extends React.Component<IVideoFeedProps, IVideoFeedState> {
387
418
  const shareBaseURL = videoPlayerConfiguration?.shareBaseURL;
388
419
  const ctaWidth = videoPlayerConfiguration?.ctaWidth;
389
420
  const buttonConfiguration = videoPlayerConfiguration?.buttonConfiguration;
421
+ const videoPlayerLogoConfigurationJsonKey = gennerateJsonKey(
422
+ videoPlayerConfiguration?.videoPlayerLogoConfiguration
423
+ );
390
424
  const showVideoDetailTitle = videoPlayerConfiguration?.showVideoDetailTitle;
391
425
  const requiresAds = adConfiguration?.requiresAds;
392
426
  const adsFetchTimeout = adConfiguration?.adsFetchTimeout;
393
427
  const vastAttributesString = this._generateVastAttributesString();
394
-
428
+ const replayBadgeVideoFeedConfigurationJsonKey = gennerateJsonKey(
429
+ videoFeedConfiguration?.replayBadge
430
+ );
431
+ const replayBadgeVideoPlayerConfigurationJsonKey = gennerateJsonKey(
432
+ videoPlayerConfiguration?.replayBadgeConfiguration
433
+ );
395
434
  let key = `gShareBaseURL:${gShareBaseURL}`;
396
435
  if (Platform.OS === 'ios') {
397
436
  key += `_appLanguage:${appLanguage}`;
@@ -470,12 +509,17 @@ class VideoFeed extends React.Component<IVideoFeedProps, IVideoFeedState> {
470
509
  key += `_buttonConfiguration.pauseButton:${this._generateButtonInfoString(
471
510
  buttonConfiguration?.pauseButton
472
511
  )}`;
512
+ key += `_videoPlayerLogoConfiguration:${videoPlayerLogoConfigurationJsonKey}`;
473
513
  key += `_showVideoDetailTitle:${showVideoDetailTitle}`;
474
514
  }
475
515
 
476
516
  key += `_requiresAds:${requiresAds}`;
477
517
  key += `_adsFetchTimeout:${adsFetchTimeout}`;
478
518
  key += `_vastAttributes:${vastAttributesString}`;
519
+ key += `_replayBadgeVideoFeedConfiguration:${replayBadgeVideoFeedConfigurationJsonKey}`;
520
+ key += `_replayBadgeVideoPlayerConfiguration:${replayBadgeVideoPlayerConfigurationJsonKey}`;
521
+
522
+ console.log('video feed key', key);
479
523
 
480
524
  return (
481
525
  <FWVideoFeed
@@ -493,6 +537,7 @@ class VideoFeed extends React.Component<IVideoFeedProps, IVideoFeedState> {
493
537
  onVideoFeedDidStopPictureInPicture={
494
538
  this._onVideoFeedDidStopPictureInPicture
495
539
  }
540
+ onVideoFeedGetFeedId={this._onVideoFeedGetFeedId}
496
541
  mode={mode ?? 'row'}
497
542
  />
498
543
  );
package/src/index.ts CHANGED
@@ -27,6 +27,7 @@ import type ButtonInfo from './models/ButtonInfo';
27
27
  import type FeedItemDetails from './models/FeedItemDetails';
28
28
  import type FWError from './models/FWError';
29
29
  import type {
30
+ CustomClickCartIconEvent,
30
31
  CustomClickLinkButtonEvent,
31
32
  CustomCTAClickEvent,
32
33
  CustomTapProductCardEvent,
@@ -120,6 +121,7 @@ export {
120
121
  AndroidFontInfo,
121
122
  ButtonInfo,
122
123
  CustomClickCartIconCallback,
124
+ CustomClickCartIconEvent,
123
125
  CustomClickLinkButtonCallback,
124
126
  CustomClickLinkButtonEvent,
125
127
  CustomCTAClickCallback,
@@ -16,13 +16,13 @@ export interface SDKInitEvent {
16
16
 
17
17
  export interface PlayerHandler {
18
18
  /**
19
- * Pause the video playback associated with this CTA.
19
+ * Pause The video playback associated with this CTA.
20
20
  * Only supported on iOS
21
21
  */
22
22
  pause: () => void;
23
23
 
24
24
  /**
25
- * Resume the video playback associated with this CTA.
25
+ * Resume The video playback associated with this CTA.
26
26
  * Only supported on iOS
27
27
  */
28
28
  resume: () => void;
@@ -39,6 +39,11 @@ export interface CustomCTAClickEvent {
39
39
  * Only supported on iOS
40
40
  */
41
41
  playerHandler?: PlayerHandler;
42
+
43
+ /**
44
+ * The video playback details for the event.
45
+ */
46
+ video: VideoPlaybackDetails;
42
47
  }
43
48
 
44
49
  export interface VideoPlaybackEvent {
@@ -63,6 +68,10 @@ export interface ShoppingCTAEvent {
63
68
  * A unique identifier of the product unit.
64
69
  */
65
70
  unitId: string;
71
+ /**
72
+ * The video playback details for the event.
73
+ */
74
+ video: VideoPlaybackDetails;
66
75
  }
67
76
 
68
77
  export interface UpdateProductDetailsEvent {
@@ -70,6 +79,10 @@ export interface UpdateProductDetailsEvent {
70
79
  * A unique identifier list of the products.
71
80
  */
72
81
  productIds: string[];
82
+ /**
83
+ * The video playback details for the event.
84
+ */
85
+ video: VideoPlaybackDetails;
73
86
  }
74
87
 
75
88
  export interface CustomClickLinkButtonEvent {
@@ -85,6 +98,11 @@ export interface CustomClickLinkButtonEvent {
85
98
  * A unique identifier of the product unit.
86
99
  */
87
100
  unitId: string;
101
+ /**
102
+ * The video playback details for the event.
103
+ * Only supported on Android.
104
+ */
105
+ video?: VideoPlaybackDetails;
88
106
  }
89
107
 
90
108
  export interface CustomTapProductCardEvent {
@@ -101,7 +119,7 @@ export interface CustomTapProductCardEvent {
101
119
  */
102
120
  unitId: string;
103
121
  /**
104
- * the video playback details that the product unit belongs to.
122
+ * The video playback details for the event.
105
123
  */
106
124
  video: VideoPlaybackDetails;
107
125
  /**
@@ -120,3 +138,10 @@ export interface LiveStreamChatEvent {
120
138
  message: LiveStreamMessageDetails;
121
139
  liveStream: LiveStreamEventDetails;
122
140
  }
141
+
142
+ export interface CustomClickCartIconEvent {
143
+ /**
144
+ * The video playback details for the event.
145
+ */
146
+ video: VideoPlaybackDetails;
147
+ }
@@ -0,0 +1,4 @@
1
+ export enum FWNativeErrorAction {
2
+ loadingFirstPage = 'loadingFirstPage',
3
+ loadingNextPage = 'loadingNextPage',
4
+ }
@@ -49,5 +49,11 @@ export default interface FeedItemDetails {
49
49
  * For instance, (and sport food) (or sport food) (and sport (or food comedy)) sport are all valid expressions.
50
50
  * Non-UTF-8 characters are not allowed. If using boolean predicates, the expression needs to be wrapped with parenthesis.
51
51
  */
52
- hashtagFilterExpression?: string;
52
+ hashtagFilterExpression?: string | null;
53
+
54
+ /**
55
+ * The feed id for the item.
56
+ * Only supported on Android.
57
+ */
58
+ feedId?: string | null;
53
59
  }
@@ -0,0 +1,7 @@
1
+ export interface ReplayBadgeConfiguration {
2
+ /**
3
+ * Indicates if the replay badge is hidden.
4
+ * Defaults to false.
5
+ */
6
+ isHidden?: boolean;
7
+ }
@@ -1,3 +1,4 @@
1
+ import type { ReplayBadgeConfiguration } from './ReplayBadgeConfiguration';
1
2
  import type VideoPlayerButtonConfiguration from './VideoPlayerButtonConfiguration';
2
3
  import type { VideoPlayerCTADelay } from './VideoPlayerCTADelay';
3
4
  import type { VideoPlayerCTAStyle } from './VideoPlayerCTAStyle';
@@ -73,7 +74,11 @@ export interface StoryBlockConfiguration {
73
74
  /**
74
75
  * Specifies the logo configuration
75
76
  * Defaults to { option: 'disabled' }
76
- * Only supported on iOS.
77
77
  */
78
78
  videoPlayerLogoConfiguration?: VideoPlayerLogoConfiguration;
79
+ /**
80
+ * The configuration of replay badge.
81
+ * Only supported on iOS.
82
+ */
83
+ replayBadgeConfiguration?: ReplayBadgeConfiguration;
79
84
  }
@@ -1,6 +1,7 @@
1
1
  import type IOSFontInfo from './IOSFontInfo';
2
2
  import type AndroidFontInfo from './AndroidFontInfo';
3
3
  import type GradientDrawable from './GradientDrawable';
4
+ import type { ReplayBadgeConfiguration } from './ReplayBadgeConfiguration';
4
5
 
5
6
  export interface VideoFeedTitleConfiguration {
6
7
  /**
@@ -135,4 +136,9 @@ export default interface VideoFeedConfiguration {
135
136
  * Defaults to 2.
136
137
  */
137
138
  gridColumns?: number;
139
+ /**
140
+ * The configuration of replay badge.
141
+ * Only supported on iOS.
142
+ */
143
+ replayBadge?: ReplayBadgeConfiguration;
138
144
  }
@@ -5,6 +5,7 @@ import type { VideoPlayerCTAWidth } from './VideoPlayerCTAWidth';
5
5
  import type { VideoPlayerCompleteAction } from './VideoPlayerCompleteAction';
6
6
  import type { VideoPlayerStyle } from './VideoPlayerStyle';
7
7
  import type { VideoPlayerLogoConfiguration } from './VideoPlayerLogoConfiguration';
8
+ import type { ReplayBadgeConfiguration } from './ReplayBadgeConfiguration';
8
9
 
9
10
  export default interface VideoPlayerConfiguration {
10
11
  /**
@@ -71,7 +72,11 @@ export default interface VideoPlayerConfiguration {
71
72
  /**
72
73
  * Specifies the logo configuration
73
74
  * Defaults to { option: 'disabled' }
74
- * Only supported on iOS.
75
75
  */
76
76
  videoPlayerLogoConfiguration?: VideoPlayerLogoConfiguration;
77
+ /**
78
+ * The configuration of replay badge.
79
+ * Only supported on iOS.
80
+ */
81
+ replayBadgeConfiguration?: ReplayBadgeConfiguration;
77
82
  }
@@ -19,6 +19,7 @@ const FireworkSDKModule = NativeModules.FireworkSDK
19
19
 
20
20
  interface IFireworkSDKModule extends NativeModule {
21
21
  init(options?: SDKInitOptions): Promise<any>;
22
+ markInitCalled(): Promise<boolean>;
22
23
  openVideoPlayer(url: string, config?: VideoPlayerNativeConfiguration): void;
23
24
  setVideoFeedClickCallbackEnabled(enabled: boolean): void; // Only supported on iOS
24
25
  setCustomCTAClickEnabled(enabled: boolean): void;