react-native-firework-sdk 1.2.0-beta.1 → 1.2.0-beta.10

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 (147) hide show
  1. package/android/build.gradle +1 -1
  2. package/android/src/main/AndroidManifest.xml +0 -4
  3. package/android/src/main/java/com/fireworksdk/bridge/components/videofeed/FWVideoFeed.kt +19 -6
  4. package/android/src/main/java/com/fireworksdk/bridge/models/FWEventName.kt +1 -0
  5. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoFeedConfigModel.kt +2 -1
  6. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoFeedPropsModel.kt +1 -0
  7. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoFeedSource.kt +1 -0
  8. package/android/src/main/java/com/fireworksdk/bridge/reactnative/manager/FWVideoFeedManager.kt +6 -0
  9. package/android/src/main/java/com/fireworksdk/bridge/reactnative/models/FWNavigatorInterface.kt +2 -1
  10. package/android/src/main/java/com/fireworksdk/bridge/reactnative/models/FWVideoShoppingInterface.kt +2 -2
  11. package/android/src/main/java/com/fireworksdk/bridge/reactnative/models/FireworkSDKInterface.kt +3 -1
  12. package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FWNavigatorModule.kt +3 -14
  13. package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FWVideoShoppingModule.kt +4 -19
  14. package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FireworkSDKModule.kt +41 -4
  15. package/android/src/main/java/com/fireworksdk/bridge/reactnative/pages/FWContainerActivity.kt +22 -10
  16. package/android/src/main/java/com/fireworksdk/bridge/reactnative/utils/FWDataUtils.kt +119 -0
  17. package/android/src/main/java/com/fireworksdk/bridge/reactnative/utils/FWEventUtils.kt +50 -3
  18. package/android/src/main/java/com/fireworksdk/bridge/utils/FWBundleUtils.kt +86 -0
  19. package/android/src/main/java/com/fireworksdk/bridge/utils/FWDateUtils.kt +15 -0
  20. package/android/src/main/java/com/fireworksdk/bridge/utils/FWVideoPlayerUtils.kt +12 -2
  21. package/ios/Components/VideoFeed.swift +6 -25
  22. package/ios/Components/VideoFeedManager.m +1 -0
  23. package/ios/FireworkSdk.xcodeproj/project.pbxproj +0 -4
  24. package/ios/Models/NativeToRN/FireworkEventName.swift +1 -0
  25. package/ios/Models/RNToNative/RCTConvert+FireworkSDKModule.swift +0 -20
  26. package/ios/Models/RNToNative/RCTConvert+VideoFeed.swift +2 -1
  27. package/ios/Modules/FWNavigatorModule/FWNavigatorContainerViewController.swift +4 -12
  28. package/ios/Modules/FWNavigatorModule/FWNavigatorModule.m +2 -2
  29. package/ios/Modules/FWNavigatorModule/FWNavigatorModule.swift +41 -11
  30. package/ios/Modules/FWNavigatorModule/FWNavigatorProtocol.swift +2 -2
  31. package/ios/Modules/FireworkSDKModule/FireworkSDKModule+CTA.swift +24 -1
  32. package/ios/Modules/FireworkSDKModule/FireworkSDKModule.m +3 -1
  33. package/ios/Modules/FireworkSDKModule/FireworkSDKModule.swift +51 -31
  34. package/ios/Modules/Shopping/CartViewController.swift +6 -1
  35. package/ios/Modules/Shopping/ShoppingModule.m +1 -2
  36. package/ios/Modules/Shopping/ShoppingModule.swift +10 -12
  37. package/lib/commonjs/FWNavigator.js +21 -15
  38. package/lib/commonjs/FWNavigator.js.map +1 -1
  39. package/lib/commonjs/FireworkSDK.js +49 -5
  40. package/lib/commonjs/FireworkSDK.js.map +1 -1
  41. package/lib/commonjs/LiveStream.js +2 -2
  42. package/lib/commonjs/LiveStream.js.map +1 -1
  43. package/lib/commonjs/VideoShopping.js +4 -18
  44. package/lib/commonjs/VideoShopping.js.map +1 -1
  45. package/lib/commonjs/components/FWVideoFeed.js.map +1 -1
  46. package/lib/commonjs/components/VideoFeed.js +33 -1
  47. package/lib/commonjs/components/VideoFeed.js.map +1 -1
  48. package/lib/commonjs/constants/FWErrorMessage.js.map +1 -1
  49. package/lib/commonjs/index.js +0 -10
  50. package/lib/commonjs/index.js.map +1 -1
  51. package/lib/commonjs/models/FWEventName.js +3 -2
  52. package/lib/commonjs/models/FWEventName.js.map +1 -1
  53. package/lib/commonjs/models/NewNativeContainerProps.js +2 -0
  54. package/lib/commonjs/models/{AdConfig.js.map → NewNativeContainerProps.js.map} +0 -0
  55. package/lib/commonjs/models/VideoFeedSource.js +0 -4
  56. package/lib/commonjs/modules/FWNavigatorModule.js.map +1 -1
  57. package/lib/commonjs/modules/FireworkSDKModule.js.map +1 -1
  58. package/lib/commonjs/modules/LiveStreamModule.js.map +1 -1
  59. package/lib/commonjs/modules/ShoppingModule.js.map +1 -1
  60. package/lib/commonjs/utils/FWLoggerUtil.js +45 -0
  61. package/lib/commonjs/utils/FWLoggerUtil.js.map +1 -0
  62. package/lib/module/FWNavigator.js +15 -16
  63. package/lib/module/FWNavigator.js.map +1 -1
  64. package/lib/module/FireworkSDK.js +45 -5
  65. package/lib/module/FireworkSDK.js.map +1 -1
  66. package/lib/module/LiveStream.js +4 -4
  67. package/lib/module/LiveStream.js.map +1 -1
  68. package/lib/module/VideoShopping.js +4 -18
  69. package/lib/module/VideoShopping.js.map +1 -1
  70. package/lib/module/components/FWVideoFeed.js +1 -1
  71. package/lib/module/components/FWVideoFeed.js.map +1 -1
  72. package/lib/module/components/VideoFeed.js +33 -1
  73. package/lib/module/components/VideoFeed.js.map +1 -1
  74. package/lib/module/constants/FWErrorMessage.js.map +1 -1
  75. package/lib/module/index.js +0 -5
  76. package/lib/module/index.js.map +1 -1
  77. package/lib/module/models/FWEventName.js +3 -2
  78. package/lib/module/models/FWEventName.js.map +1 -1
  79. package/lib/module/models/NewNativeContainerProps.js +2 -0
  80. package/lib/module/models/{AdConfig.js.map → NewNativeContainerProps.js.map} +0 -0
  81. package/lib/module/models/VideoFeedSource.js +1 -1
  82. package/lib/module/modules/FWNavigatorModule.js.map +1 -1
  83. package/lib/module/modules/FireworkSDKModule.js.map +1 -1
  84. package/lib/module/modules/LiveStreamModule.js.map +1 -1
  85. package/lib/module/modules/ShoppingModule.js.map +1 -1
  86. package/lib/module/utils/FWLoggerUtil.js +36 -0
  87. package/lib/module/utils/FWLoggerUtil.js.map +1 -0
  88. package/lib/typescript/FWNavigator.d.ts +9 -7
  89. package/lib/typescript/FireworkSDK.d.ts +16 -4
  90. package/lib/typescript/LiveStream.d.ts +1 -1
  91. package/lib/typescript/VideoShopping.d.ts +2 -9
  92. package/lib/typescript/components/VideoFeed.d.ts +8 -1
  93. package/lib/typescript/constants/FWErrorMessage.d.ts +1 -1
  94. package/lib/typescript/index.d.ts +4 -4
  95. package/lib/typescript/models/FWEventName.d.ts +4 -3
  96. package/lib/typescript/models/FeedItemDetails.d.ts +1 -1
  97. package/lib/typescript/models/NewNativeContainerProps.d.ts +6 -0
  98. package/lib/typescript/models/VideoFeedConfiguration.d.ts +4 -0
  99. package/lib/typescript/models/VideoFeedSource.d.ts +1 -2
  100. package/lib/typescript/modules/FWNavigatorModule.d.ts +3 -1
  101. package/lib/typescript/modules/FireworkSDKModule.d.ts +5 -4
  102. package/lib/typescript/modules/ShoppingModule.d.ts +2 -2
  103. package/lib/typescript/utils/FWLoggerUtil.d.ts +6 -0
  104. package/package.json +3 -1
  105. package/react-native-firework-sdk.podspec +1 -1
  106. package/src/FWNavigator.tsx +22 -12
  107. package/src/FireworkSDK.ts +46 -7
  108. package/src/LiveStream.ts +9 -7
  109. package/src/VideoShopping.ts +10 -21
  110. package/src/components/FWVideoFeed.tsx +5 -5
  111. package/src/components/VideoFeed.tsx +48 -14
  112. package/src/constants/FWErrorMessage.ts +1 -3
  113. package/src/index.tsx +5 -13
  114. package/src/models/AdBadgeConfiguration.ts +1 -1
  115. package/src/models/FWError.ts +1 -1
  116. package/src/models/FWEventName.ts +3 -2
  117. package/src/models/FWEvents.ts +1 -1
  118. package/src/models/FeedItemDetails.ts +2 -2
  119. package/src/models/LiveStreamEventDetails.ts +1 -1
  120. package/src/models/LiveStreamMessageDetails.ts +1 -1
  121. package/src/models/NewNativeContainerProps.ts +4 -0
  122. package/src/models/VideoFeedConfiguration.ts +6 -2
  123. package/src/models/VideoFeedSource.ts +6 -2
  124. package/src/models/VideoPlayerConfiguration.ts +2 -2
  125. package/src/modules/FWNavigatorModule.ts +1 -1
  126. package/src/modules/FireworkSDKModule.ts +5 -6
  127. package/src/modules/LiveStreamModule.ts +1 -5
  128. package/src/modules/ShoppingModule.ts +5 -2
  129. package/src/utils/FWLoggerUtil.ts +40 -0
  130. package/android/src/main/java/com/fireworksdk/bridge/reactnative/pages/FWVideoShoppingCartActivity.kt +0 -43
  131. package/ios/Modules/FireworkSDKModule/MobileADConfiguration.swift +0 -17
  132. package/lib/commonjs/components/CartContainer.js +0 -35
  133. package/lib/commonjs/components/CartContainer.js.map +0 -1
  134. package/lib/commonjs/components/NavigationContainer.js +0 -36
  135. package/lib/commonjs/components/NavigationContainer.js.map +0 -1
  136. package/lib/commonjs/models/AdConfig.js +0 -2
  137. package/lib/module/components/CartContainer.js +0 -18
  138. package/lib/module/components/CartContainer.js.map +0 -1
  139. package/lib/module/components/NavigationContainer.js +0 -21
  140. package/lib/module/components/NavigationContainer.js.map +0 -1
  141. package/lib/module/models/AdConfig.js +0 -2
  142. package/lib/typescript/components/CartContainer.d.ts +0 -3
  143. package/lib/typescript/components/NavigationContainer.d.ts +0 -6
  144. package/lib/typescript/models/AdConfig.d.ts +0 -10
  145. package/src/components/CartContainer.tsx +0 -20
  146. package/src/components/NavigationContainer.tsx +0 -22
  147. package/src/models/AdConfig.ts +0 -10
@@ -1 +1 @@
1
- {"version":3,"sources":["index.tsx"],"names":["AppRegistry","registerComponent","CartContainer","NavigationContainer","FireworkSDK"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AAEA;;AACA;;AAEA;;AAOA;;AACA;;AAKA;;AAiBA;;AAEA;;AAgBA;;AAcA;;;;AAEAA,yBAAYC,iBAAZ,CAA8B,oBAA9B,EAAoD,MAAMC,sBAA1D;;AACAF,yBAAYC,iBAAZ,CACE,uBADF,EAEE,MAAME,4BAFR;;eAKeC,oB","sourcesContent":["import { AppRegistry } from 'react-native';\n\nimport CartContainer from './components/CartContainer';\nimport NavigationContainer from './components/NavigationContainer';\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 AdConfig from './models/AdConfig';\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 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 } from './models/ProductUnit';\nimport type VideoFeedConfiguration from './models/VideoFeedConfiguration';\nimport type {\n VideoFeedPlayIconConfiguration,\n VideoFeedTitleConfiguration,\n VideoFeedTitlePosition,\n} from './models/VideoFeedConfiguration';\nimport type VideoFeedSource from './models/VideoFeedSource';\nimport type VideoPlaybackDetails from './models/VideoPlaybackDetails';\nimport type { VideoPlayerSize } from './models/VideoPlaybackDetails';\nimport VideoPlaybackEventName from './models/VideoPlaybackEventName';\nimport type VideoPlayerConfiguration from './models/VideoPlayerConfiguration';\nimport type {\n VideoLaunchBehavior,\n VideoPlayerCompleteAction,\n VideoPlayerCTAStyle,\n VideoPlayerStyle,\n} from './models/VideoPlayerConfiguration';\nimport type {\n AddToCartCallback,\n ClickCartIconCallback,\n UpdateProductDetailsCallback,\n WillDisplayProductCallback,\n} from './VideoShopping';\nimport VideoShopping from './VideoShopping';\n\nAppRegistry.registerComponent('FWShoppingCartPage', () => CartContainer);\nAppRegistry.registerComponent(\n 'FWNavigationContainer',\n () => NavigationContainer\n);\n\nexport default FireworkSDK;\n\nexport {\n AdBadgeConfiguration,\n AdBadgeTextType,\n AdConfig,\n AddToCartButtonConfiguration,\n AddToCartCallback,\n AddToCartEvent,\n AddToCartResult,\n ClickCartIconCallback,\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 onLiveStreamChatEventCallback,\n onLiveStreamEventCallback,\n Product,\n ProductInfoViewConfiguration,\n ProductPrice,\n ProductUnit,\n SDKInitCallback,\n SDKInitEvent,\n UpdateProductDetailsCallback,\n UpdateProductDetailsEvent,\n VideoFeed,\n VideoFeedClickCallback,\n VideoFeedConfiguration,\n VideoFeedMode,\n VideoFeedPlayIconConfiguration,\n VideoFeedSource,\n VideoFeedTitleConfiguration,\n VideoFeedTitlePosition,\n VideoLaunchBehavior,\n VideoPlaybackCallback,\n VideoPlaybackDetails,\n VideoPlaybackEvent,\n VideoPlaybackEventName,\n VideoPlayerCompleteAction,\n VideoPlayerConfiguration,\n VideoPlayerCTAStyle,\n VideoPlayerSize,\n VideoPlayerStyle,\n VideoShopping,\n WillDisplayProductCallback,\n WillDisplayProductEvent,\n};\n"]}
1
+ {"version":3,"sources":["index.tsx"],"names":["FireworkSDK"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA;;AAQA;;AACA;;AAKA;;AAgBA;;AAEA;;AAiBA;;AAcA;;;;eAEeA,oB","sourcesContent":["import type { IVideoFeedProps, VideoFeedMode } from './components/VideoFeed';\nimport VideoFeed from './components/VideoFeed';\nimport type {\n CustomCTAClickCallback,\n CustomCTALinkContentRender,\n SDKInitCallback,\n VideoFeedClickCallback,\n VideoPlaybackCallback,\n} from './FireworkSDK';\nimport FireworkSDK from './FireworkSDK';\nimport FWNavigator from './FWNavigator';\nimport type {\n onLiveStreamChatEventCallback,\n onLiveStreamEventCallback,\n} from './LiveStream';\nimport LiveStream from './LiveStream';\nimport type AdBadgeConfiguration from './models/AdBadgeConfiguration';\nimport type { AdBadgeTextType } from './models/AdBadgeConfiguration';\nimport type 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 } from './models/ProductUnit';\nimport type VideoFeedConfiguration from './models/VideoFeedConfiguration';\nimport type {\n VideoFeedPlayIconConfiguration,\n VideoFeedTitleConfiguration,\n VideoFeedTitlePosition,\n} from './models/VideoFeedConfiguration';\nimport type { VideoFeedSource } from './models/VideoFeedSource';\nimport type VideoPlaybackDetails from './models/VideoPlaybackDetails';\nimport type { VideoPlayerSize } from './models/VideoPlaybackDetails';\nimport VideoPlaybackEventName from './models/VideoPlaybackEventName';\nimport type VideoPlayerConfiguration from './models/VideoPlayerConfiguration';\nimport type {\n VideoLaunchBehavior,\n VideoPlayerCompleteAction,\n VideoPlayerCTAStyle,\n VideoPlayerStyle,\n} from './models/VideoPlayerConfiguration';\nimport type {\n AddToCartCallback,\n ClickCartIconCallback,\n UpdateProductDetailsCallback,\n WillDisplayProductCallback,\n} from './VideoShopping';\nimport VideoShopping from './VideoShopping';\n\nexport default FireworkSDK;\n\nexport {\n AdBadgeConfiguration,\n AdBadgeTextType,\n AddToCartButtonConfiguration,\n AddToCartCallback,\n AddToCartEvent,\n AddToCartResult,\n ClickCartIconCallback,\n CustomCTAClickCallback,\n CustomCTAClickEvent,\n CustomCTALinkContentRender,\n FeedItemDetails,\n FWError,\n FWNavigator,\n IVideoFeedProps,\n LiveStream,\n LiveStreamChatEvent,\n LiveStreamChatEventName,\n LiveStreamEvent,\n LiveStreamEventDetails,\n LiveStreamEventName,\n LiveStreamMessageDetails,\n NewNativeContainerProps,\n onLiveStreamChatEventCallback,\n onLiveStreamEventCallback,\n Product,\n ProductInfoViewConfiguration,\n ProductPrice,\n ProductUnit,\n SDKInitCallback,\n SDKInitEvent,\n UpdateProductDetailsCallback,\n UpdateProductDetailsEvent,\n VideoFeed,\n VideoFeedClickCallback,\n VideoFeedConfiguration,\n VideoFeedMode,\n VideoFeedPlayIconConfiguration,\n VideoFeedSource,\n VideoFeedTitleConfiguration,\n VideoFeedTitlePosition,\n VideoLaunchBehavior,\n VideoPlaybackCallback,\n VideoPlaybackDetails,\n VideoPlaybackEvent,\n VideoPlaybackEventName,\n VideoPlayerCompleteAction,\n VideoPlayerConfiguration,\n VideoPlayerCTAStyle,\n VideoPlayerSize,\n VideoPlayerStyle,\n VideoShopping,\n WillDisplayProductCallback,\n WillDisplayProductEvent,\n};\n"]}
@@ -16,9 +16,10 @@ exports.FWEventName = FWEventName;
16
16
  FWEventName["ClickCartIcon"] = "fw:shopping:click-cart-icon";
17
17
  FWEventName["UpdateProductDetails"] = "fw:shopping:update-product-details";
18
18
  FWEventName["WillDisplayProduct"] = "fw:shopping:will-display-product";
19
- FWEventName["onLiveStreamEvent"] = "fw:livestream";
20
- FWEventName["onLiveStreamChatEvent"] = "fw:livestream-chat";
19
+ FWEventName["LiveStream"] = "fw:livestream";
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["LogMessage"] = "fw:log-message";
23
24
  })(FWEventName || (exports.FWEventName = FWEventName = {}));
24
25
  //# 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;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 onLiveStreamEvent = 'fw:livestream',\n onLiveStreamChatEvent = 'fw:livestream-chat',\n ShareBaseURLUpdated = 'fw:share-base-url-updated',\n AdBadgeConfigurationUpdated = 'fw:ad-badge-configuration-updated',\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;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"]}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ //# sourceMappingURL=NewNativeContainerProps.js.map
@@ -1,6 +1,2 @@
1
1
  "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
2
  //# sourceMappingURL=VideoFeedSource.js.map
@@ -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;AAeA,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(callbackId?: string): Promise<boolean>;\n popNativeContainer(): 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;AAeA,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}\n\nconst FWNavigatorModuleEventEmitter = new NativeEventEmitter(FWNavigatorModule);\nexport { FWNavigatorModuleEventEmitter };\nexport default FWNavigatorModule as IFWNavigatorModule;\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["FireworkSDKModule.ts"],"names":["FireworkSDKModule","NativeModules","FireworkSDK","Proxy","get","Error","LINKING_ERROR","FireworkSDKModuleEventEmitter","NativeEventEmitter"],"mappings":";;;;;;;AAAA;;AAIA;;AAIA,MAAMA,iBAAiB,GAAGC,2BAAcC,WAAd,GACtBD,2BAAcC,WADQ,GAEtB,IAAIC,KAAJ,CACE,EADF,EAEE;AACEC,EAAAA,GAAG,GAAG;AACJ,UAAM,IAAIC,KAAJ,CAAUC,6BAAV,CAAN;AACD;;AAHH,CAFF,CAFJ;AAoBA,MAAMC,6BAA6B,GAAG,IAAIC,+BAAJ,CAAuBR,iBAAvB,CAAtC;;eAIeA,iB","sourcesContent":["import { NativeEventEmitter, NativeModule } from 'react-native';\nimport { NativeModules } from 'react-native';\nimport type AdBadgeConfiguration from 'src/models/AdBadgeConfiguration';\n\nimport { LINKING_ERROR } from '../constants/FWErrorMessage';\nimport type AdConfig from '../models/AdConfig';\nimport type VideoPlayerConfiguration from '../models/VideoPlayerConfiguration';\n\nconst FireworkSDKModule = NativeModules.FireworkSDK\n ? NativeModules.FireworkSDK\n : new Proxy(\n {},\n {\n get() {\n throw new Error(LINKING_ERROR);\n },\n }\n );\n\ninterface IFireworkSDKModule extends NativeModule {\n init(userId?: string, adConfig?: AdConfig): void;\n openVideoPlayer(url: string, config?: VideoPlayerConfiguration): void;\n setCustomCTAClickEnabled(enabled: boolean): void;\n setShareBaseURL(url?: string): Promise<any>;\n setVideoPlaybackEventEnabled(enabled: boolean): void;\n setAdBadgeConfiguration(config?: AdBadgeConfiguration): Promise<any>;\n}\n\nconst FireworkSDKModuleEventEmitter = new NativeEventEmitter(FireworkSDKModule);\nexport {\n FireworkSDKModuleEventEmitter,\n}\nexport default FireworkSDKModule as IFireworkSDKModule;\n"]}
1
+ {"version":3,"sources":["FireworkSDKModule.ts"],"names":["FireworkSDKModule","NativeModules","FireworkSDK","Proxy","get","Error","LINKING_ERROR","FireworkSDKModuleEventEmitter","NativeEventEmitter"],"mappings":";;;;;;;AAAA;;AAIA;;AAGA,MAAMA,iBAAiB,GAAGC,2BAAcC,WAAd,GACtBD,2BAAcC,WADQ,GAEtB,IAAIC,KAAJ,CACE,EADF,EAEE;AACEC,EAAAA,GAAG,GAAG;AACJ,UAAM,IAAIC,KAAJ,CAAUC,6BAAV,CAAN;AACD;;AAHH,CAFF,CAFJ;AAsBA,MAAMC,6BAA6B,GAAG,IAAIC,+BAAJ,CAAuBR,iBAAvB,CAAtC;;eAEeA,iB","sourcesContent":["import { NativeEventEmitter, NativeModule } from 'react-native';\nimport { NativeModules } from 'react-native';\nimport type AdBadgeConfiguration from '../models/AdBadgeConfiguration';\n\nimport { LINKING_ERROR } from '../constants/FWErrorMessage';\nimport type VideoPlayerConfiguration from '../models/VideoPlayerConfiguration';\n\nconst FireworkSDKModule = NativeModules.FireworkSDK\n ? NativeModules.FireworkSDK\n : new Proxy(\n {},\n {\n get() {\n throw new Error(LINKING_ERROR);\n },\n }\n );\n\ninterface IFireworkSDKModule extends NativeModule {\n init(userId?: string): void;\n openVideoPlayer(url: string, config?: VideoPlayerConfiguration): void;\n setCustomCTAClickEnabled(enabled: boolean): void;\n setCustomCTALinkContentPageRouteName(name?: string): Promise<any>;\n setShareBaseURL(url?: string): Promise<any>;\n setVideoPlaybackEventEnabled(enabled: boolean): void;\n setAdBadgeConfiguration(config?: AdBadgeConfiguration): Promise<any>;\n setAppComponentName(name?: string): Promise<any>;\n}\n\nconst FireworkSDKModuleEventEmitter = new NativeEventEmitter(FireworkSDKModule);\nexport { FireworkSDKModuleEventEmitter };\nexport default FireworkSDKModule as IFireworkSDKModule;\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["LiveStreamModule.ts"],"names":["LiveStreamModule","NativeModules","Proxy","get","Error","LINKING_ERROR","LiveStreamModuleEventEmitter","NativeEventEmitter"],"mappings":";;;;;;;AAAA;;AAMA;;AAEA,MAAMA,gBAAgB,GAAGC,2BAAcD,gBAAd,GACrBC,2BAAcD,gBADO,GAErB,IAAIE,KAAJ,CACE,EADF,EAEE;AACEC,EAAAA,GAAG,GAAG;AACJ,UAAM,IAAIC,KAAJ,CAAUC,6BAAV,CAAN;AACD;;AAHH,CAFF,CAFJ;AAcA,MAAMC,4BAA4B,GAAG,IAAIC,+BAAJ,CAAuBP,gBAAvB,CAArC;;eAGeA,gB","sourcesContent":["import {\n NativeEventEmitter,\n NativeModule,\n NativeModules,\n} from 'react-native';\n\nimport { LINKING_ERROR } from '../constants/FWErrorMessage';\n\nconst LiveStreamModule = NativeModules.LiveStreamModule\n ? NativeModules.LiveStreamModule\n : new Proxy(\n {},\n {\n get() {\n throw new Error(LINKING_ERROR);\n },\n }\n );\n\ninterface ILiveStreamModule extends NativeModule {\n init(): void;\n}\nconst LiveStreamModuleEventEmitter = new NativeEventEmitter(LiveStreamModule);\nexport { LiveStreamModuleEventEmitter };\n\nexport default LiveStreamModule as ILiveStreamModule;\n"]}
1
+ {"version":3,"sources":["LiveStreamModule.ts"],"names":["LiveStreamModule","NativeModules","Proxy","get","Error","LINKING_ERROR","LiveStreamModuleEventEmitter","NativeEventEmitter"],"mappings":";;;;;;;AAAA;;AAEA;;AAEA,MAAMA,gBAAgB,GAAGC,2BAAcD,gBAAd,GACrBC,2BAAcD,gBADO,GAErB,IAAIE,KAAJ,CACE,EADF,EAEE;AACEC,EAAAA,GAAG,GAAG;AACJ,UAAM,IAAIC,KAAJ,CAAUC,6BAAV,CAAN;AACD;;AAHH,CAFF,CAFJ;AAcA,MAAMC,4BAA4B,GAAG,IAAIC,+BAAJ,CAAuBP,gBAAvB,CAArC;;eAGeA,gB","sourcesContent":["import { NativeEventEmitter, NativeModule, NativeModules } from 'react-native';\n\nimport { LINKING_ERROR } from '../constants/FWErrorMessage';\n\nconst LiveStreamModule = NativeModules.LiveStreamModule\n ? NativeModules.LiveStreamModule\n : new Proxy(\n {},\n {\n get() {\n throw new Error(LINKING_ERROR);\n },\n }\n );\n\ninterface ILiveStreamModule extends NativeModule {\n init(): void;\n}\nconst LiveStreamModuleEventEmitter = new NativeEventEmitter(LiveStreamModule);\nexport { LiveStreamModuleEventEmitter };\n\nexport default LiveStreamModule as ILiveStreamModule;\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["ShoppingModule.ts"],"names":["ShoppingModule","NativeModules","Proxy","get","Error","LINKING_ERROR","ShoppingModuleEventEmitter","NativeEventEmitter"],"mappings":";;;;;;;AAAA;;AAGA;;AAEA,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;AA6BA,MAAMC,0BAA0B,GAAG,IAAIC,+BAAJ,CAAuBP,cAAvB,CAAnC;;eAGeA,c","sourcesContent":["import { NativeEventEmitter, NativeModule, NativeModules } from 'react-native';\nimport type Product from '../models/Product';\nimport type ProductInfoViewConfiguration from '../models/ProductInfoViewConfiguration';\nimport { LINKING_ERROR } from '../constants/FWErrorMessage';\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(callbackId: number | string): void;\n exitCartPage(): void;\n setCartIconVisible(visible: boolean): void;\n setCartItemCount(count: number): void;\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;;AAGA;;AAGA,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';\nimport type Product from '../models/Product';\nimport type ProductInfoViewConfiguration from '../models/ProductInfoViewConfiguration';\nimport { LINKING_ERROR } from '../constants/FWErrorMessage';\nimport type { NewNativeContainerProps } from 'src/models/NewNativeContainerProps';\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}\n\nconst ShoppingModuleEventEmitter = new NativeEventEmitter(ShoppingModule);\nexport { ShoppingModuleEventEmitter };\n\nexport default ShoppingModule as IShoppingModule;\n"]}
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ 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; }
9
+
10
+ class FWLoggerUtil {
11
+ static log(message) {
12
+ if (FWLoggerUtil.enabled && process.env.NODE_ENV === 'development') {
13
+ const currentDate = new Date();
14
+ console.log('[react-native-firework-sdk]', `${message} ${FWLoggerUtil.toISOString(currentDate)}`);
15
+ }
16
+ }
17
+
18
+ static logNativeMessage(nativeMessage) {
19
+ if (FWLoggerUtil.enabled && process.env.NODE_ENV === 'development') {
20
+ console.log('[react-native-firework-sdk] [native]', nativeMessage);
21
+ }
22
+ }
23
+
24
+ static toISOString(date) {
25
+ let timezoneOffset = -date.getTimezoneOffset();
26
+ let timezoneSymbol = timezoneOffset >= 0 ? '+' : '-';
27
+ let timezoneHours = Math.floor(Math.abs(timezoneOffset) / 60).toString().padStart(2, '0');
28
+ let timezoneMinutes = (Math.abs(timezoneOffset) % 60).toString().padStart(2, '0');
29
+ let timezoneString = `${timezoneSymbol}${timezoneHours}:${timezoneMinutes}`;
30
+ let year = date.getFullYear().toString();
31
+ let month = (date.getMonth() + 1).toString().padStart(2, '0');
32
+ let day = date.getDate().toString().padStart(2, '0');
33
+ let hours = date.getHours().toString().padStart(2, '0');
34
+ let minutes = date.getMinutes().toString().padStart(2, '0');
35
+ let seconds = date.getSeconds().toString().padStart(2, '0');
36
+ let milliseconds = date.getMilliseconds().toString().padStart(3, '0');
37
+ return `${year}-${month}-${day}T${hours}:${minutes}:${seconds}.${milliseconds}${timezoneString}`;
38
+ }
39
+
40
+ }
41
+
42
+ exports.default = FWLoggerUtil;
43
+
44
+ _defineProperty(FWLoggerUtil, "enabled", false);
45
+ //# sourceMappingURL=FWLoggerUtil.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["FWLoggerUtil.ts"],"names":["FWLoggerUtil","log","message","enabled","process","env","NODE_ENV","currentDate","Date","console","toISOString","logNativeMessage","nativeMessage","date","timezoneOffset","getTimezoneOffset","timezoneSymbol","timezoneHours","Math","floor","abs","toString","padStart","timezoneMinutes","timezoneString","year","getFullYear","month","getMonth","day","getDate","hours","getHours","minutes","getMinutes","seconds","getSeconds","milliseconds","getMilliseconds"],"mappings":";;;;;;;;;AAAe,MAAMA,YAAN,CAAmB;AAEtB,SAAHC,GAAG,CAACC,OAAD,EAAkB;AAC1B,QAAIF,YAAY,CAACG,OAAb,IAAwBC,OAAO,CAACC,GAAR,CAAYC,QAAZ,KAAyB,aAArD,EAAoE;AAClE,YAAMC,WAAW,GAAG,IAAIC,IAAJ,EAApB;AAEAC,MAAAA,OAAO,CAACR,GAAR,CACE,6BADF,EAEG,GAAEC,OAAQ,IAAGF,YAAY,CAACU,WAAb,CAAyBH,WAAzB,CAAsC,EAFtD;AAID;AACF;;AAEsB,SAAhBI,gBAAgB,CAACC,aAAD,EAAwB;AAC7C,QAAIZ,YAAY,CAACG,OAAb,IAAwBC,OAAO,CAACC,GAAR,CAAYC,QAAZ,KAAyB,aAArD,EAAoE;AAClEG,MAAAA,OAAO,CAACR,GAAR,CAAY,sCAAZ,EAAoDW,aAApD;AACD;AACF;;AAEyB,SAAXF,WAAW,CAACG,IAAD,EAAqB;AAC7C,QAAIC,cAAc,GAAG,CAACD,IAAI,CAACE,iBAAL,EAAtB;AACA,QAAIC,cAAc,GAAGF,cAAc,IAAI,CAAlB,GAAsB,GAAtB,GAA4B,GAAjD;AACA,QAAIG,aAAa,GAAGC,IAAI,CAACC,KAAL,CAAWD,IAAI,CAACE,GAAL,CAASN,cAAT,IAA2B,EAAtC,EACjBO,QADiB,GAEjBC,QAFiB,CAER,CAFQ,EAEL,GAFK,CAApB;AAGA,QAAIC,eAAe,GAAG,CAACL,IAAI,CAACE,GAAL,CAASN,cAAT,IAA2B,EAA5B,EACnBO,QADmB,GAEnBC,QAFmB,CAEV,CAFU,EAEP,GAFO,CAAtB;AAGA,QAAIE,cAAc,GAAI,GAAER,cAAe,GAAEC,aAAc,IAAGM,eAAgB,EAA1E;AACA,QAAIE,IAAI,GAAGZ,IAAI,CAACa,WAAL,GAAmBL,QAAnB,EAAX;AACA,QAAIM,KAAK,GAAG,CAACd,IAAI,CAACe,QAAL,KAAkB,CAAnB,EAAsBP,QAAtB,GAAiCC,QAAjC,CAA0C,CAA1C,EAA6C,GAA7C,CAAZ;AACA,QAAIO,GAAG,GAAGhB,IAAI,CAACiB,OAAL,GAAeT,QAAf,GAA0BC,QAA1B,CAAmC,CAAnC,EAAsC,GAAtC,CAAV;AACA,QAAIS,KAAK,GAAGlB,IAAI,CAACmB,QAAL,GAAgBX,QAAhB,GAA2BC,QAA3B,CAAoC,CAApC,EAAuC,GAAvC,CAAZ;AACA,QAAIW,OAAO,GAAGpB,IAAI,CAACqB,UAAL,GAAkBb,QAAlB,GAA6BC,QAA7B,CAAsC,CAAtC,EAAyC,GAAzC,CAAd;AACA,QAAIa,OAAO,GAAGtB,IAAI,CAACuB,UAAL,GAAkBf,QAAlB,GAA6BC,QAA7B,CAAsC,CAAtC,EAAyC,GAAzC,CAAd;AACA,QAAIe,YAAY,GAAGxB,IAAI,CAACyB,eAAL,GAAuBjB,QAAvB,GAAkCC,QAAlC,CAA2C,CAA3C,EAA8C,GAA9C,CAAnB;AAEA,WAAQ,GAAEG,IAAK,IAAGE,KAAM,IAAGE,GAAI,IAAGE,KAAM,IAAGE,OAAQ,IAAGE,OAAQ,IAAGE,YAAa,GAAEb,cAAe,EAA/F;AACD;;AAtC+B;;;;gBAAbxB,Y,aACO,K","sourcesContent":["export default class FWLoggerUtil {\n static enabled: boolean = false;\n static log(message: string) {\n if (FWLoggerUtil.enabled && process.env.NODE_ENV === 'development') {\n const currentDate = new Date();\n\n console.log(\n '[react-native-firework-sdk]',\n `${message} ${FWLoggerUtil.toISOString(currentDate)}`\n );\n }\n }\n\n static logNativeMessage(nativeMessage: string) {\n if (FWLoggerUtil.enabled && process.env.NODE_ENV === 'development') {\n console.log('[react-native-firework-sdk] [native]', nativeMessage);\n }\n }\n\n private static toISOString(date: Date): string {\n let timezoneOffset = -date.getTimezoneOffset();\n let timezoneSymbol = timezoneOffset >= 0 ? '+' : '-';\n let timezoneHours = Math.floor(Math.abs(timezoneOffset) / 60)\n .toString()\n .padStart(2, '0');\n let timezoneMinutes = (Math.abs(timezoneOffset) % 60)\n .toString()\n .padStart(2, '0');\n let timezoneString = `${timezoneSymbol}${timezoneHours}:${timezoneMinutes}`;\n let year = date.getFullYear().toString();\n let month = (date.getMonth() + 1).toString().padStart(2, '0');\n let day = date.getDate().toString().padStart(2, '0');\n let hours = date.getHours().toString().padStart(2, '0');\n let minutes = date.getMinutes().toString().padStart(2, '0');\n let seconds = date.getSeconds().toString().padStart(2, '0');\n let milliseconds = date.getMilliseconds().toString().padStart(3, '0');\n\n return `${year}-${month}-${day}T${hours}:${minutes}:${seconds}.${milliseconds}${timezoneString}`;\n }\n}\n"]}
@@ -1,17 +1,13 @@
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 FWNavigatorModule from './modules/FWNavigatorModule';
3
+ import { FWEventName } from './models/FWEventName';
4
+ import FWNavigatorModule, { FWNavigatorModuleEventEmitter } from './modules/FWNavigatorModule';
5
+ import FWLoggerUtil from './utils/FWLoggerUtil';
6
+
4
7
  /**
5
8
  * You can use this class for pushing RN page from the native page.
6
9
  */
7
-
8
10
  class FWNavigator {
9
- constructor() {
10
- _defineProperty(this, "_currentCallbackId", 0);
11
-
12
- _defineProperty(this, "navigatorPages", new Map());
13
- }
14
-
15
11
  static getInstance() {
16
12
  if (!FWNavigator._instance) {
17
13
  FWNavigator._instance = new FWNavigator();
@@ -19,18 +15,21 @@ class FWNavigator {
19
15
 
20
16
  return FWNavigator._instance;
21
17
  }
18
+
19
+ constructor() {
20
+ FWNavigatorModuleEventEmitter.addListener(FWEventName.LogMessage, () => {});
21
+ }
22
22
  /**
23
- * Push RN page from native page. The RN page is embedded in a native container.
24
- * @param {React.ReactNode} page The RN page.
25
- * @returns {Promise<boolean>} The result of pushing RN page from native page
23
+ * Push a new native container. We will render your app component in new native container.
24
+ * Please set your app component name through FireworkSDK.getInstance().appComponentName before calling this method
25
+ * @param {FWNativeContainerProps} props We will pass the props to your app component.
26
+ * @returns {Promise<boolean>} The result of pushing RN page from native page.
26
27
  */
27
28
 
28
29
 
29
- pushNativeContainer(page) {
30
- this._currentCallbackId = this._currentCallbackId + 1;
31
- const callbackId = `${this._currentCallbackId}`;
32
- this.navigatorPages.set(callbackId, page);
33
- return FWNavigatorModule.pushNativeContainer(callbackId);
30
+ pushNativeContainer(props) {
31
+ FWLoggerUtil.log(`Enter pushNewNativeContainer`);
32
+ return FWNavigatorModule.pushNativeContainer(props);
34
33
  }
35
34
  /**
36
35
  * Pop top-most native container. The native container embed the RN page.
@@ -1 +1 @@
1
- {"version":3,"sources":["FWNavigator.tsx"],"names":["FWNavigatorModule","FWNavigator","Map","getInstance","_instance","pushNativeContainer","page","_currentCallbackId","callbackId","navigatorPages","set","popNativeContainer"],"mappings":";;AAAA,OAAOA,iBAAP,MAA8B,6BAA9B;AAEA;AACA;AACA;;AACA,MAAMC,WAAN,CAAkB;AAAA;AAAA,gDAEqB,CAFrB;;AAAA,4CAGQ,IAAIC,GAAJ,EAHR;AAAA;;AAKS,SAAXC,WAAW,GAAgB;AACvC,QAAI,CAACF,WAAW,CAACG,SAAjB,EAA4B;AAC1BH,MAAAA,WAAW,CAACG,SAAZ,GAAwB,IAAIH,WAAJ,EAAxB;AACD;;AACD,WAAOA,WAAW,CAACG,SAAnB;AACD;AAED;AACF;AACA;AACA;AACA;;;AACSC,EAAAA,mBAAmB,CAACC,IAAD,EAA0C;AAClE,SAAKC,kBAAL,GAA0B,KAAKA,kBAAL,GAA0B,CAApD;AACA,UAAMC,UAAU,GAAI,GAAE,KAAKD,kBAAmB,EAA9C;AACA,SAAKE,cAAL,CAAoBC,GAApB,CAAwBF,UAAxB,EAAoCF,IAApC;AACA,WAAON,iBAAiB,CAACK,mBAAlB,CAAsCG,UAAtC,CAAP;AACD;AAED;AACF;AACA;AACA;;;AACSG,EAAAA,kBAAkB,GAAqB;AAC5C,WAAOX,iBAAiB,CAACW,kBAAlB,EAAP;AACD;;AA9Be;;gBAAZV,W;;AAiCN,eAAeA,WAAf","sourcesContent":["import FWNavigatorModule from './modules/FWNavigatorModule';\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 private _currentCallbackId: number = 0;\n public navigatorPages = new Map<string, React.ReactNode>();\n\n public static getInstance(): FWNavigator {\n if (!FWNavigator._instance) {\n FWNavigator._instance = new FWNavigator();\n }\n return FWNavigator._instance!;\n }\n\n /**\n * Push RN page from native page. The RN page is embedded in a native container.\n * @param {React.ReactNode} page The RN page.\n * @returns {Promise<boolean>} The result of pushing RN page from native page\n */\n public pushNativeContainer(page: React.ReactNode): Promise<boolean> {\n this._currentCallbackId = this._currentCallbackId + 1;\n const callbackId = `${this._currentCallbackId}`;\n this.navigatorPages.set(callbackId, page);\n return FWNavigatorModule.pushNativeContainer(callbackId);\n }\n \n /**\n * Pop top-most native container. The native container embed the RN page.\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\nexport default FWNavigator;\n"]}
1
+ {"version":3,"sources":["FWNavigator.tsx"],"names":["FWEventName","FWNavigatorModule","FWNavigatorModuleEventEmitter","FWLoggerUtil","FWNavigator","getInstance","_instance","constructor","addListener","LogMessage","pushNativeContainer","props","log","popNativeContainer"],"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;AACpBL,IAAAA,6BAA6B,CAACM,WAA9B,CAA0CR,WAAW,CAACS,UAAtD,EAAkE,MAAM,CAAE,CAA1E;AACD;AAED;AACF;AACA;AACA;AACA;AACA;;;AACSC,EAAAA,mBAAmB,CAACC,KAAD,EAAkD;AAC1ER,IAAAA,YAAY,CAACS,GAAb,CAAkB,8BAAlB;AAEA,WAAOX,iBAAiB,CAACS,mBAAlB,CAAsCC,KAAtC,CAAP;AACD;AAED;AACF;AACA;AACA;;;AACSE,EAAAA,kBAAkB,GAAqB;AAC5C,WAAOZ,iBAAiB,CAACY,kBAAlB,EAAP;AACD;;AAhCe;;gBAAZT,W;;AAmCN,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 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. The native container embed the RN page.\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\nexport default FWNavigator;\n"]}
@@ -7,6 +7,7 @@ import LiveStreamModule from './modules/LiveStreamModule';
7
7
  import ShoppingModule from './modules/ShoppingModule';
8
8
  import VideoShopping from './VideoShopping';
9
9
  import FWNavigator from './FWNavigator';
10
+ import FWLoggerUtil from './utils/FWLoggerUtil';
10
11
 
11
12
  /**
12
13
  * Entry class of Firework SDK, which supports the sdk initialization and global configuration.
@@ -28,10 +29,23 @@ class FireworkSDK {
28
29
  }
29
30
 
30
31
  set onCustomCTAClick(value) {
32
+ FWLoggerUtil.log(`Set onCustomCTAClick callback ${!!value}`);
31
33
  this._onCustomCTAClick = value;
32
34
  FireworkSDKModule.setCustomCTAClickEnabled(value ? true : false);
33
35
  }
34
36
 
37
+ /**
38
+ * The custom CTA link content page route name.
39
+ */
40
+ get customCTALinkContentPageRouteName() {
41
+ return this._customCTALinkContentPageRouteName;
42
+ }
43
+
44
+ set customCTALinkContentPageRouteName(value) {
45
+ this._customCTALinkContentPageRouteName = value;
46
+ FireworkSDKModule.setCustomCTALinkContentPageRouteName(value !== null && value !== void 0 ? value : '');
47
+ }
48
+
35
49
  /**
36
50
  * The callback of video playback.
37
51
  */
@@ -53,7 +67,7 @@ class FireworkSDK {
53
67
 
54
68
  set shareBaseURL(value) {
55
69
  this._shareBaseURL = value;
56
- FireworkSDKModule.setShareBaseURL(value).then(() => {
70
+ FireworkSDKModule.setShareBaseURL(value !== null && value !== void 0 ? value : '').then(() => {
57
71
  this.eventEmitter.emit(FWEventName.ShareBaseURLUpdated);
58
72
  });
59
73
  }
@@ -67,11 +81,23 @@ class FireworkSDK {
67
81
 
68
82
  set adBadgeConfiguration(value) {
69
83
  this._adBadgeConfiguration = value;
70
- FireworkSDKModule.setAdBadgeConfiguration(value).then(() => {
84
+ FireworkSDKModule.setAdBadgeConfiguration(value !== null && value !== void 0 ? value : {}).then(() => {
71
85
  this.eventEmitter.emit(FWEventName.AdBadgeConfigurationUpdated);
72
86
  });
73
87
  }
74
88
 
89
+ /**
90
+ * The app component name.
91
+ */
92
+ get appComponentName() {
93
+ return this._appComponentName;
94
+ }
95
+
96
+ set appComponentName(value) {
97
+ this._appComponentName = value;
98
+ FireworkSDKModule.setAppComponentName(value !== null && value !== void 0 ? value : '');
99
+ }
100
+
75
101
  get eventEmitter() {
76
102
  return FireworkSDKModuleEventEmitter;
77
103
  }
@@ -120,28 +146,43 @@ class FireworkSDK {
120
146
 
121
147
  _defineProperty(this, "_onCustomCTAClick", void 0);
122
148
 
149
+ _defineProperty(this, "_customCTALinkContentPageRouteName", void 0);
150
+
123
151
  _defineProperty(this, "_onVideoPlayback", void 0);
124
152
 
125
153
  _defineProperty(this, "_shareBaseURL", void 0);
126
154
 
127
155
  _defineProperty(this, "_adBadgeConfiguration", void 0);
128
156
 
157
+ _defineProperty(this, "_appComponentName", void 0);
158
+
129
159
  this.eventEmitter.addListener(FWEventName.SDKInit, event => {
160
+ FWLoggerUtil.log(`Receive SDKInit event ${event === null || event === void 0 ? void 0 : event.error}`);
161
+
130
162
  if (this.onSDKInit) {
131
163
  this.onSDKInit(event !== null && event !== void 0 ? event : {});
132
164
  }
133
165
  });
166
+ this.eventEmitter.addListener(FWEventName.LogMessage, event => {
167
+ FWLoggerUtil.logNativeMessage(event.message);
168
+ });
134
169
  this.eventEmitter.addListener(FWEventName.CustomCTAClick, event => {
170
+ FWLoggerUtil.log(`Receive CustomCTAClick url ${event === null || event === void 0 ? void 0 : event.url}`);
171
+
135
172
  if (this.onCustomCTAClick) {
136
173
  this.onCustomCTAClick(event !== null && event !== void 0 ? event : {});
137
174
  }
138
175
  });
139
176
  this.eventEmitter.addListener(FWEventName.VideoPlayback, event => {
177
+ FWLoggerUtil.log(`Receive VideoPlayback event ${event === null || event === void 0 ? void 0 : event.eventName}`);
178
+
140
179
  if (this.onVideoPlayback) {
141
180
  this.onVideoPlayback(event !== null && event !== void 0 ? event : {});
142
181
  }
143
182
  });
144
183
  this.eventEmitter.addListener(FWEventName.VideoFeedClick, event => {
184
+ FWLoggerUtil.log(`Receive VideoFeedClick event ${event === null || event === void 0 ? void 0 : event.info.id}`);
185
+
145
186
  if (this.onVideoFeedClick) {
146
187
  this.onVideoFeedClick(event !== null && event !== void 0 ? event : {});
147
188
  }
@@ -150,12 +191,11 @@ class FireworkSDK {
150
191
  /**
151
192
  * Initializes Firework SDK.
152
193
  * @param {string?} userId An id to uniquely identify device or user.
153
- * @param {AdConfig?} adConfig Configuration of Ad.
154
194
  */
155
195
 
156
196
 
157
- init(userId, adConfig) {
158
- FireworkSDKModule.init(userId, adConfig);
197
+ init(userId) {
198
+ FireworkSDKModule.init(userId);
159
199
  ShoppingModule.init();
160
200
  LiveStreamModule.init();
161
201
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["FireworkSDK.ts"],"names":["LiveStream","FWEventName","FireworkSDKModule","FireworkSDKModuleEventEmitter","LiveStreamModule","ShoppingModule","VideoShopping","FWNavigator","FireworkSDK","onCustomCTAClick","_onCustomCTAClick","value","setCustomCTAClickEnabled","onVideoPlayback","_onVideoPlayback","setVideoPlaybackEventEnabled","shareBaseURL","_shareBaseURL","setShareBaseURL","then","eventEmitter","emit","ShareBaseURLUpdated","adBadgeConfiguration","_adBadgeConfiguration","setAdBadgeConfiguration","AdBadgeConfigurationUpdated","shopping","getInstance","liveStream","navigator","_instance","constructor","addListener","SDKInit","event","onSDKInit","CustomCTAClick","VideoPlayback","VideoFeedClick","onVideoFeedClick","init","userId","adConfig","openVideoP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+B,EAA/B;AACD;AACF,KAJD;AAMA,SAAKf,YAAL,CAAkBa,WAAlB,CAA8BhC,WAAW,CAACqC,aAA1C,EAA0DH,KAAD,IAAW;AAClE,UAAI,KAAKtB,eAAT,EAA0B;AACxB,aAAKA,eAAL,CAAqBsB,KAArB,aAAqBA,KAArB,cAAqBA,KAArB,GAA8B,EAA9B;AACD;AACF,KAJD;AAMA,SAAKf,YAAL,CAAkBa,WAAlB,CAA8BhC,WAAW,CAACsC,cAA1C,EAA2DJ,KAAD,IAAW;AACnE,UAAI,KAAKK,gBAAT,EAA2B;AACzB,aAAKA,gBAAL,CAAsBL,KAAtB,aAAsBA,KAAtB,cAAsBA,KAAtB,GAA+B,EAA/B;AACD;AACF,KAJD;AAKD;AAED;AACF;AACA;AACA;AACA;;;AACSM,EAAAA,IAAI,CAACC,MAAD,EAAkBC,QAAlB,EAAuC;AAChDzC,IAAAA,iBAAiB,CAACuC,IAAlB,CAAuBC,MAAvB,EAA+BC,QAA/B;AACAtC,IAAAA,cAAc,CAACoC,IAAf;AACArC,IAAAA,gBAAgB,CAACqC,IAAjB;AACD;AAED;AACF;AACA;AACA;AACA;;;AACSG,EAAAA,eAAe,CAACC,GAAD,EAAcC,MAAd,EAAiD;AACrE5C,IAAAA,iBAAiB,CAAC0C,eAAlB,CAAkCC,GAAlC,EAAuCC,MAAvC,aAAuCA,MAAvC,cAAuCA,MAAvC,GAAiD,EAAjD;AACD;;AAlJe;;gBAAZtC,W;;AAqJN,eAAeA,WAAf","sourcesContent":["import type { NativeEventEmitter } from 'react-native';\nimport LiveStream from './LiveStream';\n\nimport type AdBadgeConfiguration from './models/AdBadgeConfiguration';\nimport type AdConfig from './models/AdConfig';\nimport { FWEventName } from './models/FWEventName';\nimport type {\n CustomCTAClickEvent,\n SDKInitEvent,\n VideoFeedClickEvent,\n VideoPlaybackEvent,\n} from './models/FWEvents';\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 VideoShopping from './VideoShopping';\nimport FWNavigator from './FWNavigator';\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 this._onCustomCTAClick = value;\n FireworkSDKModule.setCustomCTAClickEnabled(value ? true : false);\n }\n private _onCustomCTAClick: CustomCTAClickCallback | 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 this._shareBaseURL = value;\n FireworkSDKModule.setShareBaseURL(value).then(() => {\n this.eventEmitter.emit(FWEventName.ShareBaseURLUpdated);\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 this._adBadgeConfiguration = value;\n FireworkSDKModule.setAdBadgeConfiguration(value).then(() => {\n this.eventEmitter.emit(FWEventName.AdBadgeConfigurationUpdated);\n });\n }\n private _adBadgeConfiguration?: AdBadgeConfiguration | undefined;\n\n private get eventEmitter(): NativeEventEmitter {\n return FireworkSDKModuleEventEmitter;\n }\n\n /**\n * Get VideoShopping object.\n */\n public get shopping(): VideoShopping {\n return VideoShopping.getInstance();\n }\n\n /**\n * Get LiveStream object.\n */\n public get liveStream(): LiveStream {\n return LiveStream.getInstance();\n }\n\n /**\n * Get FWNavigator object.\n */\n public get navigator(): FWNavigator {\n return FWNavigator.getInstance();\n }\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 this.eventEmitter.addListener(FWEventName.SDKInit, (event) => {\n if (this.onSDKInit) {\n this.onSDKInit(event ?? {});\n }\n });\n\n this.eventEmitter.addListener(FWEventName.CustomCTAClick, (event) => {\n if (this.onCustomCTAClick) {\n this.onCustomCTAClick(event ?? {});\n }\n });\n\n this.eventEmitter.addListener(FWEventName.VideoPlayback, (event) => {\n if (this.onVideoPlayback) {\n this.onVideoPlayback(event ?? {});\n }\n });\n\n this.eventEmitter.addListener(FWEventName.VideoFeedClick, (event) => {\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 * @param {AdConfig?} adConfig Configuration of Ad.\n */\n public init(userId?: string, adConfig?: AdConfig) {\n FireworkSDKModule.init(userId, adConfig);\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\nexport default FireworkSDK;\n"]}
1
+ {"version":3,"sources":["FireworkSDK.ts"],"names":["LiveStream","FWEventName","FireworkSDKModule","FireworkSDKModuleEventEmitter","LiveStreamModule","ShoppingModule","VideoShopping","FWNavigator","FWLoggerUtil","FireworkSDK","onCustomCTAClick","_onCustomCTAClick","value","log","setCustomCTAClickEnabled","customCTALinkContentPageRouteName","_customCTALinkContentPageRouteName","setCustomCTALinkContentPageRouteName","onVideoPlayback","_onVideoPlayback","setVideoPlaybackEventEnabled","shareBaseURL","_shareBaseURL","setShareBaseURL","then","eventEmitter","emit","ShareBaseURLUpdated","adBadgeConfiguration","_adBadgeConfiguration","setAdBadgeConfiguration","AdBadgeConfigurationUpdated","appComponentName","_appComponentName","setAppComponentName","shopping","getInstance","liveStream","navigator","_instance","constructor","addListener","SDKInit","event","error","onSDKInit","LogMessage","logNativeMessage","message","CustomCTAClick","url","VideoPlayback","eventName","VideoFeedClick","info","id","onVideoFeedClick","init","userId","openVideoPlayer","config"],"mappings":";;AACA,OAAOA,UAAP,MAAuB,cAAvB;AAGA,SAASC,WAAT,QAA4B,sBAA5B;AAQA,OAAOC,iBAAP,IACEC,6BADF,QAEO,6BAFP;AAGA,OAAOC,gBAAP,MAA6B,4BAA7B;AACA,OAAOC,cAAP,MAA2B,0BAA3B;AACA,OAAOC,aAAP,MAA0B,iBAA1B;AACA,OAAOC,WAAP,MAAwB,eAAxB;AACA,OAAOC,YAAP,MAAyB,sBAAzB;;AAUA;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;AACrEJ,IAAAA,YAAY,CAACK,GAAb,CAAkB,iCAAgC,CAAC,CAACD,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sBA,KAAtB,GAA+B,EAA/B;AACD;AACF,KAND;AAOD;AAED;AACF;AACA;AACA;;;AACSc,EAAAA,IAAI,CAACC,MAAD,EAAkB;AAC3BxD,IAAAA,iBAAiB,CAACuD,IAAlB,CAAuBC,MAAvB;AACArD,IAAAA,cAAc,CAACoD,IAAf;AACArD,IAAAA,gBAAgB,CAACqD,IAAjB;AACD;AAED;AACF;AACA;AACA;AACA;;;AACSE,EAAAA,eAAe,CAACT,GAAD,EAAcU,MAAd,EAAiD;AACrE1D,IAAAA,iBAAiB,CAACyD,eAAlB,CAAkCT,GAAlC,EAAuCU,MAAvC,aAAuCA,MAAvC,cAAuCA,MAAvC,GAAiD,EAAjD;AACD;;AAtLe;;gBAAZnD,W;;AAyLN,eAAeA,WAAf","sourcesContent":["import type { NativeEventEmitter } from 'react-native';\nimport LiveStream from './LiveStream';\n\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 VideoPlayerConfiguration from './models/VideoPlayerConfiguration';\nimport FireworkSDKModule, {\n FireworkSDKModuleEventEmitter,\n} from './modules/FireworkSDKModule';\nimport LiveStreamModule from './modules/LiveStreamModule';\nimport ShoppingModule from './modules/ShoppingModule';\nimport VideoShopping from './VideoShopping';\nimport FWNavigator from './FWNavigator';\nimport FWLoggerUtil from './utils/FWLoggerUtil';\n\nexport type SDKInitCallback = (event: SDKInitEvent) => void;\nexport type CustomCTAClickCallback = (event: CustomCTAClickEvent) => void;\nexport type CustomCTALinkContentRender = (\n event: CustomCTAClickEvent\n) => React.ReactNode | null;\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 this._shareBaseURL = value;\n FireworkSDKModule.setShareBaseURL(value ?? '').then(() => {\n this.eventEmitter.emit(FWEventName.ShareBaseURLUpdated);\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 this._adBadgeConfiguration = value;\n FireworkSDKModule.setAdBadgeConfiguration(value ?? {}).then(() => {\n this.eventEmitter.emit(FWEventName.AdBadgeConfigurationUpdated);\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 private get eventEmitter(): NativeEventEmitter {\n return FireworkSDKModuleEventEmitter;\n }\n\n /**\n * Get VideoShopping object.\n */\n public get shopping(): VideoShopping {\n return VideoShopping.getInstance();\n }\n\n /**\n * Get LiveStream object.\n */\n public get liveStream(): LiveStream {\n return LiveStream.getInstance();\n }\n\n /**\n * Get FWNavigator object.\n */\n public get navigator(): FWNavigator {\n return FWNavigator.getInstance();\n }\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 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(`Receive VideoPlayback event ${event?.eventName}`);\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 ${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 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\nexport default FireworkSDK;\n"]}
@@ -1,7 +1,7 @@
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 { FWEventName } from "./models/FWEventName";
4
- import { LiveStreamModuleEventEmitter } from "./modules/LiveStreamModule";
3
+ import { FWEventName } from './models/FWEventName';
4
+ import { LiveStreamModuleEventEmitter } from './modules/LiveStreamModule';
5
5
 
6
6
  /**
7
7
  * The entry class of live stream.
@@ -31,12 +31,12 @@ class LiveStream {
31
31
 
32
32
  _defineProperty(this, "onLiveStreamChatEvent", void 0);
33
33
 
34
- this.eventEmitter.addListener(FWEventName.onLiveStreamEvent, event => {
34
+ this.eventEmitter.addListener(FWEventName.LiveStream, event => {
35
35
  if (this.onLiveStreamEvent) {
36
36
  this.onLiveStreamEvent(event !== null && event !== void 0 ? event : {});
37
37
  }
38
38
  });
39
- this.eventEmitter.addListener(FWEventName.onLiveStreamChatEvent, event => {
39
+ this.eventEmitter.addListener(FWEventName.LiveStreamChat, event => {
40
40
  if (this.onLiveStreamChatEvent) {
41
41
  this.onLiveStreamChatEvent(event !== null && event !== void 0 ? event : {});
42
42
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["LiveStream.ts"],"names":["FWEventName","LiveStreamModuleEventEmitter","LiveStream","eventEmitter","getInstance","_instance","constructor","addListener","onLiveStreamEvent","event","onLiveStreamChatEvent"],"mappings":";;AACA,SAASA,WAAT,QAA4B,sBAA5B;AAEA,SAASC,4BAAT,QAA6C,4BAA7C;;AAKA;AACA;AACA;AACA,MAAMC,UAAN,CAAiB;AAGf;AACF;AACA;;AAEE;AACF;AACA;AAG0B,MAAZC,YAAY,GAAuB;AAC7C,WAAOF,4BAAP;AACD;;AAEwB,SAAXG,WAAW,GAAG;AAC1B,QAAI,CAACF,UAAU,CAACG,SAAhB,EAA2B;AACzBH,MAAAA,UAAU,CAACG,SAAX,GAAuB,IAAIH,UAAJ,EAAvB;AACD;;AAED,WAAOA,UAAU,CAACG,SAAlB;AACD;;AAEOC,EAAAA,WAAW,GAAG;AAAA;;AAAA;;AACpB,SAAKH,YAAL,CAAkBI,WAAlB,CAA8BP,WAAW,CAACQ,iBAA1C,EAA8DC,KAAD,IAAW;AACtE,UAAI,KAAKD,iBAAT,EAA4B;AAC1B,aAAKA,iBAAL,CAAuBC,KAAvB,aAAuBA,KAAvB,cAAuBA,KAAvB,GAAgC,EAAhC;AACD;AACF,KAJD;AAMA,SAAKN,YAAL,CAAkBI,WAAlB,CAA8BP,WAAW,CAACU,qBAA1C,EAAkED,KAAD,IAAW;AAC1E,UAAI,KAAKC,qBAAT,EAAgC;AAC9B,aAAKA,qBAAL,CAA2BD,KAA3B,aAA2BA,KAA3B,cAA2BA,KAA3B,GAAoC,EAApC;AACD;AACF,KAJD;AAKD;;AApCc;;gBAAXP,U;;AAuCN,eAAeA,UAAf","sourcesContent":["import type { NativeEventEmitter } from \"react-native\";\nimport { FWEventName } from \"./models/FWEventName\";\nimport type { LiveStreamChatEvent, LiveStreamEvent } from \"./models/FWEvents\";\nimport { LiveStreamModuleEventEmitter } from \"./modules/LiveStreamModule\";\n\nexport type onLiveStreamEventCallback = (event: LiveStreamEvent) => void;\nexport type onLiveStreamChatEventCallback = (event: LiveStreamChatEvent) => void;\n\n/**\n * The entry class of live stream.\n */\nclass LiveStream {\n private static _instance?: LiveStream;\n\n /**\n * The callback of live stream event.\n */\n public onLiveStreamEvent?: onLiveStreamEventCallback;\n /**\n * The callback of live stream chat event.\n */\n public onLiveStreamChatEvent?: onLiveStreamChatEventCallback;\n\n private get eventEmitter(): NativeEventEmitter {\n return LiveStreamModuleEventEmitter;\n }\n\n public static getInstance() {\n if (!LiveStream._instance) {\n LiveStream._instance = new LiveStream();\n }\n\n return LiveStream._instance!;\n }\n\n private constructor() {\n this.eventEmitter.addListener(FWEventName.onLiveStreamEvent, (event) => {\n if (this.onLiveStreamEvent) {\n this.onLiveStreamEvent(event ?? {});\n }\n });\n\n this.eventEmitter.addListener(FWEventName.onLiveStreamChatEvent, (event) => {\n if (this.onLiveStreamChatEvent) {\n this.onLiveStreamChatEvent(event ?? {});\n }\n });\n }\n}\n\nexport default LiveStream;\n"]}
1
+ {"version":3,"sources":["LiveStream.ts"],"names":["FWEventName","LiveStreamModuleEventEmitter","LiveStream","eventEmitter","getInstance","_instance","constructor","addListener","event","onLiveStreamEvent","LiveStreamChat","onLiveStreamChatEvent"],"mappings":";;AACA,SAASA,WAAT,QAA4B,sBAA5B;AAEA,SAASC,4BAAT,QAA6C,4BAA7C;;AAOA;AACA;AACA;AACA,MAAMC,UAAN,CAAiB;AAGf;AACF;AACA;;AAEE;AACF;AACA;AAG0B,MAAZC,YAAY,GAAuB;AAC7C,WAAOF,4BAAP;AACD;;AAEwB,SAAXG,WAAW,GAAG;AAC1B,QAAI,CAACF,UAAU,CAACG,SAAhB,EAA2B;AACzBH,MAAAA,UAAU,CAACG,SAAX,GAAuB,IAAIH,UAAJ,EAAvB;AACD;;AAED,WAAOA,UAAU,CAACG,SAAlB;AACD;;AAEOC,EAAAA,WAAW,GAAG;AAAA;;AAAA;;AACpB,SAAKH,YAAL,CAAkBI,WAAlB,CAA8BP,WAAW,CAACE,UAA1C,EAAuDM,KAAD,IAAW;AAC/D,UAAI,KAAKC,iBAAT,EAA4B;AAC1B,aAAKA,iBAAL,CAAuBD,KAAvB,aAAuBA,KAAvB,cAAuBA,KAAvB,GAAgC,EAAhC;AACD;AACF,KAJD;AAMA,SAAKL,YAAL,CAAkBI,WAAlB,CAA8BP,WAAW,CAACU,cAA1C,EAA2DF,KAAD,IAAW;AACnE,UAAI,KAAKG,qBAAT,EAAgC;AAC9B,aAAKA,qBAAL,CAA2BH,KAA3B,aAA2BA,KAA3B,cAA2BA,KAA3B,GAAoC,EAApC;AACD;AACF,KAJD;AAKD;;AApCc;;gBAAXN,U;;AAuCN,eAAeA,UAAf","sourcesContent":["import type { NativeEventEmitter } from 'react-native';\nimport { FWEventName } from './models/FWEventName';\nimport type { LiveStreamChatEvent, LiveStreamEvent } from './models/FWEvents';\nimport { LiveStreamModuleEventEmitter } from './modules/LiveStreamModule';\n\nexport type onLiveStreamEventCallback = (event: LiveStreamEvent) => void;\nexport type onLiveStreamChatEventCallback = (\n event: LiveStreamChatEvent\n) => void;\n\n/**\n * The entry class of live stream.\n */\nclass LiveStream {\n private static _instance?: LiveStream;\n\n /**\n * The callback of live stream event.\n */\n public onLiveStreamEvent?: onLiveStreamEventCallback;\n /**\n * The callback of live stream chat event.\n */\n public onLiveStreamChatEvent?: onLiveStreamChatEventCallback;\n\n private get eventEmitter(): NativeEventEmitter {\n return LiveStreamModuleEventEmitter;\n }\n\n public static getInstance() {\n if (!LiveStream._instance) {\n LiveStream._instance = new LiveStream();\n }\n\n return LiveStream._instance!;\n }\n\n private constructor() {\n this.eventEmitter.addListener(FWEventName.LiveStream, (event) => {\n if (this.onLiveStreamEvent) {\n this.onLiveStreamEvent(event ?? {});\n }\n });\n\n this.eventEmitter.addListener(FWEventName.LiveStreamChat, (event) => {\n if (this.onLiveStreamChatEvent) {\n this.onLiveStreamChatEvent(event ?? {});\n }\n });\n }\n}\n\nexport default LiveStream;\n"]}
@@ -32,7 +32,7 @@ class VideoShopping {
32
32
  */
33
33
 
34
34
  /**
35
- * Defaults to true. You can hide the cart icon by setting this property to false.
35
+ * Defaults to true. You can hide the cart icon by setting this property to false.
36
36
  */
37
37
  get cartIconVisible() {
38
38
  return this._cartIconVisible;
@@ -66,8 +66,6 @@ class VideoShopping {
66
66
 
67
67
  _defineProperty(this, "_cartIconVisible", true);
68
68
 
69
- _defineProperty(this, "currentCartPage", void 0);
70
-
71
69
  this.eventEmitter.addListener(FWEventName.AddToCart, event => {
72
70
  this.handleAddToCartEvent(event);
73
71
  });
@@ -82,17 +80,7 @@ class VideoShopping {
82
80
  });
83
81
  }
84
82
  /**
85
- * Exit Cart Page.
86
83
  *
87
- * The host app can call this method to exit their cart page.
88
- */
89
-
90
-
91
- exitCartPage() {
92
- ShoppingModule.exitCartPage();
93
- }
94
- /**
95
- *
96
84
  * @param {number} count The number of items in the host app cart
97
85
  */
98
86
 
@@ -117,11 +105,10 @@ class VideoShopping {
117
105
  if (this.onClickCartIcon) {
118
106
  const callbackId = event.callbackId;
119
107
  delete event.callbackId;
120
- const cartPage = await this.onClickCartIcon();
121
- this.currentCartPage = cartPage;
108
+ const props = await this.onClickCartIcon();
122
109
 
123
- if (cartPage) {
124
- ShoppingModule.jumpToCartPage(callbackId);
110
+ if (callbackId) {
111
+ ShoppingModule.jumpToCartPage(callbackId, props !== null && props !== void 0 ? props : {});
125
112
  }
126
113
  }
127
114
  }
@@ -131,7 +118,6 @@ class VideoShopping {
131
118
  const callbackId = event.callbackId;
132
119
  delete event.callbackId;
133
120
  const productList = await this.onUpdateProductDetails(event);
134
- console.log('handleUpdateProductDetailsEvent productList', JSON.stringify(productList));
135
121
 
136
122
  if (productList) {
137
123
  ShoppingModule.updateVideoProducts(productList, callbackId);
@@ -1 +1 @@
1
- {"version":3,"sources":["VideoShopping.ts"],"names":["FWEventName","ShoppingModule","ShoppingModuleEventEmitter","VideoShopping","cartIconVisible","_cartIconVisible","value","setCartIconVisible","eventEmitter","getInstance","_instance","constructor","addListener","AddToCart","event","handleAddToCartEvent","ClickCartIcon","handleClickCartIconEvent","UpdateProductDetails","handleUpdateProductDetailsEvent","WillDisplayProduct","handleWillDisplayProductEvent","exitCartPage","setCartItemCount","count","onAddToCart","callbackId","result","updateAddToCartStatus","res","tips","onClickCartIcon","cartPage","currentCartPage","jumpToCartPage","onUpdateProductDetails","productList","console","log","JSON","stringify","updateVideoProducts","onWillDisplayProduct","config","updateProductViewConfig"],"mappings":";;AAQA,SAASA,WAAT,QAA4B,sBAA5B;AAGA,OAAOC,cAAP,IAAyBC,0BAAzB,QAA2D,0BAA3D;;AAoBA;AACA;AACA;AACA,MAAMC,aAAN,CAAoB;AAGlB;AACF;AACA;AACA;AACA;;AAGE;AACF;AACA;AACA;AACA;;AAGE;AACF;AACA;AACA;AACA;;AAGE;AACF;AACA;AACA;AACA;;AAGE;AACF;AACA;AAC4B,MAAfC,eAAe,GAAY;AACpC,WAAO,KAAKC,gBAAZ;AACD;;AACyB,MAAfD,eAAe,CAACE,KAAD,EAAiB;AACzC,SAAKD,gBAAL,GAAwBC,KAAxB;AACAL,IAAAA,cAAc,CAACM,kBAAf,CAAkCD,KAAlC;AACD;;AAKuB,MAAZE,YAAY,GAAuB;AAC7C,WAAON,0BAAP;AACD;;AAEwB,SAAXO,WAAW,GAAG;AAC1B,QAAI,CAACN,aAAa,CAACO,SAAnB,EAA8B;AAC5BP,MAAAA,aAAa,CAACO,SAAd,GAA0B,IAAIP,aAAJ,EAA1B;AACD;;AAED,WAAOA,aAAa,CAACO,SAArB;AACD;;AAEOC,EAAAA,WAAW,GAAG;AAAA;;AAAA;;AAAA;;AAAA;;AAAA,8CAhBc,IAgBd;;AAAA;;AACpB,SAAKH,YAAL,CAAkBI,WAAlB,CAA8BZ,WAAW,CAACa,SAA1C,EAAsDC,KAAD,IAAW;AAC9D,WAAKC,oBAAL,CAA0BD,KAA1B;AACD,KAFD;AAIA,SAAKN,YAAL,CAAkBI,WAAlB,CAA8BZ,WAAW,CAACgB,aAA1C,EAA0DF,KAAD,IAAW;AAClE,WAAKG,wBAAL,CAA8BH,KAA9B;AACD,KAFD;AAIA,SAAKN,YAAL,CAAkBI,WAAlB,CAA8BZ,WAAW,CAACkB,oBAA1C,EAAi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AzB;AACA,aAAOZ,KAAK,CAACY,UAAb;AACA,YAAMU,WAAW,GAAG,MAAM,KAAKD,sBAAL,CACxBrB,KADwB,CAA1B;AAGAuB,MAAAA,OAAO,CAACC,GAAR,CAAY,6CAAZ,EAA2DC,IAAI,CAACC,SAAL,CAAeJ,WAAf,CAA3D;;AACA,UAAIA,WAAJ,EAAiB;AACfnC,QAAAA,cAAc,CAACwC,mBAAf,CAAmCL,WAAnC,EAAgDV,UAAhD;AACD;AACF;AACF;;AAE0C,QAA7BL,6BAA6B,CACzCP,KADyC,EAEzC;AACA,QAAI,KAAK4B,oBAAT,EAA+B;AAC7B,YAAMhB,UAAU,GAAGZ,KAAK,CAACY,UAAzB;AACA,aAAOZ,KAAK,CAACY,UAAb;AACA,YAAMiB,MAAM,GAAG,MAAM,KAAKD,oBAAL,CACnB5B,KADmB,CAArB;;AAGA,UAAI6B,MAAJ,EAAY;AACV1C,QAAAA,cAAc,CAAC2C,uBAAf,CAAuCD,MAAvC,EAA+CjB,UAA/C;AACD;AACF;AACF;;AArJiB;;gBAAdvB,a;;AAwJN,eAAeA,aAAf","sourcesContent":["import type { NativeEventEmitter } 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, { ShoppingModuleEventEmitter } from './modules/ShoppingModule';\n\nexport type AddToCartCallback = (\n event: AddToCartEvent\n) => Promise<AddToCartResult | undefined | null>;\n\nexport type ClickCartIconCallback = () => Promise<\n React.ReactNode | undefined | null\n>;\n\nexport type UpdateProductDetailsCallback = (\n event: UpdateProductDetailsEvent\n) => Promise<Product[] | undefined | null>;\n\nexport type WillDisplayProductCallback = (\n event: WillDisplayProductEvent\n) => Promise<ProductInfoViewConfiguration | undefined | null>;\n\ntype CallbackInfo = { callbackId?: number | string };\n\n/**\n * The entry class of video shopping.\n */\nclass VideoShopping {\n private static _instance?: VideoShopping;\n\n /**\n * This callback is triggered when the user clicks the \"Add to cart\" button.\n *\n * The host app can return an AddToCartResult object to tell FireworkSDK the result of adding to cart.\n */\n public onAddToCart?: AddToCartCallback;\n\n /**\n * This callback is triggered when the user clicks the shopping cart icon.\n *\n * The host app can return a React.Node to integrate custom cart page to shopping flow.\n */\n public onClickCartIcon?: ClickCartIconCallback;\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.\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 public currentCartPage?: React.ReactNode;\n\n private get eventEmitter(): NativeEventEmitter {\n return ShoppingModuleEventEmitter;\n }\n\n public static getInstance() {\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 this.handleAddToCartEvent(event);\n });\n\n this.eventEmitter.addListener(FWEventName.ClickCartIcon, (event) => {\n this.handleClickCartIconEvent(event);\n });\n\n this.eventEmitter.addListener(FWEventName.UpdateProductDetails, (event) => {\n this.handleUpdateProductDetailsEvent(event);\n });\n\n this.eventEmitter.addListener(FWEventName.WillDisplayProduct, (event) => {\n this.handleWillDisplayProductEvent(event);\n });\n }\n\n /**\n * Exit Cart Page.\n *\n * The host app can call this method to exit their cart page.\n */\n public exitCartPage() {\n ShoppingModule.exitCartPage();\n }\n\n /**\n * \n * @param {number} count The number of items in the host app cart\n */\n public setCartItemCount(count: number) {\n ShoppingModule.setCartItemCount(count);\n }\n\n private async handleAddToCartEvent(event: AddToCartEvent & CallbackInfo) {\n if (this.onAddToCart) {\n const callbackId = event.callbackId;\n delete event.callbackId;\n const result = await this.onAddToCart(event as AddToCartEvent);\n if (result) {\n ShoppingModule.updateAddToCartStatus(\n result.res,\n result.tips,\n callbackId!,\n );\n }\n }\n }\n\n private async handleClickCartIconEvent(event: CallbackInfo) {\n if (this.onClickCartIcon) {\n const callbackId = event.callbackId;\n delete event.callbackId;\n const cartPage = await this.onClickCartIcon();\n this.currentCartPage = cartPage;\n\n if (cartPage) {\n ShoppingModule.jumpToCartPage(callbackId!);\n }\n }\n }\n\n private async handleUpdateProductDetailsEvent(\n event: UpdateProductDetailsEvent & CallbackInfo\n ) {\n if (this.onUpdateProductDetails) {\n const callbackId = event.callbackId;\n delete event.callbackId;\n const productList = await this.onUpdateProductDetails(\n event as UpdateProductDetailsEvent\n );\n console.log('handleUpdateProductDetailsEvent productList', JSON.stringify(productList));\n if (productList) {\n ShoppingModule.updateVideoProducts(productList, callbackId!);\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) {\n ShoppingModule.updateProductViewConfig(config, callbackId!);\n }\n }\n }\n}\n\nexport default VideoShopping;\n"]}
1
+ {"version":3,"sources":["VideoShopping.ts"],"names":["FWEventName","ShoppingModule","ShoppingModuleEventEmitter","VideoShopping","cartIconVisible","_cartIconVisible","value","setCartIconVisible","eventEmitter","getInstance","_instance","constructor","addListener","AddToCart","event","handleAddToCartEvent","ClickCartIcon","handleClickCartIconEvent","UpdateProductDetails","handleUpdateProductDetailsEvent","WillDisplayProduct","handleWillDisplayProductEvent","setCartItemCount","count","onAddToCart","callbackId","result","updateAddToCartStatus","res","tips","onClickCartIcon","props","jumpToCartPage","onUpdateProductDetails","productList","updateVideoProducts","onWillDisplayProduct","config","updateProductViewConfig"],"mappings":";;AAQA,SAASA,WAAT,QAA4B,sBAA5B;AAGA,OAAOC,cAAP,IACEC,0BADF,QAEO,0BAFP;;AAuBA;AACA;AACA;AACA,MAAMC,aAAN,CAAoB;AAGlB;AACF;AACA;AACA;AACA;;AAGE;AACF;AACA;AACA;AACA;;AAGE;AACF;AACA;AACA;AACA;;AAGE;AACF;AACA;AACA;AACA;;AAGE;AACF;AACA;AAC4B,MAAfC,eAAe,GAAY;AACpC,WAAO,KAAKC,gBAAZ;AACD;;AACyB,MAAfD,eAAe,CAACE,KAAD,EAAiB;AACzC,SAAKD,gBAAL,GAAwBC,KAAxB;AACAL,IAAAA,cAAc,CAACM,kBAAf,CAAkCD,KAAlC;AACD;;AAGuB,MAAZE,YAAY,GAAuB;AAC7C,WAAON,0BAAP;AACD;;AAEwB,SAAXO,WAAW,GAAG;AAC1B,QAAI,CAACN,aAAa,CAACO,SAAnB,EAA8B;AAC5BP,MAAAA,aAAa,CAACO,SAAd,GAA0B,IAAIP,aAAJ,EAA1B;AACD;;AAED,WAAOA,aAAa,CAACO,SAArB;AACD;;AAEOC,EAAAA,WAAW,GAAG;AAAA;;AAAA;;AAAA;;AAAA;;AAAA,8CAdc,IAcd;;AACpB,SAAKH,YAAL,CAAkBI,WAAlB,CAA8BZ,WAAW,CAACa,SAA1C,EAAsDC,KAAD,IAAW;AAC9D,WAAKC,oBAAL,CAA0BD,KAA1B;AACD,KAFD;AAIA,SAAKN,YAAL,CAAkBI,WAAlB,CAA8BZ,WAAW,CAACgB,aAA1C,EAA0DF,KAAD,IAAW;AAClE,WAAKG,wBAAL,CAA8BH,KAA9B;AACD,KAFD;AAIA,SAAKN,YAAL,CAAkBI,WAAlB,CAA8BZ,WAAW,CAACkB,oBAA1C,EAAiEJ,KAAD,IAAW;AACzE,WAAKK,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;AAGA,UAAIoB,WAAJ,EAAiB;AACfjC,QAAAA,cAAc,CAACkC,mBAAf,CAAmCD,WAAnC,EAAgDT,UAAhD;AACD;AACF;AACF;;AAE0C,QAA7BJ,6BAA6B,CACzCP,KADyC,EAEzC;AACA,QAAI,KAAKsB,oBAAT,EAA+B;AAC7B,YAAMX,UAAU,GAAGX,KAAK,CAACW,UAAzB;AACA,aAAOX,KAAK,CAACW,UAAb;AACA,YAAMY,MAAM,GAAG,MAAM,KAAKD,oBAAL,CACnBtB,KADmB,CAArB;;AAGA,UAAIuB,MAAJ,EAAY;AACVpC,QAAAA,cAAc,CAACqC,uBAAf,CAAuCD,MAAvC,EAA+CZ,UAA/C;AACD;AACF;AACF;;AAvIiB;;gBAAdtB,a;;AA0IN,eAAeA,aAAf","sourcesContent":["import type { NativeEventEmitter } 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';\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 UpdateProductDetailsCallback = (\n event: UpdateProductDetailsEvent\n) => Promise<Product[] | undefined | null>;\n\nexport type WillDisplayProductCallback = (\n event: WillDisplayProductEvent\n) => Promise<ProductInfoViewConfiguration | undefined | null>;\n\ntype CallbackInfo = { callbackId?: number | string };\n\n/**\n * The entry class of video shopping.\n */\nclass VideoShopping {\n private static _instance?: VideoShopping;\n\n /**\n * This callback is triggered when the user clicks the \"Add to cart\" button.\n *\n * The host app can return an AddToCartResult object to tell FireworkSDK the result of adding to cart.\n */\n public onAddToCart?: AddToCartCallback;\n\n /**\n * This callback is triggered when the user clicks the shopping cart icon.\n *\n * The host app can return a React.Node to integrate custom cart page to shopping flow.\n */\n public onClickCartIcon?: ClickCartIconCallback;\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.\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 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 this.handleAddToCartEvent(event);\n });\n\n this.eventEmitter.addListener(FWEventName.ClickCartIcon, (event) => {\n this.handleClickCartIconEvent(event);\n });\n\n this.eventEmitter.addListener(FWEventName.UpdateProductDetails, (event) => {\n this.handleUpdateProductDetailsEvent(event);\n });\n\n this.eventEmitter.addListener(FWEventName.WillDisplayProduct, (event) => {\n this.handleWillDisplayProductEvent(event);\n });\n }\n\n /**\n *\n * @param {number} count The number of items in the host app cart\n */\n public setCartItemCount(count: number) {\n ShoppingModule.setCartItemCount(count);\n }\n\n private async handleAddToCartEvent(event: AddToCartEvent & CallbackInfo) {\n if (this.onAddToCart) {\n const callbackId = event.callbackId;\n delete event.callbackId;\n const result = await this.onAddToCart(event as AddToCartEvent);\n if (result) {\n ShoppingModule.updateAddToCartStatus(\n result.res,\n result.tips,\n callbackId!\n );\n }\n }\n }\n\n private async handleClickCartIconEvent(event: CallbackInfo) {\n 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 if (this.onUpdateProductDetails) {\n const callbackId = event.callbackId;\n delete event.callbackId;\n const productList = await this.onUpdateProductDetails(\n event as UpdateProductDetailsEvent\n );\n if (productList) {\n ShoppingModule.updateVideoProducts(productList, callbackId!);\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) {\n ShoppingModule.updateProductViewConfig(config, callbackId!);\n }\n }\n }\n}\n\nexport default VideoShopping;\n"]}
@@ -1,5 +1,5 @@
1
1
  import { requireNativeComponent, UIManager } from 'react-native';
2
- import { LINKING_ERROR } from "../constants/FWErrorMessage";
2
+ import { LINKING_ERROR } from '../constants/FWErrorMessage';
3
3
  const NativeComponentName = 'FWVideoFeed';
4
4
  const FWVideoFeed = UIManager.getViewManagerConfig(NativeComponentName) != null ? requireNativeComponent(NativeComponentName) : () => {
5
5
  throw new Error(LINKING_ERROR);
@@ -1 +1 @@
1
- {"version":3,"sources":["FWVideoFeed.tsx"],"names":["requireNativeComponent","UIManager","LINKING_ERROR","NativeComponentName","FWVideoFeed","getViewManagerConfig","Error"],"mappings":"AAAA,SAASA,sBAAT,EAAiCC,SAAjC,QAAkD,cAAlD;AACA,SAASC,aAAT,QAA8B,6BAA9B;AACA,MAAMC,mBAAmB,GAAG,aAA5B;AACA,MAAMC,WAAW,GACfH,SAAS,CAACI,oBAAV,CAA+BF,mBAA/B,KAAuD,IAAvD,GACIH,sBAAsB,CAAMG,mBAAN,CAD1B,GAEI,MAAM;AACN,QAAM,IAAIG,KAAJ,CAAUJ,aAAV,CAAN;AACD,CALL;AAMA,eAAeE,WAAf","sourcesContent":["import { requireNativeComponent, UIManager } from 'react-native'\nimport { LINKING_ERROR } from \"../constants/FWErrorMessage\";\nconst NativeComponentName = 'FWVideoFeed';\nconst FWVideoFeed =\n UIManager.getViewManagerConfig(NativeComponentName) != null\n ? requireNativeComponent<any>(NativeComponentName)\n : () => {\n throw new Error(LINKING_ERROR);\n };\nexport default FWVideoFeed\n"]}
1
+ {"version":3,"sources":["FWVideoFeed.tsx"],"names":["requireNativeComponent","UIManager","LINKING_ERROR","NativeComponentName","FWVideoFeed","getViewManagerConfig","Error"],"mappings":"AAAA,SAASA,sBAAT,EAAiCC,SAAjC,QAAkD,cAAlD;AACA,SAASC,aAAT,QAA8B,6BAA9B;AACA,MAAMC,mBAAmB,GAAG,aAA5B;AACA,MAAMC,WAAW,GACfH,SAAS,CAACI,oBAAV,CAA+BF,mBAA/B,KAAuD,IAAvD,GACIH,sBAAsB,CAAMG,mBAAN,CAD1B,GAEI,MAAM;AACJ,QAAM,IAAIG,KAAJ,CAAUJ,aAAV,CAAN;AACD,CALP;AAMA,eAAeE,WAAf","sourcesContent":["import { requireNativeComponent, UIManager } from 'react-native';\nimport { LINKING_ERROR } from '../constants/FWErrorMessage';\nconst NativeComponentName = 'FWVideoFeed';\nconst FWVideoFeed =\n UIManager.getViewManagerConfig(NativeComponentName) != null\n ? requireNativeComponent<any>(NativeComponentName)\n : () => {\n throw new Error(LINKING_ERROR);\n };\nexport default FWVideoFeed;\n"]}