react-native-firework-sdk 1.6.2 → 1.7.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 (53) hide show
  1. package/android/build.gradle +1 -1
  2. package/android/src/main/java/com/fireworksdk/bridge/reactnative/models/FireworkSDKInterface.kt +2 -0
  3. package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FireworkSDKModule.kt +55 -0
  4. package/android/src/main/java/com/fireworksdk/bridge/utils/FWLanguageUtil.kt +72 -0
  5. package/ios/Components/StoryBlock.swift +5 -4
  6. package/ios/Components/VideoFeed.swift +27 -35
  7. package/ios/Components/VideoPlayerConfiguration.swift +11 -0
  8. package/ios/FireworkSdk.xcodeproj/project.pbxproj +26 -16
  9. package/ios/Modules/FWNavigatorModule/FWNavigatorModule.swift +2 -11
  10. package/ios/Modules/FireworkSDKModule/FireworkSDKModule+EventTracking.swift +2 -0
  11. package/ios/Modules/FireworkSDKModule/FireworkSDKModule.swift +1 -1
  12. package/ios/Utils/DispatchQueue+FWOnce.swift +32 -0
  13. package/ios/Utils/FWPiPManager.swift +24 -0
  14. package/ios/Utils/FWSwizzleLoader.h +15 -0
  15. package/ios/Utils/FWSwizzleLoader.m +17 -0
  16. package/ios/Utils/FWSwizzleUtil.swift +29 -0
  17. package/ios/Utils/UIButton+FWSwizzle.swift +33 -0
  18. package/ios/Utils/UINavigationController+FWSwizzle.swift +30 -0
  19. package/ios/react_native_firework_sdk.h +1 -2
  20. package/lib/commonjs/FireworkSDK.js +21 -1
  21. package/lib/commonjs/FireworkSDK.js.map +1 -1
  22. package/lib/commonjs/VideoShopping.js +7 -7
  23. package/lib/commonjs/VideoShopping.js.map +1 -1
  24. package/lib/commonjs/components/VideoFeed.js +3 -1
  25. package/lib/commonjs/components/VideoFeed.js.map +1 -1
  26. package/lib/commonjs/index.js.map +1 -1
  27. package/lib/commonjs/modules/FireworkSDKModule.js.map +1 -1
  28. package/lib/module/FireworkSDK.js +21 -1
  29. package/lib/module/FireworkSDK.js.map +1 -1
  30. package/lib/module/VideoShopping.js +7 -7
  31. package/lib/module/VideoShopping.js.map +1 -1
  32. package/lib/module/components/VideoFeed.js +3 -1
  33. package/lib/module/components/VideoFeed.js.map +1 -1
  34. package/lib/module/index.js.map +1 -1
  35. package/lib/module/modules/FireworkSDKModule.js.map +1 -1
  36. package/lib/typescript/FireworkSDK.d.ts +7 -3
  37. package/lib/typescript/VideoShopping.d.ts +7 -7
  38. package/lib/typescript/index.d.ts +3 -3
  39. package/lib/typescript/models/VideoPlayerConfiguration.d.ts +19 -0
  40. package/lib/typescript/modules/FireworkSDKModule.d.ts +2 -0
  41. package/package.json +1 -1
  42. package/react-native-firework-sdk.podspec +2 -4
  43. package/src/FireworkSDK.ts +18 -4
  44. package/src/VideoShopping.ts +7 -7
  45. package/src/components/VideoFeed.tsx +2 -0
  46. package/src/index.tsx +4 -2
  47. package/src/models/VideoPlayerConfiguration.ts +20 -0
  48. package/src/modules/FireworkSDKModule.ts +2 -0
  49. package/ios/Utils/AVPlayer+FWSwizzle.h +0 -17
  50. package/ios/Utils/AVPlayer+FWSwizzle.m +0 -50
  51. package/ios/Utils/FWNavigatorUtils.swift +0 -26
  52. package/ios/Utils/UINavigationController+FWSwizzle.h +0 -16
  53. package/ios/Utils/UINavigationController+FWSwizzle.m +0 -49
@@ -1 +1 @@
1
- {"version":3,"sources":["VideoShopping.ts"],"names":["Platform","FWEventName","ShoppingModule","ShoppingModuleEventEmitter","FWLoggerUtil","VideoShopping","onCustomClickCartIcon","_onCustomClickCartIcon","value","OS","setCustomClickCartIconEnabled","cartIconVisible","_cartIconVisible","setCartIconVisible","eventEmitter","getInstance","log","_instance","constructor","addListener","AddToCart","event","productId","unitId","handleAddToCartEvent","ClickCartIcon","handleClickCartIconEvent","UpdateProductDetails","productIds","handleUpdateProductDetailsEvent","WillDisplayProduct","videoId","handleWillDisplayProductEvent","LogMessage","setCartItemCount","count","callbackId","onAddToCart","result","updateAddToCartStatus","res","tips","clearCallbackId","onClickCartIcon","props","jumpToCartPage","onUpdateProductDetails","productList","map","product","length","updateVideoProducts","onWillDisplayProduct","config","updateProductViewConfig"],"mappings":";;AAAA,SAA6BA,QAA7B,QAA6C,cAA7C;AAQA,SAASC,WAAT,QAA4B,sBAA5B;AAGA,OAAOC,cAAP,IACEC,0BADF,QAEO,0BAFP;AAIA,OAAOC,YAAP,MAAyB,sBAAzB;;AAsBA;AACA;AACA;AACA,MAAMC,aAAN,CAAoB;AAGlB;AACF;AACA;AACA;AACA;;AAGE;AACF;AACA;AACA;AACA;;AAGE;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACkC,MAArBC,qBAAqB,GAA4C;AAC1E,WAAO,KAAKC,sBAAZ;AACD;;AAC+B,MAArBD,qBAAqB,CAC9BE,KAD8B,EAE9B;AACA,SAAKD,sBAAL,GAA8BC,KAA9B;;AACA,QAAIR,QAAQ,CAACS,EAAT,KAAgB,KAApB,EAA2B;AACzBP,MAAAA,cAAc,CAACQ,6BAAf,CAA6C,CAAC,CAACF,KAA/C;AACD;AACF;;AAiBD;AACF;AACA;AAC4B,MAAfG,eAAe,GAAY;AACpC,WAAO,KAAKC,gBAAZ;AACD;;AACyB,MAAfD,eAAe,CAACH,KAAD,EAAiB;AACzC,SAAKI,gBAAL,GAAwBJ,KAAxB;AACAN,IAAAA,cAAc,CAACW,kBAAf,CAAkCL,KAAlC;AACD;;AAGuB,MAAZM,YAAY,GAAuB;AAC7C,WAAOX,0BAAP;AACD;;AAEwB,SAAXY,WAAW,GAAG;AAC1BX,IAAAA,YAAY,CAACY,GAAb,CAAiB,2BAAjB;;AACA,QAAI,CAACX,aAAa,CAACY,SAAnB,EAA8B;AAC5BZ,MAAAA,aAAa,CAACY,SAAd,GAA0B,IAAIZ,aAAJ,EAA1B;AACD;;AAED,WAAOA,aAAa,CAACY,SAArB;AACD;;AAEOC,EAAAA,WAAW,GAAG;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;A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AAvC,EAA+CjB,UAA/C;AACD;AACF;AACF;;AA7NiB;;gBAAd/B,a;;AAgON,eAAeA,aAAf","sourcesContent":["import { NativeEventEmitter, Platform } from 'react-native';\n\nimport type AddToCartResult from './models/AddToCartResult';\nimport type {\n AddToCartEvent,\n UpdateProductDetailsEvent,\n WillDisplayProductEvent,\n} from './models/FWEvents';\nimport { FWEventName } from './models/FWEventName';\nimport type Product from './models/Product';\nimport type ProductInfoViewConfiguration from './models/ProductInfoViewConfiguration';\nimport ShoppingModule, {\n ShoppingModuleEventEmitter,\n} from './modules/ShoppingModule';\nimport type { NewNativeContainerProps } from './models/NewNativeContainerProps';\nimport FWLoggerUtil from './utils/FWLoggerUtil';\n\nexport type AddToCartCallback = (\n event: AddToCartEvent\n) => Promise<AddToCartResult | undefined | null>;\n\nexport type ClickCartIconCallback = () => Promise<\n NewNativeContainerProps | undefined | null\n>;\n\nexport type CustomClickCartIconCallback = () => Promise<void>;\n\nexport type UpdateProductDetailsCallback = (\n event: UpdateProductDetailsEvent\n) => Promise<Product[] | undefined | null>;\n\nexport type WillDisplayProductCallback = (\n event: WillDisplayProductEvent\n) => Promise<ProductInfoViewConfiguration | undefined | null>;\n\ntype CallbackInfo = { callbackId?: number | string };\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\" button.\n *\n * The host app can return an AddToCartResult object to tell FireworkSDK the result of adding to cart.\n */\n public onAddToCart?: AddToCartCallback;\n\n /**\n * This callback is triggered when the user clicks the shopping cart icon.\n *\n * The host app can return NewNativeContainerProps object and we will push a new native container with the props.\n */\n public onClickCartIcon?: ClickCartIconCallback;\n\n /**\n * This callback is triggered when the user clicks the shopping cart icon.\n *\n * The host app can customize the processing logic of clicking the shopping cart icon by setting the callback.\n * In the callack, you could call FireworkSDK.getInstance().navigator.popNativeContainer to close the player\n * and call navigation.navigate to push the RN cart page.\n * Currently, there is a limitation on the iOS side when you set the callback.\n * That is, if you set the callback, you need to call FireworkSDK.getInstance().navigator.popNativeContainer in the callback.\n * Otherwise there will be bugs on the iOS side.\n */\n public get onCustomClickCartIcon(): CustomClickCartIconCallback | undefined {\n return this._onCustomClickCartIcon;\n }\n public set onCustomClickCartIcon(\n value: CustomClickCartIconCallback | undefined\n ) {\n this._onCustomClickCartIcon = value;\n if (Platform.OS === 'ios') {\n ShoppingModule.setCustomClickCartIconEnabled(!!value);\n }\n }\n private _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 product will be shown. Only supported on iOS.\n *\n * The host app can return a ProductInfoViewConfiguration object to configure \"Add to cart\" button style and cart icon style.\n */\n public onWillDisplayProduct?: WillDisplayProductCallback;\n\n /**\n * Defaults to true. 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 ShoppingModule.setCartIconVisible(value);\n }\n private _cartIconVisible: boolean = true;\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(FWEventName.AddToCart, (event) => {\n FWLoggerUtil.log(\n `Receive AddToCart event productId: ${event.productId} unitId: ${event.unitId}`\n );\n this.handleAddToCartEvent(event);\n });\n\n this.eventEmitter.addListener(FWEventName.ClickCartIcon, (event) => {\n FWLoggerUtil.log('Receive ClickCartIcon event');\n this.handleClickCartIconEvent(event);\n });\n\n this.eventEmitter.addListener(FWEventName.UpdateProductDetails, (event) => {\n FWLoggerUtil.log(\n `Receive UpdateProductDetails event productIds: ${event.productIds}`\n );\n this.handleUpdateProductDetailsEvent(event);\n });\n\n this.eventEmitter.addListener(FWEventName.WillDisplayProduct, (event) => {\n FWLoggerUtil.log(\n `Receive WillDisplayProduct event videoId: ${event.videoId}`\n );\n this.handleWillDisplayProductEvent(event);\n });\n this.eventEmitter.addListener(FWEventName.LogMessage, () => {});\n }\n\n /**\n *\n * @param {number} count The number of items in the host app cart\n */\n public setCartItemCount(count: number) {\n ShoppingModule.setCartItemCount(count);\n }\n\n private async handleAddToCartEvent(event: AddToCartEvent & CallbackInfo) {\n const callbackId = event.callbackId;\n delete event.callbackId;\n if (this.onAddToCart) {\n const result = await this.onAddToCart(event as AddToCartEvent);\n if (result) {\n if (callbackId) {\n ShoppingModule.updateAddToCartStatus(\n result.res,\n result.tips,\n callbackId\n );\n }\n } else {\n if (callbackId) {\n if (Platform.OS === 'ios') {\n ShoppingModule.clearCallbackId(callbackId, FWEventName.AddToCart);\n }\n }\n }\n } else {\n if (callbackId) {\n if (Platform.OS === 'ios') {\n ShoppingModule.clearCallbackId(callbackId, FWEventName.AddToCart);\n }\n }\n }\n }\n\n private async handleClickCartIconEvent(event: CallbackInfo) {\n if (this.onCustomClickCartIcon) {\n this.onCustomClickCartIcon();\n } else if (this.onClickCartIcon) {\n const callbackId = event.callbackId;\n delete event.callbackId;\n const props = await this.onClickCartIcon();\n if (callbackId) {\n ShoppingModule.jumpToCartPage(callbackId, props ?? {});\n }\n }\n }\n\n private async handleUpdateProductDetailsEvent(\n event: UpdateProductDetailsEvent & CallbackInfo\n ) {\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 handleWillDisplayProductEvent(\n event: WillDisplayProductEvent & CallbackInfo\n ) {\n if (this.onWillDisplayProduct) {\n const callbackId = event.callbackId;\n delete event.callbackId;\n const config = await this.onWillDisplayProduct(\n event as WillDisplayProductEvent\n );\n if (config && callbackId) {\n ShoppingModule.updateProductViewConfig(config, callbackId);\n }\n }\n }\n}\n\nexport default VideoShopping;\n"]}
1
+ {"version":3,"sources":["VideoShopping.ts"],"names":["Platform","FWEventName","ShoppingModule","ShoppingModuleEventEmitter","FWLoggerUtil","VideoShopping","onCustomClickCartIcon","_onCustomClickCartIcon","value","OS","setCustomClickCartIconEnabled","cartIconVisible","_cartIconVisible","setCartIconVisible","eventEmitter","getInstance","log","_instance","constructor","addListener","AddToCart","event","productId","unitId","handleAddToCartEvent","ClickCartIcon","handleClickCartIconEvent","UpdateProductDetails","productIds","handleUpdateProductDetailsEvent","WillDisplayProduct","videoId","handleWillDisplayProductEvent","LogMessage","setCartItemCount","count","callbackId","onAddToCart","result","updateAddToCartStatus","res","tips","clearCallbackId","onClickCartIcon","props","jumpToCartPage","onUpdateProductDetails","productList","map","product","length","updateVideoProducts","onWillDisplayProduct","config","updateProductViewConfig"],"mappings":";;AAAA,SAA6BA,QAA7B,QAA6C,cAA7C;AAQA,SAASC,WAAT,QAA4B,sBAA5B;AAGA,OAAOC,cAAP,IACEC,0BADF,QAEO,0BAFP;AAIA,OAAOC,YAAP,MAAyB,sBAAzB;;AAsBA;AACA;AACA;AACA,MA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,CACG,+DAA8DY,UAAW,uBACxE,CAACmB,WAAW,IAAI,EAAhB,EAAoBG,MACrB,EAHH;;AAMA,UAAIH,WAAJ,EAAiB;AACf,YAAIX,UAAJ,EAAgB;AACdlC,UAAAA,cAAc,CAACiD,mBAAf,CAAmCJ,WAAnC,EAAgDX,UAAhD;AACD;AACF,OAJD,MAIO;AACL,YAAIA,UAAJ,EAAgB;AACd,cAAIpC,QAAQ,CAACS,EAAT,KAAgB,KAApB,EAA2B;AACzBP,YAAAA,cAAc,CAACwC,eAAf,CACEN,UADF,EAEEnC,WAAW,CAAC0B,oBAFd;AAID;AACF;AACF;AACF,KAhCD,MAgCO;AACLvB,MAAAA,YAAY,CAACY,GAAb,CAAiB,6CAAjB;;AACA,UAAIoB,UAAJ,EAAgB;AACd,YAAIpC,QAAQ,CAACS,EAAT,KAAgB,KAApB,EAA2B;AACzBP,UAAAA,cAAc,CAACwC,eAAf,CACEN,UADF,EAEEnC,WAAW,CAAC0B,oBAFd;AAID;AACF;AACF;AACF;;AAE0C,QAA7BK,6BAA6B,CACzCX,KADyC,EAEzC;AACA,QAAI,KAAK+B,oBAAT,EAA+B;AAC7B,YAAMhB,UAAU,GAAGf,KAAK,CAACe,UAAzB;AACA,aAAOf,KAAK,CAACe,UAAb;AACA,YAAMiB,MAAM,GAAG,MAAM,KAAKD,oBAAL,CACnB/B,KADmB,CAArB;;AAGA,UAAIgC,MAAM,IAAIjB,UAAd,EAA0B;AACxBlC,QAAAA,cAAc,CAACoD,uBAAf,CAAuCD,MAAvC,EAA+CjB,UAA/C;AACD;AACF;AACF;;AA7NiB;;gBAAd/B,a;;AAgON,eAAeA,aAAf","sourcesContent":["import { NativeEventEmitter, Platform } from 'react-native';\n\nimport type AddToCartResult from './models/AddToCartResult';\nimport type {\n AddToCartEvent,\n UpdateProductDetailsEvent,\n WillDisplayProductEvent,\n} from './models/FWEvents';\nimport { FWEventName } from './models/FWEventName';\nimport type Product from './models/Product';\nimport type ProductInfoViewConfiguration from './models/ProductInfoViewConfiguration';\nimport ShoppingModule, {\n ShoppingModuleEventEmitter,\n} from './modules/ShoppingModule';\nimport type { NewNativeContainerProps } from './models/NewNativeContainerProps';\nimport FWLoggerUtil from './utils/FWLoggerUtil';\n\nexport type AddToCartCallback = (\n event: AddToCartEvent\n) => Promise<AddToCartResult | undefined | null>;\n\nexport type ClickCartIconCallback = () => Promise<\n NewNativeContainerProps | undefined | null\n>;\n\nexport type CustomClickCartIconCallback = () => Promise<void>;\n\nexport type UpdateProductDetailsCallback = (\n event: UpdateProductDetailsEvent\n) => Promise<Product[] | undefined | null>;\n\nexport type WillDisplayProductCallback = (\n event: WillDisplayProductEvent\n) => Promise<ProductInfoViewConfiguration | undefined | null>;\n\ntype CallbackInfo = { callbackId?: number | string };\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\" button.\n *\n * The host apps can return an AddToCartResult object to tell FireworkSDK the result of adding to cart.\n * If the host apps want to customize the processing logic of clicking \"Add to cart\" button, they could return null or undefined in the callback.\n */\n public onAddToCart?: AddToCartCallback;\n\n /**\n * This callback is triggered when the user clicks the shopping cart icon.\n *\n * The host app can return NewNativeContainerProps object and we will push a new native container with the props.\n */\n public onClickCartIcon?: ClickCartIconCallback;\n\n /**\n * This callback is triggered when the user clicks the shopping cart icon.\n *\n * The host app can customize the processing logic of clicking the shopping cart icon by setting the callback.\n */\n public get onCustomClickCartIcon(): CustomClickCartIconCallback | undefined {\n return this._onCustomClickCartIcon;\n }\n public set onCustomClickCartIcon(\n value: CustomClickCartIconCallback | undefined\n ) {\n this._onCustomClickCartIcon = value;\n if (Platform.OS === 'ios') {\n ShoppingModule.setCustomClickCartIconEnabled(!!value);\n }\n }\n private _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 product will be shown. Only supported on iOS.\n *\n * The host app can return a ProductInfoViewConfiguration object to configure \"Add to cart\" button style and cart icon style.\n */\n public onWillDisplayProduct?: WillDisplayProductCallback;\n\n /**\n * Defaults to true. 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 ShoppingModule.setCartIconVisible(value);\n }\n private _cartIconVisible: boolean = true;\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(FWEventName.AddToCart, (event) => {\n FWLoggerUtil.log(\n `Receive AddToCart event productId: ${event.productId} unitId: ${event.unitId}`\n );\n this.handleAddToCartEvent(event);\n });\n\n this.eventEmitter.addListener(FWEventName.ClickCartIcon, (event) => {\n FWLoggerUtil.log('Receive ClickCartIcon event');\n this.handleClickCartIconEvent(event);\n });\n\n this.eventEmitter.addListener(FWEventName.UpdateProductDetails, (event) => {\n FWLoggerUtil.log(\n `Receive UpdateProductDetails event productIds: ${event.productIds}`\n );\n this.handleUpdateProductDetailsEvent(event);\n });\n\n this.eventEmitter.addListener(FWEventName.WillDisplayProduct, (event) => {\n FWLoggerUtil.log(\n `Receive WillDisplayProduct event videoId: ${event.videoId}`\n );\n this.handleWillDisplayProductEvent(event);\n });\n this.eventEmitter.addListener(FWEventName.LogMessage, () => {});\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 setCartItemCount(count: number) {\n ShoppingModule.setCartItemCount(count);\n }\n\n private async handleAddToCartEvent(event: AddToCartEvent & CallbackInfo) {\n const callbackId = event.callbackId;\n delete event.callbackId;\n if (this.onAddToCart) {\n const result = await this.onAddToCart(event as AddToCartEvent);\n if (result) {\n if (callbackId) {\n ShoppingModule.updateAddToCartStatus(\n result.res,\n result.tips,\n callbackId\n );\n }\n } else {\n if (callbackId) {\n if (Platform.OS === 'ios') {\n ShoppingModule.clearCallbackId(callbackId, FWEventName.AddToCart);\n }\n }\n }\n } else {\n if (callbackId) {\n if (Platform.OS === 'ios') {\n ShoppingModule.clearCallbackId(callbackId, FWEventName.AddToCart);\n }\n }\n }\n }\n\n private async handleClickCartIconEvent(event: CallbackInfo) {\n if (this.onCustomClickCartIcon) {\n this.onCustomClickCartIcon();\n } else if (this.onClickCartIcon) {\n const callbackId = event.callbackId;\n delete event.callbackId;\n const props = await this.onClickCartIcon();\n if (callbackId) {\n ShoppingModule.jumpToCartPage(callbackId, props ?? {});\n }\n }\n }\n\n private async handleUpdateProductDetailsEvent(\n event: UpdateProductDetailsEvent & CallbackInfo\n ) {\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 handleWillDisplayProductEvent(\n event: WillDisplayProductEvent & CallbackInfo\n ) {\n if (this.onWillDisplayProduct) {\n const callbackId = event.callbackId;\n delete event.callbackId;\n const config = await this.onWillDisplayProduct(\n event as WillDisplayProductEvent\n );\n if (config && callbackId) {\n ShoppingModule.updateProductViewConfig(config, callbackId);\n }\n }\n }\n}\n\nexport default VideoShopping;\n"]}
@@ -82,7 +82,7 @@ export default class VideoFeed extends React.Component {
82
82
  }
83
83
 
84
84
  render() {
85
- var _videoFeedConfigurati, _videoFeedConfigurati2, _videoFeedConfigurati3, _videoFeedConfigurati4, _FireworkSDK$getInsta, _FireworkSDK$getInsta2, _adBadgeConfiguration, _adBadgeConfiguration2, _adBadgeConfiguration3, _videoFeedConfigurati5, _videoFeedConfigurati6, _videoFeedConfigurati7, _adConfiguration$requ, _adConfiguration$adsF;
85
+ var _videoFeedConfigurati, _videoFeedConfigurati2, _videoFeedConfigurati3, _videoFeedConfigurati4, _FireworkSDK$getInsta, _FireworkSDK$getInsta2, _adBadgeConfiguration, _adBadgeConfiguration2, _adBadgeConfiguration3, _videoFeedConfigurati5, _videoFeedConfigurati6, _videoFeedConfigurati7, _adConfiguration$requ, _adConfiguration$adsF, _videoFeedConfigurati8;
86
86
 
87
87
  FWLoggerUtil.log(`VideoFeed render ${JSON.stringify(this.props)}`);
88
88
  const {
@@ -115,6 +115,7 @@ export default class VideoFeed extends React.Component {
115
115
 
116
116
  const vastAttributesString = this._generateVastAttributesString();
117
117
 
118
+ const showAdBadge = (_videoFeedConfigurati8 = videoFeedConfiguration === null || videoFeedConfiguration === void 0 ? void 0 : videoFeedConfiguration.showAdBadge) !== null && _videoFeedConfigurati8 !== void 0 ? _videoFeedConfigurati8 : false;
118
119
  let key = `source:${source}`;
119
120
  key += `_channel:${channel}`;
120
121
  key += `_playlist:${playlist}`;
@@ -134,6 +135,7 @@ export default class VideoFeed extends React.Component {
134
135
  key += `_requiresAds:${requiresAds}`;
135
136
  key += `_adsFetchTimeout:${adsFetchTimeout}`;
136
137
  key += `_vastAttributes:${vastAttributesString}`;
138
+ key += `_showAdBadge:${showAdBadge}`;
137
139
  return /*#__PURE__*/React.createElement(FWVideoFeed, _extends({
138
140
  key: key
139
141
  }, this.props, {
@@ -1 +1 @@
1
- {"version":3,"sources":["VideoFeed.tsx"],"names":["React","findNodeHandle","Platform","UIManager","FireworkSDK","FWEventName","FireworkSDKModuleEventEmitter","FWLoggerUtil","FWVideoFeed","NativeComponentName","VideoFeed","Component","createRef","log","JSON","stringify","props","nativeNodeHandle","nativeComponentRef","current","commandId","getViewManagerConfig","Commands","refresh","OS","toString","dispatchViewManagerCommand","event","nativeEvent","onVideoFeedLoadFinished","name","reason","componentDidMount","subscriptionOfShareBaseURLUpdated","addListener","ShareBaseURLUpdated","setState","subscriptions","push","subscriptionOfAdBadgeConfigurationUpdated","AdBadgeConfigurationUpdated","componentWillUnmount","forEach","value","remove","render","source","channel","playlist","playlistGroup","mode","adConfiguration","videoFeedConfiguration","_getVideoFeedConfiguration","titleHidden","title","hidden","titlePosition","customLayoutName","shareBaseURL","getInstance","adBadgeConfiguration","adBadgeTextType","badgeTextType","backgroundColorOfAdBadge","backgroundColor","textColorOfAdBadge","textColor","dynamicContentParametersString","_generateDynamicContentParametersString","enableAutoplay","enablePictureInPicture","gridColumns","requiresAds","adsFetchTimeout","vastAttributesString","_generateVastAttributesString","key","_onVideoFeedLoadFinished","Object","assign","style","zIndex","dynamicContentParameters","resultString","sortedKeyList","keys","sort","valueString","join","length","vastAttributes","attribute","Math","floor"],"mappings":";;;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AAEA,SAEEC,cAFF,EAIEC,QAJF,EAMEC,SANF,QAQO,cARP;AAUA,OAAOC,WAAP,MAAwB,gBAAxB;AAEA,SAASC,WAAT,QAA4B,uBAA5B;AAKA,SAASC,6BAAT,QAA8C,8BAA9C;AACA,OAAOC,YAAP,MAAyB,uBAAzB;AACA,OAAOC,WAAP,MAAwB,eAAx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AAY,IAAK,GAAD,mBAAGQ,SAAS,CAAC9D,IAAb,6DAAqB,EAAG,IAAG8D,SAAS,CAACjD,KAAM,EAA3D;AACD;;AAED,WAAOyC,YAAP;AACD;;AAEO/B,EAAAA,0BAA0B,GAAuC;AACvE,UAAM;AAAED,MAAAA;AAAF,QAA6B,KAAKpC,KAAxC;;AACA,QAAI,CAACoC,sBAAL,EAA6B;AAC3B,aAAOA,sBAAP;AACD;;AAED,QACEA,sBAAsB,CAACoB,WAAvB,IACAqB,IAAI,CAACC,KAAL,CAAW1C,sBAAsB,CAACoB,WAAlC,MACEpB,sBAAsB,CAACoB,WAH3B,EAIE;AACA,aAAO,EACL,GAAGpB,sBADE;AAELoB,QAAAA,WAAW,EAAEqB,IAAI,CAACC,KAAL,CAAW1C,sBAAsB,CAACoB,WAAlC;AAFR,OAAP;AAID,KATD,MASO;AACL,aAAOpB,sBAAP;AACD;AACF;;AAjNqE;;gBAAnD1C,S,kBACG;AACpBwC,EAAAA,IAAI,EAAE;AADc,C","sourcesContent":["import React from 'react';\n\nimport {\n EmitterSubscription,\n findNodeHandle,\n NativeSyntheticEvent,\n Platform,\n StyleProp,\n UIManager,\n ViewStyle,\n} from 'react-native';\n\nimport FireworkSDK from '../FireworkSDK';\nimport type FWError from '../models/FWError';\nimport { FWEventName } from '../models/FWEventName';\nimport type AdConfiguration from '../models/AdConfiguration';\nimport type VideoFeedConfiguration from '../models/VideoFeedConfiguration';\nimport type { VideoFeedSource } from '../models/VideoFeedSource';\nimport type VideoPlayerConfiguration from '../models/VideoPlayerConfiguration';\nimport { FireworkSDKModuleEventEmitter } from '../modules/FireworkSDKModule';\nimport FWLoggerUtil from '../utils/FWLoggerUtil';\nimport FWVideoFeed from './FWVideoFeed';\n\nexport type VideoFeedMode = 'row' | 'column' | 'grid';\n\nexport interface IVideoFeedProps {\n /**\n * Standard React Native View Style.\n */\n style?: StyleProp<ViewStyle>;\n /**\n * One of five available video feed sources.\n */\n source: VideoFeedSource;\n /**\n * Channel id of the feed. Required when the source is set as channel or playlist or dynamicContent.\n */\n channel?: string;\n /**\n * Playlist id of the feed. Please note channel id is necessary. Required when the source is set as playlist.\n */\n playlist?: string;\n /**\n * PlaylistGroup id of the feed. Required when the source is set as playlistGroup.\n */\n playlistGroup?: string;\n /**\n * The dynamic content parameters of the feed. Required when the source is set as dynamicContent.\n */\n dynamicContentParameters?: { [key: string]: string[] };\n /**\n * One of three available display modes. Defaults to row.\n */\n mode?: VideoFeedMode;\n /**\n * Configuration of the feed.\n */\n videoFeedConfiguration?: VideoFeedConfiguration;\n /**\n * Configuration of the player.\n */\n videoPlayerConfiguration?: VideoPlayerConfiguration;\n /**\n * Ad configuration of the feed. Only supported on iOS.\n */\n adConfiguration?: AdConfiguration;\n /**\n * The feed loading result callback. It means loading successfully when error equals to undefined.\n */\n onVideoFeedLoadFinished?: (error?: FWError) => void;\n}\n\nconst NativeComponentName = 'FWVideoFeed';\n\nexport default class VideoFeed extends React.Component<IVideoFeedProps> {\n static defaultProps = {\n mode: 'row',\n };\n\n nativeComponentRef = React.createRef<any>();\n\n subscriptions: EmitterSubscription[] = [];\n\n /**\n * Force refreshing the video feed.\n */\n public refresh = () => {\n FWLoggerUtil.log(`VideoFeed refresh ${JSON.stringify(this.props)}`);\n\n const nativeNodeHandle = findNodeHandle(this.nativeComponentRef.current);\n\n let commandId: string | number =\n UIManager.getViewManagerConfig(NativeComponentName).Commands.refresh;\n if (Platform.OS === 'android') {\n commandId = commandId.toString();\n }\n\n UIManager.dispatchViewManagerCommand(\n findNodeHandle(nativeNodeHandle),\n commandId,\n []\n );\n };\n\n private _onVideoFeedLoadFinished = (event: NativeSyntheticEvent<any>) => {\n FWLoggerUtil.log(\n `VideoFeed _onVideoFeedLoadFinished ${JSON.stringify(event.nativeEvent)}`\n );\n const { onVideoFeedLoadFinished } = this.props;\n\n const { name, reason } = event.nativeEvent;\n\n if (onVideoFeedLoadFinished) {\n if (name) {\n if (reason) {\n onVideoFeedLoadFinished({ name, reason });\n } else {\n onVideoFeedLoadFinished({ name });\n }\n } else {\n onVideoFeedLoadFinished();\n }\n }\n };\n\n componentDidMount() {\n FWLoggerUtil.log(\n `VideoFeed componentDidMount ${JSON.stringify(this.props)}`\n );\n\n const subscriptionOfShareBaseURLUpdated =\n FireworkSDKModuleEventEmitter.addListener(\n FWEventName.ShareBaseURLUpdated,\n () => {\n FWLoggerUtil.log('Receive FWEventName.ShareBaseURLUpdated');\n this.setState({});\n }\n );\n this.subscriptions.push(subscriptionOfShareBaseURLUpdated);\n\n const subscriptionOfAdBadgeConfigurationUpdated =\n FireworkSDKModuleEventEmitter.addListener(\n FWEventName.AdBadgeConfigurationUpdated,\n () => {\n FWLoggerUtil.log('Receive FWEventName.AdBadgeConfigurationUpdated');\n this.setState({});\n }\n );\n this.subscriptions.push(subscriptionOfAdBadgeConfigurationUpdated);\n }\n\n componentWillUnmount() {\n FWLoggerUtil.log(\n `VideoFeed componentWillUnmount ${JSON.stringify(this.props)}`\n );\n\n this.subscriptions.forEach((value) => {\n value.remove();\n });\n\n this.subscriptions = [];\n }\n\n render() {\n FWLoggerUtil.log(`VideoFeed render ${JSON.stringify(this.props)}`);\n\n const {\n source,\n channel = '',\n playlist = '',\n playlistGroup = '',\n mode = 'row',\n adConfiguration,\n } = this.props;\n const videoFeedConfiguration = this._getVideoFeedConfiguration();\n const titleHidden = videoFeedConfiguration?.title?.hidden ?? false;\n const titlePosition = videoFeedConfiguration?.titlePosition ?? 'nested';\n const customLayoutName = videoFeedConfiguration?.customLayoutName ?? '';\n const shareBaseURL = FireworkSDK.getInstance().shareBaseURL ?? '';\n const adBadgeConfiguration =\n FireworkSDK.getInstance().adBadgeConfiguration ?? {};\n const adBadgeTextType = adBadgeConfiguration.badgeTextType ?? '';\n const backgroundColorOfAdBadge = adBadgeConfiguration.backgroundColor ?? '';\n const textColorOfAdBadge = adBadgeConfiguration.textColor ?? '';\n const dynamicContentParametersString =\n this._generateDynamicContentParametersString();\n const enableAutoplay = videoFeedConfiguration?.enableAutoplay ?? false;\n const enablePictureInPicture =\n videoFeedConfiguration?.enablePictureInPicture ?? false;\n const gridColumns = videoFeedConfiguration?.gridColumns ?? 2;\n const requiresAds = adConfiguration?.requiresAds ?? false;\n const adsFetchTimeout = adConfiguration?.adsFetchTimeout ?? 10;\n const vastAttributesString = this._generateVastAttributesString();\n\n let key = `source:${source}`;\n key += `_channel:${channel}`;\n key += `_playlist:${playlist}`;\n key += `_playlistGroup:${playlistGroup}`;\n key += `_mode:${mode}`;\n key += `_titleHidden:${titleHidden}`;\n key += `_titlePosition:${titlePosition}`;\n key += `_customLayoutName:${customLayoutName}`;\n key += `_shareBaseURL:${shareBaseURL}`;\n key += `_adBadgeTextType:${adBadgeTextType}`;\n key += `_backgroundColorOfAdBadge:${backgroundColorOfAdBadge}`;\n key += `_textColorOfAdBadge:${textColorOfAdBadge}`;\n key += `_dynamicContentParameters:${dynamicContentParametersString}`;\n key += `_enableAutoplay:${enableAutoplay}`;\n key += `_enablePictureInPicture:${enablePictureInPicture}`;\n key += `_gridColumns:${gridColumns}`;\n key += `_requiresAds:${requiresAds}`;\n key += `_adsFetchTimeout:${adsFetchTimeout}`;\n key += `_vastAttributes:${vastAttributesString}`;\n\n return (\n <FWVideoFeed\n key={key}\n {...this.props}\n ref={this.nativeComponentRef}\n onVideoFeedLoadFinished={this._onVideoFeedLoadFinished}\n mode={mode}\n style={Object.assign({}, this.props.style, { zIndex: -1 })}\n />\n );\n }\n\n private _generateDynamicContentParametersString(): string {\n const { dynamicContentParameters } = this.props;\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 private _generateVastAttributesString(): string {\n const { adConfiguration } = this.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 private _getVideoFeedConfiguration(): VideoFeedConfiguration | undefined {\n const { videoFeedConfiguration } = this.props;\n if (!videoFeedConfiguration) {\n return videoFeedConfiguration;\n }\n\n if (\n videoFeedConfiguration.gridColumns &&\n Math.floor(videoFeedConfiguration.gridColumns!) !==\n videoFeedConfiguration.gridColumns\n ) {\n return {\n ...videoFeedConfiguration,\n gridColumns: Math.floor(videoFeedConfiguration.gridColumns!),\n };\n } else {\n return videoFeedConfiguration;\n }\n }\n}\n"]}
1
+ {"version":3,"sources":["VideoFeed.tsx"],"names":["React","findNodeHandle","Platform","UIManager","FireworkSDK","FWEventName","FireworkSDKModuleEventEmitter","FWLoggerUtil","FWVideoFeed","NativeComponentName","VideoFeed","Component","createRef","log","JSON","stringify","props","nativeNodeHandle","nativeComponentRef","current","commandId","getViewManagerConfig","Commands","refresh","OS","toString","dispatchViewManagerCommand","event","nativeEvent","onVideoFeedLoadFinished","name","reason","componentDidMount","subscriptionOfShareBaseURLUpdated","addListener","ShareBaseURLUpdated","setState","subscriptions","push","subscriptionOfAdBadgeConfigurationUpdated","AdBadgeConfigurationUpdated","componentWillUnmount","forEach","value","remove","render","source","channel","playlist","playlistGroup","mode","adConfiguration","videoFeedConfiguration","_getVideoFeedConfiguration","titleHidden","title","hidden","titlePosition","customLayoutName","shareBaseURL","getInstance","adBadgeConfiguration","adBadgeTextType","badgeTextType","backgroundColorOfAdBadge","backgroundColor","textColorOfAdBadge","textColor","dynamicContentParametersString","_generateDynamicContentParametersString","enableAutoplay","enablePictureInPicture","gridColumns","requiresAds","adsFetchTimeout","vastAttributesString","_generateVastAttributesString","showAdBadge","key","_onVideoFeedLoadFinished","Object","assign","style","zIndex","dynamicContentParameters","resultString","sortedKeyList","keys","sort","valueString","join","length","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AEOT,EAAAA,6BAA6B,GAAW;AAAA;;AAC9C,UAAM;AAAEzB,MAAAA;AAAF,QAAsB,KAAKnC,KAAjC;AACA,UAAM4E,cAAc,4BAAGzC,eAAH,aAAGA,eAAH,uBAAGA,eAAe,CAAEyC,cAApB,yEAAsC,EAA1D;;AACA,QAAI,CAACA,cAAL,EAAqB;AACnB,aAAO,EAAP;AACD;;AAED,QAAIP,YAAY,GAAG,EAAnB;;AACA,SAAK,MAAMQ,SAAX,IAAwBD,cAAxB,EAAwC;AAAA;;AACtC,UAAIP,YAAY,CAACM,MAAb,GAAsB,CAA1B,EAA6B;AAC3BN,QAAAA,YAAY,IAAI,GAAhB;AACD;;AACDA,MAAAA,YAAY,IAAK,GAAD,mBAAGQ,SAAS,CAAC/D,IAAb,6DAAqB,EAAG,IAAG+D,SAAS,CAAClD,KAAM,EAA3D;AACD;;AAED,WAAO0C,YAAP;AACD;;AAEOhC,EAAAA,0BAA0B,GAAuC;AACvE,UAAM;AAAED,MAAAA;AAAF,QAA6B,KAAKpC,KAAxC;;AACA,QAAI,CAACoC,sBAAL,EAA6B;AAC3B,aAAOA,sBAAP;AACD;;AAED,QACEA,sBAAsB,CAACoB,WAAvB,IACAsB,IAAI,CAACC,KAAL,CAAW3C,sBAAsB,CAACoB,WAAlC,MACEpB,sBAAsB,CAACoB,WAH3B,EAIE;AACA,aAAO,EACL,GAAGpB,sBADE;AAELoB,QAAAA,WAAW,EAAEsB,IAAI,CAACC,KAAL,CAAW3C,sBAAsB,CAACoB,WAAlC;AAFR,OAAP;AAID,KATD,MASO;AACL,aAAOpB,sBAAP;AACD;AACF;;AAnNqE;;gBAAnD1C,S,kBACG;AACpBwC,EAAAA,IAAI,EAAE;AADc,C","sourcesContent":["import React from 'react';\n\nimport {\n EmitterSubscription,\n findNodeHandle,\n NativeSyntheticEvent,\n Platform,\n StyleProp,\n UIManager,\n ViewStyle,\n} from 'react-native';\n\nimport FireworkSDK from '../FireworkSDK';\nimport type FWError from '../models/FWError';\nimport { FWEventName } from '../models/FWEventName';\nimport type AdConfiguration from '../models/AdConfiguration';\nimport type VideoFeedConfiguration from '../models/VideoFeedConfiguration';\nimport type { VideoFeedSource } from '../models/VideoFeedSource';\nimport type VideoPlayerConfiguration from '../models/VideoPlayerConfiguration';\nimport { FireworkSDKModuleEventEmitter } from '../modules/FireworkSDKModule';\nimport FWLoggerUtil from '../utils/FWLoggerUtil';\nimport FWVideoFeed from './FWVideoFeed';\n\nexport type VideoFeedMode = 'row' | 'column' | 'grid';\n\nexport interface IVideoFeedProps {\n /**\n * Standard React Native View Style.\n */\n style?: StyleProp<ViewStyle>;\n /**\n * One of five available video feed sources.\n */\n source: VideoFeedSource;\n /**\n * Channel id of the feed. Required when the source is set as channel or playlist or dynamicContent.\n */\n channel?: string;\n /**\n * Playlist id of the feed. Please note channel id is necessary. Required when the source is set as playlist.\n */\n playlist?: string;\n /**\n * PlaylistGroup id of the feed. Required when the source is set as playlistGroup.\n */\n playlistGroup?: string;\n /**\n * The dynamic content parameters of the feed. Required when the source is set as dynamicContent.\n */\n dynamicContentParameters?: { [key: string]: string[] };\n /**\n * One of three available display modes. Defaults to row.\n */\n mode?: VideoFeedMode;\n /**\n * Configuration of the feed.\n */\n videoFeedConfiguration?: VideoFeedConfiguration;\n /**\n * Configuration of the player.\n */\n videoPlayerConfiguration?: VideoPlayerConfiguration;\n /**\n * Ad configuration of the feed. Only supported on iOS.\n */\n adConfiguration?: AdConfiguration;\n /**\n * The feed loading result callback. It means loading successfully when error equals to undefined.\n */\n onVideoFeedLoadFinished?: (error?: FWError) => void;\n}\n\nconst NativeComponentName = 'FWVideoFeed';\n\nexport default class VideoFeed extends React.Component<IVideoFeedProps> {\n static defaultProps = {\n mode: 'row',\n };\n\n nativeComponentRef = React.createRef<any>();\n\n subscriptions: EmitterSubscription[] = [];\n\n /**\n * Force refreshing the video feed.\n */\n public refresh = () => {\n FWLoggerUtil.log(`VideoFeed refresh ${JSON.stringify(this.props)}`);\n\n const nativeNodeHandle = findNodeHandle(this.nativeComponentRef.current);\n\n let commandId: string | number =\n UIManager.getViewManagerConfig(NativeComponentName).Commands.refresh;\n if (Platform.OS === 'android') {\n commandId = commandId.toString();\n }\n\n UIManager.dispatchViewManagerCommand(\n findNodeHandle(nativeNodeHandle),\n commandId,\n []\n );\n };\n\n private _onVideoFeedLoadFinished = (event: NativeSyntheticEvent<any>) => {\n FWLoggerUtil.log(\n `VideoFeed _onVideoFeedLoadFinished ${JSON.stringify(event.nativeEvent)}`\n );\n const { onVideoFeedLoadFinished } = this.props;\n\n const { name, reason } = event.nativeEvent;\n\n if (onVideoFeedLoadFinished) {\n if (name) {\n if (reason) {\n onVideoFeedLoadFinished({ name, reason });\n } else {\n onVideoFeedLoadFinished({ name });\n }\n } else {\n onVideoFeedLoadFinished();\n }\n }\n };\n\n componentDidMount() {\n FWLoggerUtil.log(\n `VideoFeed componentDidMount ${JSON.stringify(this.props)}`\n );\n\n const subscriptionOfShareBaseURLUpdated =\n FireworkSDKModuleEventEmitter.addListener(\n FWEventName.ShareBaseURLUpdated,\n () => {\n FWLoggerUtil.log('Receive FWEventName.ShareBaseURLUpdated');\n this.setState({});\n }\n );\n this.subscriptions.push(subscriptionOfShareBaseURLUpdated);\n\n const subscriptionOfAdBadgeConfigurationUpdated =\n FireworkSDKModuleEventEmitter.addListener(\n FWEventName.AdBadgeConfigurationUpdated,\n () => {\n FWLoggerUtil.log('Receive FWEventName.AdBadgeConfigurationUpdated');\n this.setState({});\n }\n );\n this.subscriptions.push(subscriptionOfAdBadgeConfigurationUpdated);\n }\n\n componentWillUnmount() {\n FWLoggerUtil.log(\n `VideoFeed componentWillUnmount ${JSON.stringify(this.props)}`\n );\n\n this.subscriptions.forEach((value) => {\n value.remove();\n });\n\n this.subscriptions = [];\n }\n\n render() {\n FWLoggerUtil.log(`VideoFeed render ${JSON.stringify(this.props)}`);\n\n const {\n source,\n channel = '',\n playlist = '',\n playlistGroup = '',\n mode = 'row',\n adConfiguration,\n } = this.props;\n const videoFeedConfiguration = this._getVideoFeedConfiguration();\n const titleHidden = videoFeedConfiguration?.title?.hidden ?? false;\n const titlePosition = videoFeedConfiguration?.titlePosition ?? 'nested';\n const customLayoutName = videoFeedConfiguration?.customLayoutName ?? '';\n const shareBaseURL = FireworkSDK.getInstance().shareBaseURL ?? '';\n const adBadgeConfiguration =\n FireworkSDK.getInstance().adBadgeConfiguration ?? {};\n const adBadgeTextType = adBadgeConfiguration.badgeTextType ?? '';\n const backgroundColorOfAdBadge = adBadgeConfiguration.backgroundColor ?? '';\n const textColorOfAdBadge = adBadgeConfiguration.textColor ?? '';\n const dynamicContentParametersString =\n this._generateDynamicContentParametersString();\n const enableAutoplay = videoFeedConfiguration?.enableAutoplay ?? false;\n const enablePictureInPicture =\n videoFeedConfiguration?.enablePictureInPicture ?? false;\n const gridColumns = videoFeedConfiguration?.gridColumns ?? 2;\n const requiresAds = adConfiguration?.requiresAds ?? false;\n const adsFetchTimeout = adConfiguration?.adsFetchTimeout ?? 10;\n const vastAttributesString = this._generateVastAttributesString();\n const showAdBadge = videoFeedConfiguration?.showAdBadge ?? false;\n\n let key = `source:${source}`;\n key += `_channel:${channel}`;\n key += `_playlist:${playlist}`;\n key += `_playlistGroup:${playlistGroup}`;\n key += `_mode:${mode}`;\n key += `_titleHidden:${titleHidden}`;\n key += `_titlePosition:${titlePosition}`;\n key += `_customLayoutName:${customLayoutName}`;\n key += `_shareBaseURL:${shareBaseURL}`;\n key += `_adBadgeTextType:${adBadgeTextType}`;\n key += `_backgroundColorOfAdBadge:${backgroundColorOfAdBadge}`;\n key += `_textColorOfAdBadge:${textColorOfAdBadge}`;\n key += `_dynamicContentParameters:${dynamicContentParametersString}`;\n key += `_enableAutoplay:${enableAutoplay}`;\n key += `_enablePictureInPicture:${enablePictureInPicture}`;\n key += `_gridColumns:${gridColumns}`;\n key += `_requiresAds:${requiresAds}`;\n key += `_adsFetchTimeout:${adsFetchTimeout}`;\n key += `_vastAttributes:${vastAttributesString}`;\n key += `_showAdBadge:${showAdBadge}`;\n\n return (\n <FWVideoFeed\n key={key}\n {...this.props}\n ref={this.nativeComponentRef}\n onVideoFeedLoadFinished={this._onVideoFeedLoadFinished}\n mode={mode}\n style={Object.assign({}, this.props.style, { zIndex: -1 })}\n />\n );\n }\n\n private _generateDynamicContentParametersString(): string {\n const { dynamicContentParameters } = this.props;\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 private _generateVastAttributesString(): string {\n const { adConfiguration } = this.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 private _getVideoFeedConfiguration(): VideoFeedConfiguration | undefined {\n const { videoFeedConfiguration } = this.props;\n if (!videoFeedConfiguration) {\n return videoFeedConfiguration;\n }\n\n if (\n videoFeedConfiguration.gridColumns &&\n Math.floor(videoFeedConfiguration.gridColumns!) !==\n videoFeedConfiguration.gridColumns\n ) {\n return {\n ...videoFeedConfiguration,\n gridColumns: Math.floor(videoFeedConfiguration.gridColumns!),\n };\n } else {\n return videoFeedConfiguration;\n }\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["index.tsx"],"names":["StoryBlock","VideoFeed","FireworkSDK","FWNavigator","LiveStream","LiveStreamChatEventName","LiveStreamEventName","VideoPlaybackEventName","VideoShopping"],"mappings":"AAAA,OAAOA,UAAP,MAAuB,yBAAvB;AAEA,OAAOC,SAAP,MAAsB,wBAAtB;AAQA,OAAOC,WAAP,MAAwB,eAAxB;AACA,OAAOC,WAAP,MAAwB,eAAxB;AAKA,OAAOC,UAAP,MAAuB,cAAvB;AAkBA,OAAOC,uBAAP,MAAoC,kCAApC;AAEA,OAAOC,mBAAP,MAAgC,8BAAhC;AAoBA,OAAOC,sBAAP,MAAmC,iCAAnC;AAeA,OAAOC,aAAP,MAA0B,iBAA1B;AAEA,eAAeN,WAAf;AAEA,SAeEC,WAfF,EAiBEC,UAjBF,EAmBEC,uBAnBF,EAsBEC,mBAtBF,EAkCEN,UAlCF,EAwCEC,SAxCF,EAqDEM,sBArDF,EA2DEC,aA3DF","sourcesContent":["import StoryBlock from './components/StoryBlock';\nimport type { IVideoFeedProps, VideoFeedMode } from './components/VideoFeed';\nimport VideoFeed from './components/VideoFeed';\nimport type {\n CustomCTAClickCallback,\n CustomCTALinkContentRender,\n SDKInitCallback,\n VideoFeedClickCallback,\n VideoPlaybackCallback,\n} from './FireworkSDK';\nimport FireworkSDK from './FireworkSDK';\nimport FWNavigator from './FWNavigator';\nimport type {\n onLiveStreamChatEventCallback,\n onLiveStreamEventCallback,\n} from './LiveStream';\nimport LiveStream from './LiveStream';\nimport type AdBadgeConfiguration from './models/AdBadgeConfiguration';\nimport type { AdBadgeTextType } from './models/AdBadgeConfiguration';\nimport type AdConfiguration from './models/AdConfiguration';\nimport type { VastAttribute } from './models/AdConfiguration';\nimport type AddToCartResult from './models/AddToCartResult';\nimport type FeedItemDetails from './models/FeedItemDetails';\nimport type FWError from './models/FWError';\nimport type {\n AddToCartEvent,\n CustomCTAClickEvent,\n LiveStreamChatEvent,\n LiveStreamEvent,\n SDKInitEvent,\n UpdateProductDetailsEvent,\n VideoPlaybackEvent,\n WillDisplayProductEvent,\n} from './models/FWEvents';\nimport LiveStreamChatEventName from './models/LiveStreamChatEventName';\nimport type LiveStreamEventDetails from './models/LiveStreamEventDetails';\nimport LiveStreamEventName from './models/LiveStreamEventName';\nimport type LiveStreamMessageDetails from './models/LiveStreamMessageDetails';\nimport type { NewNativeContainerProps } from './models/NewNativeContainerProps';\nimport type Product from './models/Product';\nimport type ProductInfoViewConfiguration from './models/ProductInfoViewConfiguration';\nimport type { AddToCartButtonConfiguration } from './models/ProductInfoViewConfiguration';\nimport type ProductUnit from './models/ProductUnit';\nimport type { ProductPrice, ProductUnitOption } from './models/ProductUnit';\nimport type { StoryBlockSource } from './models/StoryBlockSource';\nimport type TrackPurchaseParameters from './models/TrackPurchaseParameters';\nimport type VideoFeedConfiguration from './models/VideoFeedConfiguration';\nimport type {\n VideoFeedContentPadding,\n VideoFeedPlayIconConfiguration,\n VideoFeedTitleConfiguration,\n VideoFeedTitlePosition,\n} from './models/VideoFeedConfiguration';\nimport type { VideoFeedSource } from './models/VideoFeedSource';\nimport type VideoPlaybackDetails from './models/VideoPlaybackDetails';\nimport type { VideoPlayerSize } from './models/VideoPlaybackDetails';\nimport VideoPlaybackEventName from './models/VideoPlaybackEventName';\nimport type VideoPlayerConfiguration from './models/VideoPlayerConfiguration';\nimport type {\n VideoLaunchBehavior,\n VideoPlayerCompleteAction,\n VideoPlayerCTAStyle,\n VideoPlayerStyle,\n} from './models/VideoPlayerConfiguration';\nimport type {\n AddToCartCallback,\n ClickCartIconCallback,\n CustomClickCartIconCallback,\n UpdateProductDetailsCallback,\n WillDisplayProductCallback,\n} from './VideoShopping';\nimport VideoShopping from './VideoShopping';\n\nexport default FireworkSDK;\n\nexport {\n AdBadgeConfiguration,\n AdBadgeTextType,\n AdConfiguration,\n AddToCartButtonConfiguration,\n AddToCartCallback,\n AddToCartEvent,\n AddToCartResult,\n ClickCartIconCallback,\n CustomClickCartIconCallback,\n CustomCTAClickCallback,\n CustomCTAClickEvent,\n CustomCTALinkContentRender,\n FeedItemDetails,\n FWError,\n FWNavigator,\n IVideoFeedProps,\n LiveStream,\n LiveStreamChatEvent,\n LiveStreamChatEventName,\n LiveStreamEvent,\n LiveStreamEventDetails,\n LiveStreamEventName,\n LiveStreamMessageDetails,\n NewNativeContainerProps,\n onLiveStreamChatEventCallback,\n onLiveStreamEventCallback,\n Product,\n ProductInfoViewConfiguration,\n ProductPrice,\n ProductUnit,\n ProductUnitOption,\n SDKInitCallback,\n SDKInitEvent,\n StoryBlock,\n StoryBlockSource,\n TrackPurchaseParameters,\n UpdateProductDetailsCallback,\n UpdateProductDetailsEvent,\n VastAttribute,\n VideoFeed,\n VideoFeedClickCallback,\n VideoFeedConfiguration,\n VideoFeedContentPadding,\n VideoFeedMode,\n VideoFeedPlayIconConfiguration,\n VideoFeedSource,\n VideoFeedTitleConfiguration,\n VideoFeedTitlePosition,\n VideoLaunchBehavior,\n VideoPlaybackCallback,\n VideoPlaybackDetails,\n VideoPlaybackEvent,\n VideoPlaybackEventName,\n VideoPlayerCompleteAction,\n VideoPlayerConfiguration,\n VideoPlayerCTAStyle,\n VideoPlayerSize,\n VideoPlayerStyle,\n VideoShopping,\n WillDisplayProductCallback,\n WillDisplayProductEvent,\n};\n"]}
1
+ {"version":3,"sources":["index.tsx"],"names":["StoryBlock","VideoFeed","FireworkSDK","FWNavigator","LiveStream","LiveStreamChatEventName","LiveStreamEventName","VideoPlaybackEventName","VideoShopping"],"mappings":"AAAA,OAAOA,UAAP,MAAuB,yBAAvB;AAEA,OAAOC,SAAP,MAAsB,wBAAtB;AAOA,OAAOC,WAAP,MAAwB,eAAxB;AACA,OAAOC,WAAP,MAAwB,eAAxB;AAKA,OAAOC,UAAP,MAAuB,cAAvB;AAkBA,OAAOC,uBAAP,MAAoC,kCAApC;AAEA,OAAOC,mBAAP,MAAgC,8BAAhC;AAoBA,OAAOC,sBAAP,MAAmC,iCAAnC;AAiBA,OAAOC,aAAP,MAA0B,iBAA1B;AAEA,eAAeN,WAAf;AAEA,SAcEC,WAdF,EAgBEC,UAhBF,EAkBEC,uBAlBF,EAqBEC,mBArBF,EAiCEN,UAjCF,EAuCEC,SAvCF,EAoDEM,sBApDF,EA4DEC,aA5DF","sourcesContent":["import StoryBlock from './components/StoryBlock';\nimport type { IVideoFeedProps, VideoFeedMode } from './components/VideoFeed';\nimport VideoFeed from './components/VideoFeed';\nimport type {\n CustomCTAClickCallback,\n SDKInitCallback,\n VideoFeedClickCallback,\n VideoPlaybackCallback,\n} from './FireworkSDK';\nimport FireworkSDK from './FireworkSDK';\nimport FWNavigator from './FWNavigator';\nimport type {\n onLiveStreamChatEventCallback,\n onLiveStreamEventCallback,\n} from './LiveStream';\nimport LiveStream from './LiveStream';\nimport type AdBadgeConfiguration from './models/AdBadgeConfiguration';\nimport type { AdBadgeTextType } from './models/AdBadgeConfiguration';\nimport type AdConfiguration from './models/AdConfiguration';\nimport type { VastAttribute } from './models/AdConfiguration';\nimport type AddToCartResult from './models/AddToCartResult';\nimport type FeedItemDetails from './models/FeedItemDetails';\nimport type FWError from './models/FWError';\nimport type {\n AddToCartEvent,\n CustomCTAClickEvent,\n LiveStreamChatEvent,\n LiveStreamEvent,\n SDKInitEvent,\n UpdateProductDetailsEvent,\n VideoPlaybackEvent,\n WillDisplayProductEvent,\n} from './models/FWEvents';\nimport LiveStreamChatEventName from './models/LiveStreamChatEventName';\nimport type LiveStreamEventDetails from './models/LiveStreamEventDetails';\nimport LiveStreamEventName from './models/LiveStreamEventName';\nimport type LiveStreamMessageDetails from './models/LiveStreamMessageDetails';\nimport type { NewNativeContainerProps } from './models/NewNativeContainerProps';\nimport type Product from './models/Product';\nimport type ProductInfoViewConfiguration from './models/ProductInfoViewConfiguration';\nimport type { AddToCartButtonConfiguration } from './models/ProductInfoViewConfiguration';\nimport type ProductUnit from './models/ProductUnit';\nimport type { ProductPrice, ProductUnitOption } from './models/ProductUnit';\nimport type { StoryBlockSource } from './models/StoryBlockSource';\nimport type TrackPurchaseParameters from './models/TrackPurchaseParameters';\nimport type VideoFeedConfiguration from './models/VideoFeedConfiguration';\nimport type {\n VideoFeedContentPadding,\n VideoFeedPlayIconConfiguration,\n VideoFeedTitleConfiguration,\n VideoFeedTitlePosition,\n} from './models/VideoFeedConfiguration';\nimport type { VideoFeedSource } from './models/VideoFeedSource';\nimport type VideoPlaybackDetails from './models/VideoPlaybackDetails';\nimport type { VideoPlayerSize } from './models/VideoPlaybackDetails';\nimport VideoPlaybackEventName from './models/VideoPlaybackEventName';\nimport type VideoPlayerConfiguration from './models/VideoPlayerConfiguration';\nimport type {\n VideoLaunchBehavior,\n VideoPlayerCompleteAction,\n VideoPlayerCTADelay,\n VideoPlayerCTADelayType,\n VideoPlayerCTAStyle,\n VideoPlayerStyle,\n} from './models/VideoPlayerConfiguration';\nimport type {\n AddToCartCallback,\n ClickCartIconCallback,\n CustomClickCartIconCallback,\n UpdateProductDetailsCallback,\n WillDisplayProductCallback,\n} from './VideoShopping';\nimport VideoShopping from './VideoShopping';\n\nexport default FireworkSDK;\n\nexport {\n AdBadgeConfiguration,\n AdBadgeTextType,\n AdConfiguration,\n AddToCartButtonConfiguration,\n AddToCartCallback,\n AddToCartEvent,\n AddToCartResult,\n ClickCartIconCallback,\n CustomClickCartIconCallback,\n CustomCTAClickCallback,\n CustomCTAClickEvent,\n FeedItemDetails,\n FWError,\n FWNavigator,\n IVideoFeedProps,\n LiveStream,\n LiveStreamChatEvent,\n LiveStreamChatEventName,\n LiveStreamEvent,\n LiveStreamEventDetails,\n LiveStreamEventName,\n LiveStreamMessageDetails,\n NewNativeContainerProps,\n onLiveStreamChatEventCallback,\n onLiveStreamEventCallback,\n Product,\n ProductInfoViewConfiguration,\n ProductPrice,\n ProductUnit,\n ProductUnitOption,\n SDKInitCallback,\n SDKInitEvent,\n StoryBlock,\n StoryBlockSource,\n TrackPurchaseParameters,\n UpdateProductDetailsCallback,\n UpdateProductDetailsEvent,\n VastAttribute,\n VideoFeed,\n VideoFeedClickCallback,\n VideoFeedConfiguration,\n VideoFeedContentPadding,\n VideoFeedMode,\n VideoFeedPlayIconConfiguration,\n VideoFeedSource,\n VideoFeedTitleConfiguration,\n VideoFeedTitlePosition,\n VideoLaunchBehavior,\n VideoPlaybackCallback,\n VideoPlaybackDetails,\n VideoPlaybackEvent,\n VideoPlaybackEventName,\n VideoPlayerCompleteAction,\n VideoPlayerConfiguration,\n VideoPlayerCTADelay,\n VideoPlayerCTADelayType,\n VideoPlayerCTAStyle,\n VideoPlayerSize,\n VideoPlayerStyle,\n VideoShopping,\n WillDisplayProductCallback,\n WillDisplayProductEvent,\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["FireworkSDKModule.ts"],"names":["NativeEventEmitter","NativeModules","LINKING_ERROR","FireworkSDKModule","FireworkSDK","Proxy","get","Error","FireworkSDKModuleEventEmitter"],"mappings":"AAAA,SAASA,kBAAT,QAAiD,cAAjD;AACA,SAASC,aAAT,QAA8B,cAA9B;AAGA,SAASC,aAAT,QAA8B,6BAA9B;AAIA,MAAMC,iBAAiB,GAAGF,aAAa,CAACG,WAAd,GACtBH,aAAa,CAACG,WADQ,GAEtB,IAAIC,KAAJ,CACE,EADF,EAEE;AACEC,EAAAA,GAAG,GAAG;AACJ,UAAM,IAAIC,KAAJ,CAAUL,aAAV,CAAN;AACD;;AAHH,CAFF,CAFJ;AAuBA,MAAMM,6BAA6B,GAAG,IAAIR,kBAAJ,CAAuBG,iBAAvB,CAAtC;AACA,SAASK,6BAAT;AACA,eAAeL,iBAAf","sourcesContent":["import { NativeEventEmitter, NativeModule } from 'react-native';\nimport { NativeModules } from 'react-native';\nimport type AdBadgeConfiguration from '../models/AdBadgeConfiguration';\n\nimport { LINKING_ERROR } from '../constants/FWErrorMessage';\nimport type VideoPlayerConfiguration from '../models/VideoPlayerConfiguration';\nimport type TrackPurchaseParameters from '../models/TrackPurchaseParameters';\n\nconst FireworkSDKModule = NativeModules.FireworkSDK\n ? NativeModules.FireworkSDK\n : new Proxy(\n {},\n {\n get() {\n throw new Error(LINKING_ERROR);\n },\n }\n );\n\ninterface IFireworkSDKModule extends NativeModule {\n init(userId?: string): void;\n openVideoPlayer(url: string, config?: VideoPlayerConfiguration): void;\n setCustomCTAClickEnabled(enabled: boolean): void;\n setCustomCTALinkContentPageRouteName(name?: string): Promise<any>;\n setShareBaseURL(url?: string): Promise<any>;\n setVideoPlaybackEventEnabled(enabled: boolean): void;\n setAdBadgeConfiguration(config?: AdBadgeConfiguration): Promise<any>;\n setAppComponentName(name?: string): Promise<any>;\n trackPurchase(parameters: TrackPurchaseParameters): void;\n}\n\nconst FireworkSDKModuleEventEmitter = new NativeEventEmitter(FireworkSDKModule);\nexport { FireworkSDKModuleEventEmitter };\nexport default FireworkSDKModule as IFireworkSDKModule;\n"]}
1
+ {"version":3,"sources":["FireworkSDKModule.ts"],"names":["NativeEventEmitter","NativeModules","LINKING_ERROR","FireworkSDKModule","FireworkSDK","Proxy","get","Error","FireworkSDKModuleEventEmitter"],"mappings":"AAAA,SAASA,kBAAT,QAAiD,cAAjD;AACA,SAASC,aAAT,QAA8B,cAA9B;AAGA,SAASC,aAAT,QAA8B,6BAA9B;AAIA,MAAMC,iBAAiB,GAAGF,aAAa,CAACG,WAAd,GACtBH,aAAa,CAACG,WADQ,GAEtB,IAAIC,KAAJ,CACE,EADF,EAEE;AACEC,EAAAA,GAAG,GAAG;AACJ,UAAM,IAAIC,KAAJ,CAAUL,aAAV,CAAN;AACD;;AAHH,CAFF,CAFJ;AAyBA,MAAMM,6BAA6B,GAAG,IAAIR,kBAAJ,CAAuBG,iBAAvB,CAAtC;AACA,SAASK,6BAAT;AACA,eAAeL,iBAAf","sourcesContent":["import { NativeEventEmitter, NativeModule } from 'react-native';\nimport { NativeModules } from 'react-native';\nimport type AdBadgeConfiguration from '../models/AdBadgeConfiguration';\n\nimport { LINKING_ERROR } from '../constants/FWErrorMessage';\nimport type VideoPlayerConfiguration from '../models/VideoPlayerConfiguration';\nimport type TrackPurchaseParameters from '../models/TrackPurchaseParameters';\n\nconst FireworkSDKModule = NativeModules.FireworkSDK\n ? NativeModules.FireworkSDK\n : new Proxy(\n {},\n {\n get() {\n throw new Error(LINKING_ERROR);\n },\n }\n );\n\ninterface IFireworkSDKModule extends NativeModule {\n init(userId?: string): void;\n openVideoPlayer(url: string, config?: VideoPlayerConfiguration): void;\n setCustomCTAClickEnabled(enabled: boolean): void;\n setCustomCTALinkContentPageRouteName(name?: string): Promise<any>;\n setShareBaseURL(url?: string): Promise<any>;\n setVideoPlaybackEventEnabled(enabled: boolean): void;\n setAdBadgeConfiguration(config?: AdBadgeConfiguration): Promise<any>;\n setAppComponentName(name?: string): Promise<any>;\n trackPurchase(parameters: TrackPurchaseParameters): void;\n changeAppLanguage(language: string): Promise<boolean>;\n restart(): Promise<void>;\n}\n\nconst FireworkSDKModuleEventEmitter = new NativeEventEmitter(FireworkSDKModule);\nexport { FireworkSDKModuleEventEmitter };\nexport default FireworkSDKModule as IFireworkSDKModule;\n"]}
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import FWNavigator from './FWNavigator';
3
2
  import LiveStream from './LiveStream';
4
3
  import type AdBadgeConfiguration from './models/AdBadgeConfiguration';
@@ -8,7 +7,6 @@ import type VideoPlayerConfiguration from './models/VideoPlayerConfiguration';
8
7
  import VideoShopping from './VideoShopping';
9
8
  export declare type SDKInitCallback = (event: SDKInitEvent) => void;
10
9
  export declare type CustomCTAClickCallback = (event: CustomCTAClickEvent) => void;
11
- export declare type CustomCTALinkContentRender = (event: CustomCTAClickEvent) => React.ReactNode | null;
12
10
  export declare type VideoPlaybackCallback = (event: VideoPlaybackEvent) => void;
13
11
  export declare type VideoFeedClickCallback = (event: VideoFeedClickEvent) => void;
14
12
  /**
@@ -99,9 +97,15 @@ declare class FireworkSDK {
99
97
  */
100
98
  openVideoPlayer(url: string, config?: VideoPlayerConfiguration): void;
101
99
  /**
102
- * Records the user purchase.
100
+ * Records the user purchase. Only supported on iOS.
103
101
  * @param {TrackPurchaseParameters} parameters
104
102
  */
105
103
  trackPurchase(parameters: TrackPurchaseParameters): void;
104
+ /**
105
+ * Change App level language. Only supported on Android.
106
+ * @param {string} language Such as en, ar and en-US
107
+ * @returns
108
+ */
109
+ changeAppLanguage(language: string): Promise<boolean>;
106
110
  }
107
111
  export default FireworkSDK;
@@ -16,7 +16,8 @@ declare class VideoShopping {
16
16
  /**
17
17
  * This callback is triggered when the user clicks the "Add to cart" button.
18
18
  *
19
- * The host app can return an AddToCartResult object to tell FireworkSDK the result of adding to cart.
19
+ * The host apps can return an AddToCartResult object to tell FireworkSDK the result of adding to cart.
20
+ * If the host apps want to customize the processing logic of clicking "Add to cart" button, they could return null or undefined in the callback.
20
21
  */
21
22
  onAddToCart?: AddToCartCallback;
22
23
  /**
@@ -29,11 +30,6 @@ declare class VideoShopping {
29
30
  * This callback is triggered when the user clicks the shopping cart icon.
30
31
  *
31
32
  * The host app can customize the processing logic of clicking the shopping cart icon by setting the callback.
32
- * In the callack, you could call FireworkSDK.getInstance().navigator.popNativeContainer to close the player
33
- * and call navigation.navigate to push the RN cart page.
34
- * Currently, there is a limitation on the iOS side when you set the callback.
35
- * That is, if you set the callback, you need to call FireworkSDK.getInstance().navigator.popNativeContainer in the callback.
36
- * Otherwise there will be bugs on the iOS side.
37
33
  */
38
34
  get onCustomClickCartIcon(): CustomClickCartIconCallback | undefined;
39
35
  set onCustomClickCartIcon(value: CustomClickCartIconCallback | undefined);
@@ -61,7 +57,11 @@ declare class VideoShopping {
61
57
  private constructor();
62
58
  /**
63
59
  *
64
- * @param {number} count The number of items in the host app cart
60
+ * @param {number} count The number of items in the host app cart.
61
+ * The count should be greater than or equal to 0.
62
+ * We just use count to show or hide red indicator on the cart icon.
63
+ * If cound > 0, we will show the red indicator on the cart icon.
64
+ * Otherwise, we will hide the red indicator on the cart icon.
65
65
  */
66
66
  setCartItemCount(count: number): void;
67
67
  private handleAddToCartEvent;
@@ -1,7 +1,7 @@
1
1
  import StoryBlock from './components/StoryBlock';
2
2
  import type { IVideoFeedProps, VideoFeedMode } from './components/VideoFeed';
3
3
  import VideoFeed from './components/VideoFeed';
4
- import type { CustomCTAClickCallback, CustomCTALinkContentRender, SDKInitCallback, VideoFeedClickCallback, VideoPlaybackCallback } from './FireworkSDK';
4
+ import type { CustomCTAClickCallback, SDKInitCallback, VideoFeedClickCallback, VideoPlaybackCallback } from './FireworkSDK';
5
5
  import FireworkSDK from './FireworkSDK';
6
6
  import FWNavigator from './FWNavigator';
7
7
  import type { onLiveStreamChatEventCallback, onLiveStreamEventCallback } from './LiveStream';
@@ -33,8 +33,8 @@ import type VideoPlaybackDetails from './models/VideoPlaybackDetails';
33
33
  import type { VideoPlayerSize } from './models/VideoPlaybackDetails';
34
34
  import VideoPlaybackEventName from './models/VideoPlaybackEventName';
35
35
  import type VideoPlayerConfiguration from './models/VideoPlayerConfiguration';
36
- import type { VideoLaunchBehavior, VideoPlayerCompleteAction, VideoPlayerCTAStyle, VideoPlayerStyle } from './models/VideoPlayerConfiguration';
36
+ import type { VideoLaunchBehavior, VideoPlayerCompleteAction, VideoPlayerCTADelay, VideoPlayerCTADelayType, VideoPlayerCTAStyle, VideoPlayerStyle } from './models/VideoPlayerConfiguration';
37
37
  import type { AddToCartCallback, ClickCartIconCallback, CustomClickCartIconCallback, UpdateProductDetailsCallback, WillDisplayProductCallback } from './VideoShopping';
38
38
  import VideoShopping from './VideoShopping';
39
39
  export default FireworkSDK;
40
- export { AdBadgeConfiguration, AdBadgeTextType, AdConfiguration, AddToCartButtonConfiguration, AddToCartCallback, AddToCartEvent, AddToCartResult, ClickCartIconCallback, CustomClickCartIconCallback, CustomCTAClickCallback, CustomCTAClickEvent, CustomCTALinkContentRender, FeedItemDetails, FWError, FWNavigator, IVideoFeedProps, LiveStream, LiveStreamChatEvent, LiveStreamChatEventName, LiveStreamEvent, LiveStreamEventDetails, LiveStreamEventName, LiveStreamMessageDetails, NewNativeContainerProps, onLiveStreamChatEventCallback, onLiveStreamEventCallback, Product, ProductInfoViewConfiguration, ProductPrice, ProductUnit, ProductUnitOption, SDKInitCallback, SDKInitEvent, StoryBlock, StoryBlockSource, TrackPurchaseParameters, UpdateProductDetailsCallback, UpdateProductDetailsEvent, VastAttribute, VideoFeed, VideoFeedClickCallback, VideoFeedConfiguration, VideoFeedContentPadding, VideoFeedMode, VideoFeedPlayIconConfiguration, VideoFeedSource, VideoFeedTitleConfiguration, VideoFeedTitlePosition, VideoLaunchBehavior, VideoPlaybackCallback, VideoPlaybackDetails, VideoPlaybackEvent, VideoPlaybackEventName, VideoPlayerCompleteAction, VideoPlayerConfiguration, VideoPlayerCTAStyle, VideoPlayerSize, VideoPlayerStyle, VideoShopping, WillDisplayProductCallback, WillDisplayProductEvent, };
40
+ export { AdBadgeConfiguration, AdBadgeTextType, AdConfiguration, AddToCartButtonConfiguration, AddToCartCallback, AddToCartEvent, AddToCartResult, ClickCartIconCallback, CustomClickCartIconCallback, CustomCTAClickCallback, CustomCTAClickEvent, FeedItemDetails, FWError, FWNavigator, IVideoFeedProps, LiveStream, LiveStreamChatEvent, LiveStreamChatEventName, LiveStreamEvent, LiveStreamEventDetails, LiveStreamEventName, LiveStreamMessageDetails, NewNativeContainerProps, onLiveStreamChatEventCallback, onLiveStreamEventCallback, Product, ProductInfoViewConfiguration, ProductPrice, ProductUnit, ProductUnitOption, SDKInitCallback, SDKInitEvent, StoryBlock, StoryBlockSource, TrackPurchaseParameters, UpdateProductDetailsCallback, UpdateProductDetailsEvent, VastAttribute, VideoFeed, VideoFeedClickCallback, VideoFeedConfiguration, VideoFeedContentPadding, VideoFeedMode, VideoFeedPlayIconConfiguration, VideoFeedSource, VideoFeedTitleConfiguration, VideoFeedTitlePosition, VideoLaunchBehavior, VideoPlaybackCallback, VideoPlaybackDetails, VideoPlaybackEvent, VideoPlaybackEventName, VideoPlayerCompleteAction, VideoPlayerConfiguration, VideoPlayerCTADelay, VideoPlayerCTADelayType, VideoPlayerCTAStyle, VideoPlayerSize, VideoPlayerStyle, VideoShopping, WillDisplayProductCallback, WillDisplayProductEvent, };
@@ -5,6 +5,17 @@ export interface VideoPlayerCTAStyle {
5
5
  textColor?: string;
6
6
  fontSize?: number;
7
7
  }
8
+ export declare type VideoPlayerCTADelayType = 'constant' | 'percentage';
9
+ export interface VideoPlayerCTADelay {
10
+ type: VideoPlayerCTADelayType;
11
+ /**
12
+ * If type is constant, the value is the number of seconds of delay.
13
+ * Value should be greater than or equal to 0 and less than or equal to 10 when type is constant.
14
+ * If type is percentage, the value is a percentage based on the the total duration of the video length.
15
+ * Value must be greater than or equal to 0 and less than 1 when type is percentage.
16
+ */
17
+ value: number;
18
+ }
8
19
  export declare type VideoLaunchBehavior = 'default' | 'muteOnFirstLaunch';
9
20
  export default interface VideoPlayerConfiguration {
10
21
  /**
@@ -39,4 +50,12 @@ export default interface VideoPlayerConfiguration {
39
50
  * Indicates if Firework branding should be showed or not.
40
51
  */
41
52
  showBranding?: boolean;
53
+ /**
54
+ * Specifies the delay before showing the CTA.
55
+ */
56
+ ctaDelay?: VideoPlayerCTADelay;
57
+ /**
58
+ * Specifies the delay before the highlight animation occurs.
59
+ */
60
+ ctaHighlightDelay?: VideoPlayerCTADelay;
42
61
  }
@@ -12,6 +12,8 @@ interface IFireworkSDKModule extends NativeModule {
12
12
  setAdBadgeConfiguration(config?: AdBadgeConfiguration): Promise<any>;
13
13
  setAppComponentName(name?: string): Promise<any>;
14
14
  trackPurchase(parameters: TrackPurchaseParameters): void;
15
+ changeAppLanguage(language: string): Promise<boolean>;
16
+ restart(): Promise<void>;
15
17
  }
16
18
  declare const FireworkSDKModuleEventEmitter: NativeEventEmitter;
17
19
  export { FireworkSDKModuleEventEmitter };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-firework-sdk",
3
- "version": "1.6.2",
3
+ "version": "1.7.0",
4
4
  "description": "Firework React Native SDK",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -7,7 +7,7 @@ Pod::Spec.new do |s|
7
7
  s.version = package["version"]
8
8
  s.summary = package["description"]
9
9
  s.homepage = package["homepage"]
10
- s.license = package["license"]
10
+ s.license = "Apache License, Version 2.0"
11
11
  s.authors = package["author"]
12
12
 
13
13
  s.platforms = { :ios => "12.0" }
@@ -17,8 +17,6 @@ Pod::Spec.new do |s|
17
17
  # s.header_dir = "ios"
18
18
  # s.public_header_files = "ios/*.h"
19
19
  s.source_files = "ios/**/*.{h,m,mm,swift}"
20
-
21
- s.pod_target_xcconfig = { 'FRAMEWORK_SEARCH_PATHS' => ['"${PODS_ROOT}/FireworkVideoGIMASupport"','"${PODS_ROOT}/FireworkVideoGAMSupport"','"${PODS_XCFRAMEWORKS_BUILD_DIR}/FireworkVideoGIMASupport"','"${PODS_XCFRAMEWORKS_BUILD_DIR}/FireworkVideoGAMSupport"','"${PODS_ROOT}/GoogleAds-IMA-iOS-SDK"']}
22
20
 
23
21
  s.script_phase = { :name => 'Copy module header files', :script => 'echo "react-native-firework-sdk module_header_path path is"
24
22
  module_header_path=${PODS_TARGET_SRCROOT}"/ios/react_native_firework_sdk.h"
@@ -28,6 +26,6 @@ cp $module_header_path "${PODS_ROOT}/Headers/Public/react_native_firework_sdk/"'
28
26
 
29
27
  s.dependency "React-Core"
30
28
 
31
- s.dependency "FireworkVideo", "1.5.0"
29
+ s.dependency "FireworkVideo", "1.6.0"
32
30
 
33
31
  end
@@ -22,9 +22,6 @@ import VideoShopping from './VideoShopping';
22
22
 
23
23
  export type SDKInitCallback = (event: SDKInitEvent) => void;
24
24
  export type CustomCTAClickCallback = (event: CustomCTAClickEvent) => void;
25
- export type CustomCTALinkContentRender = (
26
- event: CustomCTAClickEvent
27
- ) => React.ReactNode | null;
28
25
  export type VideoPlaybackCallback = (event: VideoPlaybackEvent) => void;
29
26
  export type VideoFeedClickCallback = (event: VideoFeedClickEvent) => void;
30
27
 
@@ -243,7 +240,7 @@ class FireworkSDK {
243
240
  }
244
241
 
245
242
  /**
246
- * Records the user purchase.
243
+ * Records the user purchase. Only supported on iOS.
247
244
  * @param {TrackPurchaseParameters} parameters
248
245
  */
249
246
  public trackPurchase(parameters: TrackPurchaseParameters) {
@@ -251,6 +248,23 @@ class FireworkSDK {
251
248
  FireworkSDKModule.trackPurchase(parameters);
252
249
  }
253
250
  }
251
+
252
+ /**
253
+ * Change App level language. Only supported on Android.
254
+ * @param {string} language Such as en, ar and en-US
255
+ * @returns
256
+ */
257
+ public async changeAppLanguage(language: string): Promise<boolean> {
258
+ if (Platform.OS === 'android') {
259
+ const result = await FireworkSDKModule.changeAppLanguage(language);
260
+ if (result) {
261
+ await FireworkSDKModule.restart();
262
+ }
263
+ return result;
264
+ }
265
+
266
+ return false;
267
+ }
254
268
  }
255
269
 
256
270
  export default FireworkSDK;
@@ -44,7 +44,8 @@ class VideoShopping {
44
44
  /**
45
45
  * This callback is triggered when the user clicks the "Add to cart" button.
46
46
  *
47
- * The host app can return an AddToCartResult object to tell FireworkSDK the result of adding to cart.
47
+ * The host apps can return an AddToCartResult object to tell FireworkSDK the result of adding to cart.
48
+ * If the host apps want to customize the processing logic of clicking "Add to cart" button, they could return null or undefined in the callback.
48
49
  */
49
50
  public onAddToCart?: AddToCartCallback;
50
51
 
@@ -59,11 +60,6 @@ class VideoShopping {
59
60
  * This callback is triggered when the user clicks the shopping cart icon.
60
61
  *
61
62
  * The host app can customize the processing logic of clicking the shopping cart icon by setting the callback.
62
- * In the callack, you could call FireworkSDK.getInstance().navigator.popNativeContainer to close the player
63
- * and call navigation.navigate to push the RN cart page.
64
- * Currently, there is a limitation on the iOS side when you set the callback.
65
- * That is, if you set the callback, you need to call FireworkSDK.getInstance().navigator.popNativeContainer in the callback.
66
- * Otherwise there will be bugs on the iOS side.
67
63
  */
68
64
  public get onCustomClickCartIcon(): CustomClickCartIconCallback | undefined {
69
65
  return this._onCustomClickCartIcon;
@@ -148,7 +144,11 @@ class VideoShopping {
148
144
 
149
145
  /**
150
146
  *
151
- * @param {number} count The number of items in the host app cart
147
+ * @param {number} count The number of items in the host app cart.
148
+ * The count should be greater than or equal to 0.
149
+ * We just use count to show or hide red indicator on the cart icon.
150
+ * If cound > 0, we will show the red indicator on the cart icon.
151
+ * Otherwise, we will hide the red indicator on the cart icon.
152
152
  */
153
153
  public setCartItemCount(count: number) {
154
154
  ShoppingModule.setCartItemCount(count);
@@ -191,6 +191,7 @@ export default class VideoFeed extends React.Component<IVideoFeedProps> {
191
191
  const requiresAds = adConfiguration?.requiresAds ?? false;
192
192
  const adsFetchTimeout = adConfiguration?.adsFetchTimeout ?? 10;
193
193
  const vastAttributesString = this._generateVastAttributesString();
194
+ const showAdBadge = videoFeedConfiguration?.showAdBadge ?? false;
194
195
 
195
196
  let key = `source:${source}`;
196
197
  key += `_channel:${channel}`;
@@ -211,6 +212,7 @@ export default class VideoFeed extends React.Component<IVideoFeedProps> {
211
212
  key += `_requiresAds:${requiresAds}`;
212
213
  key += `_adsFetchTimeout:${adsFetchTimeout}`;
213
214
  key += `_vastAttributes:${vastAttributesString}`;
215
+ key += `_showAdBadge:${showAdBadge}`;
214
216
 
215
217
  return (
216
218
  <FWVideoFeed
package/src/index.tsx CHANGED
@@ -3,7 +3,6 @@ import type { IVideoFeedProps, VideoFeedMode } from './components/VideoFeed';
3
3
  import VideoFeed from './components/VideoFeed';
4
4
  import type {
5
5
  CustomCTAClickCallback,
6
- CustomCTALinkContentRender,
7
6
  SDKInitCallback,
8
7
  VideoFeedClickCallback,
9
8
  VideoPlaybackCallback,
@@ -59,6 +58,8 @@ import type VideoPlayerConfiguration from './models/VideoPlayerConfiguration';
59
58
  import type {
60
59
  VideoLaunchBehavior,
61
60
  VideoPlayerCompleteAction,
61
+ VideoPlayerCTADelay,
62
+ VideoPlayerCTADelayType,
62
63
  VideoPlayerCTAStyle,
63
64
  VideoPlayerStyle,
64
65
  } from './models/VideoPlayerConfiguration';
@@ -85,7 +86,6 @@ export {
85
86
  CustomClickCartIconCallback,
86
87
  CustomCTAClickCallback,
87
88
  CustomCTAClickEvent,
88
- CustomCTALinkContentRender,
89
89
  FeedItemDetails,
90
90
  FWError,
91
91
  FWNavigator,
@@ -129,6 +129,8 @@ export {
129
129
  VideoPlaybackEventName,
130
130
  VideoPlayerCompleteAction,
131
131
  VideoPlayerConfiguration,
132
+ VideoPlayerCTADelay,
133
+ VideoPlayerCTADelayType,
132
134
  VideoPlayerCTAStyle,
133
135
  VideoPlayerSize,
134
136
  VideoPlayerStyle,
@@ -6,6 +6,18 @@ export interface VideoPlayerCTAStyle {
6
6
  fontSize?: number;
7
7
  }
8
8
 
9
+ export type VideoPlayerCTADelayType = 'constant' | 'percentage';
10
+ export interface VideoPlayerCTADelay {
11
+ type: VideoPlayerCTADelayType;
12
+ /**
13
+ * If type is constant, the value is the number of seconds of delay.
14
+ * Value should be greater than or equal to 0 and less than or equal to 10 when type is constant.
15
+ * If type is percentage, the value is a percentage based on the the total duration of the video length.
16
+ * Value must be greater than or equal to 0 and less than 1 when type is percentage.
17
+ */
18
+ value: number;
19
+ }
20
+
9
21
  export type VideoLaunchBehavior = 'default' | 'muteOnFirstLaunch';
10
22
 
11
23
  export default interface VideoPlayerConfiguration {
@@ -41,4 +53,12 @@ export default interface VideoPlayerConfiguration {
41
53
  * Indicates if Firework branding should be showed or not.
42
54
  */
43
55
  showBranding?: boolean;
56
+ /**
57
+ * Specifies the delay before showing the CTA.
58
+ */
59
+ ctaDelay?: VideoPlayerCTADelay;
60
+ /**
61
+ * Specifies the delay before the highlight animation occurs.
62
+ */
63
+ ctaHighlightDelay?: VideoPlayerCTADelay;
44
64
  }
@@ -27,6 +27,8 @@ interface IFireworkSDKModule extends NativeModule {
27
27
  setAdBadgeConfiguration(config?: AdBadgeConfiguration): Promise<any>;
28
28
  setAppComponentName(name?: string): Promise<any>;
29
29
  trackPurchase(parameters: TrackPurchaseParameters): void;
30
+ changeAppLanguage(language: string): Promise<boolean>;
31
+ restart(): Promise<void>;
30
32
  }
31
33
 
32
34
  const FireworkSDKModuleEventEmitter = new NativeEventEmitter(FireworkSDKModule);
@@ -1,17 +0,0 @@
1
- //
2
- // AVPlayer+FWSwizzle.h
3
- // FireworkSdk
4
- //
5
- // Created by linjie jiang on 2023/1/10.
6
- //
7
-
8
-
9
- #import <AVFoundation/AVFoundation.h>
10
-
11
- NS_ASSUME_NONNULL_BEGIN
12
-
13
- @interface AVPlayer (FWSwizzle)
14
-
15
- @end
16
-
17
- NS_ASSUME_NONNULL_END