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 +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+C,CAAC,CAACD,KAAjD;AACD;;AAGD;AACF;AACA;AACA;AACA;AACA;AACmC,MAAtBE,sBAAsB,GAEnB;AACZ,WAAO,KAAKC,uBAAZ;AACD;;AACgC,MAAtBD,sBAAsB,CAC/BF,KA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AACwB,WAAW,IAAI,EAAhB,EAAoBC,GAApB,CAChBC,OAAD;AAAA;;AAAA,qCAAaA,OAAO,CAACjC,SAArB,mEAAkC,EAAlC;AAAA,OADiB,CAAnB;AAIA/B,MAAAA,YAAY,CAACyB,GAAb,CACG,+DAA8Da,UAAW,uBACxE,CAACwB,WAAW,IAAI,EAAhB,EAAoBG,MACrB,EAHH;;AAMA,UAAIH,WAAJ,EAAiB;AACf,YAAIhB,UAAJ,EAAgB;AACdhD,UAAAA,cAAc,CAACoE,mBAAf,CAAmCJ,WAAnC,EAAgDhB,UAAhD;AACD;AACF,OAJD,MAIO;AACL,YAAIA,UAAJ,EAAgB;AACd,cAAIlD,QAAQ,CAACmD,EAAT,KAAgB,KAApB,EAA2B;AACzBjD,YAAAA,cAAc,CAAC6D,eAAf,CACEb,UADF,EAEEjD,WAAW,CAACwC,oBAFd;AAID;AACF;AACF;AACF,KAhCD,MAgCO;AACLrC,MAAAA,YAAY,CAACyB,GAAb,CAAiB,6CAAjB;;AACA,UAAIqB,UAAJ,EAAgB;AACd,YAAIlD,QAAQ,CAACmD,EAAT,KAAgB,KAApB,EAA2B;AACzBjD,UAAAA,cAAc,CAAC6D,eAAf,CACEb,UADF,EAEEjD,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/BuB,+BAA+B,CAC3CvB,KAD2C,EAE3C;AACA,QAAI,KAAKvB,sBAAT,EAAiC;AAC/B,WAAKA,sBAAL,CAA4BuB,KAA5B;AACD;AACF;;AAzSiB;;gBAAd5B,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,sBAA5B;AAUA,OAAOC,cAAP,IACEC,0BADF,QAEO,0BAFP;AAGA,OAAOC,YAAP,MAAyB,sBAAzB;AAEA,OAAOC,aAAP,MAA0B,uBAA1B;;AAyBA;AACA;AACA;AACA,MAAMC,aAA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2B,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,15 @@ 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);
255
+ const countdownTimerConfigurationJsonKey = gennerateJsonKey(storyBlockConfiguration === null || storyBlockConfiguration === void 0 ? void 0 : storyBlockConfiguration.countdownTimerConfiguration);
239
256
  let key = `gShareBaseURL:${gShareBaseURL}`;
240
257
 
241
258
  if (Platform.OS === 'ios') {
@@ -279,15 +296,23 @@ const StoryBlock = (props, forwardedRef) => {
279
296
  key += `_buttonConfiguration.unmuteButton:${generateButtonInfoString(buttonConfiguration === null || buttonConfiguration === void 0 ? void 0 : buttonConfiguration.unmuteButton)}`;
280
297
  key += `_buttonConfiguration.playButton:${generateButtonInfoString(buttonConfiguration === null || buttonConfiguration === void 0 ? void 0 : buttonConfiguration.playButton)}`;
281
298
  key += `_buttonConfiguration.pauseButton:${generateButtonInfoString(buttonConfiguration === null || buttonConfiguration === void 0 ? void 0 : buttonConfiguration.pauseButton)}`;
299
+
300
+ if (Platform.OS === 'android') {
301
+ key += `_videoPlayerLogoConfiguration:${videoPlayerLogoConfigurationJsonKey}`;
302
+ }
303
+
282
304
  key += `_showVideoDetailTitle:${showVideoDetailTitle}`;
283
305
  key += `_requiresAds:${requiresAds}`;
284
306
  key += `_adsFetchTimeout:${adsFetchTimeout}`;
285
307
  key += `_vastAttributes:${vastAttributesString}`;
286
- key += `_productInfoViewConfigurationJsonKey:${productInfoViewConfigurationJsonKey}`;
308
+ key += `_productInfoViewConfiguration:${productInfoViewConfigurationJsonKey}`;
309
+ key += `_replayBadgeConfiguration:${replayBadgeConfigurationJsonKey}`;
310
+ key += `_countdownTimerConfiguration:${countdownTimerConfigurationJsonKey}`;
287
311
  return key;
288
312
  };
289
313
 
290
314
  const key = generateKey();
315
+ console.log('story block key', key);
291
316
  useImperativeHandle(forwardedRef, () => {
292
317
  const sendCommand = command => {
293
318
  const nativeNodeHandle = findNodeHandle(nativeComponentRef.current);
@@ -297,7 +322,14 @@ const StoryBlock = (props, forwardedRef) => {
297
322
  commandId = commandId.toString();
298
323
  }
299
324
 
300
- UIManager.dispatchViewManagerCommand(findNodeHandle(nativeNodeHandle), commandId, []);
325
+ let reactTag = findNodeHandle(nativeNodeHandle);
326
+ FWLoggerUtil.log(`StoryBlock sendCommand: ${command} commandId: ${commandId} nativeNodeHandle: ${nativeNodeHandle} reactTag: ${reactTag}`);
327
+
328
+ if (!nativeNodeHandle || !reactTag) {
329
+ return;
330
+ }
331
+
332
+ UIManager.dispatchViewManagerCommand(reactTag, commandId, []);
301
333
  };
302
334
 
303
335
  return {
@@ -309,6 +341,20 @@ const StoryBlock = (props, forwardedRef) => {
309
341
  },
310
342
  openFullscreen: () => {
311
343
  sendCommand('openFullscreen');
344
+ },
345
+ onViewportEntered: () => {
346
+ if (Platform.OS !== 'ios') {
347
+ return;
348
+ }
349
+
350
+ sendCommand('onViewportEntered');
351
+ },
352
+ onViewportLeft: () => {
353
+ if (Platform.OS !== 'ios') {
354
+ return;
355
+ }
356
+
357
+ sendCommand('onViewportLeft');
312
358
  }
313
359
  };
314
360
  }, []);
@@ -346,6 +392,11 @@ const StoryBlock = (props, forwardedRef) => {
346
392
  setTimeout(() => {
347
393
  const viewId = findNodeHandle(nativeComponentRef.current);
348
394
  FWLoggerUtil.log(`StoryBlock createFragment viewId: ${viewId}`);
395
+
396
+ if (!viewId) {
397
+ return;
398
+ }
399
+
349
400
  UIManager.dispatchViewManagerCommand(viewId, UIManager.getViewManagerConfig(NativeComponentName).Commands.create.toString(), [viewId]);
350
401
  }, 500);
351
402
  }
@@ -378,7 +429,8 @@ const StoryBlock = (props, forwardedRef) => {
378
429
  onStoryBlockLoadFinished: handleStoryBlockLoadFinished,
379
430
  onStoryBlockEmpty: handleStoryBlockEmpty,
380
431
  onStoryBlockDidStartPictureInPicture: handleStoryBlockDidStartPictureInPicture,
381
- onStoryBlockDidStopPictureInPicture: handleStoryBlockDidStopPictureInPicture
432
+ onStoryBlockDidStopPictureInPicture: handleStoryBlockDidStopPictureInPicture,
433
+ onStoryBlockGetFeedId: handleStoryBlockGetFeedId
382
434
  }));
383
435
  };
384
436
 
@@ -1 +1 @@
1
- {"version":3,"sources":["StoryBlock.tsx"],"names":["React","forwardRef","useEffect","useImperativeHandle","useReducer","useRef","useState","findNodeHandle","Platform","UIManager","FireworkSDK","FWEventName","FireworkSDKModuleEventEmitter","FWGlobalState","FWLoggerUtil","FWStoryBlock","gennerateJsonKey","NativeComponentName","StoryBlock","props","forwardedRef","nativeComponentRef","sdkInitCalled","setSdkInitCalled","getInstance","loadedRef","forceUpdate","x","handleStoryBlockLoadFinished","event","log","nativeEvent","name","onStoryBlockLoadFinished","onStoryBlockEmpty","reason","error","current","handleStoryBlockEmpty","handleStoryBlockDidStartPictureInPicture","JSON","stringify","onStoryBlockDidStartPictureInPicture","handleStoryBlockDidStopPictureInPicture","onStoryBlockDidStopPictureInPicture","generateDynamicContentParametersString","dynamicContentParameters","resultString","sortedKeyList","Object","keys","sort","key","value","valueString","join","length","generateVastAttributesString","adConfiguration","vastAttributes","attribute","generateButtonInfoString","buttonInfo","imageName","systemImageName","tintColor","getStoryBlockConfiguration","storyBlockConfiguration","enablePictureInPicture","resultStoryBlockConfiguration","generateKey","gShareBaseURL","shareBaseURL","appLanguage","videoLaunchBehavior","adBadgeConfiguration","adBadgeTextType","badgeTextType","backgroundColorOfAdBadge","backgroundColor","textColorOfAdBadge","textColor","androidFontIsCustomOfAdBadge","androidFontInfo","isCustom","androidFontTypefaceNameOfAdBadge","typefaceName","source","channel","playlist","hashtagFilterExpression","productIds","contentId","cornerRadius","dynamicContentParametersString","playerStyle","videoCompleteAction","showShareButton","showPlaybackButton","showMuteButton","showBranding","ctaDelayType","ctaDelay","type","ctaDelayValue","toFixed","ctaHighlightDelayType","ctaHighlightDelay","ctaHighlightDelayValue","buttonConfiguration","ctaWidth","showVideoDetailTitle","requiresAds","adsFetchTimeout","vastAttributesString","productInfoViewConfigurationJsonKey","shopping","productInfoViewConfiguration","OS","videoDetailButton","closeButton","muteButton","unmuteButton","playButton","pauseButton","sendCommand","command","nativeNodeHandle","commandId","getViewManagerConfig","Commands","toString","dispatchViewManagerCommand","play","pause","openFullscreen","subscriptionOfShareBaseURLUpdated","addListener","ShareBaseURLUpdated","subscriptionOfAdBadgeConfigurationUpdated","AdBadgeConfigurationUpdated","subscriptionOfVideoLaunchBehaviorUpdated","VideoLaunchBehaviorUpdated","subscriptionOfAppLanguageUpdated","AppLanguageUpdated","subscriptionOfProductInfoViewConfigurationUpdated","ProductInfoViewConfigurationUpdated","remove","setTimeout","viewId","create","sdkInitCalledPromise","then","style","otherProps","assign","borderRadius","undefined"],"mappings":";;A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derFunction } from 'react';\nimport React, {\n forwardRef,\n useEffect,\n useImperativeHandle,\n useReducer,\n useRef,\n useState,\n} from 'react';\n\nimport {\n findNodeHandle,\n NativeSyntheticEvent,\n Platform,\n StyleProp,\n UIManager,\n ViewStyle,\n} from 'react-native';\n\nimport FireworkSDK from '../FireworkSDK';\nimport type AdConfiguration from '../models/AdConfiguration';\nimport type FWError from '../models/FWError';\nimport { FWEventName } from '../models/FWEventName';\nimport type { StoryBlockConfiguration } from '../models/StoryBlockConfiguration';\nimport type StoryBlockNativeConfiguration from '../models/StoryBlockNativeConfiguration';\nimport type { StoryBlockSource } from '../models/StoryBlockSource';\nimport { FireworkSDKModuleEventEmitter } from '../modules/FireworkSDKModule';\nimport FWGlobalState from '../utils/FWGlobalState';\nimport FWLoggerUtil from '../utils/FWLoggerUtil';\nimport FWStoryBlock from './FWStoryBlock';\nimport type ButtonInfo from '../models/ButtonInfo';\nimport gennerateJsonKey from '../utils/FWJsonUtil';\n\nconst NativeComponentName = 'FWStoryBlock';\n\nexport interface IStoryBlockMethods {\n /**\n * Play the story block.\n */\n play: () => void;\n /**\n * Pause the story block.\n */\n pause: () => void;\n /**\n * Open the fullscreen story block.\n * Only supported on Android.\n */\n openFullscreen: () => void;\n}\n\n/**\n * The props type of StoryBlock component.\n */\nexport interface IStoryBlockProps {\n /**\n * Standard React Native View Style.\n */\n style?: StyleProp<ViewStyle>;\n /**\n * One of four available story block sources.\n */\n source: StoryBlockSource;\n /**\n * Channel id of the story block. Required when the source is set as channel or playlist or dynamicContent.\n */\n channel?: string;\n /**\n * Playlist id of the story block. Please note channel id is necessary. Required when the source is set as playlist.\n */\n playlist?: string;\n /**\n * The dynamic content parameters of the story block. Required when the source is set as dynamicContent.\n */\n dynamicContentParameters?: { [key: string]: string[] };\n /**\n * Hashtag filter expression is an s-expression used to provide feeds filtered by hashtags with specified criteria.\n * Queries are specified with boolean predicates on what hashtags are there on the video.\n * For instance, (and sport food) (or sport food) (and sport (or food comedy)) sport are all valid expressions.\n * Non-UTF-8 characters are not allowed. If using boolean predicates, the expression needs to be wrapped with parenthesis.\n */\n hashtagFilterExpression?: string;\n /**\n * Product ids used to generate the sku feed\n */\n productIds?: string[];\n /**\n * The video or live stream id.\n */\n contentId?: string;\n /**\n * Specifies if Picture in Picture is enabled. Only supported on iOS.\n */\n enablePictureInPicture?: boolean;\n /**\n * The corner radius of story block.\n */\n cornerRadius?: number;\n /**\n * Ad configuration of the feed.\n */\n adConfiguration?: AdConfiguration;\n\n /* The configuration of the story block. */\n storyBlockConfiguration?: StoryBlockConfiguration;\n /**\n * The feed loading result callback. It means loading successfully when error equals to undefined.\n */\n onStoryBlockLoadFinished?: (error?: FWError) => void;\n /**\n * The callback is triggered when there are no items in the story block.\n * The callback is triggered in the following cases:\n * 1. Loading successfully but the back end returns an empty list.\n * 2. The load failed and list is empty.\n * onStoryBlockLoadFinished will also be triggered when onStoryBlockEmpty is triggered.\n * Only supported on Android.\n */\n onStoryBlockEmpty?: (error?: FWError) => void;\n /**\n * Start Picture in Picture callback. Only supported on iOS.\n */\n onStoryBlockDidStartPictureInPicture?: (error?: FWError) => void;\n /**\n * Stop Picture in Picture callback. Only supported on iOS.\n */\n onStoryBlockDidStopPictureInPicture?: (error?: FWError) => void;\n}\n\nconst StoryBlock: ForwardRefRenderFunction<\n IStoryBlockMethods,\n IStoryBlockProps\n> = (props: IStoryBlockProps, forwardedRef) => {\n const nativeComponentRef = useRef(null);\n const [sdkInitCalled, setSdkInitCalled] = useState<boolean>(\n FWGlobalState.getInstance().sdkInitCalled\n );\n const loadedRef = useRef<boolean>(false);\n const [, forceUpdate] = useReducer((x) => x + 1, 0);\n\n const handleStoryBlockLoadFinished = (event: NativeSyntheticEvent<any>) => {\n FWLoggerUtil.log(\n `StoryBlock handleStoryBlockLoadFinished ${event.nativeEvent.name}`\n );\n\n const { onStoryBlockLoadFinished, onStoryBlockEmpty } = props;\n const { name, reason } = event.nativeEvent;\n\n if (onStoryBlockLoadFinished) {\n if (name) {\n let error: FWError = { name };\n if (reason) {\n error.reason = reason;\n }\n\n onStoryBlockLoadFinished(error);\n if (!loadedRef.current) {\n onStoryBlockEmpty?.(error);\n }\n } else {\n onStoryBlockLoadFinished();\n loadedRef.current = true;\n }\n }\n };\n\n const handleStoryBlockEmpty = (event: NativeSyntheticEvent<any>) => {\n FWLoggerUtil.log(`StoryBlock handleStoryBlockEmpty ${event.nativeEvent}`);\n\n const { onStoryBlockEmpty } = props;\n\n if (onStoryBlockEmpty) {\n onStoryBlockEmpty();\n }\n };\n\n const handleStoryBlockDidStartPictureInPicture = (\n event: NativeSyntheticEvent<any>\n ) => {\n FWLoggerUtil.log(\n `StoryBlock handleStoryBlockDidStartPictureInPicture ${JSON.stringify(\n event.nativeEvent\n )}`\n );\n const { onStoryBlockDidStartPictureInPicture } = props;\n\n const { name, reason } = event.nativeEvent;\n\n if (onStoryBlockDidStartPictureInPicture) {\n if (name) {\n if (reason) {\n onStoryBlockDidStartPictureInPicture({ name, reason });\n } else {\n onStoryBlockDidStartPictureInPicture({ name });\n }\n } else {\n onStoryBlockDidStartPictureInPicture();\n }\n }\n };\n\n const handleStoryBlockDidStopPictureInPicture = (\n event: NativeSyntheticEvent<any>\n ) => {\n FWLoggerUtil.log(\n `StoryBlock handleStoryBlockDidStopPictureInPicture ${JSON.stringify(\n event.nativeEvent\n )}`\n );\n const { onStoryBlockDidStopPictureInPicture } = props;\n\n const { name, reason } = event.nativeEvent;\n\n if (onStoryBlockDidStopPictureInPicture) {\n if (name) {\n if (reason) {\n onStoryBlockDidStopPictureInPicture({ name, reason });\n } else {\n onStoryBlockDidStopPictureInPicture({ name });\n }\n } else {\n onStoryBlockDidStopPictureInPicture();\n }\n }\n };\n\n const generateDynamicContentParametersString = (): string => {\n const { dynamicContentParameters } = props;\n\n if (!dynamicContentParameters) {\n return '';\n }\n\n let resultString = '';\n const sortedKeyList = Object.keys(dynamicContentParameters).sort();\n for (const key of sortedKeyList) {\n const value = dynamicContentParameters[key];\n const valueString = value.join(',');\n if (resultString.length > 0) {\n resultString += '_';\n }\n\n resultString += `${key}:${valueString}`;\n }\n\n return resultString;\n };\n\n const generateVastAttributesString = () => {\n const { adConfiguration } = props;\n const vastAttributes = adConfiguration?.vastAttributes;\n if (!vastAttributes) {\n return '';\n }\n\n let resultString = '';\n for (const attribute of vastAttributes) {\n if (resultString.length > 0) {\n resultString += '_';\n }\n resultString += `${attribute.name ?? ''}:${attribute.value}`;\n }\n\n return resultString;\n };\n\n const generateButtonInfoString = (buttonInfo?: ButtonInfo) => {\n return `imageName:${buttonInfo?.imageName}_systemImageName:${buttonInfo?.systemImageName}_tintColor:${buttonInfo?.tintColor}`;\n };\n\n const getStoryBlockConfiguration: () =>\n | StoryBlockNativeConfiguration\n | undefined = () => {\n const { storyBlockConfiguration, enablePictureInPicture } = props;\n let resultStoryBlockConfiguration:\n | StoryBlockNativeConfiguration\n | undefined = storyBlockConfiguration;\n if (typeof enablePictureInPicture === 'boolean') {\n if (!resultStoryBlockConfiguration) {\n resultStoryBlockConfiguration = {};\n }\n resultStoryBlockConfiguration = {\n ...resultStoryBlockConfiguration,\n enablePictureInPicture,\n };\n }\n return resultStoryBlockConfiguration;\n };\n const storyBlockConfiguration = getStoryBlockConfiguration();\n\n const generateKey = (): string => {\n const gShareBaseURL = FireworkSDK.getInstance().shareBaseURL;\n const appLanguage = FireworkSDK.getInstance().appLanguage;\n const videoLaunchBehavior = FireworkSDK.getInstance().videoLaunchBehavior;\n const adBadgeConfiguration = FireworkSDK.getInstance().adBadgeConfiguration;\n const adBadgeTextType = adBadgeConfiguration?.badgeTextType;\n const backgroundColorOfAdBadge = adBadgeConfiguration?.backgroundColor;\n const textColorOfAdBadge = adBadgeConfiguration?.textColor;\n const androidFontIsCustomOfAdBadge =\n adBadgeConfiguration?.androidFontInfo?.isCustom;\n const androidFontTypefaceNameOfAdBadge =\n adBadgeConfiguration?.androidFontInfo?.typefaceName;\n\n const {\n source,\n channel,\n playlist,\n hashtagFilterExpression,\n productIds,\n contentId,\n enablePictureInPicture,\n cornerRadius,\n adConfiguration,\n } = props;\n const dynamicContentParametersString =\n generateDynamicContentParametersString();\n\n const playerStyle = storyBlockConfiguration?.playerStyle;\n const videoCompleteAction = storyBlockConfiguration?.videoCompleteAction;\n const showShareButton = storyBlockConfiguration?.showShareButton;\n const showPlaybackButton = storyBlockConfiguration?.showPlaybackButton;\n const showMuteButton = storyBlockConfiguration?.showMuteButton;\n const showBranding = storyBlockConfiguration?.showBranding;\n const ctaDelayType = storyBlockConfiguration?.ctaDelay?.type;\n const ctaDelayValue = storyBlockConfiguration?.ctaDelay?.value?.toFixed(5);\n const ctaHighlightDelayType =\n storyBlockConfiguration?.ctaHighlightDelay?.type;\n const ctaHighlightDelayValue =\n storyBlockConfiguration?.ctaHighlightDelay?.value?.toFixed(5);\n const shareBaseURL = storyBlockConfiguration?.shareBaseURL;\n const buttonConfiguration = storyBlockConfiguration?.buttonConfiguration;\n const ctaWidth = storyBlockConfiguration?.ctaWidth;\n const showVideoDetailTitle = storyBlockConfiguration?.showVideoDetailTitle;\n\n const requiresAds = adConfiguration?.requiresAds;\n const adsFetchTimeout = adConfiguration?.adsFetchTimeout;\n const vastAttributesString = generateVastAttributesString();\n const productInfoViewConfigurationJsonKey = gennerateJsonKey(\n FireworkSDK.getInstance().shopping.productInfoViewConfiguration\n );\n\n let key = `gShareBaseURL:${gShareBaseURL}`;\n if (Platform.OS === 'ios') {\n key += `_appLanguage:${appLanguage}`;\n }\n key += `_videoLaunchBehavior:${videoLaunchBehavior}`;\n key += `_adBadgeTextType:${adBadgeTextType}`;\n key += `_backgroundColorOfAdBadge:${backgroundColorOfAdBadge}`;\n key += `_textColorOfAdBadge:${textColorOfAdBadge}`;\n if (Platform.OS === 'android') {\n key += `_androidFontIsCustomOfAdBadge${androidFontIsCustomOfAdBadge}`;\n key += `_androidFontTypefaceNameOfAdBadge${androidFontTypefaceNameOfAdBadge}`;\n }\n\n key += `_source:${source}`;\n key += `_channel:${channel}`;\n key += `_playlist:${playlist}`;\n key += `_dynamicContentParameters:${dynamicContentParametersString}`;\n key += `_hashtagFilterExpression:${hashtagFilterExpression}`;\n key += `productIds:${productIds?.join(',')}`;\n key += `_contentId:${contentId}`;\n key += `_enablePictureInPicture:${enablePictureInPicture}`;\n key += `_cornerRadius:${cornerRadius}`;\n\n key += `_shareBaseURL:${shareBaseURL}`;\n key += `_playerStyle:${playerStyle}`;\n key += `_videoCompleteAction:${videoCompleteAction}`;\n key += `_showShareButton:${showShareButton}`;\n key += `_showPlaybackButton:${showPlaybackButton}`;\n key += `_showMuteButton:${showMuteButton}`;\n key += `_showBranding:${showBranding}`;\n key += `_ctaDelayType:${ctaDelayType}`;\n key += `_ctaDelayValue:${ctaDelayValue}`;\n key += `_ctaHighlightDelayType:${ctaHighlightDelayType}`;\n key += `_ctaHighlightDelayValue:${ctaHighlightDelayValue}`;\n key += `_ctaWidth:${ctaWidth}`;\n key += `_buttonConfiguration.videoDetailButton:${generateButtonInfoString(\n buttonConfiguration?.videoDetailButton\n )}`;\n key += `_buttonConfiguration.closeButton:${generateButtonInfoString(\n buttonConfiguration?.closeButton\n )}`;\n key += `_buttonConfiguration.muteButton:${generateButtonInfoString(\n buttonConfiguration?.muteButton\n )}`;\n key += `_buttonConfiguration.unmuteButton:${generateButtonInfoString(\n buttonConfiguration?.unmuteButton\n )}`;\n key += `_buttonConfiguration.playButton:${generateButtonInfoString(\n buttonConfiguration?.playButton\n )}`;\n key += `_buttonConfiguration.pauseButton:${generateButtonInfoString(\n buttonConfiguration?.pauseButton\n )}`;\n key += `_showVideoDetailTitle:${showVideoDetailTitle}`;\n\n key += `_requiresAds:${requiresAds}`;\n key += `_adsFetchTimeout:${adsFetchTimeout}`;\n key += `_vastAttributes:${vastAttributesString}`;\n key += `_productInfoViewConfigurationJsonKey:${productInfoViewConfigurationJsonKey}`;\n\n return key;\n };\n\n const key = generateKey();\n\n useImperativeHandle(\n forwardedRef,\n () => {\n const sendCommand = (command: string) => {\n const nativeNodeHandle = findNodeHandle(nativeComponentRef.current);\n\n let commandId: string | number =\n UIManager.getViewManagerConfig(NativeComponentName).Commands[command];\n if (Platform.OS === 'android') {\n commandId = commandId.toString();\n }\n\n UIManager.dispatchViewManagerCommand(\n findNodeHandle(nativeNodeHandle),\n commandId,\n []\n );\n };\n return {\n play: () => {\n sendCommand('play');\n },\n pause: () => {\n sendCommand('pause');\n },\n openFullscreen: () => {\n sendCommand('openFullscreen');\n },\n };\n },\n []\n );\n\n useEffect(() => {\n const subscriptionOfShareBaseURLUpdated =\n FireworkSDKModuleEventEmitter.addListener(\n FWEventName.ShareBaseURLUpdated,\n () => {\n FWLoggerUtil.log('Receive FWEventName.ShareBaseURLUpdated');\n forceUpdate();\n }\n );\n const subscriptionOfAdBadgeConfigurationUpdated =\n FireworkSDKModuleEventEmitter.addListener(\n FWEventName.AdBadgeConfigurationUpdated,\n () => {\n FWLoggerUtil.log('Receive FWEventName.AdBadgeConfigurationUpdated');\n forceUpdate();\n }\n );\n\n const subscriptionOfVideoLaunchBehaviorUpdated =\n FireworkSDKModuleEventEmitter.addListener(\n FWEventName.VideoLaunchBehaviorUpdated,\n () => {\n FWLoggerUtil.log('Receive FWEventName.VideoLaunchBehaviorUpdated');\n forceUpdate();\n }\n );\n\n const subscriptionOfAppLanguageUpdated =\n FireworkSDKModuleEventEmitter.addListener(\n FWEventName.AppLanguageUpdated,\n () => {\n FWLoggerUtil.log('Receive FWEventName.AppLanguageUpdated');\n forceUpdate();\n }\n );\n\n const subscriptionOfProductInfoViewConfigurationUpdated =\n FireworkSDKModuleEventEmitter.addListener(\n FWEventName.ProductInfoViewConfigurationUpdated,\n () => {\n FWLoggerUtil.log(\n 'Receive FWEventName.ProductInfoViewConfigurationUpdated'\n );\n forceUpdate();\n }\n );\n\n return () => {\n subscriptionOfShareBaseURLUpdated.remove();\n subscriptionOfAdBadgeConfigurationUpdated.remove();\n subscriptionOfVideoLaunchBehaviorUpdated.remove();\n subscriptionOfAppLanguageUpdated.remove();\n subscriptionOfProductInfoViewConfigurationUpdated.remove();\n };\n }, []);\n\n useEffect(() => {\n if (Platform.OS === 'android') {\n setTimeout(() => {\n const viewId = findNodeHandle(nativeComponentRef.current);\n FWLoggerUtil.log(`StoryBlock createFragment viewId: ${viewId}`);\n UIManager.dispatchViewManagerCommand(\n viewId,\n UIManager.getViewManagerConfig(\n NativeComponentName\n ).Commands.create.toString(),\n [viewId]\n );\n }, 500);\n }\n }, [key]);\n\n useEffect(() => {\n FWGlobalState.getInstance().sdkInitCalledPromise.then(() => {\n setSdkInitCalled(true);\n });\n }, []);\n\n if (!sdkInitCalled) {\n return null;\n }\n const { style, cornerRadius, ...otherProps } = props;\n return (\n <FWStoryBlock\n ref={nativeComponentRef}\n key={key}\n {...otherProps}\n cornerRadius={cornerRadius}\n style={Object.assign({ borderRadius: cornerRadius }, style)}\n storyBlockConfiguration={storyBlockConfiguration}\n enablePictureInPicture={undefined}\n onStoryBlockLoadFinished={handleStoryBlockLoadFinished}\n onStoryBlockEmpty={handleStoryBlockEmpty}\n onStoryBlockDidStartPictureInPicture={\n handleStoryBlockDidStartPictureInPicture\n }\n onStoryBlockDidStopPictureInPicture={\n handleStoryBlockDidStopPictureInPicture\n }\n />\n );\n};\n\nexport default forwardRef(StoryBlock);\n"]}
1
+ {"version":3,"sources":["StoryBlock.tsx"],"names":["React","forwardRef","useEffect","useImperativeHandle","useReducer","useRef","useState","findNodeHandle","Platform","UIManager","FireworkSDK","FWEventName","FireworkSDKModuleEventEmitter","FWGlobalState","FWLoggerUtil","FWStoryBlock","gennerateJsonKey","NativeComponentName","StoryBlock","props","forwardedRef","nativeComponentRef","sdkInitCalled","setSdkInitCalled","getInstance","loadedRef","forceUpdate","x","handleStoryBlockLoadFinished","event","log","nativeEvent","name","onStoryBlockLoadFinished","onStoryBlockEmpty","reason","error","current","handleStoryBlockEmpty","handleStoryBlockDidStartPictureInPicture","JSON","stringify","onStoryBlockDidStartPictureInPicture","handleStoryBlockDidStopPictureInPicture","onStoryBlockDidStopPictureInPicture","handleStoryBlockGetFeedId","onStoryBlockGetFeedId","feedId","generateDynamicContentParametersString","dynamicContentParameters","resultString","sortedKeyList","Object","keys","sort","key","value","valueString","join","length","generateVastAttributesString","adConfiguration","vastAttributes","attribute","generateButtonInfoString","buttonInfo","imageName","systemImageName","tintColor","getStoryBlockConfiguration","storyBlockConfiguration","enablePictureInPicture","resultStoryBlockConfiguration","generateKey","gShareBaseURL","shareBaseURL","appLanguage","videoLaunchBehavior","adBadgeConfiguration","adBadgeTextType","badgeTextType","backgroundColorOfAdBadge","backgroundColor","textColorOfAdBadge","textColor","androidFontIsCustomOfAdBadge","androidFontInfo","isCustom","androidFontTypefaceNameOfAdBadge","typefaceName","source","channel","playlist","hashtagFilterExpression","productIds","contentId","cornerRadius","dynamicContentParametersString","playerStyle","videoCompleteAction","showShareButton","showPlaybackButton","showMuteButton","showBranding","ctaDelayType","ctaDelay","type","ctaDelayValue","toFixed","ctaHighlightDelayType","ctaHighlightDelay","ctaHighlightDelayValue","buttonConfiguration","videoPlayerLogoConfigurationJsonKey","videoPlayerLogoConfiguration","ctaWidth","showVideoDetailTitle","requiresAds","adsFetchTimeout","vastAttributesString","productInfoViewConfigurationJsonKey","shopping","productInfoViewConfiguration","replayBadgeConfigurationJsonKey","replayBadgeConfiguration","countdownTimerConfigurationJsonKey","countdownTimerConfiguration","OS","videoDetailButton","closeButton","muteButton","unmuteButton","playButton","pauseButton","console","sendCommand","command","nativeNodeHandle","commandId","getViewManagerConfig","Commands","toString","reactTag","dispatchViewManagerCommand","play","pause","openFullscreen","onViewportEntered","onViewportLeft","subscriptionOfShareBaseURLUpdated","addListener","ShareBaseURLUpdated","subscriptionOfAdBadgeConfigurationUpdated","AdBadgeConfigurationUpdated","subscriptionOfVideoLaunchBehaviorUpdated","VideoLaunchBehaviorUpdated","subscriptionOfAppLanguageUpdated","AppLanguageUpdated","subscriptionOfProductInfoViewConfigurationUpdated","ProductInfoViewConfigurationUpdated","remove","setTimeout","viewId","create","sdkInitCalledPromise","then","style","otherProps","assign","borderRadius","undefined"],"mappings":";;AACA,OAAOA,KAAP,IACEC,UADF,EAEEC,SAFF,EAGEC,mBAHF,EAIEC,UAJF,EAKEC,MALF,EAMEC,QANF,QAOO,OAPP;AASA,SACEC,cADF,EAGEC,QAHF,EAKEC,SALF,QAOO,cAPP;AASA,OAAOC,WAAP,MAAwB,gBAAxB;AAGA,SAASC,WAAT,QAA4B,uBAA5B;AAIA,SAASC,6BAAT,QAA8C,8BAA9C;AACA,OAAOC,aAAP,MAA0B,wBAA1B;AACA,OAAOC,YAAP,MAAyB,uBAAzB;AACA,OAAOC,YAAP,MAAyB,gBAAzB;AAEA,OAAOC,gBAAP,MAA6B,qBAA7B;AAEA,MAAMC,mBAAmB,GAAG,cAA5B;;AAgHA,MAAMC,UAGL,GAAG,CAACC,KAAD,EAA0BC,YAA1B,KAA2C;AAC7C,QAAMC,kBAAkB,GAAGhB,MAAM,CAAC,IAAD,CAAjC;AACA,QAAM,CAACiB,aAAD,EAAgBC,gBAAhB,IAAoCjB,QAAQ,CAChDO,aAAa,CAACW,WAAd,GAA4BF,aADoB,CAAlD;AAGA,QAAMG,SAAS,GAAGpB,MAAM,CAAU,KAAV,CAAxB;AACA,QAAM,GAAGqB,WAAH,IAAkBtB,UAAU,CAAEuB,CAAD,IAAOA,CAAC,GAAG,CAAZ,EAAe,CAAf,CAAlC;;AAEA,QAAMC,4BAA4B,GAAIC,KAAD,IAAsC;AACzEf,IAAAA,YAAY,CAACgB,GAAb,CACG,2CAA0CD,KAAK,CAACE,WAAN,CAAkBC,IAAK,EADpE;AAIA,UAAM;AAAEC,MAAAA,wBAAF;AAA4BC,MAAAA;AAA5B,QAAkDf,KAAxD;AACA,UAAM;AAAEa,MAAAA,IAAF;AAAQG,MAAAA;AAAR,QAAmBN,KAAK,CAACE,WAA/B;;AAEA,QAAIE,wBAAJ,EAA8B;AAC5B,UAAID,IAAJ,EAAU;AACR,YAAII,KAAc,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E,IAAA,KAAK,EAAE5C,MAAM,CAACoH,MAAP,CAAc;AAAEC,MAAAA,YAAY,EAAEzE;AAAhB,KAAd,EAA8CsE,KAA9C,CALT;AAME,IAAA,uBAAuB,EAAEhG,uBAN3B;AAOE,IAAA,sBAAsB,EAAEoG,SAP1B;AAQE,IAAA,wBAAwB,EAAE9I,4BAR5B;AASE,IAAA,iBAAiB,EAAEU,qBATrB;AAUE,IAAA,oCAAoC,EAClCC,wCAXJ;AAaE,IAAA,mCAAmC,EACjCI,uCAdJ;AAgBE,IAAA,qBAAqB,EAAEE;AAhBzB,KADF;AAoBD,CA5cD;;AA8cA,4BAAe5C,UAAU,CAACiB,UAAD,CAAzB","sourcesContent":["import type { ForwardRefRenderFunction } from 'react';\nimport React, {\n forwardRef,\n useEffect,\n useImperativeHandle,\n useReducer,\n useRef,\n useState,\n} from 'react';\n\nimport {\n findNodeHandle,\n NativeSyntheticEvent,\n Platform,\n StyleProp,\n UIManager,\n ViewStyle,\n} from 'react-native';\n\nimport FireworkSDK from '../FireworkSDK';\nimport type AdConfiguration from '../models/AdConfiguration';\nimport type FWError from '../models/FWError';\nimport { FWEventName } from '../models/FWEventName';\nimport type { StoryBlockConfiguration } from '../models/StoryBlockConfiguration';\nimport type StoryBlockNativeConfiguration from '../models/StoryBlockNativeConfiguration';\nimport type { StoryBlockSource } from '../models/StoryBlockSource';\nimport { FireworkSDKModuleEventEmitter } from '../modules/FireworkSDKModule';\nimport FWGlobalState from '../utils/FWGlobalState';\nimport FWLoggerUtil from '../utils/FWLoggerUtil';\nimport FWStoryBlock from './FWStoryBlock';\nimport type ButtonInfo from '../models/ButtonInfo';\nimport gennerateJsonKey from '../utils/FWJsonUtil';\n\nconst NativeComponentName = 'FWStoryBlock';\n\nexport interface IStoryBlockMethods {\n /**\n * Play the story block.\n */\n play: () => void;\n /**\n * Pause the story block.\n */\n pause: () => void;\n /**\n * Open the fullscreen story block.\n * Only supported on Android.\n */\n openFullscreen: () => void;\n /**\n * Triggered when the story block enters the viewport.\n * Only supported on iOS.\n * It is recommended that the host app is triggered when listening for scrolling.\n */\n onViewportEntered: () => void;\n /**\n * Triggered when the story block leaves the viewport.\n * Only supported on iOS.\n * It is recommended that the host app is triggered when listening for scrolling.\n */\n onViewportLeft: () => void;\n}\n\n/**\n * The props type of StoryBlock component.\n */\nexport interface IStoryBlockProps {\n /**\n * Standard React Native View Style.\n */\n style?: StyleProp<ViewStyle>;\n /**\n * One of four available story block sources.\n */\n source: StoryBlockSource;\n /**\n * Channel id of the story block. Required when the source is set as channel or playlist or dynamicContent.\n */\n channel?: string;\n /**\n * Playlist id of the story block. Please note channel id is necessary. Required when the source is set as playlist.\n */\n playlist?: string;\n /**\n * The dynamic content parameters of the story block. Required when the source is set as dynamicContent.\n */\n dynamicContentParameters?: { [key: string]: string[] };\n /**\n * Hashtag filter expression is an s-expression used to provide feeds filtered by hashtags with specified criteria.\n * Queries are specified with boolean predicates on what hashtags are there on the video.\n * For instance, (and sport food) (or sport food) (and sport (or food comedy)) sport are all valid expressions.\n * Non-UTF-8 characters are not allowed. If using boolean predicates, the expression needs to be wrapped with parenthesis.\n */\n hashtagFilterExpression?: string;\n /**\n * Product ids used to generate the sku feed\n */\n productIds?: string[];\n /**\n * The video or live stream id.\n */\n contentId?: string;\n /**\n * Specifies if Picture in Picture is enabled. Only supported on iOS.\n */\n enablePictureInPicture?: boolean;\n /**\n * The corner radius of story block.\n */\n cornerRadius?: number;\n /**\n * Ad configuration of the feed.\n */\n adConfiguration?: AdConfiguration;\n\n /* The configuration of the story block. */\n storyBlockConfiguration?: StoryBlockConfiguration;\n /**\n * The feed loading result callback. It means loading successfully when error equals to undefined.\n */\n onStoryBlockLoadFinished?: (error?: FWError) => void;\n /**\n * The callback is triggered when there are no items in the story block.\n * The callback is triggered in the following cases:\n * 1. Loading successfully but the back end returns an empty list.\n * 2. The load failed and list is empty.\n * onStoryBlockLoadFinished will also be triggered when onStoryBlockEmpty is triggered.\n */\n onStoryBlockEmpty?: (error?: FWError) => void;\n /**\n * Start Picture in Picture callback. Only supported on iOS.\n */\n onStoryBlockDidStartPictureInPicture?: (error?: FWError) => void;\n /**\n * Stop Picture in Picture callback. Only supported on iOS.\n */\n onStoryBlockDidStopPictureInPicture?: (error?: FWError) => void;\n /**\n *\n * The host app could use this callback to get feed id.\n * The feed id can be used for conversion tracking.\n */\n onStoryBlockGetFeedId?: (feedId: string) => void;\n}\n\nconst StoryBlock: ForwardRefRenderFunction<\n IStoryBlockMethods,\n IStoryBlockProps\n> = (props: IStoryBlockProps, forwardedRef) => {\n const nativeComponentRef = useRef(null);\n const [sdkInitCalled, setSdkInitCalled] = useState<boolean>(\n FWGlobalState.getInstance().sdkInitCalled\n );\n const loadedRef = useRef<boolean>(false);\n const [, forceUpdate] = useReducer((x) => x + 1, 0);\n\n const handleStoryBlockLoadFinished = (event: NativeSyntheticEvent<any>) => {\n FWLoggerUtil.log(\n `StoryBlock handleStoryBlockLoadFinished ${event.nativeEvent.name}`\n );\n\n const { onStoryBlockLoadFinished, onStoryBlockEmpty } = props;\n const { name, reason } = event.nativeEvent;\n\n if (onStoryBlockLoadFinished) {\n if (name) {\n let error: FWError = { name };\n if (reason) {\n error.reason = reason;\n }\n\n onStoryBlockLoadFinished(error);\n if (!loadedRef.current) {\n onStoryBlockEmpty?.(error);\n }\n } else {\n onStoryBlockLoadFinished();\n loadedRef.current = true;\n }\n }\n };\n\n const handleStoryBlockEmpty = (event: NativeSyntheticEvent<any>) => {\n FWLoggerUtil.log(`StoryBlock handleStoryBlockEmpty ${event.nativeEvent}`);\n\n const { onStoryBlockEmpty } = props;\n\n if (onStoryBlockEmpty) {\n onStoryBlockEmpty();\n }\n };\n\n const handleStoryBlockDidStartPictureInPicture = (\n event: NativeSyntheticEvent<any>\n ) => {\n FWLoggerUtil.log(\n `StoryBlock handleStoryBlockDidStartPictureInPicture ${JSON.stringify(\n event.nativeEvent\n )}`\n );\n const { onStoryBlockDidStartPictureInPicture } = props;\n\n const { name, reason } = event.nativeEvent;\n\n if (onStoryBlockDidStartPictureInPicture) {\n if (name) {\n if (reason) {\n onStoryBlockDidStartPictureInPicture({ name, reason });\n } else {\n onStoryBlockDidStartPictureInPicture({ name });\n }\n } else {\n onStoryBlockDidStartPictureInPicture();\n }\n }\n };\n\n const handleStoryBlockDidStopPictureInPicture = (\n event: NativeSyntheticEvent<any>\n ) => {\n FWLoggerUtil.log(\n `StoryBlock handleStoryBlockDidStopPictureInPicture ${JSON.stringify(\n event.nativeEvent\n )}`\n );\n const { onStoryBlockDidStopPictureInPicture } = props;\n\n const { name, reason } = event.nativeEvent;\n\n if (onStoryBlockDidStopPictureInPicture) {\n if (name) {\n if (reason) {\n onStoryBlockDidStopPictureInPicture({ name, reason });\n } else {\n onStoryBlockDidStopPictureInPicture({ name });\n }\n } else {\n onStoryBlockDidStopPictureInPicture();\n }\n }\n };\n\n const handleStoryBlockGetFeedId = (event: NativeSyntheticEvent<any>) => {\n FWLoggerUtil.log(\n `StoryBlock handleStoryBlockGetFeedId ${JSON.stringify(\n event.nativeEvent\n )}`\n );\n const { onStoryBlockGetFeedId } = props;\n\n const { feedId } = event.nativeEvent;\n\n if (onStoryBlockGetFeedId) {\n onStoryBlockGetFeedId(feedId ?? '');\n }\n };\n\n const generateDynamicContentParametersString = (): string => {\n const { dynamicContentParameters } = props;\n\n if (!dynamicContentParameters) {\n return '';\n }\n\n let resultString = '';\n const sortedKeyList = Object.keys(dynamicContentParameters).sort();\n for (const key of sortedKeyList) {\n const value = dynamicContentParameters[key];\n const valueString = value.join(',');\n if (resultString.length > 0) {\n resultString += '_';\n }\n\n resultString += `${key}:${valueString}`;\n }\n\n return resultString;\n };\n\n const generateVastAttributesString = () => {\n const { adConfiguration } = props;\n const vastAttributes = adConfiguration?.vastAttributes;\n if (!vastAttributes) {\n return '';\n }\n\n let resultString = '';\n for (const attribute of vastAttributes) {\n if (resultString.length > 0) {\n resultString += '_';\n }\n resultString += `${attribute.name ?? ''}:${attribute.value}`;\n }\n\n return resultString;\n };\n\n const generateButtonInfoString = (buttonInfo?: ButtonInfo) => {\n return `imageName:${buttonInfo?.imageName}_systemImageName:${buttonInfo?.systemImageName}_tintColor:${buttonInfo?.tintColor}`;\n };\n\n const getStoryBlockConfiguration: () =>\n | StoryBlockNativeConfiguration\n | undefined = () => {\n const { storyBlockConfiguration, enablePictureInPicture } = props;\n let resultStoryBlockConfiguration:\n | StoryBlockNativeConfiguration\n | undefined = storyBlockConfiguration;\n if (typeof enablePictureInPicture === 'boolean') {\n if (!resultStoryBlockConfiguration) {\n resultStoryBlockConfiguration = {};\n }\n resultStoryBlockConfiguration = {\n ...resultStoryBlockConfiguration,\n enablePictureInPicture,\n };\n }\n return resultStoryBlockConfiguration;\n };\n const storyBlockConfiguration = getStoryBlockConfiguration();\n\n const generateKey = (): string => {\n const gShareBaseURL = FireworkSDK.getInstance().shareBaseURL;\n const appLanguage = FireworkSDK.getInstance().appLanguage;\n const videoLaunchBehavior = FireworkSDK.getInstance().videoLaunchBehavior;\n const adBadgeConfiguration = FireworkSDK.getInstance().adBadgeConfiguration;\n const adBadgeTextType = adBadgeConfiguration?.badgeTextType;\n const backgroundColorOfAdBadge = adBadgeConfiguration?.backgroundColor;\n const textColorOfAdBadge = adBadgeConfiguration?.textColor;\n const androidFontIsCustomOfAdBadge =\n adBadgeConfiguration?.androidFontInfo?.isCustom;\n const androidFontTypefaceNameOfAdBadge =\n adBadgeConfiguration?.androidFontInfo?.typefaceName;\n\n const {\n source,\n channel,\n playlist,\n hashtagFilterExpression,\n productIds,\n contentId,\n enablePictureInPicture,\n cornerRadius,\n adConfiguration,\n } = props;\n const dynamicContentParametersString =\n generateDynamicContentParametersString();\n\n const playerStyle = storyBlockConfiguration?.playerStyle;\n const videoCompleteAction = storyBlockConfiguration?.videoCompleteAction;\n const showShareButton = storyBlockConfiguration?.showShareButton;\n const showPlaybackButton = storyBlockConfiguration?.showPlaybackButton;\n const showMuteButton = storyBlockConfiguration?.showMuteButton;\n const showBranding = storyBlockConfiguration?.showBranding;\n const ctaDelayType = storyBlockConfiguration?.ctaDelay?.type;\n const ctaDelayValue = storyBlockConfiguration?.ctaDelay?.value?.toFixed(5);\n const ctaHighlightDelayType =\n storyBlockConfiguration?.ctaHighlightDelay?.type;\n const ctaHighlightDelayValue =\n storyBlockConfiguration?.ctaHighlightDelay?.value?.toFixed(5);\n const shareBaseURL = storyBlockConfiguration?.shareBaseURL;\n const buttonConfiguration = storyBlockConfiguration?.buttonConfiguration;\n const videoPlayerLogoConfigurationJsonKey = gennerateJsonKey(\n storyBlockConfiguration?.videoPlayerLogoConfiguration\n );\n const ctaWidth = storyBlockConfiguration?.ctaWidth;\n const showVideoDetailTitle = storyBlockConfiguration?.showVideoDetailTitle;\n\n const requiresAds = adConfiguration?.requiresAds;\n const adsFetchTimeout = adConfiguration?.adsFetchTimeout;\n const vastAttributesString = generateVastAttributesString();\n const productInfoViewConfigurationJsonKey = gennerateJsonKey(\n FireworkSDK.getInstance().shopping.productInfoViewConfiguration\n );\n const replayBadgeConfigurationJsonKey = gennerateJsonKey(\n storyBlockConfiguration?.replayBadgeConfiguration\n );\n const countdownTimerConfigurationJsonKey = gennerateJsonKey(\n storyBlockConfiguration?.countdownTimerConfiguration\n );\n\n let key = `gShareBaseURL:${gShareBaseURL}`;\n if (Platform.OS === 'ios') {\n key += `_appLanguage:${appLanguage}`;\n }\n key += `_videoLaunchBehavior:${videoLaunchBehavior}`;\n key += `_adBadgeTextType:${adBadgeTextType}`;\n key += `_backgroundColorOfAdBadge:${backgroundColorOfAdBadge}`;\n key += `_textColorOfAdBadge:${textColorOfAdBadge}`;\n if (Platform.OS === 'android') {\n key += `_androidFontIsCustomOfAdBadge${androidFontIsCustomOfAdBadge}`;\n key += `_androidFontTypefaceNameOfAdBadge${androidFontTypefaceNameOfAdBadge}`;\n }\n\n key += `_source:${source}`;\n key += `_channel:${channel}`;\n key += `_playlist:${playlist}`;\n key += `_dynamicContentParameters:${dynamicContentParametersString}`;\n key += `_hashtagFilterExpression:${hashtagFilterExpression}`;\n key += `productIds:${productIds?.join(',')}`;\n key += `_contentId:${contentId}`;\n key += `_enablePictureInPicture:${enablePictureInPicture}`;\n key += `_cornerRadius:${cornerRadius}`;\n\n key += `_shareBaseURL:${shareBaseURL}`;\n key += `_playerStyle:${playerStyle}`;\n key += `_videoCompleteAction:${videoCompleteAction}`;\n key += `_showShareButton:${showShareButton}`;\n key += `_showPlaybackButton:${showPlaybackButton}`;\n key += `_showMuteButton:${showMuteButton}`;\n key += `_showBranding:${showBranding}`;\n key += `_ctaDelayType:${ctaDelayType}`;\n key += `_ctaDelayValue:${ctaDelayValue}`;\n key += `_ctaHighlightDelayType:${ctaHighlightDelayType}`;\n key += `_ctaHighlightDelayValue:${ctaHighlightDelayValue}`;\n key += `_ctaWidth:${ctaWidth}`;\n key += `_buttonConfiguration.videoDetailButton:${generateButtonInfoString(\n buttonConfiguration?.videoDetailButton\n )}`;\n key += `_buttonConfiguration.closeButton:${generateButtonInfoString(\n buttonConfiguration?.closeButton\n )}`;\n key += `_buttonConfiguration.muteButton:${generateButtonInfoString(\n buttonConfiguration?.muteButton\n )}`;\n key += `_buttonConfiguration.unmuteButton:${generateButtonInfoString(\n buttonConfiguration?.unmuteButton\n )}`;\n key += `_buttonConfiguration.playButton:${generateButtonInfoString(\n buttonConfiguration?.playButton\n )}`;\n key += `_buttonConfiguration.pauseButton:${generateButtonInfoString(\n buttonConfiguration?.pauseButton\n )}`;\n if (Platform.OS === 'android') {\n key += `_videoPlayerLogoConfiguration:${videoPlayerLogoConfigurationJsonKey}`;\n }\n key += `_showVideoDetailTitle:${showVideoDetailTitle}`;\n\n key += `_requiresAds:${requiresAds}`;\n key += `_adsFetchTimeout:${adsFetchTimeout}`;\n key += `_vastAttributes:${vastAttributesString}`;\n key += `_productInfoViewConfiguration:${productInfoViewConfigurationJsonKey}`;\n key += `_replayBadgeConfiguration:${replayBadgeConfigurationJsonKey}`;\n key += `_countdownTimerConfiguration:${countdownTimerConfigurationJsonKey}`;\n\n return key;\n };\n\n const key = generateKey();\n\n console.log('story block key', key);\n\n useImperativeHandle(\n forwardedRef,\n () => {\n const sendCommand = (command: string) => {\n const nativeNodeHandle = findNodeHandle(nativeComponentRef.current);\n\n let commandId: string | number =\n UIManager.getViewManagerConfig(NativeComponentName).Commands[command];\n if (Platform.OS === 'android') {\n commandId = commandId.toString();\n }\n let reactTag: number | null = findNodeHandle(nativeNodeHandle);\n FWLoggerUtil.log(\n `StoryBlock sendCommand: ${command} commandId: ${commandId} nativeNodeHandle: ${nativeNodeHandle} reactTag: ${reactTag}`\n );\n if (!nativeNodeHandle || !reactTag) {\n return;\n }\n UIManager.dispatchViewManagerCommand(reactTag, commandId, []);\n };\n return {\n play: () => {\n sendCommand('play');\n },\n pause: () => {\n sendCommand('pause');\n },\n openFullscreen: () => {\n sendCommand('openFullscreen');\n },\n onViewportEntered: () => {\n if (Platform.OS !== 'ios') {\n return;\n }\n sendCommand('onViewportEntered');\n },\n onViewportLeft: () => {\n if (Platform.OS !== 'ios') {\n return;\n }\n sendCommand('onViewportLeft');\n },\n };\n },\n []\n );\n\n useEffect(() => {\n const subscriptionOfShareBaseURLUpdated =\n FireworkSDKModuleEventEmitter.addListener(\n FWEventName.ShareBaseURLUpdated,\n () => {\n FWLoggerUtil.log('Receive FWEventName.ShareBaseURLUpdated');\n forceUpdate();\n }\n );\n const subscriptionOfAdBadgeConfigurationUpdated =\n FireworkSDKModuleEventEmitter.addListener(\n FWEventName.AdBadgeConfigurationUpdated,\n () => {\n FWLoggerUtil.log('Receive FWEventName.AdBadgeConfigurationUpdated');\n forceUpdate();\n }\n );\n\n const subscriptionOfVideoLaunchBehaviorUpdated =\n FireworkSDKModuleEventEmitter.addListener(\n FWEventName.VideoLaunchBehaviorUpdated,\n () => {\n FWLoggerUtil.log('Receive FWEventName.VideoLaunchBehaviorUpdated');\n forceUpdate();\n }\n );\n\n const subscriptionOfAppLanguageUpdated =\n FireworkSDKModuleEventEmitter.addListener(\n FWEventName.AppLanguageUpdated,\n () => {\n FWLoggerUtil.log('Receive FWEventName.AppLanguageUpdated');\n forceUpdate();\n }\n );\n\n const subscriptionOfProductInfoViewConfigurationUpdated =\n FireworkSDKModuleEventEmitter.addListener(\n FWEventName.ProductInfoViewConfigurationUpdated,\n () => {\n FWLoggerUtil.log(\n 'Receive FWEventName.ProductInfoViewConfigurationUpdated'\n );\n forceUpdate();\n }\n );\n\n return () => {\n subscriptionOfShareBaseURLUpdated.remove();\n subscriptionOfAdBadgeConfigurationUpdated.remove();\n subscriptionOfVideoLaunchBehaviorUpdated.remove();\n subscriptionOfAppLanguageUpdated.remove();\n subscriptionOfProductInfoViewConfigurationUpdated.remove();\n };\n }, []);\n\n useEffect(() => {\n if (Platform.OS === 'android') {\n setTimeout(() => {\n const viewId = findNodeHandle(nativeComponentRef.current);\n FWLoggerUtil.log(`StoryBlock createFragment viewId: ${viewId}`);\n if (!viewId) {\n return;\n }\n UIManager.dispatchViewManagerCommand(\n viewId,\n UIManager.getViewManagerConfig(\n NativeComponentName\n ).Commands.create.toString(),\n [viewId]\n );\n }, 500);\n }\n }, [key]);\n\n useEffect(() => {\n FWGlobalState.getInstance().sdkInitCalledPromise.then(() => {\n setSdkInitCalled(true);\n });\n }, []);\n\n if (!sdkInitCalled) {\n return null;\n }\n const { style, cornerRadius, ...otherProps } = props;\n return (\n <FWStoryBlock\n ref={nativeComponentRef}\n key={key}\n {...otherProps}\n cornerRadius={cornerRadius}\n style={Object.assign({ borderRadius: cornerRadius }, style)}\n storyBlockConfiguration={storyBlockConfiguration}\n enablePictureInPicture={undefined}\n onStoryBlockLoadFinished={handleStoryBlockLoadFinished}\n onStoryBlockEmpty={handleStoryBlockEmpty}\n onStoryBlockDidStartPictureInPicture={\n handleStoryBlockDidStartPictureInPicture\n }\n onStoryBlockDidStopPictureInPicture={\n handleStoryBlockDidStopPictureInPicture\n }\n onStoryBlockGetFeedId={handleStoryBlockGetFeedId}\n />\n );\n};\n\nexport default forwardRef(StoryBlock);\n"]}
@@ -6,8 +6,10 @@ import React from 'react';
6
6
  import { findNodeHandle, Platform, UIManager } from 'react-native';
7
7
  import FireworkSDK from '../FireworkSDK';
8
8
  import { FWEventName } from '../models/FWEventName';
9
+ import { FWNativeErrorAction } from '../models/FWNativeErrorAction';
9
10
  import { FireworkSDKModuleEventEmitter } from '../modules/FireworkSDKModule';
10
11
  import FWGlobalState from '../utils/FWGlobalState';
12
+ import gennerateJsonKey from '../utils/FWJsonUtil';
11
13
  import FWLoggerUtil from '../utils/FWLoggerUtil';
12
14
  import FWVideoFeed from './FWVideoFeed';
13
15
  const NativeComponentName = 'FWVideoFeed';
@@ -37,7 +39,14 @@ class VideoFeed extends React.Component {
37
39
  commandId = commandId.toString();
38
40
  }
39
41
 
40
- UIManager.dispatchViewManagerCommand(findNodeHandle(nativeNodeHandle), commandId, []);
42
+ let reactTag = findNodeHandle(nativeNodeHandle);
43
+ FWLoggerUtil.log(`StoryBlock refresh commandId: ${commandId} nativeNodeHandle: ${nativeNodeHandle} reactTag: ${reactTag}`);
44
+
45
+ if (!nativeNodeHandle || !reactTag) {
46
+ return;
47
+ }
48
+
49
+ UIManager.dispatchViewManagerCommand(reactTag, commandId, []);
41
50
  });
42
51
 
43
52
  _defineProperty(this, "_onVideoFeedLoadFinished", event => {
@@ -48,7 +57,8 @@ class VideoFeed extends React.Component {
48
57
  } = this.props;
49
58
  const {
50
59
  name,
51
- reason
60
+ reason,
61
+ action
52
62
  } = event.nativeEvent;
53
63
 
54
64
  if (onVideoFeedLoadFinished) {
@@ -63,8 +73,14 @@ class VideoFeed extends React.Component {
63
73
 
64
74
  onVideoFeedLoadFinished(error);
65
75
 
66
- if (!this._loaded) {
67
- onVideoFeedEmpty === null || onVideoFeedEmpty === void 0 ? void 0 : onVideoFeedEmpty(error);
76
+ if (Platform.OS === 'android') {
77
+ if (action === FWNativeErrorAction.loadingFirstPage || !this._loaded) {
78
+ onVideoFeedEmpty === null || onVideoFeedEmpty === void 0 ? void 0 : onVideoFeedEmpty(error);
79
+ }
80
+ } else {
81
+ if (!this._loaded) {
82
+ onVideoFeedEmpty === null || onVideoFeedEmpty === void 0 ? void 0 : onVideoFeedEmpty(error);
83
+ }
68
84
  }
69
85
  } else {
70
86
  onVideoFeedLoadFinished();
@@ -140,6 +156,20 @@ class VideoFeed extends React.Component {
140
156
  }
141
157
  });
142
158
 
159
+ _defineProperty(this, "_onVideoFeedGetFeedId", event => {
160
+ FWLoggerUtil.log(`VideoFeed onVideoFeedGetFeedId ${JSON.stringify(event.nativeEvent)}`);
161
+ const {
162
+ onVideoFeedGetFeedId
163
+ } = this.props;
164
+ const {
165
+ feedId
166
+ } = event.nativeEvent;
167
+
168
+ if (onVideoFeedGetFeedId) {
169
+ onVideoFeedGetFeedId(feedId !== null && feedId !== void 0 ? feedId : '');
170
+ }
171
+ });
172
+
143
173
  this.state = {
144
174
  sdkInitCalled: FWGlobalState.getInstance().sdkInitCalled
145
175
  };
@@ -268,12 +298,16 @@ class VideoFeed extends React.Component {
268
298
  const shareBaseURL = videoPlayerConfiguration === null || videoPlayerConfiguration === void 0 ? void 0 : videoPlayerConfiguration.shareBaseURL;
269
299
  const ctaWidth = videoPlayerConfiguration === null || videoPlayerConfiguration === void 0 ? void 0 : videoPlayerConfiguration.ctaWidth;
270
300
  const buttonConfiguration = videoPlayerConfiguration === null || videoPlayerConfiguration === void 0 ? void 0 : videoPlayerConfiguration.buttonConfiguration;
301
+ const videoPlayerLogoConfigurationJsonKey = gennerateJsonKey(videoPlayerConfiguration === null || videoPlayerConfiguration === void 0 ? void 0 : videoPlayerConfiguration.videoPlayerLogoConfiguration);
302
+ const countdownTimerConfigurationJsonKey = gennerateJsonKey(videoPlayerConfiguration === null || videoPlayerConfiguration === void 0 ? void 0 : videoPlayerConfiguration.countdownTimerConfiguration);
271
303
  const showVideoDetailTitle = videoPlayerConfiguration === null || videoPlayerConfiguration === void 0 ? void 0 : videoPlayerConfiguration.showVideoDetailTitle;
272
304
  const requiresAds = adConfiguration === null || adConfiguration === void 0 ? void 0 : adConfiguration.requiresAds;
273
305
  const adsFetchTimeout = adConfiguration === null || adConfiguration === void 0 ? void 0 : adConfiguration.adsFetchTimeout;
274
306
 
275
307
  const vastAttributesString = this._generateVastAttributesString();
276
308
 
309
+ const replayBadgeVideoFeedConfigurationJsonKey = gennerateJsonKey(videoFeedConfiguration === null || videoFeedConfiguration === void 0 ? void 0 : videoFeedConfiguration.replayBadge);
310
+ const replayBadgeVideoPlayerConfigurationJsonKey = gennerateJsonKey(videoPlayerConfiguration === null || videoPlayerConfiguration === void 0 ? void 0 : videoPlayerConfiguration.replayBadgeConfiguration);
277
311
  let key = `gShareBaseURL:${gShareBaseURL}`;
278
312
 
279
313
  if (Platform.OS === 'ios') {
@@ -345,12 +379,17 @@ class VideoFeed extends React.Component {
345
379
  key += `_buttonConfiguration.unmuteButton:${this._generateButtonInfoString(buttonConfiguration === null || buttonConfiguration === void 0 ? void 0 : buttonConfiguration.unmuteButton)}`;
346
380
  key += `_buttonConfiguration.playButton:${this._generateButtonInfoString(buttonConfiguration === null || buttonConfiguration === void 0 ? void 0 : buttonConfiguration.playButton)}`;
347
381
  key += `_buttonConfiguration.pauseButton:${this._generateButtonInfoString(buttonConfiguration === null || buttonConfiguration === void 0 ? void 0 : buttonConfiguration.pauseButton)}`;
382
+ key += `_videoPlayerLogoConfiguration:${videoPlayerLogoConfigurationJsonKey}`;
383
+ key += `_countdownTimerConfiguration:${countdownTimerConfigurationJsonKey}`;
348
384
  key += `_showVideoDetailTitle:${showVideoDetailTitle}`;
349
385
  }
350
386
 
351
387
  key += `_requiresAds:${requiresAds}`;
352
388
  key += `_adsFetchTimeout:${adsFetchTimeout}`;
353
389
  key += `_vastAttributes:${vastAttributesString}`;
390
+ key += `_replayBadgeVideoFeedConfiguration:${replayBadgeVideoFeedConfigurationJsonKey}`;
391
+ key += `_replayBadgeVideoPlayerConfiguration:${replayBadgeVideoPlayerConfigurationJsonKey}`;
392
+ console.log('video feed key', key);
354
393
  return /*#__PURE__*/React.createElement(FWVideoFeed, _extends({
355
394
  key: key
356
395
  }, this.props, {
@@ -362,6 +401,7 @@ class VideoFeed extends React.Component {
362
401
  onVideoFeedEmpty: this._onVideoFeedEmpty,
363
402
  onVideoFeedDidStartPictureInPicture: this._onVideoFeedDidStartPictureInPicture,
364
403
  onVideoFeedDidStopPictureInPicture: this._onVideoFeedDidStopPictureInPicture,
404
+ onVideoFeedGetFeedId: this._onVideoFeedGetFeedId,
365
405
  mode: mode !== null && mode !== void 0 ? mode : 'row'
366
406
  }));
367
407
  }