react-native-firework-sdk 2.3.0 → 2.4.0-beta.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 (310) hide show
  1. package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/FireworkVideoUI +0 -0
  2. package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Info.plist +0 -0
  3. package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios.abi.json +24 -10
  4. package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios.private.swiftinterface +1 -1
  5. package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
  6. package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios.swiftinterface +1 -1
  7. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/FireworkVideoUI +0 -0
  8. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Info.plist +0 -0
  9. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios-simulator.abi.json +24 -10
  10. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +1 -1
  11. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
  12. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios-simulator.swiftinterface +1 -1
  13. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/x86_64-apple-ios-simulator.abi.json +24 -10
  14. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +1 -1
  15. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
  16. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +1 -1
  17. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/_CodeSignature/CodeResources +21 -21
  18. package/android/gradle.properties +1 -1
  19. package/android/src/main/java/com/fireworksdk/bridge/components/storyblock/StoryBlockFragment.kt +20 -0
  20. package/android/src/main/java/com/fireworksdk/bridge/components/videofeed/FWVideoFeed.kt +1 -69
  21. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoFeedPropsModel.kt +3 -1
  22. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoFeedPropsModelDeserializer.kt +21 -4
  23. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoFeedPropsModelSerializer.kt +15 -3
  24. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoPlayerConfigModel.kt +2 -1
  25. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoPlayerConfigModelDeserializer.kt +3 -0
  26. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoPlayerConfigModelSerializer.kt +2 -0
  27. package/android/src/main/java/com/fireworksdk/bridge/models/enums/FWVideoFeedSource.kt +3 -1
  28. package/android/src/main/java/com/fireworksdk/bridge/reactnative/FWReactNativeSDK.kt +6 -0
  29. package/android/src/main/java/com/fireworksdk/bridge/reactnative/manager/FWStoryBlockManager.kt +20 -15
  30. package/android/src/main/java/com/fireworksdk/bridge/reactnative/manager/FWVideoFeedManager.kt +45 -16
  31. package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FireworkSDKModule.kt +5 -0
  32. package/android/src/main/java/com/fireworksdk/bridge/utils/FWConfigUtil.kt +11 -1
  33. package/android/src/main/java/com/fireworksdk/bridge/utils/FWImageLoaderUtil.kt +16 -0
  34. package/ios/Components/StoryBlock.swift +9 -7
  35. package/ios/Components/StoryBlockConfiguration.swift +13 -0
  36. package/ios/Components/StoryBlockManager.m +6 -1
  37. package/ios/Components/VideoFeed.swift +5 -10
  38. package/ios/Components/VideoFeedManager.m +1 -2
  39. package/ios/Components/VideoPlayerConfiguration.swift +1 -0
  40. package/ios/FireworkSdk.xcodeproj/project.pbxproj +4 -26
  41. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/AppLanguageManager.swift +13 -2
  42. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/UIKit/UIImageView+AppLanguage.swift +0 -34
  43. package/ios/FireworkVideoUI/Podfile +1 -1
  44. package/ios/FireworkVideoUI/Podfile.lock +4 -4
  45. package/ios/Models/RNToNative/RCTConvert+FireworkSDKModule.swift +1 -0
  46. package/ios/Models/RNToNative/RCTConvert+StoryBlock.swift +16 -1
  47. package/ios/Models/RNToNative/RCTConvert+VideoFeed.swift +2 -1
  48. package/ios/Modules/FireworkSDKModule/FireworkSDKModule.swift +8 -4
  49. package/ios/Modules/Shopping/ShoppingModule.swift +6 -5
  50. package/ios/react_native_firework_sdk.h +0 -1
  51. package/package.json +2 -2
  52. package/react-native-firework-sdk.podspec +1 -1
  53. package/src/FireworkSDK.ts +2 -2
  54. package/src/components/StoryBlock.tsx +65 -36
  55. package/src/components/VideoFeed.tsx +87 -74
  56. package/src/index.ts +2 -0
  57. package/src/models/AdBadgeConfiguration.ts +3 -0
  58. package/src/models/AndroidFontInfo.ts +1 -1
  59. package/src/models/OpenVideoPlayerConfiguration.ts +9 -0
  60. package/src/models/Product.ts +1 -1
  61. package/src/models/ProductUnit.ts +1 -1
  62. package/src/models/StoryBlockConfiguration.ts +1 -1
  63. package/src/models/StoryBlockNativeConfiguration.ts +9 -0
  64. package/src/models/StoryBlockSource.ts +2 -1
  65. package/src/models/VideoFeedConfiguration.ts +29 -4
  66. package/src/models/VideoFeedSource.ts +2 -1
  67. package/src/models/VideoPlayerCTAStyle.ts +6 -0
  68. package/src/models/VideoPlayerConfiguration.ts +10 -1
  69. package/src/models/VideoPlayerNativeConfiguration.ts +9 -0
  70. package/src/modules/FireworkSDKModule.ts +2 -2
  71. package/ios/Modules/Shopping/FWCartViewController.swift +0 -14
  72. package/ios/Utils/Extensions/Swizzle/UINavigationController+FWSwizzle.swift +0 -31
  73. package/ios/Utils/FWSwizzleLoader.h +0 -15
  74. package/ios/Utils/FWSwizzleLoader.m +0 -21
  75. package/ios/Utils/FWSwizzleLoader.swift +0 -13
  76. package/lib/commonjs/FWNavigator.js +0 -75
  77. package/lib/commonjs/FWNavigator.js.map +0 -1
  78. package/lib/commonjs/FireworkSDK.js +0 -341
  79. package/lib/commonjs/FireworkSDK.js.map +0 -1
  80. package/lib/commonjs/LiveStream.js +0 -66
  81. package/lib/commonjs/LiveStream.js.map +0 -1
  82. package/lib/commonjs/VideoShopping.js +0 -247
  83. package/lib/commonjs/VideoShopping.js.map +0 -1
  84. package/lib/commonjs/components/FWStoryBlock.js +0 -18
  85. package/lib/commonjs/components/FWStoryBlock.js.map +0 -1
  86. package/lib/commonjs/components/FWVideoFeed.js +0 -18
  87. package/lib/commonjs/components/FWVideoFeed.js.map +0 -1
  88. package/lib/commonjs/components/StoryBlock.js +0 -319
  89. package/lib/commonjs/components/StoryBlock.js.map +0 -1
  90. package/lib/commonjs/components/VideoFeed.js +0 -390
  91. package/lib/commonjs/components/VideoFeed.js.map +0 -1
  92. package/lib/commonjs/constants/FWErrorMessage.js +0 -15
  93. package/lib/commonjs/constants/FWErrorMessage.js.map +0 -1
  94. package/lib/commonjs/index.js +0 -84
  95. package/lib/commonjs/index.js.map +0 -1
  96. package/lib/commonjs/models/AdBadgeConfiguration.js +0 -2
  97. package/lib/commonjs/models/AdBadgeConfiguration.js.map +0 -1
  98. package/lib/commonjs/models/AdConfiguration.js +0 -2
  99. package/lib/commonjs/models/AdConfiguration.js.map +0 -1
  100. package/lib/commonjs/models/AndroidFontInfo.js +0 -2
  101. package/lib/commonjs/models/AndroidFontInfo.js.map +0 -1
  102. package/lib/commonjs/models/FWError.js +0 -2
  103. package/lib/commonjs/models/FWError.js.map +0 -1
  104. package/lib/commonjs/models/FWEventName.js +0 -29
  105. package/lib/commonjs/models/FWEventName.js.map +0 -1
  106. package/lib/commonjs/models/FWEvents.js +0 -6
  107. package/lib/commonjs/models/FWEvents.js.map +0 -1
  108. package/lib/commonjs/models/FeedItemDetails.js +0 -2
  109. package/lib/commonjs/models/FeedItemDetails.js.map +0 -1
  110. package/lib/commonjs/models/GradientDrawable.js +0 -2
  111. package/lib/commonjs/models/GradientDrawable.js.map +0 -1
  112. package/lib/commonjs/models/IOSFontInfo.js +0 -2
  113. package/lib/commonjs/models/IOSFontInfo.js.map +0 -1
  114. package/lib/commonjs/models/LiveStreamChatEventName.js +0 -15
  115. package/lib/commonjs/models/LiveStreamChatEventName.js.map +0 -1
  116. package/lib/commonjs/models/LiveStreamEventDetails.js +0 -2
  117. package/lib/commonjs/models/LiveStreamEventDetails.js.map +0 -1
  118. package/lib/commonjs/models/LiveStreamEventName.js +0 -17
  119. package/lib/commonjs/models/LiveStreamEventName.js.map +0 -1
  120. package/lib/commonjs/models/LiveStreamMessageDetails.js +0 -2
  121. package/lib/commonjs/models/LiveStreamMessageDetails.js.map +0 -1
  122. package/lib/commonjs/models/Product.js +0 -2
  123. package/lib/commonjs/models/Product.js.map +0 -1
  124. package/lib/commonjs/models/ProductInfoViewConfiguration.js +0 -2
  125. package/lib/commonjs/models/ProductInfoViewConfiguration.js.map +0 -1
  126. package/lib/commonjs/models/ProductUnit.js +0 -2
  127. package/lib/commonjs/models/ProductUnit.js.map +0 -1
  128. package/lib/commonjs/models/SDKInitOptions.js +0 -2
  129. package/lib/commonjs/models/SDKInitOptions.js.map +0 -1
  130. package/lib/commonjs/models/ShoppingCTAResult.js +0 -2
  131. package/lib/commonjs/models/ShoppingCTAResult.js.map +0 -1
  132. package/lib/commonjs/models/StoryBlockConfiguration.js +0 -6
  133. package/lib/commonjs/models/StoryBlockConfiguration.js.map +0 -1
  134. package/lib/commonjs/models/StoryBlockSource.js +0 -2
  135. package/lib/commonjs/models/StoryBlockSource.js.map +0 -1
  136. package/lib/commonjs/models/TrackPurchaseParameters.js +0 -2
  137. package/lib/commonjs/models/TrackPurchaseParameters.js.map +0 -1
  138. package/lib/commonjs/models/VideoFeedConfiguration.js +0 -2
  139. package/lib/commonjs/models/VideoFeedConfiguration.js.map +0 -1
  140. package/lib/commonjs/models/VideoFeedSource.js +0 -2
  141. package/lib/commonjs/models/VideoFeedSource.js.map +0 -1
  142. package/lib/commonjs/models/VideoPlaybackDetails.js +0 -2
  143. package/lib/commonjs/models/VideoPlaybackDetails.js.map +0 -1
  144. package/lib/commonjs/models/VideoPlaybackEventName.js +0 -26
  145. package/lib/commonjs/models/VideoPlaybackEventName.js.map +0 -1
  146. package/lib/commonjs/models/VideoPlayerCTADelay.js +0 -2
  147. package/lib/commonjs/models/VideoPlayerCTADelay.js.map +0 -1
  148. package/lib/commonjs/models/VideoPlayerCTAStyle.js +0 -6
  149. package/lib/commonjs/models/VideoPlayerCTAStyle.js.map +0 -1
  150. package/lib/commonjs/models/VideoPlayerCTAWidth.js +0 -2
  151. package/lib/commonjs/models/VideoPlayerCTAWidth.js.map +0 -1
  152. package/lib/commonjs/models/VideoPlayerCompleteAction.js +0 -2
  153. package/lib/commonjs/models/VideoPlayerCompleteAction.js.map +0 -1
  154. package/lib/commonjs/models/VideoPlayerConfiguration.js +0 -2
  155. package/lib/commonjs/models/VideoPlayerConfiguration.js.map +0 -1
  156. package/lib/commonjs/models/VideoPlayerStyle.js +0 -2
  157. package/lib/commonjs/models/VideoPlayerStyle.js.map +0 -1
  158. package/lib/commonjs/modules/FWNavigatorModule.js +0 -22
  159. package/lib/commonjs/modules/FWNavigatorModule.js.map +0 -1
  160. package/lib/commonjs/modules/FireworkSDKModule.js +0 -22
  161. package/lib/commonjs/modules/FireworkSDKModule.js.map +0 -1
  162. package/lib/commonjs/modules/LiveStreamModule.js +0 -22
  163. package/lib/commonjs/modules/LiveStreamModule.js.map +0 -1
  164. package/lib/commonjs/modules/ShoppingModule.js +0 -22
  165. package/lib/commonjs/modules/ShoppingModule.js.map +0 -1
  166. package/lib/commonjs/utils/FWGlobalState.js +0 -47
  167. package/lib/commonjs/utils/FWGlobalState.js.map +0 -1
  168. package/lib/commonjs/utils/FWLoggerUtil.js +0 -45
  169. package/lib/commonjs/utils/FWLoggerUtil.js.map +0 -1
  170. package/lib/module/FWNavigator.js +0 -58
  171. package/lib/module/FWNavigator.js.map +0 -1
  172. package/lib/module/FireworkSDK.js +0 -310
  173. package/lib/module/FireworkSDK.js.map +0 -1
  174. package/lib/module/LiveStream.js +0 -53
  175. package/lib/module/LiveStream.js.map +0 -1
  176. package/lib/module/VideoShopping.js +0 -222
  177. package/lib/module/VideoShopping.js.map +0 -1
  178. package/lib/module/components/FWStoryBlock.js +0 -8
  179. package/lib/module/components/FWStoryBlock.js.map +0 -1
  180. package/lib/module/components/FWVideoFeed.js +0 -8
  181. package/lib/module/components/FWVideoFeed.js.map +0 -1
  182. package/lib/module/components/StoryBlock.js +0 -282
  183. package/lib/module/components/StoryBlock.js.map +0 -1
  184. package/lib/module/components/VideoFeed.js +0 -365
  185. package/lib/module/components/VideoFeed.js.map +0 -1
  186. package/lib/module/constants/FWErrorMessage.js +0 -7
  187. package/lib/module/constants/FWErrorMessage.js.map +0 -1
  188. package/lib/module/index.js +0 -12
  189. package/lib/module/index.js.map +0 -1
  190. package/lib/module/models/AdBadgeConfiguration.js +0 -2
  191. package/lib/module/models/AdBadgeConfiguration.js.map +0 -1
  192. package/lib/module/models/AdConfiguration.js +0 -2
  193. package/lib/module/models/AdConfiguration.js.map +0 -1
  194. package/lib/module/models/AndroidFontInfo.js +0 -2
  195. package/lib/module/models/AndroidFontInfo.js.map +0 -1
  196. package/lib/module/models/FWError.js +0 -2
  197. package/lib/module/models/FWError.js.map +0 -1
  198. package/lib/module/models/FWEventName.js +0 -22
  199. package/lib/module/models/FWEventName.js.map +0 -1
  200. package/lib/module/models/FWEvents.js +0 -2
  201. package/lib/module/models/FWEvents.js.map +0 -1
  202. package/lib/module/models/FeedItemDetails.js +0 -2
  203. package/lib/module/models/FeedItemDetails.js.map +0 -1
  204. package/lib/module/models/GradientDrawable.js +0 -2
  205. package/lib/module/models/GradientDrawable.js.map +0 -1
  206. package/lib/module/models/IOSFontInfo.js +0 -2
  207. package/lib/module/models/IOSFontInfo.js.map +0 -1
  208. package/lib/module/models/LiveStreamChatEventName.js +0 -8
  209. package/lib/module/models/LiveStreamChatEventName.js.map +0 -1
  210. package/lib/module/models/LiveStreamEventDetails.js +0 -2
  211. package/lib/module/models/LiveStreamEventDetails.js.map +0 -1
  212. package/lib/module/models/LiveStreamEventName.js +0 -10
  213. package/lib/module/models/LiveStreamEventName.js.map +0 -1
  214. package/lib/module/models/LiveStreamMessageDetails.js +0 -2
  215. package/lib/module/models/LiveStreamMessageDetails.js.map +0 -1
  216. package/lib/module/models/Product.js +0 -2
  217. package/lib/module/models/Product.js.map +0 -1
  218. package/lib/module/models/ProductInfoViewConfiguration.js +0 -2
  219. package/lib/module/models/ProductInfoViewConfiguration.js.map +0 -1
  220. package/lib/module/models/ProductUnit.js +0 -2
  221. package/lib/module/models/ProductUnit.js.map +0 -1
  222. package/lib/module/models/SDKInitOptions.js +0 -2
  223. package/lib/module/models/SDKInitOptions.js.map +0 -1
  224. package/lib/module/models/ShoppingCTAResult.js +0 -2
  225. package/lib/module/models/ShoppingCTAResult.js.map +0 -1
  226. package/lib/module/models/StoryBlockConfiguration.js +0 -2
  227. package/lib/module/models/StoryBlockConfiguration.js.map +0 -1
  228. package/lib/module/models/StoryBlockSource.js +0 -2
  229. package/lib/module/models/StoryBlockSource.js.map +0 -1
  230. package/lib/module/models/TrackPurchaseParameters.js +0 -2
  231. package/lib/module/models/TrackPurchaseParameters.js.map +0 -1
  232. package/lib/module/models/VideoFeedConfiguration.js +0 -2
  233. package/lib/module/models/VideoFeedConfiguration.js.map +0 -1
  234. package/lib/module/models/VideoFeedSource.js +0 -2
  235. package/lib/module/models/VideoFeedSource.js.map +0 -1
  236. package/lib/module/models/VideoPlaybackDetails.js +0 -2
  237. package/lib/module/models/VideoPlaybackDetails.js.map +0 -1
  238. package/lib/module/models/VideoPlaybackEventName.js +0 -19
  239. package/lib/module/models/VideoPlaybackEventName.js.map +0 -1
  240. package/lib/module/models/VideoPlayerCTADelay.js +0 -2
  241. package/lib/module/models/VideoPlayerCTADelay.js.map +0 -1
  242. package/lib/module/models/VideoPlayerCTAStyle.js +0 -2
  243. package/lib/module/models/VideoPlayerCTAStyle.js.map +0 -1
  244. package/lib/module/models/VideoPlayerCTAWidth.js +0 -2
  245. package/lib/module/models/VideoPlayerCTAWidth.js.map +0 -1
  246. package/lib/module/models/VideoPlayerCompleteAction.js +0 -2
  247. package/lib/module/models/VideoPlayerCompleteAction.js.map +0 -1
  248. package/lib/module/models/VideoPlayerConfiguration.js +0 -2
  249. package/lib/module/models/VideoPlayerConfiguration.js.map +0 -1
  250. package/lib/module/models/VideoPlayerStyle.js +0 -2
  251. package/lib/module/models/VideoPlayerStyle.js.map +0 -1
  252. package/lib/module/modules/FWNavigatorModule.js +0 -13
  253. package/lib/module/modules/FWNavigatorModule.js.map +0 -1
  254. package/lib/module/modules/FireworkSDKModule.js +0 -12
  255. package/lib/module/modules/FireworkSDKModule.js.map +0 -1
  256. package/lib/module/modules/LiveStreamModule.js +0 -12
  257. package/lib/module/modules/LiveStreamModule.js.map +0 -1
  258. package/lib/module/modules/ShoppingModule.js +0 -12
  259. package/lib/module/modules/ShoppingModule.js.map +0 -1
  260. package/lib/module/utils/FWGlobalState.js +0 -39
  261. package/lib/module/utils/FWGlobalState.js.map +0 -1
  262. package/lib/module/utils/FWLoggerUtil.js +0 -36
  263. package/lib/module/utils/FWLoggerUtil.js.map +0 -1
  264. package/lib/typescript/FWNavigator.d.ts +0 -26
  265. package/lib/typescript/FireworkSDK.d.ts +0 -113
  266. package/lib/typescript/LiveStream.d.ts +0 -21
  267. package/lib/typescript/VideoShopping.d.ts +0 -74
  268. package/lib/typescript/components/FWStoryBlock.d.ts +0 -2
  269. package/lib/typescript/components/FWVideoFeed.d.ts +0 -2
  270. package/lib/typescript/components/StoryBlock.d.ts +0 -65
  271. package/lib/typescript/components/VideoFeed.d.ts +0 -105
  272. package/lib/typescript/constants/FWErrorMessage.d.ts +0 -2
  273. package/lib/typescript/index.d.ts +0 -52
  274. package/lib/typescript/models/AdBadgeConfiguration.d.ts +0 -22
  275. package/lib/typescript/models/AdConfiguration.d.ts +0 -22
  276. package/lib/typescript/models/AndroidFontInfo.d.ts +0 -14
  277. package/lib/typescript/models/FWError.d.ts +0 -10
  278. package/lib/typescript/models/FWEventName.d.ts +0 -19
  279. package/lib/typescript/models/FWEvents.d.ts +0 -70
  280. package/lib/typescript/models/FeedItemDetails.d.ts +0 -54
  281. package/lib/typescript/models/GradientDrawable.d.ts +0 -5
  282. package/lib/typescript/models/IOSFontInfo.d.ts +0 -21
  283. package/lib/typescript/models/LiveStreamChatEventName.d.ts +0 -7
  284. package/lib/typescript/models/LiveStreamEventDetails.d.ts +0 -3
  285. package/lib/typescript/models/LiveStreamEventName.d.ts +0 -15
  286. package/lib/typescript/models/LiveStreamMessageDetails.d.ts +0 -14
  287. package/lib/typescript/models/Product.d.ts +0 -23
  288. package/lib/typescript/models/ProductInfoViewConfiguration.d.ts +0 -38
  289. package/lib/typescript/models/ProductUnit.d.ts +0 -38
  290. package/lib/typescript/models/SDKInitOptions.d.ts +0 -11
  291. package/lib/typescript/models/ShoppingCTAResult.d.ts +0 -11
  292. package/lib/typescript/models/StoryBlockConfiguration.d.ts +0 -37
  293. package/lib/typescript/models/StoryBlockSource.d.ts +0 -1
  294. package/lib/typescript/models/TrackPurchaseParameters.d.ts +0 -26
  295. package/lib/typescript/models/VideoFeedConfiguration.d.ts +0 -108
  296. package/lib/typescript/models/VideoFeedSource.d.ts +0 -1
  297. package/lib/typescript/models/VideoPlaybackDetails.d.ts +0 -47
  298. package/lib/typescript/models/VideoPlaybackEventName.d.ts +0 -51
  299. package/lib/typescript/models/VideoPlayerCTADelay.d.ts +0 -11
  300. package/lib/typescript/models/VideoPlayerCTAStyle.d.ts +0 -21
  301. package/lib/typescript/models/VideoPlayerCTAWidth.d.ts +0 -1
  302. package/lib/typescript/models/VideoPlayerCompleteAction.d.ts +0 -1
  303. package/lib/typescript/models/VideoPlayerConfiguration.d.ts +0 -51
  304. package/lib/typescript/models/VideoPlayerStyle.d.ts +0 -1
  305. package/lib/typescript/modules/FWNavigatorModule.d.ts +0 -11
  306. package/lib/typescript/modules/FireworkSDKModule.d.ts +0 -19
  307. package/lib/typescript/modules/LiveStreamModule.d.ts +0 -8
  308. package/lib/typescript/modules/ShoppingModule.d.ts +0 -18
  309. package/lib/typescript/utils/FWGlobalState.d.ts +0 -10
  310. package/lib/typescript/utils/FWLoggerUtil.d.ts +0 -6
@@ -1,222 +0,0 @@
1
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2
-
3
- import { Platform } from 'react-native';
4
- import { FWEventName } from './models/FWEventName';
5
- import ShoppingModule, { ShoppingModuleEventEmitter } from './modules/ShoppingModule';
6
- import FWLoggerUtil from './utils/FWLoggerUtil';
7
- import FWGlobalState from './utils/FWGlobalState';
8
-
9
- /**
10
- * The entry class of video shopping.
11
- */
12
- class VideoShopping {
13
- /**
14
- * This callback is triggered when the user clicks the "Add to cart" or "Shop now" button.
15
- * The host app can return a ShoppingCTAResult object to tell SDK how to handle the result.
16
- */
17
-
18
- /**
19
- * This callback is triggered when the user clicks the shopping cart icon.
20
- *
21
- * The host app can customize the click event processing logic of
22
- * the shopping cart icon by setting the callback.
23
- */
24
-
25
- /**
26
- * This callback is triggered when the video will be shown.
27
- *
28
- * The host app can return a Product list to update the latest product information.
29
- */
30
-
31
- /**
32
- * This callback is triggered when the user clicks
33
- * the link button next to Add to cart button.
34
- *
35
- * The host app can customize the click event processing logic of
36
- * the link button by setting the callback.
37
- */
38
- get onCustomClickLinkButton() {
39
- return this._onCustomClickLinkButton;
40
- }
41
-
42
- set onCustomClickLinkButton(value) {
43
- this._onCustomClickLinkButton = value;
44
- ShoppingModule.setCustomClickLinkButtonEnabled(!!value);
45
- }
46
-
47
- /**
48
- * Defaults to true.
49
- * You can hide the cart icon by setting this property to false.
50
- */
51
- get cartIconVisible() {
52
- return this._cartIconVisible;
53
- }
54
-
55
- set cartIconVisible(value) {
56
- this._cartIconVisible = value;
57
-
58
- if (FWGlobalState.getInstance().sdkInitCalled) {
59
- ShoppingModule.setCartIconVisible(value);
60
- } else {
61
- FWGlobalState.getInstance().sdkInitCalledPromise.then(() => {
62
- ShoppingModule.setCartIconVisible(value);
63
- });
64
- }
65
- }
66
-
67
- /**
68
- * The configuration of product info view.
69
- * Please refer to {@link ProductInfoViewConfiguration} for more details.
70
- */
71
- get productInfoViewConfiguration() {
72
- return this._productInfoViewConfiguration;
73
- }
74
-
75
- set productInfoViewConfiguration(value) {
76
- this._productInfoViewConfiguration = value;
77
-
78
- if (FWGlobalState.getInstance().sdkInitCalled) {
79
- ShoppingModule.setProductInfoViewConfiguration(value !== null && value !== void 0 ? value : {});
80
- } else {
81
- FWGlobalState.getInstance().sdkInitCalledPromise.then(() => {
82
- ShoppingModule.setProductInfoViewConfiguration(value !== null && value !== void 0 ? value : {});
83
- });
84
- }
85
- }
86
-
87
- get eventEmitter() {
88
- return ShoppingModuleEventEmitter;
89
- }
90
-
91
- static getInstance() {
92
- FWLoggerUtil.log('VideoShopping constructor');
93
-
94
- if (!VideoShopping._instance) {
95
- VideoShopping._instance = new VideoShopping();
96
- }
97
-
98
- return VideoShopping._instance;
99
- }
100
-
101
- constructor() {
102
- _defineProperty(this, "onShoppingCTA", void 0);
103
-
104
- _defineProperty(this, "onCustomClickCartIcon", void 0);
105
-
106
- _defineProperty(this, "onUpdateProductDetails", void 0);
107
-
108
- _defineProperty(this, "_onCustomClickLinkButton", void 0);
109
-
110
- _defineProperty(this, "_cartIconVisible", true);
111
-
112
- _defineProperty(this, "_productInfoViewConfiguration", void 0);
113
-
114
- this.eventEmitter.addListener(FWEventName.ShoppingCTAButtonClick, event => {
115
- FWLoggerUtil.log(`Receive ShoppingCTA event productId: ${event === null || event === void 0 ? void 0 : event.productId} unitId: ${event === null || event === void 0 ? void 0 : event.unitId} url: ${event === null || event === void 0 ? void 0 : event.url}`);
116
- this.handleShoppingCTAEvent(event);
117
- });
118
- this.eventEmitter.addListener(FWEventName.ClickCartIcon, () => {
119
- FWLoggerUtil.log('Receive ClickCartIcon event');
120
- this.handleClickCartIconEvent();
121
- });
122
- this.eventEmitter.addListener(FWEventName.UpdateProductDetails, event => {
123
- FWLoggerUtil.log(`Receive UpdateProductDetails event productIds: ${event === null || event === void 0 ? void 0 : event.productIds}`);
124
- this.handleUpdateProductDetailsEvent(event);
125
- });
126
- this.eventEmitter.addListener(FWEventName.LogMessage, () => {});
127
- this.eventEmitter.addListener(FWEventName.CustomLinkButtonClick, event => {
128
- FWLoggerUtil.log(`Receive CustomLinkButtonClick event url: ${event === null || event === void 0 ? void 0 : event.url}`);
129
- this.handleCustomLinkButtonClickEvent(event);
130
- });
131
- }
132
- /**
133
- *
134
- * @param {number} count The number of items in the host app cart.
135
- * The count should be greater than or equal to 0.
136
- * We just use count to show or hide red indicator on the cart icon.
137
- * If cound > 0, we will show the red indicator on the cart icon.
138
- * Otherwise, we will hide the red indicator on the cart icon.
139
- */
140
-
141
-
142
- async setCartItemCount(count) {
143
- if (!FWGlobalState.getInstance().sdkInitCalled) {
144
- await FWGlobalState.getInstance().sdkInitCalledPromise;
145
- }
146
-
147
- ShoppingModule.setCartItemCount(count);
148
- }
149
-
150
- async handleShoppingCTAEvent(event) {
151
- const callbackId = event.callbackId;
152
- delete event.callbackId;
153
-
154
- if (this.onShoppingCTA) {
155
- const result = await this.onShoppingCTA(event);
156
-
157
- if (callbackId) {
158
- ShoppingModule.updateShoppingCTAResult(result, callbackId);
159
- }
160
- } else {
161
- if (callbackId) {
162
- if (Platform.OS === 'ios') {
163
- ShoppingModule.clearCallbackId(callbackId, FWEventName.ShoppingCTAButtonClick);
164
- }
165
- }
166
- }
167
- }
168
-
169
- async handleClickCartIconEvent() {
170
- if (this.onCustomClickCartIcon) {
171
- this.onCustomClickCartIcon();
172
- }
173
- }
174
-
175
- async handleUpdateProductDetailsEvent(event) {
176
- const callbackId = event.callbackId;
177
- delete event.callbackId;
178
-
179
- if (this.onUpdateProductDetails) {
180
- FWLoggerUtil.log(`Call onUpdateProductDetails callback productIds: ${event.productIds} callbackId: ${callbackId}`);
181
- const productList = await this.onUpdateProductDetails(event);
182
- const productIds = (productList || []).map(product => {
183
- var _product$productId;
184
-
185
- return (_product$productId = product.productId) !== null && _product$productId !== void 0 ? _product$productId : '';
186
- });
187
- FWLoggerUtil.log(`Get result from onUpdateProductDetails callback productIds: ${productIds} productListLength: ${(productList || []).length}`);
188
-
189
- if (productList) {
190
- if (callbackId) {
191
- ShoppingModule.updateVideoProducts(productList, callbackId);
192
- }
193
- } else {
194
- if (callbackId) {
195
- if (Platform.OS === 'ios') {
196
- ShoppingModule.clearCallbackId(callbackId, FWEventName.UpdateProductDetails);
197
- }
198
- }
199
- }
200
- } else {
201
- FWLoggerUtil.log('onUpdateProductDetails callback is not set.');
202
-
203
- if (callbackId) {
204
- if (Platform.OS === 'ios') {
205
- ShoppingModule.clearCallbackId(callbackId, FWEventName.UpdateProductDetails);
206
- }
207
- }
208
- }
209
- }
210
-
211
- async handleCustomLinkButtonClickEvent(event) {
212
- if (this.onCustomClickLinkButton) {
213
- this.onCustomClickLinkButton(event);
214
- }
215
- }
216
-
217
- }
218
-
219
- _defineProperty(VideoShopping, "_instance", void 0);
220
-
221
- export default VideoShopping;
222
- //# sourceMappingURL=VideoShopping.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["VideoShopping.ts"],"names":["Platform","FWEventName","ShoppingModule","ShoppingModuleEventEmitter","FWLoggerUtil","FWGlobalState","VideoShopping","onCustomClickLinkButton","_onCustomClickLinkButton","value","setCustomClickLinkButtonEnabled","cartIconVisible","_cartIconVisible","getInstance","sdkInitCalled","setCartIconVisible","sdkInitCalledPromise","then","productInfoViewConfiguration","_productInfoViewConfiguration","setProductInfoViewConfiguration","eventEmitter","log","_instance","constructor","addListener","ShoppingCTAButtonClick","event","productId","unitId","url","handleShoppingCTAEvent","ClickCartIcon","handleClickCartIconEvent","UpdateProductDetails","productIds","handleUpdateProductDetailsEvent","LogMessage","CustomLinkButtonClick","handleCustomLinkButtonClickEvent","setCartItemCount","count","callbackId","onShoppingCTA","result","updateShoppingCTAResult","OS","clearCallbackId","onCustomClickCartIcon","onUpdateProductDetails","productList","map","product","length","updateVideoProducts"],"mappings":";;AAAA,SAA6BA,QAA7B,QAA6C,cAA7C;AAEA,SAASC,WAAT,QAA4B,sBAA5B;AAQA,OAAOC,cAAP,IACEC,0BADF,QAEO,0BAFP;AAGA,OAAOC,YAAP,MAAyB,sBAAzB;AAEA,OAAOC,aAAP,MAA0B,uBAA1B;;AAmBA;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,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;AAGA,YAAMQ,WAAW,GAAG,MAAM,KAAKD,sBAAL,CACxBtB,KADwB,CAA1B;AAIA,YAAMQ,UAAU,GAAG,CAACe,WAAW,IAAI,EAAhB,EAAoBC,GAApB,CAChBC,OAAD;AAAA;;AAAA,qCAAaA,OAAO,CAACxB,SAArB,mEAAkC,EAAlC;AAAA,OADiB,CAAnB;AAIAxB,MAAAA,YAAY,CAACkB,GAAb,CACG,+DAA8Da,UAAW,uBACxE,CAACe,WAAW,IAAI,EAAhB,EAAoBG,MACrB,EAHH;;AAMA,UAAIH,WAAJ,EAAiB;AACf,YAAIR,UAAJ,EAAgB;AACdxC,UAAAA,cAAc,CAACoD,mBAAf,CAAmCJ,WAAnC,EAAgDR,UAAhD;AACD;AACF,OAJD,MAIO;AACL,YAAIA,UAAJ,EAAgB;AACd,cAAI1C,QAAQ,CAAC8C,EAAT,KAAgB,KAApB,EAA2B;AACzB5C,YAAAA,cAAc,CAAC6C,eAAf,CACEL,UADF,EAEEzC,WAAW,CAACiC,oBAFd;AAID;AACF;AACF;AACF,KAhCD,MAgCO;AACL9B,MAAAA,YAAY,CAACkB,GAAb,CAAiB,6CAAjB;;AACA,UAAIoB,UAAJ,EAAgB;AACd,YAAI1C,QAAQ,CAAC8C,EAAT,KAAgB,KAApB,EAA2B;AACzB5C,UAAAA,cAAc,CAAC6C,eAAf,CACEL,UADF,EAEEzC,WAAW,CAACiC,oBAFd;AAID;AACF;AACF;AACF;;AAE6C,QAAhCK,gCAAgC,CAC5CZ,KAD4C,EAE5C;AACA,QAAI,KAAKpB,uBAAT,EAAkC;AAChC,WAAKA,uBAAL,CAA6BoB,KAA7B;AACD;AACF;;AA3OiB;;gBAAdrB,a;;AA8ON,eAAeA,aAAf","sourcesContent":["import { NativeEventEmitter, Platform } from 'react-native';\n\nimport { FWEventName } from './models/FWEventName';\nimport type {\n CustomClickLinkButtonEvent,\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\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 * 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 this._productInfoViewConfiguration = value;\n if (FWGlobalState.getInstance().sdkInitCalled) {\n ShoppingModule.setProductInfoViewConfiguration(value ?? {});\n } else {\n FWGlobalState.getInstance().sdkInitCalledPromise.then(() => {\n ShoppingModule.setProductInfoViewConfiguration(value ?? {});\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\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\nexport default VideoShopping;\n"]}
@@ -1,8 +0,0 @@
1
- import { requireNativeComponent, UIManager } from 'react-native';
2
- import { LINKING_ERROR } from '../constants/FWErrorMessage';
3
- const NativeComponentName = 'FWStoryBlock';
4
- const FWStoryBlock = UIManager.getViewManagerConfig(NativeComponentName) != null ? requireNativeComponent(NativeComponentName) : () => {
5
- throw new Error(LINKING_ERROR);
6
- };
7
- export default FWStoryBlock;
8
- //# sourceMappingURL=FWStoryBlock.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["FWStoryBlock.tsx"],"names":["requireNativeComponent","UIManager","LINKING_ERROR","NativeComponentName","FWStoryBlock","getViewManagerConfig","Error"],"mappings":"AAAA,SAASA,sBAAT,EAAiCC,SAAjC,QAAkD,cAAlD;AACA,SAASC,aAAT,QAA8B,6BAA9B;AACA,MAAMC,mBAAmB,GAAG,cAA5B;AACA,MAAMC,YAAY,GAChBH,SAAS,CAACI,oBAAV,CAA+BF,mBAA/B,KAAuD,IAAvD,GACIH,sBAAsB,CAAMG,mBAAN,CAD1B,GAEI,MAAM;AACJ,QAAM,IAAIG,KAAJ,CAAUJ,aAAV,CAAN;AACD,CALP;AAMA,eAAeE,YAAf","sourcesContent":["import { requireNativeComponent, UIManager } from 'react-native';\nimport { LINKING_ERROR } from '../constants/FWErrorMessage';\nconst NativeComponentName = 'FWStoryBlock';\nconst FWStoryBlock =\n UIManager.getViewManagerConfig(NativeComponentName) != null\n ? requireNativeComponent<any>(NativeComponentName)\n : () => {\n throw new Error(LINKING_ERROR);\n };\nexport default FWStoryBlock;\n"]}
@@ -1,8 +0,0 @@
1
- import { requireNativeComponent, UIManager } from 'react-native';
2
- import { LINKING_ERROR } from '../constants/FWErrorMessage';
3
- const NativeComponentName = 'FWVideoFeed';
4
- const FWVideoFeed = UIManager.getViewManagerConfig(NativeComponentName) != null ? requireNativeComponent(NativeComponentName) : () => {
5
- throw new Error(LINKING_ERROR);
6
- };
7
- export default FWVideoFeed;
8
- //# sourceMappingURL=FWVideoFeed.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["FWVideoFeed.tsx"],"names":["requireNativeComponent","UIManager","LINKING_ERROR","NativeComponentName","FWVideoFeed","getViewManagerConfig","Error"],"mappings":"AAAA,SAASA,sBAAT,EAAiCC,SAAjC,QAAkD,cAAlD;AACA,SAASC,aAAT,QAA8B,6BAA9B;AACA,MAAMC,mBAAmB,GAAG,aAA5B;AACA,MAAMC,WAAW,GACfH,SAAS,CAACI,oBAAV,CAA+BF,mBAA/B,KAAuD,IAAvD,GACIH,sBAAsB,CAAMG,mBAAN,CAD1B,GAEI,MAAM;AACJ,QAAM,IAAIG,KAAJ,CAAUJ,aAAV,CAAN;AACD,CALP;AAMA,eAAeE,WAAf","sourcesContent":["import { requireNativeComponent, UIManager } from 'react-native';\nimport { LINKING_ERROR } from '../constants/FWErrorMessage';\nconst NativeComponentName = 'FWVideoFeed';\nconst FWVideoFeed =\n UIManager.getViewManagerConfig(NativeComponentName) != null\n ? requireNativeComponent<any>(NativeComponentName)\n : () => {\n throw new Error(LINKING_ERROR);\n };\nexport default FWVideoFeed;\n"]}
@@ -1,282 +0,0 @@
1
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
-
3
- import React, { forwardRef, useEffect, useImperativeHandle, useReducer, useRef, useState } from 'react';
4
- import { BackHandler, findNodeHandle, Platform, UIManager } from 'react-native';
5
- import FireworkSDK from '../FireworkSDK';
6
- import { FWEventName } from '../models/FWEventName';
7
- import { FireworkSDKModuleEventEmitter } from '../modules/FireworkSDKModule';
8
- import FWGlobalState from '../utils/FWGlobalState';
9
- import FWLoggerUtil from '../utils/FWLoggerUtil';
10
- import FWStoryBlock from './FWStoryBlock';
11
- const NativeComponentName = 'FWStoryBlock';
12
-
13
- const StoryBlock = (props, forwardedRef) => {
14
- const nativeComponentRef = useRef(null);
15
- const [isFullscreenState, setIsFullscreenState] = useState(false);
16
- const [sdkInitCalled, setSdkInitCalled] = useState(FWGlobalState.getInstance().sdkInitCalled);
17
- const [, forceUpdate] = useReducer(x => x + 1, 0);
18
-
19
- const handleStoryBlockLoadFinished = event => {
20
- FWLoggerUtil.log(`StoryBlock handleStoryBlockLoadFinished ${event.nativeEvent.name}`);
21
- const {
22
- onStoryBlockLoadFinished
23
- } = props;
24
- const {
25
- name,
26
- reason
27
- } = event.nativeEvent;
28
-
29
- if (onStoryBlockLoadFinished) {
30
- if (name) {
31
- if (reason) {
32
- onStoryBlockLoadFinished({
33
- name,
34
- reason
35
- });
36
- } else {
37
- onStoryBlockLoadFinished({
38
- name
39
- });
40
- }
41
- } else {
42
- onStoryBlockLoadFinished();
43
- }
44
- }
45
- };
46
-
47
- const handleStoryBlockFullScreenStateChanged = event => {
48
- FWLoggerUtil.log(`StoryBlock handleStoryBlockFullScreenStateChanged ${event.nativeEvent.isFullScreen}`);
49
- const {
50
- isFullScreen
51
- } = event.nativeEvent;
52
- setIsFullscreenState(isFullScreen);
53
- };
54
-
55
- const generateDynamicContentParametersString = () => {
56
- const {
57
- dynamicContentParameters
58
- } = props;
59
-
60
- if (!dynamicContentParameters) {
61
- return '';
62
- }
63
-
64
- let resultString = '';
65
- const sortedKeyList = Object.keys(dynamicContentParameters).sort();
66
-
67
- for (const key of sortedKeyList) {
68
- const value = dynamicContentParameters[key];
69
- const valueString = value.join(',');
70
-
71
- if (resultString.length > 0) {
72
- resultString += '_';
73
- }
74
-
75
- resultString += `${key}:${valueString}`;
76
- }
77
-
78
- return resultString;
79
- };
80
-
81
- const generateVastAttributesString = () => {
82
- var _adConfiguration$vast;
83
-
84
- const {
85
- adConfiguration
86
- } = props;
87
- const vastAttributes = (_adConfiguration$vast = adConfiguration === null || adConfiguration === void 0 ? void 0 : adConfiguration.vastAttributes) !== null && _adConfiguration$vast !== void 0 ? _adConfiguration$vast : '';
88
-
89
- if (!vastAttributes) {
90
- return '';
91
- }
92
-
93
- let resultString = '';
94
-
95
- for (const attribute of vastAttributes) {
96
- var _attribute$name;
97
-
98
- if (resultString.length > 0) {
99
- resultString += '_';
100
- }
101
-
102
- resultString += `${(_attribute$name = attribute.name) !== null && _attribute$name !== void 0 ? _attribute$name : ''}:${attribute.value}`;
103
- }
104
-
105
- return resultString;
106
- };
107
-
108
- const generateKey = () => {
109
- var _FireworkSDK$getInsta, _FireworkSDK$getInsta2, _FireworkSDK$getInsta3, _FireworkSDK$getInsta4, _adBadgeConfiguration, _adBadgeConfiguration2, _adBadgeConfiguration3, _adBadgeConfiguration4, _adBadgeConfiguration5, _adBadgeConfiguration6, _adBadgeConfiguration7, _adBadgeConfiguration8, _storyBlockConfigurat, _storyBlockConfigurat2, _storyBlockConfigurat3, _storyBlockConfigurat4, _storyBlockConfigurat5, _storyBlockConfigurat6, _storyBlockConfigurat7, _storyBlockConfigurat8, _storyBlockConfigurat9, _storyBlockConfigurat10, _storyBlockConfigurat11, _storyBlockConfigurat12, _storyBlockConfigurat13, _storyBlockConfigurat14, _storyBlockConfigurat15, _storyBlockConfigurat16, _storyBlockConfigurat17, _storyBlockConfigurat18, _storyBlockConfigurat19, _adConfiguration$requ, _adConfiguration$requ2, _adConfiguration$adsF;
110
-
111
- const gShareBaseURL = (_FireworkSDK$getInsta = FireworkSDK.getInstance().shareBaseURL) !== null && _FireworkSDK$getInsta !== void 0 ? _FireworkSDK$getInsta : '';
112
- const appLanguage = (_FireworkSDK$getInsta2 = FireworkSDK.getInstance().appLanguage) !== null && _FireworkSDK$getInsta2 !== void 0 ? _FireworkSDK$getInsta2 : '';
113
- const videoLaunchBehavior = (_FireworkSDK$getInsta3 = FireworkSDK.getInstance().videoLaunchBehavior) !== null && _FireworkSDK$getInsta3 !== void 0 ? _FireworkSDK$getInsta3 : '';
114
- const adBadgeConfiguration = (_FireworkSDK$getInsta4 = FireworkSDK.getInstance().adBadgeConfiguration) !== null && _FireworkSDK$getInsta4 !== void 0 ? _FireworkSDK$getInsta4 : {};
115
- const adBadgeTextType = (_adBadgeConfiguration = adBadgeConfiguration.badgeTextType) !== null && _adBadgeConfiguration !== void 0 ? _adBadgeConfiguration : '';
116
- const backgroundColorOfAdBadge = (_adBadgeConfiguration2 = adBadgeConfiguration.backgroundColor) !== null && _adBadgeConfiguration2 !== void 0 ? _adBadgeConfiguration2 : '';
117
- const textColorOfAdBadge = (_adBadgeConfiguration3 = adBadgeConfiguration.textColor) !== null && _adBadgeConfiguration3 !== void 0 ? _adBadgeConfiguration3 : '';
118
- const androidFontIsCustomOfAdBadge = (_adBadgeConfiguration4 = (_adBadgeConfiguration5 = adBadgeConfiguration.androidFontInfo) === null || _adBadgeConfiguration5 === void 0 ? void 0 : (_adBadgeConfiguration6 = _adBadgeConfiguration5.isCustom) === null || _adBadgeConfiguration6 === void 0 ? void 0 : _adBadgeConfiguration6.toString()) !== null && _adBadgeConfiguration4 !== void 0 ? _adBadgeConfiguration4 : '';
119
- const androidFontTypefaceNameOfAdBadge = (_adBadgeConfiguration7 = (_adBadgeConfiguration8 = adBadgeConfiguration.androidFontInfo) === null || _adBadgeConfiguration8 === void 0 ? void 0 : _adBadgeConfiguration8.typefaceName) !== null && _adBadgeConfiguration7 !== void 0 ? _adBadgeConfiguration7 : '';
120
- const {
121
- source,
122
- channel = '',
123
- playlist = '',
124
- hashtagFilterExpression = '',
125
- enablePictureInPicture = false,
126
- adConfiguration,
127
- storyBlockConfiguration
128
- } = props;
129
- const dynamicContentParametersString = generateDynamicContentParametersString();
130
- const videoCompleteAction = (_storyBlockConfigurat = storyBlockConfiguration === null || storyBlockConfiguration === void 0 ? void 0 : storyBlockConfiguration.videoCompleteAction) !== null && _storyBlockConfigurat !== void 0 ? _storyBlockConfigurat : '';
131
- const showShareButton = (_storyBlockConfigurat2 = storyBlockConfiguration === null || storyBlockConfiguration === void 0 ? void 0 : (_storyBlockConfigurat3 = storyBlockConfiguration.showShareButton) === null || _storyBlockConfigurat3 === void 0 ? void 0 : _storyBlockConfigurat3.toString()) !== null && _storyBlockConfigurat2 !== void 0 ? _storyBlockConfigurat2 : '';
132
- const showPlaybackButton = (_storyBlockConfigurat4 = storyBlockConfiguration === null || storyBlockConfiguration === void 0 ? void 0 : (_storyBlockConfigurat5 = storyBlockConfiguration.showPlaybackButton) === null || _storyBlockConfigurat5 === void 0 ? void 0 : _storyBlockConfigurat5.toString()) !== null && _storyBlockConfigurat4 !== void 0 ? _storyBlockConfigurat4 : '';
133
- const showBranding = (_storyBlockConfigurat6 = storyBlockConfiguration === null || storyBlockConfiguration === void 0 ? void 0 : (_storyBlockConfigurat7 = storyBlockConfiguration.showBranding) === null || _storyBlockConfigurat7 === void 0 ? void 0 : _storyBlockConfigurat7.toString()) !== null && _storyBlockConfigurat6 !== void 0 ? _storyBlockConfigurat6 : '';
134
- const ctaDelayType = (_storyBlockConfigurat8 = storyBlockConfiguration === null || storyBlockConfiguration === void 0 ? void 0 : (_storyBlockConfigurat9 = storyBlockConfiguration.ctaDelay) === null || _storyBlockConfigurat9 === void 0 ? void 0 : _storyBlockConfigurat9.type) !== null && _storyBlockConfigurat8 !== void 0 ? _storyBlockConfigurat8 : '';
135
- const ctaDelayValue = (_storyBlockConfigurat10 = storyBlockConfiguration === null || storyBlockConfiguration === void 0 ? void 0 : (_storyBlockConfigurat11 = storyBlockConfiguration.ctaDelay) === null || _storyBlockConfigurat11 === void 0 ? void 0 : (_storyBlockConfigurat12 = _storyBlockConfigurat11.value) === null || _storyBlockConfigurat12 === void 0 ? void 0 : _storyBlockConfigurat12.toFixed(5)) !== null && _storyBlockConfigurat10 !== void 0 ? _storyBlockConfigurat10 : '';
136
- const ctaHighlightDelayType = (_storyBlockConfigurat13 = storyBlockConfiguration === null || storyBlockConfiguration === void 0 ? void 0 : (_storyBlockConfigurat14 = storyBlockConfiguration.ctaHighlightDelay) === null || _storyBlockConfigurat14 === void 0 ? void 0 : _storyBlockConfigurat14.type) !== null && _storyBlockConfigurat13 !== void 0 ? _storyBlockConfigurat13 : '';
137
- const ctaHighlightDelayValue = (_storyBlockConfigurat15 = storyBlockConfiguration === null || storyBlockConfiguration === void 0 ? void 0 : (_storyBlockConfigurat16 = storyBlockConfiguration.ctaHighlightDelay) === null || _storyBlockConfigurat16 === void 0 ? void 0 : (_storyBlockConfigurat17 = _storyBlockConfigurat16.value) === null || _storyBlockConfigurat17 === void 0 ? void 0 : _storyBlockConfigurat17.toFixed(5)) !== null && _storyBlockConfigurat15 !== void 0 ? _storyBlockConfigurat15 : '';
138
- const shareBaseURL = (_storyBlockConfigurat18 = storyBlockConfiguration === null || storyBlockConfiguration === void 0 ? void 0 : storyBlockConfiguration.shareBaseURL) !== null && _storyBlockConfigurat18 !== void 0 ? _storyBlockConfigurat18 : '';
139
- const ctaWidth = (_storyBlockConfigurat19 = storyBlockConfiguration === null || storyBlockConfiguration === void 0 ? void 0 : storyBlockConfiguration.ctaWidth) !== null && _storyBlockConfigurat19 !== void 0 ? _storyBlockConfigurat19 : '';
140
- const requiresAds = (_adConfiguration$requ = adConfiguration === null || adConfiguration === void 0 ? void 0 : (_adConfiguration$requ2 = adConfiguration.requiresAds) === null || _adConfiguration$requ2 === void 0 ? void 0 : _adConfiguration$requ2.toString()) !== null && _adConfiguration$requ !== void 0 ? _adConfiguration$requ : '';
141
- const adsFetchTimeout = (_adConfiguration$adsF = adConfiguration === null || adConfiguration === void 0 ? void 0 : adConfiguration.adsFetchTimeout) !== null && _adConfiguration$adsF !== void 0 ? _adConfiguration$adsF : 10;
142
- const vastAttributesString = generateVastAttributesString();
143
- let key = `gShareBaseURL:${gShareBaseURL}`;
144
-
145
- if (Platform.OS === 'ios') {
146
- key += `_appLanguage:${appLanguage}`;
147
- }
148
-
149
- key += `_videoLaunchBehavior:${videoLaunchBehavior}`;
150
- key += `_adBadgeTextType:${adBadgeTextType}`;
151
- key += `_backgroundColorOfAdBadge:${backgroundColorOfAdBadge}`;
152
- key += `_textColorOfAdBadge:${textColorOfAdBadge}`;
153
-
154
- if (Platform.OS === 'android') {
155
- key += `_androidFontIsCustomOfAdBadge${androidFontIsCustomOfAdBadge}`;
156
- key += `_androidFontTypefaceNameOfAdBadge${androidFontTypefaceNameOfAdBadge}`;
157
- }
158
-
159
- key += `_source:${source}`;
160
- key += `_channel:${channel}`;
161
- key += `_playlist:${playlist}`;
162
- key += `_dynamicContentParameters:${dynamicContentParametersString}`;
163
- key += `_hashtagFilterExpression:${hashtagFilterExpression}`;
164
- key += `_enablePictureInPicture:${enablePictureInPicture}`;
165
- key += `_shareBaseURL:${shareBaseURL}`;
166
-
167
- if (Platform.OS === 'android') {
168
- key += `_videoCompleteAction:${videoCompleteAction}`;
169
- key += `_showShareButton:${showShareButton}`;
170
- key += `_showPlaybackButton:${showPlaybackButton}`;
171
- key += `_showBranding:${showBranding}`;
172
- key += `_ctaDelayType:${ctaDelayType}`;
173
- key += `_ctaDelayValue:${ctaDelayValue}`;
174
- key += `_ctaHighlightDelayType:${ctaHighlightDelayType}`;
175
- key += `_ctaHighlightDelayValue:${ctaHighlightDelayValue}`;
176
- key += `_ctaWidth:${ctaWidth}`;
177
- }
178
-
179
- key += `_requiresAds:${requiresAds}`;
180
- key += `_adsFetchTimeout:${adsFetchTimeout}`;
181
- key += `_vastAttributes:${vastAttributesString}`;
182
- return key;
183
- };
184
-
185
- const key = generateKey();
186
- useImperativeHandle(forwardedRef, () => {
187
- const sendCommand = command => {
188
- const nativeNodeHandle = findNodeHandle(nativeComponentRef.current);
189
- let commandId = UIManager.getViewManagerConfig(NativeComponentName).Commands[command];
190
-
191
- if (Platform.OS === 'android') {
192
- commandId = commandId.toString();
193
- }
194
-
195
- UIManager.dispatchViewManagerCommand(findNodeHandle(nativeNodeHandle), commandId, []);
196
- };
197
-
198
- return {
199
- play: () => {
200
- sendCommand('play');
201
- },
202
- pause: () => {
203
- sendCommand('pause');
204
- }
205
- };
206
- }, []);
207
- useEffect(() => {
208
- const subscriptionOfShareBaseURLUpdated = FireworkSDKModuleEventEmitter.addListener(FWEventName.ShareBaseURLUpdated, () => {
209
- FWLoggerUtil.log('Receive FWEventName.ShareBaseURLUpdated');
210
- forceUpdate();
211
- });
212
- const subscriptionOfAdBadgeConfigurationUpdated = FireworkSDKModuleEventEmitter.addListener(FWEventName.AdBadgeConfigurationUpdated, () => {
213
- FWLoggerUtil.log('Receive FWEventName.AdBadgeConfigurationUpdated');
214
- forceUpdate();
215
- });
216
- const subscriptionOfVideoLaunchBehaviorUpdated = FireworkSDKModuleEventEmitter.addListener(FWEventName.VideoLaunchBehaviorUpdated, () => {
217
- FWLoggerUtil.log('Receive FWEventName.VideoLaunchBehaviorUpdated');
218
- forceUpdate();
219
- });
220
- const subscriptionOfAppLanguageUpdated = FireworkSDKModuleEventEmitter.addListener(FWEventName.AppLanguageUpdated, () => {
221
- FWLoggerUtil.log('Receive FWEventName.AppLanguageUpdated');
222
-
223
- if (Platform.OS === 'android') {
224
- forceUpdate();
225
- }
226
- });
227
- return () => {
228
- subscriptionOfShareBaseURLUpdated.remove();
229
- subscriptionOfAdBadgeConfigurationUpdated.remove();
230
- subscriptionOfVideoLaunchBehaviorUpdated.remove();
231
- subscriptionOfAppLanguageUpdated.remove();
232
- };
233
- }, []);
234
- useEffect(() => {
235
- if (Platform.OS === 'android') {
236
- setTimeout(() => {
237
- const viewId = findNodeHandle(nativeComponentRef.current);
238
- FWLoggerUtil.log(`StoryBlock createFragment viewId: ${viewId}`);
239
- UIManager.dispatchViewManagerCommand(viewId, UIManager.getViewManagerConfig(NativeComponentName).Commands.create.toString(), [viewId]);
240
- }, 500);
241
- }
242
- }, [key]);
243
- useEffect(() => {
244
- FWGlobalState.getInstance().sdkInitCalledPromise.then(() => {
245
- setSdkInitCalled(true);
246
- });
247
- }, []);
248
- useEffect(() => {
249
- if (Platform.OS === 'android') {
250
- const onBackPress = () => {
251
- if (isFullscreenState) {
252
- FireworkSDK.getInstance().navigator.popNativeContainer();
253
- return true;
254
- }
255
-
256
- return false;
257
- };
258
-
259
- const subscription = BackHandler.addEventListener('hardwareBackPress', onBackPress);
260
- return () => {
261
- subscription.remove();
262
- };
263
- }
264
-
265
- return;
266
- }, [isFullscreenState]);
267
-
268
- if (!sdkInitCalled) {
269
- return null;
270
- }
271
-
272
- return /*#__PURE__*/React.createElement(FWStoryBlock, _extends({
273
- ref: nativeComponentRef,
274
- key: key
275
- }, props, {
276
- onStoryBlockLoadFinished: handleStoryBlockLoadFinished,
277
- onStoryBlockFullScreenStateChanged: handleStoryBlockFullScreenStateChanged
278
- }));
279
- };
280
-
281
- export default /*#__PURE__*/forwardRef(StoryBlock);
282
- //# sourceMappingURL=StoryBlock.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["StoryBlock.tsx"],"names":["React","forwardRef","useEffect","useImperativeHandle","useReducer","useRef","useState","BackHandler","findNodeHandle","Platform","UIManager","FireworkSDK","FWEventName","FireworkSDKModuleEventEmitter","FWGlobalState","FWLoggerUtil","FWStoryBlock","NativeComponentName","StoryBlock","props","forwardedRef","nativeComponentRef","isFullscreenState","setIsFullscreenState","sdkInitCalled","setSdkInitCalled","getInstance","forceUpdate","x","handleStoryBlockLoadFinished","event","log","nativeEvent","name","onStoryBlockLoadFinished","reason","handleStoryBlockFullScreenStateChanged","isFullScreen","generateDynamicContentParametersString","dynamicContentParameters","resultString","sortedKeyList","Object","keys","sort","key","value","valueString","join","length","generateVastAttributesString","adConfiguration","vastAttributes","attribute","generateKey","gShareBaseURL","shareBaseURL","appLanguage","videoLaunchBehavior","adBadgeConfiguration","adBadgeTextType","badgeTextType","backgroundColorOfAdBadge","backgroundColor","textColorOfAdBadge","textColor","androidFontIsCustomOfAdBadge","androidFontInfo","isCustom","toString","androidFontTypefaceNameOfAdBadge","typefaceName","source","channel","playlist","hashtagFilterExpression","enablePictureInPicture","storyBlockConfiguration","dynamicContentParametersString","videoCompleteAction","showShareButton","showPlaybackButton","showBranding","ctaDelayType","ctaDelay","type","ctaDelayValue","toFixed","ctaHighlightDelayType","ctaHighlightDelay","ctaHighlightDelayValue","ctaWidth","requiresAds","adsFetchTimeout","vastAttributesString","OS","sendCommand","command","nativeNodeHandle","current","commandId","getViewManagerConfig","Commands","dispatchViewManagerCommand","play","pause","subscriptionOfShareBaseURLUpdated","addListener","ShareBaseURLUpdated","subscriptionOfAdBadgeConfigurationUpdated","AdBadgeConfigurationUpdated","subscriptionOfVideoLaunchBehaviorUpdated","VideoLaunchBehaviorUpdated","subscriptionOfAppLanguageUpdated","AppLanguageUpdated","remove","setTimeout","viewId","create","sdkInitCalledPromise","then","onBackPress","navigator","popNativeContainer","subscription","addEventListener"],"mappings":";;AACA,OAAOA,KAAP,IACEC,UADF,EAEEC,SAFF,EAGEC,mBAHF,EAIEC,UAJF,EAKEC,MALF,EAMEC,QANF,QAOO,OAPP;AASA,SACEC,WADF,EAEEC,cAFF,EAIEC,QAJF,EAMEC,SANF,QAQO,cARP;AAUA,OAAOC,WAAP,MAAwB,gBAAxB;AAGA,SAASC,WAAT,QAA4B,uBAA5B;AAGA,SAASC,6BAAT,QAA8C,8BAA9C;AACA,OAAOC,aAAP,MAA0B,wBAA1B;AACA,OAAOC,YAAP,MAAyB,uBAAzB;AACA,OAAOC,YAAP,MAAyB,gBAAzB;AAEA,MAAMC,mBAAmB,GAAG,cAA5B;;AA8DA,MAAMC,UAGL,GAAG,CAACC,KAAD,EAA0BC,YAA1B,KAA2C;AA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ACgD,MAAD,CALF;AAOD,OAVS,EAUP,GAVO,CAAV;AAWD;AACF,GAdQ,EAcN,CAACxE,GAAD,CAdM,CAAT;AAgBA3C,EAAAA,SAAS,CAAC,MAAM;AACdY,IAAAA,aAAa,CAACY,WAAd,GAA4B6F,oBAA5B,CAAiDC,IAAjD,CAAsD,MAAM;AAC1D/F,MAAAA,gBAAgB,CAAC,IAAD,CAAhB;AACD,KAFD;AAGD,GAJQ,EAIN,EAJM,CAAT;AAMAvB,EAAAA,SAAS,CAAC,MAAM;AACd,QAAIO,QAAQ,CAACsF,EAAT,KAAgB,SAApB,EAA+B;AAC7B,YAAM0B,WAAW,GAAG,MAAM;AACxB,YAAInG,iBAAJ,EAAuB;AACrBX,UAAAA,WAAW,CAACe,WAAZ,GAA0BgG,SAA1B,CAAoCC,kBAApC;AACA,iBAAO,IAAP;AACD;;AACD,eAAO,KAAP;AACD,OAND;;AAOA,YAAMC,YAAY,GAAGrH,WAAW,CAACsH,gBAAZ,CACnB,mBADmB,EAEnBJ,WAFmB,CAArB;AAIA,aAAO,MAAM;AACXG,QAAAA,YAAY,CAACT,MAAb;AACD,OAFD;AAGD;;AAED;AACD,GAnBQ,EAmBN,CAAC7F,iBAAD,CAnBM,CAAT;;AAqBA,MAAI,CAACE,aAAL,EAAoB;AAClB,WAAO,IAAP;AACD;;AAED,sBACE,oBAAC,YAAD;AACE,IAAA,GAAG,EAAEH,kBADP;AAEE,IAAA,GAAG,EAAEwB;AAFP,KAGM1B,KAHN;AAIE,IAAA,wBAAwB,EAAEU,4BAJ5B;AAKE,IAAA,kCAAkC,EAChCO;AANJ,KADF;AAWD,CAnTD;;AAqTA,4BAAenC,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 BackHandler,\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 { StoryBlockSource } from '../models/StoryBlockSource';\nimport { FireworkSDKModuleEventEmitter } from '../modules/FireworkSDKModule';\nimport FWGlobalState from '../utils/FWGlobalState';\nimport FWLoggerUtil from '../utils/FWLoggerUtil';\nimport FWStoryBlock from './FWStoryBlock';\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\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 * Specifies if Picture in Picture is enabled. Only supported on iOS.\n */\n enablePictureInPicture?: boolean;\n /**\n * Ad configuration of the feed. Only supported on iOS.\n */\n adConfiguration?: AdConfiguration;\n\n /* The configuration of the story block.\n Only supported on Android.*/\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\nconst StoryBlock: ForwardRefRenderFunction<\n IStoryBlockMethods,\n IStoryBlockProps\n> = (props: IStoryBlockProps, forwardedRef) => {\n const nativeComponentRef = useRef(null);\n const [isFullscreenState, setIsFullscreenState] = useState<boolean>(false);\n const [sdkInitCalled, setSdkInitCalled] = useState<boolean>(\n FWGlobalState.getInstance().sdkInitCalled\n );\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 } = props;\n const { name, reason } = event.nativeEvent;\n\n if (onStoryBlockLoadFinished) {\n if (name) {\n if (reason) {\n onStoryBlockLoadFinished({ name, reason });\n } else {\n onStoryBlockLoadFinished({ name });\n }\n } else {\n onStoryBlockLoadFinished();\n }\n }\n };\n\n const handleStoryBlockFullScreenStateChanged = (\n event: NativeSyntheticEvent<any>\n ) => {\n FWLoggerUtil.log(\n `StoryBlock handleStoryBlockFullScreenStateChanged ${event.nativeEvent.isFullScreen}`\n );\n const { isFullScreen } = event.nativeEvent;\n setIsFullscreenState(isFullScreen);\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 generateKey = (): string => {\n const gShareBaseURL = FireworkSDK.getInstance().shareBaseURL ?? '';\n const appLanguage = FireworkSDK.getInstance().appLanguage ?? '';\n const videoLaunchBehavior =\n FireworkSDK.getInstance().videoLaunchBehavior ?? '';\n const adBadgeConfiguration =\n 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?.toString() ?? '';\n const androidFontTypefaceNameOfAdBadge =\n adBadgeConfiguration.androidFontInfo?.typefaceName ?? '';\n\n const {\n source,\n channel = '',\n playlist = '',\n hashtagFilterExpression = '',\n enablePictureInPicture = false,\n adConfiguration,\n storyBlockConfiguration,\n } = props;\n const dynamicContentParametersString =\n generateDynamicContentParametersString();\n\n const videoCompleteAction =\n storyBlockConfiguration?.videoCompleteAction ?? '';\n const showShareButton =\n storyBlockConfiguration?.showShareButton?.toString() ?? '';\n const showPlaybackButton =\n storyBlockConfiguration?.showPlaybackButton?.toString() ?? '';\n const showBranding =\n storyBlockConfiguration?.showBranding?.toString() ?? '';\n const ctaDelayType = storyBlockConfiguration?.ctaDelay?.type ?? '';\n const ctaDelayValue =\n 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 ctaWidth = storyBlockConfiguration?.ctaWidth ?? '';\n\n const requiresAds = adConfiguration?.requiresAds?.toString() ?? '';\n const adsFetchTimeout = adConfiguration?.adsFetchTimeout ?? 10;\n const vastAttributesString = generateVastAttributesString();\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 += `_enablePictureInPicture:${enablePictureInPicture}`;\n\n key += `_shareBaseURL:${shareBaseURL}`;\n if (Platform.OS === 'android') {\n key += `_videoCompleteAction:${videoCompleteAction}`;\n key += `_showShareButton:${showShareButton}`;\n key += `_showPlaybackButton:${showPlaybackButton}`;\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 }\n\n key += `_requiresAds:${requiresAds}`;\n key += `_adsFetchTimeout:${adsFetchTimeout}`;\n key += `_vastAttributes:${vastAttributesString}`;\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 };\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 if (Platform.OS === 'android') {\n forceUpdate();\n }\n }\n );\n\n return () => {\n subscriptionOfShareBaseURLUpdated.remove();\n subscriptionOfAdBadgeConfigurationUpdated.remove();\n subscriptionOfVideoLaunchBehaviorUpdated.remove();\n subscriptionOfAppLanguageUpdated.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 useEffect(() => {\n if (Platform.OS === 'android') {\n const onBackPress = () => {\n if (isFullscreenState) {\n FireworkSDK.getInstance().navigator.popNativeContainer();\n return true;\n }\n return false;\n };\n const subscription = BackHandler.addEventListener(\n 'hardwareBackPress',\n onBackPress\n );\n return () => {\n subscription.remove();\n };\n }\n\n return;\n }, [isFullscreenState]);\n\n if (!sdkInitCalled) {\n return null;\n }\n\n return (\n <FWStoryBlock\n ref={nativeComponentRef}\n key={key}\n {...props}\n onStoryBlockLoadFinished={handleStoryBlockLoadFinished}\n onStoryBlockFullScreenStateChanged={\n handleStoryBlockFullScreenStateChanged\n }\n />\n );\n};\n\nexport default forwardRef(StoryBlock);\n"]}