react-native-firework-sdk 2.10.1 → 2.11.1

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 (172) hide show
  1. package/android/gradle.properties +1 -1
  2. package/android/src/main/java/com/fireworksdk/bridge/components/storyblock/StoryBlockFragment.kt +20 -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/FWCountdownTimerConfigurationModel.kt +8 -0
  5. package/android/src/main/java/com/fireworksdk/bridge/models/FWCountdownTimerConfigurationModelDeserializer.kt +22 -0
  6. package/android/src/main/java/com/fireworksdk/bridge/models/FWCountdownTimerConfigurationModelSerializer.kt +18 -0
  7. package/android/src/main/java/com/fireworksdk/bridge/models/FWFontInfoModel.kt +2 -2
  8. package/android/src/main/java/com/fireworksdk/bridge/models/FWSDKInitOptionsModel.kt +0 -1
  9. package/android/src/main/java/com/fireworksdk/bridge/models/FWSDKInitOptionsModelDeserializer.kt +0 -3
  10. package/android/src/main/java/com/fireworksdk/bridge/models/FWSDKInitOptionsModelSerializer.kt +0 -2
  11. package/android/src/main/java/com/fireworksdk/bridge/models/FWSdkInitResultModel.kt +6 -0
  12. package/android/src/main/java/com/fireworksdk/bridge/models/FWTrackPurchaseModel.kt +9 -0
  13. package/android/src/main/java/com/fireworksdk/bridge/models/FWTrackPurchaseModelDeserializer.kt +45 -0
  14. package/android/src/main/java/com/fireworksdk/bridge/models/FWTrackPurchaseModelSerializer.kt +34 -0
  15. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoFeedItemDetailsModel.kt +1 -0
  16. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoPlaybackDetails.kt +1 -0
  17. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoPlayerConfigModel.kt +3 -1
  18. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoPlayerConfigModelDeserializer.kt +7 -1
  19. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoPlayerConfigModelSerializer.kt +4 -0
  20. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoPlayerLogoConfigurationModel.kt +8 -0
  21. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoPlayerLogoConfigurationModelDeserializer.kt +23 -0
  22. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoPlayerLogoConfigurationModelSerializer.kt +18 -0
  23. package/android/src/main/java/com/fireworksdk/bridge/models/enums/FWAppearanceMode.kt +18 -0
  24. package/android/src/main/java/com/fireworksdk/bridge/models/enums/FWEventName.kt +2 -0
  25. package/android/src/main/java/com/fireworksdk/bridge/models/enums/FWVideoPlayerLogoOption.kt +19 -0
  26. package/android/src/main/java/com/fireworksdk/bridge/reactnative/FWReactNativeSDK.kt +103 -0
  27. package/android/src/main/java/com/fireworksdk/bridge/reactnative/manager/FWStoryBlockManager.kt +12 -0
  28. package/android/src/main/java/com/fireworksdk/bridge/reactnative/manager/FWVideoFeedManager.kt +8 -0
  29. package/android/src/main/java/com/fireworksdk/bridge/reactnative/models/FireworkSDKInterface.kt +2 -0
  30. package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FWVideoShoppingModule.kt +22 -9
  31. package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FireworkSDKModule.kt +74 -122
  32. package/android/src/main/java/com/fireworksdk/bridge/reactnative/utils/FWEventUtils.kt +34 -9
  33. package/android/src/main/java/com/fireworksdk/bridge/utils/FWConfigUtil.kt +13 -0
  34. package/android/src/main/java/com/fireworksdk/bridge/utils/FWFragmentUtil.kt +3 -3
  35. package/android/src/main/java/com/fireworksdk/bridge/utils/FWGlobalDataUtil.kt +5 -2
  36. package/android/src/main/java/com/fireworksdk/bridge/utils/FWModelUtils.kt +64 -0
  37. package/ios/Components/CountdownTimerConfiguration.swift +43 -0
  38. package/ios/Components/ReplayBadgeConfiguration.swift +12 -0
  39. package/ios/Components/StoryBlock.swift +37 -0
  40. package/ios/Components/StoryBlockConfiguration.swift +2 -0
  41. package/ios/Components/StoryBlockManager.m +24 -0
  42. package/ios/Components/StoryBlockManager.swift +6 -3
  43. package/ios/Components/VideoFeed.swift +23 -3
  44. package/ios/Components/VideoFeedConfiguration.swift +1 -0
  45. package/ios/Components/VideoFeedManager.m +4 -1
  46. package/ios/Components/VideoFeedManager.swift +6 -3
  47. package/ios/Components/VideoPlayerConfiguration.swift +2 -0
  48. package/ios/FWReactNativeSDK.swift +14 -0
  49. package/ios/FireworkSdk.xcodeproj/project.pbxproj +16 -0
  50. package/ios/Modules/FireworkSDKModule/FireworkSDKModule+CTA.swift +17 -15
  51. package/ios/Modules/FireworkSDKModule/FireworkSDKModule+EventTracking.swift +1 -11
  52. package/ios/Modules/FireworkSDKModule/FireworkSDKModule.m +1 -0
  53. package/ios/Modules/FireworkSDKModule/FireworkSDKModule.swift +80 -81
  54. package/ios/Modules/FireworkSDKModule/SDKInitOptions.swift +9 -5
  55. package/ios/Modules/Shopping/ShoppingModule.swift +10 -74
  56. package/lib/commonjs/FireworkSDK.js +30 -25
  57. package/lib/commonjs/FireworkSDK.js.map +1 -1
  58. package/lib/commonjs/VideoShopping.js +6 -12
  59. package/lib/commonjs/VideoShopping.js.map +1 -1
  60. package/lib/commonjs/components/StoryBlock.js +56 -3
  61. package/lib/commonjs/components/StoryBlock.js.map +1 -1
  62. package/lib/commonjs/components/VideoFeed.js +48 -4
  63. package/lib/commonjs/components/VideoFeed.js.map +1 -1
  64. package/lib/commonjs/index.js +7 -7
  65. package/lib/commonjs/index.js.map +1 -1
  66. package/lib/commonjs/models/CountdownTimerConfiguration.js +2 -0
  67. package/lib/commonjs/models/CountdownTimerConfiguration.js.map +1 -0
  68. package/lib/commonjs/models/FWNativeErrorAction.js +14 -0
  69. package/lib/commonjs/models/FWNativeErrorAction.js.map +1 -0
  70. package/lib/commonjs/models/ReplayBadgeConfiguration.js +2 -0
  71. package/lib/commonjs/models/ReplayBadgeConfiguration.js.map +1 -0
  72. package/lib/commonjs/modules/FireworkSDKModule.js.map +1 -1
  73. package/lib/module/FireworkSDK.js +29 -25
  74. package/lib/module/FireworkSDK.js.map +1 -1
  75. package/lib/module/VideoShopping.js +6 -12
  76. package/lib/module/VideoShopping.js.map +1 -1
  77. package/lib/module/components/StoryBlock.js +55 -3
  78. package/lib/module/components/StoryBlock.js.map +1 -1
  79. package/lib/module/components/VideoFeed.js +44 -4
  80. package/lib/module/components/VideoFeed.js.map +1 -1
  81. package/lib/module/index.js +5 -5
  82. package/lib/module/index.js.map +1 -1
  83. package/lib/module/models/CountdownTimerConfiguration.js +2 -0
  84. package/lib/module/models/CountdownTimerConfiguration.js.map +1 -0
  85. package/lib/module/models/FWNativeErrorAction.js +7 -0
  86. package/lib/module/models/FWNativeErrorAction.js.map +1 -0
  87. package/lib/module/models/ReplayBadgeConfiguration.js +2 -0
  88. package/lib/module/models/ReplayBadgeConfiguration.js.map +1 -0
  89. package/lib/module/modules/FireworkSDKModule.js.map +1 -1
  90. package/lib/typescript/VideoShopping.d.ts +2 -2
  91. package/lib/typescript/components/StoryBlock.d.ts +18 -1
  92. package/lib/typescript/components/VideoFeed.d.ts +7 -1
  93. package/lib/typescript/index.d.ts +15 -13
  94. package/lib/typescript/models/CountdownTimerConfiguration.d.ts +12 -0
  95. package/lib/typescript/models/FWEvents.d.ts +26 -3
  96. package/lib/typescript/models/FWNativeErrorAction.d.ts +4 -0
  97. package/lib/typescript/models/FeedItemDetails.d.ts +6 -1
  98. package/lib/typescript/models/ReplayBadgeConfiguration.d.ts +7 -0
  99. package/lib/typescript/models/StoryBlockConfiguration.d.ts +13 -1
  100. package/lib/typescript/models/VideoFeedConfiguration.d.ts +6 -0
  101. package/lib/typescript/models/VideoPlayerConfiguration.d.ts +12 -1
  102. package/lib/typescript/modules/FireworkSDKModule.d.ts +1 -0
  103. package/package.json +1 -5
  104. package/react-native-firework-sdk.podspec +3 -5
  105. package/src/FireworkSDK.ts +27 -24
  106. package/src/VideoShopping.ts +9 -11
  107. package/src/components/StoryBlock.tsx +73 -7
  108. package/src/components/VideoFeed.tsx +61 -12
  109. package/src/index.ts +36 -30
  110. package/src/models/CountdownTimerConfiguration.ts +12 -0
  111. package/src/models/FWEvents.ts +28 -3
  112. package/src/models/FWNativeErrorAction.ts +4 -0
  113. package/src/models/FeedItemDetails.ts +7 -1
  114. package/src/models/ReplayBadgeConfiguration.ts +7 -0
  115. package/src/models/StoryBlockConfiguration.ts +13 -1
  116. package/src/models/VideoFeedConfiguration.ts +6 -0
  117. package/src/models/VideoPlayerConfiguration.ts +12 -1
  118. package/src/modules/FireworkSDKModule.ts +1 -0
  119. package/FireworkVideoUI.xcframework/Info.plist +0 -40
  120. package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/FireworkVideoUI +0 -0
  121. package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Headers/FireworkVideoUI-Swift.h +0 -280
  122. package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Headers/FireworkVideoUI.h +0 -18
  123. package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Info.plist +0 -0
  124. package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios.abi.json +0 -1313
  125. package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios.private.swiftinterface +0 -42
  126. package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
  127. package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios.swiftinterface +0 -42
  128. package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Modules/module.modulemap +0 -11
  129. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/FireworkVideoUI +0 -0
  130. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Headers/FireworkVideoUI-Swift.h +0 -556
  131. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Headers/FireworkVideoUI.h +0 -18
  132. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Info.plist +0 -0
  133. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios-simulator.abi.json +0 -1313
  134. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +0 -42
  135. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
  136. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios-simulator.swiftinterface +0 -42
  137. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/x86_64-apple-ios-simulator.abi.json +0 -1313
  138. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +0 -42
  139. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
  140. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +0 -42
  141. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/module.modulemap +0 -11
  142. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/_CodeSignature/CodeResources +0 -245
  143. package/ios/FireworkVideoUI/FireworkVideoUI/FireworkVideoUI.docc/FireworkVideoUI.md +0 -13
  144. package/ios/FireworkVideoUI/FireworkVideoUI/FireworkVideoUI.h +0 -18
  145. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/AppLanguageManager.swift +0 -154
  146. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/Foundation/Bundle+AppLanguage.swift +0 -73
  147. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/Foundation/NumberFormatter+AppLanguage.swift +0 -25
  148. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/Foundation/URLSession+AppLanguage.swift +0 -52
  149. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/UIKit/UIImageView+AppLanguage.swift +0 -60
  150. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/UIKit/UILabel+AppLanguage.swift +0 -98
  151. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/UIKit/UITextField+AppLanguage.swift +0 -97
  152. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/UIKit/UITextView+AppLanguage.swift +0 -97
  153. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/UIKit/UIView+AppLanguage.swift +0 -71
  154. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/UIKit/UIViewController+AppLanguage.swift +0 -48
  155. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/UIKit/UIWindow+AppLanguage.swift +0 -26
  156. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/LanguageUtil.swift +0 -43
  157. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/LayoutFlip/Extensions/Foundation/NSObject+LayoutFlip.swift +0 -42
  158. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/LayoutFlip/Extensions/UIKit/CALayer+LayoutFlip.swift +0 -149
  159. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/LayoutFlip/Extensions/UIKit/UILabel+LayoutFlip.swift +0 -35
  160. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/LayoutFlip/Extensions/UIKit/UIView+LayoutFlip.swift +0 -202
  161. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/LayoutFlip/LayoutFlipManager.swift +0 -59
  162. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/Utils/Extensions/Foundation/DispatchQueue+Once.swift +0 -32
  163. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/Utils/Extensions/Foundation/String+Base64.swift +0 -18
  164. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/Utils/Extensions/UIKit/UIView+UIHierarchy.swift +0 -46
  165. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/Utils/Swizzle.swift +0 -37
  166. package/ios/FireworkVideoUI/FireworkVideoUI.xcodeproj/project.pbxproj +0 -766
  167. package/ios/FireworkVideoUI/FireworkVideoUI.xcworkspace/contents.xcworkspacedata +0 -10
  168. package/ios/FireworkVideoUI/FireworkVideoUI.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
  169. package/ios/FireworkVideoUI/FireworkVideoUITests/FireworkVideoUITests.swift +0 -37
  170. package/ios/FireworkVideoUI/Podfile +0 -15
  171. package/ios/FireworkVideoUI/Podfile.lock +0 -16
  172. package/ios/scripts/react_native_firework_sdk_pods.rb +0 -27
@@ -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
  export interface VideoFeedTitleConfiguration {
5
6
  /**
6
7
  * Specifies if the video feed title is hidden.
@@ -130,4 +131,9 @@ export default interface VideoFeedConfiguration {
130
131
  * Defaults to 2.
131
132
  */
132
133
  gridColumns?: number;
134
+ /**
135
+ * The configuration of replay badge.
136
+ * Only supported on iOS.
137
+ */
138
+ replayBadge?: ReplayBadgeConfiguration;
133
139
  }
@@ -5,6 +5,8 @@ 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';
9
+ import type CountdownTimerConfiguration from './CountdownTimerConfiguration';
8
10
  export default interface VideoPlayerConfiguration {
9
11
  /**
10
12
  * Sets the proportion of the video player to its container.
@@ -70,7 +72,16 @@ export default interface VideoPlayerConfiguration {
70
72
  /**
71
73
  * Specifies the logo configuration
72
74
  * Defaults to { option: 'disabled' }
73
- * Only supported on iOS.
74
75
  */
75
76
  videoPlayerLogoConfiguration?: VideoPlayerLogoConfiguration;
77
+ /**
78
+ * The configuration of replay badge.
79
+ * Only supported on iOS.
80
+ */
81
+ replayBadgeConfiguration?: ReplayBadgeConfiguration;
82
+ /**
83
+ * Specifies countdown timer configuration.
84
+ * Only supported on iOS.
85
+ */
86
+ countdownTimerConfiguration?: CountdownTimerConfiguration;
76
87
  }
@@ -5,6 +5,7 @@ import type TrackPurchaseParameters from '../models/TrackPurchaseParameters';
5
5
  import type VideoPlayerNativeConfiguration from '../models/VideoPlayerNativeConfiguration';
6
6
  interface IFireworkSDKModule extends NativeModule {
7
7
  init(options?: SDKInitOptions): Promise<any>;
8
+ markInitCalled(): Promise<boolean>;
8
9
  openVideoPlayer(url: string, config?: VideoPlayerNativeConfiguration): void;
9
10
  setVideoFeedClickCallbackEnabled(enabled: boolean): void;
10
11
  setCustomCTAClickEnabled(enabled: boolean): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-firework-sdk",
3
- "version": "2.10.1",
3
+ "version": "2.11.1",
4
4
  "description": "Firework React Native SDK",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -13,13 +13,9 @@
13
13
  "ios",
14
14
  "cpp",
15
15
  "react-native-firework-sdk.podspec",
16
- "FireworkVideoUI.xcframework",
17
16
  "!lib/typescript/example",
18
17
  "!android/build",
19
18
  "!ios/build",
20
- "!ios/FireworkVideoUI/build",
21
- "!ios/FireworkVideoUI/Pods",
22
- "!ios/FireworkVideoUI/scripts",
23
19
  "!**/__tests__",
24
20
  "!**/__fixtures__",
25
21
  "!**/__mocks__",
@@ -27,13 +27,11 @@ fi
27
27
 
28
28
  s.source_files = 'ios/**/*.{h,m,mm,swift}'
29
29
  s.exclude_files = [
30
- 'ios/Support/**/*',
31
- 'ios/FireworkVideoUI/**/*'
30
+ 'ios/Support/**/*'
32
31
  ]
33
- s.preserve_paths = "FireworkVideoUI.xcframework"
34
- s.vendored_frameworks = "FireworkVideoUI.xcframework"
35
32
 
36
33
  s.static_framework = true
37
34
  s.dependency 'React-Core'
38
- s.dependency 'FireworkVideo', '1.16.0'
35
+ s.dependency 'FireworkVideoUI', '0.1.0'
36
+ s.dependency 'FireworkVideo', '1.18.0'
39
37
  end
@@ -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,12 @@ const StoryBlock: ForwardRefRenderFunction<
337
372
  const productInfoViewConfigurationJsonKey = gennerateJsonKey(
338
373
  FireworkSDK.getInstance().shopping.productInfoViewConfiguration
339
374
  );
375
+ const replayBadgeConfigurationJsonKey = gennerateJsonKey(
376
+ storyBlockConfiguration?.replayBadgeConfiguration
377
+ );
378
+ const countdownTimerConfigurationJsonKey = gennerateJsonKey(
379
+ storyBlockConfiguration?.countdownTimerConfiguration
380
+ );
340
381
 
341
382
  let key = `gShareBaseURL:${gShareBaseURL}`;
342
383
  if (Platform.OS === 'ios') {
@@ -391,18 +432,25 @@ const StoryBlock: ForwardRefRenderFunction<
391
432
  key += `_buttonConfiguration.pauseButton:${generateButtonInfoString(
392
433
  buttonConfiguration?.pauseButton
393
434
  )}`;
435
+ if (Platform.OS === 'android') {
436
+ key += `_videoPlayerLogoConfiguration:${videoPlayerLogoConfigurationJsonKey}`;
437
+ }
394
438
  key += `_showVideoDetailTitle:${showVideoDetailTitle}`;
395
439
 
396
440
  key += `_requiresAds:${requiresAds}`;
397
441
  key += `_adsFetchTimeout:${adsFetchTimeout}`;
398
442
  key += `_vastAttributes:${vastAttributesString}`;
399
- key += `_productInfoViewConfigurationJsonKey:${productInfoViewConfigurationJsonKey}`;
443
+ key += `_productInfoViewConfiguration:${productInfoViewConfigurationJsonKey}`;
444
+ key += `_replayBadgeConfiguration:${replayBadgeConfigurationJsonKey}`;
445
+ key += `_countdownTimerConfiguration:${countdownTimerConfigurationJsonKey}`;
400
446
 
401
447
  return key;
402
448
  };
403
449
 
404
450
  const key = generateKey();
405
451
 
452
+ console.log('story block key', key);
453
+
406
454
  useImperativeHandle(
407
455
  forwardedRef,
408
456
  () => {
@@ -414,12 +462,14 @@ const StoryBlock: ForwardRefRenderFunction<
414
462
  if (Platform.OS === 'android') {
415
463
  commandId = commandId.toString();
416
464
  }
417
-
418
- UIManager.dispatchViewManagerCommand(
419
- findNodeHandle(nativeNodeHandle),
420
- commandId,
421
- []
465
+ let reactTag: number | null = findNodeHandle(nativeNodeHandle);
466
+ FWLoggerUtil.log(
467
+ `StoryBlock sendCommand: ${command} commandId: ${commandId} nativeNodeHandle: ${nativeNodeHandle} reactTag: ${reactTag}`
422
468
  );
469
+ if (!nativeNodeHandle || !reactTag) {
470
+ return;
471
+ }
472
+ UIManager.dispatchViewManagerCommand(reactTag, commandId, []);
423
473
  };
424
474
  return {
425
475
  play: () => {
@@ -431,6 +481,18 @@ const StoryBlock: ForwardRefRenderFunction<
431
481
  openFullscreen: () => {
432
482
  sendCommand('openFullscreen');
433
483
  },
484
+ onViewportEntered: () => {
485
+ if (Platform.OS !== 'ios') {
486
+ return;
487
+ }
488
+ sendCommand('onViewportEntered');
489
+ },
490
+ onViewportLeft: () => {
491
+ if (Platform.OS !== 'ios') {
492
+ return;
493
+ }
494
+ sendCommand('onViewportLeft');
495
+ },
434
496
  };
435
497
  },
436
498
  []
@@ -497,6 +559,9 @@ const StoryBlock: ForwardRefRenderFunction<
497
559
  setTimeout(() => {
498
560
  const viewId = findNodeHandle(nativeComponentRef.current);
499
561
  FWLoggerUtil.log(`StoryBlock createFragment viewId: ${viewId}`);
562
+ if (!viewId) {
563
+ return;
564
+ }
500
565
  UIManager.dispatchViewManagerCommand(
501
566
  viewId,
502
567
  UIManager.getViewManagerConfig(
@@ -535,6 +600,7 @@ const StoryBlock: ForwardRefRenderFunction<
535
600
  onStoryBlockDidStopPictureInPicture={
536
601
  handleStoryBlockDidStopPictureInPicture
537
602
  }
603
+ onStoryBlockGetFeedId={handleStoryBlockGetFeedId}
538
604
  />
539
605
  );
540
606
  };
@@ -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,22 @@ 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
+ );
424
+ const countdownTimerConfigurationJsonKey = gennerateJsonKey(
425
+ videoPlayerConfiguration?.countdownTimerConfiguration
426
+ );
390
427
  const showVideoDetailTitle = videoPlayerConfiguration?.showVideoDetailTitle;
391
428
  const requiresAds = adConfiguration?.requiresAds;
392
429
  const adsFetchTimeout = adConfiguration?.adsFetchTimeout;
393
430
  const vastAttributesString = this._generateVastAttributesString();
394
-
431
+ const replayBadgeVideoFeedConfigurationJsonKey = gennerateJsonKey(
432
+ videoFeedConfiguration?.replayBadge
433
+ );
434
+ const replayBadgeVideoPlayerConfigurationJsonKey = gennerateJsonKey(
435
+ videoPlayerConfiguration?.replayBadgeConfiguration
436
+ );
395
437
  let key = `gShareBaseURL:${gShareBaseURL}`;
396
438
  if (Platform.OS === 'ios') {
397
439
  key += `_appLanguage:${appLanguage}`;
@@ -470,12 +512,18 @@ class VideoFeed extends React.Component<IVideoFeedProps, IVideoFeedState> {
470
512
  key += `_buttonConfiguration.pauseButton:${this._generateButtonInfoString(
471
513
  buttonConfiguration?.pauseButton
472
514
  )}`;
515
+ key += `_videoPlayerLogoConfiguration:${videoPlayerLogoConfigurationJsonKey}`;
516
+ key += `_countdownTimerConfiguration:${countdownTimerConfigurationJsonKey}`;
473
517
  key += `_showVideoDetailTitle:${showVideoDetailTitle}`;
474
518
  }
475
519
 
476
520
  key += `_requiresAds:${requiresAds}`;
477
521
  key += `_adsFetchTimeout:${adsFetchTimeout}`;
478
522
  key += `_vastAttributes:${vastAttributesString}`;
523
+ key += `_replayBadgeVideoFeedConfiguration:${replayBadgeVideoFeedConfigurationJsonKey}`;
524
+ key += `_replayBadgeVideoPlayerConfiguration:${replayBadgeVideoPlayerConfigurationJsonKey}`;
525
+
526
+ console.log('video feed key', key);
479
527
 
480
528
  return (
481
529
  <FWVideoFeed
@@ -493,6 +541,7 @@ class VideoFeed extends React.Component<IVideoFeedProps, IVideoFeedState> {
493
541
  onVideoFeedDidStopPictureInPicture={
494
542
  this._onVideoFeedDidStopPictureInPicture
495
543
  }
544
+ onVideoFeedGetFeedId={this._onVideoFeedGetFeedId}
496
545
  mode={mode ?? 'row'}
497
546
  />
498
547
  );