react-native-firework-sdk 1.1.0 → 1.2.0-beta.10
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 +6 -1
- package/android/src/main/java/com/fireworksdk/bridge/{reactnative/FireworkSDKPackage.kt → FireworkSDKPackage.kt} +4 -2
- package/android/src/main/java/com/fireworksdk/bridge/components/videofeed/FWVideoFeed.kt +19 -6
- package/android/src/main/java/com/fireworksdk/bridge/models/FWEventName.kt +1 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoFeedConfigModel.kt +2 -1
- 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 +10 -0
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/models/FWVideoShoppingInterface.kt +2 -2
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/models/FireworkSDKInterface.kt +3 -1
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FWNavigatorModule.kt +53 -0
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FWVideoShoppingModule.kt +4 -15
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FireworkSDKModule.kt +41 -7
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/pages/FWContainerActivity.kt +66 -0
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/utils/FWDataUtils.kt +119 -0
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/utils/FWEventUtils.kt +50 -3
- package/android/src/main/java/com/fireworksdk/bridge/utils/FWBundleUtils.kt +86 -0
- package/android/src/main/java/com/fireworksdk/bridge/utils/FWDateUtils.kt +15 -0
- package/android/src/main/java/com/fireworksdk/bridge/utils/FWVideoPlayerUtils.kt +12 -2
- 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 +202 -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 +32 -0
- package/ios/Modules/FWNavigatorModule/FWNavigatorModule.m +17 -0
- package/ios/Modules/FWNavigatorModule/FWNavigatorModule.swift +89 -0
- package/ios/Modules/FWNavigatorModule/FWNavigatorProtocol.swift +13 -0
- package/ios/Modules/FireworkSDKModule/FireworkSDKModule+CTA.swift +24 -1
- package/ios/Modules/FireworkSDKModule/FireworkSDKModule.m +3 -1
- package/ios/Modules/FireworkSDKModule/FireworkSDKModule.swift +51 -31
- package/ios/Modules/Shopping/CartViewController.swift +6 -1
- package/ios/Modules/Shopping/ShoppingModule.m +1 -2
- package/ios/Modules/Shopping/ShoppingModule.swift +10 -12
- package/lib/commonjs/FWNavigator.js +66 -0
- package/lib/commonjs/FWNavigator.js.map +1 -0
- package/lib/commonjs/FireworkSDK.js +59 -5
- package/lib/commonjs/FireworkSDK.js.map +1 -1
- package/lib/commonjs/LiveStream.js +2 -2
- package/lib/commonjs/LiveStream.js.map +1 -1
- package/lib/commonjs/VideoShopping.js +4 -18
- package/lib/commonjs/VideoShopping.js.map +1 -1
- package/lib/commonjs/components/FWVideoFeed.js.map +1 -1
- package/lib/commonjs/components/VideoFeed.js +33 -1
- package/lib/commonjs/components/VideoFeed.js.map +1 -1
- package/lib/commonjs/constants/FWErrorMessage.js.map +1 -1
- package/lib/commonjs/index.js +10 -8
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/models/FWEventName.js +3 -2
- package/lib/commonjs/models/FWEventName.js.map +1 -1
- package/lib/commonjs/models/NewNativeContainerProps.js +2 -0
- package/lib/commonjs/models/{AdConfig.js.map → NewNativeContainerProps.js.map} +0 -0
- package/lib/commonjs/models/VideoFeedSource.js +0 -4
- 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/modules/LiveStreamModule.js.map +1 -1
- package/lib/commonjs/modules/ShoppingModule.js.map +1 -1
- package/lib/commonjs/utils/FWLoggerUtil.js +45 -0
- package/lib/commonjs/utils/FWLoggerUtil.js.map +1 -0
- package/lib/module/FWNavigator.js +49 -0
- package/lib/module/FWNavigator.js.map +1 -0
- package/lib/module/FireworkSDK.js +54 -5
- package/lib/module/FireworkSDK.js.map +1 -1
- package/lib/module/LiveStream.js +4 -4
- package/lib/module/LiveStream.js.map +1 -1
- package/lib/module/VideoShopping.js +4 -18
- package/lib/module/VideoShopping.js.map +1 -1
- package/lib/module/components/FWVideoFeed.js +1 -1
- package/lib/module/components/FWVideoFeed.js.map +1 -1
- package/lib/module/components/VideoFeed.js +33 -1
- package/lib/module/components/VideoFeed.js.map +1 -1
- package/lib/module/constants/FWErrorMessage.js.map +1 -1
- package/lib/module/index.js +3 -5
- package/lib/module/index.js.map +1 -1
- package/lib/module/models/FWEventName.js +3 -2
- package/lib/module/models/FWEventName.js.map +1 -1
- package/lib/module/models/NewNativeContainerProps.js +2 -0
- package/lib/module/models/{AdConfig.js.map → NewNativeContainerProps.js.map} +0 -0
- package/lib/module/models/VideoFeedSource.js +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/modules/LiveStreamModule.js.map +1 -1
- package/lib/module/modules/ShoppingModule.js.map +1 -1
- package/lib/module/utils/FWLoggerUtil.js +36 -0
- package/lib/module/utils/FWLoggerUtil.js.map +1 -0
- package/lib/typescript/FWNavigator.d.ts +24 -0
- package/lib/typescript/FireworkSDK.d.ts +21 -4
- package/lib/typescript/LiveStream.d.ts +1 -1
- package/lib/typescript/VideoShopping.d.ts +2 -9
- package/lib/typescript/components/VideoFeed.d.ts +8 -1
- package/lib/typescript/constants/FWErrorMessage.d.ts +1 -1
- package/lib/typescript/index.d.ts +6 -5
- package/lib/typescript/models/FWEventName.d.ts +4 -3
- package/lib/typescript/models/FeedItemDetails.d.ts +1 -1
- package/lib/typescript/models/NewNativeContainerProps.d.ts +6 -0
- package/lib/typescript/models/VideoFeedConfiguration.d.ts +4 -0
- package/lib/typescript/models/VideoFeedSource.d.ts +1 -2
- package/lib/typescript/modules/FWNavigatorModule.d.ts +11 -0
- package/lib/typescript/modules/FireworkSDKModule.d.ts +5 -4
- package/lib/typescript/modules/ShoppingModule.d.ts +2 -2
- package/lib/typescript/utils/FWLoggerUtil.d.ts +6 -0
- package/package.json +3 -1
- package/react-native-firework-sdk.podspec +1 -1
- package/src/FWNavigator.tsx +49 -0
- package/src/FireworkSDK.ts +57 -8
- package/src/LiveStream.ts +9 -7
- package/src/VideoShopping.ts +10 -21
- package/src/components/FWVideoFeed.tsx +5 -5
- package/src/components/VideoFeed.tsx +48 -14
- package/src/constants/FWErrorMessage.ts +1 -3
- package/src/index.tsx +9 -10
- package/src/models/AdBadgeConfiguration.ts +1 -1
- package/src/models/FWError.ts +1 -1
- package/src/models/FWEventName.ts +3 -2
- package/src/models/FWEvents.ts +1 -1
- package/src/models/FeedItemDetails.ts +2 -2
- package/src/models/LiveStreamEventDetails.ts +1 -1
- package/src/models/LiveStreamMessageDetails.ts +1 -1
- package/src/models/NewNativeContainerProps.ts +4 -0
- package/src/models/VideoFeedConfiguration.ts +6 -2
- package/src/models/VideoFeedSource.ts +6 -2
- package/src/models/VideoPlayerConfiguration.ts +2 -2
- package/src/modules/FWNavigatorModule.ts +22 -0
- package/src/modules/FireworkSDKModule.ts +5 -6
- package/src/modules/LiveStreamModule.ts +1 -5
- package/src/modules/ShoppingModule.ts +5 -2
- package/src/utils/FWLoggerUtil.ts +40 -0
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/pages/FWVideoShoppingCartActivity.kt +0 -43
- package/ios/Modules/FireworkSDKModule/MobileADConfiguration.swift +0 -17
- package/lib/commonjs/components/CartContainer.js +0 -35
- package/lib/commonjs/components/CartContainer.js.map +0 -1
- package/lib/commonjs/models/AdConfig.js +0 -2
- package/lib/module/components/CartContainer.js +0 -18
- package/lib/module/components/CartContainer.js.map +0 -1
- package/lib/module/models/AdConfig.js +0 -2
- package/lib/typescript/components/CartContainer.d.ts +0 -3
- package/lib/typescript/models/AdConfig.d.ts +0 -10
- package/src/components/CartContainer.tsx +0 -20
- package/src/models/AdConfig.ts +0 -10
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["FWErrorMessage.ts"],"names":["LINKING_ERROR","Platform","select","ios","default"],"mappings":";;;;;;;AAAA;;AAEA,MAAMA,aAAa,GAChB,oFAAD,GACAC,sBAASC,MAAT,CAAgB;AAAEC,EAAAA,GAAG,EAAE,gCAAP;AAAyCC,EAAAA,OAAO,EAAE;AAAlD,CAAhB,CADA,GAEA,sDAFA,GAGA,6CAJF","sourcesContent":["import { Platform } from 'react-native';\n\nconst LINKING_ERROR =\n `The package 'react-native-firework-sdk' doesn't seem to be linked. Make sure: \\n\\n` +\n Platform.select({ ios: \"- You have run 'pod install'\\n\", default: '' }) +\n '- You rebuilt the app after installing the package\\n' +\n '- You are not using Expo managed workflow\\n';\n\
|
|
1
|
+
{"version":3,"sources":["FWErrorMessage.ts"],"names":["LINKING_ERROR","Platform","select","ios","default"],"mappings":";;;;;;;AAAA;;AAEA,MAAMA,aAAa,GAChB,oFAAD,GACAC,sBAASC,MAAT,CAAgB;AAAEC,EAAAA,GAAG,EAAE,gCAAP;AAAyCC,EAAAA,OAAO,EAAE;AAAlD,CAAhB,CADA,GAEA,sDAFA,GAGA,6CAJF","sourcesContent":["import { Platform } from 'react-native';\n\nconst LINKING_ERROR =\n `The package 'react-native-firework-sdk' doesn't seem to be linked. Make sure: \\n\\n` +\n Platform.select({ ios: \"- You have run 'pod install'\\n\", default: '' }) +\n '- You rebuilt the app after installing the package\\n' +\n '- You are not using Expo managed workflow\\n';\n\nexport { LINKING_ERROR };\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 () {
|
|
@@ -41,28 +47,24 @@ Object.defineProperty(exports, "VideoShopping", {
|
|
|
41
47
|
});
|
|
42
48
|
exports.default = void 0;
|
|
43
49
|
|
|
44
|
-
var _reactNative = require("react-native");
|
|
45
|
-
|
|
46
|
-
var _CartContainer = _interopRequireDefault(require("./components/CartContainer"));
|
|
47
|
-
|
|
48
50
|
var _VideoFeed = _interopRequireDefault(require("./components/VideoFeed"));
|
|
49
51
|
|
|
50
52
|
var _FireworkSDK = _interopRequireDefault(require("./FireworkSDK"));
|
|
51
53
|
|
|
52
|
-
var
|
|
54
|
+
var _FWNavigator = _interopRequireDefault(require("./FWNavigator"));
|
|
53
55
|
|
|
54
|
-
var
|
|
56
|
+
var _LiveStream = _interopRequireDefault(require("./LiveStream"));
|
|
55
57
|
|
|
56
58
|
var _LiveStreamChatEventName = _interopRequireDefault(require("./models/LiveStreamChatEventName"));
|
|
57
59
|
|
|
60
|
+
var _LiveStreamEventName = _interopRequireDefault(require("./models/LiveStreamEventName"));
|
|
61
|
+
|
|
58
62
|
var _VideoPlaybackEventName = _interopRequireDefault(require("./models/VideoPlaybackEventName"));
|
|
59
63
|
|
|
60
64
|
var _VideoShopping = _interopRequireDefault(require("./VideoShopping"));
|
|
61
65
|
|
|
62
66
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
63
67
|
|
|
64
|
-
_reactNative.AppRegistry.registerComponent('FWShoppingCartPage', () => _CartContainer.default);
|
|
65
|
-
|
|
66
68
|
var _default = _FireworkSDK.default;
|
|
67
69
|
exports.default = _default;
|
|
68
70
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index.tsx"],"names":["
|
|
1
|
+
{"version":3,"sources":["index.tsx"],"names":["FireworkSDK"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA;;AAQA;;AACA;;AAKA;;AAgBA;;AAEA;;AAiBA;;AAcA;;;;eAEeA,oB","sourcesContent":["import 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 { NewNativeContainerProps } from './models/NewNativeContainerProps';\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\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 NewNativeContainerProps,\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"]}
|
|
@@ -16,9 +16,10 @@ exports.FWEventName = FWEventName;
|
|
|
16
16
|
FWEventName["ClickCartIcon"] = "fw:shopping:click-cart-icon";
|
|
17
17
|
FWEventName["UpdateProductDetails"] = "fw:shopping:update-product-details";
|
|
18
18
|
FWEventName["WillDisplayProduct"] = "fw:shopping:will-display-product";
|
|
19
|
-
FWEventName["
|
|
20
|
-
FWEventName["
|
|
19
|
+
FWEventName["LiveStream"] = "fw:livestream";
|
|
20
|
+
FWEventName["LiveStreamChat"] = "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
|
|
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 LiveStream = 'fw:livestream',\n LiveStreamChat = 'fw:livestream-chat',\n ShareBaseURLUpdated = 'fw:share-base-url-updated',\n AdBadgeConfigurationUpdated = 'fw:ad-badge-configuration-updated',\n LogMessage = 'fw:log-message',\n}\n"]}
|
|
File without changes
|
|
@@ -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(props: { [key: string]: any }): Promise<boolean>;\n popNativeContainer(): Promise<boolean>;\n}\n\nconst FWNavigatorModuleEventEmitter = new NativeEventEmitter(FWNavigatorModule);\nexport { FWNavigatorModuleEventEmitter };\nexport default FWNavigatorModule as IFWNavigatorModule;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["FireworkSDKModule.ts"],"names":["FireworkSDKModule","NativeModules","FireworkSDK","Proxy","get","Error","LINKING_ERROR","FireworkSDKModuleEventEmitter","NativeEventEmitter"],"mappings":";;;;;;;AAAA;;AAIA;;
|
|
1
|
+
{"version":3,"sources":["FireworkSDKModule.ts"],"names":["FireworkSDKModule","NativeModules","FireworkSDK","Proxy","get","Error","LINKING_ERROR","FireworkSDKModuleEventEmitter","NativeEventEmitter"],"mappings":";;;;;;;AAAA;;AAIA;;AAGA,MAAMA,iBAAiB,GAAGC,2BAAcC,WAAd,GACtBD,2BAAcC,WADQ,GAEtB,IAAIC,KAAJ,CACE,EADF,EAEE;AACEC,EAAAA,GAAG,GAAG;AACJ,UAAM,IAAIC,KAAJ,CAAUC,6BAAV,CAAN;AACD;;AAHH,CAFF,CAFJ;AAsBA,MAAMC,6BAA6B,GAAG,IAAIC,+BAAJ,CAAuBR,iBAAvB,CAAtC;;eAEeA,iB","sourcesContent":["import { NativeEventEmitter, NativeModule } from 'react-native';\nimport { NativeModules } from 'react-native';\nimport type AdBadgeConfiguration from '../models/AdBadgeConfiguration';\n\nimport { LINKING_ERROR } from '../constants/FWErrorMessage';\nimport type VideoPlayerConfiguration from '../models/VideoPlayerConfiguration';\n\nconst FireworkSDKModule = NativeModules.FireworkSDK\n ? NativeModules.FireworkSDK\n : new Proxy(\n {},\n {\n get() {\n throw new Error(LINKING_ERROR);\n },\n }\n );\n\ninterface IFireworkSDKModule extends NativeModule {\n init(userId?: string): void;\n openVideoPlayer(url: string, config?: VideoPlayerConfiguration): void;\n setCustomCTAClickEnabled(enabled: boolean): void;\n setCustomCTALinkContentPageRouteName(name?: string): Promise<any>;\n setShareBaseURL(url?: string): Promise<any>;\n setVideoPlaybackEventEnabled(enabled: boolean): void;\n setAdBadgeConfiguration(config?: AdBadgeConfiguration): Promise<any>;\n setAppComponentName(name?: string): Promise<any>;\n}\n\nconst FireworkSDKModuleEventEmitter = new NativeEventEmitter(FireworkSDKModule);\nexport { FireworkSDKModuleEventEmitter };\nexport default FireworkSDKModule as IFireworkSDKModule;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["LiveStreamModule.ts"],"names":["LiveStreamModule","NativeModules","Proxy","get","Error","LINKING_ERROR","LiveStreamModuleEventEmitter","NativeEventEmitter"],"mappings":";;;;;;;AAAA;;
|
|
1
|
+
{"version":3,"sources":["LiveStreamModule.ts"],"names":["LiveStreamModule","NativeModules","Proxy","get","Error","LINKING_ERROR","LiveStreamModuleEventEmitter","NativeEventEmitter"],"mappings":";;;;;;;AAAA;;AAEA;;AAEA,MAAMA,gBAAgB,GAAGC,2BAAcD,gBAAd,GACrBC,2BAAcD,gBADO,GAErB,IAAIE,KAAJ,CACE,EADF,EAEE;AACEC,EAAAA,GAAG,GAAG;AACJ,UAAM,IAAIC,KAAJ,CAAUC,6BAAV,CAAN;AACD;;AAHH,CAFF,CAFJ;AAcA,MAAMC,4BAA4B,GAAG,IAAIC,+BAAJ,CAAuBP,gBAAvB,CAArC;;eAGeA,gB","sourcesContent":["import { NativeEventEmitter, NativeModule, NativeModules } from 'react-native';\n\nimport { LINKING_ERROR } from '../constants/FWErrorMessage';\n\nconst LiveStreamModule = NativeModules.LiveStreamModule\n ? NativeModules.LiveStreamModule\n : new Proxy(\n {},\n {\n get() {\n throw new Error(LINKING_ERROR);\n },\n }\n );\n\ninterface ILiveStreamModule extends NativeModule {\n init(): void;\n}\nconst LiveStreamModuleEventEmitter = new NativeEventEmitter(LiveStreamModule);\nexport { LiveStreamModuleEventEmitter };\n\nexport default LiveStreamModule as ILiveStreamModule;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["ShoppingModule.ts"],"names":["ShoppingModule","NativeModules","Proxy","get","Error","LINKING_ERROR","ShoppingModuleEventEmitter","NativeEventEmitter"],"mappings":";;;;;;;AAAA;;AAGA;;
|
|
1
|
+
{"version":3,"sources":["ShoppingModule.ts"],"names":["ShoppingModule","NativeModules","Proxy","get","Error","LINKING_ERROR","ShoppingModuleEventEmitter","NativeEventEmitter"],"mappings":";;;;;;;AAAA;;AAGA;;AAGA,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;AA+BA,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';\nimport type { NewNativeContainerProps } from 'src/models/NewNativeContainerProps';\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(\n callbackId: number | string,\n props: NewNativeContainerProps\n ): 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"]}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
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; }
|
|
9
|
+
|
|
10
|
+
class FWLoggerUtil {
|
|
11
|
+
static log(message) {
|
|
12
|
+
if (FWLoggerUtil.enabled && process.env.NODE_ENV === 'development') {
|
|
13
|
+
const currentDate = new Date();
|
|
14
|
+
console.log('[react-native-firework-sdk]', `${message} ${FWLoggerUtil.toISOString(currentDate)}`);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
static logNativeMessage(nativeMessage) {
|
|
19
|
+
if (FWLoggerUtil.enabled && process.env.NODE_ENV === 'development') {
|
|
20
|
+
console.log('[react-native-firework-sdk] [native]', nativeMessage);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
static toISOString(date) {
|
|
25
|
+
let timezoneOffset = -date.getTimezoneOffset();
|
|
26
|
+
let timezoneSymbol = timezoneOffset >= 0 ? '+' : '-';
|
|
27
|
+
let timezoneHours = Math.floor(Math.abs(timezoneOffset) / 60).toString().padStart(2, '0');
|
|
28
|
+
let timezoneMinutes = (Math.abs(timezoneOffset) % 60).toString().padStart(2, '0');
|
|
29
|
+
let timezoneString = `${timezoneSymbol}${timezoneHours}:${timezoneMinutes}`;
|
|
30
|
+
let year = date.getFullYear().toString();
|
|
31
|
+
let month = (date.getMonth() + 1).toString().padStart(2, '0');
|
|
32
|
+
let day = date.getDate().toString().padStart(2, '0');
|
|
33
|
+
let hours = date.getHours().toString().padStart(2, '0');
|
|
34
|
+
let minutes = date.getMinutes().toString().padStart(2, '0');
|
|
35
|
+
let seconds = date.getSeconds().toString().padStart(2, '0');
|
|
36
|
+
let milliseconds = date.getMilliseconds().toString().padStart(3, '0');
|
|
37
|
+
return `${year}-${month}-${day}T${hours}:${minutes}:${seconds}.${milliseconds}${timezoneString}`;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
exports.default = FWLoggerUtil;
|
|
43
|
+
|
|
44
|
+
_defineProperty(FWLoggerUtil, "enabled", false);
|
|
45
|
+
//# sourceMappingURL=FWLoggerUtil.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["FWLoggerUtil.ts"],"names":["FWLoggerUtil","log","message","enabled","process","env","NODE_ENV","currentDate","Date","console","toISOString","logNativeMessage","nativeMessage","date","timezoneOffset","getTimezoneOffset","timezoneSymbol","timezoneHours","Math","floor","abs","toString","padStart","timezoneMinutes","timezoneString","year","getFullYear","month","getMonth","day","getDate","hours","getHours","minutes","getMinutes","seconds","getSeconds","milliseconds","getMilliseconds"],"mappings":";;;;;;;;;AAAe,MAAMA,YAAN,CAAmB;AAEtB,SAAHC,GAAG,CAACC,OAAD,EAAkB;AAC1B,QAAIF,YAAY,CAACG,OAAb,IAAwBC,OAAO,CAACC,GAAR,CAAYC,QAAZ,KAAyB,aAArD,EAAoE;AAClE,YAAMC,WAAW,GAAG,IAAIC,IAAJ,EAApB;AAEAC,MAAAA,OAAO,CAACR,GAAR,CACE,6BADF,EAEG,GAAEC,OAAQ,IAAGF,YAAY,CAACU,WAAb,CAAyBH,WAAzB,CAAsC,EAFtD;AAID;AACF;;AAEsB,SAAhBI,gBAAgB,CAACC,aAAD,EAAwB;AAC7C,QAAIZ,YAAY,CAACG,OAAb,IAAwBC,OAAO,CAACC,G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AlB,GAA6BC,QAA7B,CAAsC,CAAtC,EAAyC,GAAzC,CAAd;AACA,QAAIe,YAAY,GAAGxB,IAAI,CAACyB,eAAL,GAAuBjB,QAAvB,GAAkCC,QAAlC,CAA2C,CAA3C,EAA8C,GAA9C,CAAnB;AAEA,WAAQ,GAAEG,IAAK,IAAGE,KAAM,IAAGE,GAAI,IAAGE,KAAM,IAAGE,OAAQ,IAAGE,OAAQ,IAAGE,YAAa,GAAEb,cAAe,EAA/F;AACD;;AAtC+B;;;;gBAAbxB,Y,aACO,K","sourcesContent":["export default class FWLoggerUtil {\n static enabled: boolean = false;\n static log(message: string) {\n if (FWLoggerUtil.enabled && process.env.NODE_ENV === 'development') {\n const currentDate = new Date();\n\n console.log(\n '[react-native-firework-sdk]',\n `${message} ${FWLoggerUtil.toISOString(currentDate)}`\n );\n }\n }\n\n static logNativeMessage(nativeMessage: string) {\n if (FWLoggerUtil.enabled && process.env.NODE_ENV === 'development') {\n console.log('[react-native-firework-sdk] [native]', nativeMessage);\n }\n }\n\n private static toISOString(date: Date): string {\n let timezoneOffset = -date.getTimezoneOffset();\n let timezoneSymbol = timezoneOffset >= 0 ? '+' : '-';\n let timezoneHours = Math.floor(Math.abs(timezoneOffset) / 60)\n .toString()\n .padStart(2, '0');\n let timezoneMinutes = (Math.abs(timezoneOffset) % 60)\n .toString()\n .padStart(2, '0');\n let timezoneString = `${timezoneSymbol}${timezoneHours}:${timezoneMinutes}`;\n let year = date.getFullYear().toString();\n let month = (date.getMonth() + 1).toString().padStart(2, '0');\n let day = date.getDate().toString().padStart(2, '0');\n let hours = date.getHours().toString().padStart(2, '0');\n let minutes = date.getMinutes().toString().padStart(2, '0');\n let seconds = date.getSeconds().toString().padStart(2, '0');\n let milliseconds = date.getMilliseconds().toString().padStart(3, '0');\n\n return `${year}-${month}-${day}T${hours}:${minutes}:${seconds}.${milliseconds}${timezoneString}`;\n }\n}\n"]}
|
|
@@ -0,0 +1,49 @@
|
|
|
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 FWNavigatorModule, { FWNavigatorModuleEventEmitter } from './modules/FWNavigatorModule';
|
|
5
|
+
import FWLoggerUtil from './utils/FWLoggerUtil';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* You can use this class for pushing RN page from the native page.
|
|
9
|
+
*/
|
|
10
|
+
class FWNavigator {
|
|
11
|
+
static getInstance() {
|
|
12
|
+
if (!FWNavigator._instance) {
|
|
13
|
+
FWNavigator._instance = new FWNavigator();
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
return FWNavigator._instance;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
constructor() {
|
|
20
|
+
FWNavigatorModuleEventEmitter.addListener(FWEventName.LogMessage, () => {});
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Push a new native container. We will render your app component in new native container.
|
|
24
|
+
* Please set your app component name through FireworkSDK.getInstance().appComponentName before calling this method
|
|
25
|
+
* @param {FWNativeContainerProps} props We will pass the props to your app component.
|
|
26
|
+
* @returns {Promise<boolean>} The result of pushing RN page from native page.
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
pushNativeContainer(props) {
|
|
31
|
+
FWLoggerUtil.log(`Enter pushNewNativeContainer`);
|
|
32
|
+
return FWNavigatorModule.pushNativeContainer(props);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Pop top-most native container. The native container embed the RN page.
|
|
36
|
+
* @returns {Promise<boolean>} The result of poping top-most native container.
|
|
37
|
+
*/
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
popNativeContainer() {
|
|
41
|
+
return FWNavigatorModule.popNativeContainer();
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
_defineProperty(FWNavigator, "_instance", void 0);
|
|
47
|
+
|
|
48
|
+
export default FWNavigator;
|
|
49
|
+
//# sourceMappingURL=FWNavigator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["FWNavigator.tsx"],"names":["FWEventName","FWNavigatorModule","FWNavigatorModuleEventEmitter","FWLoggerUtil","FWNavigator","getInstance","_instance","constructor","addListener","LogMessage","pushNativeContainer","props","log","popNativeContainer"],"mappings":";;AAAA,SAASA,WAAT,QAA4B,sBAA5B;AACA,OAAOC,iBAAP,IACEC,6BADF,QAEO,6BAFP;AAGA,OAAOC,YAAP,MAAyB,sBAAzB;;AAMA;AACA;AACA;AACA,MAAMC,WAAN,CAAkB;AAGS,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;AACpBL,IAAAA,6BAA6B,CAACM,WAA9B,CAA0CR,WAAW,CAACS,UAAtD,EAAkE,MAAM,CAAE,CAA1E;AACD;AAED;AACF;AACA;AACA;AACA;AACA;;;AACSC,EAAAA,mBAAmB,CAACC,KAAD,EAAkD;AAC1ER,IAAAA,YAAY,CAACS,GAAb,CAAkB,8BAAlB;AAEA,WAAOX,iBAAiB,CAACS,mBAAlB,CAAsCC,KAAtC,CAAP;AACD;AAED;AACF;AACA;AACA;;;AACSE,EAAAA,kBAAkB,GAAqB;AAC5C,WAAOZ,iBAAiB,CAACY,kBAAlB,EAAP;AACD;;AAhCe;;gBAAZT,W;;AAmCN,eAAeA,WAAf","sourcesContent":["import { FWEventName } from './models/FWEventName';\nimport FWNavigatorModule, {\n FWNavigatorModuleEventEmitter,\n} from './modules/FWNavigatorModule';\nimport FWLoggerUtil from './utils/FWLoggerUtil';\n\ntype FWNativeContainerProps = {\n [key: string]: any;\n};\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\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 * Push a new native container. We will render your app component in new native container.\n * Please set your app component name through FireworkSDK.getInstance().appComponentName before calling this method\n * @param {FWNativeContainerProps} props We will pass the props to your app component.\n * @returns {Promise<boolean>} The result of pushing RN page from native page.\n */\n public pushNativeContainer(props: FWNativeContainerProps): Promise<boolean> {\n FWLoggerUtil.log(`Enter pushNewNativeContainer`);\n\n return FWNavigatorModule.pushNativeContainer(props);\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"]}
|
|
@@ -6,6 +6,8 @@ import FireworkSDKModule, { FireworkSDKModuleEventEmitter } from './modules/Fire
|
|
|
6
6
|
import LiveStreamModule from './modules/LiveStreamModule';
|
|
7
7
|
import ShoppingModule from './modules/ShoppingModule';
|
|
8
8
|
import VideoShopping from './VideoShopping';
|
|
9
|
+
import FWNavigator from './FWNavigator';
|
|
10
|
+
import FWLoggerUtil from './utils/FWLoggerUtil';
|
|
9
11
|
|
|
10
12
|
/**
|
|
11
13
|
* Entry class of Firework SDK, which supports the sdk initialization and global configuration.
|
|
@@ -27,10 +29,23 @@ class FireworkSDK {
|
|
|
27
29
|
}
|
|
28
30
|
|
|
29
31
|
set onCustomCTAClick(value) {
|
|
32
|
+
FWLoggerUtil.log(`Set onCustomCTAClick callback ${!!value}`);
|
|
30
33
|
this._onCustomCTAClick = value;
|
|
31
34
|
FireworkSDKModule.setCustomCTAClickEnabled(value ? true : false);
|
|
32
35
|
}
|
|
33
36
|
|
|
37
|
+
/**
|
|
38
|
+
* The custom CTA link content page route name.
|
|
39
|
+
*/
|
|
40
|
+
get customCTALinkContentPageRouteName() {
|
|
41
|
+
return this._customCTALinkContentPageRouteName;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
set customCTALinkContentPageRouteName(value) {
|
|
45
|
+
this._customCTALinkContentPageRouteName = value;
|
|
46
|
+
FireworkSDKModule.setCustomCTALinkContentPageRouteName(value !== null && value !== void 0 ? value : '');
|
|
47
|
+
}
|
|
48
|
+
|
|
34
49
|
/**
|
|
35
50
|
* The callback of video playback.
|
|
36
51
|
*/
|
|
@@ -52,7 +67,7 @@ class FireworkSDK {
|
|
|
52
67
|
|
|
53
68
|
set shareBaseURL(value) {
|
|
54
69
|
this._shareBaseURL = value;
|
|
55
|
-
FireworkSDKModule.setShareBaseURL(value).then(() => {
|
|
70
|
+
FireworkSDKModule.setShareBaseURL(value !== null && value !== void 0 ? value : '').then(() => {
|
|
56
71
|
this.eventEmitter.emit(FWEventName.ShareBaseURLUpdated);
|
|
57
72
|
});
|
|
58
73
|
}
|
|
@@ -66,11 +81,23 @@ class FireworkSDK {
|
|
|
66
81
|
|
|
67
82
|
set adBadgeConfiguration(value) {
|
|
68
83
|
this._adBadgeConfiguration = value;
|
|
69
|
-
FireworkSDKModule.setAdBadgeConfiguration(value).then(() => {
|
|
84
|
+
FireworkSDKModule.setAdBadgeConfiguration(value !== null && value !== void 0 ? value : {}).then(() => {
|
|
70
85
|
this.eventEmitter.emit(FWEventName.AdBadgeConfigurationUpdated);
|
|
71
86
|
});
|
|
72
87
|
}
|
|
73
88
|
|
|
89
|
+
/**
|
|
90
|
+
* The app component name.
|
|
91
|
+
*/
|
|
92
|
+
get appComponentName() {
|
|
93
|
+
return this._appComponentName;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
set appComponentName(value) {
|
|
97
|
+
this._appComponentName = value;
|
|
98
|
+
FireworkSDKModule.setAppComponentName(value !== null && value !== void 0 ? value : '');
|
|
99
|
+
}
|
|
100
|
+
|
|
74
101
|
get eventEmitter() {
|
|
75
102
|
return FireworkSDKModuleEventEmitter;
|
|
76
103
|
}
|
|
@@ -90,6 +117,14 @@ class FireworkSDK {
|
|
|
90
117
|
get liveStream() {
|
|
91
118
|
return LiveStream.getInstance();
|
|
92
119
|
}
|
|
120
|
+
/**
|
|
121
|
+
* Get FWNavigator object.
|
|
122
|
+
*/
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
get navigator() {
|
|
126
|
+
return FWNavigator.getInstance();
|
|
127
|
+
}
|
|
93
128
|
/**
|
|
94
129
|
* Get global single instance of FireworkSDK class.
|
|
95
130
|
* @returns FireworkSDK
|
|
@@ -111,28 +146,43 @@ class FireworkSDK {
|
|
|
111
146
|
|
|
112
147
|
_defineProperty(this, "_onCustomCTAClick", void 0);
|
|
113
148
|
|
|
149
|
+
_defineProperty(this, "_customCTALinkContentPageRouteName", void 0);
|
|
150
|
+
|
|
114
151
|
_defineProperty(this, "_onVideoPlayback", void 0);
|
|
115
152
|
|
|
116
153
|
_defineProperty(this, "_shareBaseURL", void 0);
|
|
117
154
|
|
|
118
155
|
_defineProperty(this, "_adBadgeConfiguration", void 0);
|
|
119
156
|
|
|
157
|
+
_defineProperty(this, "_appComponentName", void 0);
|
|
158
|
+
|
|
120
159
|
this.eventEmitter.addListener(FWEventName.SDKInit, event => {
|
|
160
|
+
FWLoggerUtil.log(`Receive SDKInit event ${event === null || event === void 0 ? void 0 : event.error}`);
|
|
161
|
+
|
|
121
162
|
if (this.onSDKInit) {
|
|
122
163
|
this.onSDKInit(event !== null && event !== void 0 ? event : {});
|
|
123
164
|
}
|
|
124
165
|
});
|
|
166
|
+
this.eventEmitter.addListener(FWEventName.LogMessage, event => {
|
|
167
|
+
FWLoggerUtil.logNativeMessage(event.message);
|
|
168
|
+
});
|
|
125
169
|
this.eventEmitter.addListener(FWEventName.CustomCTAClick, event => {
|
|
170
|
+
FWLoggerUtil.log(`Receive CustomCTAClick url ${event === null || event === void 0 ? void 0 : event.url}`);
|
|
171
|
+
|
|
126
172
|
if (this.onCustomCTAClick) {
|
|
127
173
|
this.onCustomCTAClick(event !== null && event !== void 0 ? event : {});
|
|
128
174
|
}
|
|
129
175
|
});
|
|
130
176
|
this.eventEmitter.addListener(FWEventName.VideoPlayback, event => {
|
|
177
|
+
FWLoggerUtil.log(`Receive VideoPlayback event ${event === null || event === void 0 ? void 0 : event.eventName}`);
|
|
178
|
+
|
|
131
179
|
if (this.onVideoPlayback) {
|
|
132
180
|
this.onVideoPlayback(event !== null && event !== void 0 ? event : {});
|
|
133
181
|
}
|
|
134
182
|
});
|
|
135
183
|
this.eventEmitter.addListener(FWEventName.VideoFeedClick, event => {
|
|
184
|
+
FWLoggerUtil.log(`Receive VideoFeedClick event ${event === null || event === void 0 ? void 0 : event.info.id}`);
|
|
185
|
+
|
|
136
186
|
if (this.onVideoFeedClick) {
|
|
137
187
|
this.onVideoFeedClick(event !== null && event !== void 0 ? event : {});
|
|
138
188
|
}
|
|
@@ -141,12 +191,11 @@ class FireworkSDK {
|
|
|
141
191
|
/**
|
|
142
192
|
* Initializes Firework SDK.
|
|
143
193
|
* @param {string?} userId An id to uniquely identify device or user.
|
|
144
|
-
* @param {AdConfig?} adConfig Configuration of Ad.
|
|
145
194
|
*/
|
|
146
195
|
|
|
147
196
|
|
|
148
|
-
init(userId
|
|
149
|
-
FireworkSDKModule.init(userId
|
|
197
|
+
init(userId) {
|
|
198
|
+
FireworkSDKModule.init(userId);
|
|
150
199
|
ShoppingModule.init();
|
|
151
200
|
LiveStreamModule.init();
|
|
152
201
|
}
|
|
@@ -1 +1 @@
|
|
|
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,GAAU,KAA9D;AACD;;AAGD;AACF;AACA;AACyB,MAAZK,YAAY,GAAuB;AAC5C,WAAO,KAAKC,aAAZ;AACD;;AACsB,MAAZD,YAAY,CAACL,KAAD,EAA4B;AACjD,SAAKM,aAAL,GAAqBN,KAArB;AACAR,IAAAA,iBAAiB,CAACe,eAAlB,CAAkCP,KAAlC,EAAyCQ,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AAW;AACnE,UAAI,KAAKzB,gBAAT,EAA2B;AACzB,aAAKA,gBAAL,CAAsByB,KAAtB,aAAsBA,KAAtB,cAAsBA,KAAtB,GAA+B,EAA/B;AACD;AACF,KAJD;AAMA,SAAKd,YAAL,CAAkBY,WAAlB,CAA8B9B,WAAW,CAACmC,aAA1C,EAA0DH,KAAD,IAAW;AAClE,UAAI,KAAKrB,eAAT,EAA0B;AACxB,aAAKA,eAAL,CAAqBqB,KAArB,aAAqBA,KAArB,cAAqBA,KAArB,GAA8B,EAA9B;AACD;AACF,KAJD;AAMA,SAAKd,YAAL,CAAkBY,WAAlB,CAA8B9B,WAAW,CAACoC,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;AAChDvC,IAAAA,iBAAiB,CAACqC,IAAlB,CAAuBC,MAAvB,EAA+BC,QAA/B;AACApC,IAAAA,cAAc,CAACkC,IAAf;AACAnC,IAAAA,gBAAgB,CAACmC,IAAjB;AACD;AAED;AACF;AACA;AACA;AACA;;;AACSG,EAAAA,eAAe,CAACC,GAAD,EAAcC,MAAd,EAAiD;AACrE1C,IAAAA,iBAAiB,CAACwC,eAAlB,CAAkCC,GAAlC,EAAuCC,MAAvC,aAAuCA,MAAvC,cAAuCA,MAAvC,GAAiD,EAAjD;AACD;;AA3Ie;;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"]}
|
|
1
|
+
{"version":3,"sources":["FireworkSDK.ts"],"names":["LiveStream","FWEventName","FireworkSDKModule","FireworkSDKModuleEventEmitter","LiveStreamModule","ShoppingModule","VideoShopping","FWNavigator","FWLoggerUtil","FireworkSDK","onCustomCTAClick","_onCustomCTAClick","value","log","setCustomCTAClickEnabled","customCTALinkContentPageRouteName","_customCTALinkContentPageRouteName","setCustomCTALinkContentPageRouteName","onVideoPlayback","_onVideoPlayback","setVideoPlaybackEventEnabled","shareBaseURL","_shareBaseURL","setShareBaseURL","then","eventEmitter","emit","ShareBaseURLUpdated","adBadgeConfiguration","_adBadgeConfiguration","setAdBadgeConfiguration","AdBadgeConfigurationUpdated","appComponentName","_appComponentName","setAppComponentName","shopping","getInstance","liveStream","navigator","_instance","constructor","addListener","SDKInit","event","error","onSDKInit","LogMessage","logNativeMessage","message","CustomCTAClick","url","VideoPlayback","eventName","VideoFeedClick","info","id","onVideoFeedClick","init","userId","openVideoPlayer","config"],"mappings":";;AACA,OAAOA,UAAP,MAAuB,cAAvB;AAGA,SAASC,WAAT,QAA4B,sBAA5B;AAQA,OAAOC,iBAAP,IACEC,6BADF,QAEO,6BAFP;AAGA,OAAOC,gBAAP,MAA6B,4BAA7B;AACA,OAAOC,cAAP,MAA2B,0BAA3B;AACA,OAAOC,aAAP,MAA0B,iBAA1B;AACA,OAAOC,WAAP,MAAwB,eAAxB;AACA,OAAOC,YAAP,MAAyB,sBAAzB;;AAUA;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;AACrEJ,IAAAA,YAAY,CAACK,GAAb,CAAkB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B,aAAsBA,KAAtB,cAAsBA,KAAtB,GAA+B,EAA/B;AACD;AACF,KAND;AAOD;AAED;AACF;AACA;AACA;;;AACSc,EAAAA,IAAI,CAACC,MAAD,EAAkB;AAC3BxD,IAAAA,iBAAiB,CAACuD,IAAlB,CAAuBC,MAAvB;AACArD,IAAAA,cAAc,CAACoD,IAAf;AACArD,IAAAA,gBAAgB,CAACqD,IAAjB;AACD;AAED;AACF;AACA;AACA;AACA;;;AACSE,EAAAA,eAAe,CAACT,GAAD,EAAcU,MAAd,EAAiD;AACrE1D,IAAAA,iBAAiB,CAACyD,eAAlB,CAAkCT,GAAlC,EAAuCU,MAAvC,aAAuCA,MAAvC,cAAuCA,MAAvC,GAAiD,EAAjD;AACD;;AAtLe;;gBAAZnD,W;;AAyLN,eAAeA,WAAf","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 CTA link content page route name.\n */\n public get customCTALinkContentPageRouteName(): string | undefined {\n return this._customCTALinkContentPageRouteName;\n }\n public set customCTALinkContentPageRouteName(value: string | undefined) {\n this._customCTALinkContentPageRouteName = value;\n FireworkSDKModule.setCustomCTALinkContentPageRouteName(value ?? '');\n }\n private _customCTALinkContentPageRouteName: string | 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 /**\n * The app component name.\n */\n public get appComponentName(): string | undefined {\n return this._appComponentName;\n }\n public set appComponentName(value: string | undefined) {\n this._appComponentName = value;\n FireworkSDKModule.setAppComponentName(value ?? '');\n }\n private _appComponentName: string | 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"]}
|
package/lib/module/LiveStream.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
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 { FWEventName } from
|
|
4
|
-
import { LiveStreamModuleEventEmitter } from
|
|
3
|
+
import { FWEventName } from './models/FWEventName';
|
|
4
|
+
import { LiveStreamModuleEventEmitter } from './modules/LiveStreamModule';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* The entry class of live stream.
|
|
@@ -31,12 +31,12 @@ class LiveStream {
|
|
|
31
31
|
|
|
32
32
|
_defineProperty(this, "onLiveStreamChatEvent", void 0);
|
|
33
33
|
|
|
34
|
-
this.eventEmitter.addListener(FWEventName.
|
|
34
|
+
this.eventEmitter.addListener(FWEventName.LiveStream, event => {
|
|
35
35
|
if (this.onLiveStreamEvent) {
|
|
36
36
|
this.onLiveStreamEvent(event !== null && event !== void 0 ? event : {});
|
|
37
37
|
}
|
|
38
38
|
});
|
|
39
|
-
this.eventEmitter.addListener(FWEventName.
|
|
39
|
+
this.eventEmitter.addListener(FWEventName.LiveStreamChat, event => {
|
|
40
40
|
if (this.onLiveStreamChatEvent) {
|
|
41
41
|
this.onLiveStreamChatEvent(event !== null && event !== void 0 ? event : {});
|
|
42
42
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["LiveStream.ts"],"names":["FWEventName","LiveStreamModuleEventEmitter","LiveStream","eventEmitter","getInstance","_instance","constructor","addListener","onLiveStreamEvent","
|
|
1
|
+
{"version":3,"sources":["LiveStream.ts"],"names":["FWEventName","LiveStreamModuleEventEmitter","LiveStream","eventEmitter","getInstance","_instance","constructor","addListener","event","onLiveStreamEvent","LiveStreamChat","onLiveStreamChatEvent"],"mappings":";;AACA,SAASA,WAAT,QAA4B,sBAA5B;AAEA,SAASC,4BAAT,QAA6C,4BAA7C;;AAOA;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,CAACE,UAA1C,EAAuDM,KAAD,IAAW;AAC/D,UAAI,KAAKC,iBAAT,EAA4B;AAC1B,aAAKA,iBAAL,CAAuBD,KAAvB,aAAuBA,KAAvB,cAAuBA,KAAvB,GAAgC,EAAhC;AACD;AACF,KAJD;AAMA,SAAKL,YAAL,CAAkBI,WAAlB,CAA8BP,WAAW,CAACU,cAA1C,EAA2DF,KAAD,IAAW;AACnE,UAAI,KAAKG,qBAAT,EAAgC;AAC9B,aAAKA,qBAAL,CAA2BH,KAA3B,aAA2BA,KAA3B,cAA2BA,KAA3B,GAAoC,EAApC;AACD;AACF,KAJD;AAKD;;AApCc;;gBAAXN,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 = (\n event: LiveStreamChatEvent\n) => 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.LiveStream, (event) => {\n if (this.onLiveStreamEvent) {\n this.onLiveStreamEvent(event ?? {});\n }\n });\n\n this.eventEmitter.addListener(FWEventName.LiveStreamChat, (event) => {\n if (this.onLiveStreamChatEvent) {\n this.onLiveStreamChatEvent(event ?? {});\n }\n });\n }\n}\n\nexport default LiveStream;\n"]}
|
|
@@ -32,7 +32,7 @@ class VideoShopping {
|
|
|
32
32
|
*/
|
|
33
33
|
|
|
34
34
|
/**
|
|
35
|
-
* Defaults to true. You can hide the cart icon by setting this property to false.
|
|
35
|
+
* Defaults to true. You can hide the cart icon by setting this property to false.
|
|
36
36
|
*/
|
|
37
37
|
get cartIconVisible() {
|
|
38
38
|
return this._cartIconVisible;
|
|
@@ -66,8 +66,6 @@ class VideoShopping {
|
|
|
66
66
|
|
|
67
67
|
_defineProperty(this, "_cartIconVisible", true);
|
|
68
68
|
|
|
69
|
-
_defineProperty(this, "currentCartPage", void 0);
|
|
70
|
-
|
|
71
69
|
this.eventEmitter.addListener(FWEventName.AddToCart, event => {
|
|
72
70
|
this.handleAddToCartEvent(event);
|
|
73
71
|
});
|
|
@@ -82,17 +80,7 @@ class VideoShopping {
|
|
|
82
80
|
});
|
|
83
81
|
}
|
|
84
82
|
/**
|
|
85
|
-
* Exit Cart Page.
|
|
86
83
|
*
|
|
87
|
-
* The host app can call this method to exit their cart page.
|
|
88
|
-
*/
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
exitCartPage() {
|
|
92
|
-
ShoppingModule.exitCartPage();
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
*
|
|
96
84
|
* @param {number} count The number of items in the host app cart
|
|
97
85
|
*/
|
|
98
86
|
|
|
@@ -117,11 +105,10 @@ class VideoShopping {
|
|
|
117
105
|
if (this.onClickCartIcon) {
|
|
118
106
|
const callbackId = event.callbackId;
|
|
119
107
|
delete event.callbackId;
|
|
120
|
-
const
|
|
121
|
-
this.currentCartPage = cartPage;
|
|
108
|
+
const props = await this.onClickCartIcon();
|
|
122
109
|
|
|
123
|
-
if (
|
|
124
|
-
ShoppingModule.jumpToCartPage(callbackId);
|
|
110
|
+
if (callbackId) {
|
|
111
|
+
ShoppingModule.jumpToCartPage(callbackId, props !== null && props !== void 0 ? props : {});
|
|
125
112
|
}
|
|
126
113
|
}
|
|
127
114
|
}
|
|
@@ -131,7 +118,6 @@ class VideoShopping {
|
|
|
131
118
|
const callbackId = event.callbackId;
|
|
132
119
|
delete event.callbackId;
|
|
133
120
|
const productList = await this.onUpdateProductDetails(event);
|
|
134
|
-
console.log('handleUpdateProductDetailsEvent productList', JSON.stringify(productList));
|
|
135
121
|
|
|
136
122
|
if (productList) {
|
|
137
123
|
ShoppingModule.updateVideoProducts(productList, callbackId);
|