react-native-firework-sdk 1.7.1 → 1.9.0-beta.3

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 (139) hide show
  1. package/android/src/main/java/com/fireworksdk/bridge/components/videofeed/FWVideoFeed.kt +0 -1
  2. package/android/src/main/java/com/fireworksdk/bridge/models/FWEventName.kt +1 -0
  3. package/android/src/main/java/com/fireworksdk/bridge/reactnative/models/FWVideoShoppingInterface.kt +1 -0
  4. package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FWVideoShoppingModule.kt +11 -1
  5. package/android/src/main/java/com/fireworksdk/bridge/reactnative/utils/FWEventUtils.kt +9 -0
  6. package/android/src/main/java/com/fireworksdk/bridge/utils/FWLanguageUtil.kt +0 -2
  7. package/android/src/main/java/com/fireworksdk/bridge/utils/FWVideoPlayerUtils.kt +1 -0
  8. package/ios/Components/StoryBlock.swift +6 -9
  9. package/ios/Components/StoryBlockManager.swift +4 -0
  10. package/ios/Components/VideoFeed.swift +14 -15
  11. package/ios/Components/VideoFeedConfiguration.swift +2 -0
  12. package/ios/Components/VideoFeedManager.m +2 -0
  13. package/ios/Components/VideoFeedManager.swift +4 -0
  14. package/ios/Components/VideoPlayerConfiguration.swift +1 -0
  15. package/ios/FireworkSdk-Bridging-Header.h +6 -0
  16. package/ios/FireworkSdk.xcodeproj/project.pbxproj +374 -200
  17. package/ios/Models/Common/FontInfo.swift +57 -0
  18. package/ios/Models/NativeToRN/FireworkEventName.swift +1 -0
  19. package/ios/Modules/FWNavigatorModule/FWNavigatorModule.m +2 -0
  20. package/ios/Modules/FWNavigatorModule/FWNavigatorModule.swift +271 -107
  21. package/ios/Modules/FireworkSDKModule/FireworkSDKModule+EventTracking.swift +0 -2
  22. package/ios/Modules/FireworkSDKModule/FireworkSDKModule.m +1 -0
  23. package/ios/Modules/FireworkSDKModule/FireworkSDKModule.swift +43 -12
  24. package/ios/Modules/LiveStream/LiveStreamModule.swift +5 -3
  25. package/ios/Modules/Shopping/ProductInfoViewConfiguration.swift +7 -2
  26. package/ios/Modules/Shopping/ShoppingModule.m +1 -1
  27. package/ios/Modules/Shopping/ShoppingModule.swift +72 -63
  28. package/ios/Utils/AppLanguage/Bundle+FWSwizzle.swift +58 -0
  29. package/ios/Utils/AppLanguage/FWAppLanguageManager.swift +118 -0
  30. package/ios/Utils/AppLanguage/FWLanguageUtil.swift +39 -0
  31. package/ios/Utils/AppLanguage/NumberFormatter+FWSwizzle.swift +25 -0
  32. package/ios/Utils/AppLanguage/UIImageView+FWSwizzle.swift +91 -0
  33. package/ios/Utils/AppLanguage/UILabel+FWSwizzle.swift +98 -0
  34. package/ios/Utils/AppLanguage/UITextField+FWSwizzle.swift +97 -0
  35. package/ios/Utils/AppLanguage/UITextView+FWSwizzle.swift +97 -0
  36. package/ios/Utils/AppLanguage/UIView+FWSwizzle.swift +38 -0
  37. package/ios/Utils/AppLanguage/UIViewController+FWSwizzle.swift +32 -0
  38. package/ios/Utils/AppLanguage/UIWindow+FWSwizzle.swift +26 -0
  39. package/ios/Utils/AppLanguage/URLSession+FWSwizzle.swift +69 -0
  40. package/ios/Utils/{DispatchQueue+FWOnce.swift → Extensions/DispatchQueue+FWOnce.swift} +3 -3
  41. package/ios/Utils/{UINavigationController+FWSwizzle.swift → Extensions/Swizzle/UINavigationController+FWSwizzle.swift} +6 -8
  42. package/ios/Utils/Extensions/UIView+FWUIHierarchy.swift +47 -0
  43. package/ios/Utils/FWRTL/Classes/Manager/FWRTLManager.h +25 -0
  44. package/ios/Utils/FWRTL/Classes/Manager/FWRTLManager.m +75 -0
  45. package/ios/Utils/FWRTL/Classes/UICategories/CALayer+FWRTL.h +21 -0
  46. package/ios/Utils/FWRTL/Classes/UICategories/CALayer+FWRTL.m +124 -0
  47. package/ios/Utils/FWRTL/Classes/UICategories/FWRTLRemoteViewControllerAdaptor.h +11 -0
  48. package/ios/Utils/FWRTL/Classes/UICategories/FWRTLRemoteViewControllerAdaptor.m +86 -0
  49. package/ios/Utils/FWRTL/Classes/UICategories/FWRTLWhiteListManager.h +16 -0
  50. package/ios/Utils/FWRTL/Classes/UICategories/FWRTLWhiteListManager.m +55 -0
  51. package/ios/Utils/FWRTL/Classes/UICategories/UILabel+FWRTL.h +18 -0
  52. package/ios/Utils/FWRTL/Classes/UICategories/UILabel+FWRTL.m +39 -0
  53. package/ios/Utils/FWRTL/Classes/UICategories/UIView+FWRTL.h +54 -0
  54. package/ios/Utils/FWRTL/Classes/UICategories/UIView+FWRTL.m +141 -0
  55. package/ios/Utils/FWRTL/Classes/UICategories/UIWindow+FWRTL.h +16 -0
  56. package/ios/Utils/FWRTL/Classes/UICategories/UIWindow+FWRTL.m +20 -0
  57. package/ios/Utils/FWRTL/Classes/Utils/FWRTLDefinitions.h +52 -0
  58. package/ios/Utils/FWRTL/Classes/Utils/NSObject+FWRTLReloadBlock.h +19 -0
  59. package/ios/Utils/FWRTL/Classes/Utils/NSObject+FWRTLReloadBlock.m +49 -0
  60. package/ios/Utils/FWRTL/Classes/Utils/NSString+FWRTL.h +21 -0
  61. package/ios/Utils/FWRTL/Classes/Utils/NSString+FWRTL.m +38 -0
  62. package/ios/Utils/FWRTL/Classes/Utils/UIImage+FWRTL.h +18 -0
  63. package/ios/Utils/FWRTL/Classes/Utils/UIImage+FWRTL.m +43 -0
  64. package/ios/Utils/FWSwizzleLoader.m +1 -2
  65. package/ios/Utils/FWSwizzleLoader.swift +13 -0
  66. package/ios/Utils/FWSwizzleUtil.swift +17 -9
  67. package/ios/react_native_firework_sdk.h +1 -0
  68. package/ios/scripts/firework_sdk_pods.rb +3 -0
  69. package/lib/commonjs/FWNavigator.js +32 -1
  70. package/lib/commonjs/FWNavigator.js.map +1 -1
  71. package/lib/commonjs/FireworkSDK.js +26 -12
  72. package/lib/commonjs/FireworkSDK.js.map +1 -1
  73. package/lib/commonjs/VideoShopping.js +64 -9
  74. package/lib/commonjs/VideoShopping.js.map +1 -1
  75. package/lib/commonjs/components/VideoFeed.js +26 -5
  76. package/lib/commonjs/components/VideoFeed.js.map +1 -1
  77. package/lib/commonjs/index.js +6 -0
  78. package/lib/commonjs/index.js.map +1 -1
  79. package/lib/commonjs/models/FWEventName.js +2 -0
  80. package/lib/commonjs/models/FWEventName.js.map +1 -1
  81. package/lib/commonjs/models/IOSFontInfo.js +2 -0
  82. package/lib/commonjs/models/IOSFontInfo.js.map +1 -0
  83. package/lib/commonjs/modules/FWNavigatorModule.js.map +1 -1
  84. package/lib/commonjs/modules/ShoppingModule.js.map +1 -1
  85. package/lib/module/FWNavigator.js +31 -1
  86. package/lib/module/FWNavigator.js.map +1 -1
  87. package/lib/module/FireworkSDK.js +27 -11
  88. package/lib/module/FireworkSDK.js.map +1 -1
  89. package/lib/module/VideoShopping.js +63 -9
  90. package/lib/module/VideoShopping.js.map +1 -1
  91. package/lib/module/components/VideoFeed.js +21 -5
  92. package/lib/module/components/VideoFeed.js.map +1 -1
  93. package/lib/module/index.js +1 -1
  94. package/lib/module/index.js.map +1 -1
  95. package/lib/module/models/FWEventName.js +2 -0
  96. package/lib/module/models/FWEventName.js.map +1 -1
  97. package/lib/module/models/IOSFontInfo.js +2 -0
  98. package/lib/module/models/IOSFontInfo.js.map +1 -0
  99. package/lib/module/modules/FWNavigatorModule.js.map +1 -1
  100. package/lib/module/modules/ShoppingModule.js.map +1 -1
  101. package/lib/typescript/FWNavigator.d.ts +17 -2
  102. package/lib/typescript/FireworkSDK.d.ts +9 -5
  103. package/lib/typescript/LiveStream.d.ts +2 -2
  104. package/lib/typescript/VideoShopping.d.ts +33 -11
  105. package/lib/typescript/components/VideoFeed.d.ts +5 -1
  106. package/lib/typescript/index.d.ts +8 -4
  107. package/lib/typescript/models/AdBadgeConfiguration.d.ts +1 -1
  108. package/lib/typescript/models/FWEventName.d.ts +3 -1
  109. package/lib/typescript/models/FWEvents.d.ts +5 -0
  110. package/lib/typescript/models/IOSFontInfo.d.ts +19 -0
  111. package/lib/typescript/models/NewNativeContainerProps.d.ts +1 -1
  112. package/lib/typescript/models/ProductInfoViewConfiguration.d.ts +23 -0
  113. package/lib/typescript/models/StoryBlockSource.d.ts +1 -1
  114. package/lib/typescript/models/VideoFeedConfiguration.d.ts +20 -2
  115. package/lib/typescript/models/VideoFeedSource.d.ts +1 -1
  116. package/lib/typescript/models/VideoPlayerConfiguration.d.ts +20 -4
  117. package/lib/typescript/modules/FWNavigatorModule.d.ts +2 -0
  118. package/lib/typescript/modules/ShoppingModule.d.ts +2 -1
  119. package/package.json +7 -4
  120. package/react-native-firework-sdk.podspec +15 -18
  121. package/src/{FWNavigator.tsx → FWNavigator.ts} +30 -2
  122. package/src/FireworkSDK.ts +24 -13
  123. package/src/VideoShopping.ts +86 -20
  124. package/src/components/VideoFeed.tsx +24 -2
  125. package/src/{index.tsx → index.ts} +24 -1
  126. package/src/models/FWEventName.ts +2 -0
  127. package/src/models/FWEvents.ts +6 -0
  128. package/src/models/IOSFontInfo.ts +29 -0
  129. package/src/models/ProductInfoViewConfiguration.ts +25 -0
  130. package/src/models/VideoFeedConfiguration.ts +20 -1
  131. package/src/models/VideoPlayerConfiguration.ts +17 -0
  132. package/src/modules/FWNavigatorModule.ts +2 -0
  133. package/src/modules/ShoppingModule.ts +2 -4
  134. package/ios/Utils/FWPiPManager.swift +0 -24
  135. package/ios/Utils/UIButton+FWSwizzle.swift +0 -33
  136. package/ios/Utils/UIView+ParentViewController.swift +0 -21
  137. /package/ios/Utils/{String+Color.swift → Extensions/String+Color.swift} +0 -0
  138. /package/ios/Utils/{UIView+Constraints.swift → Extensions/UIView+Constraints.swift} +0 -0
  139. /package/ios/Utils/{UIViewController+AttachChild.swift → Extensions/UIViewController+AttachChild.swift} +0 -0
@@ -1 +1 @@
1
- {"version":3,"sources":["VideoShopping.ts"],"names":["VideoShopping","onCustomClickCartIcon","_onCustomClickCartIcon","value","Platform","OS","ShoppingModule","setCustomClickCartIconEnabled","cartIconVisible","_cartIconVisible","setCartIconVisible","eventEmitter","ShoppingModuleEventEmitter","getInstance","FWLoggerUtil","log","_instance","constructor","addListener","FWEventName","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;;AAQA;;AAGA;;AAIA;;;;;;;;;;AAsBA;AACA;AACA;AACA,MAAMA,aAAN,CAAoB;AAGlB;AACF;AACA;AACA;AACA;AACA;;AAGE;AACF;AACA;AACA;AACA;;AAGE;AACF;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,QAAIC,sBAASC,EAAT,KAAgB,KAApB,EAA2B;AACzBC,8BAAeC,6BAAf,CAA6C,CAAC,CAACJ,KAA/C;AACD;AACF;;AAiBD;AACF;AACA;AAC4B,MAAfK,eAAe,GAAY;AACpC,WAAO,KAAKC,gBAAZ;AACD;;AACyB,MAAfD,eAAe,CAACL,KAAD,EAAiB;AACzC,SAAKM,gBAAL,GAAwBN,KAAxB;;AACAG,4BAAeI,kBAAf,CAAkCP,KAAlC;AACD;;AAGuB,MAAZQ,YAAY,GAAuB;AAC7C,WAAOC,0CAAP;AACD;;AAEwB,SAAXC,WAAW,GAAG;AAC1BC,0BAAaC,GAAb,CAAiB,2BAAjB;;AACA,QAAI,CAACf,aAAa,CAACgB,SAAnB,EAA8B;AAC5BhB,MAAAA,aAAa,CAACgB,SAAd,GAA0B,IAAIhB,aAAJ,EAA1B;AACD;;AAED,WAAOA,aAAa,CAACgB,SAArB;AACD;;AAEOC,E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ADwB,CAA1B;AAIA,YAAMO,UAAU,GAAG,CAACmB,WAAW,IAAI,EAAhB,EAAoBC,GAApB,CAChBC,OAAD;AAAA;;AAAA,qCAAaA,OAAO,CAAC3B,SAArB,mEAAkC,EAAlC;AAAA,OADiB,CAAnB;;AAIAR,4BAAaC,GAAb,CACG,+DAA8Da,UAAW,uBACxE,CAACmB,WAAW,IAAI,EAAhB,EAAoBG,MACrB,EAHH;;AAMA,UAAIH,WAAJ,EAAiB;AACf,YAAIX,UAAJ,EAAgB;AACd9B,kCAAe6C,mBAAf,CAAmCJ,WAAnC,EAAgDX,UAAhD;AACD;AACF,OAJD,MAIO;AACL,YAAIA,UAAJ,EAAgB;AACd,cAAIhC,sBAASC,EAAT,KAAgB,KAApB,EAA2B;AACzBC,oCAAeoC,eAAf,CACEN,UADF,EAEEjB,yBAAYQ,oBAFd;AAID;AACF;AACF;AACF,KAhCD,MAgCO;AACLb,4BAAaC,GAAb,CAAiB,6CAAjB;;AACA,UAAIqB,UAAJ,EAAgB;AACd,YAAIhC,sBAASC,EAAT,KAAgB,KAApB,EAA2B;AACzBC,kCAAeoC,eAAf,CACEN,UADF,EAEEjB,yBAAYQ,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;AACxB9B,gCAAegD,uBAAf,CAAuCD,MAAvC,EAA+CjB,UAA/C;AACD;AACF;AACF;;AA7NiB;;gBAAdpC,a;;eAgOSA,a","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"]}
1
+ {"version":3,"sources":["VideoShopping.ts"],"names":["VideoShopping","onCustomClickCartIcon","_onCustomClickCartIcon","value","Platform","OS","ShoppingModule","setCustomClickCartIconEnabled","cartIconVisible","_cartIconVisible","setCartIconVisible","productInfoViewConfiguration","_productInfoViewConfiguration","setProductInfoViewConfiguration","onCustomClickLinkButton","_onCustomClickLinkButton","setCustomClickLinkButtonEnabled","eventEmitter","ShoppingModuleEventEmitter","getInstance","FWLoggerUtil","log","_instance","constructor","addListener","FWEventName","AddToCart","event","productId","unitId","handleAddToCartEvent","ClickCartIcon","handleClickCartIconEvent","UpdateProductDetails","productIds","handleUpdateProductDetailsEvent","WillDisplayProduct","videoId","handleWillDisplayProductEvent","LogMessage","CustomLinkButtonClick","url","handleCustomLinkButtonClickEvent","setCartItemCount","count","callbackId","onAddToCart","result","updateAddToCartStatus","res","tips","clearCallbackId","onClickCartIcon","props","jumpToCartPage","onUpdateProductDetails","productList","map","product","length","updateVideoProducts","onWillDisplayProduct","config"],"mappings":";;;;;;;AAAA;;AASA;;AAGA;;AAIA;;;;;;;;;;AAwBA;AACA;AACA;AACA,MAAMA,aAAN,CAAoB;AAGlB;AACF;AACA;AACA;AACA;AACA;;AAGE;AACF;AACA;AACA;AACA;AACA;;AAGE;AACF;AACA;AACA;AACA;AACA;AACkC,MAArBC,qBAAqB,GAA4C;AAC1E,WAAO,KAAKC,sBAAZ;AACD;;AAC+B,MAArB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,CAACX,KAAD,EAAa;AACtD,QAAI,KAAKkC,oBAAT,EAA+B;AAC7B,aAAOlC,KAAK,CAACkB,UAAb;AACA,YAAMiB,MAAM,GAAG,MAAM,KAAKD,oBAAL,CACnBlC,KADmB,CAArB;;AAGA,UAAImC,MAAJ,EAAY;AACVxD,gCAAeO,+BAAf,CAA+CiD,MAA/C;AACD;AACF;AACF;;AAE6C,QAAhCpB,gCAAgC,CAC5Cf,KAD4C,EAE5C;AACA,QAAI,KAAKb,uBAAT,EAAkC;AAChC,WAAKA,uBAAL,CAA6Ba,KAA7B;AACD;AACF;;AA5RiB;;gBAAd3B,a;;eA+RSA,a","sourcesContent":["import { NativeEventEmitter, Platform } from 'react-native';\n\nimport type AddToCartResult from './models/AddToCartResult';\nimport type {\n AddToCartEvent,\n CustomClickLinkButtonEvent,\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\nexport type CustomClickLinkButtonCallback = (\n event: CustomClickLinkButtonEvent\n) => Promise<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\" 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\n * 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 click event processing logic of\n * 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 * Please use productInfoViewConfiguration property. Only supported on iOS.\n *\n * @deprecated The property will be deprecated since RN SDK V2.\n */\n public onWillDisplayProduct?: WillDisplayProductCallback;\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 ShoppingModule.setCartIconVisible(value);\n }\n private _cartIconVisible: boolean = true;\n\n /**\n * The host app can use this property to configure \"Add to cart\" button style\n * and hide the link button next to \"Add to cart\" button. Only supported on iOS.\n */\n public get productInfoViewConfiguration():\n | ProductInfoViewConfiguration\n | undefined {\n return this._productInfoViewConfiguration;\n }\n\n public set productInfoViewConfiguration(\n value: ProductInfoViewConfiguration | undefined\n ) {\n this._productInfoViewConfiguration = value;\n if (Platform.OS === 'ios') {\n ShoppingModule.setProductInfoViewConfiguration(value ?? {});\n }\n }\n\n private _productInfoViewConfiguration?:\n | ProductInfoViewConfiguration\n | undefined;\n\n /**\n * This callback is triggered when the user clicks\n * the link button next to Add to cart button. Only supported on Android.\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 if (Platform.OS === 'android') {\n ShoppingModule.setCustomClickLinkButtonEnabled(!!value);\n }\n }\n private _onCustomClickLinkButton?: CustomClickLinkButtonCallback | 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(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 if (Platform.OS === 'android') {\n this.eventEmitter.addListener(\n FWEventName.CustomLinkButtonClick,\n (event) => {\n FWLoggerUtil.log(\n `Receive CustomLinkButtonClick event url: ${event?.url}`\n );\n this.handleCustomLinkButtonClickEvent(event);\n }\n );\n }\n }\n\n /**\n *\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: any) {\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: any) {\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(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 handleWillDisplayProductEvent(event: any) {\n if (this.onWillDisplayProduct) {\n delete event.callbackId;\n const config = await this.onWillDisplayProduct(\n event as WillDisplayProductEvent\n );\n if (config) {\n ShoppingModule.setProductInfoViewConfiguration(config);\n }\n }\n }\n\n private async handleCustomLinkButtonClickEvent(\n event: CustomClickLinkButtonEvent\n ) {\n if (this.onCustomClickLinkButton) {\n this.onCustomClickLinkButton(event);\n }\n }\n}\n\nexport default VideoShopping;\n"]}
@@ -97,6 +97,14 @@ class VideoFeed extends _react.default.Component {
97
97
  });
98
98
 
99
99
  this.subscriptions.push(subscriptionOfAdBadgeConfigurationUpdated);
100
+
101
+ const subscriptionOfAppLanguageUpdated = _FireworkSDKModule.FireworkSDKModuleEventEmitter.addListener(_FWEventName.FWEventName.AppLanguageUpdated, () => {
102
+ _FWLoggerUtil.default.log('Receive FWEventName.AppLanguageUpdated');
103
+
104
+ this.setState({});
105
+ });
106
+
107
+ this.subscriptions.push(subscriptionOfAppLanguageUpdated);
100
108
  }
101
109
 
102
110
  componentWillUnmount() {
@@ -109,7 +117,7 @@ class VideoFeed extends _react.default.Component {
109
117
  }
110
118
 
111
119
  render() {
112
- var _videoFeedConfigurati, _videoFeedConfigurati2, _videoFeedConfigurati3, _videoFeedConfigurati4, _FireworkSDK$getInsta, _FireworkSDK$getInsta2, _adBadgeConfiguration, _adBadgeConfiguration2, _adBadgeConfiguration3, _videoFeedConfigurati5, _videoFeedConfigurati6, _videoFeedConfigurati7, _adConfiguration$requ, _adConfiguration$adsF, _videoFeedConfigurati8;
120
+ var _videoFeedConfigurati, _videoFeedConfigurati2, _videoFeedConfigurati3, _videoFeedConfigurati4, _FireworkSDK$getInsta, _FireworkSDK$getInsta2, _adBadgeConfiguration, _adBadgeConfiguration2, _adBadgeConfiguration3, _videoFeedConfigurati5, _videoFeedConfigurati6, _adConfiguration$requ, _adConfiguration$adsF, _videoFeedConfigurati7;
113
121
 
114
122
  _FWLoggerUtil.default.log(`VideoFeed render ${JSON.stringify(this.props)}`);
115
123
 
@@ -119,7 +127,8 @@ class VideoFeed extends _react.default.Component {
119
127
  playlist = '',
120
128
  playlistGroup = '',
121
129
  mode = 'row',
122
- adConfiguration
130
+ adConfiguration,
131
+ enablePictureInPicture = false
123
132
  } = this.props;
124
133
 
125
134
  const videoFeedConfiguration = this._getVideoFeedConfiguration();
@@ -136,14 +145,24 @@ class VideoFeed extends _react.default.Component {
136
145
  const dynamicContentParametersString = this._generateDynamicContentParametersString();
137
146
 
138
147
  const enableAutoplay = (_videoFeedConfigurati5 = videoFeedConfiguration === null || videoFeedConfiguration === void 0 ? void 0 : videoFeedConfiguration.enableAutoplay) !== null && _videoFeedConfigurati5 !== void 0 ? _videoFeedConfigurati5 : false;
139
- const enablePictureInPicture = (_videoFeedConfigurati6 = videoFeedConfiguration === null || videoFeedConfiguration === void 0 ? void 0 : videoFeedConfiguration.enablePictureInPicture) !== null && _videoFeedConfigurati6 !== void 0 ? _videoFeedConfigurati6 : false;
140
- const gridColumns = (_videoFeedConfigurati7 = videoFeedConfiguration === null || videoFeedConfiguration === void 0 ? void 0 : videoFeedConfiguration.gridColumns) !== null && _videoFeedConfigurati7 !== void 0 ? _videoFeedConfigurati7 : 2;
148
+ let enablePictureInPictureLegacy = false;
149
+
150
+ if (videoFeedConfiguration) {
151
+ var _enablePictureInPictu;
152
+
153
+ enablePictureInPictureLegacy = (_enablePictureInPictu = videoFeedConfiguration.enablePictureInPicture) !== null && _enablePictureInPictu !== void 0 ? _enablePictureInPictu : false;
154
+ }
155
+
156
+ const gridColumns = (_videoFeedConfigurati6 = videoFeedConfiguration === null || videoFeedConfiguration === void 0 ? void 0 : videoFeedConfiguration.gridColumns) !== null && _videoFeedConfigurati6 !== void 0 ? _videoFeedConfigurati6 : 2;
141
157
  const requiresAds = (_adConfiguration$requ = adConfiguration === null || adConfiguration === void 0 ? void 0 : adConfiguration.requiresAds) !== null && _adConfiguration$requ !== void 0 ? _adConfiguration$requ : false;
142
158
  const adsFetchTimeout = (_adConfiguration$adsF = adConfiguration === null || adConfiguration === void 0 ? void 0 : adConfiguration.adsFetchTimeout) !== null && _adConfiguration$adsF !== void 0 ? _adConfiguration$adsF : 10;
143
159
 
144
160
  const vastAttributesString = this._generateVastAttributesString();
145
161
 
146
- const showAdBadge = (_videoFeedConfigurati8 = videoFeedConfiguration === null || videoFeedConfiguration === void 0 ? void 0 : videoFeedConfiguration.showAdBadge) !== null && _videoFeedConfigurati8 !== void 0 ? _videoFeedConfigurati8 : false;
162
+ const showAdBadge = (_videoFeedConfigurati7 = videoFeedConfiguration === null || videoFeedConfiguration === void 0 ? void 0 : videoFeedConfiguration.showAdBadge) !== null && _videoFeedConfigurati7 !== void 0 ? _videoFeedConfigurati7 : false;
163
+
164
+ const appLanguage = _FireworkSDK.default.getInstance().appLanguage;
165
+
147
166
  let key = `source:${source}`;
148
167
  key += `_channel:${channel}`;
149
168
  key += `_playlist:${playlist}`;
@@ -159,11 +178,13 @@ class VideoFeed extends _react.default.Component {
159
178
  key += `_dynamicContentParameters:${dynamicContentParametersString}`;
160
179
  key += `_enableAutoplay:${enableAutoplay}`;
161
180
  key += `_enablePictureInPicture:${enablePictureInPicture}`;
181
+ key += `_enablePictureInPictureLegacy:${enablePictureInPictureLegacy}`;
162
182
  key += `_gridColumns:${gridColumns}`;
163
183
  key += `_requiresAds:${requiresAds}`;
164
184
  key += `_adsFetchTimeout:${adsFetchTimeout}`;
165
185
  key += `_vastAttributes:${vastAttributesString}`;
166
186
  key += `_showAdBadge:${showAdBadge}`;
187
+ key += `_appLanguage:${appLanguage}`;
167
188
  return /*#__PURE__*/_react.default.createElement(_FWVideoFeed.default, _extends({
168
189
  key: key
169
190
  }, this.props, {
@@ -1 +1 @@
1
- {"version":3,"sources":["VideoFeed.tsx"],"names":["NativeComponentName","VideoFeed","React","Component","createRef","FWLoggerUtil","log","JSON","stringify","props","nativeNodeHandle","nativeComponentRef","current","commandId","UIManager","getViewManagerConfig","Commands","refresh","Platform","OS","toString","dispatchViewManagerCommand","event","nativeEvent","onVideoFeedLoadFinished","name","reason","componentDidMount","subscriptionOfShareBaseURLUpdated","FireworkSDKModuleEventEmitter","addListener","FWEventName","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","FireworkSDK","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","vastAttributes","attribute","Math","floor"],"mappings":";;;;;;;AAAA;;AAEA;;AAUA;;AAEA;;AAKA;;AACA;;AACA;;;;;;;;AAmDA,MAAMA,mBAAmB,GAAG,aAA5B;;AAEe,MAAMC,SAAN,SAAwBC,eAAMC,SAA9B,CAAyD;AAAA;AAAA;;AAAA,6DAKjDD,eAAME,SAAN,EALiD;;AAAA,2CAO/B,EAP+B;;AAAA,qCAYrD,MAAM;AACrBC,4BAAaC,GAAb,CAAkB,qBAAoBC,IAAI,CAACC,SAAL,CAAe,KAAKC,KAApB,CAA2B,EAAjE;;AAEA,YAAMC,gBAAgB,GAAG,iCAAe,KAAKC,kBAAL,C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C,sBAAsB,CAACqB,WAAlC,MACErB,sBAAsB,CAACqB,WAH3B,EAIE;AACA,aAAO,EACL,GAAGrB,sBADE;AAELqB,QAAAA,WAAW,EAAEsB,IAAI,CAACC,KAAL,CAAW5C,sBAAsB,CAACqB,WAAlC;AAFR,OAAP;AAID,KATD,MASO;AACL,aAAOrB,sBAAP;AACD;AACF;;AAnNqE;;;;gBAAnDhD,S,kBACG;AACpB8C,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
+ {"version":3,"sources":["VideoFeed.tsx"],"names":["NativeComponentName","VideoFeed","React","Component","createRef","FWLoggerUtil","log","JSON","stringify","props","nativeNodeHandle","nativeComponentRef","current","commandId","UIManager","getViewManagerConfig","Commands","refresh","Platform","OS","toString","dispatchViewManagerCommand","event","nativeEvent","onVideoFeedLoadFinished","name","reason","componentDidMount","subscriptionOfShareBaseURLUpdated","FireworkSDKModuleEventEmitter","addListener","FWEventName","ShareBaseURLUpdated","setState","subscriptions","push","subscriptionOfAdBadgeConfigurationUpdated","AdBadgeConfigurationUpdated","subscriptionOfAppLanguageUpdated","AppLanguageUpdated","componentWillUnmount","forEach","value","remove","render","source","channel","playlist","playlistGroup","mode","adConfiguration","enablePictureInPicture","videoFeedConfiguration","_getVideoFeedConfiguration","titleHidden","title","hidden","titlePosition","customLayoutName","shareBaseURL","FireworkSDK","getInstance","adBadgeConfiguration","adBadgeTextType","badgeTextType","backgroundColorOfAdBadge","backgroundColor","textColorOfAdBadge","textColor","dynamicContentParametersString","_generateDynamicContentParametersString","enableAutoplay","enablePictureInPictureLegacy","gridColumns","requiresAds","adsFetchTimeout","vastAttributesString","_generateVastAttributesString","showAdBadge","appLanguage","key","_onVideoFeedLoadFinished","Object","assign","style","zIndex","dynamicContentParameters","resultString","sortedKeyList","keys","sort","valueString","join","length","vastAttributes","attribute","Math","floor"],"mappings":";;;;;;;AAAA;;AAEA;;AAUA;;AAEA;;AAKA;;AACA;;AACA;;;;;;;;AAuDA,MAAMA,mBAAmB,GAAG,aAA5B;;AAEe,MAAMC,SAAN,SAAwBC,eAAMC,SAA9B,CAAyD;AAAA;AAAA;;AAAA,6DAKjDD,eAAME,SAAN,EALiD;;AAAA,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H,uBAAGA,eAAe,CAAE4C,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,CAACtE,IAAb,6DAAqB,EAAG,IAAGsE,SAAS,CAACrD,KAAM,EAA3D;AACD;;AAED,WAAO6C,YAAP;AACD;;AAEOlC,EAAAA,0BAA0B,GAAuC;AACvE,UAAM;AAAED,MAAAA;AAAF,QAA6B,KAAK3C,KAAxC;;AACA,QAAI,CAAC2C,sBAAL,EAA6B;AAC3B,aAAOA,sBAAP;AACD;;AAED,QACEA,sBAAsB,CAACqB,WAAvB,IACAuB,IAAI,CAACC,KAAL,CAAW7C,sBAAsB,CAACqB,WAAlC,MACErB,sBAAsB,CAACqB,WAH3B,EAIE;AACA,aAAO,EACL,GAAGrB,sBADE;AAELqB,QAAAA,WAAW,EAAEuB,IAAI,CAACC,KAAL,CAAW7C,sBAAsB,CAACqB,WAAlC;AAFR,OAAP;AAID,KATD,MASO;AACL,aAAOrB,sBAAP;AACD;AACF;;AArOqE;;;;gBAAnDnD,S,kBACG;AACpBgD,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 * Specifies if Picture in Picture is enabled. Only supported on iOS.\n */\n enablePictureInPicture?: boolean;\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 const subscriptionOfAppLanguageUpdated =\n FireworkSDKModuleEventEmitter.addListener(\n FWEventName.AppLanguageUpdated,\n () => {\n FWLoggerUtil.log('Receive FWEventName.AppLanguageUpdated');\n this.setState({});\n }\n );\n this.subscriptions.push(subscriptionOfAppLanguageUpdated);\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 enablePictureInPicture = false,\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\n let enablePictureInPictureLegacy = false;\n if (videoFeedConfiguration) {\n enablePictureInPictureLegacy =\n (videoFeedConfiguration as any).enablePictureInPicture ?? false;\n }\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 const appLanguage = FireworkSDK.getInstance().appLanguage;\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 += `_enablePictureInPictureLegacy:${enablePictureInPictureLegacy}`;\n key += `_gridColumns:${gridColumns}`;\n key += `_requiresAds:${requiresAds}`;\n key += `_adsFetchTimeout:${adsFetchTimeout}`;\n key += `_vastAttributes:${vastAttributesString}`;\n key += `_showAdBadge:${showAdBadge}`;\n key += `_appLanguage:${appLanguage}`;\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"]}
@@ -9,6 +9,12 @@ Object.defineProperty(exports, "FWNavigator", {
9
9
  return _FWNavigator.default;
10
10
  }
11
11
  });
12
+ Object.defineProperty(exports, "FireworkSDK", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _FireworkSDK.default;
16
+ }
17
+ });
12
18
  Object.defineProperty(exports, "LiveStream", {
13
19
  enumerable: true,
14
20
  get: function () {
@@ -1 +1 @@
1
- {"version":3,"sources":["index.tsx"],"names":["FireworkSDK"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AAEA;;AAOA;;AACA;;AAKA;;AAkBA;;AAEA;;AAoBA;;AAiBA;;;;eAEeA,oB","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
+ {"version":3,"sources":["index.ts"],"names":["FireworkSDK"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA;;AAEA;;AAOA;;AAEA;;AAKA;;AAyBA;;AAEA;;AAuBA;;AAkBA;;;;eAEeA,oB","sourcesContent":["import type { IStoryBlockProps } from './components/StoryBlock';\nimport 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 type { FWNativeContainerProps } from './FWNavigator';\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 CustomClickLinkButtonEvent,\n CustomCTAClickEvent,\n LiveStreamChatEvent,\n LiveStreamEvent,\n SDKInitEvent,\n UpdateProductDetailsEvent,\n VideoFeedClickEvent,\n VideoPlaybackEvent,\n WillDisplayProductEvent,\n} from './models/FWEvents';\nimport type IOSFontInfo from './models/IOSFontInfo';\nimport type {\n IOSSystemFontStyle,\n IOSSystemFontWeight,\n} from './models/IOSFontInfo';\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 {\n AddToCartButtonConfiguration,\n LinkButtonConfiguration,\n} 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 CustomClickLinkButtonCallback,\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 CustomClickLinkButtonCallback,\n CustomClickLinkButtonEvent,\n CustomCTAClickCallback,\n CustomCTAClickEvent,\n FeedItemDetails,\n FireworkSDK,\n FWError,\n FWNativeContainerProps,\n FWNavigator,\n IOSFontInfo,\n IOSSystemFontStyle,\n IOSSystemFontWeight,\n IStoryBlockProps,\n IVideoFeedProps,\n LinkButtonConfiguration,\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 VideoFeedClickEvent,\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"]}
@@ -20,6 +20,8 @@ exports.FWEventName = FWEventName;
20
20
  FWEventName["LiveStreamChat"] = "fw:livestream-chat";
21
21
  FWEventName["ShareBaseURLUpdated"] = "fw:share-base-url-updated";
22
22
  FWEventName["AdBadgeConfigurationUpdated"] = "fw:ad-badge-configuration-updated";
23
+ FWEventName["AppLanguageUpdated"] = "fw:app-language-updated";
23
24
  FWEventName["LogMessage"] = "fw:log-message";
25
+ FWEventName["CustomLinkButtonClick"] = "fw:shopping:custom-link-button-click";
24
26
  })(FWEventName || (exports.FWEventName = FWEventName = {}));
25
27
  //# sourceMappingURL=FWEventName.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["FWEventName.ts"],"names":["FWEventName"],"mappings":";;;;;;IAAYA,W;;;WAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;GAAAA,W,2BAAAA,W","sourcesContent":["export enum FWEventName {\n SDKInit = 'fw:sdk-init',\n CustomCTAClick = 'fw:custom-cta-click',\n VideoPlayback = 'fw:video-playback',\n VideoFeedClick = 'fw:video-feed-click',\n AddToCart = 'fw:shopping:add-to-cart',\n ClickCartIcon = 'fw:shopping:click-cart-icon',\n UpdateProductDetails = 'fw:shopping:update-product-details',\n WillDisplayProduct = 'fw:shopping:will-display-product',\n LiveStream = 'fw:livestream',\n LiveStreamChat = 'fw:livestream-chat',\n ShareBaseURLUpdated = 'fw:share-base-url-updated',\n AdBadgeConfigurationUpdated = 'fw:ad-badge-configuration-updated',\n LogMessage = 'fw:log-message',\n}\n"]}
1
+ {"version":3,"sources":["FWEventName.ts"],"names":["FWEventName"],"mappings":";;;;;;IAAYA,W;;;WAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;GAAAA,W,2BAAAA,W","sourcesContent":["export enum FWEventName {\n SDKInit = 'fw:sdk-init',\n CustomCTAClick = 'fw:custom-cta-click',\n VideoPlayback = 'fw:video-playback',\n VideoFeedClick = 'fw:video-feed-click',\n AddToCart = 'fw:shopping:add-to-cart',\n ClickCartIcon = 'fw:shopping:click-cart-icon',\n UpdateProductDetails = 'fw:shopping:update-product-details',\n WillDisplayProduct = 'fw:shopping:will-display-product',\n LiveStream = 'fw:livestream',\n LiveStreamChat = 'fw:livestream-chat',\n ShareBaseURLUpdated = 'fw:share-base-url-updated',\n AdBadgeConfigurationUpdated = 'fw:ad-badge-configuration-updated',\n AppLanguageUpdated = 'fw:app-language-updated',\n LogMessage = 'fw:log-message',\n CustomLinkButtonClick = 'fw:shopping:custom-link-button-click',\n}\n"]}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ //# sourceMappingURL=IOSFontInfo.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
@@ -1 +1 @@
1
- {"version":3,"sources":["FWNavigatorModule.ts"],"names":["FWNavigatorModule","NativeModules","Proxy","get","Error","LINKING_ERROR","FWNavigatorModuleEventEmitter","NativeEventEmitter"],"mappings":";;;;;;;AAAA;;AAEA;;AAEA,MAAMA,iBAAiB,GAAGC,2BAAcD,iBAAd,GACtBC,2BAAcD,iBADQ,GAEtB,IAAIE,KAAJ,CACE,EADF,EAEE;AACEC,EAAAA,GAAG,GAAG;AACJ,UAAM,IAAIC,KAAJ,CAAUC,6BAAV,CAAN;AACD;;AAHH,CAFF,CAFJ;AAgBA,MAAMC,6BAA6B,GAAG,IAAIC,+BAAJ,CAAuBP,iBAAvB,CAAtC;;eAEeA,iB","sourcesContent":["import { NativeEventEmitter, NativeModule } from 'react-native';\nimport { NativeModules } from 'react-native';\nimport { LINKING_ERROR } from '../constants/FWErrorMessage';\n\nconst FWNavigatorModule = NativeModules.FWNavigatorModule\n ? NativeModules.FWNavigatorModule\n : new Proxy(\n {},\n {\n get() {\n throw new Error(LINKING_ERROR);\n },\n }\n );\ninterface IFWNavigatorModule extends NativeModule {\n pushNativeContainer(props: { [key: string]: any }): Promise<boolean>;\n popNativeContainer(): Promise<boolean>;\n canPopNativeContainer(): Promise<boolean>;\n}\n\nconst FWNavigatorModuleEventEmitter = new NativeEventEmitter(FWNavigatorModule);\nexport { FWNavigatorModuleEventEmitter };\nexport default FWNavigatorModule as IFWNavigatorModule;\n"]}
1
+ {"version":3,"sources":["FWNavigatorModule.ts"],"names":["FWNavigatorModule","NativeModules","Proxy","get","Error","LINKING_ERROR","FWNavigatorModuleEventEmitter","NativeEventEmitter"],"mappings":";;;;;;;AAAA;;AAEA;;AAEA,MAAMA,iBAAiB,GAAGC,2BAAcD,iBAAd,GACtBC,2BAAcD,iBADQ,GAEtB,IAAIE,KAAJ,CACE,EADF,EAEE;AACEC,EAAAA,GAAG,GAAG;AACJ,UAAM,IAAIC,KAAJ,CAAUC,6BAAV,CAAN;AACD;;AAHH,CAFF,CAFJ;AAkBA,MAAMC,6BAA6B,GAAG,IAAIC,+BAAJ,CAAuBP,iBAAvB,CAAtC;;eAEeA,iB","sourcesContent":["import { NativeEventEmitter, NativeModule } from 'react-native';\nimport { NativeModules } from 'react-native';\nimport { LINKING_ERROR } from '../constants/FWErrorMessage';\n\nconst FWNavigatorModule = NativeModules.FWNavigatorModule\n ? NativeModules.FWNavigatorModule\n : new Proxy(\n {},\n {\n get() {\n throw new Error(LINKING_ERROR);\n },\n }\n );\ninterface IFWNavigatorModule extends NativeModule {\n pushNativeContainer(props: { [key: string]: any }): Promise<boolean>;\n popNativeContainer(): Promise<boolean>;\n canPopNativeContainer(): Promise<boolean>;\n startFloatingPlayer(): Promise<boolean>;\n stopFloatingPlayer(): Promise<boolean>;\n}\n\nconst FWNavigatorModuleEventEmitter = new NativeEventEmitter(FWNavigatorModule);\nexport { FWNavigatorModuleEventEmitter };\nexport default FWNavigatorModule as IFWNavigatorModule;\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["ShoppingModule.ts"],"names":["ShoppingModule","NativeModules","Proxy","get","Error","LINKING_ERROR","ShoppingModuleEventEmitter","NativeEventEmitter"],"mappings":";;;;;;;AAAA;;AAEA;;AAKA,MAAMA,cAAc,GAAGC,2BAAcD,cAAd,GACnBC,2BAAcD,cADK,GAEnB,IAAIE,KAAJ,CACE,EADF,EAEE;AACEC,EAAAA,GAAG,GAAG;AACJ,UAAM,IAAIC,KAAJ,CAAUC,6BAAV,CAAN;AACD;;AAHH,CAFF,CAFJ;AAiCA,MAAMC,0BAA0B,GAAG,IAAIC,+BAAJ,CAAuBP,cAAvB,CAAnC;;eAGeA,c","sourcesContent":["import { NativeEventEmitter, NativeModule, NativeModules } from 'react-native';\n\nimport { LINKING_ERROR } from '../constants/FWErrorMessage';\nimport type { NewNativeContainerProps } from '../models/NewNativeContainerProps';\nimport type Product from '../models/Product';\nimport type ProductInfoViewConfiguration from '../models/ProductInfoViewConfiguration';\n\nconst ShoppingModule = NativeModules.ShoppingModule\n ? NativeModules.ShoppingModule\n : new Proxy(\n {},\n {\n get() {\n throw new Error(LINKING_ERROR);\n },\n }\n );\n\ninterface IShoppingModule extends NativeModule {\n init(): void;\n updateVideoProducts(products: Product[], callbackId: number | string): void;\n updateProductViewConfig(\n config: ProductInfoViewConfiguration,\n callbackId: number | string\n ): void;\n updateAddToCartStatus(\n res: string,\n tips: string,\n callbackId: number | string\n ): void;\n jumpToCartPage(\n callbackId: number | string,\n props: NewNativeContainerProps\n ): void;\n setCartIconVisible(visible: boolean): void;\n setCartItemCount(count: number): void;\n setCustomClickCartIconEnabled(enabled: boolean): Promise<void>; // Only supported on iOS\n clearCallbackId(callbackId: number | string, eventName: string): void; // Only supported on iOS\n}\n\nconst ShoppingModuleEventEmitter = new NativeEventEmitter(ShoppingModule);\nexport { ShoppingModuleEventEmitter };\n\nexport default ShoppingModule as IShoppingModule;\n"]}
1
+ {"version":3,"sources":["ShoppingModule.ts"],"names":["ShoppingModule","NativeModules","Proxy","get","Error","LINKING_ERROR","ShoppingModuleEventEmitter","NativeEventEmitter"],"mappings":";;;;;;;AAAA;;AAEA;;AAKA,MAAMA,cAAc,GAAGC,2BAAcD,cAAd,GACnBC,2BAAcD,cADK,GAEnB,IAAIE,KAAJ,CACE,EADF,EAEE;AACEC,EAAAA,GAAG,GAAG;AACJ,UAAM,IAAIC,KAAJ,CAAUC,6BAAV,CAAN;AACD;;AAHH,CAFF,CAFJ;AA+BA,MAAMC,0BAA0B,GAAG,IAAIC,+BAAJ,CAAuBP,cAAvB,CAAnC;;eAGeA,c","sourcesContent":["import { NativeEventEmitter, NativeModule, NativeModules } from 'react-native';\n\nimport { LINKING_ERROR } from '../constants/FWErrorMessage';\nimport type { NewNativeContainerProps } from '../models/NewNativeContainerProps';\nimport type Product from '../models/Product';\nimport type ProductInfoViewConfiguration from '../models/ProductInfoViewConfiguration';\n\nconst ShoppingModule = NativeModules.ShoppingModule\n ? NativeModules.ShoppingModule\n : new Proxy(\n {},\n {\n get() {\n throw new Error(LINKING_ERROR);\n },\n }\n );\n\ninterface IShoppingModule extends NativeModule {\n init(): void;\n updateVideoProducts(products: Product[], callbackId: number | string): void;\n updateAddToCartStatus(\n res: string,\n tips: string,\n callbackId: number | string\n ): void;\n jumpToCartPage(\n callbackId: number | string,\n props: NewNativeContainerProps\n ): void;\n setCartIconVisible(visible: boolean): void;\n setCartItemCount(count: number): void;\n setCustomClickCartIconEnabled(enabled: boolean): Promise<void>; // Only supported on iOS\n clearCallbackId(callbackId: number | string, eventName: string): void; // Only supported on iOS\n setProductInfoViewConfiguration(config: ProductInfoViewConfiguration): void; // Only supported on iOS\n setCustomClickLinkButtonEnabled(enabled: boolean): Promise<void>; // Only supported on Android\n}\n\nconst ShoppingModuleEventEmitter = new NativeEventEmitter(ShoppingModule);\nexport { ShoppingModuleEventEmitter };\n\nexport default ShoppingModule as IShoppingModule;\n"]}
@@ -1,5 +1,6 @@
1
1
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2
2
 
3
+ import { Platform } from 'react-native';
3
4
  import { FWEventName } from './models/FWEventName';
4
5
  import FWNavigatorModule, { FWNavigatorModuleEventEmitter } from './modules/FWNavigatorModule';
5
6
  import FWLoggerUtil from './utils/FWLoggerUtil';
@@ -25,6 +26,8 @@ class FWNavigator {
25
26
  * Please set your app component name through FireworkSDK.getInstance().appComponentName before calling this method
26
27
  * @param {FWNativeContainerProps} props We will pass the props to your app component.
27
28
  * @returns {Promise<boolean>} The result of pushing RN page from native page.
29
+ *
30
+ * @deprecated The property will be deprecated since RN SDK V2.
28
31
  */
29
32
 
30
33
 
@@ -43,13 +46,40 @@ class FWNavigator {
43
46
  }
44
47
  /**
45
48
  * Indicate if we can pop top-most native container.
46
- * @returns {Promise<boolean>} If the result is true, we could call popNativeContainer to pop top-most native container.
49
+ * @returns {Promise<boolean>} If the result is true,
50
+ * we could call popNativeContainer to pop top-most native container.
51
+ *
52
+ * @deprecated The property will be deprecated since RN SDK V2.
47
53
  */
48
54
 
49
55
 
50
56
  canPopNativeContainer() {
51
57
  return FWNavigatorModule.canPopNativeContainer();
52
58
  }
59
+ /**
60
+ * Change current fullscreen player to floating player.
61
+ * @returns {Promise<boolean>} If the result is true, it means that the fullscreen
62
+ * player is changed to floating player. Only supported on iOS.
63
+ */
64
+
65
+
66
+ async startFloatingPlayer() {
67
+ if (Platform.OS === 'ios') {
68
+ return FWNavigatorModule.startFloatingPlayer();
69
+ }
70
+
71
+ return true;
72
+ }
73
+ /**
74
+ * Stop current floating player. Only supported on iOS.
75
+ */
76
+
77
+
78
+ async stopFloatingPlayer() {
79
+ if (Platform.OS === 'ios') {
80
+ await FWNavigatorModule.stopFloatingPlayer();
81
+ }
82
+ }
53
83
 
54
84
  }
55
85
 
@@ -1 +1 @@
1
- {"version":3,"sources":["FWNavigator.tsx"],"names":["FWEventName","FWNavigatorModule","FWNavigatorModuleEventEmitter","FWLoggerUtil","FWNavigator","getInstance","_instance","constructor","log","addListener","LogMessage","pushNativeContainer","props","popNativeContainer","canPopNativeContainer"],"mappings":";;AAAA,SAASA,WAAT,QAA4B,sBAA5B;AACA,OAAOC,iBAAP,IACEC,6BADF,QAEO,6BAFP;AAGA,OAAOC,YAAP,MAAyB,sBAAzB;;AAMA;AACA;AACA;AACA,MAAMC,WAAN,CAAkB;AAGS,SAAXC,WAAW,GAAgB;AACvC,QAAI,CAACD,WAAW,CAACE,SAAjB,EAA4B;AAC1BF,MAAAA,WAAW,CAACE,SAAZ,GAAwB,IAAIF,WAAJ,EAAxB;AACD;;AACD,WAAOA,WAAW,CAACE,SAAnB;AACD;;AAEOC,EAAAA,WAAW,GAAG;AACpBJ,IAAAA,YAAY,CAACK,GAAb,CAAiB,yBAAjB;AACAN,IAAAA,6BAA6B,CAACO,WAA9B,CAA0CT,WAAW,CAACU,UAAtD,EAAkE,MAAM,CAAE,CAA1E;AACD;AAED;AACF;AACA;AACA;AACA;AACA;;;AACSC,EAAAA,mBAAmB,CAACC,KAAD,EAAkD;AAC1ET,IAAAA,YAAY,CAACK,GAAb,CAAkB,8BAAlB;AAEA,WAAOP,iBAAiB,CAACU,mBAAlB,CAAsCC,KAAtC,CAAP;AACD;AAED;AACF;AACA;AACA;;;AACSC,EAAAA,kBAAkB,GAAqB;AAC5C,WAAOZ,iBAAiB,CAACY,kBAAlB,EAAP;AACD;AAED;AACF;AACA;AACA;;;AACSC,EAAAA,qBAAqB,GAAqB;AAC/C,WAAOb,iBAAiB,CAACa,qBAAlB,EAAP;AACD;;AAzCe;;gBAAZV,W;;AA4CN,eAAeA,WAAf","sourcesContent":["import { FWEventName } from './models/FWEventName';\nimport FWNavigatorModule, {\n FWNavigatorModuleEventEmitter,\n} from './modules/FWNavigatorModule';\nimport FWLoggerUtil from './utils/FWLoggerUtil';\n\ntype FWNativeContainerProps = {\n [key: string]: any;\n};\n\n/**\n * You can use this class for pushing RN page from the native page.\n */\nclass FWNavigator {\n private static _instance?: FWNavigator;\n\n public static getInstance(): FWNavigator {\n if (!FWNavigator._instance) {\n FWNavigator._instance = new FWNavigator();\n }\n return FWNavigator._instance!;\n }\n\n private constructor() {\n FWLoggerUtil.log('FWNavigator constructor');\n FWNavigatorModuleEventEmitter.addListener(FWEventName.LogMessage, () => {});\n }\n\n /**\n * Push a new native container. We will render your app component in new native container.\n * Please set your app component name through FireworkSDK.getInstance().appComponentName before calling this method\n * @param {FWNativeContainerProps} props We will pass the props to your app component.\n * @returns {Promise<boolean>} The result of pushing RN page from native page.\n */\n public pushNativeContainer(props: FWNativeContainerProps): Promise<boolean> {\n FWLoggerUtil.log(`Enter pushNewNativeContainer`);\n\n return FWNavigatorModule.pushNativeContainer(props);\n }\n\n /**\n * Pop top-most native container.\n * @returns {Promise<boolean>} The result of poping top-most native container.\n */\n public popNativeContainer(): Promise<boolean> {\n return FWNavigatorModule.popNativeContainer();\n }\n\n /**\n * Indicate if we can pop top-most native container.\n * @returns {Promise<boolean>} If the result is true, we could call popNativeContainer to pop top-most native container.\n */\n public canPopNativeContainer(): Promise<boolean> {\n return FWNavigatorModule.canPopNativeContainer();\n }\n}\n\nexport default FWNavigator;\n"]}
1
+ {"version":3,"sources":["FWNavigator.ts"],"names":["Platform","FWEventName","FWNavigatorModule","FWNavigatorModuleEventEmitter","FWLoggerUtil","FWNavigator","getInstance","_instance","constructor","log","addListener","LogMessage","pushNativeContainer","props","popNativeContainer","canPopNativeContainer","startFloatingPlayer","OS","stopFloatingPlayer"],"mappings":";;AAAA,SAASA,QAAT,QAAyB,cAAzB;AACA,SAASC,WAAT,QAA4B,sBAA5B;AACA,OAAOC,iBAAP,IACEC,6BADF,QAEO,6BAFP;AAGA,OAAOC,YAAP,MAAyB,sBAAzB;;AAMA;AACA;AACA;AACA,MAAMC,WAAN,CAAkB;AAGS,SAAXC,WAAW,GAAgB;AACvC,QAAI,CAACD,WAAW,CAACE,SAAjB,EAA4B;AAC1BF,MAAAA,WAAW,CAACE,SAAZ,GAAwB,IAAIF,WAAJ,EAAxB;AACD;;AACD,WAAOA,WAAW,CAACE,SAAnB;AACD;;AAEOC,EAAAA,WAAW,GAAG;AACpBJ,IAAAA,YAAY,CAACK,GAAb,CAAiB,yBAAjB;AACAN,IAAAA,6BAA6B,CAACO,WAA9B,CAA0CT,WAAW,CAACU,UAAtD,EAAkE,MAAM,CAAE,CAA1E;AACD;AAED;AACF;AACA;AACA;AACA;AACA;AACA;AACA;;;AACSC,EAAAA,mBAAmB,CAACC,KAAD,EAAkD;AAC1ET,IAAAA,YAAY,CAACK,GAAb,CAAkB,8BAAlB;AAEA,WAAOP,iBAAiB,CAACU,mBAAlB,CAAsCC,KAAtC,CAAP;AACD;AAED;AACF;AACA;AACA;;;AACSC,EAAAA,kBAAkB,GAAqB;AAC5C,WAAOZ,iBAAiB,CAACY,kBAAlB,EAAP;AACD;AAED;AACF;AACA;AACA;AACA;AACA;AACA;;;AACSC,EAAAA,qBAAqB,GAAqB;AAC/C,WAAOb,iBAAiB,CAACa,qBAAlB,EAAP;AACD;AAED;AACF;AACA;AACA;AACA;;;AACkC,QAAnBC,mBAAmB,GAAqB;AACnD,QAAIhB,QAAQ,CAACiB,EAAT,KAAgB,KAApB,EAA2B;AACzB,aAAOf,iBAAiB,CAACc,mBAAlB,EAAP;AACD;;AAED,WAAO,IAAP;AACD;AAED;AACF;AACA;;;AACiC,QAAlBE,kBAAkB,GAAkB;AAC/C,QAAIlB,QAAQ,CAACiB,EAAT,KAAgB,KAApB,EAA2B;AACzB,YAAMf,iBAAiB,CAACgB,kBAAlB,EAAN;AACD;AACF;;AApEe;;gBAAZb,W;;AAuEN,eAAeA,WAAf","sourcesContent":["import { Platform } from 'react-native';\nimport { FWEventName } from './models/FWEventName';\nimport FWNavigatorModule, {\n FWNavigatorModuleEventEmitter,\n} from './modules/FWNavigatorModule';\nimport FWLoggerUtil from './utils/FWLoggerUtil';\n\nexport type FWNativeContainerProps = {\n [key: string]: any;\n};\n\n/**\n * You can use this class for pushing RN page from the native page.\n */\nclass FWNavigator {\n private static _instance?: FWNavigator;\n\n public static getInstance(): FWNavigator {\n if (!FWNavigator._instance) {\n FWNavigator._instance = new FWNavigator();\n }\n return FWNavigator._instance!;\n }\n\n private constructor() {\n FWLoggerUtil.log('FWNavigator constructor');\n FWNavigatorModuleEventEmitter.addListener(FWEventName.LogMessage, () => {});\n }\n\n /**\n * Push a new native container. We will render your app component in new native container.\n * Please set your app component name through FireworkSDK.getInstance().appComponentName before calling this method\n * @param {FWNativeContainerProps} props We will pass the props to your app component.\n * @returns {Promise<boolean>} The result of pushing RN page from native page.\n *\n * @deprecated The property will be deprecated since RN SDK V2.\n */\n public pushNativeContainer(props: FWNativeContainerProps): Promise<boolean> {\n FWLoggerUtil.log(`Enter pushNewNativeContainer`);\n\n return FWNavigatorModule.pushNativeContainer(props);\n }\n\n /**\n * Pop top-most native container.\n * @returns {Promise<boolean>} The result of poping top-most native container.\n */\n public popNativeContainer(): Promise<boolean> {\n return FWNavigatorModule.popNativeContainer();\n }\n\n /**\n * Indicate if we can pop top-most native container.\n * @returns {Promise<boolean>} If the result is true,\n * we could call popNativeContainer to pop top-most native container.\n *\n * @deprecated The property will be deprecated since RN SDK V2.\n */\n public canPopNativeContainer(): Promise<boolean> {\n return FWNavigatorModule.canPopNativeContainer();\n }\n\n /**\n * Change current fullscreen player to floating player.\n * @returns {Promise<boolean>} If the result is true, it means that the fullscreen\n * player is changed to floating player. Only supported on iOS.\n */\n public async startFloatingPlayer(): Promise<boolean> {\n if (Platform.OS === 'ios') {\n return FWNavigatorModule.startFloatingPlayer();\n }\n\n return true;\n }\n\n /**\n * Stop current floating player. Only supported on iOS.\n */\n public async stopFloatingPlayer(): Promise<void> {\n if (Platform.OS === 'ios') {\n await FWNavigatorModule.stopFloatingPlayer();\n }\n }\n}\n\nexport default FWNavigator;\n"]}
@@ -61,15 +61,17 @@ class FireworkSDK {
61
61
 
62
62
  /**
63
63
  * The share base URL of videos.
64
+ * The set accessor is async.
64
65
  */
65
66
  get shareBaseURL() {
66
67
  return this._shareBaseURL;
67
68
  }
68
69
 
69
70
  set shareBaseURL(value) {
70
- const valueHasChanged = this._shareBaseURL !== value;
71
- this._shareBaseURL = value;
72
71
  FireworkSDKModule.setShareBaseURL(value !== null && value !== void 0 ? value : '').then(() => {
72
+ const valueHasChanged = this._shareBaseURL !== value;
73
+ this._shareBaseURL = value;
74
+
73
75
  if (valueHasChanged) {
74
76
  this.eventEmitter.emit(FWEventName.ShareBaseURLUpdated);
75
77
  }
@@ -78,17 +80,19 @@ class FireworkSDK {
78
80
 
79
81
  /**
80
82
  * The configuration for ad badges.
83
+ * The set accessor is async.
81
84
  */
82
85
  get adBadgeConfiguration() {
83
86
  return this._adBadgeConfiguration;
84
87
  }
85
88
 
86
89
  set adBadgeConfiguration(value) {
87
- var _this$_adBadgeConfigu, _this$_adBadgeConfigu2, _this$_adBadgeConfigu3;
88
-
89
- const valueHasChanged = ((_this$_adBadgeConfigu = this._adBadgeConfiguration) === null || _this$_adBadgeConfigu === void 0 ? void 0 : _this$_adBadgeConfigu.badgeTextType) !== (value === null || value === void 0 ? void 0 : value.badgeTextType) || ((_this$_adBadgeConfigu2 = this._adBadgeConfiguration) === null || _this$_adBadgeConfigu2 === void 0 ? void 0 : _this$_adBadgeConfigu2.backgroundColor) !== (value === null || value === void 0 ? void 0 : value.backgroundColor) || ((_this$_adBadgeConfigu3 = this._adBadgeConfiguration) === null || _this$_adBadgeConfigu3 === void 0 ? void 0 : _this$_adBadgeConfigu3.textColor) !== (value === null || value === void 0 ? void 0 : value.textColor);
90
- this._adBadgeConfiguration = value;
91
90
  FireworkSDKModule.setAdBadgeConfiguration(value !== null && value !== void 0 ? value : {}).then(() => {
91
+ var _this$_adBadgeConfigu, _this$_adBadgeConfigu2, _this$_adBadgeConfigu3;
92
+
93
+ const valueHasChanged = ((_this$_adBadgeConfigu = this._adBadgeConfiguration) === null || _this$_adBadgeConfigu === void 0 ? void 0 : _this$_adBadgeConfigu.badgeTextType) !== (value === null || value === void 0 ? void 0 : value.badgeTextType) || ((_this$_adBadgeConfigu2 = this._adBadgeConfiguration) === null || _this$_adBadgeConfigu2 === void 0 ? void 0 : _this$_adBadgeConfigu2.backgroundColor) !== (value === null || value === void 0 ? void 0 : value.backgroundColor) || ((_this$_adBadgeConfigu3 = this._adBadgeConfiguration) === null || _this$_adBadgeConfigu3 === void 0 ? void 0 : _this$_adBadgeConfigu3.textColor) !== (value === null || value === void 0 ? void 0 : value.textColor);
94
+ this._adBadgeConfiguration = value;
95
+
92
96
  if (valueHasChanged) {
93
97
  this.eventEmitter.emit(FWEventName.AdBadgeConfigurationUpdated);
94
98
  }
@@ -107,6 +111,10 @@ class FireworkSDK {
107
111
  FireworkSDKModule.setAppComponentName(value !== null && value !== void 0 ? value : '');
108
112
  }
109
113
 
114
+ get appLanguage() {
115
+ return this._appLanguage;
116
+ }
117
+
110
118
  /**
111
119
  * Defaults to false. You can enable debug logs by setting this property to true.
112
120
  */
@@ -173,6 +181,8 @@ class FireworkSDK {
173
181
 
174
182
  _defineProperty(this, "_appComponentName", void 0);
175
183
 
184
+ _defineProperty(this, "_appLanguage", void 0);
185
+
176
186
  _defineProperty(this, "_shopping", VideoShopping.getInstance());
177
187
 
178
188
  _defineProperty(this, "_liveStream", LiveStream.getInstance());
@@ -246,19 +256,25 @@ class FireworkSDK {
246
256
  }
247
257
  }
248
258
  /**
249
- * Change App level language. Only supported on Android.
259
+ * Change App level language.
250
260
  * @param {string} language Such as en, ar and en-US
251
261
  * @returns
252
262
  */
253
263
 
254
264
 
255
265
  async changeAppLanguage(language) {
256
- if (Platform.OS === 'android') {
257
- const result = await FireworkSDKModule.changeAppLanguage(language);
258
- return result;
266
+ const result = await FireworkSDKModule.changeAppLanguage(language);
267
+
268
+ if (result) {
269
+ const valueHasChanged = this._appLanguage !== language;
270
+ this._appLanguage = language;
271
+
272
+ if (valueHasChanged) {
273
+ this.eventEmitter.emit(FWEventName.AppLanguageUpdated);
274
+ }
259
275
  }
260
276
 
261
- return false;
277
+ return result;
262
278
  }
263
279
 
264
280
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["FireworkSDK.ts"],"names":["Platform","FWNavigator","LiveStream","FWEventName","FireworkSDKModule","FireworkSDKModuleEventEmitter","LiveStreamModule","ShoppingModule","FWLoggerUtil","VideoShopping","FireworkSDK","onCustomCTAClick","_onCustomCTAClick","value","log","setCustomCTAClickEnabled","customCTALinkContentPageRouteName","_customCTALinkContentPageRouteName","setCustomCTALinkContentPageRouteName","onVideoPlayback","_onVideoPlayback","setVideoPlaybackEventEnabled","shareBaseURL","_shareBaseURL","valueHasChanged","setShareBaseURL","then","eventEmitter","emit","ShareBaseURLUpdated","adBadgeConfiguration","_adBadgeConfiguration","badgeTextType","backgroundColor","textColor","setAdBadgeConfiguration","AdBadgeConfigurationUpdated","appComponentName","_appComponentName","setAppComponentName","debugLogsEnabled","enabled","shopping","_shopping","liveStream","_liveStream","navigator","_navigator","getInstance","_instance","constructor","addListener","SDKInit","event","error","onSDKInit","LogMessage","logNativeMessage","message","CustomCTAClick","url","VideoPlayback","eventName","VideoFeedClick","info","id","onVideoFeedClick","init","userId","openVideoPlayer","config","trackPurchase","parameters","OS","changeAppLanguage","language","result"],"mappings":";;AAAA,SAA6BA,QAA7B,QAA6C,cAA7C;AAEA,OAAOC,WAAP,MAAwB,eAAxB;AACA,OAAOC,UAAP,MAAuB,cAAvB;AAEA,SAASC,WAAT,QAA4B,sBAA5B;AASA,OAAOC,iBAAP,IACEC,6BADF,QAEO,6BAFP;AAGA,OAAOC,gBAAP,MAA6B,4BAA7B;AACA,OAAOC,cAAP,MAA2B,0BAA3B;AACA,OAAOC,YAAP,MAAyB,sBAAzB;AACA,OAAOC,aAAP,MAA0B,iBAA1B;;AAOA;AACA;AACA;AACA,MAAMC,WAAN,CAAkB;AAGhB;AACF;AACA;;AAGE;AACF;AACA;;AAGE;AACF;AACA;AAC6B,MAAhBC,gBAAgB,GAAuC;AAChE,WAAO,KAAKC,iBAAZ;AACD;;AAC0B,MAAhBD,gBAAgB,CAACE,KAAD,EAA4C;AACrEL,IAAAA,YAAY,CAACM,GAAb,CAAkB,iCAAgC,CAAC,CAACD,KAAM,EAA1D;AACA,SAAKD,iBAAL,GAAyBC,KAAzB;AACAT,IAAAA,iBAAiB,CAACW,wBAAlB,CAA2CF,KAAK,GAAG,IAAH,GAAU,KAA1D;AACD;;AAGD;AACF;AACA;AAC8C,MAAjCG,iCAAiC,GAAuB;AACjE,WAAO,KAAKC,kCAAZ;AACD;;AAC2C,MAAjCD,iCAAiC,CAACH,KAAD,EAA4B;AACtE,SAAKI,kCAAL,GAA0CJ,KAA1C;AACAT,IAAAA,iBAAiB,CAACc,oCAAlB,CAAuDL,KAAvD,aAAuDA,KAAvD,cAAuDA,KAAvD,GAAgE,EAAhE;AACD;;AAGD;AACF;AACA;AAC4B,MAAfM,eAAe,GAAsC;AAC9D,WAAO,KAAKC,gBAAZ;AACD;;AACyB,MAAfD,eAAe,CAACN,KAAD,EAA2C;AACnE,SAAKO,gBAAL,GAAwBP,KAAxB;AACAT,IAAAA,iBAAiB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AAW;AACnE7C,MAAAA,YAAY,CAACM,GAAb,CAAkB,oCAAmCuC,KAApC,aAAoCA,KAApC,uBAAoCA,KAAK,CAAEW,IAAP,CAAYC,EAAG,EAApE;;AAEA,UAAI,KAAKC,gBAAT,EAA2B;AACzB,aAAKA,gBAAL,CAAsBb,KAAtB,aAAsBA,KAAtB,cAAsBA,KAAtB,GAA+B,EAA/B;AACD;AACF,KAND;AAOD;AAED;AACF;AACA;AACA;;;AACSc,EAAAA,IAAI,CAACC,MAAD,EAAkB;AAC3B5D,IAAAA,YAAY,CAACM,GAAb,CAAiB,8BAAjB;AAEAV,IAAAA,iBAAiB,CAAC+D,IAAlB,CAAuBC,MAAvB;AACA7D,IAAAA,cAAc,CAAC4D,IAAf;AACA7D,IAAAA,gBAAgB,CAAC6D,IAAjB;AACD;AAED;AACF;AACA;AACA;AACA;;;AACSE,EAAAA,eAAe,CAACT,GAAD,EAAcU,MAAd,EAAiD;AACrElE,IAAAA,iBAAiB,CAACiE,eAAlB,CAAkCT,GAAlC,EAAuCU,MAAvC,aAAuCA,MAAvC,cAAuCA,MAAvC,GAAiD,EAAjD;AACD;AAED;AACF;AACA;AACA;;;AACSC,EAAAA,aAAa,CAACC,UAAD,EAAsC;AACxD,QAAIxE,QAAQ,CAACyE,EAAT,KAAgB,KAApB,EAA2B;AACzBrE,MAAAA,iBAAiB,CAACmE,aAAlB,CAAgCC,UAAhC;AACD;AACF;AAED;AACF;AACA;AACA;AACA;;;AACgC,QAAjBE,iBAAiB,CAACC,QAAD,EAAqC;AACjE,QAAI3E,QAAQ,CAACyE,EAAT,KAAgB,SAApB,EAA+B;AAC7B,YAAMG,MAAM,GAAG,MAAMxE,iBAAiB,CAACsE,iBAAlB,CAAoCC,QAApC,CAArB;AACA,aAAOC,MAAP;AACD;;AAED,WAAO,KAAP;AACD;;AAzOe;;gBAAZlE,W;;AA4ON,eAAeA,WAAf","sourcesContent":["import { NativeEventEmitter, Platform } from 'react-native';\n\nimport FWNavigator from './FWNavigator';\nimport LiveStream from './LiveStream';\nimport type AdBadgeConfiguration from './models/AdBadgeConfiguration';\nimport { FWEventName } from './models/FWEventName';\nimport type {\n CustomCTAClickEvent,\n SDKInitEvent,\n VideoFeedClickEvent,\n VideoPlaybackEvent,\n} from './models/FWEvents';\nimport type TrackPurchaseParameters from './models/TrackPurchaseParameters';\nimport type VideoPlayerConfiguration from './models/VideoPlayerConfiguration';\nimport FireworkSDKModule, {\n FireworkSDKModuleEventEmitter,\n} from './modules/FireworkSDKModule';\nimport LiveStreamModule from './modules/LiveStreamModule';\nimport ShoppingModule from './modules/ShoppingModule';\nimport FWLoggerUtil from './utils/FWLoggerUtil';\nimport VideoShopping from './VideoShopping';\n\nexport type SDKInitCallback = (event: SDKInitEvent) => void;\nexport type CustomCTAClickCallback = (event: CustomCTAClickEvent) => void;\nexport type VideoPlaybackCallback = (event: VideoPlaybackEvent) => void;\nexport type VideoFeedClickCallback = (event: VideoFeedClickEvent) => void;\n\n/**\n * Entry class of Firework SDK, which supports the sdk initialization and global configuration.\n */\nclass FireworkSDK {\n private static _instance?: FireworkSDK;\n\n /**\n * The callback of SDK initialization.\n */\n public onSDKInit?: SDKInitCallback;\n\n /**\n * the callback of clicking Video Feed.\n */\n public onVideoFeedClick?: VideoFeedClickCallback;\n\n /**\n * The callback of clicking custom CTA.\n */\n public get onCustomCTAClick(): CustomCTAClickCallback | undefined {\n return this._onCustomCTAClick;\n }\n public set onCustomCTAClick(value: CustomCTAClickCallback | undefined) {\n FWLoggerUtil.log(`Set onCustomCTAClick callback ${!!value}`);\n this._onCustomCTAClick = value;\n FireworkSDKModule.setCustomCTAClickEnabled(value ? true : false);\n }\n private _onCustomCTAClick: CustomCTAClickCallback | undefined;\n\n /**\n * The custom CTA link content page route name.\n */\n public get customCTALinkContentPageRouteName(): string | undefined {\n return this._customCTALinkContentPageRouteName;\n }\n public set customCTALinkContentPageRouteName(value: string | undefined) {\n this._customCTALinkContentPageRouteName = value;\n FireworkSDKModule.setCustomCTALinkContentPageRouteName(value ?? '');\n }\n private _customCTALinkContentPageRouteName: string | undefined;\n\n /**\n * The callback of video playback.\n */\n public get onVideoPlayback(): VideoPlaybackCallback | undefined {\n return this._onVideoPlayback;\n }\n public set onVideoPlayback(value: VideoPlaybackCallback | undefined) {\n this._onVideoPlayback = value;\n FireworkSDKModule.setVideoPlaybackEventEnabled(value ? true : false);\n }\n private _onVideoPlayback?: VideoPlaybackCallback | undefined;\n\n /**\n * The share base URL of videos.\n */\n public get shareBaseURL(): string | undefined {\n return this._shareBaseURL;\n }\n public set shareBaseURL(value: string | undefined) {\n const valueHasChanged = this._shareBaseURL !== value;\n this._shareBaseURL = value;\n FireworkSDKModule.setShareBaseURL(value ?? '').then(() => {\n if (valueHasChanged) {\n this.eventEmitter.emit(FWEventName.ShareBaseURLUpdated);\n }\n });\n }\n private _shareBaseURL: string | undefined;\n\n /**\n * The configuration for ad badges.\n */\n public get adBadgeConfiguration(): AdBadgeConfiguration | undefined {\n return this._adBadgeConfiguration;\n }\n public set adBadgeConfiguration(value: AdBadgeConfiguration | undefined) {\n const valueHasChanged =\n this._adBadgeConfiguration?.badgeTextType !== value?.badgeTextType ||\n this._adBadgeConfiguration?.backgroundColor !== value?.backgroundColor ||\n this._adBadgeConfiguration?.textColor !== value?.textColor;\n this._adBadgeConfiguration = value;\n FireworkSDKModule.setAdBadgeConfiguration(value ?? {}).then(() => {\n if (valueHasChanged) {\n this.eventEmitter.emit(FWEventName.AdBadgeConfigurationUpdated);\n }\n });\n }\n private _adBadgeConfiguration: AdBadgeConfiguration | undefined;\n\n /**\n * The app component name.\n */\n public get appComponentName(): string | undefined {\n return this._appComponentName;\n }\n public set appComponentName(value: string | undefined) {\n this._appComponentName = value;\n FireworkSDKModule.setAppComponentName(value ?? '');\n }\n private _appComponentName: string | undefined;\n\n /**\n * Defaults to false. You can enable debug logs by setting this property to true.\n */\n public get debugLogsEnabled(): boolean {\n return FWLoggerUtil.enabled;\n }\n public set debugLogsEnabled(value: boolean) {\n FWLoggerUtil.enabled = value;\n }\n\n private get eventEmitter(): NativeEventEmitter {\n return FireworkSDKModuleEventEmitter;\n }\n\n /**\n * Get VideoShopping object.\n */\n public get shopping(): VideoShopping {\n return this._shopping;\n }\n private _shopping: VideoShopping = VideoShopping.getInstance();\n\n /**\n * Get LiveStream object.\n */\n public get liveStream(): LiveStream {\n return this._liveStream;\n }\n private _liveStream: LiveStream = LiveStream.getInstance();\n\n /**\n * Get FWNavigator object.\n */\n public get navigator(): FWNavigator {\n return this._navigator;\n }\n private _navigator: FWNavigator = FWNavigator.getInstance();\n\n /**\n * Get global single instance of FireworkSDK class.\n * @returns FireworkSDK\n */\n public static getInstance() {\n if (!FireworkSDK._instance) {\n FireworkSDK._instance = new FireworkSDK();\n }\n\n return FireworkSDK._instance!;\n }\n\n private constructor() {\n FWLoggerUtil.log('FireworkSDK constructor');\n this.eventEmitter.addListener(FWEventName.SDKInit, (event) => {\n FWLoggerUtil.log(`Receive SDKInit event ${event?.error}`);\n\n if (this.onSDKInit) {\n this.onSDKInit(event ?? {});\n }\n });\n\n this.eventEmitter.addListener(FWEventName.LogMessage, (event) => {\n FWLoggerUtil.logNativeMessage(event.message);\n });\n\n this.eventEmitter.addListener(FWEventName.CustomCTAClick, (event) => {\n FWLoggerUtil.log(`Receive CustomCTAClick url: ${event?.url}`);\n\n if (this.onCustomCTAClick) {\n this.onCustomCTAClick(event ?? {});\n }\n });\n\n this.eventEmitter.addListener(FWEventName.VideoPlayback, (event) => {\n FWLoggerUtil.log(\n `Receive VideoPlayback event eventName: ${event?.eventName}`\n );\n\n if (this.onVideoPlayback) {\n this.onVideoPlayback(event ?? {});\n }\n });\n\n this.eventEmitter.addListener(FWEventName.VideoFeedClick, (event) => {\n FWLoggerUtil.log(`Receive VideoFeedClick event id: ${event?.info.id}`);\n\n if (this.onVideoFeedClick) {\n this.onVideoFeedClick(event ?? {});\n }\n });\n }\n\n /**\n * Initializes Firework SDK.\n * @param {string?} userId An id to uniquely identify device or user.\n */\n public init(userId?: string) {\n FWLoggerUtil.log('Call FireworkSDK init method');\n\n FireworkSDKModule.init(userId);\n ShoppingModule.init();\n LiveStreamModule.init();\n }\n\n /**\n * Open Video URL.\n * @param {string} url\n * @param {VideoPlayerConfiguration} config\n */\n public openVideoPlayer(url: string, config?: VideoPlayerConfiguration) {\n FireworkSDKModule.openVideoPlayer(url, config ?? {});\n }\n\n /**\n * Records the user purchase. Only supported on iOS.\n * @param {TrackPurchaseParameters} parameters\n */\n public trackPurchase(parameters: TrackPurchaseParameters) {\n if (Platform.OS === 'ios') {\n FireworkSDKModule.trackPurchase(parameters);\n }\n }\n\n /**\n * Change App level language. Only supported on Android.\n * @param {string} language Such as en, ar and en-US\n * @returns\n */\n public async changeAppLanguage(language: string): Promise<boolean> {\n if (Platform.OS === 'android') {\n const result = await FireworkSDKModule.changeAppLanguage(language);\n return result;\n }\n\n return false;\n }\n}\n\nexport default FireworkSDK;\n"]}
1
+ {"version":3,"sources":["FireworkSDK.ts"],"names":["Platform","FWNavigator","LiveStream","FWEventName","FireworkSDKModule","FireworkSDKModuleEventEmitter","LiveStreamModule","ShoppingModule","FWLoggerUtil","VideoShopping","FireworkSDK","onCustomCTAClick","_onCustomCTAClick","value","log","setCustomCTAClickEnabled","customCTALinkContentPageRouteName","_customCTALinkContentPageRouteName","setCustomCTALinkContentPageRouteName","onVideoPlayback","_onVideoPlayback","setVideoPlaybackEventEnabled","shareBaseURL","_shareBaseURL","setShareBaseURL","then","valueHasChanged","eventEmitter","emit","ShareBaseURLUpdated","adBadgeConfiguration","_adBadgeConfiguration","setAdBadgeConfiguration","badgeTextType","backgroundColor","textColor","AdBadgeConfigurationUpdated","appComponentName","_appComponentName","setAppComponentName","appLanguage","_appLanguage","debugLogsEnabled","enabled","shopping","_shopping","liveStream","_liveStream","navigator","_navigator","getInstance","_instance","constructor","addListener","SDKInit","event","error","onSDKInit","LogMessage","logNativeMessage","message","CustomCTAClick","url","VideoPlayback","eventName","VideoFeedClick","info","id","onVideoFeedClick","init","userId","openVideoPlayer","config","trackPurchase","parameters","OS","changeAppLanguage","language","result","AppLanguageUpdated"],"mappings":";;AAAA,SAA6BA,QAA7B,QAA6C,cAA7C;AAEA,OAAOC,WAAP,MAAwB,eAAxB;AACA,OAAOC,UAAP,MAAuB,cAAvB;AAEA,SAASC,WAAT,QAA4B,sBAA5B;AASA,OAAOC,iBAAP,IACEC,6BADF,QAEO,6BAFP;AAGA,OAAOC,gBAAP,MAA6B,4BAA7B;AACA,OAAOC,cAAP,MAA2B,0BAA3B;AACA,OAAOC,YAAP,MAAyB,sBAAzB;AACA,OAAOC,aAAP,MAA0B,iBAA1B;;AAOA;AACA;AACA;AACA,MAAMC,WAAN,CAAkB;AAGhB;AACF;AACA;;AAGE;AACF;AACA;;AAGE;AACF;AACA;AAC6B,MAAhBC,gBAAgB,GAAuC;AAChE,WAAO,KAAKC,iBAAZ;AACD;;AAC0B,MAAhBD,gBAAgB,CAACE,KAAD,EAA4C;AACrEL,IAAAA,YAAY,CAACM,GAAb,CAAkB,iCAAgC,CAAC,CAACD,KAAM,EAA1D;AACA,SAAKD,iBAAL,GAAyBC,KAAzB;AACAT,IAAAA,iBAAiB,CAACW,wBAAlB,CAA2CF,KAAK,GAAG,IAAH,GAAU,KAA1D;AACD;;AAGD;AACF;AACA;AAC8C,MAAjCG,iCAAiC,GAAuB;AACjE,WAAO,KAAKC,kCAAZ;AACD;;AAC2C,MAAjCD,iCAAiC,CAACH,KAAD,EAA4B;AACtE,SAAKI,kCAAL,GAA0CJ,KAA1C;AACAT,IAAAA,iBAAiB,CAACc,oCAAlB,CAAuDL,KAAvD,aAAuDA,KAAvD,cAAuDA,KAAvD,GAAgE,EAAhE;AACD;;AAGD;AACF;AACA;AAC4B,MAAfM,eAAe,GAAsC;AAC9D,WAAO,KAAKC,gBAAZ;AACD;;AACyB,MAAfD,eAAe,CAACN,KAAD,EAA2C;AACnE,SAAKO,gBAAL,GAAwBP,KAAxB;AACAT,IAAAA,iB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,EAAqB;AACnB,aAAKC,YAAL,CAAkBC,IAAlB,CAAuBzB,WAAW,CAAC4E,kBAAnC;AACD;AACF;;AACD,WAAOD,MAAP;AACD;;AApPe;;gBAAZpE,W;;AAuPN,eAAeA,WAAf","sourcesContent":["import { NativeEventEmitter, Platform } from 'react-native';\n\nimport FWNavigator from './FWNavigator';\nimport LiveStream from './LiveStream';\nimport type AdBadgeConfiguration from './models/AdBadgeConfiguration';\nimport { FWEventName } from './models/FWEventName';\nimport type {\n CustomCTAClickEvent,\n SDKInitEvent,\n VideoFeedClickEvent,\n VideoPlaybackEvent,\n} from './models/FWEvents';\nimport type TrackPurchaseParameters from './models/TrackPurchaseParameters';\nimport type VideoPlayerConfiguration from './models/VideoPlayerConfiguration';\nimport FireworkSDKModule, {\n FireworkSDKModuleEventEmitter,\n} from './modules/FireworkSDKModule';\nimport LiveStreamModule from './modules/LiveStreamModule';\nimport ShoppingModule from './modules/ShoppingModule';\nimport FWLoggerUtil from './utils/FWLoggerUtil';\nimport VideoShopping from './VideoShopping';\n\nexport type SDKInitCallback = (event: SDKInitEvent) => void;\nexport type CustomCTAClickCallback = (event: CustomCTAClickEvent) => void;\nexport type VideoPlaybackCallback = (event: VideoPlaybackEvent) => void;\nexport type VideoFeedClickCallback = (event: VideoFeedClickEvent) => void;\n\n/**\n * Entry class of Firework SDK, which supports the sdk initialization and global configuration.\n */\nclass FireworkSDK {\n private static _instance?: FireworkSDK;\n\n /**\n * The callback of SDK initialization.\n */\n public onSDKInit?: SDKInitCallback;\n\n /**\n * the callback of clicking Video Feed.\n */\n public onVideoFeedClick?: VideoFeedClickCallback;\n\n /**\n * The callback of clicking custom CTA.\n */\n public get onCustomCTAClick(): CustomCTAClickCallback | undefined {\n return this._onCustomCTAClick;\n }\n public set onCustomCTAClick(value: CustomCTAClickCallback | undefined) {\n FWLoggerUtil.log(`Set onCustomCTAClick callback ${!!value}`);\n this._onCustomCTAClick = value;\n FireworkSDKModule.setCustomCTAClickEnabled(value ? true : false);\n }\n private _onCustomCTAClick: CustomCTAClickCallback | undefined;\n\n /**\n * The custom CTA link content page route name.\n */\n public get customCTALinkContentPageRouteName(): string | undefined {\n return this._customCTALinkContentPageRouteName;\n }\n public set customCTALinkContentPageRouteName(value: string | undefined) {\n this._customCTALinkContentPageRouteName = value;\n FireworkSDKModule.setCustomCTALinkContentPageRouteName(value ?? '');\n }\n private _customCTALinkContentPageRouteName: string | undefined;\n\n /**\n * The callback of video playback.\n */\n public get onVideoPlayback(): VideoPlaybackCallback | undefined {\n return this._onVideoPlayback;\n }\n public set onVideoPlayback(value: VideoPlaybackCallback | undefined) {\n this._onVideoPlayback = value;\n FireworkSDKModule.setVideoPlaybackEventEnabled(value ? true : false);\n }\n private _onVideoPlayback?: VideoPlaybackCallback | undefined;\n\n /**\n * The share base URL of videos.\n * The set accessor is async.\n */\n public get shareBaseURL(): string | undefined {\n return this._shareBaseURL;\n }\n public set shareBaseURL(value: string | undefined) {\n FireworkSDKModule.setShareBaseURL(value ?? '').then(() => {\n const valueHasChanged = this._shareBaseURL !== value;\n this._shareBaseURL = value;\n if (valueHasChanged) {\n this.eventEmitter.emit(FWEventName.ShareBaseURLUpdated);\n }\n });\n }\n private _shareBaseURL: string | undefined;\n\n /**\n * The configuration for ad badges.\n * The set accessor is async.\n */\n public get adBadgeConfiguration(): AdBadgeConfiguration | undefined {\n return this._adBadgeConfiguration;\n }\n public set adBadgeConfiguration(value: AdBadgeConfiguration | undefined) {\n FireworkSDKModule.setAdBadgeConfiguration(value ?? {}).then(() => {\n const valueHasChanged =\n this._adBadgeConfiguration?.badgeTextType !== value?.badgeTextType ||\n this._adBadgeConfiguration?.backgroundColor !==\n value?.backgroundColor ||\n this._adBadgeConfiguration?.textColor !== value?.textColor;\n this._adBadgeConfiguration = value;\n if (valueHasChanged) {\n this.eventEmitter.emit(FWEventName.AdBadgeConfigurationUpdated);\n }\n });\n }\n private _adBadgeConfiguration: AdBadgeConfiguration | undefined;\n\n /**\n * The app component name.\n */\n public get appComponentName(): string | undefined {\n return this._appComponentName;\n }\n public set appComponentName(value: string | undefined) {\n this._appComponentName = value;\n FireworkSDKModule.setAppComponentName(value ?? '');\n }\n private _appComponentName: string | undefined;\n\n public get appLanguage(): string | undefined {\n return this._appLanguage;\n }\n private _appLanguage: string | undefined;\n\n /**\n * Defaults to false. You can enable debug logs by setting this property to true.\n */\n public get debugLogsEnabled(): boolean {\n return FWLoggerUtil.enabled;\n }\n public set debugLogsEnabled(value: boolean) {\n FWLoggerUtil.enabled = value;\n }\n\n private get eventEmitter(): NativeEventEmitter {\n return FireworkSDKModuleEventEmitter;\n }\n\n /**\n * Get VideoShopping object.\n */\n public get shopping(): VideoShopping {\n return this._shopping;\n }\n private _shopping: VideoShopping = VideoShopping.getInstance();\n\n /**\n * Get LiveStream object.\n */\n public get liveStream(): LiveStream {\n return this._liveStream;\n }\n private _liveStream: LiveStream = LiveStream.getInstance();\n\n /**\n * Get FWNavigator object.\n */\n public get navigator(): FWNavigator {\n return this._navigator;\n }\n private _navigator: FWNavigator = FWNavigator.getInstance();\n\n /**\n * Get global single instance of FireworkSDK class.\n * @returns FireworkSDK\n */\n public static getInstance() {\n if (!FireworkSDK._instance) {\n FireworkSDK._instance = new FireworkSDK();\n }\n\n return FireworkSDK._instance!;\n }\n\n private constructor() {\n FWLoggerUtil.log('FireworkSDK constructor');\n this.eventEmitter.addListener(FWEventName.SDKInit, (event) => {\n FWLoggerUtil.log(`Receive SDKInit event ${event?.error}`);\n\n if (this.onSDKInit) {\n this.onSDKInit(event ?? {});\n }\n });\n\n this.eventEmitter.addListener(FWEventName.LogMessage, (event) => {\n FWLoggerUtil.logNativeMessage(event.message);\n });\n\n this.eventEmitter.addListener(FWEventName.CustomCTAClick, (event) => {\n FWLoggerUtil.log(`Receive CustomCTAClick url: ${event?.url}`);\n\n if (this.onCustomCTAClick) {\n this.onCustomCTAClick(event ?? {});\n }\n });\n\n this.eventEmitter.addListener(FWEventName.VideoPlayback, (event) => {\n FWLoggerUtil.log(\n `Receive VideoPlayback event eventName: ${event?.eventName}`\n );\n\n if (this.onVideoPlayback) {\n this.onVideoPlayback(event ?? {});\n }\n });\n\n this.eventEmitter.addListener(FWEventName.VideoFeedClick, (event) => {\n FWLoggerUtil.log(`Receive VideoFeedClick event id: ${event?.info.id}`);\n\n if (this.onVideoFeedClick) {\n this.onVideoFeedClick(event ?? {});\n }\n });\n }\n\n /**\n * Initializes Firework SDK.\n * @param {string?} userId An id to uniquely identify device or user.\n */\n public init(userId?: string) {\n FWLoggerUtil.log('Call FireworkSDK init method');\n\n FireworkSDKModule.init(userId);\n ShoppingModule.init();\n LiveStreamModule.init();\n }\n\n /**\n * Open Video URL.\n * @param {string} url\n * @param {VideoPlayerConfiguration} config\n */\n public openVideoPlayer(url: string, config?: VideoPlayerConfiguration) {\n FireworkSDKModule.openVideoPlayer(url, config ?? {});\n }\n\n /**\n * Records the user purchase. Only supported on iOS.\n * @param {TrackPurchaseParameters} parameters\n */\n public trackPurchase(parameters: TrackPurchaseParameters) {\n if (Platform.OS === 'ios') {\n FireworkSDKModule.trackPurchase(parameters);\n }\n }\n\n /**\n * Change App level language.\n * @param {string} language Such as en, ar and en-US\n * @returns\n */\n public async changeAppLanguage(language: string): Promise<boolean> {\n const result = await FireworkSDKModule.changeAppLanguage(language);\n if (result) {\n const valueHasChanged = this._appLanguage !== language;\n this._appLanguage = language;\n if (valueHasChanged) {\n this.eventEmitter.emit(FWEventName.AppLanguageUpdated);\n }\n }\n return result;\n }\n}\n\nexport default FireworkSDK;\n"]}