react-native-firework-sdk 2.8.6 → 2.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. package/FireworkVideoUI.xcframework/Info.plist +5 -5
  2. package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/FireworkVideoUI +0 -0
  3. package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Info.plist +0 -0
  4. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/FireworkVideoUI +0 -0
  5. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Info.plist +0 -0
  6. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/_CodeSignature/CodeResources +1 -1
  7. package/android/build.gradle +2 -1
  8. package/android/gradle.properties +1 -1
  9. package/android/src/main/java/com/fireworksdk/bridge/components/base/FWLoading.kt +22 -0
  10. package/android/src/main/java/com/fireworksdk/bridge/components/storyblock/StoryBlockFragment.kt +240 -18
  11. package/android/src/main/java/com/fireworksdk/bridge/components/videofeed/FWVideoFeed.kt +19 -9
  12. package/android/src/main/java/com/fireworksdk/bridge/models/FWAdConfigurationDeserializer.kt +49 -0
  13. package/android/src/main/java/com/fireworksdk/bridge/models/FWAdConfigurationModel.kt +13 -0
  14. package/android/src/main/java/com/fireworksdk/bridge/models/FWAdConfigurationSerializer.kt +42 -0
  15. package/android/src/main/java/com/fireworksdk/bridge/models/FWButtonInfoDeserializer.kt +21 -0
  16. package/android/src/main/java/com/fireworksdk/bridge/models/FWButtonInfoModel.kt +6 -0
  17. package/android/src/main/java/com/fireworksdk/bridge/models/FWButtonInfoSerializer.kt +17 -0
  18. package/android/src/main/java/com/fireworksdk/bridge/models/FWPlayerButtonConfigurationDeserializer.kt +33 -0
  19. package/android/src/main/java/com/fireworksdk/bridge/models/FWPlayerButtonConfigurationModel.kt +10 -0
  20. package/android/src/main/java/com/fireworksdk/bridge/models/FWPlayerButtonConfigurationSerializer.kt +25 -0
  21. package/android/src/main/java/com/fireworksdk/bridge/models/FWProductInfoViewConfiguration.kt +7 -0
  22. package/android/src/main/java/com/fireworksdk/bridge/models/FWProductInfoViewConfigurationDeserializer.kt +17 -0
  23. package/android/src/main/java/com/fireworksdk/bridge/models/FWProductInfoViewConfigurationSerializer.kt +13 -0
  24. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoFeedPropsModel.kt +1 -0
  25. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoFeedPropsModelDeserializer.kt +3 -0
  26. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoFeedPropsModelSerializer.kt +2 -0
  27. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoPlayerConfigModel.kt +3 -1
  28. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoPlayerConfigModelDeserializer.kt +7 -1
  29. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoPlayerConfigModelSerializer.kt +4 -0
  30. package/android/src/main/java/com/fireworksdk/bridge/models/enums/FWErrorAction.kt +18 -0
  31. package/android/src/main/java/com/fireworksdk/bridge/models/enums/FWEventName.kt +3 -0
  32. package/android/src/main/java/com/fireworksdk/bridge/reactnative/manager/FWStoryBlockManager.kt +50 -26
  33. package/android/src/main/java/com/fireworksdk/bridge/reactnative/manager/FWVideoFeedManager.kt +47 -8
  34. package/android/src/main/java/com/fireworksdk/bridge/reactnative/models/FWVideoShoppingInterface.kt +1 -0
  35. package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FWNavigatorModule.kt +0 -10
  36. package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FWVideoShoppingModule.kt +42 -0
  37. package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FireworkSDKModule.kt +5 -3
  38. package/android/src/main/java/com/fireworksdk/bridge/reactnative/utils/FWEventUtils.kt +24 -6
  39. package/android/src/main/java/com/fireworksdk/bridge/utils/FWConfigUtil.kt +95 -0
  40. package/android/src/main/res/layout/fw_bridge_story_block.xml +6 -0
  41. package/android/src/main/res/layout/fw_loading.xml +14 -0
  42. package/ios/Components/VideoFeed.swift +1 -1
  43. package/ios/FireworkVideoUI/Podfile.lock +1 -1
  44. package/ios/Modules/FWNavigatorModule/RNSScreenStackView+Window.h +20 -0
  45. package/ios/Modules/FWNavigatorModule/RNSScreenStackView+Window.m +84 -0
  46. package/lib/commonjs/VideoShopping.js +1 -4
  47. package/lib/commonjs/VideoShopping.js.map +1 -1
  48. package/lib/commonjs/components/StoryBlock.js +32 -42
  49. package/lib/commonjs/components/StoryBlock.js.map +1 -1
  50. package/lib/commonjs/components/VideoFeed.js +29 -11
  51. package/lib/commonjs/components/VideoFeed.js.map +1 -1
  52. package/lib/commonjs/index.js +8 -0
  53. package/lib/commonjs/index.js.map +1 -1
  54. package/lib/commonjs/utils/VideoFeedUtil.js +73 -0
  55. package/lib/commonjs/utils/VideoFeedUtil.js.map +1 -0
  56. package/lib/module/VideoShopping.js +1 -5
  57. package/lib/module/VideoShopping.js.map +1 -1
  58. package/lib/module/components/StoryBlock.js +32 -40
  59. package/lib/module/components/StoryBlock.js.map +1 -1
  60. package/lib/module/components/VideoFeed.js +28 -11
  61. package/lib/module/components/VideoFeed.js.map +1 -1
  62. package/lib/module/index.js +2 -1
  63. package/lib/module/index.js.map +1 -1
  64. package/lib/module/utils/VideoFeedUtil.js +65 -0
  65. package/lib/module/utils/VideoFeedUtil.js.map +1 -0
  66. package/lib/typescript/VideoShopping.d.ts +0 -1
  67. package/lib/typescript/components/StoryBlock.d.ts +15 -4
  68. package/lib/typescript/components/VideoFeed.d.ts +12 -1
  69. package/lib/typescript/index.d.ts +2 -1
  70. package/lib/typescript/models/ButtonInfo.d.ts +0 -1
  71. package/lib/typescript/models/ProductInfoViewConfiguration.d.ts +3 -3
  72. package/lib/typescript/models/StoryBlockConfiguration.d.ts +0 -2
  73. package/lib/typescript/models/VideoPlayerButtonConfiguration.d.ts +0 -6
  74. package/lib/typescript/models/VideoPlayerConfiguration.d.ts +0 -2
  75. package/lib/typescript/utils/VideoFeedUtil.d.ts +10 -0
  76. package/package.json +1 -1
  77. package/src/VideoShopping.ts +1 -4
  78. package/src/components/StoryBlock.tsx +40 -44
  79. package/src/components/VideoFeed.tsx +32 -11
  80. package/src/index.ts +2 -0
  81. package/src/models/ButtonInfo.ts +0 -1
  82. package/src/models/ProductInfoViewConfiguration.ts +3 -3
  83. package/src/models/StoryBlockConfiguration.ts +0 -2
  84. package/src/models/VideoPlayerButtonConfiguration.ts +0 -6
  85. package/src/models/VideoPlayerConfiguration.ts +0 -2
  86. package/src/utils/VideoFeedUtil.ts +74 -0
  87. package/android/src/main/java/com/fireworksdk/bridge/utils/FWStatusBarUtil.kt +0 -28
  88. package/android/src/main/java/com/fireworksdk/bridge/utils/FWStoryBlockUtil.kt +0 -30
@@ -1 +1 @@
1
- {"version":3,"sources":["VideoShopping.ts"],"names":["Platform","FWEventName","ShoppingModule","ShoppingModuleEventEmitter","FWLoggerUtil","FWGlobalState","VideoShopping","onCustomClickLinkButton","_onCustomClickLinkButton","value","setCustomClickLinkButtonEnabled","onCustomTapProductCard","_onCustomTapProductCard","OS","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","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;AACA;AACmC,MAAtBE,sBAAsB,GAEnB;AACZ,WAAO,KAAKC,uBAAZ;AACD;;AACgC,MAAtBD,sBAAsB,CAC/BF,KAD+B,EAE/B;AACA,SAAKG,uBAAL,GAA+BH,KAA/B;;AACA,QAAIT,QAAQ,CAACa,EAAT,KAAgB,KAApB,EAA2B;AACzBX,MAAAA,cAAc,CAACY,8BAAf,CAA8C,CAAC,CAACL,KAAhD;AACD;AACF;;AAGD;AACF;AACA;AACA;AAC4B,MAAfM,eAAe,GAAY;AACpC,WAAO,KAAKC,gBAAZ;AACD;;AACyB,MAAfD,eAAe,CAACN,KAAD,EAAiB;AACzC,SAAKO,gBAAL,GAAwBP,KAAxB;;AACA,QAAIJ,aAAa,CAACY,WAAd,GAA4BC,aAAhC,EAA+C;AAC7ChB,MAAAA,cAAc,CAACiB,kBAAf,CAAkCV,KAAlC;AACD,KAFD,MAEO;AACLJ,MAAAA,aAAa,CAACY,WAAd,GAA4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CAACa,EAAT,KAAgB,KAApB,EAA2B;AACzBX,YAAAA,cAAc,CAAC6D,eAAf,CACEZ,UADF,EAEElD,WAAW,CAACyC,oBAFd;AAID;AACF;AACF;AACF,KAhCD,MAgCO;AACLtC,MAAAA,YAAY,CAAC0B,GAAb,CAAiB,6CAAjB;;AACA,UAAIqB,UAAJ,EAAgB;AACd,YAAInD,QAAQ,CAACa,EAAT,KAAgB,KAApB,EAA2B;AACzBX,UAAAA,cAAc,CAAC6D,eAAf,CACEZ,UADF,EAEElD,WAAW,CAACyC,oBAFd;AAID;AACF;AACF;AACF;;AAE6C,QAAhCK,gCAAgC,CAC5CZ,KAD4C,EAE5C;AACA,QAAI,KAAK5B,uBAAT,EAAkC;AAChC,WAAKA,uBAAL,CAA6B4B,KAA7B;AACD;AACF;;AAE4C,QAA/BsB,+BAA+B,CAC3CtB,KAD2C,EAE3C;AACA,QAAI,KAAKxB,sBAAT,EAAiC;AAC/B,WAAKA,sBAAL,CAA4BwB,KAA5B;AACD;AACF;;AA5SiB;;gBAAd7B,a;;AA+SN,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 * Only supported on iOS.\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 if (Platform.OS === 'ios') {\n ShoppingModule.setCustomTapProductCardEnabled(!!value);\n }\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","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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AAM,KAAKD,sBAAL,CACxB/B,KADwB,CAA1B;AAIA,YAAMQ,UAAU,GAAG,CAACwB,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,7 +1,7 @@
1
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
2
 
3
3
  import React, { forwardRef, useEffect, useImperativeHandle, useReducer, useRef, useState } from 'react';
4
- import { BackHandler, findNodeHandle, Platform, UIManager } from 'react-native';
4
+ import { findNodeHandle, Platform, UIManager } from 'react-native';
5
5
  import FireworkSDK from '../FireworkSDK';
6
6
  import { FWEventName } from '../models/FWEventName';
7
7
  import { FireworkSDKModuleEventEmitter } from '../modules/FireworkSDKModule';
@@ -13,14 +13,15 @@ const NativeComponentName = 'FWStoryBlock';
13
13
 
14
14
  const StoryBlock = (props, forwardedRef) => {
15
15
  const nativeComponentRef = useRef(null);
16
- const [isFullscreenState, setIsFullscreenState] = useState(false);
17
16
  const [sdkInitCalled, setSdkInitCalled] = useState(FWGlobalState.getInstance().sdkInitCalled);
17
+ const loadedRef = useRef(false);
18
18
  const [, forceUpdate] = useReducer(x => x + 1, 0);
19
19
 
20
20
  const handleStoryBlockLoadFinished = event => {
21
21
  FWLoggerUtil.log(`StoryBlock handleStoryBlockLoadFinished ${event.nativeEvent.name}`);
22
22
  const {
23
- onStoryBlockLoadFinished
23
+ onStoryBlockLoadFinished,
24
+ onStoryBlockEmpty
24
25
  } = props;
25
26
  const {
26
27
  name,
@@ -29,22 +30,37 @@ const StoryBlock = (props, forwardedRef) => {
29
30
 
30
31
  if (onStoryBlockLoadFinished) {
31
32
  if (name) {
33
+ let error = {
34
+ name
35
+ };
36
+
32
37
  if (reason) {
33
- onStoryBlockLoadFinished({
34
- name,
35
- reason
36
- });
37
- } else {
38
- onStoryBlockLoadFinished({
39
- name
40
- });
38
+ error.reason = reason;
39
+ }
40
+
41
+ onStoryBlockLoadFinished(error);
42
+
43
+ if (!loadedRef.current) {
44
+ onStoryBlockEmpty === null || onStoryBlockEmpty === void 0 ? void 0 : onStoryBlockEmpty(error);
41
45
  }
42
46
  } else {
43
47
  onStoryBlockLoadFinished();
48
+ loadedRef.current = true;
44
49
  }
45
50
  }
46
51
  };
47
52
 
53
+ const handleStoryBlockEmpty = event => {
54
+ FWLoggerUtil.log(`StoryBlock handleStoryBlockEmpty ${event.nativeEvent}`);
55
+ const {
56
+ onStoryBlockEmpty
57
+ } = props;
58
+
59
+ if (onStoryBlockEmpty) {
60
+ onStoryBlockEmpty();
61
+ }
62
+ };
63
+
48
64
  const handleStoryBlockDidStartPictureInPicture = event => {
49
65
  FWLoggerUtil.log(`StoryBlock handleStoryBlockDidStartPictureInPicture ${JSON.stringify(event.nativeEvent)}`);
50
66
  const {
@@ -101,14 +117,6 @@ const StoryBlock = (props, forwardedRef) => {
101
117
  }
102
118
  };
103
119
 
104
- const handleStoryBlockFullScreenStateChanged = event => {
105
- FWLoggerUtil.log(`StoryBlock handleStoryBlockFullScreenStateChanged ${event.nativeEvent.isFullScreen}`);
106
- const {
107
- isFullScreen
108
- } = event.nativeEvent;
109
- setIsFullscreenState(isFullScreen);
110
- };
111
-
112
120
  const generateDynamicContentParametersString = () => {
113
121
  const {
114
122
  dynamicContentParameters
@@ -298,6 +306,9 @@ const StoryBlock = (props, forwardedRef) => {
298
306
  },
299
307
  pause: () => {
300
308
  sendCommand('pause');
309
+ },
310
+ openFullscreen: () => {
311
+ sendCommand('openFullscreen');
301
312
  }
302
313
  };
303
314
  }, []);
@@ -344,25 +355,6 @@ const StoryBlock = (props, forwardedRef) => {
344
355
  setSdkInitCalled(true);
345
356
  });
346
357
  }, []);
347
- useEffect(() => {
348
- if (Platform.OS === 'android') {
349
- const onBackPress = () => {
350
- if (isFullscreenState) {
351
- FireworkSDK.getInstance().navigator.popNativeContainer();
352
- return true;
353
- }
354
-
355
- return false;
356
- };
357
-
358
- const subscription = BackHandler.addEventListener('hardwareBackPress', onBackPress);
359
- return () => {
360
- subscription.remove();
361
- };
362
- }
363
-
364
- return;
365
- }, [isFullscreenState]);
366
358
 
367
359
  if (!sdkInitCalled) {
368
360
  return null;
@@ -384,9 +376,9 @@ const StoryBlock = (props, forwardedRef) => {
384
376
  storyBlockConfiguration: storyBlockConfiguration,
385
377
  enablePictureInPicture: undefined,
386
378
  onStoryBlockLoadFinished: handleStoryBlockLoadFinished,
379
+ onStoryBlockEmpty: handleStoryBlockEmpty,
387
380
  onStoryBlockDidStartPictureInPicture: handleStoryBlockDidStartPictureInPicture,
388
- onStoryBlockDidStopPictureInPicture: handleStoryBlockDidStopPictureInPicture,
389
- onStoryBlockFullScreenStateChanged: handleStoryBlockFullScreenStateChanged
381
+ onStoryBlockDidStopPictureInPicture: handleStoryBlockDidStopPictureInPicture
390
382
  }));
391
383
  };
392
384
 
@@ -1 +1 @@
1
- {"version":3,"sources":["StoryBlock.tsx"],"names":["React","forwardRef","useEffect","useImperativeHandle","useReducer","useRef","useState","BackHandler","findNodeHandle","Platform","UIManager","FireworkSDK","FWEventName","FireworkSDKModuleEventEmitter","FWGlobalState","FWLoggerUtil","FWStoryBlock","gennerateJsonKey","NativeComponentName","StoryBlock","props","forwardedRef","nativeComponentRef","isFullscreenState","setIsFullscreenState","sdkInitCalled","setSdkInitCalled","getInstance","forceUpdate","x","handleStoryBlockLoadFinished","event","log","nativeEvent","name","onStoryBlockLoadFinished","reason","handleStoryBlockDidStartPictureInPicture","JSON","stringify","onStoryBlockDidStartPictureInPicture","handleStoryBlockDidStopPictureInPicture","onStoryBlockDidStopPictureInPicture","handleStoryBlockFullScreenStateChanged","isFullScreen","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","current","commandId","getViewManagerConfig","Commands","toString","dispatchViewManagerCommand","play","pause","subscriptionOfShareBaseURLUpdated","addListener","ShareBaseURLUpdated","subscriptionOfAdBadgeConfigurationUpdated","AdBadgeConfigurationUpdated","subscriptionOfVideoLaunchBehaviorUpdated","VideoLaunchBehaviorUpdated","subscriptionOfAppLanguageUpdated","AppLanguageUpdated","subscriptionOfProductInfoViewConfigurationUpdated","ProductInfoViewConfigurationUpdated","remove","setTimeout","viewId","create","sdkInitCalledPromise","then","onBackPress","navigator","popNativeContainer","subscription","addEventListener","style","otherProps","assign","borderRadius","undefined"],"mappings":";;AACA,OAAOA,KAAP,IACEC,UADF,E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E,IAAA,wBAAwB,EAAEpI,4BAR5B;AASE,IAAA,oCAAoC,EAClCO,wCAVJ;AAYE,IAAA,mCAAmC,EACjCI,uCAbJ;AAeE,IAAA,kCAAkC,EAChCE;AAhBJ,KADF;AAqBD,CA1aD;;AA4aA,4BAAe1C,UAAU,CAACkB,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 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\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. Only supported on iOS.\n */\n adConfiguration?: AdConfiguration;\n\n /**\n * The configuration of the story block.\n */\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 * 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 [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 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 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 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 };\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 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 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 onStoryBlockDidStartPictureInPicture={\n handleStoryBlockDidStartPictureInPicture\n }\n onStoryBlockDidStopPictureInPicture={\n handleStoryBlockDidStopPictureInPicture\n }\n onStoryBlockFullScreenStateChanged={\n handleStoryBlockFullScreenStateChanged\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","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","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4BAAe1C,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\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"]}
@@ -26,6 +26,8 @@ class VideoFeed extends React.Component {
26
26
 
27
27
  _defineProperty(this, "_subscriptions", []);
28
28
 
29
+ _defineProperty(this, "_loaded", false);
30
+
29
31
  _defineProperty(this, "refresh", () => {
30
32
  FWLoggerUtil.log(`VideoFeed refresh ${JSON.stringify(this.props)}`);
31
33
  const nativeNodeHandle = findNodeHandle(this._nativeComponentRef.current);
@@ -41,7 +43,8 @@ class VideoFeed extends React.Component {
41
43
  _defineProperty(this, "_onVideoFeedLoadFinished", event => {
42
44
  FWLoggerUtil.log(`VideoFeed _onVideoFeedLoadFinished ${JSON.stringify(event.nativeEvent)}`);
43
45
  const {
44
- onVideoFeedLoadFinished
46
+ onVideoFeedLoadFinished,
47
+ onVideoFeedEmpty
45
48
  } = this.props;
46
49
  const {
47
50
  name,
@@ -50,22 +53,37 @@ class VideoFeed extends React.Component {
50
53
 
51
54
  if (onVideoFeedLoadFinished) {
52
55
  if (name) {
56
+ let error = {
57
+ name
58
+ };
59
+
53
60
  if (reason) {
54
- onVideoFeedLoadFinished({
55
- name,
56
- reason
57
- });
58
- } else {
59
- onVideoFeedLoadFinished({
60
- name
61
- });
61
+ error.reason = reason;
62
+ }
63
+
64
+ onVideoFeedLoadFinished(error);
65
+
66
+ if (!this._loaded) {
67
+ onVideoFeedEmpty === null || onVideoFeedEmpty === void 0 ? void 0 : onVideoFeedEmpty(error);
62
68
  }
63
69
  } else {
64
70
  onVideoFeedLoadFinished();
71
+ this._loaded = true;
65
72
  }
66
73
  }
67
74
  });
68
75
 
76
+ _defineProperty(this, "_onVideoFeedEmpty", event => {
77
+ FWLoggerUtil.log(`VideoFeed _onVideoFeedLoadFinished ${JSON.stringify(event.nativeEvent)}`);
78
+ const {
79
+ onVideoFeedEmpty
80
+ } = this.props;
81
+
82
+ if (onVideoFeedEmpty) {
83
+ onVideoFeedEmpty();
84
+ }
85
+ });
86
+
69
87
  _defineProperty(this, "_onVideoFeedDidStartPictureInPicture", event => {
70
88
  FWLoggerUtil.log(`VideoFeed _onVideoFeedDidStartPictureInPicture ${JSON.stringify(event.nativeEvent)}`);
71
89
  const {
@@ -191,8 +209,6 @@ class VideoFeed extends React.Component {
191
209
  render() {
192
210
  var _adBadgeConfiguration, _adBadgeConfiguration2, _adBadgeConfiguration3, _videoFeedConfigurati, _videoFeedConfigurati2, _videoFeedConfigurati3, _videoFeedConfigurati4, _videoFeedConfigurati5, _videoFeedConfigurati6, _videoFeedConfigurati7, _videoFeedConfigurati8, _videoFeedConfigurati9, _videoFeedConfigurati10, _videoFeedConfigurati11, _videoFeedConfigurati12, _videoFeedConfigurati13, _videoFeedConfigurati14, _videoPlayerConfigura, _videoPlayerConfigura2, _videoPlayerConfigura3, _videoPlayerConfigura4, _videoPlayerConfigura5, _videoPlayerConfigura6;
193
211
 
194
- FWLoggerUtil.log(`VideoFeed render props ${JSON.stringify(this.props)} state ${JSON.stringify(this.state)}`);
195
-
196
212
  if (!this.state.sdkInitCalled) {
197
213
  return null;
198
214
  }
@@ -343,6 +359,7 @@ class VideoFeed extends React.Component {
343
359
  videoPlayerConfiguration: videoPlayerConfiguration,
344
360
  ref: this._nativeComponentRef,
345
361
  onVideoFeedLoadFinished: this._onVideoFeedLoadFinished,
362
+ onVideoFeedEmpty: this._onVideoFeedEmpty,
346
363
  onVideoFeedDidStartPictureInPicture: this._onVideoFeedDidStartPictureInPicture,
347
364
  onVideoFeedDidStopPictureInPicture: this._onVideoFeedDidStopPictureInPicture,
348
365
  mode: mode !== null && mode !== void 0 ? mode : 'row'