react-native-firework-sdk 2.10.0 → 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 (159) 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/FWLiveStreamModule.kt +2 -0
  26. package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FWVideoShoppingModule.kt +22 -9
  27. package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FireworkSDKModule.kt +78 -122
  28. package/android/src/main/java/com/fireworksdk/bridge/reactnative/utils/FWEventUtils.kt +34 -9
  29. package/android/src/main/java/com/fireworksdk/bridge/utils/FWConfigUtil.kt +13 -0
  30. package/android/src/main/java/com/fireworksdk/bridge/utils/FWFragmentUtil.kt +3 -3
  31. package/android/src/main/java/com/fireworksdk/bridge/utils/FWGlobalDataUtil.kt +5 -2
  32. package/android/src/main/java/com/fireworksdk/bridge/utils/FWModelUtils.kt +64 -0
  33. package/ios/Components/ReplayBadgeConfiguration.swift +12 -0
  34. package/ios/Components/StoryBlock.swift +31 -0
  35. package/ios/Components/StoryBlockConfiguration.swift +1 -0
  36. package/ios/Components/StoryBlockManager.m +24 -0
  37. package/ios/Components/StoryBlockManager.swift +6 -3
  38. package/ios/Components/VideoFeed.swift +18 -3
  39. package/ios/Components/VideoFeedConfiguration.swift +1 -0
  40. package/ios/Components/VideoFeedManager.m +4 -1
  41. package/ios/Components/VideoFeedManager.swift +6 -3
  42. package/ios/Components/VideoPlayerConfiguration.swift +1 -0
  43. package/ios/FWReactNativeSDK.swift +14 -0
  44. package/ios/FireworkSdk.xcodeproj/project.pbxproj +4 -0
  45. package/ios/Modules/FireworkSDKModule/FireworkSDKModule+CTA.swift +17 -15
  46. package/ios/Modules/FireworkSDKModule/FireworkSDKModule+EventTracking.swift +1 -11
  47. package/ios/Modules/FireworkSDKModule/FireworkSDKModule.m +1 -0
  48. package/ios/Modules/FireworkSDKModule/FireworkSDKModule.swift +80 -81
  49. package/ios/Modules/FireworkSDKModule/SDKInitOptions.swift +9 -5
  50. package/ios/Modules/Shopping/ShoppingModule.swift +10 -74
  51. package/lib/commonjs/FireworkSDK.js +30 -25
  52. package/lib/commonjs/FireworkSDK.js.map +1 -1
  53. package/lib/commonjs/VideoShopping.js +6 -12
  54. package/lib/commonjs/VideoShopping.js.map +1 -1
  55. package/lib/commonjs/components/StoryBlock.js +54 -3
  56. package/lib/commonjs/components/StoryBlock.js.map +1 -1
  57. package/lib/commonjs/components/VideoFeed.js +46 -4
  58. package/lib/commonjs/components/VideoFeed.js.map +1 -1
  59. package/lib/commonjs/index.js.map +1 -1
  60. package/lib/commonjs/models/FWNativeErrorAction.js +14 -0
  61. package/lib/commonjs/models/FWNativeErrorAction.js.map +1 -0
  62. package/lib/commonjs/models/ReplayBadgeConfiguration.js +2 -0
  63. package/lib/commonjs/models/ReplayBadgeConfiguration.js.map +1 -0
  64. package/lib/commonjs/modules/FireworkSDKModule.js.map +1 -1
  65. package/lib/module/FireworkSDK.js +29 -25
  66. package/lib/module/FireworkSDK.js.map +1 -1
  67. package/lib/module/VideoShopping.js +6 -12
  68. package/lib/module/VideoShopping.js.map +1 -1
  69. package/lib/module/components/StoryBlock.js +53 -3
  70. package/lib/module/components/StoryBlock.js.map +1 -1
  71. package/lib/module/components/VideoFeed.js +42 -4
  72. package/lib/module/components/VideoFeed.js.map +1 -1
  73. package/lib/module/index.js.map +1 -1
  74. package/lib/module/models/FWNativeErrorAction.js +7 -0
  75. package/lib/module/models/FWNativeErrorAction.js.map +1 -0
  76. package/lib/module/models/ReplayBadgeConfiguration.js +2 -0
  77. package/lib/module/models/ReplayBadgeConfiguration.js.map +1 -0
  78. package/lib/module/modules/FireworkSDKModule.js.map +1 -1
  79. package/lib/typescript/VideoShopping.d.ts +2 -2
  80. package/lib/typescript/components/StoryBlock.d.ts +18 -1
  81. package/lib/typescript/components/VideoFeed.d.ts +7 -1
  82. package/lib/typescript/index.d.ts +2 -2
  83. package/lib/typescript/models/FWEvents.d.ts +26 -3
  84. package/lib/typescript/models/FWNativeErrorAction.d.ts +4 -0
  85. package/lib/typescript/models/FeedItemDetails.d.ts +6 -1
  86. package/lib/typescript/models/ReplayBadgeConfiguration.d.ts +7 -0
  87. package/lib/typescript/models/StoryBlockConfiguration.d.ts +6 -1
  88. package/lib/typescript/models/VideoFeedConfiguration.d.ts +6 -0
  89. package/lib/typescript/models/VideoPlayerConfiguration.d.ts +6 -1
  90. package/lib/typescript/modules/FireworkSDKModule.d.ts +1 -0
  91. package/package.json +1 -5
  92. package/react-native-firework-sdk.podspec +3 -5
  93. package/src/FireworkSDK.ts +27 -24
  94. package/src/VideoShopping.ts +9 -11
  95. package/src/components/StoryBlock.tsx +69 -7
  96. package/src/components/VideoFeed.tsx +57 -12
  97. package/src/index.ts +2 -0
  98. package/src/models/FWEvents.ts +28 -3
  99. package/src/models/FWNativeErrorAction.ts +4 -0
  100. package/src/models/FeedItemDetails.ts +7 -1
  101. package/src/models/ReplayBadgeConfiguration.ts +7 -0
  102. package/src/models/StoryBlockConfiguration.ts +6 -1
  103. package/src/models/VideoFeedConfiguration.ts +6 -0
  104. package/src/models/VideoPlayerConfiguration.ts +6 -1
  105. package/src/modules/FireworkSDKModule.ts +1 -0
  106. package/FireworkVideoUI.xcframework/Info.plist +0 -40
  107. package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/FireworkVideoUI +0 -0
  108. package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Headers/FireworkVideoUI-Swift.h +0 -280
  109. package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Headers/FireworkVideoUI.h +0 -18
  110. package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Info.plist +0 -0
  111. package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios.abi.json +0 -1313
  112. package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios.private.swiftinterface +0 -42
  113. package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
  114. package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios.swiftinterface +0 -42
  115. package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Modules/module.modulemap +0 -11
  116. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/FireworkVideoUI +0 -0
  117. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Headers/FireworkVideoUI-Swift.h +0 -556
  118. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Headers/FireworkVideoUI.h +0 -18
  119. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Info.plist +0 -0
  120. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios-simulator.abi.json +0 -1313
  121. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +0 -42
  122. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
  123. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios-simulator.swiftinterface +0 -42
  124. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/x86_64-apple-ios-simulator.abi.json +0 -1313
  125. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +0 -42
  126. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
  127. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +0 -42
  128. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/module.modulemap +0 -11
  129. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/_CodeSignature/CodeResources +0 -245
  130. package/ios/FireworkVideoUI/FireworkVideoUI/FireworkVideoUI.docc/FireworkVideoUI.md +0 -13
  131. package/ios/FireworkVideoUI/FireworkVideoUI/FireworkVideoUI.h +0 -18
  132. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/AppLanguageManager.swift +0 -154
  133. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/Foundation/Bundle+AppLanguage.swift +0 -73
  134. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/Foundation/NumberFormatter+AppLanguage.swift +0 -25
  135. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/Foundation/URLSession+AppLanguage.swift +0 -52
  136. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/UIKit/UIImageView+AppLanguage.swift +0 -60
  137. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/UIKit/UILabel+AppLanguage.swift +0 -98
  138. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/UIKit/UITextField+AppLanguage.swift +0 -97
  139. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/UIKit/UITextView+AppLanguage.swift +0 -97
  140. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/UIKit/UIView+AppLanguage.swift +0 -71
  141. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/UIKit/UIViewController+AppLanguage.swift +0 -48
  142. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/UIKit/UIWindow+AppLanguage.swift +0 -26
  143. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/LanguageUtil.swift +0 -43
  144. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/LayoutFlip/Extensions/Foundation/NSObject+LayoutFlip.swift +0 -42
  145. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/LayoutFlip/Extensions/UIKit/CALayer+LayoutFlip.swift +0 -149
  146. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/LayoutFlip/Extensions/UIKit/UILabel+LayoutFlip.swift +0 -35
  147. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/LayoutFlip/Extensions/UIKit/UIView+LayoutFlip.swift +0 -202
  148. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/LayoutFlip/LayoutFlipManager.swift +0 -59
  149. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/Utils/Extensions/Foundation/DispatchQueue+Once.swift +0 -32
  150. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/Utils/Extensions/Foundation/String+Base64.swift +0 -18
  151. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/Utils/Extensions/UIKit/UIView+UIHierarchy.swift +0 -46
  152. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/Utils/Swizzle.swift +0 -37
  153. package/ios/FireworkVideoUI/FireworkVideoUI.xcodeproj/project.pbxproj +0 -766
  154. package/ios/FireworkVideoUI/FireworkVideoUI.xcworkspace/contents.xcworkspacedata +0 -10
  155. package/ios/FireworkVideoUI/FireworkVideoUI.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
  156. package/ios/FireworkVideoUI/FireworkVideoUITests/FireworkVideoUITests.swift +0 -37
  157. package/ios/FireworkVideoUI/Podfile +0 -15
  158. package/ios/FireworkVideoUI/Podfile.lock +0 -16
  159. package/ios/scripts/react_native_firework_sdk_pods.rb +0 -27
@@ -181,8 +181,8 @@ class FireworkSDK {
181
181
  this.eventEmitter.addListener(FWEventName.SDKInit, event => {
182
182
  FWLoggerUtil.log(`Receive SDKInit event ${event === null || event === void 0 ? void 0 : event.error}`);
183
183
 
184
- if (this.onSDKInit) {
185
- this.onSDKInit(event !== null && event !== void 0 ? event : {});
184
+ if (this.onSDKInit && event) {
185
+ this.onSDKInit(event);
186
186
  }
187
187
  });
188
188
  this.eventEmitter.addListener(FWEventName.LogMessage, event => {
@@ -192,36 +192,34 @@ class FireworkSDK {
192
192
  FWLoggerUtil.log(`Receive CustomCTAClick url: ${event === null || event === void 0 ? void 0 : event.url}`);
193
193
  FWLoggerUtil.log(`Receive CustomCTAClick callbackId: ${event === null || event === void 0 ? void 0 : event.callbackId}`);
194
194
 
195
- if (this.onCustomCTAClick) {
196
- if (event) {
197
- if (event.callbackId) {
198
- const callbackId = event.callbackId;
199
- delete event.callbackId;
200
-
201
- if (Platform.OS === 'ios') {
202
- event.playerHandler = {
203
- pause: () => FireworkSDKModule.pausePlayer(callbackId),
204
- resume: () => FireworkSDKModule.resumePlayer(callbackId)
205
- };
206
- }
195
+ if (this.onCustomCTAClick && event) {
196
+ if (event.callbackId) {
197
+ const callbackId = event.callbackId;
198
+ delete event.callbackId;
199
+
200
+ if (Platform.OS === 'ios') {
201
+ event.playerHandler = {
202
+ pause: () => FireworkSDKModule.pausePlayer(callbackId),
203
+ resume: () => FireworkSDKModule.resumePlayer(callbackId)
204
+ };
207
205
  }
208
206
  }
209
207
 
210
- this.onCustomCTAClick(event !== null && event !== void 0 ? event : {});
208
+ this.onCustomCTAClick(event);
211
209
  }
212
210
  });
213
211
  this.eventEmitter.addListener(FWEventName.VideoPlayback, event => {
214
212
  FWLoggerUtil.log(`Receive VideoPlayback event eventName: ${event === null || event === void 0 ? void 0 : event.eventName}`);
215
213
 
216
- if (this.onVideoPlayback) {
217
- this.onVideoPlayback(event !== null && event !== void 0 ? event : {});
214
+ if (this.onVideoPlayback && event) {
215
+ this.onVideoPlayback(event);
218
216
  }
219
217
  });
220
218
  this.eventEmitter.addListener(FWEventName.VideoFeedClick, event => {
221
219
  FWLoggerUtil.log(`Receive VideoFeedClick event id: ${event === null || event === void 0 ? void 0 : event.info.id}`);
222
220
 
223
- if (this.onVideoFeedClick) {
224
- this.onVideoFeedClick(event !== null && event !== void 0 ? event : {});
221
+ if (this.onVideoFeedClick && event) {
222
+ this.onVideoFeedClick(event);
225
223
  }
226
224
  });
227
225
 
@@ -259,6 +257,14 @@ class FireworkSDK {
259
257
 
260
258
 
261
259
  async markInitCalled() {
260
+ FWLoggerUtil.log('Call FireworkSDK markInitCalled method');
261
+ const hasCalledSDKInitFromNative = await FireworkSDKModule.markInitCalled();
262
+
263
+ if (hasCalledSDKInitFromNative) {
264
+ await ShoppingModule.init();
265
+ await LiveStreamModule.init();
266
+ }
267
+
262
268
  FWGlobalState.getInstance().resolveSdkInitCalled();
263
269
  }
264
270
  /**
@@ -282,13 +288,11 @@ class FireworkSDK {
282
288
 
283
289
 
284
290
  async trackPurchase(parameters) {
285
- if (Platform.OS === 'ios') {
286
- if (!FWGlobalState.getInstance().sdkInitCalled) {
287
- await FWGlobalState.getInstance().sdkInitCalledPromise;
288
- }
289
-
290
- FireworkSDKModule.trackPurchase(parameters);
291
+ if (!FWGlobalState.getInstance().sdkInitCalled) {
292
+ await FWGlobalState.getInstance().sdkInitCalledPromise;
291
293
  }
294
+
295
+ FireworkSDKModule.trackPurchase(parameters);
292
296
  }
293
297
  /**
294
298
  * Change App level language.
@@ -1 +1 @@
1
- {"version":3,"sources":["FireworkSDK.ts"],"names":["Platform","FWNavigator","LiveStream","FWEventName","FireworkSDKModule","FireworkSDKModuleEventEmitter","LiveStreamModule","ShoppingModule","FWLoggerUtil","VideoShopping","FWGlobalState","FireworkSDK","onVideoFeedClick","_onVideoFeedClick","value","OS","setVideoFeedClickCallbackEnabled","onCustomCTAClick","_onCustomCTAClick","log","setCustomCTAClickEnabled","onVideoPlayback","_onVideoPlayback","setVideoPlaybackEventEnabled","shareBaseURL","_shareBaseURL","updateInternalShareBaseURL","setShareBaseURL","adBadgeConfiguration","_adBadgeConfiguration","valueHasChanged","badgeTextType","backgroundColor","textColor","androidFontInfo","isCustom","typefaceName","eventEmitter","emit","AdBadgeConfigurationUpdated","setAdBadgeConfiguration","appLanguage","_appLanguage","debugLogsEnabled","enabled","videoLaunchBehavior","_videoLaunchBehavior","shopping","_shopping","liveStream","_liveStream","navigator","_navigator","getInstance","_instance","constructor","addListener","SDKInit","event","error","onSDKInit","LogMessage","logNativeMessage","message","CustomCTAClick","url","callbackId","playerHandler","pause","pausePlayer","resume","resumePlayer","VideoPlayback","eventName","VideoFeedClick","info","id","NativeAppLanguageUpdated","language","updateInternalAppLanguage","init","options","videoLaunchBehaviorUpdated","VideoLaunchBehaviorUpdated","resolveSdkInitCalled","markInitCalled","openVideoPlayer","config","sdkInitCalled","sdkInitCalledPromise","trackPurchase","parameters","changeAppLanguage","result","languageChanged","stopFloatingPlayer","AppLanguageUpdated","shareBaseURLChanged","ShareBaseURLUpdated"],"mappings":";;AAAA,SAA6BA,QAA7B,QAA6C,cAA7C;AAEA,OAAOC,WAAP,MAAwB,eAAxB;AACA,OAAOC,UAAP,MAAuB,cAAvB;AAEA,S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iBAAiB,CAACwF,iBAAlB,CAAoCd,QAApC,CAArB;;AAEA,QAAIe,MAAJ,EAAY;AACV,YAAMC,eAAe,GAAG,KAAKpD,YAAL,KAAsBoC,QAA9C;;AACA,UAAI9E,QAAQ,CAACe,EAAT,KAAgB,KAAhB,IAAyB+E,eAA7B,EAA8C;AAC5C,cAAM,KAAK3C,SAAL,CAAe4C,kBAAf,EAAN;AACD;;AACD,WAAKhB,yBAAL,CAA+BD,QAA/B;AACD;;AACD,WAAOe,MAAP;AACD;;AAEOd,EAAAA,yBAAyB,CAACD,QAAD,EAA2B;AAC1D,UAAMhD,eAAe,GAAG,KAAKY,YAAL,KAAsBoC,QAA9C;AACA,SAAKpC,YAAL,GAAoBoC,QAApB;;AACA,QAAIhD,eAAJ,EAAqB;AACnB,WAAKO,YAAL,CAAkBC,IAAlB,CAAuBnC,WAAW,CAAC6F,kBAAnC;AACD;AACF;;AAEOtE,EAAAA,0BAA0B,CAACF,YAAD,EAAwB;AACxD,UAAMyE,mBAAmB,GAAG,KAAKxE,aAAL,KAAuBD,YAAnD;AACA,SAAKC,aAAL,GAAqBD,YAArB;;AACA,QAAIyE,mBAAJ,EAAyB;AACvB,WAAK5D,YAAL,CAAkBC,IAAlB,CAAuBnC,WAAW,CAAC+F,mBAAnC;AACD;AACF;;AAtTe;;gBAAZvF,W;;AAyTN,eAAeA,WAAf","sourcesContent":["import { NativeEventEmitter, Platform } from 'react-native';\n\nimport FWNavigator from './FWNavigator';\nimport LiveStream from './LiveStream';\nimport type AdBadgeConfiguration from './models/AdBadgeConfiguration';\nimport { FWEventName } from './models/FWEventName';\nimport type {\n CustomCTAClickEvent,\n SDKInitEvent,\n VideoFeedClickEvent,\n VideoPlaybackEvent,\n} from './models/FWEvents';\nimport type SDKInitOptions from './models/SDKInitOptions';\nimport type { VideoLaunchBehavior } from './models/SDKInitOptions';\nimport type TrackPurchaseParameters from './models/TrackPurchaseParameters';\nimport FireworkSDKModule, {\n FireworkSDKModuleEventEmitter,\n} from './modules/FireworkSDKModule';\nimport LiveStreamModule from './modules/LiveStreamModule';\nimport ShoppingModule from './modules/ShoppingModule';\nimport FWLoggerUtil from './utils/FWLoggerUtil';\nimport VideoShopping from './VideoShopping';\nimport FWGlobalState from './utils/FWGlobalState';\nimport type OpenVideoPlayerConfiguration from './models/OpenVideoPlayerConfiguration';\n\nexport type SDKInitCallback = (event: SDKInitEvent) => Promise<void> | void;\nexport type CustomCTAClickCallback = (\n event: CustomCTAClickEvent\n) => Promise<void> | void;\nexport type VideoPlaybackCallback = (\n event: VideoPlaybackEvent\n) => Promise<void> | void;\nexport type VideoFeedClickCallback = (\n event: VideoFeedClickEvent\n) => Promise<void> | void;\n\n/**\n * Firework SDK.\n */\nclass FireworkSDK {\n private static _instance?: FireworkSDK;\n\n /**\n * The callback of SDK initialization.\n */\n public onSDKInit?: SDKInitCallback;\n\n /**\n * the callback of clicking Video Feed.\n */\n public get onVideoFeedClick(): VideoFeedClickCallback | undefined {\n return this._onVideoFeedClick;\n }\n public set onVideoFeedClick(value: VideoFeedClickCallback | undefined) {\n this._onVideoFeedClick = value;\n if (Platform.OS === 'ios') {\n FireworkSDKModule.setVideoFeedClickCallbackEnabled(!!value);\n }\n }\n private _onVideoFeedClick?: VideoFeedClickCallback | undefined;\n\n /**\n * The callback of clicking custom CTA.\n */\n public get onCustomCTAClick(): CustomCTAClickCallback | undefined {\n return this._onCustomCTAClick;\n }\n public set onCustomCTAClick(value: CustomCTAClickCallback | undefined) {\n FWLoggerUtil.log(`Set onCustomCTAClick callback ${!!value}`);\n this._onCustomCTAClick = value;\n FireworkSDKModule.setCustomCTAClickEnabled(value ? true : false);\n }\n private _onCustomCTAClick: CustomCTAClickCallback | undefined;\n\n /**\n * The callback of video playback.\n */\n public get onVideoPlayback(): VideoPlaybackCallback | undefined {\n return this._onVideoPlayback;\n }\n public set onVideoPlayback(value: VideoPlaybackCallback | undefined) {\n this._onVideoPlayback = value;\n FireworkSDKModule.setVideoPlaybackEventEnabled(value ? true : false);\n }\n private _onVideoPlayback?: VideoPlaybackCallback | undefined;\n\n /**\n * The global share base URL of the video.\n * The {@link VideoPlayerConfiguration.shareBaseURL} in {@link VideoPlayerConfiguration} will override this.\n */\n public get shareBaseURL(): string | undefined {\n return this._shareBaseURL;\n }\n public set shareBaseURL(value: string | undefined) {\n this.updateInternalShareBaseURL(value);\n FireworkSDKModule.setShareBaseURL(value ?? '');\n }\n private _shareBaseURL: string | undefined;\n\n /**\n * The configuration for ad badges.\n */\n public get adBadgeConfiguration(): AdBadgeConfiguration | undefined {\n return this._adBadgeConfiguration;\n }\n public set adBadgeConfiguration(value: AdBadgeConfiguration | undefined) {\n const valueHasChanged =\n this._adBadgeConfiguration?.badgeTextType !== value?.badgeTextType ||\n this._adBadgeConfiguration?.backgroundColor !== value?.backgroundColor ||\n this._adBadgeConfiguration?.textColor !== value?.textColor ||\n this._adBadgeConfiguration?.androidFontInfo?.isCustom !==\n value?.androidFontInfo?.isCustom ||\n this._adBadgeConfiguration?.androidFontInfo?.typefaceName !==\n value?.androidFontInfo?.typefaceName;\n this._adBadgeConfiguration = value;\n if (valueHasChanged) {\n this.eventEmitter.emit(FWEventName.AdBadgeConfigurationUpdated);\n }\n FireworkSDKModule.setAdBadgeConfiguration(value ?? {});\n }\n private _adBadgeConfiguration: AdBadgeConfiguration | undefined;\n\n public get appLanguage(): string | undefined | null {\n return this._appLanguage;\n }\n private _appLanguage: string | undefined | null;\n\n /**\n * Defaults to false.\n * You can enable debug logs by setting this property to true.\n */\n public get debugLogsEnabled(): boolean {\n return FWLoggerUtil.enabled;\n }\n public set debugLogsEnabled(value: boolean) {\n FWLoggerUtil.enabled = value;\n }\n\n /**\n * Get video launch behavior.\n */\n public get videoLaunchBehavior(): VideoLaunchBehavior | undefined {\n return this._videoLaunchBehavior;\n }\n private _videoLaunchBehavior: VideoLaunchBehavior | undefined;\n\n private get eventEmitter(): NativeEventEmitter {\n return FireworkSDKModuleEventEmitter;\n }\n\n /**\n * Get VideoShopping object.\n */\n public get shopping(): VideoShopping {\n return this._shopping;\n }\n private _shopping: VideoShopping = VideoShopping.getInstance();\n\n /**\n * Get LiveStream object.\n */\n public get liveStream(): LiveStream {\n return this._liveStream;\n }\n private _liveStream: LiveStream = LiveStream.getInstance();\n\n /**\n * Get FWNavigator object.\n */\n public get navigator(): FWNavigator {\n return this._navigator;\n }\n private _navigator: FWNavigator = FWNavigator.getInstance();\n\n /**\n * Get global single instance of FireworkSDK class.\n * @returns FireworkSDK\n */\n public static getInstance() {\n if (!FireworkSDK._instance) {\n FireworkSDK._instance = new FireworkSDK();\n }\n\n return FireworkSDK._instance!;\n }\n\n private constructor() {\n FWLoggerUtil.log('FireworkSDK constructor');\n\n this.eventEmitter.addListener(FWEventName.SDKInit, (event) => {\n FWLoggerUtil.log(`Receive SDKInit event ${event?.error}`);\n\n if (this.onSDKInit) {\n this.onSDKInit(event ?? {});\n }\n });\n\n this.eventEmitter.addListener(FWEventName.LogMessage, (event) => {\n FWLoggerUtil.logNativeMessage(event.message);\n });\n\n this.eventEmitter.addListener(FWEventName.CustomCTAClick, (event) => {\n FWLoggerUtil.log(`Receive CustomCTAClick url: ${event?.url}`);\n FWLoggerUtil.log(\n `Receive CustomCTAClick callbackId: ${event?.callbackId}`\n );\n\n if (this.onCustomCTAClick) {\n if (event) {\n if (event.callbackId) {\n const callbackId = event.callbackId;\n delete event.callbackId;\n if (Platform.OS === 'ios') {\n event.playerHandler = {\n pause: () => FireworkSDKModule.pausePlayer(callbackId),\n resume: () => FireworkSDKModule.resumePlayer(callbackId),\n };\n }\n }\n }\n\n this.onCustomCTAClick(event ?? {});\n }\n });\n\n this.eventEmitter.addListener(FWEventName.VideoPlayback, (event) => {\n FWLoggerUtil.log(\n `Receive VideoPlayback event eventName: ${event?.eventName}`\n );\n\n if (this.onVideoPlayback) {\n this.onVideoPlayback(event ?? {});\n }\n });\n\n this.eventEmitter.addListener(FWEventName.VideoFeedClick, (event) => {\n FWLoggerUtil.log(`Receive VideoFeedClick event id: ${event?.info.id}`);\n\n if (this.onVideoFeedClick) {\n this.onVideoFeedClick(event ?? {});\n }\n });\n\n if (Platform.OS === 'ios') {\n this.eventEmitter.addListener(\n FWEventName.NativeAppLanguageUpdated,\n (event) => {\n FWLoggerUtil.log(\n `Receive NativeAppLanguageUpdated event appLanguage: ${event.appLanguage}`\n );\n const language = event.appLanguage;\n this.updateInternalAppLanguage(language);\n }\n );\n }\n }\n\n /**\n * Initializes Firework SDK.\n * @param {SDKInitOptions?} options\n */\n public async init(options?: SDKInitOptions): Promise<void> {\n FWLoggerUtil.log('Call FireworkSDK init method');\n const videoLaunchBehaviorUpdated =\n this._videoLaunchBehavior !== options?.videoLaunchBehavior;\n this._videoLaunchBehavior = options?.videoLaunchBehavior;\n if (videoLaunchBehaviorUpdated) {\n this.eventEmitter.emit(FWEventName.VideoLaunchBehaviorUpdated);\n }\n await FireworkSDKModule.init(options);\n await ShoppingModule.init();\n await LiveStreamModule.init();\n\n FWGlobalState.getInstance().resolveSdkInitCalled();\n }\n\n /**\n * You only need to call this method when you call init method in native side instead of JS side.\n */\n public async markInitCalled(): Promise<void> {\n FWGlobalState.getInstance().resolveSdkInitCalled();\n }\n\n /**\n * Open Video URL.\n * @param {string} url\n * @param {VideoPlayerConfiguration} config\n */\n public async openVideoPlayer(\n url: string,\n config?: OpenVideoPlayerConfiguration\n ): Promise<void> {\n if (!FWGlobalState.getInstance().sdkInitCalled) {\n await FWGlobalState.getInstance().sdkInitCalledPromise;\n }\n FireworkSDKModule.openVideoPlayer(url, config ?? {});\n }\n\n /**\n * Records the user purchase. Only supported on iOS.\n * @param {TrackPurchaseParameters} parameters\n */\n public async trackPurchase(\n parameters: TrackPurchaseParameters\n ): Promise<void> {\n if (Platform.OS === 'ios') {\n if (!FWGlobalState.getInstance().sdkInitCalled) {\n await FWGlobalState.getInstance().sdkInitCalledPromise;\n }\n FireworkSDKModule.trackPurchase(parameters);\n }\n }\n\n /**\n * Change App level language.\n * @param {string | undefined | null} language Such as en, ar and en-US. If language is undefined or null or empty string, SDK will use system language.\n * @returns {Promise<boolean>} The result of changing app language.\n */\n public async changeAppLanguage(language?: string | null): Promise<boolean> {\n if (!FWGlobalState.getInstance().sdkInitCalled) {\n await FWGlobalState.getInstance().sdkInitCalledPromise;\n }\n\n const result = await FireworkSDKModule.changeAppLanguage(language);\n\n if (result) {\n const languageChanged = this._appLanguage !== language;\n if (Platform.OS === 'ios' && languageChanged) {\n await this.navigator.stopFloatingPlayer();\n }\n this.updateInternalAppLanguage(language);\n }\n return result;\n }\n\n private updateInternalAppLanguage(language?: string | null) {\n const valueHasChanged = this._appLanguage !== language;\n this._appLanguage = language;\n if (valueHasChanged) {\n this.eventEmitter.emit(FWEventName.AppLanguageUpdated);\n }\n }\n\n private updateInternalShareBaseURL(shareBaseURL?: string) {\n const shareBaseURLChanged = this._shareBaseURL !== shareBaseURL;\n this._shareBaseURL = shareBaseURL;\n if (shareBaseURLChanged) {\n this.eventEmitter.emit(FWEventName.ShareBaseURLUpdated);\n }\n }\n}\n\nexport default FireworkSDK;\n"]}
1
+ {"version":3,"sources":["FireworkSDK.ts"],"names":["Platform","FWNavigator","LiveStream","FWEventName","FireworkSDKModule","FireworkSDKModuleEventEmitter","LiveStreamModule","ShoppingModule","FWLoggerUtil","VideoShopping","FWGlobalState","FireworkSDK","onVideoFeedClick","_onVideoFeedClick","value","OS","setVideoFeedClickCallbackEnabled","onCustomCTAClick","_onCustomCTAClick","log","setCustomCTAClickEnabled","onVideoPlayback","_onVideoPlayback","setVideoPlaybackEventEnabled","shareBaseURL","_shareBaseURL","updateInternalShareBaseURL","setShareBaseURL","adBadgeConfiguration","_adBadgeConfiguration","valueHasChanged","badgeTextType","backgroundColor","textColor","androidFontInfo","isCustom","typefaceName","eventEmitter","emit","AdBadgeConfigurationUpdated","setAdBadgeConfiguration","appLanguage","_appLanguage","debugLogsEnabled","enabled","videoLaunchBehavior","_videoLaunchBehavior","shopping","_shopping","liveStream","_liveStream","navigator","_navigator","getInstance","_instance","constructor","addListener","SDKInit","event","error","onSDKInit","LogMessage","logNativeMessage","message","CustomCTAClick","url","callbackId","playerHandler","pause","pausePlayer","resume","resumePlayer","VideoPlayback","eventName","VideoFeedClick","info","id","NativeAppLanguageUpdated","language","updateInternalAppLanguage","init","options","videoLaunchBehaviorUpdated","VideoLaunchBehaviorUpdated","resolveSdkInitCalled","markInitCalled","hasCalledSDKInitFromNative","openVideoPlayer","config","sdkInitCalled","sdkInitCalledPromise","trackPurchase","parameters","changeAppLanguage","result","languageChanged","stopFloatingPlayer","AppLanguageUpdated","shareBaseURLChanged","ShareBaseURLUpdated"],"mappings":";;AAAA,SAA6BA,QAA7B,QAA6C,cAA7C;AAEA,OAAOC,WAAP,MAAwB,eAAxB;AACA,OAAOC,UAAP,MAAuB,cAAvB;AAEA,SAASC,WAAT,QAA4B,sBAA5B;AAUA,OAAOC,iBAAP,IACEC,6BADF,QAEO,6BAFP;AAGA,OAAOC,gBAAP,MAA6B,4BAA7B;AACA,OAAOC,cAAP,MAA2B,0BAA3B;AACA,OAAOC,YAAP,MAAyB,sBAAzB;AACA,OAAOC,aAAP,MAA0B,iBAA1B;AACA,OAAOC,aAAP,MAA0B,uBAA1B;;AAcA;AACA;AACA;AACA,MAAMC,WAAN,CAAkB;AAGhB;AACF;AACA;;AAGE;AACF;AACA;AAC6B,MAAhBC,gBAAgB,GAAuC;AAChE,WAAO,KAAKC,iBAAZ;AACD;;AAC0B,MAAhBD,gBAAgB,CAACE,KAAD,EAA4C;AACrE,SAAKD,iBAAL,GAAyBC,KAAzB;;AACA,QAAId,QAAQ,CAACe,EAAT,KAAgB,KAApB,EAA2B;AACzBX,MAAAA,iBAAiB,CAACY,gCAAlB,CAAmD,CAAC,CAACF,KAArD;AACD;AACF;;AAGD;AACF;AACA;AAC6B,MAAhBG,gBAAgB,GAAuC;AAChE,WAAO,KAAKC,iBAAZ;AACD;;AAC0B,MAAhBD,gBAAgB,CAACH,KAAD,EAA4C;AACrEN,IAA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AAqBD,YAArB;;AACA,QAAI0E,mBAAJ,EAAyB;AACvB,WAAK7D,YAAL,CAAkBC,IAAlB,CAAuBnC,WAAW,CAACgG,mBAAnC;AACD;AACF;;AAzTe;;gBAAZxF,W;;AA4TN,eAAeA,WAAf","sourcesContent":["import { NativeEventEmitter, Platform } from 'react-native';\n\nimport FWNavigator from './FWNavigator';\nimport LiveStream from './LiveStream';\nimport type AdBadgeConfiguration from './models/AdBadgeConfiguration';\nimport { FWEventName } from './models/FWEventName';\nimport type {\n CustomCTAClickEvent,\n SDKInitEvent,\n VideoFeedClickEvent,\n VideoPlaybackEvent,\n} from './models/FWEvents';\nimport type SDKInitOptions from './models/SDKInitOptions';\nimport type { VideoLaunchBehavior } from './models/SDKInitOptions';\nimport type TrackPurchaseParameters from './models/TrackPurchaseParameters';\nimport FireworkSDKModule, {\n FireworkSDKModuleEventEmitter,\n} from './modules/FireworkSDKModule';\nimport LiveStreamModule from './modules/LiveStreamModule';\nimport ShoppingModule from './modules/ShoppingModule';\nimport FWLoggerUtil from './utils/FWLoggerUtil';\nimport VideoShopping from './VideoShopping';\nimport FWGlobalState from './utils/FWGlobalState';\nimport type OpenVideoPlayerConfiguration from './models/OpenVideoPlayerConfiguration';\n\nexport type SDKInitCallback = (event: SDKInitEvent) => Promise<void> | void;\nexport type CustomCTAClickCallback = (\n event: CustomCTAClickEvent\n) => Promise<void> | void;\nexport type VideoPlaybackCallback = (\n event: VideoPlaybackEvent\n) => Promise<void> | void;\nexport type VideoFeedClickCallback = (\n event: VideoFeedClickEvent\n) => Promise<void> | void;\n\n/**\n * Firework SDK.\n */\nclass FireworkSDK {\n private static _instance?: FireworkSDK;\n\n /**\n * The callback of SDK initialization.\n */\n public onSDKInit?: SDKInitCallback;\n\n /**\n * the callback of clicking Video Feed.\n */\n public get onVideoFeedClick(): VideoFeedClickCallback | undefined {\n return this._onVideoFeedClick;\n }\n public set onVideoFeedClick(value: VideoFeedClickCallback | undefined) {\n this._onVideoFeedClick = value;\n if (Platform.OS === 'ios') {\n FireworkSDKModule.setVideoFeedClickCallbackEnabled(!!value);\n }\n }\n private _onVideoFeedClick?: VideoFeedClickCallback | undefined;\n\n /**\n * The callback of clicking custom CTA.\n */\n public get onCustomCTAClick(): CustomCTAClickCallback | undefined {\n return this._onCustomCTAClick;\n }\n public set onCustomCTAClick(value: CustomCTAClickCallback | undefined) {\n FWLoggerUtil.log(`Set onCustomCTAClick callback ${!!value}`);\n this._onCustomCTAClick = value;\n FireworkSDKModule.setCustomCTAClickEnabled(value ? true : false);\n }\n private _onCustomCTAClick: CustomCTAClickCallback | undefined;\n\n /**\n * The callback of video playback.\n */\n public get onVideoPlayback(): VideoPlaybackCallback | undefined {\n return this._onVideoPlayback;\n }\n public set onVideoPlayback(value: VideoPlaybackCallback | undefined) {\n this._onVideoPlayback = value;\n FireworkSDKModule.setVideoPlaybackEventEnabled(value ? true : false);\n }\n private _onVideoPlayback?: VideoPlaybackCallback | undefined;\n\n /**\n * The global share base URL of the video.\n * The {@link VideoPlayerConfiguration.shareBaseURL} in {@link VideoPlayerConfiguration} will override this.\n */\n public get shareBaseURL(): string | undefined {\n return this._shareBaseURL;\n }\n public set shareBaseURL(value: string | undefined) {\n this.updateInternalShareBaseURL(value);\n FireworkSDKModule.setShareBaseURL(value ?? '');\n }\n private _shareBaseURL: string | undefined;\n\n /**\n * The configuration for ad badges.\n */\n public get adBadgeConfiguration(): AdBadgeConfiguration | undefined {\n return this._adBadgeConfiguration;\n }\n public set adBadgeConfiguration(value: AdBadgeConfiguration | undefined) {\n const valueHasChanged =\n this._adBadgeConfiguration?.badgeTextType !== value?.badgeTextType ||\n this._adBadgeConfiguration?.backgroundColor !== value?.backgroundColor ||\n this._adBadgeConfiguration?.textColor !== value?.textColor ||\n this._adBadgeConfiguration?.androidFontInfo?.isCustom !==\n value?.androidFontInfo?.isCustom ||\n this._adBadgeConfiguration?.androidFontInfo?.typefaceName !==\n value?.androidFontInfo?.typefaceName;\n this._adBadgeConfiguration = value;\n if (valueHasChanged) {\n this.eventEmitter.emit(FWEventName.AdBadgeConfigurationUpdated);\n }\n FireworkSDKModule.setAdBadgeConfiguration(value ?? {});\n }\n private _adBadgeConfiguration: AdBadgeConfiguration | undefined;\n\n public get appLanguage(): string | undefined | null {\n return this._appLanguage;\n }\n private _appLanguage: string | undefined | null;\n\n /**\n * Defaults to false.\n * You can enable debug logs by setting this property to true.\n */\n public get debugLogsEnabled(): boolean {\n return FWLoggerUtil.enabled;\n }\n public set debugLogsEnabled(value: boolean) {\n FWLoggerUtil.enabled = value;\n }\n\n /**\n * Get video launch behavior.\n */\n public get videoLaunchBehavior(): VideoLaunchBehavior | undefined {\n return this._videoLaunchBehavior;\n }\n private _videoLaunchBehavior: VideoLaunchBehavior | undefined;\n\n private get eventEmitter(): NativeEventEmitter {\n return FireworkSDKModuleEventEmitter;\n }\n\n /**\n * Get VideoShopping object.\n */\n public get shopping(): VideoShopping {\n return this._shopping;\n }\n private _shopping: VideoShopping = VideoShopping.getInstance();\n\n /**\n * Get LiveStream object.\n */\n public get liveStream(): LiveStream {\n return this._liveStream;\n }\n private _liveStream: LiveStream = LiveStream.getInstance();\n\n /**\n * Get FWNavigator object.\n */\n public get navigator(): FWNavigator {\n return this._navigator;\n }\n private _navigator: FWNavigator = FWNavigator.getInstance();\n\n /**\n * Get global single instance of FireworkSDK class.\n * @returns FireworkSDK\n */\n public static getInstance() {\n if (!FireworkSDK._instance) {\n FireworkSDK._instance = new FireworkSDK();\n }\n\n return FireworkSDK._instance!;\n }\n\n private constructor() {\n FWLoggerUtil.log('FireworkSDK constructor');\n\n this.eventEmitter.addListener(FWEventName.SDKInit, (event) => {\n FWLoggerUtil.log(`Receive SDKInit event ${event?.error}`);\n\n if (this.onSDKInit && event) {\n this.onSDKInit(event);\n }\n });\n\n this.eventEmitter.addListener(FWEventName.LogMessage, (event) => {\n FWLoggerUtil.logNativeMessage(event.message);\n });\n\n this.eventEmitter.addListener(FWEventName.CustomCTAClick, (event) => {\n FWLoggerUtil.log(`Receive CustomCTAClick url: ${event?.url}`);\n FWLoggerUtil.log(\n `Receive CustomCTAClick callbackId: ${event?.callbackId}`\n );\n\n if (this.onCustomCTAClick && event) {\n if (event.callbackId) {\n const callbackId = event.callbackId;\n delete event.callbackId;\n if (Platform.OS === 'ios') {\n event.playerHandler = {\n pause: () => FireworkSDKModule.pausePlayer(callbackId),\n resume: () => FireworkSDKModule.resumePlayer(callbackId),\n };\n }\n }\n this.onCustomCTAClick(event);\n }\n });\n\n this.eventEmitter.addListener(FWEventName.VideoPlayback, (event) => {\n FWLoggerUtil.log(\n `Receive VideoPlayback event eventName: ${event?.eventName}`\n );\n\n if (this.onVideoPlayback && event) {\n this.onVideoPlayback(event);\n }\n });\n\n this.eventEmitter.addListener(FWEventName.VideoFeedClick, (event) => {\n FWLoggerUtil.log(`Receive VideoFeedClick event id: ${event?.info.id}`);\n\n if (this.onVideoFeedClick && event) {\n this.onVideoFeedClick(event);\n }\n });\n\n if (Platform.OS === 'ios') {\n this.eventEmitter.addListener(\n FWEventName.NativeAppLanguageUpdated,\n (event) => {\n FWLoggerUtil.log(\n `Receive NativeAppLanguageUpdated event appLanguage: ${event.appLanguage}`\n );\n const language = event.appLanguage;\n this.updateInternalAppLanguage(language);\n }\n );\n }\n }\n\n /**\n * Initializes Firework SDK.\n * @param {SDKInitOptions?} options\n */\n public async init(options?: SDKInitOptions): Promise<void> {\n FWLoggerUtil.log('Call FireworkSDK init method');\n const videoLaunchBehaviorUpdated =\n this._videoLaunchBehavior !== options?.videoLaunchBehavior;\n this._videoLaunchBehavior = options?.videoLaunchBehavior;\n if (videoLaunchBehaviorUpdated) {\n this.eventEmitter.emit(FWEventName.VideoLaunchBehaviorUpdated);\n }\n await FireworkSDKModule.init(options);\n await ShoppingModule.init();\n await LiveStreamModule.init();\n\n FWGlobalState.getInstance().resolveSdkInitCalled();\n }\n\n /**\n * You only need to call this method when you call init method in native side instead of JS side.\n */\n public async markInitCalled(): Promise<void> {\n FWLoggerUtil.log('Call FireworkSDK markInitCalled method');\n\n const hasCalledSDKInitFromNative = await FireworkSDKModule.markInitCalled();\n if (hasCalledSDKInitFromNative) {\n await ShoppingModule.init();\n await LiveStreamModule.init();\n }\n\n FWGlobalState.getInstance().resolveSdkInitCalled();\n }\n\n /**\n * Open Video URL.\n * @param {string} url\n * @param {VideoPlayerConfiguration} config\n */\n public async openVideoPlayer(\n url: string,\n config?: OpenVideoPlayerConfiguration\n ): Promise<void> {\n if (!FWGlobalState.getInstance().sdkInitCalled) {\n await FWGlobalState.getInstance().sdkInitCalledPromise;\n }\n FireworkSDKModule.openVideoPlayer(url, config ?? {});\n }\n\n /**\n * Records the user purchase. Only supported on iOS.\n * @param {TrackPurchaseParameters} parameters\n */\n public async trackPurchase(\n parameters: TrackPurchaseParameters\n ): Promise<void> {\n if (!FWGlobalState.getInstance().sdkInitCalled) {\n await FWGlobalState.getInstance().sdkInitCalledPromise;\n }\n FireworkSDKModule.trackPurchase(parameters);\n }\n\n /**\n * Change App level language.\n * @param {string | undefined | null} language Such as en, ar and en-US. If language is undefined or null or empty string, SDK will use system language.\n * @returns {Promise<boolean>} The result of changing app language.\n */\n public async changeAppLanguage(language?: string | null): Promise<boolean> {\n if (!FWGlobalState.getInstance().sdkInitCalled) {\n await FWGlobalState.getInstance().sdkInitCalledPromise;\n }\n\n const result = await FireworkSDKModule.changeAppLanguage(language);\n\n if (result) {\n const languageChanged = this._appLanguage !== language;\n if (Platform.OS === 'ios' && languageChanged) {\n await this.navigator.stopFloatingPlayer();\n }\n this.updateInternalAppLanguage(language);\n }\n return result;\n }\n\n private updateInternalAppLanguage(language?: string | null) {\n const valueHasChanged = this._appLanguage !== language;\n this._appLanguage = language;\n if (valueHasChanged) {\n this.eventEmitter.emit(FWEventName.AppLanguageUpdated);\n }\n }\n\n private updateInternalShareBaseURL(shareBaseURL?: string) {\n const shareBaseURLChanged = this._shareBaseURL !== shareBaseURL;\n this._shareBaseURL = shareBaseURL;\n if (shareBaseURLChanged) {\n this.eventEmitter.emit(FWEventName.ShareBaseURLUpdated);\n }\n }\n}\n\nexport default FireworkSDK;\n"]}
@@ -142,9 +142,9 @@ class VideoShopping {
142
142
  FWLoggerUtil.log(`Receive ShoppingCTA event productId: ${event === null || event === void 0 ? void 0 : event.productId} unitId: ${event === null || event === void 0 ? void 0 : event.unitId} url: ${event === null || event === void 0 ? void 0 : event.url}`);
143
143
  this.handleShoppingCTAEvent(event);
144
144
  });
145
- this.eventEmitter.addListener(FWEventName.ClickCartIcon, () => {
145
+ this.eventEmitter.addListener(FWEventName.ClickCartIcon, event => {
146
146
  FWLoggerUtil.log('Receive ClickCartIcon event');
147
- this.handleClickCartIconEvent();
147
+ this.handleClickCartIconEvent(event);
148
148
  });
149
149
  this.eventEmitter.addListener(FWEventName.UpdateProductDetails, event => {
150
150
  FWLoggerUtil.log(`Receive UpdateProductDetails event productIds: ${event === null || event === void 0 ? void 0 : event.productIds}`);
@@ -159,12 +159,6 @@ class VideoShopping {
159
159
  FWLoggerUtil.log(`Receive CustomProductCardTap event url: ${event === null || event === void 0 ? void 0 : event.url}`);
160
160
 
161
161
  if (event) {
162
- if (!event.video) {
163
- event.video = {
164
- videoId: ''
165
- };
166
- }
167
-
168
162
  if (event.callbackId) {
169
163
  const callbackId = event.callbackId;
170
164
  delete event.callbackId;
@@ -176,9 +170,9 @@ class VideoShopping {
176
170
  };
177
171
  }
178
172
  }
179
- }
180
173
 
181
- this.handleCustomProductCardTapEvent(event !== null && event !== void 0 ? event : {});
174
+ this.handleCustomProductCardTapEvent(event);
175
+ }
182
176
  });
183
177
  }
184
178
  /**
@@ -218,9 +212,9 @@ class VideoShopping {
218
212
  }
219
213
  }
220
214
 
221
- async handleClickCartIconEvent() {
215
+ async handleClickCartIconEvent(event) {
222
216
  if (this.onCustomClickCartIcon) {
223
- this.onCustomClickCartIcon();
217
+ this.onCustomClickCartIcon(event);
224
218
  }
225
219
  }
226
220
 
@@ -1 +1 @@
1
- {"version":3,"sources":["VideoShopping.ts"],"names":["Platform","FWEventName","ShoppingModule","ShoppingModuleEventEmitter","FWLoggerUtil","FWGlobalState","VideoShopping","onCustomClickLinkButton","_onCustomClickLinkButton","value","setCustomClickLinkButtonEnabled","onCustomTapProductCard","_onCustomTapProductCard","setCustomTapProductCardEnabled","cartIconVisible","_cartIconVisible","getInstance","sdkInitCalled","setCartIconVisible","sdkInitCalledPromise","then","productInfoViewConfiguration","_productInfoViewConfiguration","valueHasChanged","updateNativeProductInfoViewConfiguration","setProductInfoViewConfiguration","eventEmitter","emit","ProductInfoViewConfigurationUpdated","log","_instance","constructor","addListener","ShoppingCTAButtonClick","event","productId","unitId","url","handleShoppingCTAEvent","ClickCartIcon","handleClickCartIconEvent","UpdateProductDetails","productIds","handleUpdateProductDetailsEvent","LogMessage","CustomLinkButtonClick","handleCustomLinkButtonClickEvent","CustomProductCardTap","video","videoId","callbackId","OS","playerHandler","pause","pausePlayer","resume","resumePlayer","handleCustomProductCardTapEvent","setCartItemCount","count","onShoppingCTA","result","updateShoppingCTAResult","clearCallbackId","onCustomClickCartIcon","onUpdateProductDetails","productList","map","product","length","updateVideoProducts"],"mappings":";;AAAA,SAA6BA,QAA7B,QAA6C,cAA7C;AAEA,SAASC,WAAT,QAA4B,sBAA5B;AASA,OAAOC,cAAP,IACEC,0BADF,QAEO,0BAFP;AAGA,OAAOC,YAAP,MAAyB,sBAAzB;AAEA,OAAOC,aAAP,MAA0B,uBAA1B;;AAuBA;AACA;AACA;AACA,MAAMC,aAAN,CAAoB;AAGlB;AACF;AACA;AACA;;AAGE;AACF;AACA;AACA;AACA;AACA;;AAGE;AACF;AACA;AACA;AACA;;AAGE;AACF;AACA;AACA;AACA;AACA;AACA;AACoC,MAAvBC,uBAAuB,GAEpB;AACZ,WAAO,KAAKC,wBAAZ;AACD;;AACiC,MAAvBD,uBAAuB,CAChCE,KADgC,EAEhC;AACA,SAAKD,wBAAL,GAAgCC,KAAhC;AACAP,IAAAA,cAAc,CAACQ,+BAAf,CAA+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BAAd5B,a;;AA4SN,eAAeA,aAAf","sourcesContent":["import { NativeEventEmitter, Platform } from 'react-native';\n\nimport { FWEventName } from './models/FWEventName';\nimport type {\n CustomClickLinkButtonEvent,\n CustomTapProductCardEvent,\n ShoppingCTAEvent,\n UpdateProductDetailsEvent,\n} from './models/FWEvents';\nimport type Product from './models/Product';\nimport type ProductInfoViewConfiguration from './models/ProductInfoViewConfiguration';\nimport ShoppingModule, {\n ShoppingModuleEventEmitter,\n} from './modules/ShoppingModule';\nimport FWLoggerUtil from './utils/FWLoggerUtil';\nimport type ShoppingCTAResult from './models/ShoppingCTAResult';\nimport FWGlobalState from './utils/FWGlobalState';\n\nexport type ShoppingCTACallback = (\n event: ShoppingCTAEvent\n) => Promise<ShoppingCTAResult> | ShoppingCTAResult;\n\nexport type CustomClickCartIconCallback = () => Promise<void> | void;\n\nexport type UpdateProductDetailsCallbackResult = Product[] | undefined | null;\nexport type UpdateProductDetailsCallback = (\n event: UpdateProductDetailsEvent\n) =>\n | Promise<UpdateProductDetailsCallbackResult>\n | UpdateProductDetailsCallbackResult;\n\nexport type CustomClickLinkButtonCallback = (\n event: CustomClickLinkButtonEvent\n) => Promise<void> | void;\n\nexport type CustomTapProductCardCallback = (\n event: CustomTapProductCardEvent\n) => Promise<void> | void;\n\n/**\n * The entry class of video shopping.\n */\nclass VideoShopping {\n private static _instance?: VideoShopping;\n\n /**\n * This callback is triggered when the user clicks the \"Add to cart\" or \"Shop now\" button.\n * The host app can return a ShoppingCTAResult object to tell SDK how to handle the result.\n */\n public onShoppingCTA?: ShoppingCTACallback;\n\n /**\n * This callback is triggered when the user clicks the shopping cart icon.\n *\n * The host app can customize the click event processing logic of\n * the shopping cart icon by setting the callback.\n */\n public onCustomClickCartIcon?: CustomClickCartIconCallback | undefined;\n\n /**\n * This callback is triggered when the video will be shown.\n *\n * The host app can return a Product list to update the latest product information.\n */\n public onUpdateProductDetails?: UpdateProductDetailsCallback;\n\n /**\n * This callback is triggered when the user clicks\n * the link button next to Add to cart button.\n *\n * The host app can customize the click event processing logic of\n * the link button by setting the callback.\n */\n public get onCustomClickLinkButton():\n | CustomClickLinkButtonCallback\n | undefined {\n return this._onCustomClickLinkButton;\n }\n public set onCustomClickLinkButton(\n value: CustomClickLinkButtonCallback | undefined\n ) {\n this._onCustomClickLinkButton = value;\n ShoppingModule.setCustomClickLinkButtonEnabled(!!value);\n }\n private _onCustomClickLinkButton?: CustomClickLinkButtonCallback | undefined;\n\n /**\n * This callback is triggered when the user clicks product card.\n *\n * The host app can customize the tap event processing logic of\n * the product card by setting the callback.\n */\n public get onCustomTapProductCard():\n | CustomTapProductCardCallback\n | undefined {\n return this._onCustomTapProductCard;\n }\n public set onCustomTapProductCard(\n value: CustomTapProductCardCallback | undefined\n ) {\n this._onCustomTapProductCard = value;\n ShoppingModule.setCustomTapProductCardEnabled(!!value);\n }\n private _onCustomTapProductCard?: CustomTapProductCardCallback | undefined;\n\n /**\n * Defaults to true.\n * You can hide the cart icon by setting this property to false.\n */\n public get cartIconVisible(): boolean {\n return this._cartIconVisible;\n }\n public set cartIconVisible(value: boolean) {\n this._cartIconVisible = value;\n if (FWGlobalState.getInstance().sdkInitCalled) {\n ShoppingModule.setCartIconVisible(value);\n } else {\n FWGlobalState.getInstance().sdkInitCalledPromise.then(() => {\n ShoppingModule.setCartIconVisible(value);\n });\n }\n }\n private _cartIconVisible: boolean = true;\n\n /**\n * The configuration of product info view.\n * Please refer to {@link ProductInfoViewConfiguration} for more details.\n */\n public get productInfoViewConfiguration():\n | ProductInfoViewConfiguration\n | undefined {\n return this._productInfoViewConfiguration;\n }\n\n public set productInfoViewConfiguration(\n value: ProductInfoViewConfiguration | undefined\n ) {\n const valueHasChanged = this._productInfoViewConfiguration !== value;\n this._productInfoViewConfiguration = value;\n if (FWGlobalState.getInstance().sdkInitCalled) {\n this.updateNativeProductInfoViewConfiguration(value, valueHasChanged);\n } else {\n FWGlobalState.getInstance().sdkInitCalledPromise.then(() => {\n this.updateNativeProductInfoViewConfiguration(value, valueHasChanged);\n });\n }\n }\n\n private updateNativeProductInfoViewConfiguration(\n value: ProductInfoViewConfiguration | undefined,\n valueHasChanged: Boolean\n ) {\n ShoppingModule.setProductInfoViewConfiguration(value ?? {}).then(() => {\n if (valueHasChanged) {\n this.eventEmitter.emit(FWEventName.ProductInfoViewConfigurationUpdated);\n FWLoggerUtil.log('eventEmitter ProductInfoViewConfigurationUpdated');\n }\n });\n }\n\n private _productInfoViewConfiguration?:\n | ProductInfoViewConfiguration\n | undefined;\n\n private get eventEmitter(): NativeEventEmitter {\n return ShoppingModuleEventEmitter;\n }\n\n public static getInstance() {\n FWLoggerUtil.log('VideoShopping constructor');\n if (!VideoShopping._instance) {\n VideoShopping._instance = new VideoShopping();\n }\n\n return VideoShopping._instance!;\n }\n\n private constructor() {\n this.eventEmitter.addListener(\n FWEventName.ShoppingCTAButtonClick,\n (event) => {\n FWLoggerUtil.log(\n `Receive ShoppingCTA event productId: ${event?.productId} unitId: ${event?.unitId} url: ${event?.url}`\n );\n this.handleShoppingCTAEvent(event);\n }\n );\n\n this.eventEmitter.addListener(FWEventName.ClickCartIcon, () => {\n FWLoggerUtil.log('Receive ClickCartIcon event');\n this.handleClickCartIconEvent();\n });\n\n this.eventEmitter.addListener(FWEventName.UpdateProductDetails, (event) => {\n FWLoggerUtil.log(\n `Receive UpdateProductDetails event productIds: ${event?.productIds}`\n );\n this.handleUpdateProductDetailsEvent(event);\n });\n\n this.eventEmitter.addListener(FWEventName.LogMessage, () => {});\n\n this.eventEmitter.addListener(\n FWEventName.CustomLinkButtonClick,\n (event) => {\n FWLoggerUtil.log(\n `Receive CustomLinkButtonClick event url: ${event?.url}`\n );\n this.handleCustomLinkButtonClickEvent(event);\n }\n );\n\n this.eventEmitter.addListener(FWEventName.CustomProductCardTap, (event) => {\n FWLoggerUtil.log(`Receive CustomProductCardTap event url: ${event?.url}`);\n if (event) {\n if (!event.video) {\n event.video = { videoId: '' };\n }\n\n if (event.callbackId) {\n const callbackId = event.callbackId;\n delete event.callbackId;\n if (Platform.OS === 'ios') {\n event.playerHandler = {\n pause: () => ShoppingModule.pausePlayer(callbackId),\n resume: () => ShoppingModule.resumePlayer(callbackId),\n };\n }\n }\n }\n\n this.handleCustomProductCardTapEvent(event ?? {});\n });\n }\n\n /**\n *\n * @param {number} count The number of items in the host app cart.\n * The count should be greater than or equal to 0.\n * We just use count to show or hide red indicator on the cart icon.\n * If cound > 0, we will show the red indicator on the cart icon.\n * Otherwise, we will hide the red indicator on the cart icon.\n */\n public async setCartItemCount(count: number): Promise<void> {\n if (!FWGlobalState.getInstance().sdkInitCalled) {\n await FWGlobalState.getInstance().sdkInitCalledPromise;\n }\n ShoppingModule.setCartItemCount(count);\n }\n\n private async handleShoppingCTAEvent(event: any) {\n const callbackId = event.callbackId;\n delete event.callbackId;\n\n if (this.onShoppingCTA) {\n const result = await this.onShoppingCTA(event as ShoppingCTAEvent);\n if (callbackId) {\n ShoppingModule.updateShoppingCTAResult(result, callbackId);\n }\n } else {\n if (callbackId) {\n if (Platform.OS === 'ios') {\n ShoppingModule.clearCallbackId(\n callbackId,\n FWEventName.ShoppingCTAButtonClick\n );\n }\n }\n }\n }\n\n private async handleClickCartIconEvent() {\n if (this.onCustomClickCartIcon) {\n this.onCustomClickCartIcon();\n }\n }\n\n private async handleUpdateProductDetailsEvent(event: any) {\n const callbackId = event.callbackId;\n delete event.callbackId;\n if (this.onUpdateProductDetails) {\n FWLoggerUtil.log(\n `Call onUpdateProductDetails callback productIds: ${event.productIds} callbackId: ${callbackId}`\n );\n const productList = await this.onUpdateProductDetails(\n event as UpdateProductDetailsEvent\n );\n\n const productIds = (productList || []).map(\n (product) => product.productId ?? ''\n );\n\n FWLoggerUtil.log(\n `Get result from onUpdateProductDetails callback productIds: ${productIds} productListLength: ${\n (productList || []).length\n }`\n );\n\n if (productList) {\n if (callbackId) {\n ShoppingModule.updateVideoProducts(productList, callbackId);\n }\n } else {\n if (callbackId) {\n if (Platform.OS === 'ios') {\n ShoppingModule.clearCallbackId(\n callbackId,\n FWEventName.UpdateProductDetails\n );\n }\n }\n }\n } else {\n FWLoggerUtil.log('onUpdateProductDetails callback is not set.');\n if (callbackId) {\n if (Platform.OS === 'ios') {\n ShoppingModule.clearCallbackId(\n callbackId,\n FWEventName.UpdateProductDetails\n );\n }\n }\n }\n }\n\n private async handleCustomLinkButtonClickEvent(\n event: CustomClickLinkButtonEvent\n ) {\n if (this.onCustomClickLinkButton) {\n this.onCustomClickLinkButton(event);\n }\n }\n\n private async handleCustomProductCardTapEvent(\n event: CustomTapProductCardEvent\n ) {\n if (this.onCustomTapProductCard) {\n this.onCustomTapProductCard(event);\n }\n }\n}\n\nexport default VideoShopping;\n"]}
1
+ {"version":3,"sources":["VideoShopping.ts"],"names":["Platform","FWEventName","ShoppingModule","ShoppingModuleEventEmitter","FWLoggerUtil","FWGlobalState","VideoShopping","onCustomClickLinkButton","_onCustomClickLinkButton","value","setCustomClickLinkButtonEnabled","onCustomTapProductCard","_onCustomTapProductCard","setCustomTapProductCardEnabled","cartIconVisible","_cartIconVisible","getInstance","sdkInitCalled","setCartIconVisible","sdkInitCalledPromise","then","productInfoViewConfiguration","_productInfoViewConfiguration","valueHasChanged","updateNativeProductInfoViewConfiguration","setProductInfoViewConfiguration","eventEmitter","emit","ProductInfoViewConfigurationUpdated","log","_instance","constructor","addListener","ShoppingCTAButtonClick","event","productId","unitId","url","handleShoppingCTAEvent","ClickCartIcon","handleClickCartIconEvent","UpdateProductDetails","productIds","handleUpdateProductDetailsEvent","LogMessage","CustomLinkButtonClick","handleCustomLinkButtonClickEvent","CustomProductCardTap","callbackId","OS","playerHandler","pause","pausePlayer","resume","resumePlayer","handleCustomProductCardTapEvent","setCartItemCount","count","onShoppingCTA","result","updateShoppingCTAResult","clearCallbackId","onCustomClickCartIcon","onUpdateProductDetails","productList","map","product","length","updateVideoProducts"],"mappings":";;AAAA,SAA6BA,QAA7B,QAA6C,cAA7C;AAEA,SAASC,WAAT,QAA4B,s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EE/C,WAAW,CAACwC,oBAFd;AAID;AACF;AACF;AACF;;AAE6C,QAAhCK,gCAAgC,CAC5CZ,KAD4C,EAE5C;AACA,QAAI,KAAK3B,uBAAT,EAAkC;AAChC,WAAKA,uBAAL,CAA6B2B,KAA7B;AACD;AACF;;AAE4C,QAA/BqB,+BAA+B,CAC3CrB,KAD2C,EAE3C;AACA,QAAI,KAAKvB,sBAAT,EAAiC;AAC/B,WAAKA,sBAAL,CAA4BuB,KAA5B;AACD;AACF;;AApSiB;;gBAAd5B,a;;AAuSN,eAAeA,aAAf","sourcesContent":["import { NativeEventEmitter, Platform } from 'react-native';\n\nimport { FWEventName } from './models/FWEventName';\nimport type {\n CustomClickCartIconEvent,\n CustomClickLinkButtonEvent,\n CustomTapProductCardEvent,\n ShoppingCTAEvent,\n UpdateProductDetailsEvent,\n} from './models/FWEvents';\nimport type Product from './models/Product';\nimport type ProductInfoViewConfiguration from './models/ProductInfoViewConfiguration';\nimport ShoppingModule, {\n ShoppingModuleEventEmitter,\n} from './modules/ShoppingModule';\nimport FWLoggerUtil from './utils/FWLoggerUtil';\nimport type ShoppingCTAResult from './models/ShoppingCTAResult';\nimport FWGlobalState from './utils/FWGlobalState';\n\nexport type ShoppingCTACallback = (\n event: ShoppingCTAEvent\n) => Promise<ShoppingCTAResult> | ShoppingCTAResult;\n\nexport type CustomClickCartIconCallback = (\n event: CustomClickCartIconEvent\n) => Promise<void> | void;\n\nexport type UpdateProductDetailsCallbackResult = Product[] | undefined | null;\nexport type UpdateProductDetailsCallback = (\n event: UpdateProductDetailsEvent\n) =>\n | Promise<UpdateProductDetailsCallbackResult>\n | UpdateProductDetailsCallbackResult;\n\nexport type CustomClickLinkButtonCallback = (\n event: CustomClickLinkButtonEvent\n) => Promise<void> | void;\n\nexport type CustomTapProductCardCallback = (\n event: CustomTapProductCardEvent\n) => Promise<void> | void;\n\n/**\n * The entry class of video shopping.\n */\nclass VideoShopping {\n private static _instance?: VideoShopping;\n\n /**\n * This callback is triggered when the user clicks the \"Add to cart\" or \"Shop now\" button.\n * The host app can return a ShoppingCTAResult object to tell SDK how to handle the result.\n */\n public onShoppingCTA?: ShoppingCTACallback;\n\n /**\n * This callback is triggered when the user clicks the shopping cart icon.\n *\n * The host app can customize the click event processing logic of\n * the shopping cart icon by setting the callback.\n */\n public onCustomClickCartIcon?: CustomClickCartIconCallback | undefined;\n\n /**\n * This callback is triggered when the video will be shown.\n *\n * The host app can return a Product list to update the latest product information.\n */\n public onUpdateProductDetails?: UpdateProductDetailsCallback;\n\n /**\n * This callback is triggered when the user clicks\n * the link button next to Add to cart button.\n *\n * The host app can customize the click event processing logic of\n * the link button by setting the callback.\n */\n public get onCustomClickLinkButton():\n | CustomClickLinkButtonCallback\n | undefined {\n return this._onCustomClickLinkButton;\n }\n public set onCustomClickLinkButton(\n value: CustomClickLinkButtonCallback | undefined\n ) {\n this._onCustomClickLinkButton = value;\n ShoppingModule.setCustomClickLinkButtonEnabled(!!value);\n }\n private _onCustomClickLinkButton?: CustomClickLinkButtonCallback | undefined;\n\n /**\n * This callback is triggered when the user clicks product card.\n *\n * The host app can customize the tap event processing logic of\n * the product card by setting the callback.\n */\n public get onCustomTapProductCard():\n | CustomTapProductCardCallback\n | undefined {\n return this._onCustomTapProductCard;\n }\n public set onCustomTapProductCard(\n value: CustomTapProductCardCallback | undefined\n ) {\n this._onCustomTapProductCard = value;\n ShoppingModule.setCustomTapProductCardEnabled(!!value);\n }\n private _onCustomTapProductCard?: CustomTapProductCardCallback | undefined;\n\n /**\n * Defaults to true.\n * You can hide the cart icon by setting this property to false.\n */\n public get cartIconVisible(): boolean {\n return this._cartIconVisible;\n }\n public set cartIconVisible(value: boolean) {\n this._cartIconVisible = value;\n if (FWGlobalState.getInstance().sdkInitCalled) {\n ShoppingModule.setCartIconVisible(value);\n } else {\n FWGlobalState.getInstance().sdkInitCalledPromise.then(() => {\n ShoppingModule.setCartIconVisible(value);\n });\n }\n }\n private _cartIconVisible: boolean = true;\n\n /**\n * The configuration of product info view.\n * Please refer to {@link ProductInfoViewConfiguration} for more details.\n */\n public get productInfoViewConfiguration():\n | ProductInfoViewConfiguration\n | undefined {\n return this._productInfoViewConfiguration;\n }\n\n public set productInfoViewConfiguration(\n value: ProductInfoViewConfiguration | undefined\n ) {\n const valueHasChanged = this._productInfoViewConfiguration !== value;\n this._productInfoViewConfiguration = value;\n if (FWGlobalState.getInstance().sdkInitCalled) {\n this.updateNativeProductInfoViewConfiguration(value, valueHasChanged);\n } else {\n FWGlobalState.getInstance().sdkInitCalledPromise.then(() => {\n this.updateNativeProductInfoViewConfiguration(value, valueHasChanged);\n });\n }\n }\n\n private updateNativeProductInfoViewConfiguration(\n value: ProductInfoViewConfiguration | undefined,\n valueHasChanged: Boolean\n ) {\n ShoppingModule.setProductInfoViewConfiguration(value ?? {}).then(() => {\n if (valueHasChanged) {\n this.eventEmitter.emit(FWEventName.ProductInfoViewConfigurationUpdated);\n FWLoggerUtil.log('eventEmitter ProductInfoViewConfigurationUpdated');\n }\n });\n }\n\n private _productInfoViewConfiguration?:\n | ProductInfoViewConfiguration\n | undefined;\n\n private get eventEmitter(): NativeEventEmitter {\n return ShoppingModuleEventEmitter;\n }\n\n public static getInstance() {\n FWLoggerUtil.log('VideoShopping constructor');\n if (!VideoShopping._instance) {\n VideoShopping._instance = new VideoShopping();\n }\n\n return VideoShopping._instance!;\n }\n\n private constructor() {\n this.eventEmitter.addListener(\n FWEventName.ShoppingCTAButtonClick,\n (event) => {\n FWLoggerUtil.log(\n `Receive ShoppingCTA event productId: ${event?.productId} unitId: ${event?.unitId} url: ${event?.url}`\n );\n this.handleShoppingCTAEvent(event);\n }\n );\n\n this.eventEmitter.addListener(FWEventName.ClickCartIcon, (event) => {\n FWLoggerUtil.log('Receive ClickCartIcon event');\n this.handleClickCartIconEvent(event);\n });\n\n this.eventEmitter.addListener(FWEventName.UpdateProductDetails, (event) => {\n FWLoggerUtil.log(\n `Receive UpdateProductDetails event productIds: ${event?.productIds}`\n );\n this.handleUpdateProductDetailsEvent(event);\n });\n\n this.eventEmitter.addListener(FWEventName.LogMessage, () => {});\n\n this.eventEmitter.addListener(\n FWEventName.CustomLinkButtonClick,\n (event) => {\n FWLoggerUtil.log(\n `Receive CustomLinkButtonClick event url: ${event?.url}`\n );\n this.handleCustomLinkButtonClickEvent(event);\n }\n );\n\n this.eventEmitter.addListener(FWEventName.CustomProductCardTap, (event) => {\n FWLoggerUtil.log(`Receive CustomProductCardTap event url: ${event?.url}`);\n if (event) {\n if (event.callbackId) {\n const callbackId = event.callbackId;\n delete event.callbackId;\n if (Platform.OS === 'ios') {\n event.playerHandler = {\n pause: () => ShoppingModule.pausePlayer(callbackId),\n resume: () => ShoppingModule.resumePlayer(callbackId),\n };\n }\n }\n this.handleCustomProductCardTapEvent(event);\n }\n });\n }\n\n /**\n *\n * @param {number} count The number of items in the host app cart.\n * The count should be greater than or equal to 0.\n * We just use count to show or hide red indicator on the cart icon.\n * If cound > 0, we will show the red indicator on the cart icon.\n * Otherwise, we will hide the red indicator on the cart icon.\n */\n public async setCartItemCount(count: number): Promise<void> {\n if (!FWGlobalState.getInstance().sdkInitCalled) {\n await FWGlobalState.getInstance().sdkInitCalledPromise;\n }\n ShoppingModule.setCartItemCount(count);\n }\n\n private async handleShoppingCTAEvent(event: any) {\n const callbackId = event.callbackId;\n delete event.callbackId;\n\n if (this.onShoppingCTA) {\n const result = await this.onShoppingCTA(event as ShoppingCTAEvent);\n if (callbackId) {\n ShoppingModule.updateShoppingCTAResult(result, callbackId);\n }\n } else {\n if (callbackId) {\n if (Platform.OS === 'ios') {\n ShoppingModule.clearCallbackId(\n callbackId,\n FWEventName.ShoppingCTAButtonClick\n );\n }\n }\n }\n }\n\n private async handleClickCartIconEvent(event: any) {\n if (this.onCustomClickCartIcon) {\n this.onCustomClickCartIcon(event as CustomClickCartIconEvent);\n }\n }\n\n private async handleUpdateProductDetailsEvent(event: any) {\n const callbackId = event.callbackId;\n delete event.callbackId;\n if (this.onUpdateProductDetails) {\n FWLoggerUtil.log(\n `Call onUpdateProductDetails callback productIds: ${event.productIds} callbackId: ${callbackId}`\n );\n const productList = await this.onUpdateProductDetails(\n event as UpdateProductDetailsEvent\n );\n\n const productIds = (productList || []).map(\n (product) => product.productId ?? ''\n );\n\n FWLoggerUtil.log(\n `Get result from onUpdateProductDetails callback productIds: ${productIds} productListLength: ${\n (productList || []).length\n }`\n );\n\n if (productList) {\n if (callbackId) {\n ShoppingModule.updateVideoProducts(productList, callbackId);\n }\n } else {\n if (callbackId) {\n if (Platform.OS === 'ios') {\n ShoppingModule.clearCallbackId(\n callbackId,\n FWEventName.UpdateProductDetails\n );\n }\n }\n }\n } else {\n FWLoggerUtil.log('onUpdateProductDetails callback is not set.');\n if (callbackId) {\n if (Platform.OS === 'ios') {\n ShoppingModule.clearCallbackId(\n callbackId,\n FWEventName.UpdateProductDetails\n );\n }\n }\n }\n }\n\n private async handleCustomLinkButtonClickEvent(\n event: CustomClickLinkButtonEvent\n ) {\n if (this.onCustomClickLinkButton) {\n this.onCustomClickLinkButton(event);\n }\n }\n\n private async handleCustomProductCardTapEvent(\n event: CustomTapProductCardEvent\n ) {\n if (this.onCustomTapProductCard) {\n this.onCustomTapProductCard(event);\n }\n }\n}\n\nexport default VideoShopping;\n"]}
@@ -117,6 +117,20 @@ const StoryBlock = (props, forwardedRef) => {
117
117
  }
118
118
  };
119
119
 
120
+ const handleStoryBlockGetFeedId = event => {
121
+ FWLoggerUtil.log(`StoryBlock handleStoryBlockGetFeedId ${JSON.stringify(event.nativeEvent)}`);
122
+ const {
123
+ onStoryBlockGetFeedId
124
+ } = props;
125
+ const {
126
+ feedId
127
+ } = event.nativeEvent;
128
+
129
+ if (onStoryBlockGetFeedId) {
130
+ onStoryBlockGetFeedId(feedId !== null && feedId !== void 0 ? feedId : '');
131
+ }
132
+ };
133
+
120
134
  const generateDynamicContentParametersString = () => {
121
135
  const {
122
136
  dynamicContentParameters
@@ -230,12 +244,14 @@ const StoryBlock = (props, forwardedRef) => {
230
244
  const ctaHighlightDelayValue = storyBlockConfiguration === null || storyBlockConfiguration === void 0 ? void 0 : (_storyBlockConfigurat5 = storyBlockConfiguration.ctaHighlightDelay) === null || _storyBlockConfigurat5 === void 0 ? void 0 : (_storyBlockConfigurat6 = _storyBlockConfigurat5.value) === null || _storyBlockConfigurat6 === void 0 ? void 0 : _storyBlockConfigurat6.toFixed(5);
231
245
  const shareBaseURL = storyBlockConfiguration === null || storyBlockConfiguration === void 0 ? void 0 : storyBlockConfiguration.shareBaseURL;
232
246
  const buttonConfiguration = storyBlockConfiguration === null || storyBlockConfiguration === void 0 ? void 0 : storyBlockConfiguration.buttonConfiguration;
247
+ const videoPlayerLogoConfigurationJsonKey = gennerateJsonKey(storyBlockConfiguration === null || storyBlockConfiguration === void 0 ? void 0 : storyBlockConfiguration.videoPlayerLogoConfiguration);
233
248
  const ctaWidth = storyBlockConfiguration === null || storyBlockConfiguration === void 0 ? void 0 : storyBlockConfiguration.ctaWidth;
234
249
  const showVideoDetailTitle = storyBlockConfiguration === null || storyBlockConfiguration === void 0 ? void 0 : storyBlockConfiguration.showVideoDetailTitle;
235
250
  const requiresAds = adConfiguration === null || adConfiguration === void 0 ? void 0 : adConfiguration.requiresAds;
236
251
  const adsFetchTimeout = adConfiguration === null || adConfiguration === void 0 ? void 0 : adConfiguration.adsFetchTimeout;
237
252
  const vastAttributesString = generateVastAttributesString();
238
253
  const productInfoViewConfigurationJsonKey = gennerateJsonKey(FireworkSDK.getInstance().shopping.productInfoViewConfiguration);
254
+ const replayBadgeConfigurationJsonKey = gennerateJsonKey(storyBlockConfiguration === null || storyBlockConfiguration === void 0 ? void 0 : storyBlockConfiguration.replayBadgeConfiguration);
239
255
  let key = `gShareBaseURL:${gShareBaseURL}`;
240
256
 
241
257
  if (Platform.OS === 'ios') {
@@ -279,15 +295,22 @@ const StoryBlock = (props, forwardedRef) => {
279
295
  key += `_buttonConfiguration.unmuteButton:${generateButtonInfoString(buttonConfiguration === null || buttonConfiguration === void 0 ? void 0 : buttonConfiguration.unmuteButton)}`;
280
296
  key += `_buttonConfiguration.playButton:${generateButtonInfoString(buttonConfiguration === null || buttonConfiguration === void 0 ? void 0 : buttonConfiguration.playButton)}`;
281
297
  key += `_buttonConfiguration.pauseButton:${generateButtonInfoString(buttonConfiguration === null || buttonConfiguration === void 0 ? void 0 : buttonConfiguration.pauseButton)}`;
298
+
299
+ if (Platform.OS === 'android') {
300
+ key += `_videoPlayerLogoConfiguration:${videoPlayerLogoConfigurationJsonKey}`;
301
+ }
302
+
282
303
  key += `_showVideoDetailTitle:${showVideoDetailTitle}`;
283
304
  key += `_requiresAds:${requiresAds}`;
284
305
  key += `_adsFetchTimeout:${adsFetchTimeout}`;
285
306
  key += `_vastAttributes:${vastAttributesString}`;
286
- key += `_productInfoViewConfigurationJsonKey:${productInfoViewConfigurationJsonKey}`;
307
+ key += `_productInfoViewConfiguration:${productInfoViewConfigurationJsonKey}`;
308
+ key += `_replayBadgeConfiguration:${replayBadgeConfigurationJsonKey}`;
287
309
  return key;
288
310
  };
289
311
 
290
312
  const key = generateKey();
313
+ console.log('story block key', key);
291
314
  useImperativeHandle(forwardedRef, () => {
292
315
  const sendCommand = command => {
293
316
  const nativeNodeHandle = findNodeHandle(nativeComponentRef.current);
@@ -297,7 +320,14 @@ const StoryBlock = (props, forwardedRef) => {
297
320
  commandId = commandId.toString();
298
321
  }
299
322
 
300
- UIManager.dispatchViewManagerCommand(findNodeHandle(nativeNodeHandle), commandId, []);
323
+ let reactTag = findNodeHandle(nativeNodeHandle);
324
+ FWLoggerUtil.log(`StoryBlock sendCommand: ${command} commandId: ${commandId} nativeNodeHandle: ${nativeNodeHandle} reactTag: ${reactTag}`);
325
+
326
+ if (!nativeNodeHandle || !reactTag) {
327
+ return;
328
+ }
329
+
330
+ UIManager.dispatchViewManagerCommand(reactTag, commandId, []);
301
331
  };
302
332
 
303
333
  return {
@@ -309,6 +339,20 @@ const StoryBlock = (props, forwardedRef) => {
309
339
  },
310
340
  openFullscreen: () => {
311
341
  sendCommand('openFullscreen');
342
+ },
343
+ onViewportEntered: () => {
344
+ if (Platform.OS !== 'ios') {
345
+ return;
346
+ }
347
+
348
+ sendCommand('onViewportEntered');
349
+ },
350
+ onViewportLeft: () => {
351
+ if (Platform.OS !== 'ios') {
352
+ return;
353
+ }
354
+
355
+ sendCommand('onViewportLeft');
312
356
  }
313
357
  };
314
358
  }, []);
@@ -346,6 +390,11 @@ const StoryBlock = (props, forwardedRef) => {
346
390
  setTimeout(() => {
347
391
  const viewId = findNodeHandle(nativeComponentRef.current);
348
392
  FWLoggerUtil.log(`StoryBlock createFragment viewId: ${viewId}`);
393
+
394
+ if (!viewId) {
395
+ return;
396
+ }
397
+
349
398
  UIManager.dispatchViewManagerCommand(viewId, UIManager.getViewManagerConfig(NativeComponentName).Commands.create.toString(), [viewId]);
350
399
  }, 500);
351
400
  }
@@ -378,7 +427,8 @@ const StoryBlock = (props, forwardedRef) => {
378
427
  onStoryBlockLoadFinished: handleStoryBlockLoadFinished,
379
428
  onStoryBlockEmpty: handleStoryBlockEmpty,
380
429
  onStoryBlockDidStartPictureInPicture: handleStoryBlockDidStartPictureInPicture,
381
- onStoryBlockDidStopPictureInPicture: handleStoryBlockDidStopPictureInPicture
430
+ onStoryBlockDidStopPictureInPicture: handleStoryBlockDidStopPictureInPicture,
431
+ onStoryBlockGetFeedId: handleStoryBlockGetFeedId
382
432
  }));
383
433
  };
384
434