react-native-firework-sdk 1.0.6-beta.2 → 1.2.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (214) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +2 -40
  3. package/android/build.gradle +6 -3
  4. package/android/gradle.properties +2 -1
  5. package/android/gradlew +0 -0
  6. package/android/proguard-rules.pro +22 -0
  7. package/android/publish.gradle +4 -3
  8. package/android/settings.gradle +1 -0
  9. package/android/src/main/AndroidManifest.xml +11 -2
  10. package/android/src/main/java/com/fireworksdk/bridge/FireworkSDKPackage.kt +27 -0
  11. package/android/src/main/java/com/fireworksdk/bridge/components/videofeed/FWVideoFeed.kt +226 -0
  12. package/android/src/main/java/com/{reactnativefireworksdk → fireworksdk/bridge}/constants/FWCommandConstant.kt +1 -1
  13. package/android/src/main/java/com/{reactnativefireworksdk → fireworksdk/bridge}/constants/FWVideoPlayerConstant.kt +13 -1
  14. package/android/src/main/java/com/fireworksdk/bridge/models/FWAdBadgeConfigModel.kt +9 -0
  15. package/android/src/main/java/com/{reactnativefireworksdk → fireworksdk/bridge}/models/FWEventName.kt +10 -1
  16. package/android/src/main/java/com/fireworksdk/bridge/models/FWLiveStreamEventDetailsModel.kt +9 -0
  17. package/android/src/main/java/com/fireworksdk/bridge/models/FWLiveStreamMessageDetailsModel.kt +11 -0
  18. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoFeedConfigModel.kt +28 -0
  19. package/android/src/main/java/com/{reactnativefireworksdk → fireworksdk/bridge}/models/FWVideoFeedItemDetailsModel.kt +2 -1
  20. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoFeedModel.kt +7 -0
  21. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoFeedPropsModel.kt +18 -0
  22. package/android/src/main/java/com/{reactnativefireworksdk → fireworksdk/bridge}/models/FWVideoFeedSource.kt +2 -1
  23. package/android/src/main/java/com/{reactnativefireworksdk → fireworksdk/bridge}/models/FWVideoFeedTitlePosition.kt +1 -1
  24. package/android/src/main/java/com/{reactnativefireworksdk → fireworksdk/bridge}/models/FWVideoPlaybackDetails.kt +1 -1
  25. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoPlayerConfigModel.kt +23 -0
  26. package/android/src/main/java/com/{reactnativefireworksdk → fireworksdk/bridge}/models/FWVideoShoppingProduct.kt +1 -1
  27. package/android/src/main/java/com/fireworksdk/bridge/models/WeakProperty.kt +19 -0
  28. package/android/src/main/java/com/fireworksdk/bridge/reactnative/FWInitializationProvider.kt +99 -0
  29. package/android/src/main/java/com/fireworksdk/bridge/reactnative/manager/FWVideoFeedManager.kt +175 -0
  30. package/android/src/main/java/com/fireworksdk/bridge/reactnative/models/FWLiveStreamInterface.kt +5 -0
  31. package/android/src/main/java/com/fireworksdk/bridge/reactnative/models/FWNavigatorInterface.kt +9 -0
  32. package/android/src/main/java/com/{reactnativefireworksdk → fireworksdk/bridge/reactnative}/models/FWVideoShoppingInterface.kt +1 -1
  33. package/android/src/main/java/com/{reactnativefireworksdk → fireworksdk/bridge/reactnative}/models/FireworkSDKInterface.kt +4 -2
  34. package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FWLiveStreamModule.kt +88 -0
  35. package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FWNavigatorModule.kt +64 -0
  36. package/android/src/main/java/com/{reactnativefireworksdk → fireworksdk/bridge/reactnative}/module/FWVideoShoppingModule.kt +20 -14
  37. package/android/src/main/java/com/{reactnativefireworksdk → fireworksdk/bridge/reactnative}/module/FireworkSDKModule.kt +23 -16
  38. package/android/src/main/java/com/fireworksdk/bridge/reactnative/pages/FWContainerActivity.kt +54 -0
  39. package/android/src/main/java/com/{reactnativefireworksdk → fireworksdk/bridge/reactnative}/pages/FWVideoShoppingCartActivity.kt +4 -4
  40. package/android/src/main/java/com/{reactnativefireworksdk → fireworksdk/bridge/reactnative}/utils/FWEventUtils.kt +46 -5
  41. package/android/src/main/java/com/{reactnativefireworksdk → fireworksdk/bridge}/utils/FWJsonUtils.kt +1 -1
  42. package/android/src/main/java/com/{reactnativefireworksdk → fireworksdk/bridge}/utils/FWLogUtils.kt +2 -2
  43. package/android/src/main/java/com/{reactnativefireworksdk → fireworksdk/bridge}/utils/FWUrlUtils.kt +1 -1
  44. package/android/src/main/java/com/fireworksdk/bridge/utils/FWVideoPlayerUtils.kt +94 -0
  45. package/android/src/main/res/layout/{fwrn_fragment_shoppingcart.xml → fw_bridge_fragment_container.xml} +1 -1
  46. package/android/src/main/res/layout/fw_bridge_fragment_playlistfeed.xml +18 -0
  47. package/android/src/main/res/layout/fw_bridge_fragment_shoppingcart.xml +8 -0
  48. package/android/src/main/res/layout/{fwrn_fragment_videofeed.xml → fw_bridge_fragment_videofeed.xml} +2 -1
  49. package/android/src/main/res/values/colors.xml +4 -0
  50. package/ios/{Component → Components}/VideoFeed.swift +29 -0
  51. package/ios/{Component → Components}/VideoFeedConfiguration.swift +1 -0
  52. package/ios/{Component → Components}/VideoFeedManager.m +0 -0
  53. package/ios/{Component → Components}/VideoFeedManager.swift +0 -0
  54. package/ios/{Component → Components}/VideoPlayerConfiguration.swift +0 -0
  55. package/ios/FireworkSdk.xcodeproj/project.pbxproj +206 -18
  56. package/ios/Models/{FireworkJsEvent.swift → NativeToRN/FireworkEventName.swift} +20 -0
  57. package/ios/Models/{FireworkSDK+JsModel.swift → NativeToRN/FireworkSDK+Json.swift} +33 -3
  58. package/ios/Models/{RCTConvert+FireworkSDKModule.swift → RNToNative/RCTConvert+FireworkSDKModule.swift} +20 -0
  59. package/ios/Models/{RCTConvert+Shopping.swift → RNToNative/RCTConvert+Shopping.swift} +0 -0
  60. package/ios/Models/{RCTConvert+VideoFeed.swift → RNToNative/RCTConvert+VideoFeed.swift} +0 -0
  61. package/ios/Modules/FWNavigatorModule/FWNavigatorContainerViewController.swift +40 -0
  62. package/ios/Modules/FWNavigatorModule/FWNavigatorModule.m +17 -0
  63. package/ios/Modules/FWNavigatorModule/FWNavigatorModule.swift +59 -0
  64. package/ios/Modules/FWNavigatorModule/FWNavigatorProtocol.swift +13 -0
  65. package/ios/Modules/FireworkSDKModule/AdBadgeConfiguration.swift +18 -0
  66. package/ios/Modules/FireworkSDKModule/FireworkSDKModule+CTA.swift +1 -1
  67. package/ios/Modules/FireworkSDKModule/FireworkSDKModule+EventTracking.swift +10 -19
  68. package/ios/Modules/FireworkSDKModule/FireworkSDKModule.m +2 -1
  69. package/ios/Modules/FireworkSDKModule/FireworkSDKModule.swift +12 -4
  70. package/ios/Modules/LiveStream/LiveStreamModule.m +14 -0
  71. package/ios/Modules/LiveStream/LiveStreamModule.swift +43 -0
  72. package/lib/commonjs/FWNavigator.js +60 -0
  73. package/lib/commonjs/FWNavigator.js.map +1 -0
  74. package/lib/commonjs/FireworkSDK.js +71 -38
  75. package/lib/commonjs/FireworkSDK.js.map +1 -1
  76. package/lib/commonjs/LiveStream.js +60 -0
  77. package/lib/commonjs/LiveStream.js.map +1 -0
  78. package/lib/commonjs/VideoShopping.js +16 -15
  79. package/lib/commonjs/VideoShopping.js.map +1 -1
  80. package/lib/commonjs/components/NavigationContainer.js +36 -0
  81. package/lib/commonjs/components/NavigationContainer.js.map +1 -0
  82. package/lib/commonjs/components/VideoFeed.js +46 -2
  83. package/lib/commonjs/components/VideoFeed.js.map +1 -1
  84. package/lib/commonjs/index.js +36 -0
  85. package/lib/commonjs/index.js.map +1 -1
  86. package/lib/commonjs/models/AdBadgeConfiguration.js +2 -0
  87. package/lib/commonjs/models/{ADConfig.js.map → AdBadgeConfiguration.js.map} +0 -0
  88. package/lib/commonjs/models/AdConfig.js +2 -0
  89. package/lib/{module/models/ADConfig.js.map → commonjs/models/AdConfig.js.map} +0 -0
  90. package/lib/commonjs/models/FWEventName.js +24 -0
  91. package/lib/commonjs/models/FWEventName.js.map +1 -0
  92. package/lib/commonjs/models/FWEvents.js +0 -14
  93. package/lib/commonjs/models/FWEvents.js.map +1 -1
  94. package/lib/commonjs/models/LiveStreamChatEventName.js +15 -0
  95. package/lib/commonjs/models/LiveStreamChatEventName.js.map +1 -0
  96. package/lib/commonjs/models/LiveStreamEventDetails.js +2 -0
  97. package/lib/commonjs/models/LiveStreamEventDetails.js.map +1 -0
  98. package/lib/commonjs/models/LiveStreamEventName.js +17 -0
  99. package/lib/commonjs/models/LiveStreamEventName.js.map +1 -0
  100. package/lib/commonjs/models/LiveStreamMessageDetails.js +2 -0
  101. package/lib/commonjs/models/LiveStreamMessageDetails.js.map +1 -0
  102. package/lib/commonjs/models/VideoFeedSource.js +6 -0
  103. package/lib/commonjs/models/VideoFeedSource.js.map +1 -0
  104. package/lib/commonjs/models/VideoPlaybackEventName.js.map +1 -1
  105. package/lib/commonjs/modules/FWNavigatorModule.js +22 -0
  106. package/lib/commonjs/modules/FWNavigatorModule.js.map +1 -0
  107. package/lib/commonjs/modules/FireworkSDKModule.js +3 -1
  108. package/lib/commonjs/modules/FireworkSDKModule.js.map +1 -1
  109. package/lib/commonjs/modules/LiveStreamModule.js +22 -0
  110. package/lib/commonjs/modules/LiveStreamModule.js.map +1 -0
  111. package/lib/commonjs/modules/ShoppingModule.js +3 -1
  112. package/lib/commonjs/modules/ShoppingModule.js.map +1 -1
  113. package/lib/module/FWNavigator.js +50 -0
  114. package/lib/module/FWNavigator.js.map +1 -0
  115. package/lib/module/FireworkSDK.js +59 -34
  116. package/lib/module/FireworkSDK.js.map +1 -1
  117. package/lib/module/LiveStream.js +51 -0
  118. package/lib/module/LiveStream.js.map +1 -0
  119. package/lib/module/VideoShopping.js +10 -10
  120. package/lib/module/VideoShopping.js.map +1 -1
  121. package/lib/module/components/NavigationContainer.js +21 -0
  122. package/lib/module/components/NavigationContainer.js.map +1 -0
  123. package/lib/module/components/VideoFeed.js +41 -3
  124. package/lib/module/components/VideoFeed.js.map +1 -1
  125. package/lib/module/index.js +7 -1
  126. package/lib/module/index.js.map +1 -1
  127. package/lib/module/models/AdBadgeConfiguration.js +2 -0
  128. package/lib/module/models/AdBadgeConfiguration.js.map +1 -0
  129. package/lib/module/models/AdConfig.js +2 -0
  130. package/lib/module/models/AdConfig.js.map +1 -0
  131. package/lib/module/models/FWEventName.js +17 -0
  132. package/lib/module/models/FWEventName.js.map +1 -0
  133. package/lib/module/models/FWEvents.js +1 -12
  134. package/lib/module/models/FWEvents.js.map +1 -1
  135. package/lib/module/models/LiveStreamChatEventName.js +8 -0
  136. package/lib/module/models/LiveStreamChatEventName.js.map +1 -0
  137. package/lib/module/models/LiveStreamEventDetails.js +2 -0
  138. package/lib/module/models/LiveStreamEventDetails.js.map +1 -0
  139. package/lib/module/models/LiveStreamEventName.js +10 -0
  140. package/lib/module/models/LiveStreamEventName.js.map +1 -0
  141. package/lib/module/models/LiveStreamMessageDetails.js +2 -0
  142. package/lib/module/models/LiveStreamMessageDetails.js.map +1 -0
  143. package/lib/module/models/VideoFeedSource.js +2 -0
  144. package/lib/module/models/VideoFeedSource.js.map +1 -0
  145. package/lib/module/models/VideoPlaybackEventName.js.map +1 -1
  146. package/lib/module/modules/FWNavigatorModule.js +13 -0
  147. package/lib/module/modules/FWNavigatorModule.js.map +1 -0
  148. package/lib/module/modules/FireworkSDKModule.js +3 -0
  149. package/lib/module/modules/FireworkSDKModule.js.map +1 -1
  150. package/lib/module/modules/LiveStreamModule.js +12 -0
  151. package/lib/module/modules/LiveStreamModule.js.map +1 -0
  152. package/lib/module/modules/ShoppingModule.js +3 -1
  153. package/lib/module/modules/ShoppingModule.js.map +1 -1
  154. package/lib/typescript/FWNavigator.d.ts +22 -0
  155. package/lib/typescript/FireworkSDK.d.ts +31 -24
  156. package/lib/typescript/LiveStream.d.ts +21 -0
  157. package/lib/typescript/VideoShopping.d.ts +5 -5
  158. package/lib/typescript/components/NavigationContainer.d.ts +6 -0
  159. package/lib/typescript/components/VideoFeed.d.ts +7 -4
  160. package/lib/typescript/index.d.ts +16 -6
  161. package/lib/typescript/models/AdBadgeConfiguration.d.ts +15 -0
  162. package/lib/typescript/models/{ADConfig.d.ts → AdConfig.d.ts} +1 -1
  163. package/lib/typescript/models/FWEventName.d.ts +14 -0
  164. package/lib/typescript/models/FWEvents.d.ts +14 -11
  165. package/lib/typescript/models/FeedItemDetails.d.ts +11 -4
  166. package/lib/typescript/models/LiveStreamChatEventName.d.ts +7 -0
  167. package/lib/typescript/models/LiveStreamEventDetails.d.ts +3 -0
  168. package/lib/typescript/models/LiveStreamEventName.d.ts +15 -0
  169. package/lib/typescript/models/LiveStreamMessageDetails.d.ts +14 -0
  170. package/lib/typescript/models/VideoFeedConfiguration.d.ts +7 -3
  171. package/lib/typescript/models/VideoFeedSource.d.ts +2 -0
  172. package/lib/typescript/models/VideoPlaybackDetails.d.ts +1 -2
  173. package/lib/typescript/models/VideoPlaybackEventName.d.ts +1 -1
  174. package/lib/typescript/models/VideoPlayerConfiguration.d.ts +5 -0
  175. package/lib/typescript/modules/FWNavigatorModule.d.ts +9 -0
  176. package/lib/typescript/modules/FireworkSDKModule.d.ts +8 -4
  177. package/lib/typescript/modules/LiveStreamModule.d.ts +8 -0
  178. package/lib/typescript/modules/ShoppingModule.d.ts +3 -1
  179. package/package.json +3 -3
  180. package/react-native-firework-sdk.podspec +3 -1
  181. package/src/FWNavigator.tsx +39 -0
  182. package/src/FireworkSDK.ts +59 -33
  183. package/src/LiveStream.ts +51 -0
  184. package/src/VideoShopping.ts +10 -9
  185. package/src/components/NavigationContainer.tsx +22 -0
  186. package/src/components/VideoFeed.tsx +63 -7
  187. package/src/index.tsx +38 -12
  188. package/src/models/AdBadgeConfiguration.ts +16 -0
  189. package/src/models/{ADConfig.ts → AdConfig.ts} +1 -1
  190. package/src/models/FWEventName.ts +14 -0
  191. package/src/models/FWEvents.ts +16 -12
  192. package/src/models/FeedItemDetails.ts +12 -4
  193. package/src/models/LiveStreamChatEventName.ts +8 -0
  194. package/src/models/LiveStreamEventDetails.ts +4 -0
  195. package/src/models/LiveStreamEventName.ts +16 -0
  196. package/src/models/LiveStreamMessageDetails.ts +14 -0
  197. package/src/models/VideoFeedConfiguration.ts +7 -3
  198. package/src/models/VideoFeedSource.ts +2 -0
  199. package/src/models/VideoPlaybackDetails.ts +1 -3
  200. package/src/models/VideoPlaybackEventName.ts +1 -1
  201. package/src/models/VideoPlayerConfiguration.ts +7 -1
  202. package/src/modules/FWNavigatorModule.ts +22 -0
  203. package/src/modules/FireworkSDKModule.ts +10 -4
  204. package/src/modules/LiveStreamModule.ts +26 -0
  205. package/src/modules/ShoppingModule.ts +13 -6
  206. package/android/src/main/java/com/reactnativefireworksdk/FireworkSDKPackage.kt +0 -20
  207. package/android/src/main/java/com/reactnativefireworksdk/components/videofeed/FWVideoFeed.kt +0 -143
  208. package/android/src/main/java/com/reactnativefireworksdk/manager/FWVideoFeedManager.kt +0 -88
  209. package/android/src/main/java/com/reactnativefireworksdk/models/FWVideoFeedConfigModel.kt +0 -27
  210. package/android/src/main/java/com/reactnativefireworksdk/models/FWVideoFeedMode.kt +0 -7
  211. package/android/src/main/java/com/reactnativefireworksdk/models/FWVideoPlayerConfigModel.kt +0 -22
  212. package/android/src/main/java/com/reactnativefireworksdk/utils/FWVideoPlayerUtils.kt +0 -20
  213. package/lib/commonjs/models/ADConfig.js +0 -2
  214. package/lib/module/models/ADConfig.js +0 -2
package/src/index.tsx CHANGED
@@ -1,11 +1,8 @@
1
1
  import { AppRegistry } from 'react-native';
2
2
 
3
3
  import CartContainer from './components/CartContainer';
4
- import type {
5
- IVideoFeedProps,
6
- VideoFeedMode,
7
- VideoFeedSource,
8
- } from './components/VideoFeed';
4
+ import NavigationContainer from './components/NavigationContainer';
5
+ import type { IVideoFeedProps, VideoFeedMode } from './components/VideoFeed';
9
6
  import VideoFeed from './components/VideoFeed';
10
7
  import type {
11
8
  CustomCTAClickCallback,
@@ -14,18 +11,32 @@ import type {
14
11
  VideoPlaybackCallback,
15
12
  } from './FireworkSDK';
16
13
  import FireworkSDK from './FireworkSDK';
17
- import type ADConfig from './models/ADConfig';
14
+ import FWNavigator from './FWNavigator';
15
+ import type {
16
+ onLiveStreamChatEventCallback,
17
+ onLiveStreamEventCallback,
18
+ } from './LiveStream';
19
+ import LiveStream from './LiveStream';
20
+ import type AdBadgeConfiguration from './models/AdBadgeConfiguration';
21
+ import type { AdBadgeTextType } from './models/AdBadgeConfiguration';
22
+ import type AdConfig from './models/AdConfig';
18
23
  import type AddToCartResult from './models/AddToCartResult';
19
24
  import type FeedItemDetails from './models/FeedItemDetails';
20
25
  import type FWError from './models/FWError';
21
26
  import type {
22
27
  AddToCartEvent,
23
28
  CustomCTAClickEvent,
29
+ LiveStreamChatEvent,
30
+ LiveStreamEvent,
24
31
  SDKInitEvent,
25
32
  UpdateProductDetailsEvent,
26
33
  VideoPlaybackEvent,
27
34
  WillDisplayProductEvent,
28
35
  } from './models/FWEvents';
36
+ import LiveStreamChatEventName from './models/LiveStreamChatEventName';
37
+ import type LiveStreamEventDetails from './models/LiveStreamEventDetails';
38
+ import LiveStreamEventName from './models/LiveStreamEventName';
39
+ import type LiveStreamMessageDetails from './models/LiveStreamMessageDetails';
29
40
  import type Product from './models/Product';
30
41
  import type ProductInfoViewConfiguration from './models/ProductInfoViewConfiguration';
31
42
  import type { AddToCartButtonConfiguration } from './models/ProductInfoViewConfiguration';
@@ -37,14 +48,13 @@ import type {
37
48
  VideoFeedTitleConfiguration,
38
49
  VideoFeedTitlePosition,
39
50
  } from './models/VideoFeedConfiguration';
51
+ import type VideoFeedSource from './models/VideoFeedSource';
40
52
  import type VideoPlaybackDetails from './models/VideoPlaybackDetails';
41
- import type {
42
- VideoBadge,
43
- VideoPlayerSize,
44
- } from './models/VideoPlaybackDetails';
53
+ import type { VideoPlayerSize } from './models/VideoPlaybackDetails';
45
54
  import VideoPlaybackEventName from './models/VideoPlaybackEventName';
46
55
  import type VideoPlayerConfiguration from './models/VideoPlayerConfiguration';
47
56
  import type {
57
+ VideoLaunchBehavior,
48
58
  VideoPlayerCompleteAction,
49
59
  VideoPlayerCTAStyle,
50
60
  VideoPlayerStyle,
@@ -58,11 +68,17 @@ import type {
58
68
  import VideoShopping from './VideoShopping';
59
69
 
60
70
  AppRegistry.registerComponent('FWShoppingCartPage', () => CartContainer);
71
+ AppRegistry.registerComponent(
72
+ 'FWNavigationContainer',
73
+ () => NavigationContainer
74
+ );
61
75
 
62
76
  export default FireworkSDK;
63
77
 
64
78
  export {
65
- ADConfig,
79
+ AdBadgeConfiguration,
80
+ AdBadgeTextType,
81
+ AdConfig,
66
82
  AddToCartButtonConfiguration,
67
83
  AddToCartCallback,
68
84
  AddToCartEvent,
@@ -72,7 +88,17 @@ export {
72
88
  CustomCTAClickEvent,
73
89
  FeedItemDetails,
74
90
  FWError,
91
+ FWNavigator,
75
92
  IVideoFeedProps,
93
+ LiveStream,
94
+ LiveStreamChatEvent,
95
+ LiveStreamChatEventName,
96
+ LiveStreamEvent,
97
+ LiveStreamEventDetails,
98
+ LiveStreamEventName,
99
+ LiveStreamMessageDetails,
100
+ onLiveStreamChatEventCallback,
101
+ onLiveStreamEventCallback,
76
102
  Product,
77
103
  ProductInfoViewConfiguration,
78
104
  ProductPrice,
@@ -81,7 +107,6 @@ export {
81
107
  SDKInitEvent,
82
108
  UpdateProductDetailsCallback,
83
109
  UpdateProductDetailsEvent,
84
- VideoBadge,
85
110
  VideoFeed,
86
111
  VideoFeedClickCallback,
87
112
  VideoFeedConfiguration,
@@ -90,6 +115,7 @@ export {
90
115
  VideoFeedSource,
91
116
  VideoFeedTitleConfiguration,
92
117
  VideoFeedTitlePosition,
118
+ VideoLaunchBehavior,
93
119
  VideoPlaybackCallback,
94
120
  VideoPlaybackDetails,
95
121
  VideoPlaybackEvent,
@@ -0,0 +1,16 @@
1
+ export type AdBadgeTextType = 'ad' | 'sponsored';
2
+
3
+ export default interface AdBadgeConfiguration {
4
+ /**
5
+ * The text type of the ad badge.
6
+ */
7
+ badgeTextType?: AdBadgeTextType;
8
+ /**
9
+ * The background color of the ad badge. Only supported on iOS.
10
+ */
11
+ backgroundColor?: string;
12
+ /**
13
+ * The color of the ad badge text. Only supported on iOS.
14
+ */
15
+ textColor?: string;
16
+ }
@@ -1,4 +1,4 @@
1
- export default interface ADConfig {
1
+ export default interface AdConfig {
2
2
  /**
3
3
  * Defaults to none. Only supported on iOS.
4
4
  */
@@ -0,0 +1,14 @@
1
+ export enum FWEventName {
2
+ SDKInit = 'fw:sdk-init',
3
+ CustomCTAClick = 'fw:custom-cta-click',
4
+ VideoPlayback = 'fw:video-playback',
5
+ VideoFeedClick = 'fw:video-feed-click',
6
+ AddToCart = 'fw:shopping:add-to-cart',
7
+ ClickCartIcon = 'fw:shopping:click-cart-icon',
8
+ UpdateProductDetails = 'fw:shopping:update-product-details',
9
+ WillDisplayProduct = 'fw:shopping:will-display-product',
10
+ onLiveStreamEvent = 'fw:livestream',
11
+ onLiveStreamChatEvent = 'fw:livestream-chat',
12
+ ShareBaseURLUpdated = 'fw:share-base-url-updated',
13
+ AdBadgeConfigurationUpdated = 'fw:ad-badge-configuration-updated',
14
+ }
@@ -2,17 +2,10 @@ import type VideoPlaybackDetails from './VideoPlaybackDetails';
2
2
  import type FWError from './FWError';
3
3
  import type VideoPlaybackEventName from './VideoPlaybackEventName';
4
4
  import type FeedItemDetails from './FeedItemDetails';
5
-
6
- export enum FWEventName {
7
- SDKInit = 'fw:sdk-init',
8
- CustomCTAClick = 'fw:custom-cta-click',
9
- VideoPlayback = 'fw:video-playback',
10
- VideoFeedClick = 'fw:video-feed-click',
11
- AddToCart = 'fw:shopping:add-to-cart',
12
- ClickCartIcon = 'fw:shopping:click-cart-icon',
13
- UpdateProductDetails = 'fw:shopping:update-product-details',
14
- WillDisplayProduct = 'fw:shopping:will-display-product',
15
- }
5
+ import type LiveStreamMessageDetails from './LiveStreamMessageDetails';
6
+ import type LiveStreamChatEventName from './LiveStreamChatEventName';
7
+ import type LiveStreamEventDetails from './LiveStreamEventDetails';
8
+ import type LiveStreamEventName from './LiveStreamEventName';
16
9
 
17
10
  export interface SDKInitEvent {
18
11
  /**
@@ -50,7 +43,7 @@ export interface AddToCartEvent {
50
43
 
51
44
  export interface UpdateProductDetailsEvent {
52
45
  /**
53
- * A unique identifier of the product.
46
+ * A unique identifier list of the products.
54
47
  */
55
48
  productIds: string[];
56
49
  }
@@ -60,4 +53,15 @@ export interface WillDisplayProductEvent {
60
53
  * A unique identifier of the video.
61
54
  */
62
55
  videoId: string;
56
+ }
57
+
58
+ export interface LiveStreamEvent {
59
+ eventName: LiveStreamEventName;
60
+ info: LiveStreamEventDetails;
61
+ }
62
+
63
+ export interface LiveStreamChatEvent {
64
+ eventName: LiveStreamChatEventName;
65
+ message: LiveStreamMessageDetails;
66
+ liveStream: LiveStreamEventDetails;
63
67
  }
@@ -1,14 +1,22 @@
1
+ import type VideoFeedSource from '../models/VideoFeedSource';
2
+
1
3
  export default interface FeedItemDetails {
2
4
  /**
3
- * The index of the thumbnail tapped in the video feed.
5
+ * The index of the thumbnail tapped in the feed.
4
6
  */
5
7
  index: number;
6
8
  /**
7
- * A unique id for the video.
9
+ * The unique id of the thumbnail.
10
+ * If the source is `playlistGroup` this value will represent the playlist's id; otherwise this value is the id of the selected video.
8
11
  */
9
- videoId: string;
12
+ id: string;
10
13
  /**
11
- * The total duration of the video
14
+ * The total duration of the video.
15
+ * If the source is `playlistGroup` this value will always be 0; otherwise this value is the duration of the selected video.
12
16
  */
13
17
  duration: number;
18
+ /**
19
+ * The content source of the feed.
20
+ */
21
+ source: VideoFeedSource;
14
22
  }
@@ -0,0 +1,8 @@
1
+ enum LiveStreamChatEventName {
2
+ /**
3
+ * Called when a user sends messages to an active live stream.
4
+ */
5
+ userSendChat = 'fw:livestream:user-send-chat',
6
+ }
7
+
8
+ export default LiveStreamChatEventName;
@@ -0,0 +1,4 @@
1
+ export default interface LiveStreamEventDetails {
2
+ /// A unique identifier of the live stream.
3
+ id: string;
4
+ }
@@ -0,0 +1,16 @@
1
+ enum LiveStreamEventName {
2
+ /**
3
+ * Called when a user joins an active live stream.
4
+ */
5
+ userDidjoin = 'fw:livestream:user-join',
6
+ /**
7
+ * Called when the user leaves an active live stream.
8
+ */
9
+ userDidLeave = 'fw:livestream:user-leave',
10
+ /**
11
+ * Called when a user sends a like to an active live stream.
12
+ */
13
+ userSendLike = 'fw:livestream:user-send-like',
14
+ }
15
+
16
+ export default LiveStreamEventName;
@@ -0,0 +1,14 @@
1
+ export default interface LiveStreamMessageDetails {
2
+ /**
3
+ * A unique identifier of the message.
4
+ */
5
+ messageId: string;
6
+ /**
7
+ * The username of the user.
8
+ */
9
+ username?: string | null;
10
+ /**
11
+ * The text of the message.
12
+ */
13
+ text?: string | null;
14
+ }
@@ -13,11 +13,11 @@ export type VideoFeedTitlePosition = 'stacked' | 'nested';
13
13
 
14
14
  export default interface VideoFeedConfiguration {
15
15
  /**
16
- * BackgroundColor of video feed.
16
+ * Background color of video feed.
17
17
  */
18
18
  backgroundColor?: string;
19
19
  /**
20
- * CornerRadius of video feed. Only supported on iOS.
20
+ * Corner radius of video feed. Only supported on iOS.
21
21
  */
22
22
  cornerRadius?: number;
23
23
  /**
@@ -25,11 +25,15 @@ export default interface VideoFeedConfiguration {
25
25
  */
26
26
  title?: VideoFeedTitleConfiguration;
27
27
  /**
28
- * Configuration of video feed title position.
28
+ * Title position of video feed.
29
29
  */
30
30
  titlePosition?: VideoFeedTitlePosition;
31
31
  /**
32
32
  * Configuration of video feed play icon. Only supported on iOS.
33
33
  */
34
34
  playIcon?: VideoFeedPlayIconConfiguration;
35
+ /**
36
+ * Indicates if the video feed shows ad badge.
37
+ */
38
+ showAdBadge?: boolean;
35
39
  }
@@ -0,0 +1,2 @@
1
+ type VideoFeedSource = 'discover' | 'channel' | 'playlist' | 'playlistGroup';
2
+ export default VideoFeedSource;
@@ -3,8 +3,6 @@ export interface VideoPlayerSize {
3
3
  height: number;
4
4
  }
5
5
 
6
- export type VideoBadge = 'ad' | 'demo' | 'featured';
7
-
8
6
  export default interface VideoPlaybackDetails {
9
7
  /**
10
8
  * A unique identifier of the video.
@@ -21,7 +19,7 @@ export default interface VideoPlaybackDetails {
21
19
  /**
22
20
  * Video badge type.
23
21
  */
24
- badge?: VideoBadge | null;
22
+ badge?: string | null;
25
23
  /**
26
24
  * The size of the player.
27
25
  */
@@ -24,7 +24,7 @@ enum VideoPlaybackEventName {
24
24
  */
25
25
  Complete = 'fw:video:complete',
26
26
  /**
27
- * When ad video finishes playing
27
+ * When ad video finishes playing.
28
28
  */
29
29
  AdEnd = 'fw:video:ad-end',
30
30
  /**
@@ -6,6 +6,8 @@ export interface VideoPlayerCTAStyle {
6
6
  fontSize?: number;
7
7
  }
8
8
 
9
+ export type VideoLaunchBehavior = 'default' | 'muteOnFirstLaunch';
10
+
9
11
  export default interface VideoPlayerConfiguration {
10
12
  /**
11
13
  * Sets the proportion of the video player to its container.
@@ -30,5 +32,9 @@ export default interface VideoPlayerConfiguration {
30
32
  /**
31
33
  * Indicates if the video player shows mute button.
32
34
  */
33
- showMuteButton?: boolean;
35
+ showMuteButton?: boolean;
36
+ /**
37
+ * The property is valid only if showMuteButton is true.
38
+ */
39
+ launchBehavior?: VideoLaunchBehavior;
34
40
  }
@@ -0,0 +1,22 @@
1
+ import { NativeEventEmitter, NativeModule } from 'react-native';
2
+ import { NativeModules } from 'react-native';
3
+ import { LINKING_ERROR } from '../constants/FWErrorMessage';
4
+
5
+ const FWNavigatorModule = NativeModules.FWNavigatorModule
6
+ ? NativeModules.FWNavigatorModule
7
+ : new Proxy(
8
+ {},
9
+ {
10
+ get() {
11
+ throw new Error(LINKING_ERROR);
12
+ },
13
+ }
14
+ );
15
+ interface IFWNavigatorModule extends NativeModule {
16
+ pushNativeContainer(callbackId?: string): Promise<boolean>;
17
+ popNativeContainer(): Promise<boolean>;
18
+ }
19
+
20
+ const FWNavigatorModuleEventEmitter = new NativeEventEmitter(FWNavigatorModule);
21
+ export { FWNavigatorModuleEventEmitter };
22
+ export default FWNavigatorModule as IFWNavigatorModule;
@@ -1,8 +1,9 @@
1
- import type { NativeModule } from 'react-native';
1
+ import { NativeEventEmitter, NativeModule } from 'react-native';
2
2
  import { NativeModules } from 'react-native';
3
+ import type AdBadgeConfiguration from 'src/models/AdBadgeConfiguration';
3
4
 
4
5
  import { LINKING_ERROR } from '../constants/FWErrorMessage';
5
- import type ADConfig from '../models/ADConfig';
6
+ import type AdConfig from '../models/AdConfig';
6
7
  import type VideoPlayerConfiguration from '../models/VideoPlayerConfiguration';
7
8
 
8
9
  const FireworkSDKModule = NativeModules.FireworkSDK
@@ -17,11 +18,16 @@ const FireworkSDKModule = NativeModules.FireworkSDK
17
18
  );
18
19
 
19
20
  interface IFireworkSDKModule extends NativeModule {
20
- init(userId?: string, adConfig?: ADConfig): void;
21
+ init(userId?: string, adConfig?: AdConfig): void;
21
22
  openVideoPlayer(url: string, config?: VideoPlayerConfiguration): void;
22
23
  setCustomCTAClickEnabled(enabled: boolean): void;
23
- setShareBaseURL(url?: string): void;
24
+ setShareBaseURL(url?: string): Promise<any>;
24
25
  setVideoPlaybackEventEnabled(enabled: boolean): void;
26
+ setAdBadgeConfiguration(config?: AdBadgeConfiguration): Promise<any>;
25
27
  }
26
28
 
29
+ const FireworkSDKModuleEventEmitter = new NativeEventEmitter(FireworkSDKModule);
30
+ export {
31
+ FireworkSDKModuleEventEmitter,
32
+ }
27
33
  export default FireworkSDKModule as IFireworkSDKModule;
@@ -0,0 +1,26 @@
1
+ import {
2
+ NativeEventEmitter,
3
+ NativeModule,
4
+ NativeModules,
5
+ } from 'react-native';
6
+
7
+ import { LINKING_ERROR } from '../constants/FWErrorMessage';
8
+
9
+ const LiveStreamModule = NativeModules.LiveStreamModule
10
+ ? NativeModules.LiveStreamModule
11
+ : new Proxy(
12
+ {},
13
+ {
14
+ get() {
15
+ throw new Error(LINKING_ERROR);
16
+ },
17
+ }
18
+ );
19
+
20
+ interface ILiveStreamModule extends NativeModule {
21
+ init(): void;
22
+ }
23
+ const LiveStreamModuleEventEmitter = new NativeEventEmitter(LiveStreamModule);
24
+ export { LiveStreamModuleEventEmitter };
25
+
26
+ export default LiveStreamModule as ILiveStreamModule;
@@ -1,7 +1,4 @@
1
- import {
2
- NativeModule,
3
- NativeModules,
4
- } from 'react-native';
1
+ import { NativeEventEmitter, NativeModule, NativeModules } from 'react-native';
5
2
  import type Product from '../models/Product';
6
3
  import type ProductInfoViewConfiguration from '../models/ProductInfoViewConfiguration';
7
4
  import { LINKING_ERROR } from '../constants/FWErrorMessage';
@@ -20,12 +17,22 @@ const ShoppingModule = NativeModules.ShoppingModule
20
17
  interface IShoppingModule extends NativeModule {
21
18
  init(): void;
22
19
  updateVideoProducts(products: Product[], callbackId: number | string): void;
23
- updateProductViewConfig(config: ProductInfoViewConfiguration, callbackId: number | string): void;
24
- updateAddToCartStatus(res: string, tips: string, callbackId: number | string): void;
20
+ updateProductViewConfig(
21
+ config: ProductInfoViewConfiguration,
22
+ callbackId: number | string
23
+ ): void;
24
+ updateAddToCartStatus(
25
+ res: string,
26
+ tips: string,
27
+ callbackId: number | string
28
+ ): void;
25
29
  jumpToCartPage(callbackId: number | string): void;
26
30
  exitCartPage(): void;
27
31
  setCartIconVisible(visible: boolean): void;
28
32
  setCartItemCount(count: number): void;
29
33
  }
30
34
 
35
+ const ShoppingModuleEventEmitter = new NativeEventEmitter(ShoppingModule);
36
+ export { ShoppingModuleEventEmitter };
37
+
31
38
  export default ShoppingModule as IShoppingModule;
@@ -1,20 +0,0 @@
1
- package com.reactnativefireworksdk
2
-
3
- import com.facebook.react.ReactPackage
4
- import com.facebook.react.bridge.NativeModule
5
- import com.facebook.react.bridge.ReactApplicationContext
6
- import com.facebook.react.uimanager.ViewManager
7
- import com.reactnativefireworksdk.manager.FWVideoFeedManager
8
- import com.reactnativefireworksdk.module.FWVideoShoppingModule
9
- import com.reactnativefireworksdk.module.FireworkSDKModule
10
-
11
-
12
- class FireworkSDKPackage : ReactPackage {
13
- override fun createNativeModules(reactContext: ReactApplicationContext): List<NativeModule> {
14
- return listOf(FireworkSDKModule(reactContext), FWVideoShoppingModule(reactContext))
15
- }
16
-
17
- override fun createViewManagers(reactContext: ReactApplicationContext): List<ViewManager<*, *>> {
18
- return listOf(FWVideoFeedManager())
19
- }
20
- }
@@ -1,143 +0,0 @@
1
- package com.reactnativefireworksdk.components.videofeed
2
-
3
- import android.app.Activity
4
- import android.graphics.Color
5
- import android.util.AttributeSet
6
- import android.view.LayoutInflater
7
- import android.widget.RelativeLayout
8
- import com.facebook.react.uimanager.ThemedReactContext
9
- import com.loopnow.fireworklibrary.FeedType
10
- import com.loopnow.fireworklibrary.models.FeedLayout
11
- import com.loopnow.fireworklibrary.models.FeedTitlePosition
12
- import com.loopnow.fireworklibrary.models.VideoContentStatus
13
- import com.loopnow.fireworklibrary.views.OnItemClickedListener
14
- import com.loopnow.fireworklibrary.views.OnVideoContentStatusListener
15
- import com.loopnow.fireworklibrary.views.VideoFeedView
16
- import com.reactnativefireworksdk.R
17
- import com.reactnativefireworksdk.models.*
18
- import com.reactnativefireworksdk.utils.FWEventUtils
19
- import com.reactnativefireworksdk.utils.FWLogUtils
20
- import com.reactnativefireworksdk.utils.FWVideoPlayerUtils
21
-
22
-
23
- class FWVideoFeed(
24
- context: ThemedReactContext,
25
- attrs: AttributeSet?
26
- ) : RelativeLayout(context, attrs) {
27
-
28
- private val activity: Activity = context.currentActivity as Activity
29
-
30
- private val videoFeedView: VideoFeedView
31
- private var channelId: String? = null
32
- private var playlistId: String? = null
33
- private var feedType: FeedType? = null
34
- private var feedLayout: FeedLayout? = null
35
- private var titlePosition: FeedTitlePosition? = null
36
-
37
- constructor(context: ThemedReactContext) : this(context, null)
38
-
39
- init {
40
- val view = LayoutInflater.from(activity).inflate(R.layout.fwrn_fragment_videofeed, this, true)
41
- videoFeedView = view.findViewById(R.id.fwrn_integrated_videofeed)
42
- videoFeedView.addOnItemClickedListener(object: OnItemClickedListener {
43
- override fun onItemClicked(index: Int, title: String, id: String, videoDuration: Long) {
44
- val fwVideoFeedItemDetailsModel = FWVideoFeedItemDetailsModel(index, id, videoDuration.toInt())
45
- FWEventUtils.sendVideoFeedClickEvent(context, fwVideoFeedItemDetailsModel)
46
- }
47
-
48
- override fun onItemClicked(index: Int) {
49
- super.onItemClicked(index)
50
- }
51
-
52
- override fun onItemClicked(index: Int, feedId: Int): Boolean {
53
- return super.onItemClicked(index, feedId)
54
- }
55
- })
56
- videoFeedView.addOnVideoContentStatusListener(object: OnVideoContentStatusListener {
57
- override fun currentStatus(status: VideoContentStatus, extra: String) {
58
- when (status) {
59
- VideoContentStatus.LoadingContent -> {
60
- FWLogUtils.d { "VideoContentStatus.LoadingContent" }
61
- }
62
- VideoContentStatus.LoadingContentFailed -> {
63
- FWLogUtils.e { "VideoContentStatus.LoadingContentFailed" }
64
- FWEventUtils.receiveVideoFeedLoadFinishedFailedEvent(context, id, VideoContentStatus.LoadingContentFailed.rawValue, extra)
65
- }
66
- VideoContentStatus.ContentLoaded -> {
67
- FWLogUtils.d { "VideoContentStatus.ContentLoaded" }
68
- FWEventUtils.receiveVideoFeedLoadFinishedSuccessEvent(context, id)
69
- }
70
- }
71
- }
72
- })
73
- }
74
-
75
- fun setSource(source: String?) {
76
- feedType = when {
77
- source.equals(FWVideoFeedSource.Channel.rawValue) -> {
78
- FeedType.CHANNEL
79
- }
80
- source.equals(FWVideoFeedSource.Playlist.rawValue) -> {
81
- FeedType.PLAYLIST
82
- }
83
- else -> {
84
- FeedType.DISCOVER
85
- }
86
- }
87
- setFeed(channelId, playlistId, feedType)
88
- }
89
-
90
- fun setChannel(channel: String?) {
91
- channelId = channel
92
- setFeed(channelId, playlistId, feedType)
93
- }
94
-
95
- fun setPlaylist(playlist: String?) {
96
- playlistId = playlist
97
- setFeed(channelId, playlistId, feedType)
98
- }
99
-
100
- fun setMode(mode: String?) {
101
- feedLayout = when {
102
- mode.equals(FWVideoFeedMode.Column.rawValue) -> FeedLayout.VERTICAL
103
- mode.equals(FWVideoFeedMode.Grid.rawValue) -> FeedLayout.GRID
104
- else -> FeedLayout.HORIZONTAL
105
- }
106
- videoFeedView.setLayout(feedLayout)
107
- }
108
-
109
- fun setVideoFeedConfig(config: FWVideoFeedConfigModel?) {
110
- val backgroundColor = config?.backgroundColor
111
- if (!backgroundColor.isNullOrBlank()) {
112
- videoFeedView.setBackgroundColor(Color.parseColor(backgroundColor))
113
- } else {
114
- videoFeedView.setBackgroundColor(Color.TRANSPARENT)
115
- }
116
-
117
- videoFeedView.setTitleVisible(config?.title?.hidden != true)
118
-
119
- titlePosition = when {
120
- config?.titlePosition.equals(FWVideoFeedTitlePosition.Stacked.rawValue) -> FeedTitlePosition.BELOW
121
- else -> FeedTitlePosition.ALIGN_BOTTOM
122
- }
123
- videoFeedView.setTitlePosition(titlePosition)
124
- }
125
-
126
- fun setVideoPlayerConfig(config: FWVideoPlayerConfigModel?) {
127
- FWVideoPlayerUtils.setVideoPlayerConfig(config)
128
- }
129
-
130
- fun refresh() {
131
- videoFeedView.refreshFeed()
132
- }
133
-
134
- private fun setFeed(channelId: String?, playlistId: String?, feedType: FeedType?) {
135
- if (feedType == FeedType.CHANNEL && !channelId.isNullOrBlank()) {
136
- videoFeedView.setFeed(channelId, null, FeedType.CHANNEL)
137
- } else if (feedType == FeedType.PLAYLIST && !channelId.isNullOrBlank() && !playlistId.isNullOrBlank()) {
138
- videoFeedView.setFeed(channelId, playlistId, FeedType.PLAYLIST)
139
- } else {
140
- videoFeedView.setFeed(null, null, FeedType.DISCOVER)
141
- }
142
- }
143
- }