react-native-firework-sdk 1.1.1 → 1.2.0-beta.6
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.
- package/android/build.gradle +1 -1
- package/android/gradlew +0 -0
- package/android/src/main/AndroidManifest.xml +9 -0
- package/android/src/main/java/com/fireworksdk/bridge/FireworkSDKPackage.kt +3 -1
- package/android/src/main/java/com/fireworksdk/bridge/components/videofeed/FWVideoFeed.kt +17 -4
- package/android/src/main/java/com/fireworksdk/bridge/models/FWEventName.kt +1 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoFeedPropsModel.kt +1 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoFeedSource.kt +1 -0
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/FWInitializationProvider.kt +99 -0
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/manager/FWVideoFeedManager.kt +6 -0
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/models/FWNavigatorInterface.kt +9 -0
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/models/FireworkSDKInterface.kt +1 -1
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FWNavigatorModule.kt +74 -0
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FWVideoShoppingModule.kt +6 -2
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FireworkSDKModule.kt +7 -6
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/pages/FWContainerActivity.kt +54 -0
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/utils/FWEventUtils.kt +9 -0
- package/android/src/main/java/com/fireworksdk/bridge/utils/FWDateUtils.kt +15 -0
- package/android/src/main/res/layout/fw_bridge_fragment_container.xml +8 -0
- package/ios/Components/VideoFeed.swift +6 -25
- package/ios/Components/VideoFeedManager.m +1 -0
- package/ios/FireworkSdk.xcodeproj/project.pbxproj +206 -18
- package/ios/Models/NativeToRN/FireworkEventName.swift +1 -0
- package/ios/Models/RNToNative/RCTConvert+FireworkSDKModule.swift +0 -20
- package/ios/Models/RNToNative/RCTConvert+VideoFeed.swift +2 -1
- package/ios/Modules/FWNavigatorModule/FWNavigatorContainerViewController.swift +40 -0
- package/ios/Modules/FWNavigatorModule/FWNavigatorModule.m +17 -0
- package/ios/Modules/FWNavigatorModule/FWNavigatorModule.swift +67 -0
- package/ios/Modules/FWNavigatorModule/FWNavigatorProtocol.swift +13 -0
- package/ios/Modules/FireworkSDKModule/FWCustomCTALinkContentContainerViewController.swift +31 -0
- package/ios/Modules/FireworkSDKModule/FireworkSDKModule+CTA.swift +14 -1
- package/ios/Modules/FireworkSDKModule/FireworkSDKModule.m +2 -1
- package/ios/Modules/FireworkSDKModule/FireworkSDKModule.swift +43 -31
- package/lib/commonjs/FWNavigator.js +72 -0
- package/lib/commonjs/FWNavigator.js.map +1 -0
- package/lib/commonjs/FireworkSDK.js +45 -3
- package/lib/commonjs/FireworkSDK.js.map +1 -1
- package/lib/commonjs/VideoShopping.js +0 -1
- package/lib/commonjs/VideoShopping.js.map +1 -1
- package/lib/commonjs/components/CustomCTALinkContentContainer.js +39 -0
- package/lib/commonjs/components/CustomCTALinkContentContainer.js.map +1 -0
- package/lib/commonjs/components/NavigationContainer.js +40 -0
- package/lib/commonjs/components/NavigationContainer.js.map +1 -0
- package/lib/commonjs/components/VideoFeed.js +30 -0
- package/lib/commonjs/components/VideoFeed.js.map +1 -1
- package/lib/commonjs/index.js +18 -2
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/models/FWEventName.js +1 -0
- package/lib/commonjs/models/FWEventName.js.map +1 -1
- package/lib/commonjs/modules/FWNavigatorModule.js +22 -0
- package/lib/commonjs/modules/FWNavigatorModule.js.map +1 -0
- package/lib/commonjs/modules/FireworkSDKModule.js.map +1 -1
- package/lib/commonjs/utils/FWLoggerUtil.js +41 -0
- package/lib/commonjs/utils/FWLoggerUtil.js.map +1 -0
- package/lib/module/FWNavigator.js +55 -0
- package/lib/module/FWNavigator.js.map +1 -0
- package/lib/module/FireworkSDK.js +40 -3
- package/lib/module/FireworkSDK.js.map +1 -1
- package/lib/module/VideoShopping.js +0 -1
- package/lib/module/VideoShopping.js.map +1 -1
- package/lib/module/components/CustomCTALinkContentContainer.js +24 -0
- package/lib/module/components/CustomCTALinkContentContainer.js.map +1 -0
- package/lib/module/components/NavigationContainer.js +23 -0
- package/lib/module/components/NavigationContainer.js.map +1 -0
- package/lib/module/components/VideoFeed.js +30 -0
- package/lib/module/components/VideoFeed.js.map +1 -1
- package/lib/module/index.js +7 -2
- package/lib/module/index.js.map +1 -1
- package/lib/module/models/FWEventName.js +1 -0
- package/lib/module/models/FWEventName.js.map +1 -1
- package/lib/module/modules/FWNavigatorModule.js +13 -0
- package/lib/module/modules/FWNavigatorModule.js.map +1 -0
- package/lib/module/modules/FireworkSDKModule.js.map +1 -1
- package/lib/module/utils/FWLoggerUtil.js +32 -0
- package/lib/module/utils/FWLoggerUtil.js.map +1 -0
- package/lib/typescript/FWNavigator.d.ts +23 -0
- package/lib/typescript/FireworkSDK.d.ts +15 -3
- package/lib/typescript/components/CustomCTALinkContentContainer.d.ts +6 -0
- package/lib/typescript/components/NavigationContainer.d.ts +6 -0
- package/lib/typescript/components/VideoFeed.d.ts +7 -0
- package/lib/typescript/index.d.ts +4 -4
- package/lib/typescript/models/FWEventName.d.ts +2 -1
- package/lib/typescript/models/VideoFeedSource.d.ts +1 -1
- package/lib/typescript/modules/FWNavigatorModule.d.ts +9 -0
- package/lib/typescript/modules/FireworkSDKModule.d.ts +4 -4
- package/lib/typescript/utils/FWLoggerUtil.d.ts +5 -0
- package/package.json +1 -1
- package/react-native-firework-sdk.podspec +1 -1
- package/src/FWNavigator.tsx +47 -0
- package/src/FireworkSDK.ts +50 -5
- package/src/VideoShopping.ts +0 -1
- package/src/components/CustomCTALinkContentContainer.tsx +26 -0
- package/src/components/NavigationContainer.tsx +24 -0
- package/src/components/VideoFeed.tsx +45 -13
- package/src/index.tsx +16 -4
- package/src/models/FWEventName.ts +1 -0
- package/src/models/VideoFeedSource.ts +1 -1
- package/src/modules/FWNavigatorModule.ts +22 -0
- package/src/modules/FireworkSDKModule.ts +4 -6
- package/src/utils/FWLoggerUtil.ts +39 -0
- package/ios/Modules/FireworkSDKModule/MobileADConfiguration.swift +0 -17
- package/lib/commonjs/models/AdConfig.js +0 -2
- package/lib/commonjs/models/AdConfig.js.map +0 -1
- package/lib/module/models/AdConfig.js +0 -2
- package/lib/module/models/AdConfig.js.map +0 -1
- package/lib/typescript/models/AdConfig.d.ts +0 -10
- package/src/models/AdConfig.ts +0 -10
|
@@ -0,0 +1,72 @@
|
|
|
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 _FWNavigatorModule = _interopRequireWildcard(require("./modules/FWNavigatorModule"));
|
|
11
|
+
|
|
12
|
+
var _FWLoggerUtil = _interopRequireDefault(require("./utils/FWLoggerUtil"));
|
|
13
|
+
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
+
|
|
16
|
+
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); }
|
|
17
|
+
|
|
18
|
+
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; }
|
|
19
|
+
|
|
20
|
+
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; }
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* You can use this class for pushing RN page from the native page.
|
|
24
|
+
*/
|
|
25
|
+
class FWNavigator {
|
|
26
|
+
static getInstance() {
|
|
27
|
+
if (!FWNavigator._instance) {
|
|
28
|
+
FWNavigator._instance = new FWNavigator();
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return FWNavigator._instance;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
constructor() {
|
|
35
|
+
_defineProperty(this, "_currentCallbackId", 0);
|
|
36
|
+
|
|
37
|
+
_defineProperty(this, "navigatorPages", new Map());
|
|
38
|
+
|
|
39
|
+
_FWNavigatorModule.FWNavigatorModuleEventEmitter.addListener(_FWEventName.FWEventName.LogMessage, () => {});
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Push RN page from native page. The RN page is embedded in a native container.
|
|
43
|
+
* @param {React.ReactNode} page The RN page.
|
|
44
|
+
* @returns {Promise<boolean>} The result of pushing RN page from native page
|
|
45
|
+
*/
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
pushNativeContainer(page) {
|
|
49
|
+
_FWLoggerUtil.default.log(`Enter pushNativeContainer`);
|
|
50
|
+
|
|
51
|
+
this._currentCallbackId = this._currentCallbackId + 1;
|
|
52
|
+
const callbackId = `${this._currentCallbackId}`;
|
|
53
|
+
this.navigatorPages.set(callbackId, page);
|
|
54
|
+
return _FWNavigatorModule.default.pushNativeContainer(callbackId);
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Pop top-most native container. The native container embed the RN page.
|
|
58
|
+
* @returns {Promise<boolean>} The result of poping top-most native container.
|
|
59
|
+
*/
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
popNativeContainer() {
|
|
63
|
+
return _FWNavigatorModule.default.popNativeContainer();
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
_defineProperty(FWNavigator, "_instance", void 0);
|
|
69
|
+
|
|
70
|
+
var _default = FWNavigator;
|
|
71
|
+
exports.default = _default;
|
|
72
|
+
//# sourceMappingURL=FWNavigator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["FWNavigator.tsx"],"names":["FWNavigator","getInstance","_instance","constructor","Map","FWNavigatorModuleEventEmitter","addListener","FWEventName","LogMessage","pushNativeContainer","page","FWLoggerUtil","log","_currentCallbackId","callbackId","navigatorPages","set","FWNavigatorModule","popNativeContainer"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;;;;;;;;;AAEA;AACA;AACA;AACA,MAAMA,WAAN,CAAkB;AAKS,SAAXC,WAAW,GAAgB;AACvC,QAAI,CAACD,WAAW,CAACE,SAAjB,EAA4B;AAC1BF,MAAAA,WAAW,CAACE,SAAZ,GAAwB,IAAIF,WAAJ,EAAxB;AACD;;AACD,WAAOA,WAAW,CAACE,SAAnB;AACD;;AAEOC,EAAAA,WAAW,GAAG;AAAA,gDAVe,CAUf;;AAAA,4CATE,IAAIC,GAAJ,EASF;;AACpBC,qDAA8BC,WAA9B,CAA0CC,yBAAYC,UAAtD,EAAkE,MAAM,CACvE,CADD;AAED;AAED;AACF;AACA;AACA;AACA;;;AACSC,EAAAA,mBAAmB,CAACC,IAAD,EAA0C;AAClEC,0BAAaC,GAAb,CAAkB,2BAAlB;;AACA,SAAKC,kBAAL,GAA0B,KAAKA,kBAAL,GAA0B,CAApD;AACA,UAAMC,UAAU,GAAI,GAAE,KAAKD,kBAAmB,EAA9C;AACA,SAAKE,cAAL,CAAoBC,GAApB,CAAwBF,UAAxB,EAAoCJ,IAApC;AACA,WAAOO,2BAAkBR,mBAAlB,CAAsCK,UAAtC,CAAP;AACD;AAED;AACF;AACA;AACA;;;AACSI,EAAAA,kBAAkB,GAAqB;AAC5C,WAAOD,2BAAkBC,kBAAlB,EAAP;AACD;;AApCe;;gBAAZlB,W;;eAuCSA,W","sourcesContent":["import { FWEventName } from './models/FWEventName';\nimport FWNavigatorModule, { FWNavigatorModuleEventEmitter } from './modules/FWNavigatorModule';\nimport FWLoggerUtil from './utils/FWLoggerUtil';\n\n/**\n * You can use this class for pushing RN page from the native page.\n */\nclass FWNavigator {\n private static _instance?: FWNavigator;\n private _currentCallbackId: number = 0;\n public navigatorPages = new Map<string, React.ReactNode>();\n\n public static getInstance(): FWNavigator {\n if (!FWNavigator._instance) {\n FWNavigator._instance = new FWNavigator();\n }\n return FWNavigator._instance!;\n }\n\n private constructor() {\n FWNavigatorModuleEventEmitter.addListener(FWEventName.LogMessage, () => {\n });\n }\n\n /**\n * Push RN page from native page. The RN page is embedded in a native container.\n * @param {React.ReactNode} page The RN page.\n * @returns {Promise<boolean>} The result of pushing RN page from native page\n */\n public pushNativeContainer(page: React.ReactNode): Promise<boolean> {\n FWLoggerUtil.log(`Enter pushNativeContainer`)\n this._currentCallbackId = this._currentCallbackId + 1;\n const callbackId = `${this._currentCallbackId}`;\n this.navigatorPages.set(callbackId, page);\n return FWNavigatorModule.pushNativeContainer(callbackId);\n }\n \n /**\n * Pop top-most native container. The native container embed the RN page.\n * @returns {Promise<boolean>} The result of poping top-most native container.\n */\n public popNativeContainer(): Promise<boolean> {\n return FWNavigatorModule.popNativeContainer();\n }\n}\n\nexport default FWNavigator;\n"]}
|
|
@@ -17,6 +17,10 @@ var _ShoppingModule = _interopRequireDefault(require("./modules/ShoppingModule")
|
|
|
17
17
|
|
|
18
18
|
var _VideoShopping = _interopRequireDefault(require("./VideoShopping"));
|
|
19
19
|
|
|
20
|
+
var _FWNavigator = _interopRequireDefault(require("./FWNavigator"));
|
|
21
|
+
|
|
22
|
+
var _FWLoggerUtil = _interopRequireDefault(require("./utils/FWLoggerUtil"));
|
|
23
|
+
|
|
20
24
|
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
25
|
|
|
22
26
|
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; }
|
|
@@ -45,11 +49,29 @@ class FireworkSDK {
|
|
|
45
49
|
}
|
|
46
50
|
|
|
47
51
|
set onCustomCTAClick(value) {
|
|
52
|
+
_FWLoggerUtil.default.log(`Set onCustomCTAClick callback ${!!value}`);
|
|
53
|
+
|
|
48
54
|
this._onCustomCTAClick = value;
|
|
49
55
|
|
|
50
56
|
_FireworkSDKModule.default.setCustomCTAClickEnabled(value ? true : false);
|
|
51
57
|
}
|
|
52
58
|
|
|
59
|
+
/**
|
|
60
|
+
* The custom render method of CTA link content.
|
|
61
|
+
* We will show a native container to display the element returned by the render method.
|
|
62
|
+
*/
|
|
63
|
+
get customCTALinkContentRender() {
|
|
64
|
+
return this._customCTALinkContentRender;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
set customCTALinkContentRender(value) {
|
|
68
|
+
_FWLoggerUtil.default.log(`Set customCTALinkContentRender ${!!value}`);
|
|
69
|
+
|
|
70
|
+
this._customCTALinkContentRender = value;
|
|
71
|
+
|
|
72
|
+
_FireworkSDKModule.default.setCustomCTALinkContentRenderEnabled(value ? true : false);
|
|
73
|
+
}
|
|
74
|
+
|
|
53
75
|
/**
|
|
54
76
|
* The callback of video playback.
|
|
55
77
|
*/
|
|
@@ -112,6 +134,14 @@ class FireworkSDK {
|
|
|
112
134
|
get liveStream() {
|
|
113
135
|
return _LiveStream.default.getInstance();
|
|
114
136
|
}
|
|
137
|
+
/**
|
|
138
|
+
* Get FWNavigator object.
|
|
139
|
+
*/
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
get navigator() {
|
|
143
|
+
return _FWNavigator.default.getInstance();
|
|
144
|
+
}
|
|
115
145
|
/**
|
|
116
146
|
* Get global single instance of FireworkSDK class.
|
|
117
147
|
* @returns FireworkSDK
|
|
@@ -133,6 +163,8 @@ class FireworkSDK {
|
|
|
133
163
|
|
|
134
164
|
_defineProperty(this, "_onCustomCTAClick", void 0);
|
|
135
165
|
|
|
166
|
+
_defineProperty(this, "_customCTALinkContentRender", void 0);
|
|
167
|
+
|
|
136
168
|
_defineProperty(this, "_onVideoPlayback", void 0);
|
|
137
169
|
|
|
138
170
|
_defineProperty(this, "_shareBaseURL", void 0);
|
|
@@ -140,21 +172,32 @@ class FireworkSDK {
|
|
|
140
172
|
_defineProperty(this, "_adBadgeConfiguration", void 0);
|
|
141
173
|
|
|
142
174
|
this.eventEmitter.addListener(_FWEventName.FWEventName.SDKInit, event => {
|
|
175
|
+
_FWLoggerUtil.default.log(`Receive SDKInit event ${event === null || event === void 0 ? void 0 : event.error}`);
|
|
176
|
+
|
|
143
177
|
if (this.onSDKInit) {
|
|
144
178
|
this.onSDKInit(event !== null && event !== void 0 ? event : {});
|
|
145
179
|
}
|
|
146
180
|
});
|
|
181
|
+
this.eventEmitter.addListener(_FWEventName.FWEventName.LogMessage, event => {
|
|
182
|
+
_FWLoggerUtil.default.logNativeMessage(event.message);
|
|
183
|
+
});
|
|
147
184
|
this.eventEmitter.addListener(_FWEventName.FWEventName.CustomCTAClick, event => {
|
|
185
|
+
_FWLoggerUtil.default.log(`Receive CustomCTAClick url ${event === null || event === void 0 ? void 0 : event.url}`);
|
|
186
|
+
|
|
148
187
|
if (this.onCustomCTAClick) {
|
|
149
188
|
this.onCustomCTAClick(event !== null && event !== void 0 ? event : {});
|
|
150
189
|
}
|
|
151
190
|
});
|
|
152
191
|
this.eventEmitter.addListener(_FWEventName.FWEventName.VideoPlayback, event => {
|
|
192
|
+
_FWLoggerUtil.default.log(`Receive VideoPlayback event ${event === null || event === void 0 ? void 0 : event.eventName}`);
|
|
193
|
+
|
|
153
194
|
if (this.onVideoPlayback) {
|
|
154
195
|
this.onVideoPlayback(event !== null && event !== void 0 ? event : {});
|
|
155
196
|
}
|
|
156
197
|
});
|
|
157
198
|
this.eventEmitter.addListener(_FWEventName.FWEventName.VideoFeedClick, event => {
|
|
199
|
+
_FWLoggerUtil.default.log(`Receive VideoFeedClick event ${event === null || event === void 0 ? void 0 : event.info.id}`);
|
|
200
|
+
|
|
158
201
|
if (this.onVideoFeedClick) {
|
|
159
202
|
this.onVideoFeedClick(event !== null && event !== void 0 ? event : {});
|
|
160
203
|
}
|
|
@@ -163,12 +206,11 @@ class FireworkSDK {
|
|
|
163
206
|
/**
|
|
164
207
|
* Initializes Firework SDK.
|
|
165
208
|
* @param {string?} userId An id to uniquely identify device or user.
|
|
166
|
-
* @param {AdConfig?} adConfig Configuration of Ad.
|
|
167
209
|
*/
|
|
168
210
|
|
|
169
211
|
|
|
170
|
-
init(userId
|
|
171
|
-
_FireworkSDKModule.default.init(userId
|
|
212
|
+
init(userId) {
|
|
213
|
+
_FireworkSDKModule.default.init(userId);
|
|
172
214
|
|
|
173
215
|
_ShoppingModule.default.init();
|
|
174
216
|
|
|
@@ -1 +1 @@
|
|
|
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;;AAGE;AACF;AACA;;AAGE;AACF;AACA;AAC6B,MAAhBC,gBAAgB,GAAuC;AAChE,WAAO,KAAKC,iBAAZ;AACD;;AAC0B,MAAhBD,gBAAgB,CAACE,KAAD,EAA4C;AACrE,SAAKD,iBAAL,GAAyBC,KAAzB;;AACAC,+BAAkBC,wBAAlB,CAA2CF,KAAK,GAAG,IAAH,GAAU,KAA1D;AACD;;AAGD;AACF;AACA;AAC4B,MAAfG,eAAe,GAAsC;AAC9D,WAAO,KAAKC,gBAAZ;AACD;;AACyB,MAAfD,eAAe,CAACH,KAAD,EAA2C;AACnE,SAAKI,gBAAL,GAAwBJ,KAAxB;;AACAC,+BAAkBI,4BAAlB,CAA+CL,KAAK,GAAG,IAAH,GAAU,KAA9D;AACD;;AAGD;AACF;AACA;AACyB,MAAZM,YAAY,GAAuB;AAC5C,WAAO,KAAKC,aAAZ;AACD;;AACsB,MAAZD,YAAY,CAACN,KAAD,EAA4B;AACjD,SAAKO,aAAL,GAAqBP,KAArB;;AACAC,+BAA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ACnE,UAAI,KAAK9B,gBAAT,EAA2B;AACzB,aAAKA,gBAAL,CAAsB8B,KAAtB,aAAsBA,KAAtB,cAAsBA,KAAtB,GAA+B,EAA/B;AACD;AACF,KAJD;AAMA,SAAKlB,YAAL,CAAkBgB,WAAlB,CAA8Bd,yBAAYmB,aAA1C,EAA0DH,KAAD,IAAW;AAClE,UAAI,KAAKzB,eAAT,EAA0B;AACxB,aAAKA,eAAL,CAAqByB,KAArB,aAAqBA,KAArB,cAAqBA,KAArB,GAA8B,EAA9B;AACD;AACF,KAJD;AAMA,SAAKlB,YAAL,CAAkBgB,WAAlB,CAA8Bd,yBAAYoB,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;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"]}
|
|
1
|
+
{"version":3,"sources":["FireworkSDK.ts"],"names":["FireworkSDK","onCustomCTAClick","_onCustomCTAClick","value","FWLoggerUtil","log","FireworkSDKModule","setCustomCTAClickEnabled","customCTALinkContentRender","_customCTALinkContentRender","setCustomCTALinkContentRenderEnabled","onVideoPlayback","_onVideoPlayback","setVideoPlaybackEventEnabled","shareBaseURL","_shareBaseURL","setShareBaseURL","then","eventEmitter","emit","FWEventName","ShareBaseURLUpdated","adBadgeConfiguration","_adBadgeConfiguration","setAdBadgeConfiguration","AdBadgeConfigurationUpdated","FireworkSDKModuleEventEmitter","shopping","VideoShopping","getInstance","liveStream","LiveStream","navigator","FWNavigator","_instance","constructor","addListener","SDKInit","event","error","onSDKInit","LogMessage","logNativeMessage","message","CustomCTAClick","url","VideoPlayback","eventName","VideoFeedClick","info","id","onVideoFeedClick","init","userId","ShoppingModule","LiveStreamModule","openVideoPlayer","config"],"mappings":";;;;;;;AACA;;AAGA;;AAQA;;AAGA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;AAUA;AACA;AACA;AACA,MAAMA,WAAN,CAAkB;AAGhB;AACF;AACA;;AAGE;AACF;AACA;;AAGE;AACF;AACA;AAC6B,MAAhBC,gBAAgB,GAAuC;AAChE,WAAO,KAAKC,iBAAZ;AACD;;AAC0B,MAAhBD,gBAAgB,CAACE,KAAD,EAA4C;AACrEC,0BAAaC,GAAb,CAAkB,iCAAgC,CAAC,CAACF,KAAM,EAA1D;;AACA,SAAKD,iBAAL,GAAyBC,KAAzB;;AACAG,+BAAkBC,wBAAlB,CAA2CJ,KAAK,GAAG,IAAH,GAAU,KAA1D;AACD;;AAGD;AACF;AACA;AACA;AACuC,MAA1BK,0BAA0B,GAEvB;AACZ,WAAO,KAAKC,2BAAZ;AACD;;AACoC,MAA1BD,0BAA0B,CACnCL,KADmC,EAEnC;AACAC,0BAAaC,GAAb,CAAkB,kCAAiC,CAAC,CAACF,KAAM,E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CAAES,SAAU,EAAjE;;AAEA,UAAI,KAAKpC,eAAT,EAA0B;AACxB,aAAKA,eAAL,CAAqB2B,KAArB,aAAqBA,KAArB,cAAqBA,KAArB,GAA8B,EAA9B;AACD;AACF,KAND;AAQA,SAAKpB,YAAL,CAAkBkB,WAAlB,CAA8BhB,yBAAY4B,cAA1C,EAA2DV,KAAD,IAAW;AACnElC,4BAAaC,GAAb,CAAkB,gCAA+BiC,KAAhC,aAAgCA,KAAhC,uBAAgCA,KAAK,CAAEW,IAAP,CAAYC,EAAG,EAAhE;;AAEA,UAAI,KAAKC,gBAAT,EAA2B;AACzB,aAAKA,gBAAL,CAAsBb,KAAtB,aAAsBA,KAAtB,cAAsBA,KAAtB,GAA+B,EAA/B;AACD;AACF,KAND;AAOD;AAED;AACF;AACA;AACA;;;AACSc,EAAAA,IAAI,CAACC,MAAD,EAAkB;AAC3B/C,+BAAkB8C,IAAlB,CAAuBC,MAAvB;;AACAC,4BAAeF,IAAf;;AACAG,8BAAiBH,IAAjB;AACD;AAED;AACF;AACA;AACA;AACA;;;AACSI,EAAAA,eAAe,CAACX,GAAD,EAAcY,MAAd,EAAiD;AACrEnD,+BAAkBkD,eAAlB,CAAkCX,GAAlC,EAAuCY,MAAvC,aAAuCA,MAAvC,cAAuCA,MAAvC,GAAiD,EAAjD;AACD;;AAlLe;;gBAAZzD,W;;eAqLSA,W","sourcesContent":["import type { NativeEventEmitter } from 'react-native';\nimport LiveStream from './LiveStream';\n\nimport type AdBadgeConfiguration from './models/AdBadgeConfiguration';\nimport { FWEventName } from './models/FWEventName';\nimport type {\n CustomCTAClickEvent,\n SDKInitEvent,\n VideoFeedClickEvent,\n VideoPlaybackEvent,\n} from './models/FWEvents';\nimport type VideoPlayerConfiguration from './models/VideoPlayerConfiguration';\nimport FireworkSDKModule, {\n FireworkSDKModuleEventEmitter,\n} from './modules/FireworkSDKModule';\nimport LiveStreamModule from './modules/LiveStreamModule';\nimport ShoppingModule from './modules/ShoppingModule';\nimport VideoShopping from './VideoShopping';\nimport FWNavigator from './FWNavigator';\nimport FWLoggerUtil from './utils/FWLoggerUtil';\n\nexport type SDKInitCallback = (event: SDKInitEvent) => void;\nexport type CustomCTAClickCallback = (event: CustomCTAClickEvent) => void;\nexport type CustomCTALinkContentRender = (\n event: CustomCTAClickEvent\n) => React.ReactNode | null;\nexport type VideoPlaybackCallback = (event: VideoPlaybackEvent) => void;\nexport type VideoFeedClickCallback = (event: VideoFeedClickEvent) => void;\n\n/**\n * Entry class of Firework SDK, which supports the sdk initialization and global configuration.\n */\nclass FireworkSDK {\n private static _instance?: FireworkSDK;\n\n /**\n * The callback of SDK initialization.\n */\n public onSDKInit?: SDKInitCallback;\n\n /**\n * the callback of clicking Video Feed.\n */\n public onVideoFeedClick?: VideoFeedClickCallback;\n\n /**\n * The callback of clicking custom CTA.\n */\n public get onCustomCTAClick(): CustomCTAClickCallback | undefined {\n return this._onCustomCTAClick;\n }\n public set onCustomCTAClick(value: CustomCTAClickCallback | undefined) {\n FWLoggerUtil.log(`Set onCustomCTAClick callback ${!!value}`);\n this._onCustomCTAClick = value;\n FireworkSDKModule.setCustomCTAClickEnabled(value ? true : false);\n }\n private _onCustomCTAClick: CustomCTAClickCallback | undefined;\n\n /**\n * The custom render method of CTA link content.\n * We will show a native container to display the element returned by the render method.\n */\n public get customCTALinkContentRender():\n | CustomCTALinkContentRender\n | undefined {\n return this._customCTALinkContentRender;\n }\n public set customCTALinkContentRender(\n value: CustomCTALinkContentRender | undefined\n ) {\n FWLoggerUtil.log(`Set customCTALinkContentRender ${!!value}`);\n this._customCTALinkContentRender = value;\n FireworkSDKModule.setCustomCTALinkContentRenderEnabled(\n value ? true : false\n );\n }\n private _customCTALinkContentRender: CustomCTALinkContentRender | undefined;\n\n /**\n * The callback of video playback.\n */\n public get onVideoPlayback(): VideoPlaybackCallback | undefined {\n return this._onVideoPlayback;\n }\n public set onVideoPlayback(value: VideoPlaybackCallback | undefined) {\n this._onVideoPlayback = value;\n FireworkSDKModule.setVideoPlaybackEventEnabled(value ? true : false);\n }\n private _onVideoPlayback?: VideoPlaybackCallback | undefined;\n\n /**\n * The share base URL of videos.\n */\n public get shareBaseURL(): string | undefined {\n return this._shareBaseURL;\n }\n public set shareBaseURL(value: string | undefined) {\n this._shareBaseURL = value;\n FireworkSDKModule.setShareBaseURL(value).then(() => {\n this.eventEmitter.emit(FWEventName.ShareBaseURLUpdated);\n });\n }\n private _shareBaseURL: string | undefined;\n\n /**\n * The configuration for ad badges.\n */\n public get adBadgeConfiguration(): AdBadgeConfiguration | undefined {\n return this._adBadgeConfiguration;\n }\n public set adBadgeConfiguration(value: AdBadgeConfiguration | undefined) {\n this._adBadgeConfiguration = value;\n FireworkSDKModule.setAdBadgeConfiguration(value).then(() => {\n this.eventEmitter.emit(FWEventName.AdBadgeConfigurationUpdated);\n });\n }\n private _adBadgeConfiguration?: AdBadgeConfiguration | undefined;\n\n private get eventEmitter(): NativeEventEmitter {\n return FireworkSDKModuleEventEmitter;\n }\n\n /**\n * Get VideoShopping object.\n */\n public get shopping(): VideoShopping {\n return VideoShopping.getInstance();\n }\n\n /**\n * Get LiveStream object.\n */\n public get liveStream(): LiveStream {\n return LiveStream.getInstance();\n }\n\n /**\n * Get FWNavigator object.\n */\n public get navigator(): FWNavigator {\n return FWNavigator.getInstance();\n }\n\n /**\n * Get global single instance of FireworkSDK class.\n * @returns FireworkSDK\n */\n public static getInstance() {\n if (!FireworkSDK._instance) {\n FireworkSDK._instance = new FireworkSDK();\n }\n\n return FireworkSDK._instance!;\n }\n\n private constructor() {\n this.eventEmitter.addListener(FWEventName.SDKInit, (event) => {\n FWLoggerUtil.log(`Receive SDKInit event ${event?.error}`);\n\n if (this.onSDKInit) {\n this.onSDKInit(event ?? {});\n }\n });\n\n this.eventEmitter.addListener(FWEventName.LogMessage, (event) => {\n FWLoggerUtil.logNativeMessage(event.message);\n });\n\n this.eventEmitter.addListener(FWEventName.CustomCTAClick, (event) => {\n FWLoggerUtil.log(`Receive CustomCTAClick url ${event?.url}`);\n\n if (this.onCustomCTAClick) {\n this.onCustomCTAClick(event ?? {});\n }\n });\n\n this.eventEmitter.addListener(FWEventName.VideoPlayback, (event) => {\n FWLoggerUtil.log(`Receive VideoPlayback event ${event?.eventName}`);\n\n if (this.onVideoPlayback) {\n this.onVideoPlayback(event ?? {});\n }\n });\n\n this.eventEmitter.addListener(FWEventName.VideoFeedClick, (event) => {\n FWLoggerUtil.log(`Receive VideoFeedClick event ${event?.info.id}`);\n\n if (this.onVideoFeedClick) {\n this.onVideoFeedClick(event ?? {});\n }\n });\n }\n\n /**\n * Initializes Firework SDK.\n * @param {string?} userId An id to uniquely identify device or user.\n */\n public init(userId?: string) {\n FireworkSDKModule.init(userId);\n ShoppingModule.init();\n LiveStreamModule.init();\n }\n\n /**\n * Open Video URL.\n * @param {string} url\n * @param {VideoPlayerConfiguration} config\n */\n public openVideoPlayer(url: string, config?: VideoPlayerConfiguration) {\n FireworkSDKModule.openVideoPlayer(url, config ?? {});\n }\n}\n\nexport default FireworkSDK;\n"]}
|
|
@@ -144,7 +144,6 @@ class VideoShopping {
|
|
|
144
144
|
const callbackId = event.callbackId;
|
|
145
145
|
delete event.callbackId;
|
|
146
146
|
const productList = await this.onUpdateProductDetails(event);
|
|
147
|
-
console.log('handleUpdateProductDetailsEvent productList', JSON.stringify(productList));
|
|
148
147
|
|
|
149
148
|
if (productList) {
|
|
150
149
|
_ShoppingModule.default.updateVideoProducts(productList, callbackId);
|
|
@@ -1 +1 @@
|
|
|
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","
|
|
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","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,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;AAEA,UAAIA,QAAJ,EAAc;AACZ5B,gCAAe8B,cAAf,CAA8BR,UAA9B;AACD;AACF;AACF;;AAE4C,QAA/BP,+BAA+B,CAC3CL,KAD2C,EAE3C;AACA,QAAI,KAAKqB,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;;AAGA,UAAIsB,WAAJ,EAAiB;AACfhC,gCAAeiC,mBAAf,CAAmCD,WAAnC,EAAgDV,UAAhD;AACD;AACF;AACF;;AAE0C,QAA7BL,6BAA6B,CACzCP,KADyC,EAEzC;AACA,QAAI,KAAKwB,oBAAT,EAA+B;AAC7B,YAAMZ,UAAU,GAAGZ,KAAK,CAACY,UAAzB;AACA,aAAOZ,KAAK,CAACY,UAAb;AACA,YAAMa,MAAM,GAAG,MAAM,KAAKD,oBAAL,CACnBxB,KADmB,CAArB;;AAGA,UAAIyB,MAAJ,EAAY;AACVnC,gCAAeoC,uBAAf,CAAuCD,MAAvC,EAA+Cb,UAA/C;AACD;AACF;AACF;;AApJiB;;gBAAd1B,a;;eAuJSA,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 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"]}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
|
|
10
|
+
var _reactNative = require("react-native");
|
|
11
|
+
|
|
12
|
+
var _FireworkSDK = _interopRequireDefault(require("../FireworkSDK"));
|
|
13
|
+
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
+
|
|
16
|
+
const CustomCTALinkContentContainer = _ref => {
|
|
17
|
+
let {
|
|
18
|
+
url = ''
|
|
19
|
+
} = _ref;
|
|
20
|
+
|
|
21
|
+
const customCTALinkContentRender = _FireworkSDK.default.getInstance().customCTALinkContentRender;
|
|
22
|
+
|
|
23
|
+
let content = customCTALinkContentRender === null || customCTALinkContentRender === void 0 ? void 0 : customCTALinkContentRender({
|
|
24
|
+
url
|
|
25
|
+
});
|
|
26
|
+
return /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
27
|
+
style: styles.container
|
|
28
|
+
}, content);
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
var _default = CustomCTALinkContentContainer;
|
|
32
|
+
exports.default = _default;
|
|
33
|
+
|
|
34
|
+
const styles = _reactNative.StyleSheet.create({
|
|
35
|
+
container: {
|
|
36
|
+
flex: 1
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
//# sourceMappingURL=CustomCTALinkContentContainer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["CustomCTALinkContentContainer.tsx"],"names":["CustomCTALinkContentContainer","url","customCTALinkContentRender","FireworkSDK","getInstance","content","styles","container","StyleSheet","create","flex"],"mappings":";;;;;;;AAAA;;AAEA;;AAEA;;;;AAMA,MAAMA,6BAA6B,GAAG,QAEK;AAAA,MAFJ;AACrCC,IAAAA,GAAG,GAAG;AAD+B,GAEI;;AACzC,QAAMC,0BAA0B,GAC9BC,qBAAYC,WAAZ,GAA0BF,0BAD5B;;AAEA,MAAIG,OAAO,GAAGH,0BAAH,aAAGA,0BAAH,uBAAGA,0BAA0B,CAAG;AAAED,IAAAA;AAAF,GAAH,CAAxC;AACA,sBAAO,6BAAC,iBAAD;AAAM,IAAA,KAAK,EAAEK,MAAM,CAACC;AAApB,KAAgCF,OAAhC,CAAP;AACD,CAPD;;eASeL,6B;;;AAEf,MAAMM,MAAM,GAAGE,wBAAWC,MAAX,CAAkB;AAC/BF,EAAAA,SAAS,EAAE;AACTG,IAAAA,IAAI,EAAE;AADG;AADoB,CAAlB,CAAf","sourcesContent":["import React from 'react';\n\nimport { StyleSheet, View } from 'react-native';\n\nimport FireworkSDK from '../FireworkSDK';\n\nexport interface ICustomCTALinkContentContainerProps {\n url?: string;\n}\n\nconst CustomCTALinkContentContainer = ({\n url = '',\n}: ICustomCTALinkContentContainerProps) => {\n const customCTALinkContentRender =\n FireworkSDK.getInstance().customCTALinkContentRender;\n let content = customCTALinkContentRender?.({ url });\n return <View style={styles.container}>{content}</View>;\n};\n\nexport default CustomCTALinkContentContainer;\n\nconst styles = StyleSheet.create({\n container: {\n flex: 1,\n },\n});\n"]}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
|
|
10
|
+
var _reactNative = require("react-native");
|
|
11
|
+
|
|
12
|
+
var _FWNavigator = _interopRequireDefault(require("../FWNavigator"));
|
|
13
|
+
|
|
14
|
+
var _FWLoggerUtil = _interopRequireDefault(require("../utils/FWLoggerUtil"));
|
|
15
|
+
|
|
16
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
+
|
|
18
|
+
const NavigationContainer = _ref => {
|
|
19
|
+
let {
|
|
20
|
+
callbackId
|
|
21
|
+
} = _ref;
|
|
22
|
+
|
|
23
|
+
_FWLoggerUtil.default.log('Render NavigationContainer');
|
|
24
|
+
|
|
25
|
+
const page = _FWNavigator.default.getInstance().navigatorPages.get(callbackId !== null && callbackId !== void 0 ? callbackId : '');
|
|
26
|
+
|
|
27
|
+
return /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
28
|
+
style: styles.container
|
|
29
|
+
}, page);
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const styles = _reactNative.StyleSheet.create({
|
|
33
|
+
container: {
|
|
34
|
+
flex: 1
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
var _default = NavigationContainer;
|
|
39
|
+
exports.default = _default;
|
|
40
|
+
//# sourceMappingURL=NavigationContainer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["NavigationContainer.tsx"],"names":["NavigationContainer","callbackId","FWLoggerUtil","log","page","FWNavigator","getInstance","navigatorPages","get","styles","container","StyleSheet","create","flex"],"mappings":";;;;;;;AAAA;;AAEA;;AAEA;;AACA;;;;AAMA,MAAMA,mBAAmB,GAAG,QAA+C;AAAA,MAA9C;AAAEC,IAAAA;AAAF,GAA8C;;AACzEC,wBAAaC,GAAb,CAAiB,4BAAjB;;AACA,QAAMC,IAAI,GAAGC,qBAAYC,WAAZ,GAA0BC,cAA1B,CAAyCC,GAAzC,CAA6CP,UAA7C,aAA6CA,UAA7C,cAA6CA,UAA7C,GAA2D,EAA3D,CAAb;;AACA,sBAAO,6BAAC,iBAAD;AAAM,IAAA,KAAK,EAAEQ,MAAM,CAACC;AAApB,KAAgCN,IAAhC,CAAP;AACD,CAJD;;AAMA,MAAMK,MAAM,GAAGE,wBAAWC,MAAX,CAAkB;AAC/BF,EAAAA,SAAS,EAAE;AACTG,IAAAA,IAAI,EAAE;AADG;AADoB,CAAlB,CAAf;;eAMeb,mB","sourcesContent":["import React from 'react';\n\nimport { StyleSheet, View } from 'react-native';\n\nimport FWNavigator from '../FWNavigator';\nimport FWLoggerUtil from '../utils/FWLoggerUtil';\n\nexport interface INavigationContainerProps {\n callbackId?: string;\n}\n\nconst NavigationContainer = ({ callbackId }: INavigationContainerProps) => {\n FWLoggerUtil.log('Render NavigationContainer');\n const page = FWNavigator.getInstance().navigatorPages.get(callbackId ?? '');\n return <View style={styles.container}>{page}</View>;\n};\n\nconst styles = StyleSheet.create({\n container: {\n flex: 1,\n },\n});\n\nexport default NavigationContainer;\n"]}
|
|
@@ -97,6 +97,9 @@ class VideoFeed extends _react.default.Component {
|
|
|
97
97
|
const adBadgeTextType = (_adBadgeConfiguration = adBadgeConfiguration.badgeTextType) !== null && _adBadgeConfiguration !== void 0 ? _adBadgeConfiguration : '';
|
|
98
98
|
const backgroundColorOfAdBadge = (_adBadgeConfiguration2 = adBadgeConfiguration.backgroundColor) !== null && _adBadgeConfiguration2 !== void 0 ? _adBadgeConfiguration2 : '';
|
|
99
99
|
const textColorOfAdBadge = (_adBadgeConfiguration3 = adBadgeConfiguration.textColor) !== null && _adBadgeConfiguration3 !== void 0 ? _adBadgeConfiguration3 : '';
|
|
100
|
+
|
|
101
|
+
const dynamicContentParametersString = this._generateDynamicContentParametersString();
|
|
102
|
+
|
|
100
103
|
let key = `source:${source}`;
|
|
101
104
|
key += `_channel:${channel}`;
|
|
102
105
|
key += `_playlist:${playlist}`;
|
|
@@ -108,6 +111,7 @@ class VideoFeed extends _react.default.Component {
|
|
|
108
111
|
key += `_adBadgeTextType:${adBadgeTextType}`;
|
|
109
112
|
key += `_backgroundColorOfAdBadge:${backgroundColorOfAdBadge}`;
|
|
110
113
|
key += `_textColorOfAdBadge:${textColorOfAdBadge}`;
|
|
114
|
+
key += `_dynamicContentParameters:${dynamicContentParametersString}`;
|
|
111
115
|
return /*#__PURE__*/_react.default.createElement(_FWVideoFeed.default, _extends({
|
|
112
116
|
key: key
|
|
113
117
|
}, this.props, {
|
|
@@ -120,6 +124,32 @@ class VideoFeed extends _react.default.Component {
|
|
|
120
124
|
}));
|
|
121
125
|
}
|
|
122
126
|
|
|
127
|
+
_generateDynamicContentParametersString() {
|
|
128
|
+
const {
|
|
129
|
+
dynamicContentParameters
|
|
130
|
+
} = this.props;
|
|
131
|
+
|
|
132
|
+
if (!dynamicContentParameters) {
|
|
133
|
+
return '';
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
let resultString = '';
|
|
137
|
+
const sortedKeyList = Object.keys(dynamicContentParameters).sort();
|
|
138
|
+
|
|
139
|
+
for (const key of sortedKeyList) {
|
|
140
|
+
const value = dynamicContentParameters[key];
|
|
141
|
+
const valueString = value.join(',');
|
|
142
|
+
|
|
143
|
+
if (resultString.length > 0) {
|
|
144
|
+
resultString += '_';
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
resultString += `${key}:${valueString}`;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
return resultString;
|
|
151
|
+
}
|
|
152
|
+
|
|
123
153
|
}
|
|
124
154
|
|
|
125
155
|
exports.default = VideoFeed;
|
|
@@ -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","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;;AA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AAA,GAAG,IAAK,6BAA4BJ,wBAAyB,EAA7D;AACAI,IAAAA,GAAG,IAAK,uBAAsBF,kBAAmB,EAAjD;AAEA,wBACE,6BAAC,oBAAD;AACE,MAAA,GAAG,EAAEE;AADP,OAEM,KAAKtC,KAFX;AAGE,MAAA,GAAG,EAAE,KAAKX,kBAHZ;AAIE,MAAA,uBAAuB,EAAE,KAAKkD,wBAJhC;AAKE,MAAA,IAAI,EAAEjB,IALR;AAME,MAAA,KAAK,EAAEkB,MAAM,CAACC,MAAP,CAAc,EAAd,EAAkB,KAAKzC,KAAL,CAAW0C,KAA7B,EAAoC;AAAEC,QAAAA,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"]}
|
|
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","dynamicContentParametersString","_generateDynamicContentParametersString","key","_onVideoFeedLoadFinished","Object","assign","style","zIndex","dynamicContentParameters","resultString","sortedKeyList","keys","sort","valueString","join","length"],"mappings":";;;;;;;AAAA;;AAGA;;AAQA;;AAEA;;AAIA;;AACA;;;;;;;;AAuDA,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,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,KAjCqE;AAAA;;AAmCtEC,EAAAA,iBAAiB,GAAG;AAClB,UAAMC,iCAAiC,GACrCC,iDAA8BC,WAA9B,CACEC,yBAAYC,mBADd,EAEE,MAAM;AACJ,WAAKC,QAAL,CAAc,EAAd;AACD,KAJH,CADF;;AAOA,SAAKC,aAAL,CA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AAlB,EAAiC;AAC/B,YAAMjC,KAAK,GAAG+B,wBAAwB,CAACN,GAAD,CAAtC;AACA,YAAMW,WAAW,GAAGpC,KAAK,CAACqC,IAAN,CAAW,GAAX,CAApB;;AACA,UAAIL,YAAY,CAACM,MAAb,GAAsB,CAA1B,EAA6B;AAC3BN,QAAAA,YAAY,IAAI,GAAhB;AACD;;AAEDA,MAAAA,YAAY,IAAK,GAAEP,GAAI,IAAGW,WAAY,EAAtC;AACD;;AAED,WAAOJ,YAAP;AACD;;AA/HqE;;;;gBAAnD/D,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 /**\n * The parameters to be passed to a dynamic content feed. Required when the source is set as dynamicContent.\n */\n dynamicContentParameters?: { [key: string]: string[] };\n\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 =\n FireworkSDKModuleEventEmitter.addListener(\n FWEventName.ShareBaseURLUpdated,\n () => {\n this.setState({});\n }\n );\n this.subscriptions.push(subscriptionOfShareBaseURLUpdated);\n\n const subscriptionOfAdBadgeConfigurationUpdated =\n 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 const dynamicContentParametersString =\n this._generateDynamicContentParametersString();\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 key += `_dynamicContentParameters:${dynamicContentParametersString}`;\n\n return (\n <FWVideoFeed\n key={key}\n {...this.props}\n ref={this.nativeComponentRef}\n onVideoFeedLoadFinished={this._onVideoFeedLoadFinished}\n mode={mode}\n style={Object.assign({}, this.props.style, { zIndex: -1 })}\n />\n );\n }\n\n private _generateDynamicContentParametersString(): string {\n const { dynamicContentParameters } = this.props;\n if (!dynamicContentParameters) {\n return '';\n }\n\n let resultString = '';\n const sortedKeyList = Object.keys(dynamicContentParameters).sort();\n for (const key of sortedKeyList) {\n const value = dynamicContentParameters[key];\n const valueString = value.join(',');\n if (resultString.length > 0) {\n resultString += '_';\n }\n\n resultString += `${key}:${valueString}`;\n }\n\n return resultString;\n }\n}\n"]}
|
package/lib/commonjs/index.js
CHANGED
|
@@ -3,6 +3,12 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
Object.defineProperty(exports, "FWNavigator", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _FWNavigator.default;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
6
12
|
Object.defineProperty(exports, "LiveStream", {
|
|
7
13
|
enumerable: true,
|
|
8
14
|
get: function () {
|
|
@@ -45,16 +51,22 @@ var _reactNative = require("react-native");
|
|
|
45
51
|
|
|
46
52
|
var _CartContainer = _interopRequireDefault(require("./components/CartContainer"));
|
|
47
53
|
|
|
54
|
+
var _CustomCTALinkContentContainer = _interopRequireDefault(require("./components/CustomCTALinkContentContainer"));
|
|
55
|
+
|
|
56
|
+
var _NavigationContainer = _interopRequireDefault(require("./components/NavigationContainer"));
|
|
57
|
+
|
|
48
58
|
var _VideoFeed = _interopRequireDefault(require("./components/VideoFeed"));
|
|
49
59
|
|
|
50
60
|
var _FireworkSDK = _interopRequireDefault(require("./FireworkSDK"));
|
|
51
61
|
|
|
52
|
-
var
|
|
62
|
+
var _FWNavigator = _interopRequireDefault(require("./FWNavigator"));
|
|
53
63
|
|
|
54
|
-
var
|
|
64
|
+
var _LiveStream = _interopRequireDefault(require("./LiveStream"));
|
|
55
65
|
|
|
56
66
|
var _LiveStreamChatEventName = _interopRequireDefault(require("./models/LiveStreamChatEventName"));
|
|
57
67
|
|
|
68
|
+
var _LiveStreamEventName = _interopRequireDefault(require("./models/LiveStreamEventName"));
|
|
69
|
+
|
|
58
70
|
var _VideoPlaybackEventName = _interopRequireDefault(require("./models/VideoPlaybackEventName"));
|
|
59
71
|
|
|
60
72
|
var _VideoShopping = _interopRequireDefault(require("./VideoShopping"));
|
|
@@ -63,6 +75,10 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
63
75
|
|
|
64
76
|
_reactNative.AppRegistry.registerComponent('FWShoppingCartPage', () => _CartContainer.default);
|
|
65
77
|
|
|
78
|
+
_reactNative.AppRegistry.registerComponent('FWNavigationContainer', () => _NavigationContainer.default);
|
|
79
|
+
|
|
80
|
+
_reactNative.AppRegistry.registerComponent('FWCustomCTALinkContentContainer', () => _CustomCTALinkContentContainer.default);
|
|
81
|
+
|
|
66
82
|
var _default = _FireworkSDK.default;
|
|
67
83
|
exports.default = _default;
|
|
68
84
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index.tsx"],"names":["AppRegistry","registerComponent","CartContainer","FireworkSDK"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["index.tsx"],"names":["AppRegistry","registerComponent","CartContainer","NavigationContainer","CustomCTALinkContentContainer","FireworkSDK"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AAEA;;AACA;;AACA;;AAEA;;AAQA;;AACA;;AAKA;;AAgBA;;AAEA;;AAgBA;;AAcA;;;;AAEAA,yBAAYC,iBAAZ,CAA8B,oBAA9B,EAAoD,MAAMC,sBAA1D;;AACAF,yBAAYC,iBAAZ,CACE,uBADF,EAEE,MAAME,4BAFR;;AAIAH,yBAAYC,iBAAZ,CACE,iCADF,EAEE,MAAMG,sCAFR;;eAKeC,oB","sourcesContent":["import { AppRegistry } from 'react-native';\n\nimport CartContainer from './components/CartContainer';\nimport CustomCTALinkContentContainer from './components/CustomCTALinkContentContainer';\nimport NavigationContainer from './components/NavigationContainer';\nimport type { IVideoFeedProps, VideoFeedMode } from './components/VideoFeed';\nimport VideoFeed from './components/VideoFeed';\nimport type {\n CustomCTAClickCallback,\n CustomCTALinkContentRender,\n SDKInitCallback,\n VideoFeedClickCallback,\n VideoPlaybackCallback,\n} from './FireworkSDK';\nimport FireworkSDK from './FireworkSDK';\nimport FWNavigator from './FWNavigator';\nimport type {\n onLiveStreamChatEventCallback,\n onLiveStreamEventCallback,\n} from './LiveStream';\nimport LiveStream from './LiveStream';\nimport type AdBadgeConfiguration from './models/AdBadgeConfiguration';\nimport type { AdBadgeTextType } from './models/AdBadgeConfiguration';\nimport type AddToCartResult from './models/AddToCartResult';\nimport type FeedItemDetails from './models/FeedItemDetails';\nimport type FWError from './models/FWError';\nimport type {\n AddToCartEvent,\n CustomCTAClickEvent,\n LiveStreamChatEvent,\n LiveStreamEvent,\n SDKInitEvent,\n UpdateProductDetailsEvent,\n VideoPlaybackEvent,\n WillDisplayProductEvent,\n} from './models/FWEvents';\nimport LiveStreamChatEventName from './models/LiveStreamChatEventName';\nimport type LiveStreamEventDetails from './models/LiveStreamEventDetails';\nimport LiveStreamEventName from './models/LiveStreamEventName';\nimport type LiveStreamMessageDetails from './models/LiveStreamMessageDetails';\nimport type Product from './models/Product';\nimport type ProductInfoViewConfiguration from './models/ProductInfoViewConfiguration';\nimport type { AddToCartButtonConfiguration } from './models/ProductInfoViewConfiguration';\nimport type ProductUnit from './models/ProductUnit';\nimport type { ProductPrice } from './models/ProductUnit';\nimport type VideoFeedConfiguration from './models/VideoFeedConfiguration';\nimport type {\n VideoFeedPlayIconConfiguration,\n VideoFeedTitleConfiguration,\n VideoFeedTitlePosition,\n} from './models/VideoFeedConfiguration';\nimport type VideoFeedSource from './models/VideoFeedSource';\nimport type VideoPlaybackDetails from './models/VideoPlaybackDetails';\nimport type { VideoPlayerSize } from './models/VideoPlaybackDetails';\nimport VideoPlaybackEventName from './models/VideoPlaybackEventName';\nimport type VideoPlayerConfiguration from './models/VideoPlayerConfiguration';\nimport type {\n VideoLaunchBehavior,\n VideoPlayerCompleteAction,\n VideoPlayerCTAStyle,\n VideoPlayerStyle,\n} from './models/VideoPlayerConfiguration';\nimport type {\n AddToCartCallback,\n ClickCartIconCallback,\n UpdateProductDetailsCallback,\n WillDisplayProductCallback,\n} from './VideoShopping';\nimport VideoShopping from './VideoShopping';\n\nAppRegistry.registerComponent('FWShoppingCartPage', () => CartContainer);\nAppRegistry.registerComponent(\n 'FWNavigationContainer',\n () => NavigationContainer\n);\nAppRegistry.registerComponent(\n 'FWCustomCTALinkContentContainer',\n () => CustomCTALinkContentContainer\n);\n\nexport default FireworkSDK;\n\nexport {\n AdBadgeConfiguration,\n AdBadgeTextType,\n AddToCartButtonConfiguration,\n AddToCartCallback,\n AddToCartEvent,\n AddToCartResult,\n ClickCartIconCallback,\n CustomCTAClickCallback,\n CustomCTAClickEvent,\n CustomCTALinkContentRender,\n FeedItemDetails,\n FWError,\n FWNavigator,\n IVideoFeedProps,\n LiveStream,\n LiveStreamChatEvent,\n LiveStreamChatEventName,\n LiveStreamEvent,\n LiveStreamEventDetails,\n LiveStreamEventName,\n LiveStreamMessageDetails,\n 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"]}
|
|
@@ -20,5 +20,6 @@ exports.FWEventName = FWEventName;
|
|
|
20
20
|
FWEventName["onLiveStreamChatEvent"] = "fw:livestream-chat";
|
|
21
21
|
FWEventName["ShareBaseURLUpdated"] = "fw:share-base-url-updated";
|
|
22
22
|
FWEventName["AdBadgeConfigurationUpdated"] = "fw:ad-badge-configuration-updated";
|
|
23
|
+
FWEventName["LogMessage"] = "fw:log-message";
|
|
23
24
|
})(FWEventName || (exports.FWEventName = FWEventName = {}));
|
|
24
25
|
//# sourceMappingURL=FWEventName.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["FWEventName.ts"],"names":["FWEventName"],"mappings":";;;;;;IAAYA,W;;;WAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;GAAAA,W,2BAAAA,W","sourcesContent":["export enum FWEventName {\n SDKInit = 'fw:sdk-init',\n CustomCTAClick = 'fw:custom-cta-click',\n VideoPlayback = 'fw:video-playback',\n VideoFeedClick = 'fw:video-feed-click',\n AddToCart = 'fw:shopping:add-to-cart',\n ClickCartIcon = 'fw:shopping:click-cart-icon',\n UpdateProductDetails = 'fw:shopping:update-product-details',\n WillDisplayProduct = 'fw:shopping:will-display-product',\n onLiveStreamEvent = 'fw:livestream',\n onLiveStreamChatEvent = 'fw:livestream-chat',\n ShareBaseURLUpdated = 'fw:share-base-url-updated',\n AdBadgeConfigurationUpdated = 'fw:ad-badge-configuration-updated',\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["FWEventName.ts"],"names":["FWEventName"],"mappings":";;;;;;IAAYA,W;;;WAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;GAAAA,W,2BAAAA,W","sourcesContent":["export enum FWEventName {\n SDKInit = 'fw:sdk-init',\n CustomCTAClick = 'fw:custom-cta-click',\n VideoPlayback = 'fw:video-playback',\n VideoFeedClick = 'fw:video-feed-click',\n AddToCart = 'fw:shopping:add-to-cart',\n ClickCartIcon = 'fw:shopping:click-cart-icon',\n UpdateProductDetails = 'fw:shopping:update-product-details',\n WillDisplayProduct = 'fw:shopping:will-display-product',\n onLiveStreamEvent = 'fw:livestream',\n onLiveStreamChatEvent = 'fw:livestream-chat',\n ShareBaseURLUpdated = 'fw:share-base-url-updated',\n AdBadgeConfigurationUpdated = 'fw:ad-badge-configuration-updated',\n LogMessage = 'fw:log-message',\n}\n"]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = exports.FWNavigatorModuleEventEmitter = void 0;
|
|
7
|
+
|
|
8
|
+
var _reactNative = require("react-native");
|
|
9
|
+
|
|
10
|
+
var _FWErrorMessage = require("../constants/FWErrorMessage");
|
|
11
|
+
|
|
12
|
+
const FWNavigatorModule = _reactNative.NativeModules.FWNavigatorModule ? _reactNative.NativeModules.FWNavigatorModule : new Proxy({}, {
|
|
13
|
+
get() {
|
|
14
|
+
throw new Error(_FWErrorMessage.LINKING_ERROR);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
});
|
|
18
|
+
const FWNavigatorModuleEventEmitter = new _reactNative.NativeEventEmitter(FWNavigatorModule);
|
|
19
|
+
exports.FWNavigatorModuleEventEmitter = FWNavigatorModuleEventEmitter;
|
|
20
|
+
var _default = FWNavigatorModule;
|
|
21
|
+
exports.default = _default;
|
|
22
|
+
//# sourceMappingURL=FWNavigatorModule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["FWNavigatorModule.ts"],"names":["FWNavigatorModule","NativeModules","Proxy","get","Error","LINKING_ERROR","FWNavigatorModuleEventEmitter","NativeEventEmitter"],"mappings":";;;;;;;AAAA;;AAEA;;AAEA,MAAMA,iBAAiB,GAAGC,2BAAcD,iBAAd,GACtBC,2BAAcD,iBADQ,GAEtB,IAAIE,KAAJ,CACE,EADF,EAEE;AACEC,EAAAA,GAAG,GAAG;AACJ,UAAM,IAAIC,KAAJ,CAAUC,6BAAV,CAAN;AACD;;AAHH,CAFF,CAFJ;AAeA,MAAMC,6BAA6B,GAAG,IAAIC,+BAAJ,CAAuBP,iBAAvB,CAAtC;;eAEeA,iB","sourcesContent":["import { NativeEventEmitter, NativeModule } from 'react-native';\nimport { NativeModules } from 'react-native';\nimport { LINKING_ERROR } from '../constants/FWErrorMessage';\n\nconst FWNavigatorModule = NativeModules.FWNavigatorModule\n ? NativeModules.FWNavigatorModule\n : new Proxy(\n {},\n {\n get() {\n throw new Error(LINKING_ERROR);\n },\n }\n );\ninterface IFWNavigatorModule extends NativeModule {\n pushNativeContainer(callbackId?: string): Promise<boolean>;\n popNativeContainer(): Promise<boolean>;\n}\n\nconst FWNavigatorModuleEventEmitter = new NativeEventEmitter(FWNavigatorModule);\nexport { FWNavigatorModuleEventEmitter };\nexport default FWNavigatorModule as IFWNavigatorModule;\n"]}
|