react-native-firework-sdk 1.0.4 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +202 -0
- package/README.md +2 -40
- package/android/build.gradle +6 -3
- package/android/gradle.properties +2 -1
- package/android/proguard-rules.pro +22 -0
- package/android/publish.gradle +4 -3
- package/android/settings.gradle +1 -0
- package/android/src/main/AndroidManifest.xml +5 -2
- package/android/src/main/java/com/fireworksdk/bridge/components/videofeed/FWVideoFeed.kt +226 -0
- package/android/src/main/java/com/{reactnativefireworksdk → fireworksdk/bridge}/constants/FWCommandConstant.kt +1 -1
- package/android/src/main/java/com/{reactnativefireworksdk → fireworksdk/bridge}/constants/FWVideoPlayerConstant.kt +13 -1
- package/android/src/main/java/com/fireworksdk/bridge/models/FWAdBadgeConfigModel.kt +9 -0
- package/android/src/main/java/com/{reactnativefireworksdk → fireworksdk/bridge}/models/FWEventName.kt +10 -1
- package/android/src/main/java/com/fireworksdk/bridge/models/FWLiveStreamEventDetailsModel.kt +9 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/FWLiveStreamMessageDetailsModel.kt +11 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoFeedConfigModel.kt +28 -0
- package/android/src/main/java/com/{reactnativefireworksdk → fireworksdk/bridge}/models/FWVideoFeedItemDetailsModel.kt +2 -1
- package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoFeedModel.kt +7 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoFeedPropsModel.kt +18 -0
- package/android/src/main/java/com/{reactnativefireworksdk → fireworksdk/bridge}/models/FWVideoFeedSource.kt +2 -1
- package/android/src/main/java/com/{reactnativefireworksdk → fireworksdk/bridge}/models/FWVideoFeedTitlePosition.kt +1 -1
- package/android/src/main/java/com/{reactnativefireworksdk → fireworksdk/bridge}/models/FWVideoPlaybackDetails.kt +1 -1
- package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoPlayerConfigModel.kt +23 -0
- package/android/src/main/java/com/{reactnativefireworksdk → fireworksdk/bridge}/models/FWVideoShoppingProduct.kt +1 -1
- package/android/src/main/java/com/fireworksdk/bridge/models/WeakProperty.kt +19 -0
- package/android/src/main/java/com/{reactnativefireworksdk → fireworksdk/bridge/reactnative}/FireworkSDKPackage.kt +10 -5
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/manager/FWVideoFeedManager.kt +175 -0
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/models/FWLiveStreamInterface.kt +5 -0
- package/android/src/main/java/com/{reactnativefireworksdk → fireworksdk/bridge/reactnative}/models/FWVideoShoppingInterface.kt +3 -2
- package/android/src/main/java/com/{reactnativefireworksdk → fireworksdk/bridge/reactnative}/models/FireworkSDKInterface.kt +4 -2
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FWLiveStreamModule.kt +88 -0
- package/android/src/main/java/com/{reactnativefireworksdk → fireworksdk/bridge/reactnative}/module/FWVideoShoppingModule.kt +53 -39
- package/android/src/main/java/com/{reactnativefireworksdk → fireworksdk/bridge/reactnative}/module/FireworkSDKModule.kt +23 -22
- package/android/src/main/java/com/{reactnativefireworksdk → fireworksdk/bridge/reactnative}/pages/FWVideoShoppingCartActivity.kt +4 -4
- package/android/src/main/java/com/{reactnativefireworksdk → fireworksdk/bridge/reactnative}/utils/FWEventUtils.kt +61 -7
- package/android/src/main/java/com/{reactnativefireworksdk → fireworksdk/bridge}/utils/FWJsonUtils.kt +29 -1
- package/android/src/main/java/com/{reactnativefireworksdk → fireworksdk/bridge}/utils/FWLogUtils.kt +2 -2
- package/android/src/main/java/com/{reactnativefireworksdk → fireworksdk/bridge}/utils/FWUrlUtils.kt +1 -1
- package/android/src/main/java/com/fireworksdk/bridge/utils/FWVideoPlayerUtils.kt +94 -0
- package/android/src/main/res/layout/fw_bridge_fragment_playlistfeed.xml +18 -0
- package/android/src/main/res/layout/{fwrn_fragment_shoppingcart.xml → fw_bridge_fragment_shoppingcart.xml} +1 -1
- package/android/src/main/res/layout/{fwrn_fragment_videofeed.xml → fw_bridge_fragment_videofeed.xml} +2 -1
- package/android/src/main/res/values/colors.xml +4 -0
- package/ios/{Component → Components}/VideoFeed.swift +60 -3
- package/ios/{Component → Components}/VideoFeedConfiguration.swift +2 -0
- package/ios/{Component → Components}/VideoFeedManager.m +2 -0
- package/ios/{Component → Components}/VideoFeedManager.swift +0 -0
- package/ios/{Component → Components}/VideoPlayerConfiguration.swift +7 -0
- package/ios/Models/{FireworkJsEvent.swift → NativeToRN/FireworkEventName.swift} +20 -0
- package/ios/Models/{FireworkSDK+JsModel.swift → NativeToRN/FireworkSDK+Json.swift} +33 -3
- package/ios/Models/{RCTConvert+FireworkSDKModule.swift → RNToNative/RCTConvert+FireworkSDKModule.swift} +20 -0
- package/ios/Models/{RCTConvert+Shopping.swift → RNToNative/RCTConvert+Shopping.swift} +15 -0
- package/ios/Models/{RCTConvert+VideoFeed.swift → RNToNative/RCTConvert+VideoFeed.swift} +2 -1
- package/ios/Modules/FireworkSDKModule/AdBadgeConfiguration.swift +18 -0
- package/ios/Modules/FireworkSDKModule/FireworkSDKModule+CTA.swift +1 -1
- package/ios/Modules/FireworkSDKModule/FireworkSDKModule+EventTracking.swift +10 -14
- package/ios/Modules/FireworkSDKModule/FireworkSDKModule.m +2 -1
- package/ios/Modules/FireworkSDKModule/FireworkSDKModule.swift +16 -4
- package/ios/Modules/LiveStream/LiveStreamModule.m +14 -0
- package/ios/Modules/LiveStream/LiveStreamModule.swift +43 -0
- package/ios/Modules/Shopping/ShoppingModule.m +1 -1
- package/ios/Modules/Shopping/ShoppingModule.swift +10 -9
- package/lib/commonjs/FireworkSDK.js +61 -38
- package/lib/commonjs/FireworkSDK.js.map +1 -1
- package/lib/commonjs/LiveStream.js +60 -0
- package/lib/commonjs/LiveStream.js.map +1 -0
- package/lib/commonjs/VideoShopping.js +20 -18
- package/lib/commonjs/VideoShopping.js.map +1 -1
- package/lib/commonjs/components/VideoFeed.js +47 -2
- package/lib/commonjs/components/VideoFeed.js.map +1 -1
- package/lib/commonjs/index.js +24 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/models/AdBadgeConfiguration.js +2 -0
- package/lib/commonjs/models/{ADConfig.js.map → AdBadgeConfiguration.js.map} +0 -0
- package/lib/commonjs/models/AdConfig.js +2 -0
- package/lib/{module/models/ADConfig.js.map → commonjs/models/AdConfig.js.map} +0 -0
- package/lib/commonjs/models/FWEventName.js +24 -0
- package/lib/commonjs/models/FWEventName.js.map +1 -0
- package/lib/commonjs/models/FWEvents.js +0 -14
- package/lib/commonjs/models/FWEvents.js.map +1 -1
- package/lib/commonjs/models/LiveStreamChatEventName.js +15 -0
- package/lib/commonjs/models/LiveStreamChatEventName.js.map +1 -0
- package/lib/commonjs/models/LiveStreamEventDetails.js +2 -0
- package/lib/commonjs/models/LiveStreamEventDetails.js.map +1 -0
- package/lib/commonjs/models/LiveStreamEventName.js +17 -0
- package/lib/commonjs/models/LiveStreamEventName.js.map +1 -0
- package/lib/commonjs/models/LiveStreamMessageDetails.js +2 -0
- package/lib/commonjs/models/LiveStreamMessageDetails.js.map +1 -0
- package/lib/commonjs/models/VideoFeedSource.js +6 -0
- package/lib/commonjs/models/VideoFeedSource.js.map +1 -0
- package/lib/commonjs/models/VideoPlaybackEventName.js.map +1 -1
- package/lib/commonjs/modules/FireworkSDKModule.js +3 -1
- package/lib/commonjs/modules/FireworkSDKModule.js.map +1 -1
- package/lib/commonjs/modules/LiveStreamModule.js +22 -0
- package/lib/commonjs/modules/LiveStreamModule.js.map +1 -0
- package/lib/commonjs/modules/ShoppingModule.js +3 -1
- package/lib/commonjs/modules/ShoppingModule.js.map +1 -1
- package/lib/module/FireworkSDK.js +50 -34
- package/lib/module/FireworkSDK.js.map +1 -1
- package/lib/module/LiveStream.js +51 -0
- package/lib/module/LiveStream.js.map +1 -0
- package/lib/module/VideoShopping.js +14 -13
- package/lib/module/VideoShopping.js.map +1 -1
- package/lib/module/components/VideoFeed.js +42 -3
- package/lib/module/components/VideoFeed.js.map +1 -1
- package/lib/module/index.js +4 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/models/AdBadgeConfiguration.js +2 -0
- package/lib/module/models/AdBadgeConfiguration.js.map +1 -0
- package/lib/module/models/AdConfig.js +2 -0
- package/lib/module/models/AdConfig.js.map +1 -0
- package/lib/module/models/FWEventName.js +17 -0
- package/lib/module/models/FWEventName.js.map +1 -0
- package/lib/module/models/FWEvents.js +1 -12
- package/lib/module/models/FWEvents.js.map +1 -1
- package/lib/module/models/LiveStreamChatEventName.js +8 -0
- package/lib/module/models/LiveStreamChatEventName.js.map +1 -0
- package/lib/module/models/LiveStreamEventDetails.js +2 -0
- package/lib/module/models/LiveStreamEventDetails.js.map +1 -0
- package/lib/module/models/LiveStreamEventName.js +10 -0
- package/lib/module/models/LiveStreamEventName.js.map +1 -0
- package/lib/module/models/LiveStreamMessageDetails.js +2 -0
- package/lib/module/models/LiveStreamMessageDetails.js.map +1 -0
- package/lib/module/models/VideoFeedSource.js +2 -0
- package/lib/module/models/VideoFeedSource.js.map +1 -0
- package/lib/module/models/VideoPlaybackEventName.js.map +1 -1
- package/lib/module/modules/FireworkSDKModule.js +3 -0
- package/lib/module/modules/FireworkSDKModule.js.map +1 -1
- package/lib/module/modules/LiveStreamModule.js +12 -0
- package/lib/module/modules/LiveStreamModule.js.map +1 -0
- package/lib/module/modules/ShoppingModule.js +3 -1
- package/lib/module/modules/ShoppingModule.js.map +1 -1
- package/lib/typescript/FireworkSDK.d.ts +26 -24
- package/lib/typescript/LiveStream.d.ts +21 -0
- package/lib/typescript/VideoShopping.d.ts +6 -6
- package/lib/typescript/components/VideoFeed.d.ts +11 -4
- package/lib/typescript/index.d.ts +15 -6
- package/lib/typescript/models/AdBadgeConfiguration.d.ts +15 -0
- package/lib/typescript/models/{ADConfig.d.ts → AdConfig.d.ts} +1 -1
- package/lib/typescript/models/FWEventName.d.ts +14 -0
- package/lib/typescript/models/FWEvents.d.ts +15 -12
- package/lib/typescript/models/FeedItemDetails.d.ts +11 -4
- package/lib/typescript/models/LiveStreamChatEventName.d.ts +7 -0
- package/lib/typescript/models/LiveStreamEventDetails.d.ts +3 -0
- package/lib/typescript/models/LiveStreamEventName.d.ts +15 -0
- package/lib/typescript/models/LiveStreamMessageDetails.d.ts +14 -0
- package/lib/typescript/models/VideoFeedConfiguration.d.ts +7 -3
- package/lib/typescript/models/VideoFeedSource.d.ts +2 -0
- package/lib/typescript/models/VideoPlaybackDetails.d.ts +1 -2
- package/lib/typescript/models/VideoPlaybackEventName.d.ts +1 -1
- package/lib/typescript/models/VideoPlayerConfiguration.d.ts +13 -0
- package/lib/typescript/modules/FireworkSDKModule.d.ts +8 -4
- package/lib/typescript/modules/LiveStreamModule.d.ts +8 -0
- package/lib/typescript/modules/ShoppingModule.d.ts +4 -2
- package/package.json +3 -4
- package/react-native-firework-sdk.podspec +3 -1
- package/src/FireworkSDK.ts +49 -33
- package/src/LiveStream.ts +51 -0
- package/src/VideoShopping.ts +15 -13
- package/src/components/VideoFeed.tsx +69 -7
- package/src/index.tsx +32 -15
- package/src/models/AdBadgeConfiguration.ts +16 -0
- package/src/models/{ADConfig.ts → AdConfig.ts} +1 -1
- package/src/models/FWEventName.ts +14 -0
- package/src/models/FWEvents.ts +17 -13
- package/src/models/FeedItemDetails.ts +12 -4
- package/src/models/LiveStreamChatEventName.ts +8 -0
- package/src/models/LiveStreamEventDetails.ts +4 -0
- package/src/models/LiveStreamEventName.ts +16 -0
- package/src/models/LiveStreamMessageDetails.ts +14 -0
- package/src/models/VideoFeedConfiguration.ts +7 -3
- package/src/models/VideoFeedSource.ts +2 -0
- package/src/models/VideoPlaybackDetails.ts +1 -3
- package/src/models/VideoPlaybackEventName.ts +1 -1
- package/src/models/VideoPlayerConfiguration.ts +14 -0
- package/src/modules/FireworkSDKModule.ts +10 -4
- package/src/modules/LiveStreamModule.ts +26 -0
- package/src/modules/ShoppingModule.ts +14 -7
- package/android/src/main/java/com/reactnativefireworksdk/components/videofeed/FWVideoFeed.kt +0 -124
- package/android/src/main/java/com/reactnativefireworksdk/manager/FWVideoFeedManager.kt +0 -88
- package/android/src/main/java/com/reactnativefireworksdk/models/FWVideoFeedConfigModel.kt +0 -27
- package/android/src/main/java/com/reactnativefireworksdk/models/FWVideoFeedMode.kt +0 -7
- package/android/src/main/java/com/reactnativefireworksdk/models/FWVideoPlayerConfigModel.kt +0 -20
- package/android/src/main/java/com/reactnativefireworksdk/utils/FWVideoPlayerUtils.kt +0 -18
- package/lib/commonjs/models/ADConfig.js +0 -2
- package/lib/module/models/ADConfig.js +0 -2
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.default = void 0;
|
|
6
|
+
exports.default = exports.ShoppingModuleEventEmitter = void 0;
|
|
7
7
|
|
|
8
8
|
var _reactNative = require("react-native");
|
|
9
9
|
|
|
@@ -15,6 +15,8 @@ const ShoppingModule = _reactNative.NativeModules.ShoppingModule ? _reactNative.
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
});
|
|
18
|
+
const ShoppingModuleEventEmitter = new _reactNative.NativeEventEmitter(ShoppingModule);
|
|
19
|
+
exports.ShoppingModuleEventEmitter = ShoppingModuleEventEmitter;
|
|
18
20
|
var _default = ShoppingModule;
|
|
19
21
|
exports.default = _default;
|
|
20
22
|
//# sourceMappingURL=ShoppingModule.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["ShoppingModule.ts"],"names":["ShoppingModule","NativeModules","Proxy","get","Error","LINKING_ERROR"],"mappings":";;;;;;;AAAA;;
|
|
1
|
+
{"version":3,"sources":["ShoppingModule.ts"],"names":["ShoppingModule","NativeModules","Proxy","get","Error","LINKING_ERROR","ShoppingModuleEventEmitter","NativeEventEmitter"],"mappings":";;;;;;;AAAA;;AAGA;;AAEA,MAAMA,cAAc,GAAGC,2BAAcD,cAAd,GACnBC,2BAAcD,cADK,GAEnB,IAAIE,KAAJ,CACE,EADF,EAEE;AACEC,EAAAA,GAAG,GAAG;AACJ,UAAM,IAAIC,KAAJ,CAAUC,6BAAV,CAAN;AACD;;AAHH,CAFF,CAFJ;AA6BA,MAAMC,0BAA0B,GAAG,IAAIC,+BAAJ,CAAuBP,cAAvB,CAAnC;;eAGeA,c","sourcesContent":["import { NativeEventEmitter, NativeModule, NativeModules } from 'react-native';\nimport type Product from '../models/Product';\nimport type ProductInfoViewConfiguration from '../models/ProductInfoViewConfiguration';\nimport { LINKING_ERROR } from '../constants/FWErrorMessage';\n\nconst ShoppingModule = NativeModules.ShoppingModule\n ? NativeModules.ShoppingModule\n : new Proxy(\n {},\n {\n get() {\n throw new Error(LINKING_ERROR);\n },\n }\n );\n\ninterface IShoppingModule extends NativeModule {\n init(): void;\n updateVideoProducts(products: Product[], callbackId: number | string): void;\n updateProductViewConfig(\n config: ProductInfoViewConfiguration,\n callbackId: number | string\n ): void;\n updateAddToCartStatus(\n res: string,\n tips: string,\n callbackId: number | string\n ): void;\n jumpToCartPage(callbackId: number | string): void;\n exitCartPage(): void;\n setCartIconVisible(visible: boolean): void;\n setCartItemCount(count: number): void;\n}\n\nconst ShoppingModuleEventEmitter = new NativeEventEmitter(ShoppingModule);\nexport { ShoppingModuleEventEmitter };\n\nexport default ShoppingModule as IShoppingModule;\n"]}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
import { FWEventName } from './models/
|
|
5
|
-
import FireworkSDKModule from './modules/FireworkSDKModule';
|
|
3
|
+
import LiveStream from './LiveStream';
|
|
4
|
+
import { FWEventName } from './models/FWEventName';
|
|
5
|
+
import FireworkSDKModule, { FireworkSDKModuleEventEmitter } from './modules/FireworkSDKModule';
|
|
6
|
+
import LiveStreamModule from './modules/LiveStreamModule';
|
|
6
7
|
import ShoppingModule from './modules/ShoppingModule';
|
|
7
8
|
import VideoShopping from './VideoShopping';
|
|
8
9
|
|
|
@@ -11,69 +12,84 @@ import VideoShopping from './VideoShopping';
|
|
|
11
12
|
*/
|
|
12
13
|
class FireworkSDK {
|
|
13
14
|
/**
|
|
14
|
-
*
|
|
15
|
+
* The callback of SDK initialization.
|
|
15
16
|
*/
|
|
16
17
|
|
|
17
18
|
/**
|
|
18
|
-
*
|
|
19
|
+
* the callback of clicking Video Feed.
|
|
19
20
|
*/
|
|
20
21
|
|
|
21
22
|
/**
|
|
22
|
-
*
|
|
23
|
+
* The callback of clicking custom CTA.
|
|
23
24
|
*/
|
|
24
25
|
get onCustomCTAClick() {
|
|
25
26
|
return this._onCustomCTAClick;
|
|
26
27
|
}
|
|
27
|
-
/**
|
|
28
|
-
* Set Custom Clicking CTA callback.
|
|
29
|
-
*/
|
|
30
|
-
|
|
31
28
|
|
|
32
29
|
set onCustomCTAClick(value) {
|
|
33
30
|
this._onCustomCTAClick = value;
|
|
34
31
|
FireworkSDKModule.setCustomCTAClickEnabled(value ? true : false);
|
|
35
32
|
}
|
|
33
|
+
|
|
36
34
|
/**
|
|
37
|
-
*
|
|
35
|
+
* The callback of video playback.
|
|
38
36
|
*/
|
|
39
|
-
|
|
40
|
-
|
|
41
37
|
get onVideoPlayback() {
|
|
42
38
|
return this._onVideoPlayback;
|
|
43
39
|
}
|
|
44
|
-
/**
|
|
45
|
-
* Set Video Playback callback.
|
|
46
|
-
*/
|
|
47
|
-
|
|
48
40
|
|
|
49
41
|
set onVideoPlayback(value) {
|
|
50
42
|
this._onVideoPlayback = value;
|
|
51
43
|
FireworkSDKModule.setVideoPlaybackEventEnabled(value ? true : false);
|
|
52
44
|
}
|
|
45
|
+
|
|
53
46
|
/**
|
|
54
|
-
*
|
|
47
|
+
* The share base URL of videos.
|
|
55
48
|
*/
|
|
56
|
-
|
|
57
|
-
|
|
58
49
|
get shareBaseURL() {
|
|
59
50
|
return this._shareBaseURL;
|
|
60
51
|
}
|
|
61
|
-
/**
|
|
62
|
-
* set Share Base URL
|
|
63
|
-
*/
|
|
64
|
-
|
|
65
52
|
|
|
66
53
|
set shareBaseURL(value) {
|
|
67
54
|
this._shareBaseURL = value;
|
|
68
|
-
FireworkSDKModule.setShareBaseURL(value)
|
|
55
|
+
FireworkSDKModule.setShareBaseURL(value).then(() => {
|
|
56
|
+
this.eventEmitter.emit(FWEventName.ShareBaseURLUpdated);
|
|
57
|
+
});
|
|
69
58
|
}
|
|
70
59
|
|
|
60
|
+
/**
|
|
61
|
+
* The configuration for ad badges.
|
|
62
|
+
*/
|
|
63
|
+
get adBadgeConfiguration() {
|
|
64
|
+
return this._adBadgeConfiguration;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
set adBadgeConfiguration(value) {
|
|
68
|
+
this._adBadgeConfiguration = value;
|
|
69
|
+
FireworkSDKModule.setAdBadgeConfiguration(value).then(() => {
|
|
70
|
+
this.eventEmitter.emit(FWEventName.AdBadgeConfigurationUpdated);
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
get eventEmitter() {
|
|
75
|
+
return FireworkSDKModuleEventEmitter;
|
|
76
|
+
}
|
|
71
77
|
/**
|
|
72
78
|
* Get VideoShopping object.
|
|
73
79
|
*/
|
|
80
|
+
|
|
81
|
+
|
|
74
82
|
get shopping() {
|
|
75
83
|
return VideoShopping.getInstance();
|
|
76
84
|
}
|
|
85
|
+
/**
|
|
86
|
+
* Get LiveStream object.
|
|
87
|
+
*/
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
get liveStream() {
|
|
91
|
+
return LiveStream.getInstance();
|
|
92
|
+
}
|
|
77
93
|
/**
|
|
78
94
|
* Get global single instance of FireworkSDK class.
|
|
79
95
|
* @returns FireworkSDK
|
|
@@ -89,19 +105,18 @@ class FireworkSDK {
|
|
|
89
105
|
}
|
|
90
106
|
|
|
91
107
|
constructor() {
|
|
108
|
+
_defineProperty(this, "onSDKInit", void 0);
|
|
109
|
+
|
|
110
|
+
_defineProperty(this, "onVideoFeedClick", void 0);
|
|
111
|
+
|
|
92
112
|
_defineProperty(this, "_onCustomCTAClick", void 0);
|
|
93
113
|
|
|
94
114
|
_defineProperty(this, "_onVideoPlayback", void 0);
|
|
95
115
|
|
|
96
|
-
_defineProperty(this, "onVideoFeedClick", void 0);
|
|
97
|
-
|
|
98
116
|
_defineProperty(this, "_shareBaseURL", void 0);
|
|
99
117
|
|
|
100
|
-
_defineProperty(this, "
|
|
101
|
-
|
|
102
|
-
_defineProperty(this, "eventEmitter", void 0);
|
|
118
|
+
_defineProperty(this, "_adBadgeConfiguration", void 0);
|
|
103
119
|
|
|
104
|
-
this.eventEmitter = new NativeEventEmitter(FireworkSDKModule);
|
|
105
120
|
this.eventEmitter.addListener(FWEventName.SDKInit, event => {
|
|
106
121
|
if (this.onSDKInit) {
|
|
107
122
|
this.onSDKInit(event !== null && event !== void 0 ? event : {});
|
|
@@ -126,18 +141,19 @@ class FireworkSDK {
|
|
|
126
141
|
/**
|
|
127
142
|
* Initializes Firework SDK.
|
|
128
143
|
* @param {string?} userId An id to uniquely identify device or user.
|
|
129
|
-
* @param {
|
|
144
|
+
* @param {AdConfig?} adConfig Configuration of Ad.
|
|
130
145
|
*/
|
|
131
146
|
|
|
132
147
|
|
|
133
148
|
init(userId, adConfig) {
|
|
134
149
|
FireworkSDKModule.init(userId, adConfig);
|
|
135
150
|
ShoppingModule.init();
|
|
151
|
+
LiveStreamModule.init();
|
|
136
152
|
}
|
|
137
153
|
/**
|
|
138
154
|
* Open Video URL.
|
|
139
|
-
* @param {string} url
|
|
140
|
-
* @param {VideoPlayerConfiguration} config
|
|
155
|
+
* @param {string} url
|
|
156
|
+
* @param {VideoPlayerConfiguration} config
|
|
141
157
|
*/
|
|
142
158
|
|
|
143
159
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["FireworkSDK.ts"],"names":["
|
|
1
|
+
{"version":3,"sources":["FireworkSDK.ts"],"names":["LiveStream","FWEventName","FireworkSDKModule","FireworkSDKModuleEventEmitter","LiveStreamModule","ShoppingModule","VideoShopping","FireworkSDK","onCustomCTAClick","_onCustomCTAClick","value","setCustomCTAClickEnabled","onVideoPlayback","_onVideoPlayback","setVideoPlaybackEventEnabled","shareBaseURL","_shareBaseURL","setShareBaseURL","then","eventEmitter","emit","ShareBaseURLUpdated","adBadgeConfiguration","_adBadgeConfiguration","setAdBadgeConfiguration","AdBadgeConfigurationUpdated","shopping","getInstance","liveStream","_instance","constructor","addListener","SDKInit","event","onSDKInit","CustomCTAClick","VideoPlayback","VideoFeedClick","onVideoFeedClick","init","userId","adConfig","openVideoPlayer","url","config"],"mappings":";;AACA,OAAOA,UAAP,MAAuB,cAAvB;AAIA,SAASC,WAAT,QAA4B,sBAA5B;AAQA,OAAOC,iBAAP,IAA4BC,6BAA5B,QAAiE,6BAAjE;AACA,OAAOC,gBAAP,MAA6B,4BAA7B;AACA,OAAOC,cAAP,MAA2B,0BAA3B;AACA,OAAOC,aAAP,MAA0B,iBAA1B;;AAOA;AACA;AACA;AACA,MAAMC,WAAN,CAAkB;AAGhB;AACF;AACA;;AAGE;AACF;AACA;;AAGE;AACF;AACA;AAC6B,MAAhBC,gBAAgB,GAAuC;AAChE,WAAO,KAAKC,iBAAZ;AACD;;AAC0B,MAAhBD,gBAAgB,CAACE,KAAD,EAA4C;AACrE,SAAKD,iBAAL,GAAyBC,KAAzB;AACAR,IAAAA,iBAAiB,CAACS,wBAAlB,CAA2CD,KAAK,GAAG,IAAH,GAAU,KAA1D;AACD;;AAGD;AACF;AACA;AAC4B,MAAfE,eAAe,GAAsC;AAC9D,WAAO,KAAKC,gBAAZ;AACD;;AACyB,MAAfD,eAAe,CAACF,KAAD,EAA2C;AACnE,SAAKG,gBAAL,GAAwBH,KAAxB;AACAR,IAAAA,iBAAiB,CAACY,4BAAlB,CAA+CJ,KAAK,GAAG,IAAH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ie;;gBAAZrC,W;;AA8IN,eAAeA,WAAf","sourcesContent":["import type { NativeEventEmitter } from 'react-native';\nimport LiveStream from './LiveStream';\n\nimport type AdBadgeConfiguration from './models/AdBadgeConfiguration';\nimport type AdConfig from './models/AdConfig';\nimport { FWEventName } from './models/FWEventName';\nimport type {\n CustomCTAClickEvent,\n SDKInitEvent,\n VideoFeedClickEvent,\n VideoPlaybackEvent,\n} from './models/FWEvents';\nimport type VideoPlayerConfiguration from './models/VideoPlayerConfiguration';\nimport FireworkSDKModule, { 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,51 @@
|
|
|
1
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
|
+
|
|
3
|
+
import { FWEventName } from "./models/FWEventName";
|
|
4
|
+
import { LiveStreamModuleEventEmitter } from "./modules/LiveStreamModule";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The entry class of live stream.
|
|
8
|
+
*/
|
|
9
|
+
class LiveStream {
|
|
10
|
+
/**
|
|
11
|
+
* The callback of live stream event.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* The callback of live stream chat event.
|
|
16
|
+
*/
|
|
17
|
+
get eventEmitter() {
|
|
18
|
+
return LiveStreamModuleEventEmitter;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
static getInstance() {
|
|
22
|
+
if (!LiveStream._instance) {
|
|
23
|
+
LiveStream._instance = new LiveStream();
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return LiveStream._instance;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
constructor() {
|
|
30
|
+
_defineProperty(this, "onLiveStreamEvent", void 0);
|
|
31
|
+
|
|
32
|
+
_defineProperty(this, "onLiveStreamChatEvent", void 0);
|
|
33
|
+
|
|
34
|
+
this.eventEmitter.addListener(FWEventName.onLiveStreamEvent, event => {
|
|
35
|
+
if (this.onLiveStreamEvent) {
|
|
36
|
+
this.onLiveStreamEvent(event !== null && event !== void 0 ? event : {});
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
this.eventEmitter.addListener(FWEventName.onLiveStreamChatEvent, event => {
|
|
40
|
+
if (this.onLiveStreamChatEvent) {
|
|
41
|
+
this.onLiveStreamChatEvent(event !== null && event !== void 0 ? event : {});
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
_defineProperty(LiveStream, "_instance", void 0);
|
|
49
|
+
|
|
50
|
+
export default LiveStream;
|
|
51
|
+
//# sourceMappingURL=LiveStream.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["LiveStream.ts"],"names":["FWEventName","LiveStreamModuleEventEmitter","LiveStream","eventEmitter","getInstance","_instance","constructor","addListener","onLiveStreamEvent","event","onLiveStreamChatEvent"],"mappings":";;AACA,SAASA,WAAT,QAA4B,sBAA5B;AAEA,SAASC,4BAAT,QAA6C,4BAA7C;;AAKA;AACA;AACA;AACA,MAAMC,UAAN,CAAiB;AAGf;AACF;AACA;;AAEE;AACF;AACA;AAG0B,MAAZC,YAAY,GAAuB;AAC7C,WAAOF,4BAAP;AACD;;AAEwB,SAAXG,WAAW,GAAG;AAC1B,QAAI,CAACF,UAAU,CAACG,SAAhB,EAA2B;AACzBH,MAAAA,UAAU,CAACG,SAAX,GAAuB,IAAIH,UAAJ,EAAvB;AACD;;AAED,WAAOA,UAAU,CAACG,SAAlB;AACD;;AAEOC,EAAAA,WAAW,GAAG;AAAA;;AAAA;;AACpB,SAAKH,YAAL,CAAkBI,WAAlB,CAA8BP,WAAW,CAACQ,iBAA1C,EAA8DC,KAAD,IAAW;AACtE,UAAI,KAAKD,iBAAT,EAA4B;AAC1B,aAAKA,iBAAL,CAAuBC,KAAvB,aAAuBA,KAAvB,cAAuBA,KAAvB,GAAgC,EAAhC;AACD;AACF,KAJD;AAMA,SAAKN,YAAL,CAAkBI,WAAlB,CAA8BP,WAAW,CAACU,qBAA1C,EAAkED,KAAD,IAAW;AAC1E,UAAI,KAAKC,qBAAT,EAAgC;AAC9B,aAAKA,qBAAL,CAA2BD,KAA3B,aAA2BA,KAA3B,cAA2BA,KAA3B,GAAoC,EAApC;AACD;AACF,KAJD;AAKD;;AApCc;;gBAAXP,U;;AAuCN,eAAeA,UAAf","sourcesContent":["import type { NativeEventEmitter } from \"react-native\";\nimport { FWEventName } from \"./models/FWEventName\";\nimport type { LiveStreamChatEvent, LiveStreamEvent } from \"./models/FWEvents\";\nimport { LiveStreamModuleEventEmitter } from \"./modules/LiveStreamModule\";\n\nexport type onLiveStreamEventCallback = (event: LiveStreamEvent) => void;\nexport type onLiveStreamChatEventCallback = (event: LiveStreamChatEvent) => void;\n\n/**\n * The entry class of live stream.\n */\nclass LiveStream {\n private static _instance?: LiveStream;\n\n /**\n * The callback of live stream event.\n */\n public onLiveStreamEvent?: onLiveStreamEventCallback;\n /**\n * The callback of live stream chat event.\n */\n public onLiveStreamChatEvent?: onLiveStreamChatEventCallback;\n\n private get eventEmitter(): NativeEventEmitter {\n return LiveStreamModuleEventEmitter;\n }\n\n public static getInstance() {\n if (!LiveStream._instance) {\n LiveStream._instance = new LiveStream();\n }\n\n return LiveStream._instance!;\n }\n\n private constructor() {\n this.eventEmitter.addListener(FWEventName.onLiveStreamEvent, (event) => {\n if (this.onLiveStreamEvent) {\n this.onLiveStreamEvent(event ?? {});\n }\n });\n\n this.eventEmitter.addListener(FWEventName.onLiveStreamChatEvent, (event) => {\n if (this.onLiveStreamChatEvent) {\n this.onLiveStreamChatEvent(event ?? {});\n }\n });\n }\n}\n\nexport default LiveStream;\n"]}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import ShoppingModule from './modules/ShoppingModule';
|
|
3
|
+
import { FWEventName } from './models/FWEventName';
|
|
4
|
+
import ShoppingModule, { ShoppingModuleEventEmitter } from './modules/ShoppingModule';
|
|
6
5
|
|
|
7
6
|
/**
|
|
8
|
-
*
|
|
7
|
+
* The entry class of video shopping.
|
|
9
8
|
*/
|
|
10
9
|
class VideoShopping {
|
|
11
10
|
/**
|
|
@@ -23,7 +22,7 @@ class VideoShopping {
|
|
|
23
22
|
/**
|
|
24
23
|
* This callback is triggered when the video will be shown.
|
|
25
24
|
*
|
|
26
|
-
* The host app can return a Product
|
|
25
|
+
* The host app can return a Product list to update the latest product information.
|
|
27
26
|
*/
|
|
28
27
|
|
|
29
28
|
/**
|
|
@@ -44,6 +43,10 @@ class VideoShopping {
|
|
|
44
43
|
ShoppingModule.setCartIconVisible(value);
|
|
45
44
|
}
|
|
46
45
|
|
|
46
|
+
get eventEmitter() {
|
|
47
|
+
return ShoppingModuleEventEmitter;
|
|
48
|
+
}
|
|
49
|
+
|
|
47
50
|
static getInstance() {
|
|
48
51
|
if (!VideoShopping._instance) {
|
|
49
52
|
VideoShopping._instance = new VideoShopping();
|
|
@@ -53,8 +56,6 @@ class VideoShopping {
|
|
|
53
56
|
}
|
|
54
57
|
|
|
55
58
|
constructor() {
|
|
56
|
-
_defineProperty(this, "_cartIconVisible", true);
|
|
57
|
-
|
|
58
59
|
_defineProperty(this, "onAddToCart", void 0);
|
|
59
60
|
|
|
60
61
|
_defineProperty(this, "onClickCartIcon", void 0);
|
|
@@ -63,11 +64,10 @@ class VideoShopping {
|
|
|
63
64
|
|
|
64
65
|
_defineProperty(this, "onWillDisplayProduct", void 0);
|
|
65
66
|
|
|
66
|
-
_defineProperty(this, "
|
|
67
|
+
_defineProperty(this, "_cartIconVisible", true);
|
|
67
68
|
|
|
68
|
-
_defineProperty(this, "
|
|
69
|
+
_defineProperty(this, "currentCartPage", void 0);
|
|
69
70
|
|
|
70
|
-
this.eventEmitter = new NativeEventEmitter(ShoppingModule);
|
|
71
71
|
this.eventEmitter.addListener(FWEventName.AddToCart, event => {
|
|
72
72
|
this.handleAddToCartEvent(event);
|
|
73
73
|
});
|
|
@@ -130,10 +130,11 @@ class VideoShopping {
|
|
|
130
130
|
if (this.onUpdateProductDetails) {
|
|
131
131
|
const callbackId = event.callbackId;
|
|
132
132
|
delete event.callbackId;
|
|
133
|
-
const
|
|
133
|
+
const productList = await this.onUpdateProductDetails(event);
|
|
134
|
+
console.log('handleUpdateProductDetailsEvent productList', JSON.stringify(productList));
|
|
134
135
|
|
|
135
|
-
if (
|
|
136
|
-
ShoppingModule.
|
|
136
|
+
if (productList) {
|
|
137
|
+
ShoppingModule.updateVideoProducts(productList, callbackId);
|
|
137
138
|
}
|
|
138
139
|
}
|
|
139
140
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["VideoShopping.ts"],"names":["
|
|
1
|
+
{"version":3,"sources":["VideoShopping.ts"],"names":["FWEventName","ShoppingModule","ShoppingModuleEventEmitter","VideoShopping","cartIconVisible","_cartIconVisible","value","setCartIconVisible","eventEmitter","getInstance","_instance","constructor","addListener","AddToCart","event","handleAddToCartEvent","ClickCartIcon","handleClickCartIconEvent","UpdateProductDetails","handleUpdateProductDetailsEvent","WillDisplayProduct","handleWillDisplayProductEvent","exitCartPage","setCartItemCount","count","onAddToCart","callbackId","result","updateAddToCartStatus","res","tips","onClickCartIcon","cartPage","currentCartPage","jumpToCartPage","onUpdateProductDetails","productList","console","log","JSON","stringify","updateVideoProducts","onWillDisplayProduct","config","updateProductViewConfig"],"mappings":";;AAQA,SAASA,WAAT,QAA4B,sBAA5B;AAGA,OAAOC,cAAP,IAAyBC,0BAAzB,QAA2D,0BAA3D;;AAoBA;AACA;AACA;AACA,MAAMC,aAAN,CAAoB;AAGlB;AACF;AACA;AACA;AACA;;AAGE;AACF;AACA;AACA;AACA;;AAGE;AACF;AACA;AACA;AACA;;AAGE;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A,QAAI,KAAK4B,oBAAT,EAA+B;AAC7B,YAAMhB,UAAU,GAAGZ,KAAK,CAACY,UAAzB;AACA,aAAOZ,KAAK,CAACY,UAAb;AACA,YAAMiB,MAAM,GAAG,MAAM,KAAKD,oBAAL,CACnB5B,KADmB,CAArB;;AAGA,UAAI6B,MAAJ,EAAY;AACV1C,QAAAA,cAAc,CAAC2C,uBAAf,CAAuCD,MAAvC,EAA+CjB,UAA/C;AACD;AACF;AACF;;AArJiB;;gBAAdvB,a;;AAwJN,eAAeA,aAAf","sourcesContent":["import type { NativeEventEmitter } from 'react-native';\n\nimport type AddToCartResult from './models/AddToCartResult';\nimport type {\n AddToCartEvent,\n UpdateProductDetailsEvent,\n WillDisplayProductEvent,\n} from './models/FWEvents';\nimport { FWEventName } from './models/FWEventName';\nimport type Product from './models/Product';\nimport type ProductInfoViewConfiguration from './models/ProductInfoViewConfiguration';\nimport ShoppingModule, { ShoppingModuleEventEmitter } from './modules/ShoppingModule';\n\nexport type AddToCartCallback = (\n event: AddToCartEvent\n) => Promise<AddToCartResult | undefined | null>;\n\nexport type ClickCartIconCallback = () => Promise<\n React.ReactNode | undefined | null\n>;\n\nexport type UpdateProductDetailsCallback = (\n event: UpdateProductDetailsEvent\n) => Promise<Product[] | undefined | null>;\n\nexport type WillDisplayProductCallback = (\n event: WillDisplayProductEvent\n) => Promise<ProductInfoViewConfiguration | undefined | null>;\n\ntype CallbackInfo = { callbackId?: number | string };\n\n/**\n * The entry class of video shopping.\n */\nclass VideoShopping {\n private static _instance?: VideoShopping;\n\n /**\n * This callback is triggered when the user clicks the \"Add to cart\" button.\n *\n * The host app can return an AddToCartResult object to tell FireworkSDK the result of adding to cart.\n */\n public onAddToCart?: AddToCartCallback;\n\n /**\n * This callback is triggered when the user clicks the shopping cart icon.\n *\n * The host app can return a React.Node to integrate custom cart page to shopping flow.\n */\n public onClickCartIcon?: ClickCartIconCallback;\n\n /**\n * This callback is triggered when the video will be shown.\n *\n * The host app can return a Product list to update the latest product information.\n */\n public onUpdateProductDetails?: UpdateProductDetailsCallback;\n\n /**\n * This callback is triggered when the product will be shown.\n *\n * The host app can return a ProductInfoViewConfiguration object to configure \"Add to cart\" button style and cart icon style.\n */\n public onWillDisplayProduct?: WillDisplayProductCallback;\n\n /**\n * Defaults to true. You can hide the cart icon by setting this property to false. \n */\n public get cartIconVisible(): boolean {\n return this._cartIconVisible;\n }\n public set cartIconVisible(value: boolean) {\n this._cartIconVisible = value;\n ShoppingModule.setCartIconVisible(value);\n }\n private _cartIconVisible: boolean = true;\n\n public currentCartPage?: React.ReactNode;\n\n private get eventEmitter(): NativeEventEmitter {\n return ShoppingModuleEventEmitter;\n }\n\n public static getInstance() {\n if (!VideoShopping._instance) {\n VideoShopping._instance = new VideoShopping();\n }\n\n return VideoShopping._instance!;\n }\n\n private constructor() {\n this.eventEmitter.addListener(FWEventName.AddToCart, (event) => {\n this.handleAddToCartEvent(event);\n });\n\n this.eventEmitter.addListener(FWEventName.ClickCartIcon, (event) => {\n this.handleClickCartIconEvent(event);\n });\n\n this.eventEmitter.addListener(FWEventName.UpdateProductDetails, (event) => {\n this.handleUpdateProductDetailsEvent(event);\n });\n\n this.eventEmitter.addListener(FWEventName.WillDisplayProduct, (event) => {\n this.handleWillDisplayProductEvent(event);\n });\n }\n\n /**\n * Exit Cart Page.\n *\n * The host app can call this method to exit their cart page.\n */\n public exitCartPage() {\n ShoppingModule.exitCartPage();\n }\n\n /**\n * \n * @param {number} count The number of items in the host app cart\n */\n public setCartItemCount(count: number) {\n ShoppingModule.setCartItemCount(count);\n }\n\n private async handleAddToCartEvent(event: AddToCartEvent & CallbackInfo) {\n if (this.onAddToCart) {\n const callbackId = event.callbackId;\n delete event.callbackId;\n const result = await this.onAddToCart(event as AddToCartEvent);\n if (result) {\n ShoppingModule.updateAddToCartStatus(\n result.res,\n result.tips,\n callbackId!,\n );\n }\n }\n }\n\n private async handleClickCartIconEvent(event: CallbackInfo) {\n if (this.onClickCartIcon) {\n const callbackId = event.callbackId;\n delete event.callbackId;\n const cartPage = await this.onClickCartIcon();\n this.currentCartPage = cartPage;\n\n if (cartPage) {\n ShoppingModule.jumpToCartPage(callbackId!);\n }\n }\n }\n\n private async handleUpdateProductDetailsEvent(\n event: UpdateProductDetailsEvent & CallbackInfo\n ) {\n if (this.onUpdateProductDetails) {\n const callbackId = event.callbackId;\n delete event.callbackId;\n const productList = await this.onUpdateProductDetails(\n event as UpdateProductDetailsEvent\n );\n console.log('handleUpdateProductDetailsEvent productList', JSON.stringify(productList));\n if (productList) {\n ShoppingModule.updateVideoProducts(productList, callbackId!);\n }\n }\n }\n\n private async handleWillDisplayProductEvent(\n event: WillDisplayProductEvent & CallbackInfo\n ) {\n if (this.onWillDisplayProduct) {\n const callbackId = event.callbackId;\n delete event.callbackId;\n const config = await this.onWillDisplayProduct(\n event as WillDisplayProductEvent\n );\n if (config) {\n ShoppingModule.updateProductViewConfig(config, callbackId!);\n }\n }\n }\n}\n\nexport default VideoShopping;\n"]}
|
|
@@ -3,7 +3,10 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
|
|
|
3
3
|
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; }
|
|
4
4
|
|
|
5
5
|
import React from 'react';
|
|
6
|
-
import {
|
|
6
|
+
import { findNodeHandle, UIManager } from 'react-native';
|
|
7
|
+
import FireworkSDK from '../FireworkSDK';
|
|
8
|
+
import { FWEventName } from '../models/FWEventName';
|
|
9
|
+
import { FireworkSDKModuleEventEmitter } from '../modules/FireworkSDKModule';
|
|
7
10
|
import FWVideoFeed from './FWVideoFeed';
|
|
8
11
|
const NativeComponentName = 'FWVideoFeed';
|
|
9
12
|
export default class VideoFeed extends React.Component {
|
|
@@ -12,6 +15,8 @@ export default class VideoFeed extends React.Component {
|
|
|
12
15
|
|
|
13
16
|
_defineProperty(this, "nativeComponentRef", /*#__PURE__*/React.createRef());
|
|
14
17
|
|
|
18
|
+
_defineProperty(this, "subscriptions", []);
|
|
19
|
+
|
|
15
20
|
_defineProperty(this, "refresh", () => {
|
|
16
21
|
const nativeNodeHandle = findNodeHandle(this.nativeComponentRef.current);
|
|
17
22
|
UIManager.dispatchViewManagerCommand(findNodeHandle(nativeNodeHandle), UIManager.getViewManagerConfig(NativeComponentName).Commands.refresh, []);
|
|
@@ -36,19 +41,53 @@ export default class VideoFeed extends React.Component {
|
|
|
36
41
|
});
|
|
37
42
|
}
|
|
38
43
|
|
|
44
|
+
componentDidMount() {
|
|
45
|
+
const subscriptionOfShareBaseURLUpdated = FireworkSDKModuleEventEmitter.addListener(FWEventName.ShareBaseURLUpdated, () => {
|
|
46
|
+
this.setState({});
|
|
47
|
+
});
|
|
48
|
+
this.subscriptions.push(subscriptionOfShareBaseURLUpdated);
|
|
49
|
+
const subscriptionOfAdBadgeConfigurationUpdated = FireworkSDKModuleEventEmitter.addListener(FWEventName.AdBadgeConfigurationUpdated, () => {
|
|
50
|
+
this.setState({});
|
|
51
|
+
});
|
|
52
|
+
this.subscriptions.push(subscriptionOfAdBadgeConfigurationUpdated);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
componentWillUnmount() {
|
|
56
|
+
this.subscriptions.forEach(value => {
|
|
57
|
+
value.remove();
|
|
58
|
+
});
|
|
59
|
+
this.subscriptions = [];
|
|
60
|
+
}
|
|
61
|
+
|
|
39
62
|
render() {
|
|
40
|
-
var _videoFeedConfigurati, _videoFeedConfigurati2, _videoFeedConfigurati3;
|
|
63
|
+
var _videoFeedConfigurati, _videoFeedConfigurati2, _videoFeedConfigurati3, _FireworkSDK$getInsta, _FireworkSDK$getInsta2, _adBadgeConfiguration, _adBadgeConfiguration2, _adBadgeConfiguration3;
|
|
41
64
|
|
|
42
65
|
const {
|
|
43
66
|
source,
|
|
44
67
|
channel = '',
|
|
45
68
|
playlist = '',
|
|
69
|
+
playlistGroup = '',
|
|
46
70
|
mode = 'row',
|
|
47
71
|
videoFeedConfiguration
|
|
48
72
|
} = this.props;
|
|
49
73
|
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;
|
|
50
74
|
const titlePosition = (_videoFeedConfigurati3 = videoFeedConfiguration === null || videoFeedConfiguration === void 0 ? void 0 : videoFeedConfiguration.titlePosition) !== null && _videoFeedConfigurati3 !== void 0 ? _videoFeedConfigurati3 : 'nested';
|
|
51
|
-
const
|
|
75
|
+
const shareBaseURL = (_FireworkSDK$getInsta = FireworkSDK.getInstance().shareBaseURL) !== null && _FireworkSDK$getInsta !== void 0 ? _FireworkSDK$getInsta : '';
|
|
76
|
+
const adBadgeConfiguration = (_FireworkSDK$getInsta2 = FireworkSDK.getInstance().adBadgeConfiguration) !== null && _FireworkSDK$getInsta2 !== void 0 ? _FireworkSDK$getInsta2 : {};
|
|
77
|
+
const adBadgeTextType = (_adBadgeConfiguration = adBadgeConfiguration.badgeTextType) !== null && _adBadgeConfiguration !== void 0 ? _adBadgeConfiguration : '';
|
|
78
|
+
const backgroundColorOfAdBadge = (_adBadgeConfiguration2 = adBadgeConfiguration.backgroundColor) !== null && _adBadgeConfiguration2 !== void 0 ? _adBadgeConfiguration2 : '';
|
|
79
|
+
const textColorOfAdBadge = (_adBadgeConfiguration3 = adBadgeConfiguration.textColor) !== null && _adBadgeConfiguration3 !== void 0 ? _adBadgeConfiguration3 : '';
|
|
80
|
+
let key = `source:${source}`;
|
|
81
|
+
key += `_channel:${channel}`;
|
|
82
|
+
key += `_playlist:${playlist}`;
|
|
83
|
+
key += `_playlistGroup:${playlistGroup}`;
|
|
84
|
+
key += `_mode:${mode}`;
|
|
85
|
+
key += `_titleHidden:${titleHidden}`;
|
|
86
|
+
key += `_titlePosition:${titlePosition}`;
|
|
87
|
+
key += `_shareBaseURL:${shareBaseURL}`;
|
|
88
|
+
key += `_adBadgeTextType:${adBadgeTextType}`;
|
|
89
|
+
key += `_backgroundColorOfAdBadge:${backgroundColorOfAdBadge}`;
|
|
90
|
+
key += `_textColorOfAdBadge:${textColorOfAdBadge}`;
|
|
52
91
|
return /*#__PURE__*/React.createElement(FWVideoFeed, _extends({
|
|
53
92
|
key: key
|
|
54
93
|
}, this.props, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["VideoFeed.tsx"],"names":["React","UIManager","
|
|
1
|
+
{"version":3,"sources":["VideoFeed.tsx"],"names":["React","findNodeHandle","UIManager","FireworkSDK","FWEventName","FireworkSDKModuleEventEmitter","FWVideoFeed","NativeComponentName","VideoFeed","Component","createRef","nativeNodeHandle","nativeComponentRef","current","dispatchViewManagerCommand","getViewManagerConfig","Commands","refresh","event","name","reason","nativeEvent","props","onVideoFeedLoadFinished","componentDidMount","subscriptionOfShareBaseURLUpdated","addListener","ShareBaseURLUpdated","setState","subscriptions","push","subscriptionOfAdBadgeConfigurationUpdated","AdBadgeConfigurationUpdated","componentWillUnmount","forEach","value","remove","render","source","channel","playlist","playlistGroup","mode","videoFeedConfiguration","titleHidden","title","hidden","titlePosition","shareBaseURL","getInstance","adBadgeConfiguration","adBadgeTextType","badgeTextType","backgroundColorOfAdBadge","backgroundColor","textColorOfAdBadge","textColor","key","_onVideoFeedLoadFinished","Object","assign","style","zIndex"],"mappings":";;;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AAGA,SAEEC,cAFF,EAIEC,SAJF,QAMO,cANP;AAQA,OAAOC,WAAP,MAAwB,gBAAxB;AAEA,SAASC,WAAT,QAA4B,uBAA5B;AAIA,SAASC,6BAAT,QAA8C,8BAA9C;AACA,OAAOC,WAAP,MAAwB,eAAxB;AAiDA,MAAMC,mBAAmB,GAAG,aAA5B;AAEA,eAAe,MAAMC,SAAN,SAAwBR,KAAK,CAACS,SAA9B,CAAyD;AAAA;AAAA;;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a,EAArC;AACAS,IAAAA,GAAG,IAAK,oBAAmBN,eAAgB,EAA3C;AACAM,IAAAA,GAAG,IAAK,6BAA4BJ,wBAAyB,EAA7D;AACAI,IAAAA,GAAG,IAAK,uBAAsBF,kBAAmB,EAAjD;AAEA,wBACE,oBAAC,WAAD;AACE,MAAA,GAAG,EAAEE;AADP,OAEM,KAAKnC,KAFX;AAGE,MAAA,GAAG,EAAE,KAAKV,kBAHZ;AAIE,MAAA,uBAAuB,EAAE,KAAK8C,wBAJhC;AAKE,MAAA,IAAI,EAAEhB,IALR;AAME,MAAA,KAAK,EAAEiB,MAAM,CAACC,MAAP,CAAc,EAAd,EAAkB,KAAKtC,KAAL,CAAWuC,KAA7B,EAAoC;AAAEC,QAAAA,MAAM,EAAE,CAAC;AAAX,OAApC;AANT,OADF;AAUD;;AArGqE;;gBAAnDtD,S,kBACG;AACpBkC,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"]}
|
package/lib/module/index.js
CHANGED
|
@@ -2,9 +2,12 @@ import { AppRegistry } from 'react-native';
|
|
|
2
2
|
import CartContainer from './components/CartContainer';
|
|
3
3
|
import VideoFeed from './components/VideoFeed';
|
|
4
4
|
import FireworkSDK from './FireworkSDK';
|
|
5
|
+
import LiveStream from './LiveStream';
|
|
6
|
+
import LiveStreamEventName from './models/LiveStreamEventName';
|
|
7
|
+
import LiveStreamChatEventName from './models/LiveStreamChatEventName';
|
|
5
8
|
import VideoPlaybackEventName from './models/VideoPlaybackEventName';
|
|
6
9
|
import VideoShopping from './VideoShopping';
|
|
7
10
|
AppRegistry.registerComponent('FWShoppingCartPage', () => CartContainer);
|
|
8
11
|
export default FireworkSDK;
|
|
9
|
-
export { VideoFeed, VideoPlaybackEventName, VideoShopping };
|
|
12
|
+
export { LiveStream, LiveStreamEventName, LiveStreamChatEventName, VideoFeed, VideoPlaybackEventName, VideoShopping };
|
|
10
13
|
//# sourceMappingURL=index.js.map
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index.tsx"],"names":["AppRegistry","CartContainer","VideoFeed","FireworkSDK","VideoPlaybackEventName","VideoShopping","registerComponent"],"mappings":"AAAA,SAASA,WAAT,QAA4B,cAA5B;AAEA,OAAOC,aAAP,MAA0B,4BAA1B;
|
|
1
|
+
{"version":3,"sources":["index.tsx"],"names":["AppRegistry","CartContainer","VideoFeed","FireworkSDK","LiveStream","LiveStreamEventName","LiveStreamChatEventName","VideoPlaybackEventName","VideoShopping","registerComponent"],"mappings":"AAAA,SAASA,WAAT,QAA4B,cAA5B;AAEA,OAAOC,aAAP,MAA0B,4BAA1B;AAEA,OAAOC,SAAP,MAAsB,wBAAtB;AAOA,OAAOC,WAAP,MAAwB,eAAxB;AAKA,OAAOC,UAAP,MAAuB,cAAvB;AAkBA,OAAOC,mBAAP,MAAgC,8BAAhC;AAEA,OAAOC,uBAAP,MAAoC,kCAApC;AAeA,OAAOC,sBAAP,MAAmC,iCAAnC;AAcA,OAAOC,aAAP,MAA0B,iBAA1B;AAEAR,WAAW,CAACS,iBAAZ,CAA8B,oBAA9B,EAAoD,MAAMR,aAA1D;AAEA,eAAeE,WAAf;AAEA,SAcEC,UAdF,EAkBEC,mBAlBF,EAoBEC,uBApBF,EA+BEJ,SA/BF,EA2CEK,sBA3CF,EAiDEC,aAjDF","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 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export let FWEventName;
|
|
2
|
+
|
|
3
|
+
(function (FWEventName) {
|
|
4
|
+
FWEventName["SDKInit"] = "fw:sdk-init";
|
|
5
|
+
FWEventName["CustomCTAClick"] = "fw:custom-cta-click";
|
|
6
|
+
FWEventName["VideoPlayback"] = "fw:video-playback";
|
|
7
|
+
FWEventName["VideoFeedClick"] = "fw:video-feed-click";
|
|
8
|
+
FWEventName["AddToCart"] = "fw:shopping:add-to-cart";
|
|
9
|
+
FWEventName["ClickCartIcon"] = "fw:shopping:click-cart-icon";
|
|
10
|
+
FWEventName["UpdateProductDetails"] = "fw:shopping:update-product-details";
|
|
11
|
+
FWEventName["WillDisplayProduct"] = "fw:shopping:will-display-product";
|
|
12
|
+
FWEventName["onLiveStreamEvent"] = "fw:livestream";
|
|
13
|
+
FWEventName["onLiveStreamChatEvent"] = "fw:livestream-chat";
|
|
14
|
+
FWEventName["ShareBaseURLUpdated"] = "fw:share-base-url-updated";
|
|
15
|
+
FWEventName["AdBadgeConfigurationUpdated"] = "fw:ad-badge-configuration-updated";
|
|
16
|
+
})(FWEventName || (FWEventName = {}));
|
|
17
|
+
//# sourceMappingURL=FWEventName.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["FWEventName.ts"],"names":["FWEventName"],"mappings":"AAAA,WAAYA,WAAZ;;WAAYA,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,KAAAA,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"]}
|