react-native-firework-sdk 1.0.4 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (186) 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/proguard-rules.pro +22 -0
  6. package/android/publish.gradle +4 -3
  7. package/android/settings.gradle +1 -0
  8. package/android/src/main/AndroidManifest.xml +5 -2
  9. package/android/src/main/java/com/fireworksdk/bridge/components/videofeed/FWVideoFeed.kt +226 -0
  10. package/android/src/main/java/com/{reactnativefireworksdk → fireworksdk/bridge}/constants/FWCommandConstant.kt +1 -1
  11. package/android/src/main/java/com/{reactnativefireworksdk → fireworksdk/bridge}/constants/FWVideoPlayerConstant.kt +13 -1
  12. package/android/src/main/java/com/fireworksdk/bridge/models/FWAdBadgeConfigModel.kt +9 -0
  13. package/android/src/main/java/com/{reactnativefireworksdk → fireworksdk/bridge}/models/FWEventName.kt +10 -1
  14. package/android/src/main/java/com/fireworksdk/bridge/models/FWLiveStreamEventDetailsModel.kt +9 -0
  15. package/android/src/main/java/com/fireworksdk/bridge/models/FWLiveStreamMessageDetailsModel.kt +11 -0
  16. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoFeedConfigModel.kt +28 -0
  17. package/android/src/main/java/com/{reactnativefireworksdk → fireworksdk/bridge}/models/FWVideoFeedItemDetailsModel.kt +2 -1
  18. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoFeedModel.kt +7 -0
  19. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoFeedPropsModel.kt +18 -0
  20. package/android/src/main/java/com/{reactnativefireworksdk → fireworksdk/bridge}/models/FWVideoFeedSource.kt +2 -1
  21. package/android/src/main/java/com/{reactnativefireworksdk → fireworksdk/bridge}/models/FWVideoFeedTitlePosition.kt +1 -1
  22. package/android/src/main/java/com/{reactnativefireworksdk → fireworksdk/bridge}/models/FWVideoPlaybackDetails.kt +1 -1
  23. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoPlayerConfigModel.kt +23 -0
  24. package/android/src/main/java/com/{reactnativefireworksdk → fireworksdk/bridge}/models/FWVideoShoppingProduct.kt +1 -1
  25. package/android/src/main/java/com/fireworksdk/bridge/models/WeakProperty.kt +19 -0
  26. package/android/src/main/java/com/{reactnativefireworksdk → fireworksdk/bridge/reactnative}/FireworkSDKPackage.kt +10 -5
  27. package/android/src/main/java/com/fireworksdk/bridge/reactnative/manager/FWVideoFeedManager.kt +175 -0
  28. package/android/src/main/java/com/fireworksdk/bridge/reactnative/models/FWLiveStreamInterface.kt +5 -0
  29. package/android/src/main/java/com/{reactnativefireworksdk → fireworksdk/bridge/reactnative}/models/FWVideoShoppingInterface.kt +3 -2
  30. package/android/src/main/java/com/{reactnativefireworksdk → fireworksdk/bridge/reactnative}/models/FireworkSDKInterface.kt +4 -2
  31. package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FWLiveStreamModule.kt +88 -0
  32. package/android/src/main/java/com/{reactnativefireworksdk → fireworksdk/bridge/reactnative}/module/FWVideoShoppingModule.kt +53 -39
  33. package/android/src/main/java/com/{reactnativefireworksdk → fireworksdk/bridge/reactnative}/module/FireworkSDKModule.kt +23 -22
  34. package/android/src/main/java/com/{reactnativefireworksdk → fireworksdk/bridge/reactnative}/pages/FWVideoShoppingCartActivity.kt +4 -4
  35. package/android/src/main/java/com/{reactnativefireworksdk → fireworksdk/bridge/reactnative}/utils/FWEventUtils.kt +61 -7
  36. package/android/src/main/java/com/{reactnativefireworksdk → fireworksdk/bridge}/utils/FWJsonUtils.kt +29 -1
  37. package/android/src/main/java/com/{reactnativefireworksdk → fireworksdk/bridge}/utils/FWLogUtils.kt +2 -2
  38. package/android/src/main/java/com/{reactnativefireworksdk → fireworksdk/bridge}/utils/FWUrlUtils.kt +1 -1
  39. package/android/src/main/java/com/fireworksdk/bridge/utils/FWVideoPlayerUtils.kt +94 -0
  40. package/android/src/main/res/layout/fw_bridge_fragment_playlistfeed.xml +18 -0
  41. package/android/src/main/res/layout/{fwrn_fragment_shoppingcart.xml → fw_bridge_fragment_shoppingcart.xml} +1 -1
  42. package/android/src/main/res/layout/{fwrn_fragment_videofeed.xml → fw_bridge_fragment_videofeed.xml} +2 -1
  43. package/android/src/main/res/values/colors.xml +4 -0
  44. package/ios/{Component → Components}/VideoFeed.swift +60 -3
  45. package/ios/{Component → Components}/VideoFeedConfiguration.swift +2 -0
  46. package/ios/{Component → Components}/VideoFeedManager.m +2 -0
  47. package/ios/{Component → Components}/VideoFeedManager.swift +0 -0
  48. package/ios/{Component → Components}/VideoPlayerConfiguration.swift +7 -0
  49. package/ios/Models/{FireworkJsEvent.swift → NativeToRN/FireworkEventName.swift} +20 -0
  50. package/ios/Models/{FireworkSDK+JsModel.swift → NativeToRN/FireworkSDK+Json.swift} +33 -3
  51. package/ios/Models/{RCTConvert+FireworkSDKModule.swift → RNToNative/RCTConvert+FireworkSDKModule.swift} +20 -0
  52. package/ios/Models/{RCTConvert+Shopping.swift → RNToNative/RCTConvert+Shopping.swift} +15 -0
  53. package/ios/Models/{RCTConvert+VideoFeed.swift → RNToNative/RCTConvert+VideoFeed.swift} +2 -1
  54. package/ios/Modules/FireworkSDKModule/AdBadgeConfiguration.swift +18 -0
  55. package/ios/Modules/FireworkSDKModule/FireworkSDKModule+CTA.swift +1 -1
  56. package/ios/Modules/FireworkSDKModule/FireworkSDKModule+EventTracking.swift +10 -14
  57. package/ios/Modules/FireworkSDKModule/FireworkSDKModule.m +2 -1
  58. package/ios/Modules/FireworkSDKModule/FireworkSDKModule.swift +16 -4
  59. package/ios/Modules/LiveStream/LiveStreamModule.m +14 -0
  60. package/ios/Modules/LiveStream/LiveStreamModule.swift +43 -0
  61. package/ios/Modules/Shopping/ShoppingModule.m +1 -1
  62. package/ios/Modules/Shopping/ShoppingModule.swift +10 -9
  63. package/lib/commonjs/FireworkSDK.js +61 -38
  64. package/lib/commonjs/FireworkSDK.js.map +1 -1
  65. package/lib/commonjs/LiveStream.js +60 -0
  66. package/lib/commonjs/LiveStream.js.map +1 -0
  67. package/lib/commonjs/VideoShopping.js +20 -18
  68. package/lib/commonjs/VideoShopping.js.map +1 -1
  69. package/lib/commonjs/components/VideoFeed.js +47 -2
  70. package/lib/commonjs/components/VideoFeed.js.map +1 -1
  71. package/lib/commonjs/index.js +24 -0
  72. package/lib/commonjs/index.js.map +1 -1
  73. package/lib/commonjs/models/AdBadgeConfiguration.js +2 -0
  74. package/lib/commonjs/models/{ADConfig.js.map → AdBadgeConfiguration.js.map} +0 -0
  75. package/lib/commonjs/models/AdConfig.js +2 -0
  76. package/lib/{module/models/ADConfig.js.map → commonjs/models/AdConfig.js.map} +0 -0
  77. package/lib/commonjs/models/FWEventName.js +24 -0
  78. package/lib/commonjs/models/FWEventName.js.map +1 -0
  79. package/lib/commonjs/models/FWEvents.js +0 -14
  80. package/lib/commonjs/models/FWEvents.js.map +1 -1
  81. package/lib/commonjs/models/LiveStreamChatEventName.js +15 -0
  82. package/lib/commonjs/models/LiveStreamChatEventName.js.map +1 -0
  83. package/lib/commonjs/models/LiveStreamEventDetails.js +2 -0
  84. package/lib/commonjs/models/LiveStreamEventDetails.js.map +1 -0
  85. package/lib/commonjs/models/LiveStreamEventName.js +17 -0
  86. package/lib/commonjs/models/LiveStreamEventName.js.map +1 -0
  87. package/lib/commonjs/models/LiveStreamMessageDetails.js +2 -0
  88. package/lib/commonjs/models/LiveStreamMessageDetails.js.map +1 -0
  89. package/lib/commonjs/models/VideoFeedSource.js +6 -0
  90. package/lib/commonjs/models/VideoFeedSource.js.map +1 -0
  91. package/lib/commonjs/models/VideoPlaybackEventName.js.map +1 -1
  92. package/lib/commonjs/modules/FireworkSDKModule.js +3 -1
  93. package/lib/commonjs/modules/FireworkSDKModule.js.map +1 -1
  94. package/lib/commonjs/modules/LiveStreamModule.js +22 -0
  95. package/lib/commonjs/modules/LiveStreamModule.js.map +1 -0
  96. package/lib/commonjs/modules/ShoppingModule.js +3 -1
  97. package/lib/commonjs/modules/ShoppingModule.js.map +1 -1
  98. package/lib/module/FireworkSDK.js +50 -34
  99. package/lib/module/FireworkSDK.js.map +1 -1
  100. package/lib/module/LiveStream.js +51 -0
  101. package/lib/module/LiveStream.js.map +1 -0
  102. package/lib/module/VideoShopping.js +14 -13
  103. package/lib/module/VideoShopping.js.map +1 -1
  104. package/lib/module/components/VideoFeed.js +42 -3
  105. package/lib/module/components/VideoFeed.js.map +1 -1
  106. package/lib/module/index.js +4 -1
  107. package/lib/module/index.js.map +1 -1
  108. package/lib/module/models/AdBadgeConfiguration.js +2 -0
  109. package/lib/module/models/AdBadgeConfiguration.js.map +1 -0
  110. package/lib/module/models/AdConfig.js +2 -0
  111. package/lib/module/models/AdConfig.js.map +1 -0
  112. package/lib/module/models/FWEventName.js +17 -0
  113. package/lib/module/models/FWEventName.js.map +1 -0
  114. package/lib/module/models/FWEvents.js +1 -12
  115. package/lib/module/models/FWEvents.js.map +1 -1
  116. package/lib/module/models/LiveStreamChatEventName.js +8 -0
  117. package/lib/module/models/LiveStreamChatEventName.js.map +1 -0
  118. package/lib/module/models/LiveStreamEventDetails.js +2 -0
  119. package/lib/module/models/LiveStreamEventDetails.js.map +1 -0
  120. package/lib/module/models/LiveStreamEventName.js +10 -0
  121. package/lib/module/models/LiveStreamEventName.js.map +1 -0
  122. package/lib/module/models/LiveStreamMessageDetails.js +2 -0
  123. package/lib/module/models/LiveStreamMessageDetails.js.map +1 -0
  124. package/lib/module/models/VideoFeedSource.js +2 -0
  125. package/lib/module/models/VideoFeedSource.js.map +1 -0
  126. package/lib/module/models/VideoPlaybackEventName.js.map +1 -1
  127. package/lib/module/modules/FireworkSDKModule.js +3 -0
  128. package/lib/module/modules/FireworkSDKModule.js.map +1 -1
  129. package/lib/module/modules/LiveStreamModule.js +12 -0
  130. package/lib/module/modules/LiveStreamModule.js.map +1 -0
  131. package/lib/module/modules/ShoppingModule.js +3 -1
  132. package/lib/module/modules/ShoppingModule.js.map +1 -1
  133. package/lib/typescript/FireworkSDK.d.ts +26 -24
  134. package/lib/typescript/LiveStream.d.ts +21 -0
  135. package/lib/typescript/VideoShopping.d.ts +6 -6
  136. package/lib/typescript/components/VideoFeed.d.ts +11 -4
  137. package/lib/typescript/index.d.ts +15 -6
  138. package/lib/typescript/models/AdBadgeConfiguration.d.ts +15 -0
  139. package/lib/typescript/models/{ADConfig.d.ts → AdConfig.d.ts} +1 -1
  140. package/lib/typescript/models/FWEventName.d.ts +14 -0
  141. package/lib/typescript/models/FWEvents.d.ts +15 -12
  142. package/lib/typescript/models/FeedItemDetails.d.ts +11 -4
  143. package/lib/typescript/models/LiveStreamChatEventName.d.ts +7 -0
  144. package/lib/typescript/models/LiveStreamEventDetails.d.ts +3 -0
  145. package/lib/typescript/models/LiveStreamEventName.d.ts +15 -0
  146. package/lib/typescript/models/LiveStreamMessageDetails.d.ts +14 -0
  147. package/lib/typescript/models/VideoFeedConfiguration.d.ts +7 -3
  148. package/lib/typescript/models/VideoFeedSource.d.ts +2 -0
  149. package/lib/typescript/models/VideoPlaybackDetails.d.ts +1 -2
  150. package/lib/typescript/models/VideoPlaybackEventName.d.ts +1 -1
  151. package/lib/typescript/models/VideoPlayerConfiguration.d.ts +13 -0
  152. package/lib/typescript/modules/FireworkSDKModule.d.ts +8 -4
  153. package/lib/typescript/modules/LiveStreamModule.d.ts +8 -0
  154. package/lib/typescript/modules/ShoppingModule.d.ts +4 -2
  155. package/package.json +3 -4
  156. package/react-native-firework-sdk.podspec +3 -1
  157. package/src/FireworkSDK.ts +49 -33
  158. package/src/LiveStream.ts +51 -0
  159. package/src/VideoShopping.ts +15 -13
  160. package/src/components/VideoFeed.tsx +69 -7
  161. package/src/index.tsx +32 -15
  162. package/src/models/AdBadgeConfiguration.ts +16 -0
  163. package/src/models/{ADConfig.ts → AdConfig.ts} +1 -1
  164. package/src/models/FWEventName.ts +14 -0
  165. package/src/models/FWEvents.ts +17 -13
  166. package/src/models/FeedItemDetails.ts +12 -4
  167. package/src/models/LiveStreamChatEventName.ts +8 -0
  168. package/src/models/LiveStreamEventDetails.ts +4 -0
  169. package/src/models/LiveStreamEventName.ts +16 -0
  170. package/src/models/LiveStreamMessageDetails.ts +14 -0
  171. package/src/models/VideoFeedConfiguration.ts +7 -3
  172. package/src/models/VideoFeedSource.ts +2 -0
  173. package/src/models/VideoPlaybackDetails.ts +1 -3
  174. package/src/models/VideoPlaybackEventName.ts +1 -1
  175. package/src/models/VideoPlayerConfiguration.ts +14 -0
  176. package/src/modules/FireworkSDKModule.ts +10 -4
  177. package/src/modules/LiveStreamModule.ts +26 -0
  178. package/src/modules/ShoppingModule.ts +14 -7
  179. package/android/src/main/java/com/reactnativefireworksdk/components/videofeed/FWVideoFeed.kt +0 -124
  180. package/android/src/main/java/com/reactnativefireworksdk/manager/FWVideoFeedManager.kt +0 -88
  181. package/android/src/main/java/com/reactnativefireworksdk/models/FWVideoFeedConfigModel.kt +0 -27
  182. package/android/src/main/java/com/reactnativefireworksdk/models/FWVideoFeedMode.kt +0 -7
  183. package/android/src/main/java/com/reactnativefireworksdk/models/FWVideoPlayerConfigModel.kt +0 -20
  184. package/android/src/main/java/com/reactnativefireworksdk/utils/FWVideoPlayerUtils.kt +0 -18
  185. package/lib/commonjs/models/ADConfig.js +0 -2
  186. package/lib/module/models/ADConfig.js +0 -2
@@ -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,9 +43,9 @@ 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
- productId: string;
48
+ productIds: string[];
56
49
  }
57
50
 
58
51
  export interface WillDisplayProductEvent {
@@ -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.
@@ -23,4 +25,16 @@ export default interface VideoPlayerConfiguration {
23
25
  * The style of CTA button style. Only supported on iOS.
24
26
  */
25
27
  ctaButtonStyle?: VideoPlayerCTAStyle;
28
+ /**
29
+ * Indicates if the video player shows playback button.
30
+ */
31
+ showPlaybackButton?: boolean;
32
+ /**
33
+ * Indicates if the video player shows mute button.
34
+ */
35
+ showMuteButton?: boolean;
36
+ /**
37
+ * The property is valid only if showMuteButton is true.
38
+ */
39
+ launchBehavior?: VideoLaunchBehavior;
26
40
  }
@@ -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';
@@ -19,13 +16,23 @@ const ShoppingModule = NativeModules.ShoppingModule
19
16
 
20
17
  interface IShoppingModule extends NativeModule {
21
18
  init(): void;
22
- updateVideoProduct(production: Product, callbackId: number | string): void;
23
- updateProductViewConfig(config: ProductInfoViewConfiguration, callbackId: number | string): void;
24
- updateAddToCartStatus(res: string, tips: string, callbackId: number | string): void;
19
+ updateVideoProducts(products: Product[], 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,124 +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.views.OnItemClickedListener
13
- import com.loopnow.fireworklibrary.views.VideoFeedView
14
- import com.reactnativefireworksdk.R
15
- import com.reactnativefireworksdk.models.*
16
- import com.reactnativefireworksdk.utils.FWEventUtils
17
- import com.reactnativefireworksdk.utils.FWVideoPlayerUtils
18
-
19
-
20
- class FWVideoFeed(
21
- context: ThemedReactContext,
22
- attrs: AttributeSet?
23
- ) : RelativeLayout(context, attrs) {
24
-
25
- // private val reactContext: ReactContext = context.reactApplicationContext
26
- private val activity: Activity = context.currentActivity as Activity
27
-
28
- private val videoFeedView: VideoFeedView
29
- private var channelId: String? = null
30
- private var playlistId: String? = null
31
- private var feedType: FeedType? = null
32
- private var feedLayout: FeedLayout? = null
33
- private var titlePosition: FeedTitlePosition? = null
34
-
35
- constructor(context: ThemedReactContext) : this(context, null)
36
-
37
- init {
38
- val view = LayoutInflater.from(activity).inflate(R.layout.fwrn_fragment_videofeed, this, true)
39
- videoFeedView = view.findViewById(R.id.fwrn_integrated_videofeed)
40
- videoFeedView.addOnItemClickedListener(object: OnItemClickedListener {
41
- override fun onItemClicked(index: Int, title: String, id: String, videoDuration: Long) {
42
- val fwVideoFeedItemDetailsModel = FWVideoFeedItemDetailsModel(index, id, videoDuration.toInt())
43
- FWEventUtils.sendVideoFeedClickEvent(context, fwVideoFeedItemDetailsModel)
44
- }
45
-
46
- override fun onItemClicked(index: Int) {
47
- super.onItemClicked(index)
48
- }
49
-
50
- override fun onItemClicked(index: Int, feedId: Int): Boolean {
51
- return super.onItemClicked(index, feedId)
52
- }
53
- })
54
- }
55
-
56
- fun setSource(source: String?) {
57
- feedType = when {
58
- source.equals(FWVideoFeedSource.Channel.rawValue) -> {
59
- FeedType.CHANNEL
60
- }
61
- source.equals(FWVideoFeedSource.Playlist.rawValue) -> {
62
- FeedType.PLAYLIST
63
- }
64
- else -> {
65
- FeedType.DISCOVER
66
- }
67
- }
68
- setFeed(channelId, playlistId, feedType)
69
- }
70
-
71
- fun setChannel(channel: String?) {
72
- channelId = channel
73
- setFeed(channelId, playlistId, feedType)
74
- }
75
-
76
- fun setPlaylist(playlist: String?) {
77
- playlistId = playlist
78
- setFeed(channelId, playlistId, feedType)
79
- }
80
-
81
- fun setMode(mode: String?) {
82
- feedLayout = when {
83
- mode.equals(FWVideoFeedMode.Column.rawValue) -> FeedLayout.VERTICAL
84
- mode.equals(FWVideoFeedMode.Grid.rawValue) -> FeedLayout.GRID
85
- else -> FeedLayout.HORIZONTAL
86
- }
87
- videoFeedView.setLayout(feedLayout)
88
- }
89
-
90
- fun setVideoFeedConfig(config: FWVideoFeedConfigModel?) {
91
- val backgroundColor = config?.backgroundColor
92
- if (!backgroundColor.isNullOrBlank()) {
93
- videoFeedView.setBackgroundColor(Color.parseColor(backgroundColor))
94
- } else {
95
- videoFeedView.setBackgroundColor(Color.TRANSPARENT)
96
- }
97
-
98
- videoFeedView.setTitleVisible(config?.title?.hidden != true)
99
-
100
- titlePosition = when {
101
- config?.titlePosition.equals(FWVideoFeedTitlePosition.Stacked.rawValue) -> FeedTitlePosition.BELOW
102
- else -> FeedTitlePosition.ALIGN_BOTTOM
103
- }
104
- videoFeedView.setTitlePosition(titlePosition)
105
- }
106
-
107
- fun setVideoPlayerConfig(config: FWVideoPlayerConfigModel?) {
108
- FWVideoPlayerUtils.setVideoPlayerConfig(config)
109
- }
110
-
111
- fun refresh() {
112
- videoFeedView.refreshFeed()
113
- }
114
-
115
- private fun setFeed(channelId: String?, playlistId: String?, feedType: FeedType?) {
116
- if (feedType == FeedType.CHANNEL && !channelId.isNullOrBlank()) {
117
- videoFeedView.setFeed(channelId, null, FeedType.CHANNEL)
118
- } else if (feedType == FeedType.PLAYLIST && !channelId.isNullOrBlank() && !playlistId.isNullOrBlank()) {
119
- videoFeedView.setFeed(channelId, playlistId, FeedType.PLAYLIST)
120
- } else {
121
- videoFeedView.setFeed(null, null, FeedType.DISCOVER)
122
- }
123
- }
124
- }
@@ -1,88 +0,0 @@
1
- package com.reactnativefireworksdk.manager
2
-
3
- import com.facebook.react.bridge.ReadableArray
4
- import com.facebook.react.bridge.ReadableMap
5
- import com.facebook.react.uimanager.SimpleViewManager
6
- import com.facebook.react.uimanager.ThemedReactContext
7
-
8
- import com.facebook.react.uimanager.annotations.ReactProp
9
- import com.reactnativefireworksdk.constants.FWCommandConstant
10
- import com.reactnativefireworksdk.models.FWVideoFeedConfigModel
11
- import com.reactnativefireworksdk.models.FWVideoPlayerConfigModel
12
- import com.reactnativefireworksdk.utils.FWJsonUtils
13
- import com.facebook.react.common.MapBuilder
14
- import com.reactnativefireworksdk.components.videofeed.FWVideoFeed
15
- import com.reactnativefireworksdk.models.FWFeedViewEventName
16
-
17
-
18
- class FWVideoFeedManager : SimpleViewManager<FWVideoFeed>() {
19
-
20
- override fun getName(): String {
21
- return "FWVideoFeed"
22
- }
23
-
24
- override fun createViewInstance(reactContext: ThemedReactContext): FWVideoFeed {
25
- // currentActivity cannot be null
26
- return FWVideoFeed(reactContext)
27
- }
28
-
29
- @ReactProp(name = "source")
30
- fun setSource(view: FWVideoFeed, source: String?) {
31
- view.setSource(source)
32
- }
33
-
34
- @ReactProp(name = "channel")
35
- fun setChannel(view: FWVideoFeed, channel: String?) {
36
- view.setChannel(channel)
37
- }
38
-
39
- @ReactProp(name = "playlist")
40
- fun setPlaylist(view: FWVideoFeed, playlist: String?) {
41
- view.setPlaylist(playlist)
42
- }
43
-
44
- @ReactProp(name = "mode")
45
- fun setMode(view: FWVideoFeed, mode: String?) {
46
- view.setMode(mode)
47
- }
48
-
49
- @ReactProp(name = "videoFeedConfiguration")
50
- fun setVideoFeedConfig(view: FWVideoFeed, config: ReadableMap?) {
51
- val configMap = config?.toHashMap()
52
- val videoFeedConfigModel = FWJsonUtils.fromMap(configMap, FWVideoFeedConfigModel::class.java)
53
- view.setVideoFeedConfig(videoFeedConfigModel)
54
- }
55
-
56
- @ReactProp(name = "videoPlayerConfiguration")
57
- fun setVideoPlayerConfig(view: FWVideoFeed, config: ReadableMap?) {
58
- val configMap = config?.toHashMap()
59
- val videoPlayerConfigModel = FWJsonUtils.fromMap(configMap, FWVideoPlayerConfigModel::class.java)
60
- view.setVideoPlayerConfig(videoPlayerConfigModel)
61
- }
62
-
63
- override fun getCommandsMap(): MutableMap<String, Int> {
64
- val map: MutableMap<String, Int> = HashMap()
65
- map["refresh"] = FWCommandConstant.FW_COMMAND_VIDEO_FEED_REFRESH
66
- return map
67
- }
68
-
69
- override fun receiveCommand(root: FWVideoFeed, commandId: Int, args: ReadableArray?) {
70
- when (commandId) {
71
- FWCommandConstant.FW_COMMAND_VIDEO_FEED_REFRESH -> {
72
- root.refresh()
73
- }
74
- }
75
- }
76
-
77
- /**
78
- * To map the "onVideoFeedLoadFinished" event name to the "onVideoFeedLoadFinished" callback prop in JavaScript
79
- * first onVideoFeedLoadFinished is event name
80
- * second onVideoFeedLoadFinished is callback prop in JavaScript
81
- */
82
- override fun getExportedCustomBubblingEventTypeConstants(): MutableMap<String, Any>? {
83
- return MapBuilder.builder<String, Any>()
84
- .put(FWFeedViewEventName.VideoFeedLoadFinished.rawValue, MapBuilder.of("phasedRegistrationNames", MapBuilder.of("bubbled", FWFeedViewEventName.VideoFeedLoadFinished.rawValue)))
85
- .build()
86
- }
87
-
88
- }
@@ -1,27 +0,0 @@
1
- package com.reactnativefireworksdk.models
2
-
3
- import android.os.Parcelable
4
- import kotlinx.android.parcel.Parcelize
5
-
6
- @Parcelize
7
- data class FWVideoFeedConfigModel(
8
- val backgroundColor: String?,
9
- val cornerRadius: Int?,
10
- val title: FWTitleModel?,
11
- val titlePosition: String?,
12
- val playIcon: FWPlayIconModel?
13
- ) : Parcelable {
14
-
15
- @Parcelize
16
- data class FWTitleModel(
17
- val hidden: Boolean?,
18
- val textColor: String?,
19
- val fontSize: Int?,
20
- ) : Parcelable
21
-
22
- @Parcelize
23
- data class FWPlayIconModel(
24
- val hidden: Boolean?,
25
- val iconWidth: Int?,
26
- ) : Parcelable
27
- }
@@ -1,7 +0,0 @@
1
- package com.reactnativefireworksdk.models
2
-
3
- enum class FWVideoFeedMode(val rawValue: String) {
4
- Row("row"),
5
- Column("column"),
6
- Grid("grid"),
7
- }
@@ -1,20 +0,0 @@
1
- package com.reactnativefireworksdk.models
2
-
3
- import android.os.Parcelable
4
- import kotlinx.android.parcel.Parcelize
5
-
6
- @Parcelize
7
- data class FWVideoPlayerConfigModel(
8
- val playerStyle: String?,
9
- val videoCompleteAction: String?,
10
- val showShareButton: Boolean?,
11
- val ctaButtonStyle: FWCtaButtonStyleModel?
12
- ) : Parcelable {
13
-
14
- @Parcelize
15
- data class FWCtaButtonStyleModel(
16
- val backgroundColor: String?,
17
- val fontSize: String?,
18
- val textColor: String?,
19
- ) : Parcelable
20
- }
@@ -1,18 +0,0 @@
1
- package com.reactnativefireworksdk.utils
2
-
3
- import com.loopnow.fireworklibrary.VideoPlayerProperties
4
- import com.reactnativefireworksdk.constants.FWVideoPlayerConstant
5
- import com.reactnativefireworksdk.models.FWVideoPlayerConfigModel
6
-
7
- object FWVideoPlayerUtils {
8
-
9
- var customCTAClickEnabled: Boolean = false
10
- var videoPlaybackEventEnabled: Boolean = false
11
-
12
- fun setVideoPlayerConfig(config: FWVideoPlayerConfigModel?) {
13
- VideoPlayerProperties.share = config?.showShareButton != false
14
- VideoPlayerProperties.loop = config?.videoCompleteAction != FWVideoPlayerConstant.FW_VIDEO_COMPLETE_ACTION_ADVANCE_TO_NEXT
15
- // VideoPlayerProperties.autoPlayOnComplete = config?.videoCompleteAction != FWVideoPlayerConstant.FW_VIDEO_COMPLETE_ACTION_LOOP
16
- VideoPlayerProperties.fullScreenPlayer = config?.playerStyle == FWVideoPlayerConstant.FW_PLAYER_STYLE_FULL
17
- }
18
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- //# sourceMappingURL=ADConfig.js.map
@@ -1,2 +0,0 @@
1
-
2
- //# sourceMappingURL=ADConfig.js.map