react-native-firework-sdk 1.0.6-beta.2 → 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 (184) 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 +2 -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 +1 -1
  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 +14 -12
  33. package/android/src/main/java/com/{reactnativefireworksdk → fireworksdk/bridge/reactnative}/module/FireworkSDKModule.kt +23 -13
  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 +46 -5
  36. package/android/src/main/java/com/{reactnativefireworksdk → fireworksdk/bridge}/utils/FWJsonUtils.kt +1 -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 +29 -0
  45. package/ios/{Component → Components}/VideoFeedConfiguration.swift +1 -0
  46. package/ios/{Component → Components}/VideoFeedManager.m +0 -0
  47. package/ios/{Component → Components}/VideoFeedManager.swift +0 -0
  48. package/ios/{Component → Components}/VideoPlayerConfiguration.swift +0 -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} +0 -0
  53. package/ios/Models/{RCTConvert+VideoFeed.swift → RNToNative/RCTConvert+VideoFeed.swift} +0 -0
  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 -19
  57. package/ios/Modules/FireworkSDKModule/FireworkSDKModule.m +2 -1
  58. package/ios/Modules/FireworkSDKModule/FireworkSDKModule.swift +11 -3
  59. package/ios/Modules/LiveStream/LiveStreamModule.m +14 -0
  60. package/ios/Modules/LiveStream/LiveStreamModule.swift +43 -0
  61. package/lib/commonjs/FireworkSDK.js +61 -38
  62. package/lib/commonjs/FireworkSDK.js.map +1 -1
  63. package/lib/commonjs/LiveStream.js +60 -0
  64. package/lib/commonjs/LiveStream.js.map +1 -0
  65. package/lib/commonjs/VideoShopping.js +16 -15
  66. package/lib/commonjs/VideoShopping.js.map +1 -1
  67. package/lib/commonjs/components/VideoFeed.js +46 -2
  68. package/lib/commonjs/components/VideoFeed.js.map +1 -1
  69. package/lib/commonjs/index.js +24 -0
  70. package/lib/commonjs/index.js.map +1 -1
  71. package/lib/commonjs/models/AdBadgeConfiguration.js +2 -0
  72. package/lib/commonjs/models/{ADConfig.js.map → AdBadgeConfiguration.js.map} +0 -0
  73. package/lib/commonjs/models/AdConfig.js +2 -0
  74. package/lib/{module/models/ADConfig.js.map → commonjs/models/AdConfig.js.map} +0 -0
  75. package/lib/commonjs/models/FWEventName.js +24 -0
  76. package/lib/commonjs/models/FWEventName.js.map +1 -0
  77. package/lib/commonjs/models/FWEvents.js +0 -14
  78. package/lib/commonjs/models/FWEvents.js.map +1 -1
  79. package/lib/commonjs/models/LiveStreamChatEventName.js +15 -0
  80. package/lib/commonjs/models/LiveStreamChatEventName.js.map +1 -0
  81. package/lib/commonjs/models/LiveStreamEventDetails.js +2 -0
  82. package/lib/commonjs/models/LiveStreamEventDetails.js.map +1 -0
  83. package/lib/commonjs/models/LiveStreamEventName.js +17 -0
  84. package/lib/commonjs/models/LiveStreamEventName.js.map +1 -0
  85. package/lib/commonjs/models/LiveStreamMessageDetails.js +2 -0
  86. package/lib/commonjs/models/LiveStreamMessageDetails.js.map +1 -0
  87. package/lib/commonjs/models/VideoFeedSource.js +6 -0
  88. package/lib/commonjs/models/VideoFeedSource.js.map +1 -0
  89. package/lib/commonjs/models/VideoPlaybackEventName.js.map +1 -1
  90. package/lib/commonjs/modules/FireworkSDKModule.js +3 -1
  91. package/lib/commonjs/modules/FireworkSDKModule.js.map +1 -1
  92. package/lib/commonjs/modules/LiveStreamModule.js +22 -0
  93. package/lib/commonjs/modules/LiveStreamModule.js.map +1 -0
  94. package/lib/commonjs/modules/ShoppingModule.js +3 -1
  95. package/lib/commonjs/modules/ShoppingModule.js.map +1 -1
  96. package/lib/module/FireworkSDK.js +50 -34
  97. package/lib/module/FireworkSDK.js.map +1 -1
  98. package/lib/module/LiveStream.js +51 -0
  99. package/lib/module/LiveStream.js.map +1 -0
  100. package/lib/module/VideoShopping.js +10 -10
  101. package/lib/module/VideoShopping.js.map +1 -1
  102. package/lib/module/components/VideoFeed.js +41 -3
  103. package/lib/module/components/VideoFeed.js.map +1 -1
  104. package/lib/module/index.js +4 -1
  105. package/lib/module/index.js.map +1 -1
  106. package/lib/module/models/AdBadgeConfiguration.js +2 -0
  107. package/lib/module/models/AdBadgeConfiguration.js.map +1 -0
  108. package/lib/module/models/AdConfig.js +2 -0
  109. package/lib/module/models/AdConfig.js.map +1 -0
  110. package/lib/module/models/FWEventName.js +17 -0
  111. package/lib/module/models/FWEventName.js.map +1 -0
  112. package/lib/module/models/FWEvents.js +1 -12
  113. package/lib/module/models/FWEvents.js.map +1 -1
  114. package/lib/module/models/LiveStreamChatEventName.js +8 -0
  115. package/lib/module/models/LiveStreamChatEventName.js.map +1 -0
  116. package/lib/module/models/LiveStreamEventDetails.js +2 -0
  117. package/lib/module/models/LiveStreamEventDetails.js.map +1 -0
  118. package/lib/module/models/LiveStreamEventName.js +10 -0
  119. package/lib/module/models/LiveStreamEventName.js.map +1 -0
  120. package/lib/module/models/LiveStreamMessageDetails.js +2 -0
  121. package/lib/module/models/LiveStreamMessageDetails.js.map +1 -0
  122. package/lib/module/models/VideoFeedSource.js +2 -0
  123. package/lib/module/models/VideoFeedSource.js.map +1 -0
  124. package/lib/module/models/VideoPlaybackEventName.js.map +1 -1
  125. package/lib/module/modules/FireworkSDKModule.js +3 -0
  126. package/lib/module/modules/FireworkSDKModule.js.map +1 -1
  127. package/lib/module/modules/LiveStreamModule.js +12 -0
  128. package/lib/module/modules/LiveStreamModule.js.map +1 -0
  129. package/lib/module/modules/ShoppingModule.js +3 -1
  130. package/lib/module/modules/ShoppingModule.js.map +1 -1
  131. package/lib/typescript/FireworkSDK.d.ts +26 -24
  132. package/lib/typescript/LiveStream.d.ts +21 -0
  133. package/lib/typescript/VideoShopping.d.ts +5 -5
  134. package/lib/typescript/components/VideoFeed.d.ts +7 -4
  135. package/lib/typescript/index.d.ts +15 -6
  136. package/lib/typescript/models/AdBadgeConfiguration.d.ts +15 -0
  137. package/lib/typescript/models/{ADConfig.d.ts → AdConfig.d.ts} +1 -1
  138. package/lib/typescript/models/FWEventName.d.ts +14 -0
  139. package/lib/typescript/models/FWEvents.d.ts +14 -11
  140. package/lib/typescript/models/FeedItemDetails.d.ts +11 -4
  141. package/lib/typescript/models/LiveStreamChatEventName.d.ts +7 -0
  142. package/lib/typescript/models/LiveStreamEventDetails.d.ts +3 -0
  143. package/lib/typescript/models/LiveStreamEventName.d.ts +15 -0
  144. package/lib/typescript/models/LiveStreamMessageDetails.d.ts +14 -0
  145. package/lib/typescript/models/VideoFeedConfiguration.d.ts +7 -3
  146. package/lib/typescript/models/VideoFeedSource.d.ts +2 -0
  147. package/lib/typescript/models/VideoPlaybackDetails.d.ts +1 -2
  148. package/lib/typescript/models/VideoPlaybackEventName.d.ts +1 -1
  149. package/lib/typescript/models/VideoPlayerConfiguration.d.ts +5 -0
  150. package/lib/typescript/modules/FireworkSDKModule.d.ts +8 -4
  151. package/lib/typescript/modules/LiveStreamModule.d.ts +8 -0
  152. package/lib/typescript/modules/ShoppingModule.d.ts +3 -1
  153. package/package.json +3 -3
  154. package/react-native-firework-sdk.podspec +3 -1
  155. package/src/FireworkSDK.ts +49 -33
  156. package/src/LiveStream.ts +51 -0
  157. package/src/VideoShopping.ts +10 -9
  158. package/src/components/VideoFeed.tsx +63 -7
  159. package/src/index.tsx +31 -12
  160. package/src/models/AdBadgeConfiguration.ts +16 -0
  161. package/src/models/{ADConfig.ts → AdConfig.ts} +1 -1
  162. package/src/models/FWEventName.ts +14 -0
  163. package/src/models/FWEvents.ts +16 -12
  164. package/src/models/FeedItemDetails.ts +12 -4
  165. package/src/models/LiveStreamChatEventName.ts +8 -0
  166. package/src/models/LiveStreamEventDetails.ts +4 -0
  167. package/src/models/LiveStreamEventName.ts +16 -0
  168. package/src/models/LiveStreamMessageDetails.ts +14 -0
  169. package/src/models/VideoFeedConfiguration.ts +7 -3
  170. package/src/models/VideoFeedSource.ts +2 -0
  171. package/src/models/VideoPlaybackDetails.ts +1 -3
  172. package/src/models/VideoPlaybackEventName.ts +1 -1
  173. package/src/models/VideoPlayerConfiguration.ts +7 -1
  174. package/src/modules/FireworkSDKModule.ts +10 -4
  175. package/src/modules/LiveStreamModule.ts +26 -0
  176. package/src/modules/ShoppingModule.ts +13 -6
  177. package/android/src/main/java/com/reactnativefireworksdk/components/videofeed/FWVideoFeed.kt +0 -143
  178. package/android/src/main/java/com/reactnativefireworksdk/manager/FWVideoFeedManager.kt +0 -88
  179. package/android/src/main/java/com/reactnativefireworksdk/models/FWVideoFeedConfigModel.kt +0 -27
  180. package/android/src/main/java/com/reactnativefireworksdk/models/FWVideoFeedMode.kt +0 -7
  181. package/android/src/main/java/com/reactnativefireworksdk/models/FWVideoPlayerConfigModel.kt +0 -22
  182. package/android/src/main/java/com/reactnativefireworksdk/utils/FWVideoPlayerUtils.kt +0 -20
  183. package/lib/commonjs/models/ADConfig.js +0 -2
  184. package/lib/module/models/ADConfig.js +0 -2
@@ -5,16 +5,22 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
 
8
- var _reactNative = require("react-native");
8
+ var _LiveStream = _interopRequireDefault(require("./LiveStream"));
9
9
 
10
- var _FWEvents = require("./models/FWEvents");
10
+ var _FWEventName = require("./models/FWEventName");
11
11
 
12
- var _FireworkSDKModule = _interopRequireDefault(require("./modules/FireworkSDKModule"));
12
+ var _FireworkSDKModule = _interopRequireWildcard(require("./modules/FireworkSDKModule"));
13
+
14
+ var _LiveStreamModule = _interopRequireDefault(require("./modules/LiveStreamModule"));
13
15
 
14
16
  var _ShoppingModule = _interopRequireDefault(require("./modules/ShoppingModule"));
15
17
 
16
18
  var _VideoShopping = _interopRequireDefault(require("./VideoShopping"));
17
19
 
20
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
21
+
22
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
23
+
18
24
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
25
 
20
26
  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; }
@@ -24,72 +30,88 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
24
30
  */
25
31
  class FireworkSDK {
26
32
  /**
27
- * Clicking Video Feed callback
33
+ * The callback of SDK initialization.
28
34
  */
29
35
 
30
36
  /**
31
- * SDK initialization callback.
37
+ * the callback of clicking Video Feed.
32
38
  */
33
39
 
34
40
  /**
35
- * Get Custom Clicking CTA callback.
41
+ * The callback of clicking custom CTA.
36
42
  */
37
43
  get onCustomCTAClick() {
38
44
  return this._onCustomCTAClick;
39
45
  }
40
- /**
41
- * Set Custom Clicking CTA callback.
42
- */
43
-
44
46
 
45
47
  set onCustomCTAClick(value) {
46
48
  this._onCustomCTAClick = value;
47
49
 
48
50
  _FireworkSDKModule.default.setCustomCTAClickEnabled(value ? true : false);
49
51
  }
52
+
50
53
  /**
51
- * Get Video Playback callback.
54
+ * The callback of video playback.
52
55
  */
53
-
54
-
55
56
  get onVideoPlayback() {
56
57
  return this._onVideoPlayback;
57
58
  }
58
- /**
59
- * Set Video Playback callback.
60
- */
61
-
62
59
 
63
60
  set onVideoPlayback(value) {
64
61
  this._onVideoPlayback = value;
65
62
 
66
63
  _FireworkSDKModule.default.setVideoPlaybackEventEnabled(value ? true : false);
67
64
  }
65
+
68
66
  /**
69
- * get Share Base URL
67
+ * The share base URL of videos.
70
68
  */
71
-
72
-
73
69
  get shareBaseURL() {
74
70
  return this._shareBaseURL;
75
71
  }
76
- /**
77
- * set Share Base URL
78
- */
79
-
80
72
 
81
73
  set shareBaseURL(value) {
82
74
  this._shareBaseURL = value;
83
75
 
84
- _FireworkSDKModule.default.setShareBaseURL(value);
76
+ _FireworkSDKModule.default.setShareBaseURL(value).then(() => {
77
+ this.eventEmitter.emit(_FWEventName.FWEventName.ShareBaseURLUpdated);
78
+ });
79
+ }
80
+
81
+ /**
82
+ * The configuration for ad badges.
83
+ */
84
+ get adBadgeConfiguration() {
85
+ return this._adBadgeConfiguration;
86
+ }
87
+
88
+ set adBadgeConfiguration(value) {
89
+ this._adBadgeConfiguration = value;
90
+
91
+ _FireworkSDKModule.default.setAdBadgeConfiguration(value).then(() => {
92
+ this.eventEmitter.emit(_FWEventName.FWEventName.AdBadgeConfigurationUpdated);
93
+ });
85
94
  }
86
95
 
96
+ get eventEmitter() {
97
+ return _FireworkSDKModule.FireworkSDKModuleEventEmitter;
98
+ }
87
99
  /**
88
100
  * Get VideoShopping object.
89
101
  */
102
+
103
+
90
104
  get shopping() {
91
105
  return _VideoShopping.default.getInstance();
92
106
  }
107
+ /**
108
+ * Get LiveStream object.
109
+ */
110
+
111
+
112
+ get liveStream() {
113
+ return _LiveStream.default.getInstance();
114
+ }
93
115
  /**
94
116
  * Get global single instance of FireworkSDK class.
95
117
  * @returns FireworkSDK
@@ -105,35 +127,34 @@ class FireworkSDK {
105
127
  }
106
128
 
107
129
  constructor() {
130
+ _defineProperty(this, "onSDKInit", void 0);
131
+
132
+ _defineProperty(this, "onVideoFeedClick", void 0);
133
+
108
134
  _defineProperty(this, "_onCustomCTAClick", void 0);
109
135
 
110
136
  _defineProperty(this, "_onVideoPlayback", void 0);
111
137
 
112
- _defineProperty(this, "onVideoFeedClick", void 0);
113
-
114
138
  _defineProperty(this, "_shareBaseURL", void 0);
115
139
 
116
- _defineProperty(this, "onSDKInit", void 0);
140
+ _defineProperty(this, "_adBadgeConfiguration", void 0);
117
141
 
118
- _defineProperty(this, "eventEmitter", void 0);
119
-
120
- this.eventEmitter = new _reactNative.NativeEventEmitter(_FireworkSDKModule.default);
121
- this.eventEmitter.addListener(_FWEvents.FWEventName.SDKInit, event => {
142
+ this.eventEmitter.addListener(_FWEventName.FWEventName.SDKInit, event => {
122
143
  if (this.onSDKInit) {
123
144
  this.onSDKInit(event !== null && event !== void 0 ? event : {});
124
145
  }
125
146
  });
126
- this.eventEmitter.addListener(_FWEvents.FWEventName.CustomCTAClick, event => {
147
+ this.eventEmitter.addListener(_FWEventName.FWEventName.CustomCTAClick, event => {
127
148
  if (this.onCustomCTAClick) {
128
149
  this.onCustomCTAClick(event !== null && event !== void 0 ? event : {});
129
150
  }
130
151
  });
131
- this.eventEmitter.addListener(_FWEvents.FWEventName.VideoPlayback, event => {
152
+ this.eventEmitter.addListener(_FWEventName.FWEventName.VideoPlayback, event => {
132
153
  if (this.onVideoPlayback) {
133
154
  this.onVideoPlayback(event !== null && event !== void 0 ? event : {});
134
155
  }
135
156
  });
136
- this.eventEmitter.addListener(_FWEvents.FWEventName.VideoFeedClick, event => {
157
+ this.eventEmitter.addListener(_FWEventName.FWEventName.VideoFeedClick, event => {
137
158
  if (this.onVideoFeedClick) {
138
159
  this.onVideoFeedClick(event !== null && event !== void 0 ? event : {});
139
160
  }
@@ -142,7 +163,7 @@ class FireworkSDK {
142
163
  /**
143
164
  * Initializes Firework SDK.
144
165
  * @param {string?} userId An id to uniquely identify device or user.
145
- * @param {ADConfig?} adConfig Configuration of Ad.
166
+ * @param {AdConfig?} adConfig Configuration of Ad.
146
167
  */
147
168
 
148
169
 
@@ -150,11 +171,13 @@ class FireworkSDK {
150
171
  _FireworkSDKModule.default.init(userId, adConfig);
151
172
 
152
173
  _ShoppingModule.default.init();
174
+
175
+ _LiveStreamModule.default.init();
153
176
  }
154
177
  /**
155
178
  * Open Video URL.
156
- * @param {string} url
157
- * @param {VideoPlayerConfiguration} config
179
+ * @param {string} url
180
+ * @param {VideoPlayerConfiguration} config
158
181
  */
159
182
 
160
183
 
@@ -1 +1 @@
1
- {"version":3,"sources":["FireworkSDK.ts"],"names":["FireworkSDK","onCustomCTAClick","_onCustomCTAClick","value","FireworkSDKModule","setCustomCTAClickEnabled","onVideoPlayback","_onVideoPlayback","setVideoPlaybackEventEnabled","shareBaseURL","_shareBaseURL","setShareBaseURL","shopping","VideoShopping","getInstance","_instance","constructor","eventEmitter","NativeEventEmitter","addListener","FWEventName","SDKInit","event","onSDKInit","CustomCTAClick","VideoPlayback","VideoFeedClick","onVideoFeedClick","init","userId","adConfig","ShoppingModule","openVideoPlayer","url","config"],"mappings":";;;;;;;AAAA;;AAQA;;AAEA;;AACA;;AACA;;;;;;AAOA;AACA;AACA;AACA,MAAMA,WAAN,CAAkB;AAKhB;AACF;AACA;;AAIE;AACF;AACA;;AAGE;AACF;AACA;AAC6B,MAAhBC,gBAAgB,GAAuC;AAChE,WAAO,KAAKC,iBAAZ;AACD;AAED;AACF;AACA;;;AAC6B,MAAhBD,gBAAgB,CAACE,KAAD,EAA4C;AACrE,SAAKD,iBAAL,GAAyBC,KAAzB;;AACAC,+BAAkBC,wBAAlB,CAA2CF,KAAK,GAAG,IAAH,GAAU,KAA1D;AACD;AAED;AACF;AACA;;;AAC4B,MAAfG,eAAe,GAAsC;AAC9D,WAAO,KAAKC,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YAAL,CAAkBE,WAAlB,CAA8BC,sBAAYK,aAA1C,EAA0DH,KAAD,IAAW;AAClE,UAAI,KAAKhB,eAAT,EAA0B;AACxB,aAAKA,eAAL,CAAqBgB,KAArB,aAAqBA,KAArB,cAAqBA,KAArB,GAA8B,EAA9B;AACD;AACF,KAJD;AAMA,SAAKL,YAAL,CAAkBE,WAAlB,CAA8BC,sBAAYM,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;AAChD1B,+BAAkBwB,IAAlB,CAAuBC,MAAvB,EAA+BC,QAA/B;;AACAC,4BAAeH,IAAf;AACD;AAED;AACF;AACA;AACA;AACA;;;AACSI,EAAAA,eAAe,CAACC,GAAD,EAAcC,MAAd,EAAiD;AACrE9B,+BAAkB4B,eAAlB,CAAkCC,GAAlC,EAAuCC,MAAvC,aAAuCA,MAAvC,cAAuCA,MAAvC,GAAiD,EAAjD;AACD;;AA/He;;gBAAZlC,W;;eAkISA,W","sourcesContent":["import { NativeEventEmitter } from 'react-native';\n\nimport type ADConfig from './models/ADConfig';\nimport type {\n CustomCTAClickEvent,\n SDKInitEvent,\n VideoPlaybackEvent,\n} from './models/FWEvents';\nimport { FWEventName, VideoFeedClickEvent } from './models/FWEvents';\nimport type VideoPlayerConfiguration from './models/VideoPlayerConfiguration';\nimport FireworkSDKModule from './modules/FireworkSDKModule';\nimport ShoppingModule from './modules/ShoppingModule';\nimport VideoShopping from './VideoShopping';\n\nexport type SDKInitCallback = (event: SDKInitEvent) => void;\nexport type CustomCTAClickCallback = (event: CustomCTAClickEvent) => void;\nexport type VideoPlaybackCallback = (event: VideoPlaybackEvent) => void;\nexport type VideoFeedClickCallback = (event: VideoFeedClickEvent) => void;\n\n/**\n * Entry class of Firework SDK, which supports the sdk initialization and global configuration.\n */\nclass FireworkSDK {\n private static _instance?: FireworkSDK;\n private _onCustomCTAClick: CustomCTAClickCallback | undefined;\n private _onVideoPlayback?: VideoPlaybackCallback | undefined;\n\n /**\n * Clicking Video Feed callback\n */\n public onVideoFeedClick?: VideoFeedClickCallback;\n private _shareBaseURL: string | undefined;\n\n /**\n * SDK initialization callback.\n */\n public onSDKInit?: SDKInitCallback;\n\n /**\n * Get Custom Clicking CTA callback.\n */\n public get onCustomCTAClick(): CustomCTAClickCallback | undefined {\n return this._onCustomCTAClick;\n }\n\n /**\n * Set Custom Clicking CTA callback.\n */\n public set onCustomCTAClick(value: CustomCTAClickCallback | undefined) {\n this._onCustomCTAClick = value;\n FireworkSDKModule.setCustomCTAClickEnabled(value ? true : false);\n }\n\n /**\n * Get Video Playback callback.\n */\n public get onVideoPlayback(): VideoPlaybackCallback | undefined {\n return this._onVideoPlayback;\n }\n\n /**\n * Set Video Playback callback.\n */\n public set onVideoPlayback(value: VideoPlaybackCallback | undefined) {\n this._onVideoPlayback = value;\n FireworkSDKModule.setVideoPlaybackEventEnabled(value ? true : false);\n }\n\n /**\n * get Share Base URL\n */\n public get shareBaseURL(): string | undefined {\n return this._shareBaseURL;\n }\n\n /**\n * set Share Base URL\n */\n public set shareBaseURL(value: string | undefined) {\n this._shareBaseURL = value;\n FireworkSDKModule.setShareBaseURL(value);\n }\n\n private eventEmitter: NativeEventEmitter;\n\n /**\n * Get VideoShopping object.\n */\n public get shopping(): VideoShopping {\n return VideoShopping.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 = new NativeEventEmitter(FireworkSDKModule);\n\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 }\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":["FireworkSDK","onCustomCTAClick","_onCustomCTAClick","value","FireworkSDKModule","setCustomCTAClickEnabled","onVideoPlayback","_onVideoPlayback","setVideoPlaybackEventEnabled","shareBaseURL","_shareBaseURL","setShareBaseURL","then","eventEmitter","emit","FWEventName","ShareBaseURLUpdated","adBadgeConfiguration","_adBadgeConfiguration","setAdBadgeConfiguration","AdBadgeConfigurationUpdated","FireworkSDKModuleEventEmitter","shopping","VideoShopping","getInstance","liveStream","LiveStream","_instance","constructor","addListener","SDKInit","event","onSDKInit","CustomCTAClick","VideoPlayback","VideoFeedClick","onVideoFeedClick","init","userId","adConfig","ShoppingModule","LiveStreamModule","openVideoPlayer","url","config"],"mappings":";;;;;;;AACA;;AAIA;;AAQA;;AACA;;AACA;;AACA;;;;;;;;;;AAOA;AACA;AACA;AACA,MAAMA,WAAN,CAAkB;AAGhB;AACF;AACA;;AA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AA,IAAI,CAACC,MAAD,EAAkBC,QAAlB,EAAuC;AAChDnC,+BAAkBiC,IAAlB,CAAuBC,MAAvB,EAA+BC,QAA/B;;AACAC,4BAAeH,IAAf;;AACAI,8BAAiBJ,IAAjB;AACD;AAED;AACF;AACA;AACA;AACA;;;AACSK,EAAAA,eAAe,CAACC,GAAD,EAAcC,MAAd,EAAiD;AACrExC,+BAAkBsC,eAAlB,CAAkCC,GAAlC,EAAuCC,MAAvC,aAAuCA,MAAvC,cAAuCA,MAAvC,GAAiD,EAAjD;AACD;;AA3Ie;;gBAAZ5C,W;;eA8ISA,W","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, { FireworkSDKModuleEventEmitter } from './modules/FireworkSDKModule';\nimport LiveStreamModule from './modules/LiveStreamModule';\nimport ShoppingModule from './modules/ShoppingModule';\nimport VideoShopping from './VideoShopping';\n\nexport type SDKInitCallback = (event: SDKInitEvent) => void;\nexport type CustomCTAClickCallback = (event: CustomCTAClickEvent) => void;\nexport type VideoPlaybackCallback = (event: VideoPlaybackEvent) => void;\nexport type VideoFeedClickCallback = (event: VideoFeedClickEvent) => void;\n\n/**\n * Entry class of Firework SDK, which supports the sdk initialization and global configuration.\n */\nclass FireworkSDK {\n private static _instance?: FireworkSDK;\n\n /**\n * The callback of SDK initialization.\n */\n public onSDKInit?: SDKInitCallback;\n\n /**\n * the callback of clicking Video Feed.\n */\n public onVideoFeedClick?: VideoFeedClickCallback;\n\n /**\n * The callback of clicking custom CTA.\n */\n public get onCustomCTAClick(): CustomCTAClickCallback | undefined {\n return this._onCustomCTAClick;\n }\n public set onCustomCTAClick(value: CustomCTAClickCallback | undefined) {\n 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 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"]}
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _FWEventName = require("./models/FWEventName");
9
+
10
+ var _LiveStreamModule = require("./modules/LiveStreamModule");
11
+
12
+ 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; }
13
+
14
+ /**
15
+ * The entry class of live stream.
16
+ */
17
+ class LiveStream {
18
+ /**
19
+ * The callback of live stream event.
20
+ */
21
+
22
+ /**
23
+ * The callback of live stream chat event.
24
+ */
25
+ get eventEmitter() {
26
+ return _LiveStreamModule.LiveStreamModuleEventEmitter;
27
+ }
28
+
29
+ static getInstance() {
30
+ if (!LiveStream._instance) {
31
+ LiveStream._instance = new LiveStream();
32
+ }
33
+
34
+ return LiveStream._instance;
35
+ }
36
+
37
+ constructor() {
38
+ _defineProperty(this, "onLiveStreamEvent", void 0);
39
+
40
+ _defineProperty(this, "onLiveStreamChatEvent", void 0);
41
+
42
+ this.eventEmitter.addListener(_FWEventName.FWEventName.onLiveStreamEvent, event => {
43
+ if (this.onLiveStreamEvent) {
44
+ this.onLiveStreamEvent(event !== null && event !== void 0 ? event : {});
45
+ }
46
+ });
47
+ this.eventEmitter.addListener(_FWEventName.FWEventName.onLiveStreamChatEvent, event => {
48
+ if (this.onLiveStreamChatEvent) {
49
+ this.onLiveStreamChatEvent(event !== null && event !== void 0 ? event : {});
50
+ }
51
+ });
52
+ }
53
+
54
+ }
55
+
56
+ _defineProperty(LiveStream, "_instance", void 0);
57
+
58
+ var _default = LiveStream;
59
+ exports.default = _default;
60
+ //# sourceMappingURL=LiveStream.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["LiveStream.ts"],"names":["LiveStream","eventEmitter","LiveStreamModuleEventEmitter","getInstance","_instance","constructor","addListener","FWEventName","onLiveStreamEvent","event","onLiveStreamChatEvent"],"mappings":";;;;;;;AACA;;AAEA;;;;AAKA;AACA;AACA;AACA,MAAMA,UAAN,CAAiB;AAGf;AACF;AACA;;AAEE;AACF;AACA;AAG0B,MAAZC,YAAY,GAAuB;AAC7C,WAAOC,8CAAP;AACD;;AAEwB,SAAXC,WAAW,GAAG;AAC1B,QAAI,CAACH,UAAU,CAACI,SAAhB,EAA2B;AACzBJ,MAAAA,UAAU,CAACI,SAAX,GAAuB,IAAIJ,UAAJ,EAAvB;AACD;;AAED,WAAOA,UAAU,CAACI,SAAlB;AACD;;AAEOC,EAAAA,WAAW,GAAG;AAAA;;AAAA;;AACpB,SAAKJ,YAAL,CAAkBK,WAAlB,CAA8BC,yBAAYC,iBAA1C,EAA8DC,KAAD,IAAW;AACtE,UAAI,KAAKD,iBAAT,EAA4B;AAC1B,aAAKA,iBAAL,CAAuBC,KAAvB,aAAuBA,KAAvB,cAAuBA,KAAvB,GAAgC,EAAhC;AACD;AACF,KAJD;AAMA,SAAKR,YAAL,CAAkBK,WAAlB,CAA8BC,yBAAYG,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;;gBAAXT,U;;eAuCSA,U","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"]}
@@ -5,18 +5,18 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
 
8
- var _reactNative = require("react-native");
8
+ var _FWEventName = require("./models/FWEventName");
9
9
 
10
- var _FWEvents = require("./models/FWEvents");
10
+ var _ShoppingModule = _interopRequireWildcard(require("./modules/ShoppingModule"));
11
11
 
12
- var _ShoppingModule = _interopRequireDefault(require("./modules/ShoppingModule"));
12
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
13
13
 
14
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
15
15
 
16
16
  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; }
17
17
 
18
18
  /**
19
- * Entry class of Video Shopping
19
+ * The entry class of video shopping.
20
20
  */
21
21
  class VideoShopping {
22
22
  /**
@@ -34,7 +34,7 @@ class VideoShopping {
34
34
  /**
35
35
  * This callback is triggered when the video will be shown.
36
36
  *
37
- * The host app can return a Product object to update the latest product information.
37
+ * The host app can return a Product list to update the latest product information.
38
38
  */
39
39
 
40
40
  /**
@@ -56,6 +56,10 @@ class VideoShopping {
56
56
  _ShoppingModule.default.setCartIconVisible(value);
57
57
  }
58
58
 
59
+ get eventEmitter() {
60
+ return _ShoppingModule.ShoppingModuleEventEmitter;
61
+ }
62
+
59
63
  static getInstance() {
60
64
  if (!VideoShopping._instance) {
61
65
  VideoShopping._instance = new VideoShopping();
@@ -65,8 +69,6 @@ class VideoShopping {
65
69
  }
66
70
 
67
71
  constructor() {
68
- _defineProperty(this, "_cartIconVisible", true);
69
-
70
72
  _defineProperty(this, "onAddToCart", void 0);
71
73
 
72
74
  _defineProperty(this, "onClickCartIcon", void 0);
@@ -75,21 +77,20 @@ class VideoShopping {
75
77
 
76
78
  _defineProperty(this, "onWillDisplayProduct", void 0);
77
79
 
78
- _defineProperty(this, "currentCartPage", void 0);
80
+ _defineProperty(this, "_cartIconVisible", true);
79
81
 
80
- _defineProperty(this, "eventEmitter", void 0);
82
+ _defineProperty(this, "currentCartPage", void 0);
81
83
 
82
- this.eventEmitter = new _reactNative.NativeEventEmitter(_ShoppingModule.default);
83
- this.eventEmitter.addListener(_FWEvents.FWEventName.AddToCart, event => {
84
+ this.eventEmitter.addListener(_FWEventName.FWEventName.AddToCart, event => {
84
85
  this.handleAddToCartEvent(event);
85
86
  });
86
- this.eventEmitter.addListener(_FWEvents.FWEventName.ClickCartIcon, event => {
87
+ this.eventEmitter.addListener(_FWEventName.FWEventName.ClickCartIcon, event => {
87
88
  this.handleClickCartIconEvent(event);
88
89
  });
89
- this.eventEmitter.addListener(_FWEvents.FWEventName.UpdateProductDetails, event => {
90
+ this.eventEmitter.addListener(_FWEventName.FWEventName.UpdateProductDetails, event => {
90
91
  this.handleUpdateProductDetailsEvent(event);
91
92
  });
92
- this.eventEmitter.addListener(_FWEvents.FWEventName.WillDisplayProduct, event => {
93
+ this.eventEmitter.addListener(_FWEventName.FWEventName.WillDisplayProduct, event => {
93
94
  this.handleWillDisplayProductEvent(event);
94
95
  });
95
96
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["VideoShopping.ts"],"names":["VideoShopping","cartIconVisible","_cartIconVisible","value","ShoppingModule","setCartIconVisible","getInstance","_instance","constructor","eventEmitter","NativeEventEmitter","addListener","FWEventName","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":";;;;;;;AAAA;;AAGA;;AAQA;;;;;;AAoBA;AACA;AACA;AACA,MAAMA,aAAN,CAAoB;AAIlB;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;;AACAC,4BAAeC,kBAAf,CAAkCF,KAAlC;AACD;;AAMwB,SAAXG,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,8CArDc,IAqDd;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AACpB,SAAKC,YAAL,GAAoB,IAAIC,+BAAJ,CAAuBN,uBAAvB,CAApB;AACA,SAAKK,YAAL,CAAkBE,WAAlB,CAA8BC,sBAAYC,SAA1C,EAAsDC,KAAD,IAAW;AAC9D,WAAKC,oBAAL,CAA0BD,KAA1B;AACD,KAFD;AAIA,SAAKL,YAAL,CAAkBE,WAAlB,CAA8BC,sBAAYI,aAA1C,EAA0DF,KAAD,IAAW;A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sBAAT,EAAiC;AAC/B,YAAMT,UAAU,GAAGZ,KAAK,CAACY,UAAzB;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;AACfhC,gCAAeqC,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;AACVvC,gCAAewC,uBAAf,CAAuCD,MAAvC,EAA+CjB,UAA/C;AACD;AACF;AACF;;AApJiB;;gBAAd1B,a;;eAuJSA,a","sourcesContent":["import { NativeEventEmitter } from 'react-native';\n\nimport type AddToCartResult from './models/AddToCartResult';\nimport {\n AddToCartEvent,\n FWEventName,\n UpdateProductDetailsEvent,\n WillDisplayProductEvent,\n} from './models/FWEvents';\nimport type Product from './models/Product';\nimport type ProductInfoViewConfiguration from './models/ProductInfoViewConfiguration';\nimport ShoppingModule 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 * Entry class of Video Shopping\n */\nclass VideoShopping {\n private static _instance?: VideoShopping;\n private _cartIconVisible: boolean = true;\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 object 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\n public currentCartPage?: React.ReactNode;\n\n private eventEmitter: NativeEventEmitter;\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 = new NativeEventEmitter(ShoppingModule);\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":["VideoShopping","cartIconVisible","_cartIconVisible","value","ShoppingModule","setCartIconVisible","eventEmitter","ShoppingModuleEventEmitter","getInstance","_instance","constructor","addListener","FWEventName","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;;AAGA;;;;;;;;AAoBA;AACA;AACA;AACA,MAAMA,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;;AACAC,4BAAeC,kBAAf,CAAkCF,KAAlC;AACD;;AAKuB,MAAZG,YAAY,GAAuB;AAC7C,WAAOC,0CAAP;AACD;;AAEwB,SAAXC,WAAW,GAAG;AAC1B,QAAI,CAACR,aAAa,CAACS,SAAnB,EAA8B;AAC5BT,MAAAA,aAAa,CAACS,SAAd,GAA0B,IAAIT,aAAJ,EAA1B;AACD;;AAED,WAAOA,aAAa,CAACS,SAArB;AACD;;AAEOC,EAAAA,WAAW,GAAG;AAAA;;AAAA;;AAAA;;AAAA;;AAAA,8CAhBc,IAgBd;;AAAA;;AACpB,SAAKJ,YAAL,CAAkBK,WAAlB,CAA8BC,yBAAYC,SAA1C,EAAsDC,KAAD,IAAW;AAC9D,WAAKC,oBAAL,CAA0BD,KAA1B;AACD,KAFD;AAIA,SAAKR,YAAL,CAAkBK,WAAlB,CAA8BC,yBAAYI,aAA1C,EAA0DF,KAAD,IAAW;AAClE,WAAKG,wBAAL,CAA8BH,KAA9B;AACD,KAFD;AAIA,SAAKR,YAAL,CAAkBK,WAAlB,CAA8BC,yBAAYM,oBAA1C,EAAiEJ,KAAD,IAAW;AACzE,WAAKK,+BAAL,CAAqCL,KAArC;AACD,KAFD;AAI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AAO,CAACC,GAAR,CAAY,6CAAZ,EAA2DC,IAAI,CAACC,SAAL,CAAeJ,WAAf,CAA3D;;AACA,UAAIA,WAAJ,EAAiB;AACfhC,gCAAeqC,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;AACVvC,gCAAewC,uBAAf,CAAuCD,MAAvC,EAA+CjB,UAA/C;AACD;AACF;AACF;;AArJiB;;gBAAd1B,a;;eAwJSA,a","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"]}
@@ -9,6 +9,12 @@ var _react = _interopRequireDefault(require("react"));
9
9
 
10
10
  var _reactNative = require("react-native");
11
11
 
12
+ var _FireworkSDK = _interopRequireDefault(require("../FireworkSDK"));
13
+
14
+ var _FWEventName = require("../models/FWEventName");
15
+
16
+ var _FireworkSDKModule = require("../modules/FireworkSDKModule");
17
+
12
18
  var _FWVideoFeed = _interopRequireDefault(require("./FWVideoFeed"));
13
19
 
14
20
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -25,6 +31,8 @@ class VideoFeed extends _react.default.Component {
25
31
 
26
32
  _defineProperty(this, "nativeComponentRef", /*#__PURE__*/_react.default.createRef());
27
33
 
34
+ _defineProperty(this, "subscriptions", []);
35
+
28
36
  _defineProperty(this, "refresh", () => {
29
37
  const nativeNodeHandle = (0, _reactNative.findNodeHandle)(this.nativeComponentRef.current);
30
38
 
@@ -50,8 +58,29 @@ class VideoFeed extends _react.default.Component {
50
58
  });
51
59
  }
52
60
 
61
+ componentDidMount() {
62
+ const subscriptionOfShareBaseURLUpdated = _FireworkSDKModule.FireworkSDKModuleEventEmitter.addListener(_FWEventName.FWEventName.ShareBaseURLUpdated, () => {
63
+ this.setState({});
64
+ });
65
+
66
+ this.subscriptions.push(subscriptionOfShareBaseURLUpdated);
67
+
68
+ const subscriptionOfAdBadgeConfigurationUpdated = _FireworkSDKModule.FireworkSDKModuleEventEmitter.addListener(_FWEventName.FWEventName.AdBadgeConfigurationUpdated, () => {
69
+ this.setState({});
70
+ });
71
+
72
+ this.subscriptions.push(subscriptionOfAdBadgeConfigurationUpdated);
73
+ }
74
+
75
+ componentWillUnmount() {
76
+ this.subscriptions.forEach(value => {
77
+ value.remove();
78
+ });
79
+ this.subscriptions = [];
80
+ }
81
+
53
82
  render() {
54
- var _videoFeedConfigurati, _videoFeedConfigurati2, _videoFeedConfigurati3;
83
+ var _videoFeedConfigurati, _videoFeedConfigurati2, _videoFeedConfigurati3, _FireworkSDK$getInsta, _FireworkSDK$getInsta2, _adBadgeConfiguration, _adBadgeConfiguration2, _adBadgeConfiguration3;
55
84
 
56
85
  const {
57
86
  source,
@@ -63,7 +92,22 @@ class VideoFeed extends _react.default.Component {
63
92
  } = this.props;
64
93
  const titleHidden = (_videoFeedConfigurati = videoFeedConfiguration === null || videoFeedConfiguration === void 0 ? void 0 : (_videoFeedConfigurati2 = videoFeedConfiguration.title) === null || _videoFeedConfigurati2 === void 0 ? void 0 : _videoFeedConfigurati2.hidden) !== null && _videoFeedConfigurati !== void 0 ? _videoFeedConfigurati : false;
65
94
  const titlePosition = (_videoFeedConfigurati3 = videoFeedConfiguration === null || videoFeedConfiguration === void 0 ? void 0 : videoFeedConfiguration.titlePosition) !== null && _videoFeedConfigurati3 !== void 0 ? _videoFeedConfigurati3 : 'nested';
66
- const key = `source:${source}_channel:${channel}_playlist:${playlist}_playlistGroup:${playlistGroup}_mode:${mode}_titleHidden:${titleHidden}_titlePosition:${titlePosition}`;
95
+ const shareBaseURL = (_FireworkSDK$getInsta = _FireworkSDK.default.getInstance().shareBaseURL) !== null && _FireworkSDK$getInsta !== void 0 ? _FireworkSDK$getInsta : '';
96
+ const adBadgeConfiguration = (_FireworkSDK$getInsta2 = _FireworkSDK.default.getInstance().adBadgeConfiguration) !== null && _FireworkSDK$getInsta2 !== void 0 ? _FireworkSDK$getInsta2 : {};
97
+ const adBadgeTextType = (_adBadgeConfiguration = adBadgeConfiguration.badgeTextType) !== null && _adBadgeConfiguration !== void 0 ? _adBadgeConfiguration : '';
98
+ const backgroundColorOfAdBadge = (_adBadgeConfiguration2 = adBadgeConfiguration.backgroundColor) !== null && _adBadgeConfiguration2 !== void 0 ? _adBadgeConfiguration2 : '';
99
+ const textColorOfAdBadge = (_adBadgeConfiguration3 = adBadgeConfiguration.textColor) !== null && _adBadgeConfiguration3 !== void 0 ? _adBadgeConfiguration3 : '';
100
+ let key = `source:${source}`;
101
+ key += `_channel:${channel}`;
102
+ key += `_playlist:${playlist}`;
103
+ key += `_playlistGroup:${playlistGroup}`;
104
+ key += `_mode:${mode}`;
105
+ key += `_titleHidden:${titleHidden}`;
106
+ key += `_titlePosition:${titlePosition}`;
107
+ key += `_shareBaseURL:${shareBaseURL}`;
108
+ key += `_adBadgeTextType:${adBadgeTextType}`;
109
+ key += `_backgroundColorOfAdBadge:${backgroundColorOfAdBadge}`;
110
+ key += `_textColorOfAdBadge:${textColorOfAdBadge}`;
67
111
  return /*#__PURE__*/_react.default.createElement(_FWVideoFeed.default, _extends({
68
112
  key: key
69
113
  }, this.props, {
@@ -1 +1 @@
1
- {"version":3,"sources":["VideoFeed.tsx"],"names":["NativeComponentName","VideoFeed","React","Component","createRef","nativeNodeHandle","nativeComponentRef","current","UIManager","dispatchViewManagerCommand","getViewManagerConfig","Commands","refresh","event","name","reason","nativeEvent","props","onVideoFeedLoadFinished","render","source","channel","playlist","playlistGroup","mode","videoFeedConfiguration","titleHidden","title","hidden","titlePosition","key","_onVideoFeedLoadFinished","Object","assign","style","zIndex"],"mappings":";;;;;;;AAAA;;AACA;;AAKA;;;;;;;;AAkDA,MAAMA,mBAAmB,GAAG,aAA5B;;AAEe,MAAMC,SAAN,SAAwBC,eAAMC,SAA9B,CAAyD;AAAA;AAAA;;AAAA,6DAKjDD,eAAME,SAAN,EALiD;;AAAA,qCASrD,MAAM;AACrB,YAAMC,gBAAgB,GAAG,iCAAe,KAAKC,kBAAL,CAAwBC,OAAvC,CAAzB;;AAEAC,6BAAUC,0BAAV,CACE,iCAAeJ,gBAAf,CADF,EAEEG,uBAAUE,oBAAV,CAA+BV,mBAA/B,EAAoDW,QAApD,CAA6DC,OAF/D,EAGE,EAHF;AAKD,KAjBqE;;AAAA,sDAoBpEC,KADiC,IAE9B;AACH,YAAM;AAAEC,QAAAA,IAAF;AAAQC,QAAAA;AAAR,UAAmBF,KAAK,CAACG,WAA/B;;AACA,UAAI,KAAKC,KAAL,CAAWC,uBAAf,EAAwC;AACtC,YAAIJ,IAAJ,EAAU;AACR,eAAKG,KAAL,CAAWC,uBAAX,CAAmC;AAAEJ,YAAAA,IAAF;AAAQC,YAAAA;AAAR,WAAnC;AACD,SAFD,MAEO;AACL,eAAKE,KAAL,CAAWC,uBAAX;AACD;AACF;AACF,KA9BqE;AAAA;;AAgCtEC,EAAAA,MAAM,GAAG;AAAA;;AACP,UAAM;AACJC,MAAAA,MADI;AAEJC,MAAAA,OAAO,GAAG,EAFN;AAGJC,MAAAA,QAAQ,GAAG,EAHP;AAIJC,MAAAA,aAAa,GAAG,EAJZ;AAKJC,MAAAA,IAAI,GAAG,KALH;AAMJC,MAAAA;AANI,QAOF,KAAKR,KAPT;AAQA,UAAMS,WAAW,4BAAGD,sBAAH,aAAGA,sBAAH,iDAAGA,sBAAsB,CAAEE,KAA3B,2DAAG,uBAA+BC,MAAlC,yEAA4C,KAA7D;AACA,UAAMC,aAAa,6BAAGJ,sBAAH,aAAGA,sBAAH,uBAAGA,sBAAsB,CAAEI,aAA3B,2EAA4C,QAA/D;AAEA,UAAMC,GAAG,GAAI,UAASV,MAAO,YAAWC,OAAQ,aAAYC,QAAS,kBAAiBC,aAAc,SAAQC,IAAK,gBAAeE,WAAY,kBAAiBG,aAAc,EAA3K;AAEA,wBACE,6BAAC,oBAAD;AACE,MAAA,GAAG,EAAEC;AADP,OAEM,KAAKb,KAFX;AAGE,MAAA,GAAG,EAAE,KAAKX,kBAHZ;AAIE,MAAA,uBAAuB,EAAE,KAAKyB,wBAJhC;AAKE,MAAA,IAAI,EAAEP,IALR;AAME,MAAA,KAAK,EAAEQ,MAAM,CAACC,MAAP,CAAc,EAAd,EAAkB,KAAKhB,KAAL,CAAWiB,KAA7B,EAAoC;AAACC,QAAAA,MAAM,EAAE,CAAC;AAAV,OAApC;AANT,OADF;AAUD;;AAxDqE;;;;gBAAnDlC,S,kBACG;AACpBuB,EAAAA,IAAI,EAAE;AADc,C","sourcesContent":["import React from 'react';\nimport { UIManager, findNodeHandle, StyleProp, ViewStyle } from 'react-native';\nimport type { NativeSyntheticEvent, TargetedEvent } from 'react-native';\nimport type VideoPlayerConfiguration from '../models/VideoPlayerConfiguration';\nimport type VideoFeedConfiguration from '../models/VideoFeedConfiguration';\nimport type FWError from '../models/FWError';\nimport FWVideoFeed from './FWVideoFeed';\n\nexport type VideoFeedSource = 'discover' | 'channel' | 'playlist' | 'playlistGroup';\nexport type VideoFeedMode = 'row' | 'column' | 'grid';\n\nexport interface IVideoFeedProps {\n /**\n * Standard React Native View Style.\n */\n style?: StyleProp<ViewStyle>;\n /**\n * One of three available video feed sources.\n */\n source: VideoFeedSource;\n /**\n * Channel name from which content should be displayed. Videos are ordered as a channel timeline. The prop is required when the source is set as channel or playlist.\n */\n channel?: string;\n /**\n * Playlist Id for selected content. Please note channel name is necessary. Required when the source is set as playlist.\n */\n playlist?: string;\n\n /**\n * PlaylistGroup Id for selected content. Required when the source is set as playlistGroup.\n */\n playlistGroup?: string;\n /**\n * One of three available display modes. Defaults to row.\n */\n mode?: VideoFeedMode;\n /**\n * Configuration of Video Feed.\n */\n videoFeedConfiguration?: VideoFeedConfiguration;\n /**\n * Configuration of Video Player.\n */\n videoPlayerConfiguration?: VideoPlayerConfiguration;\n /**\n * Video feed loading result callback. It means loading successfully when error equals to undefined.\n */\n onVideoFeedLoadFinished?: (error?: FWError) => void;\n}\n\ninterface VideoFeedLoadFinishedEvent extends TargetedEvent {\n name: string;\n reason?: string | null;\n}\n\nconst NativeComponentName = 'FWVideoFeed';\n\nexport default class VideoFeed extends React.Component<IVideoFeedProps> {\n static defaultProps = {\n mode: 'row',\n };\n\n nativeComponentRef = React.createRef<any>();\n /**\n * Force refreshing the video feed.\n */\n public refresh = () => {\n const nativeNodeHandle = findNodeHandle(this.nativeComponentRef.current);\n\n UIManager.dispatchViewManagerCommand(\n findNodeHandle(nativeNodeHandle),\n UIManager.getViewManagerConfig(NativeComponentName).Commands.refresh,\n []\n );\n };\n\n private _onVideoFeedLoadFinished = (\n event: NativeSyntheticEvent<VideoFeedLoadFinishedEvent>\n ) => {\n const { name, reason } = event.nativeEvent;\n if (this.props.onVideoFeedLoadFinished) {\n if (name) {\n this.props.onVideoFeedLoadFinished({ name, reason });\n } else {\n this.props.onVideoFeedLoadFinished();\n }\n }\n };\n\n render() {\n const {\n source,\n channel = '',\n playlist = '',\n playlistGroup = '',\n mode = 'row',\n videoFeedConfiguration,\n } = this.props;\n const titleHidden = videoFeedConfiguration?.title?.hidden ?? false;\n const titlePosition = videoFeedConfiguration?.titlePosition ?? 'nested';\n\n const key = `source:${source}_channel:${channel}_playlist:${playlist}_playlistGroup:${playlistGroup}_mode:${mode}_titleHidden:${titleHidden}_titlePosition:${titlePosition}`;\n\n return (\n <FWVideoFeed\n key={key}\n {...this.props}\n ref={this.nativeComponentRef}\n onVideoFeedLoadFinished={this._onVideoFeedLoadFinished}\n mode={mode}\n style={Object.assign({}, this.props.style, {zIndex: -1})}\n />\n );\n }\n}\n"]}
1
+ {"version":3,"sources":["VideoFeed.tsx"],"names":["NativeComponentName","VideoFeed","React","Component","createRef","nativeNodeHandle","nativeComponentRef","current","UIManager","dispatchViewManagerCommand","getViewManagerConfig","Commands","refresh","event","name","reason","nativeEvent","props","onVideoFeedLoadFinished","componentDidMount","subscriptionOfShareBaseURLUpdated","FireworkSDKModuleEventEmitter","addListener","FWEventName","ShareBaseURLUpdated","setState","subscriptions","push","subscriptionOfAdBadgeConfigurationUpdated","AdBadgeConfigurationUpdated","componentWillUnmount","forEach","value","remove","render","source","channel","playlist","playlistGroup","mode","videoFeedConfiguration","titleHidden","title","hidden","titlePosition","shareBaseURL","FireworkSDK","getInstance","adBadgeConfiguration","adBadgeTextType","badgeTextType","backgroundColorOfAdBadge","backgroundColor","textColorOfAdBadge","textColor","key","_onVideoFeedLoadFinished","Object","assign","style","zIndex"],"mappings":";;;;;;;AAAA;;AAGA;;AAQA;;AAEA;;AAIA;;AACA;;;;;;;;AAiDA,MAAMA,mBAAmB,GAAG,aAA5B;;AAEe,MAAMC,SAAN,SAAwBC,eAAMC,SAA9B,CAAyD;AAAA;AAAA;;AAAA,6DAKjDD,eAAME,SAAN,EALiD;;AAAA,2CAO/B,EAP+B;;AAAA,qCAYrD,MAAM;AACrB,YAAMC,gBAAgB,GAAG,iCAAe,KAAKC,kBAAL,CAAwBC,OAAvC,CAAzB;;AAEAC,6BAAUC,0BAAV,CACE,iCAAeJ,gBAAf,CADF,EAEEG,uBAAUE,oBAAV,CAA+BV,mBAA/B,EAAoDW,QAApD,CAA6DC,OAF/D,EAGE,EAHF;AAKD,KApBqE;;AAAA,sDAuBpEC,KADiC,IAE9B;AACH,YAAM;AAAEC,QAAAA,IAAF;AAAQC,QAAAA;AAAR,UAAmBF,KAAK,C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AAAA,MAAM,EAAE,CAAC;AAAX,OAApC;AANT,OADF;AAUD;;AArGqE;;;;gBAAnD3D,S,kBACG;AACpBsC,EAAAA,IAAI,EAAE;AADc,C","sourcesContent":["import React from 'react';\n\nimport type { NativeSyntheticEvent, TargetedEvent } from 'react-native';\nimport {\n EmitterSubscription,\n findNodeHandle,\n StyleProp,\n UIManager,\n ViewStyle,\n} from 'react-native';\n\nimport FireworkSDK from '../FireworkSDK';\nimport type FWError from '../models/FWError';\nimport { FWEventName } from '../models/FWEventName';\nimport type VideoFeedConfiguration from '../models/VideoFeedConfiguration';\nimport type VideoFeedSource from '../models/VideoFeedSource';\nimport type VideoPlayerConfiguration from '../models/VideoPlayerConfiguration';\nimport { FireworkSDKModuleEventEmitter } from '../modules/FireworkSDKModule';\nimport FWVideoFeed from './FWVideoFeed';\n\nexport type VideoFeedMode = 'row' | 'column' | 'grid';\n\nexport interface IVideoFeedProps {\n /**\n * Standard React Native View Style.\n */\n style?: StyleProp<ViewStyle>;\n /**\n * One of three available video feed sources.\n */\n source: VideoFeedSource;\n /**\n * Channel name from which content should be displayed. Videos are ordered as a channel timeline. The prop is required when the source is set as channel or playlist.\n */\n channel?: string;\n /**\n * Playlist Id for selected content. Please note channel name is necessary. Required when the source is set as playlist.\n */\n playlist?: string;\n\n /**\n * PlaylistGroup Id for selected content. Required when the source is set as playlistGroup.\n */\n playlistGroup?: string;\n /**\n * One of three available display modes. Defaults to row.\n */\n mode?: VideoFeedMode;\n /**\n * Configuration of Video Feed.\n */\n videoFeedConfiguration?: VideoFeedConfiguration;\n /**\n * Configuration of Video Player.\n */\n videoPlayerConfiguration?: VideoPlayerConfiguration;\n /**\n * Video feed loading result callback. It means loading successfully when error equals to undefined.\n */\n onVideoFeedLoadFinished?: (error?: FWError) => void;\n}\n\ninterface VideoFeedLoadFinishedEvent extends TargetedEvent {\n name: string;\n reason?: string | null;\n}\n\nconst NativeComponentName = 'FWVideoFeed';\n\nexport default class VideoFeed extends React.Component<IVideoFeedProps> {\n static defaultProps = {\n mode: 'row',\n };\n\n nativeComponentRef = React.createRef<any>();\n\n subscriptions: EmitterSubscription[] = [];\n\n /**\n * Force refreshing the video feed.\n */\n public refresh = () => {\n const nativeNodeHandle = findNodeHandle(this.nativeComponentRef.current);\n\n UIManager.dispatchViewManagerCommand(\n findNodeHandle(nativeNodeHandle),\n UIManager.getViewManagerConfig(NativeComponentName).Commands.refresh,\n []\n );\n };\n\n private _onVideoFeedLoadFinished = (\n event: NativeSyntheticEvent<VideoFeedLoadFinishedEvent>\n ) => {\n const { name, reason } = event.nativeEvent;\n if (this.props.onVideoFeedLoadFinished) {\n if (name) {\n this.props.onVideoFeedLoadFinished({ name, reason });\n } else {\n this.props.onVideoFeedLoadFinished();\n }\n }\n }; \n\n componentDidMount() {\n const subscriptionOfShareBaseURLUpdated = FireworkSDKModuleEventEmitter.addListener(\n FWEventName.ShareBaseURLUpdated,\n () => {\n this.setState({});\n }\n );\n this.subscriptions.push(subscriptionOfShareBaseURLUpdated);\n\n const subscriptionOfAdBadgeConfigurationUpdated = FireworkSDKModuleEventEmitter.addListener(\n FWEventName.AdBadgeConfigurationUpdated,\n () => {\n this.setState({});\n }\n );\n this.subscriptions.push(subscriptionOfAdBadgeConfigurationUpdated);\n }\n\n componentWillUnmount() {\n this.subscriptions.forEach((value) => {\n value.remove();\n });\n\n this.subscriptions = [];\n }\n\n render() {\n const {\n source,\n channel = '',\n playlist = '',\n playlistGroup = '',\n mode = 'row',\n videoFeedConfiguration,\n } = this.props;\n const titleHidden = videoFeedConfiguration?.title?.hidden ?? false;\n const titlePosition = videoFeedConfiguration?.titlePosition ?? 'nested';\n const shareBaseURL = FireworkSDK.getInstance().shareBaseURL ?? '';\n const adBadgeConfiguration =\n FireworkSDK.getInstance().adBadgeConfiguration ?? {};\n const adBadgeTextType = adBadgeConfiguration.badgeTextType ?? '';\n const backgroundColorOfAdBadge = adBadgeConfiguration.backgroundColor ?? '';\n const textColorOfAdBadge = adBadgeConfiguration.textColor ?? '';\n\n let key = `source:${source}`;\n key += `_channel:${channel}`;\n key += `_playlist:${playlist}`;\n key += `_playlistGroup:${playlistGroup}`;\n key += `_mode:${mode}`;\n key += `_titleHidden:${titleHidden}`;\n key += `_titlePosition:${titlePosition}`;\n key += `_shareBaseURL:${shareBaseURL}`;\n key += `_adBadgeTextType:${adBadgeTextType}`;\n key += `_backgroundColorOfAdBadge:${backgroundColorOfAdBadge}`;\n key += `_textColorOfAdBadge:${textColorOfAdBadge}`;\n\n return (\n <FWVideoFeed\n key={key}\n {...this.props}\n ref={this.nativeComponentRef}\n onVideoFeedLoadFinished={this._onVideoFeedLoadFinished}\n mode={mode}\n style={Object.assign({}, this.props.style, { zIndex: -1 })}\n />\n );\n }\n}\n"]}
@@ -3,6 +3,24 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ Object.defineProperty(exports, "LiveStream", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _LiveStream.default;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "LiveStreamChatEventName", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _LiveStreamChatEventName.default;
16
+ }
17
+ });
18
+ Object.defineProperty(exports, "LiveStreamEventName", {
19
+ enumerable: true,
20
+ get: function () {
21
+ return _LiveStreamEventName.default;
22
+ }
23
+ });
6
24
  Object.defineProperty(exports, "VideoFeed", {
7
25
  enumerable: true,
8
26
  get: function () {
@@ -31,6 +49,12 @@ var _VideoFeed = _interopRequireDefault(require("./components/VideoFeed"));
31
49
 
32
50
  var _FireworkSDK = _interopRequireDefault(require("./FireworkSDK"));
33
51
 
52
+ var _LiveStream = _interopRequireDefault(require("./LiveStream"));
53
+
54
+ var _LiveStreamEventName = _interopRequireDefault(require("./models/LiveStreamEventName"));
55
+
56
+ var _LiveStreamChatEventName = _interopRequireDefault(require("./models/LiveStreamChatEventName"));
57
+
34
58
  var _VideoPlaybackEventName = _interopRequireDefault(require("./models/VideoPlaybackEventName"));
35
59
 
36
60
  var _VideoShopping = _interopRequireDefault(require("./VideoShopping"));
@@ -1 +1 @@
1
- {"version":3,"sources":["index.tsx"],"names":["AppRegistry","registerComponent","CartContainer","FireworkSDK"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AAEA;;AAMA;;AAOA;;AA6BA;;AAaA;;;;AAEAA,yBAAYC,iBAAZ,CAA8B,oBAA9B,EAAoD,MAAMC,sBAA1D;;eAEeC,oB","sourcesContent":["import { AppRegistry } from 'react-native';\n\nimport CartContainer from './components/CartContainer';\nimport type {\n IVideoFeedProps,\n VideoFeedMode,\n VideoFeedSource,\n} from './components/VideoFeed';\nimport VideoFeed from './components/VideoFeed';\nimport type {\n CustomCTAClickCallback,\n SDKInitCallback,\n VideoFeedClickCallback,\n VideoPlaybackCallback,\n} from './FireworkSDK';\nimport FireworkSDK from './FireworkSDK';\nimport type 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 SDKInitEvent,\n UpdateProductDetailsEvent,\n VideoPlaybackEvent,\n WillDisplayProductEvent,\n} from './models/FWEvents';\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 VideoPlaybackDetails from './models/VideoPlaybackDetails';\nimport type {\n VideoBadge,\n VideoPlayerSize,\n} from './models/VideoPlaybackDetails';\nimport VideoPlaybackEventName from './models/VideoPlaybackEventName';\nimport type VideoPlayerConfiguration from './models/VideoPlayerConfiguration';\nimport type {\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);\n\nexport default FireworkSDK;\n\nexport {\n ADConfig,\n AddToCartButtonConfiguration,\n AddToCartCallback,\n AddToCartEvent,\n AddToCartResult,\n ClickCartIconCallback,\n CustomCTAClickCallback,\n CustomCTAClickEvent,\n FeedItemDetails,\n FWError,\n IVideoFeedProps,\n Product,\n ProductInfoViewConfiguration,\n ProductPrice,\n ProductUnit,\n SDKInitCallback,\n SDKInitEvent,\n UpdateProductDetailsCallback,\n UpdateProductDetailsEvent,\n VideoBadge,\n VideoFeed,\n VideoFeedClickCallback,\n VideoFeedConfiguration,\n VideoFeedMode,\n VideoFeedPlayIconConfiguration,\n VideoFeedSource,\n VideoFeedTitleConfiguration,\n VideoFeedTitlePosition,\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":["AppRegistry","registerComponent","CartContainer","FireworkSDK"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AAEA;;AAEA;;AAOA;;AAKA;;AAkBA;;AAEA;;AAeA;;AAcA;;;;AAEAA,yBAAYC,iBAAZ,CAA8B,oBAA9B,EAAoD,MAAMC,sBAA1D;;eAEeC,oB","sourcesContent":["import { AppRegistry } from 'react-native';\n\nimport CartContainer from './components/CartContainer';\nimport type { IVideoFeedProps, VideoFeedMode } from './components/VideoFeed';\nimport VideoFeed from './components/VideoFeed';\nimport type {\n CustomCTAClickCallback,\n SDKInitCallback,\n VideoFeedClickCallback,\n VideoPlaybackCallback,\n} from './FireworkSDK';\nimport FireworkSDK from './FireworkSDK';\nimport type {\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 type LiveStreamEventDetails from './models/LiveStreamEventDetails';\nimport LiveStreamEventName from './models/LiveStreamEventName';\nimport type LiveStreamMessageDetails from './models/LiveStreamMessageDetails';\nimport LiveStreamChatEventName from './models/LiveStreamChatEventName';\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);\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 IVideoFeedProps,\n LiveStream,\n LiveStreamChatEvent,\n LiveStreamEvent,\n LiveStreamEventDetails,\n LiveStreamEventName,\n LiveStreamMessageDetails,\n LiveStreamChatEventName,\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"]}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ //# sourceMappingURL=AdBadgeConfiguration.js.map