react-native-firework-sdk 1.0.0-beta
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/README.md +39 -0
- package/android/build.gradle +193 -0
- package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/android/gradle/wrapper/gradle-wrapper.properties +5 -0
- package/android/gradle.properties +5 -0
- package/android/gradlew +185 -0
- package/android/gradlew.bat +89 -0
- package/android/publish.gradle +65 -0
- package/android/src/main/AndroidManifest.xml +16 -0
- package/android/src/main/java/com/reactnativefireworksdk/FireworkSDKPackage.kt +20 -0
- package/android/src/main/java/com/reactnativefireworksdk/components/videofeed/FWVideoFeed.kt +123 -0
- package/android/src/main/java/com/reactnativefireworksdk/constants/FWCommandConstant.kt +6 -0
- package/android/src/main/java/com/reactnativefireworksdk/constants/FWVideoPlayerConstant.kt +20 -0
- package/android/src/main/java/com/reactnativefireworksdk/manager/FWVideoFeedManager.kt +88 -0
- package/android/src/main/java/com/reactnativefireworksdk/models/FWEventName.kt +35 -0
- package/android/src/main/java/com/reactnativefireworksdk/models/FWVideoFeedConfigModel.kt +27 -0
- package/android/src/main/java/com/reactnativefireworksdk/models/FWVideoFeedItemDetailsModel.kt +11 -0
- package/android/src/main/java/com/reactnativefireworksdk/models/FWVideoFeedMode.kt +7 -0
- package/android/src/main/java/com/reactnativefireworksdk/models/FWVideoFeedSource.kt +7 -0
- package/android/src/main/java/com/reactnativefireworksdk/models/FWVideoFeedTitlePosition.kt +7 -0
- package/android/src/main/java/com/reactnativefireworksdk/models/FWVideoPlaybackDetails.kt +19 -0
- package/android/src/main/java/com/reactnativefireworksdk/models/FWVideoPlayerConfigModel.kt +20 -0
- package/android/src/main/java/com/reactnativefireworksdk/models/FWVideoShoppingInterface.kt +13 -0
- package/android/src/main/java/com/reactnativefireworksdk/models/FWVideoShoppingProduct.kt +34 -0
- package/android/src/main/java/com/reactnativefireworksdk/models/FireworkSDKInterface.kt +12 -0
- package/android/src/main/java/com/reactnativefireworksdk/module/FWVideoShoppingModule.kt +190 -0
- package/android/src/main/java/com/reactnativefireworksdk/module/FireworkSDKModule.kt +248 -0
- package/android/src/main/java/com/reactnativefireworksdk/pages/FWVideoShoppingCartActivity.kt +43 -0
- package/android/src/main/java/com/reactnativefireworksdk/utils/FWEventUtils.kt +127 -0
- package/android/src/main/java/com/reactnativefireworksdk/utils/FWJsonUtils.kt +57 -0
- package/android/src/main/java/com/reactnativefireworksdk/utils/FWLogUtils.kt +147 -0
- package/android/src/main/java/com/reactnativefireworksdk/utils/FWUrlUtils.kt +68 -0
- package/android/src/main/java/com/reactnativefireworksdk/utils/FWVideoPlayerUtils.kt +18 -0
- package/android/src/main/res/layout/fwrn_fragment_shoppingcart.xml +8 -0
- package/android/src/main/res/layout/fwrn_fragment_videofeed.xml +20 -0
- package/android/src/main/res/values/styles.xml +43 -0
- package/ios/Component/VideoFeed.swift +262 -0
- package/ios/Component/VideoFeedConfiguration.swift +32 -0
- package/ios/Component/VideoFeedManager.m +51 -0
- package/ios/Component/VideoFeedManager.swift +40 -0
- package/ios/Component/VideoPlayerConfiguration.swift +30 -0
- package/ios/FireworkSdk-Bridging-Header.h +6 -0
- package/ios/FireworkSdk.xcodeproj/project.pbxproj +291 -0
- package/ios/Models/FireworkJsEvent.swift +34 -0
- package/ios/Models/FireworkSDK+JsModel.swift +62 -0
- package/ios/Models/RCTConvert+FireworkSDKModule.swift +91 -0
- package/ios/Models/RCTConvert+Shopping.swift +49 -0
- package/ios/Models/RCTConvert+VideoFeed.swift +69 -0
- package/ios/Modules/FireworkSDKModule/FireworkSDKModule+CTA.swift +17 -0
- package/ios/Modules/FireworkSDKModule/FireworkSDKModule+EventTracking.swift +74 -0
- package/ios/Modules/FireworkSDKModule/FireworkSDKModule.m +19 -0
- package/ios/Modules/FireworkSDKModule/FireworkSDKModule.swift +106 -0
- package/ios/Modules/FireworkSDKModule/MobileADConfiguration.swift +17 -0
- package/ios/Modules/Shopping/CartViewController.swift +98 -0
- package/ios/Modules/Shopping/Product.swift +33 -0
- package/ios/Modules/Shopping/ProductInfoViewConfiguration.swift +24 -0
- package/ios/Modules/Shopping/ShoppingModule.m +19 -0
- package/ios/Modules/Shopping/ShoppingModule.swift +214 -0
- package/ios/Utils/String+Color.swift +38 -0
- package/ios/Utils/UIView+Constraints.swift +91 -0
- package/ios/Utils/UIView+ParentViewController.swift +21 -0
- package/ios/Utils/UIViewController+AttachChild.swift +69 -0
- package/lib/commonjs/FireworkSDK.js +171 -0
- package/lib/commonjs/FireworkSDK.js.map +1 -0
- package/lib/commonjs/VideoShopping.js +146 -0
- package/lib/commonjs/VideoShopping.js.map +1 -0
- package/lib/commonjs/components/CartContainer.js +35 -0
- package/lib/commonjs/components/CartContainer.js.map +1 -0
- package/lib/commonjs/components/FWVideoFeed.js +18 -0
- package/lib/commonjs/components/FWVideoFeed.js.map +1 -0
- package/lib/commonjs/components/VideoFeed.js +82 -0
- package/lib/commonjs/components/VideoFeed.js.map +1 -0
- package/lib/commonjs/constants/FWErrorMessage.js +15 -0
- package/lib/commonjs/constants/FWErrorMessage.js.map +1 -0
- package/lib/commonjs/index.js +44 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/models/ADConfig.js +2 -0
- package/lib/commonjs/models/ADConfig.js.map +1 -0
- package/lib/commonjs/models/AddToCartResult.js +2 -0
- package/lib/commonjs/models/AddToCartResult.js.map +1 -0
- package/lib/commonjs/models/FWError.js +2 -0
- package/lib/commonjs/models/FWError.js.map +1 -0
- package/lib/commonjs/models/FWEvents.js +20 -0
- package/lib/commonjs/models/FWEvents.js.map +1 -0
- package/lib/commonjs/models/FeedItemDetails.js +2 -0
- package/lib/commonjs/models/FeedItemDetails.js.map +1 -0
- package/lib/commonjs/models/Product.js +2 -0
- package/lib/commonjs/models/Product.js.map +1 -0
- package/lib/commonjs/models/ProductInfoViewConfiguration.js +2 -0
- package/lib/commonjs/models/ProductInfoViewConfiguration.js.map +1 -0
- package/lib/commonjs/models/ProductUnit.js +2 -0
- package/lib/commonjs/models/ProductUnit.js.map +1 -0
- package/lib/commonjs/models/VideoFeedConfiguration.js +2 -0
- package/lib/commonjs/models/VideoFeedConfiguration.js.map +1 -0
- package/lib/commonjs/models/VideoPlaybackDetails.js +2 -0
- package/lib/commonjs/models/VideoPlaybackDetails.js.map +1 -0
- package/lib/commonjs/models/VideoPlaybackEventName.js +23 -0
- package/lib/commonjs/models/VideoPlaybackEventName.js.map +1 -0
- package/lib/commonjs/models/VideoPlayerConfiguration.js +2 -0
- package/lib/commonjs/models/VideoPlayerConfiguration.js.map +1 -0
- package/lib/commonjs/modules/FireworkSDKModule.js +20 -0
- package/lib/commonjs/modules/FireworkSDKModule.js.map +1 -0
- package/lib/commonjs/modules/ShoppingModule.js +20 -0
- package/lib/commonjs/modules/ShoppingModule.js.map +1 -0
- package/lib/module/FireworkSDK.js +153 -0
- package/lib/module/FireworkSDK.js.map +1 -0
- package/lib/module/VideoShopping.js +134 -0
- package/lib/module/VideoShopping.js.map +1 -0
- package/lib/module/components/CartContainer.js +18 -0
- package/lib/module/components/CartContainer.js.map +1 -0
- package/lib/module/components/FWVideoFeed.js +8 -0
- package/lib/module/components/FWVideoFeed.js.map +1 -0
- package/lib/module/components/VideoFeed.js +66 -0
- package/lib/module/components/VideoFeed.js.map +1 -0
- package/lib/module/constants/FWErrorMessage.js +7 -0
- package/lib/module/constants/FWErrorMessage.js.map +1 -0
- package/lib/module/index.js +10 -0
- package/lib/module/index.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/AddToCartResult.js +2 -0
- package/lib/module/models/AddToCartResult.js.map +1 -0
- package/lib/module/models/FWError.js +2 -0
- package/lib/module/models/FWError.js.map +1 -0
- package/lib/module/models/FWEvents.js +13 -0
- package/lib/module/models/FWEvents.js.map +1 -0
- package/lib/module/models/FeedItemDetails.js +2 -0
- package/lib/module/models/FeedItemDetails.js.map +1 -0
- package/lib/module/models/Product.js +2 -0
- package/lib/module/models/Product.js.map +1 -0
- package/lib/module/models/ProductInfoViewConfiguration.js +2 -0
- package/lib/module/models/ProductInfoViewConfiguration.js.map +1 -0
- package/lib/module/models/ProductUnit.js +2 -0
- package/lib/module/models/ProductUnit.js.map +1 -0
- package/lib/module/models/VideoFeedConfiguration.js +2 -0
- package/lib/module/models/VideoFeedConfiguration.js.map +1 -0
- package/lib/module/models/VideoPlaybackDetails.js +2 -0
- package/lib/module/models/VideoPlaybackDetails.js.map +1 -0
- package/lib/module/models/VideoPlaybackEventName.js +16 -0
- package/lib/module/models/VideoPlaybackEventName.js.map +1 -0
- package/lib/module/models/VideoPlayerConfiguration.js +2 -0
- package/lib/module/models/VideoPlayerConfiguration.js.map +1 -0
- package/lib/module/modules/FireworkSDKModule.js +10 -0
- package/lib/module/modules/FireworkSDKModule.js.map +1 -0
- package/lib/module/modules/ShoppingModule.js +10 -0
- package/lib/module/modules/ShoppingModule.js.map +1 -0
- package/lib/typescript/FireworkSDK.d.ts +74 -0
- package/lib/typescript/VideoShopping.d.ts +54 -0
- package/lib/typescript/components/CartContainer.d.ts +3 -0
- package/lib/typescript/components/FWVideoFeed.d.ts +2 -0
- package/lib/typescript/components/VideoFeed.d.ts +53 -0
- package/lib/typescript/constants/FWErrorMessage.d.ts +2 -0
- package/lib/typescript/index.d.ts +25 -0
- package/lib/typescript/models/ADConfig.d.ts +10 -0
- package/lib/typescript/models/AddToCartResult.d.ts +10 -0
- package/lib/typescript/models/FWError.d.ts +10 -0
- package/lib/typescript/models/FWEvents.d.ts +55 -0
- package/lib/typescript/models/FeedItemDetails.d.ts +14 -0
- package/lib/typescript/models/Product.d.ts +19 -0
- package/lib/typescript/models/ProductInfoViewConfiguration.d.ts +18 -0
- package/lib/typescript/models/ProductUnit.d.ts +22 -0
- package/lib/typescript/models/VideoFeedConfiguration.d.ts +32 -0
- package/lib/typescript/models/VideoPlaybackDetails.d.ts +31 -0
- package/lib/typescript/models/VideoPlaybackEventName.d.ts +39 -0
- package/lib/typescript/models/VideoPlayerConfiguration.d.ts +25 -0
- package/lib/typescript/modules/FireworkSDKModule.d.ts +12 -0
- package/lib/typescript/modules/ShoppingModule.d.ts +13 -0
- package/package.json +147 -0
- package/react-native-firework-sdk.podspec +22 -0
- package/src/FireworkSDK.ts +153 -0
- package/src/VideoShopping.ts +165 -0
- package/src/components/CartContainer.tsx +20 -0
- package/src/components/FWVideoFeed.tsx +10 -0
- package/src/components/VideoFeed.tsx +109 -0
- package/src/constants/FWErrorMessage.ts +11 -0
- package/src/index.tsx +109 -0
- package/src/models/ADConfig.ts +10 -0
- package/src/models/AddToCartResult.ts +10 -0
- package/src/models/FWError.ts +10 -0
- package/src/models/FWEvents.ts +63 -0
- package/src/models/FeedItemDetails.ts +14 -0
- package/src/models/Product.ts +20 -0
- package/src/models/ProductInfoViewConfiguration.ts +20 -0
- package/src/models/ProductUnit.ts +23 -0
- package/src/models/VideoFeedConfiguration.ts +35 -0
- package/src/models/VideoPlaybackDetails.ts +33 -0
- package/src/models/VideoPlaybackEventName.ts +40 -0
- package/src/models/VideoPlayerConfiguration.ts +26 -0
- package/src/modules/FireworkSDKModule.ts +27 -0
- package/src/modules/ShoppingModule.ts +29 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.FWEventName = void 0;
|
|
7
|
+
let FWEventName;
|
|
8
|
+
exports.FWEventName = FWEventName;
|
|
9
|
+
|
|
10
|
+
(function (FWEventName) {
|
|
11
|
+
FWEventName["SDKInit"] = "fw:sdk-init";
|
|
12
|
+
FWEventName["CustomCTAClick"] = "fw:custom-cta-click";
|
|
13
|
+
FWEventName["VideoPlayback"] = "fw:video-playback";
|
|
14
|
+
FWEventName["VideoFeedClick"] = "fw:video-feed-click";
|
|
15
|
+
FWEventName["AddToCart"] = "fw:shopping:add-to-cart";
|
|
16
|
+
FWEventName["ClickCartIcon"] = "fw:shopping:click-cart-icon";
|
|
17
|
+
FWEventName["UpdateProductDetails"] = "fw:shopping:update-product-details";
|
|
18
|
+
FWEventName["WillDisplayProduct"] = "fw:shopping:will-display-product";
|
|
19
|
+
})(FWEventName || (exports.FWEventName = FWEventName = {}));
|
|
20
|
+
//# sourceMappingURL=FWEvents.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["FWEvents.ts"],"names":["FWEventName"],"mappings":";;;;;;IAKYA,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;GAAAA,W,2BAAAA,W","sourcesContent":["import type VideoPlaybackDetails from './VideoPlaybackDetails';\nimport type FWError from './FWError';\nimport type VideoPlaybackEventName from './VideoPlaybackEventName';\nimport type FeedItemDetails from './FeedItemDetails';\n\nexport 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}\n\nexport interface SDKInitEvent {\n /**\n * If error equals undefined/null, it means the initialization is successful.\n */\n error?: FWError | null;\n}\n\nexport interface CustomCTAClickEvent {\n /**\n * Action URL that is associated with this CTA\n */\n url: string;\n}\n\nexport interface VideoPlaybackEvent {\n eventName: VideoPlaybackEventName;\n info: VideoPlaybackDetails;\n}\n\nexport interface VideoFeedClickEvent {\n info: FeedItemDetails;\n}\n\nexport interface AddToCartEvent {\n /**\n * A unique identifier of the product.\n */\n productId: string;\n /**\n * A unique identifier of the product unit.\n */\n unitId: string;\n}\n\nexport interface UpdateProductDetailsEvent {\n /**\n * A unique identifier of the product.\n */\n productId: string;\n}\n\nexport interface WillDisplayProductEvent {\n /**\n * A unique identifier of the video.\n */\n videoId: string;\n}"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var VideoPlaybackEventName;
|
|
8
|
+
|
|
9
|
+
(function (VideoPlaybackEventName) {
|
|
10
|
+
VideoPlaybackEventName["Impression"] = "fw:video:impression";
|
|
11
|
+
VideoPlaybackEventName["Start"] = "fw:video:start";
|
|
12
|
+
VideoPlaybackEventName["FirstQuartile"] = "fw:video:first-quartile";
|
|
13
|
+
VideoPlaybackEventName["Midpoint"] = "fw:video:midpoint";
|
|
14
|
+
VideoPlaybackEventName["ThirdQuartile"] = "fw:video:third-quartile";
|
|
15
|
+
VideoPlaybackEventName["Complete"] = "fw:video:complete";
|
|
16
|
+
VideoPlaybackEventName["AdEnd"] = "fw:video:ad-end";
|
|
17
|
+
VideoPlaybackEventName["ClickCTA"] = "fw:video:click-cta";
|
|
18
|
+
VideoPlaybackEventName["ClickShare"] = "fw:video:click-share";
|
|
19
|
+
})(VideoPlaybackEventName || (VideoPlaybackEventName = {}));
|
|
20
|
+
|
|
21
|
+
var _default = VideoPlaybackEventName;
|
|
22
|
+
exports.default = _default;
|
|
23
|
+
//# sourceMappingURL=VideoPlaybackEventName.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["VideoPlaybackEventName.ts"],"names":["VideoPlaybackEventName"],"mappings":";;;;;;IAAKA,sB;;WAAAA,sB;AAAAA,EAAAA,sB;AAAAA,EAAAA,sB;AAAAA,EAAAA,sB;AAAAA,EAAAA,sB;AAAAA,EAAAA,sB;AAAAA,EAAAA,sB;AAAAA,EAAAA,sB;AAAAA,EAAAA,sB;AAAAA,EAAAA,sB;GAAAA,sB,KAAAA,sB;;eAuCUA,sB","sourcesContent":["enum VideoPlaybackEventName {\n /**\n * When video is shown to the user.\n */\n Impression = 'fw:video:impression',\n /**\n * Video started.\n */\n Start = 'fw:video:start',\n /**\n * Video reached 25%.\n */\n FirstQuartile = 'fw:video:first-quartile',\n /**\n * Video reached 50%.\n */\n Midpoint = 'fw:video:midpoint',\n /**\n * Video reached 75%.\n */\n ThirdQuartile = 'fw:video:third-quartile',\n /**\n * Video reached 100%.\n */\n Complete = 'fw:video:complete',\n /**\n * When ad video finishes playing\n */\n AdEnd = 'fw:video:ad-end',\n /**\n * When a visitor clicks on CTA button (if available).\n */\n ClickCTA = 'fw:video:click-cta',\n /**\n * When user clicks on \"Share\" button.\n */\n ClickShare = 'fw:video:click-share',\n}\n\nexport default VideoPlaybackEventName;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _reactNative = require("react-native");
|
|
9
|
+
|
|
10
|
+
var _FWErrorMessage = require("../constants/FWErrorMessage");
|
|
11
|
+
|
|
12
|
+
const FireworkSDKModule = _reactNative.NativeModules.FireworkSDK ? _reactNative.NativeModules.FireworkSDK : new Proxy({}, {
|
|
13
|
+
get() {
|
|
14
|
+
throw new Error(_FWErrorMessage.LINKING_ERROR);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
});
|
|
18
|
+
var _default = FireworkSDKModule;
|
|
19
|
+
exports.default = _default;
|
|
20
|
+
//# sourceMappingURL=FireworkSDKModule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["FireworkSDKModule.ts"],"names":["FireworkSDKModule","NativeModules","FireworkSDK","Proxy","get","Error","LINKING_ERROR"],"mappings":";;;;;;;AACA;;AAEA;;AAIA,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;eAmBeN,iB","sourcesContent":["import type { NativeModule } from 'react-native';\nimport { NativeModules } from 'react-native';\n\nimport { LINKING_ERROR } from '../constants/FWErrorMessage';\nimport type ADConfig from '../models/ADConfig';\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, adConfig?: ADConfig): void;\n openVideoPlayer(url: string, config?: VideoPlayerConfiguration): void;\n setCustomCTAClickEnabled(enabled: boolean): void;\n setShareBaseURL(url?: string): void;\n setVideoPlaybackEventEnabled(enabled: boolean): void;\n}\n\nexport default FireworkSDKModule as IFireworkSDKModule;\n"]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _reactNative = require("react-native");
|
|
9
|
+
|
|
10
|
+
var _FWErrorMessage = require("../constants/FWErrorMessage");
|
|
11
|
+
|
|
12
|
+
const ShoppingModule = _reactNative.NativeModules.ShoppingModule ? _reactNative.NativeModules.ShoppingModule : new Proxy({}, {
|
|
13
|
+
get() {
|
|
14
|
+
throw new Error(_FWErrorMessage.LINKING_ERROR);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
});
|
|
18
|
+
var _default = ShoppingModule;
|
|
19
|
+
exports.default = _default;
|
|
20
|
+
//# sourceMappingURL=ShoppingModule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["ShoppingModule.ts"],"names":["ShoppingModule","NativeModules","Proxy","get","Error","LINKING_ERROR"],"mappings":";;;;;;;AAAA;;AAMA;;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;eAoBeL,c","sourcesContent":["import {\n NativeModule,\n NativeModules,\n} 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 updateVideoProduct(production: Product, callbackId: number): void;\n updateProductViewConfig(config: ProductInfoViewConfiguration, callbackId: number): void;\n updateAddToCartStatus(res: string, tips: string, callbackId: number): void;\n jumpToCartPage(callbackId: number): void;\n exitCartPage(): void;\n}\n\nexport default ShoppingModule as IShoppingModule;\n"]}
|
|
@@ -0,0 +1,153 @@
|
|
|
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 { NativeEventEmitter } from 'react-native';
|
|
4
|
+
import { FWEventName } from './models/FWEvents';
|
|
5
|
+
import FireworkSDKModule from './modules/FireworkSDKModule';
|
|
6
|
+
import ShoppingModule from './modules/ShoppingModule';
|
|
7
|
+
import VideoShopping from './VideoShopping';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Entry class of Firework SDK, which supports the sdk initialization and global configuration.
|
|
11
|
+
*/
|
|
12
|
+
class FireworkSDK {
|
|
13
|
+
/**
|
|
14
|
+
* Clicking Video Feed callback
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* SDK initialization callback.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Get Custom Clicking CTA callback.
|
|
23
|
+
*/
|
|
24
|
+
get onCustomCTAClick() {
|
|
25
|
+
return this._onCustomCTAClick;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Set Custom Clicking CTA callback.
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
set onCustomCTAClick(value) {
|
|
33
|
+
this._onCustomCTAClick = value;
|
|
34
|
+
FireworkSDKModule.setCustomCTAClickEnabled(value ? true : false);
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Get Video Playback callback.
|
|
38
|
+
*/
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
get onVideoPlayback() {
|
|
42
|
+
return this._onVideoPlayback;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Set Video Playback callback.
|
|
46
|
+
*/
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
set onVideoPlayback(value) {
|
|
50
|
+
this._onVideoPlayback = value;
|
|
51
|
+
FireworkSDKModule.setVideoPlaybackEventEnabled(value ? true : false);
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* get Share Base URL
|
|
55
|
+
*/
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
get shareBaseURL() {
|
|
59
|
+
return this._shareBaseURL;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* set Share Base URL
|
|
63
|
+
*/
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
set shareBaseURL(value) {
|
|
67
|
+
this._shareBaseURL = value;
|
|
68
|
+
FireworkSDKModule.setShareBaseURL(value);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Get VideoShopping object.
|
|
73
|
+
*/
|
|
74
|
+
get shopping() {
|
|
75
|
+
return VideoShopping.getInstance();
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Get global single instance of FireworkSDK class.
|
|
79
|
+
* @returns FireworkSDK
|
|
80
|
+
*/
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
static getInstance() {
|
|
84
|
+
if (!FireworkSDK._instance) {
|
|
85
|
+
FireworkSDK._instance = new FireworkSDK();
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
return FireworkSDK._instance;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
constructor() {
|
|
92
|
+
_defineProperty(this, "_onCustomCTAClick", void 0);
|
|
93
|
+
|
|
94
|
+
_defineProperty(this, "_onVideoPlayback", void 0);
|
|
95
|
+
|
|
96
|
+
_defineProperty(this, "onVideoFeedClick", void 0);
|
|
97
|
+
|
|
98
|
+
_defineProperty(this, "_shareBaseURL", void 0);
|
|
99
|
+
|
|
100
|
+
_defineProperty(this, "onSDKInit", void 0);
|
|
101
|
+
|
|
102
|
+
_defineProperty(this, "eventEmitter", void 0);
|
|
103
|
+
|
|
104
|
+
this.eventEmitter = new NativeEventEmitter(FireworkSDKModule);
|
|
105
|
+
this.eventEmitter.addListener(FWEventName.SDKInit, event => {
|
|
106
|
+
if (this.onSDKInit) {
|
|
107
|
+
this.onSDKInit(event !== null && event !== void 0 ? event : {});
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
this.eventEmitter.addListener(FWEventName.CustomCTAClick, event => {
|
|
111
|
+
if (this.onCustomCTAClick) {
|
|
112
|
+
this.onCustomCTAClick(event !== null && event !== void 0 ? event : {});
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
this.eventEmitter.addListener(FWEventName.VideoPlayback, event => {
|
|
116
|
+
if (this.onVideoPlayback) {
|
|
117
|
+
this.onVideoPlayback(event !== null && event !== void 0 ? event : {});
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
this.eventEmitter.addListener(FWEventName.VideoFeedClick, event => {
|
|
121
|
+
if (this.onVideoFeedClick) {
|
|
122
|
+
this.onVideoFeedClick(event !== null && event !== void 0 ? event : {});
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Initializes Firework SDK.
|
|
128
|
+
* @param {string?} userId An id to uniquely identify device or user.
|
|
129
|
+
* @param {ADConfig?} adConfig Configuration of Ad.
|
|
130
|
+
*/
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
init(userId, adConfig) {
|
|
134
|
+
FireworkSDKModule.init(userId, adConfig);
|
|
135
|
+
ShoppingModule.init();
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Open Video URL.
|
|
139
|
+
* @param {string} url
|
|
140
|
+
* @param {VideoPlayerConfiguration} config
|
|
141
|
+
*/
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
openVideoPlayer(url, config) {
|
|
145
|
+
FireworkSDKModule.openVideoPlayer(url, config !== null && config !== void 0 ? config : {});
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
_defineProperty(FireworkSDK, "_instance", void 0);
|
|
151
|
+
|
|
152
|
+
export default FireworkSDK;
|
|
153
|
+
//# sourceMappingURL=FireworkSDK.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["FireworkSDK.ts"],"names":["NativeEventEmitter","FWEventName","FireworkSDKModule","ShoppingModule","VideoShopping","FireworkSDK","onCustomCTAClick","_onCustomCTAClick","value","setCustomCTAClickEnabled","onVideoPlayback","_onVideoPlayback","setVideoPlaybackEventEnabled","shareBaseURL","_shareBaseURL","setShareBaseURL","shopping","getInstance","_instance","constructor","eventEmitter","addListener","SDKInit","event","onSDKInit","CustomCTAClick","VideoPlayback","VideoFeedClick","onVideoFeedClick","init","userId","adConfig","openVideoPlayer","url","config"],"mappings":"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","sourcesContent":["import { NativeEventEmitter } from 'react-native';\n\nimport type ADConfig from './models/ADConfig';\nimport type {\n CustomCTAClickEvent,\n SDKInitEvent,\n VideoPlaybackEvent,\n} from './models/FWEvents';\nimport { FWEventName, VideoFeedClickEvent } from './models/FWEvents';\nimport type VideoPlayerConfiguration from './models/VideoPlayerConfiguration';\nimport FireworkSDKModule from './modules/FireworkSDKModule';\nimport ShoppingModule from './modules/ShoppingModule';\nimport VideoShopping from './VideoShopping';\n\nexport type SDKInitCallback = (event: SDKInitEvent) => void;\nexport type CustomCTAClickCallback = (event: CustomCTAClickEvent) => void;\nexport type VideoPlaybackCallback = (event: VideoPlaybackEvent) => void;\nexport type VideoFeedClickCallback = (event: VideoFeedClickEvent) => void;\n\n/**\n * Entry class of Firework SDK, which supports the sdk initialization and global configuration.\n */\nclass FireworkSDK {\n private static _instance?: FireworkSDK;\n private _onCustomCTAClick: CustomCTAClickCallback | undefined;\n private _onVideoPlayback?: VideoPlaybackCallback | undefined;\n\n /**\n * Clicking Video Feed callback\n */\n public onVideoFeedClick?: VideoFeedClickCallback;\n private _shareBaseURL: string | undefined;\n\n /**\n * SDK initialization callback.\n */\n public onSDKInit?: SDKInitCallback;\n\n /**\n * Get Custom Clicking CTA callback.\n */\n public get onCustomCTAClick(): CustomCTAClickCallback | undefined {\n return this._onCustomCTAClick;\n }\n\n /**\n * Set Custom Clicking CTA callback.\n */\n public set onCustomCTAClick(value: CustomCTAClickCallback | undefined) {\n this._onCustomCTAClick = value;\n FireworkSDKModule.setCustomCTAClickEnabled(value ? true : false);\n }\n\n /**\n * Get Video Playback callback.\n */\n public get onVideoPlayback(): VideoPlaybackCallback | undefined {\n return this._onVideoPlayback;\n }\n\n /**\n * Set Video Playback callback.\n */\n public set onVideoPlayback(value: VideoPlaybackCallback | undefined) {\n this._onVideoPlayback = value;\n FireworkSDKModule.setVideoPlaybackEventEnabled(value ? true : false);\n }\n\n /**\n * get Share Base URL\n */\n public get shareBaseURL(): string | undefined {\n return this._shareBaseURL;\n }\n\n /**\n * set Share Base URL\n */\n public set shareBaseURL(value: string | undefined) {\n this._shareBaseURL = value;\n FireworkSDKModule.setShareBaseURL(value);\n }\n\n private eventEmitter: NativeEventEmitter;\n\n /**\n * Get VideoShopping object.\n */\n public get shopping(): VideoShopping {\n return VideoShopping.getInstance();\n }\n\n /**\n * Get global single instance of FireworkSDK class.\n * @returns FireworkSDK\n */\n public static getInstance() {\n if (!FireworkSDK._instance) {\n FireworkSDK._instance = new FireworkSDK();\n }\n\n return FireworkSDK._instance!;\n }\n\n private constructor() {\n this.eventEmitter = new NativeEventEmitter(FireworkSDKModule);\n\n this.eventEmitter.addListener(FWEventName.SDKInit, (event) => {\n if (this.onSDKInit) {\n this.onSDKInit(event ?? {});\n }\n });\n\n this.eventEmitter.addListener(FWEventName.CustomCTAClick, (event) => {\n if (this.onCustomCTAClick) {\n this.onCustomCTAClick(event ?? {});\n }\n });\n\n this.eventEmitter.addListener(FWEventName.VideoPlayback, (event) => {\n if (this.onVideoPlayback) {\n this.onVideoPlayback(event ?? {});\n }\n });\n\n this.eventEmitter.addListener(FWEventName.VideoFeedClick, (event) => {\n if (this.onVideoFeedClick) {\n this.onVideoFeedClick(event ?? {});\n }\n });\n }\n\n /**\n * Initializes Firework SDK.\n * @param {string?} userId An id to uniquely identify device or user.\n * @param {ADConfig?} adConfig Configuration of Ad.\n */\n public init(userId?: string, adConfig?: ADConfig) {\n FireworkSDKModule.init(userId, adConfig);\n ShoppingModule.init();\n }\n\n /**\n * Open Video URL.\n * @param {string} url \n * @param {VideoPlayerConfiguration} config \n */\n public openVideoPlayer(url: string, config?: VideoPlayerConfiguration) {\n FireworkSDKModule.openVideoPlayer(url, config ?? {});\n }\n}\n\nexport default FireworkSDK;\n"]}
|
|
@@ -0,0 +1,134 @@
|
|
|
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 { NativeEventEmitter } from 'react-native';
|
|
4
|
+
import { FWEventName } from './models/FWEvents';
|
|
5
|
+
import ShoppingModule from './modules/ShoppingModule';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Entry class of Video Shopping
|
|
9
|
+
*/
|
|
10
|
+
class VideoShopping {
|
|
11
|
+
/**
|
|
12
|
+
* This callback is triggered when the user clicks the "Add to cart" button.
|
|
13
|
+
*
|
|
14
|
+
* The host app can return an AddToCartResult object to tell FireworkSDK the result of adding to cart.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* This callback is triggered when the user clicks the shopping cart icon.
|
|
19
|
+
*
|
|
20
|
+
* The host app can return a React.Node to integrate custom cart page to shopping flow.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* This callback is triggered when the video will be shown.
|
|
25
|
+
*
|
|
26
|
+
* The host app can return a Product object to update the latest product information.
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* This callback is triggered when the product will be shown.
|
|
31
|
+
*
|
|
32
|
+
* The host app can return a ProductInfoViewConfiguration object to configure "Add to cart" button style and cart icon style.
|
|
33
|
+
*/
|
|
34
|
+
static getInstance() {
|
|
35
|
+
if (!VideoShopping._instance) {
|
|
36
|
+
VideoShopping._instance = new VideoShopping();
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return VideoShopping._instance;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
constructor() {
|
|
43
|
+
_defineProperty(this, "onAddToCart", void 0);
|
|
44
|
+
|
|
45
|
+
_defineProperty(this, "onClickCartIcon", void 0);
|
|
46
|
+
|
|
47
|
+
_defineProperty(this, "onUpdateProductDetails", void 0);
|
|
48
|
+
|
|
49
|
+
_defineProperty(this, "onWillDisplayProduct", void 0);
|
|
50
|
+
|
|
51
|
+
_defineProperty(this, "currentCartPage", void 0);
|
|
52
|
+
|
|
53
|
+
_defineProperty(this, "eventEmitter", void 0);
|
|
54
|
+
|
|
55
|
+
this.eventEmitter = new NativeEventEmitter(ShoppingModule);
|
|
56
|
+
this.eventEmitter.addListener(FWEventName.AddToCart, event => {
|
|
57
|
+
this.handleAddToCartEvent(event);
|
|
58
|
+
});
|
|
59
|
+
this.eventEmitter.addListener(FWEventName.ClickCartIcon, event => {
|
|
60
|
+
this.handleClickCartIconEvent(event);
|
|
61
|
+
});
|
|
62
|
+
this.eventEmitter.addListener(FWEventName.UpdateProductDetails, event => {
|
|
63
|
+
this.handleUpdateProductDetailsEvent(event);
|
|
64
|
+
});
|
|
65
|
+
this.eventEmitter.addListener(FWEventName.WillDisplayProduct, event => {
|
|
66
|
+
this.handleWillDisplayProductEvent(event);
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Exit Cart Page.
|
|
71
|
+
*
|
|
72
|
+
* The host app can call this method to exit their cart page.
|
|
73
|
+
*/
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
exitCartPage() {
|
|
77
|
+
ShoppingModule.exitCartPage();
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
async handleAddToCartEvent(event) {
|
|
81
|
+
if (this.onAddToCart) {
|
|
82
|
+
const callbackId = event.callbackId;
|
|
83
|
+
delete event.callbackId;
|
|
84
|
+
const result = await this.onAddToCart(event);
|
|
85
|
+
|
|
86
|
+
if (result) {
|
|
87
|
+
ShoppingModule.updateAddToCartStatus(result.res, result.tips, callbackId);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
async handleClickCartIconEvent(event) {
|
|
93
|
+
if (this.onClickCartIcon) {
|
|
94
|
+
const callbackId = event.callbackId;
|
|
95
|
+
delete event.callbackId;
|
|
96
|
+
const cartPage = await this.onClickCartIcon();
|
|
97
|
+
this.currentCartPage = cartPage;
|
|
98
|
+
|
|
99
|
+
if (cartPage) {
|
|
100
|
+
ShoppingModule.jumpToCartPage(callbackId);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
async handleUpdateProductDetailsEvent(event) {
|
|
106
|
+
if (this.onUpdateProductDetails) {
|
|
107
|
+
const callbackId = event.callbackId;
|
|
108
|
+
delete event.callbackId;
|
|
109
|
+
const product = await this.onUpdateProductDetails(event);
|
|
110
|
+
|
|
111
|
+
if (product) {
|
|
112
|
+
ShoppingModule.updateVideoProduct(product, callbackId);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
async handleWillDisplayProductEvent(event) {
|
|
118
|
+
if (this.onWillDisplayProduct) {
|
|
119
|
+
const callbackId = event.callbackId;
|
|
120
|
+
delete event.callbackId;
|
|
121
|
+
const config = await this.onWillDisplayProduct(event);
|
|
122
|
+
|
|
123
|
+
if (config) {
|
|
124
|
+
ShoppingModule.updateProductViewConfig(config, callbackId);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
_defineProperty(VideoShopping, "_instance", void 0);
|
|
132
|
+
|
|
133
|
+
export default VideoShopping;
|
|
134
|
+
//# sourceMappingURL=VideoShopping.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["VideoShopping.ts"],"names":["NativeEventEmitter","FWEventName","ShoppingModule","VideoShopping","getInstance","_instance","constructor","eventEmitter","addListener","AddToCart","event","handleAddToCartEvent","ClickCartIcon","handleClickCartIconEvent","UpdateProductDetails","handleUpdateProductDetailsEvent","WillDisplayProduct","handleWillDisplayProductEvent","exitCartPage","onAddToCart","callbackId","result","updateAddToCartStatus","res","tips","onClickCartIcon","cartPage","currentCartPage","jumpToCartPage","onUpdateProductDetails","product","updateVideoProduct","onWillDisplayProduct","config","updateProductViewConfig"],"mappings":"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","sourcesContent":["import { NativeEventEmitter } from 'react-native';\n\nimport type AddToCartResult from './models/AddToCartResult';\nimport {\n AddToCartEvent,\n FWEventName,\n UpdateProductDetailsEvent,\n WillDisplayProductEvent,\n} from './models/FWEvents';\nimport type Product from './models/Product';\nimport type ProductInfoViewConfiguration from './models/ProductInfoViewConfiguration';\nimport ShoppingModule from './modules/ShoppingModule';\n\nexport type AddToCartCallback = (\n event: AddToCartEvent\n) => Promise<AddToCartResult | undefined | null>;\n\nexport type ClickCartIconCallback = () => Promise<\n React.ReactNode | undefined | null\n>;\n\nexport type UpdateProductDetailsCallback = (\n event: UpdateProductDetailsEvent\n) => Promise<Product | undefined | null>;\n\nexport type WillDisplayProductCallback = (\n event: WillDisplayProductEvent\n) => Promise<ProductInfoViewConfiguration | undefined | null>;\n\ntype CallbackInfo = { callbackId?: number };\n\n/**\n * 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 object to update the latest product information.\n */\n public onUpdateProductDetails?: UpdateProductDetailsCallback;\n\n /**\n * This callback is triggered when the product will be shown.\n *\n * The host app can return a ProductInfoViewConfiguration object to configure \"Add to cart\" button style and cart icon style.\n */\n public onWillDisplayProduct?: WillDisplayProductCallback;\n\n public currentCartPage?: React.ReactNode;\n\n private eventEmitter: NativeEventEmitter;\n\n public static getInstance() {\n if (!VideoShopping._instance) {\n VideoShopping._instance = new VideoShopping();\n }\n\n return VideoShopping._instance!;\n }\n\n private constructor() {\n this.eventEmitter = new NativeEventEmitter(ShoppingModule);\n this.eventEmitter.addListener(FWEventName.AddToCart, (event) => {\n this.handleAddToCartEvent(event);\n });\n\n this.eventEmitter.addListener(FWEventName.ClickCartIcon, (event) => {\n this.handleClickCartIconEvent(event);\n });\n\n this.eventEmitter.addListener(FWEventName.UpdateProductDetails, (event) => {\n this.handleUpdateProductDetailsEvent(event);\n });\n\n this.eventEmitter.addListener(FWEventName.WillDisplayProduct, (event) => {\n this.handleWillDisplayProductEvent(event);\n });\n }\n\n /**\n * Exit Cart Page.\n *\n * The host app can call this method to exit their cart page.\n */\n public exitCartPage() {\n ShoppingModule.exitCartPage();\n }\n\n 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 product = await this.onUpdateProductDetails(\n event as UpdateProductDetailsEvent\n );\n if (product) {\n ShoppingModule.updateVideoProduct(product, callbackId!);\n }\n }\n }\n\n private async handleWillDisplayProductEvent(\n event: WillDisplayProductEvent & CallbackInfo\n ) {\n if (this.onWillDisplayProduct) {\n const callbackId = event.callbackId;\n delete event.callbackId;\n const config = await this.onWillDisplayProduct(\n event as WillDisplayProductEvent\n );\n if (config) {\n ShoppingModule.updateProductViewConfig(config, callbackId!);\n }\n }\n }\n}\n\nexport default VideoShopping;\n"]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { StyleSheet, View } from 'react-native';
|
|
3
|
+
import VideoShopping from '../VideoShopping';
|
|
4
|
+
|
|
5
|
+
const CartContainer = () => {
|
|
6
|
+
const [cartPage, _] = useState(VideoShopping.getInstance().currentCartPage);
|
|
7
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
8
|
+
style: styles.container
|
|
9
|
+
}, cartPage);
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const styles = StyleSheet.create({
|
|
13
|
+
container: {
|
|
14
|
+
flex: 1
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
export default CartContainer;
|
|
18
|
+
//# sourceMappingURL=CartContainer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["CartContainer.tsx"],"names":["React","useState","StyleSheet","View","VideoShopping","CartContainer","cartPage","_","getInstance","currentCartPage","styles","container","create","flex"],"mappings":"AAAA,OAAOA,KAAP,IAAgBC,QAAhB,QAAgC,OAAhC;AAEA,SAASC,UAAT,EAAqBC,IAArB,QAAiC,cAAjC;AAEA,OAAOC,aAAP,MAA0B,kBAA1B;;AAEA,MAAMC,aAAa,GAAG,MAAM;AAC1B,QAAM,CAACC,QAAD,EAAWC,CAAX,IAAgBN,QAAQ,CAC5BG,aAAa,CAACI,WAAd,GAA4BC,eADA,CAA9B;AAGA,sBAAO,oBAAC,IAAD;AAAM,IAAA,KAAK,EAAEC,MAAM,CAACC;AAApB,KAAgCL,QAAhC,CAAP;AACD,CALD;;AAOA,MAAMI,MAAM,GAAGR,UAAU,CAACU,MAAX,CAAkB;AAC/BD,EAAAA,SAAS,EAAE;AACTE,IAAAA,IAAI,EAAE;AADG;AADoB,CAAlB,CAAf;AAMA,eAAeR,aAAf","sourcesContent":["import React, { useState } from 'react';\n\nimport { StyleSheet, View } from 'react-native';\n\nimport VideoShopping from '../VideoShopping';\n\nconst CartContainer = () => {\n const [cartPage, _] = useState<React.ReactNode>(\n VideoShopping.getInstance().currentCartPage\n );\n return <View style={styles.container}>{cartPage}</View>;\n};\n\nconst styles = StyleSheet.create({\n container: {\n flex: 1,\n },\n});\n\nexport default CartContainer;\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { requireNativeComponent, UIManager } from 'react-native';
|
|
2
|
+
import { LINKING_ERROR } from "../constants/FWErrorMessage";
|
|
3
|
+
const NativeComponentName = 'FWVideoFeed';
|
|
4
|
+
const FWVideoFeed = UIManager.getViewManagerConfig(NativeComponentName) != null ? requireNativeComponent(NativeComponentName) : () => {
|
|
5
|
+
throw new Error(LINKING_ERROR);
|
|
6
|
+
};
|
|
7
|
+
export default FWVideoFeed;
|
|
8
|
+
//# sourceMappingURL=FWVideoFeed.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["FWVideoFeed.tsx"],"names":["requireNativeComponent","UIManager","LINKING_ERROR","NativeComponentName","FWVideoFeed","getViewManagerConfig","Error"],"mappings":"AAAA,SAASA,sBAAT,EAAiCC,SAAjC,QAAkD,cAAlD;AACA,SAASC,aAAT,QAA8B,6BAA9B;AACA,MAAMC,mBAAmB,GAAG,aAA5B;AACA,MAAMC,WAAW,GACfH,SAAS,CAACI,oBAAV,CAA+BF,mBAA/B,KAAuD,IAAvD,GACIH,sBAAsB,CAAMG,mBAAN,CAD1B,GAEI,MAAM;AACN,QAAM,IAAIG,KAAJ,CAAUJ,aAAV,CAAN;AACD,CALL;AAMA,eAAeE,WAAf","sourcesContent":["import { requireNativeComponent, UIManager } from 'react-native'\nimport { LINKING_ERROR } from \"../constants/FWErrorMessage\";\nconst NativeComponentName = 'FWVideoFeed';\nconst FWVideoFeed =\n UIManager.getViewManagerConfig(NativeComponentName) != null\n ? requireNativeComponent<any>(NativeComponentName)\n : () => {\n throw new Error(LINKING_ERROR);\n };\nexport default FWVideoFeed\n"]}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
+
|
|
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
|
+
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import { UIManager, findNodeHandle } from 'react-native';
|
|
7
|
+
import FWVideoFeed from './FWVideoFeed';
|
|
8
|
+
const NativeComponentName = 'FWVideoFeed';
|
|
9
|
+
export default class VideoFeed extends React.Component {
|
|
10
|
+
constructor() {
|
|
11
|
+
super(...arguments);
|
|
12
|
+
|
|
13
|
+
_defineProperty(this, "nativeComponentRef", /*#__PURE__*/React.createRef());
|
|
14
|
+
|
|
15
|
+
_defineProperty(this, "refresh", () => {
|
|
16
|
+
const nativeNodeHandle = findNodeHandle(this.nativeComponentRef.current);
|
|
17
|
+
UIManager.dispatchViewManagerCommand(findNodeHandle(nativeNodeHandle), UIManager.getViewManagerConfig(NativeComponentName).Commands.refresh, []);
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
_defineProperty(this, "_onVideoFeedLoadFinished", event => {
|
|
21
|
+
const {
|
|
22
|
+
name,
|
|
23
|
+
reason
|
|
24
|
+
} = event.nativeEvent;
|
|
25
|
+
|
|
26
|
+
if (this.props.onVideoFeedLoadFinished) {
|
|
27
|
+
if (name) {
|
|
28
|
+
this.props.onVideoFeedLoadFinished({
|
|
29
|
+
name,
|
|
30
|
+
reason
|
|
31
|
+
});
|
|
32
|
+
} else {
|
|
33
|
+
this.props.onVideoFeedLoadFinished();
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
render() {
|
|
40
|
+
var _videoFeedConfigurati, _videoFeedConfigurati2, _videoFeedConfigurati3;
|
|
41
|
+
|
|
42
|
+
const {
|
|
43
|
+
source,
|
|
44
|
+
channel = '',
|
|
45
|
+
playlist = '',
|
|
46
|
+
mode = 'row',
|
|
47
|
+
videoFeedConfiguration
|
|
48
|
+
} = this.props;
|
|
49
|
+
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
|
+
const titlePosition = (_videoFeedConfigurati3 = videoFeedConfiguration === null || videoFeedConfiguration === void 0 ? void 0 : videoFeedConfiguration.titlePosition) !== null && _videoFeedConfigurati3 !== void 0 ? _videoFeedConfigurati3 : 'nested';
|
|
51
|
+
const key = `source:${source}_channel:${channel}_playlist:${playlist}_mode:${mode}_titleHidden:${titleHidden}_titlePosition:${titlePosition}`;
|
|
52
|
+
return /*#__PURE__*/React.createElement(FWVideoFeed, _extends({
|
|
53
|
+
key: key
|
|
54
|
+
}, this.props, {
|
|
55
|
+
ref: this.nativeComponentRef,
|
|
56
|
+
onVideoFeedLoadFinished: this._onVideoFeedLoadFinished,
|
|
57
|
+
mode: mode
|
|
58
|
+
}));
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
_defineProperty(VideoFeed, "defaultProps", {
|
|
64
|
+
mode: 'row'
|
|
65
|
+
});
|
|
66
|
+
//# sourceMappingURL=VideoFeed.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["VideoFeed.tsx"],"names":["React","UIManager","findNodeHandle","FWVideoFeed","NativeComponentName","VideoFeed","Component","createRef","nativeNodeHandle","nativeComponentRef","current","dispatchViewManagerCommand","getViewManagerConfig","Commands","refresh","event","name","reason","nativeEvent","props","onVideoFeedLoadFinished","render","source","channel","playlist","mode","videoFeedConfiguration","titleHidden","title","hidden","titlePosition","key","_onVideoFeedLoadFinished"],"mappings":";;;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAASC,SAAT,EAAoBC,cAApB,QAAgE,cAAhE;AAKA,OAAOC,WAAP,MAAwB,eAAxB;AA6CA,MAAMC,mBAAmB,GAAG,aAA5B;AAEA,eAAe,MAAMC,SAAN,SAAwBL,KAAK,CAACM,SAA9B,CAAyD;AAAA;AAAA;;AAAA,6DAKjDN,KAAK,CAACO,SAAN,EALiD;;AAAA,qCASrD,MAAM;AACrB,YAAMC,gBAAgB,GAAGN,cAAc,CAAC,KAAKO,kBAAL,CAAwBC,OAAzB,CAAvC;AAEAT,MAAAA,SAAS,CAACU,0BAAV,CACET,cAAc,CAACM,gBAAD,CADhB,EAEEP,SAAS,CAACW,oBAAV,CAA+BR,mBAA/B,EAAoDS,QAApD,CAA6DC,OAF/D,EAGE,EAHF;AAKD,KAjBqE;;AAAA,sDAoBpEC,KADiC,IAE9B;AACH,YAAM;AAAEC,QAAAA,IAAF;AAAQC,QAAAA;AAAR,UAAmBF,KAAK,CAACG,WAA/B;;AACA,UAAI,KAAKC,KAAL,CAAWC,uBAAf,EAAwC;AACtC,YAAIJ,IAAJ,EAAU;AACR,eAAKG,KAAL,CAAWC,uBAAX,CAAmC;AAAEJ,YAAAA,IAAF;AAAQC,YAAAA;AAAR,WAAnC;AACD,SAFD,MAEO;AACL,eAAKE,KAAL,CAAWC,uBAAX;AACD;AACF;AACF,KA9BqE;AAAA;;AAgCtEC,EAAAA,MAAM,GAAG;AAAA;;AACP,UAAM;AACJC,MAAAA,MADI;AAEJC,MAAAA,OAAO,GAAG,EAFN;AAGJC,MAAAA,QAAQ,GAAG,EAHP;AAIJC,MAAAA,IAAI,GAAG,KAJH;AAKJC,MAAAA;AALI,QAMF,KAAKP,KANT;AAOA,UAAMQ,WAAW,4BAAGD,sBAAH,aAAGA,sBAAH,iDAAGA,sBAAsB,CAAEE,KAA3B,2DAAG,uBAA+BC,MAAlC,yEAA4C,KAA7D;AACA,UAAMC,aAAa,6BAAGJ,sBAAH,aAAGA,sBAAH,uBAAGA,sBAAsB,CAAEI,aAA3B,2EAA4C,QAA/D;AAEA,UAAMC,GAAG,GAAI,UAAST,MAAO,YAAWC,OAAQ,aAAYC,QAAS,SAAQC,IAAK,gBAAeE,WAAY,kBAAiBG,aAAc,EAA5I;AAEA,wBACE,oBAAC,WAAD;AACE,MAAA,GAAG,EAAEC;AADP,OAEM,KAAKZ,KAFX;AAGE,MAAA,GAAG,EAAE,KAAKV,kBAHZ;AAIE,MAAA,uBAAuB,EAAE,KAAKuB,wBAJhC;AAKE,MAAA,IAAI,EAAEP;AALR,OADF;AASD;;AAtDqE;;gBAAnDpB,S,kBACG;AACpBoB,EAAAA,IAAI,EAAE;AADc,C","sourcesContent":["import React from 'react';\nimport { UIManager, findNodeHandle, StyleProp, ViewStyle } from 'react-native';\nimport type { NativeSyntheticEvent, TargetedEvent } from 'react-native';\nimport type VideoPlayerConfiguration from '../models/VideoPlayerConfiguration';\nimport type VideoFeedConfiguration from '../models/VideoFeedConfiguration';\nimport type FWError from '../models/FWError';\nimport FWVideoFeed from './FWVideoFeed';\n\nexport type VideoFeedSource = 'discover' | 'channel' | 'playlist';\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 * One of three available display modes. Defaults to row.\n */\n mode?: VideoFeedMode;\n /**\n * Configuration of Video Feed.\n */\n videoFeedConfiguration?: VideoFeedConfiguration;\n /**\n * Configuration of Video Player.\n */\n videoPlayerConfiguration?: VideoPlayerConfiguration;\n /**\n * Video feed loading result callback. It means loading successfully when error equals to undefined.\n */\n onVideoFeedLoadFinished?: (error?: FWError) => void;\n}\n\ninterface VideoFeedLoadFinishedEvent extends TargetedEvent {\n name: string;\n reason?: string | null;\n}\n\nconst NativeComponentName = 'FWVideoFeed';\n\nexport default class VideoFeed extends React.Component<IVideoFeedProps> {\n static defaultProps = {\n mode: 'row',\n };\n\n nativeComponentRef = React.createRef<any>();\n /**\n * Force refreshing the video feed.\n */\n public refresh = () => {\n const nativeNodeHandle = findNodeHandle(this.nativeComponentRef.current);\n\n UIManager.dispatchViewManagerCommand(\n findNodeHandle(nativeNodeHandle),\n UIManager.getViewManagerConfig(NativeComponentName).Commands.refresh,\n []\n );\n };\n\n private _onVideoFeedLoadFinished = (\n event: NativeSyntheticEvent<VideoFeedLoadFinishedEvent>\n ) => {\n const { name, reason } = event.nativeEvent;\n if (this.props.onVideoFeedLoadFinished) {\n if (name) {\n this.props.onVideoFeedLoadFinished({ name, reason });\n } else {\n this.props.onVideoFeedLoadFinished();\n }\n }\n };\n\n render() {\n const {\n source,\n channel = '',\n playlist = '',\n mode = 'row',\n videoFeedConfiguration,\n } = this.props;\n const titleHidden = videoFeedConfiguration?.title?.hidden ?? false;\n const titlePosition = videoFeedConfiguration?.titlePosition ?? 'nested';\n\n const key = `source:${source}_channel:${channel}_playlist:${playlist}_mode:${mode}_titleHidden:${titleHidden}_titlePosition:${titlePosition}`;\n\n return (\n <FWVideoFeed\n key={key}\n {...this.props}\n ref={this.nativeComponentRef}\n onVideoFeedLoadFinished={this._onVideoFeedLoadFinished}\n mode={mode}\n />\n );\n }\n}\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Platform } from 'react-native';
|
|
2
|
+
const LINKING_ERROR = `The package 'react-native-firework-sdk' doesn't seem to be linked. Make sure: \n\n` + Platform.select({
|
|
3
|
+
ios: "- You have run 'pod install'\n",
|
|
4
|
+
default: ''
|
|
5
|
+
}) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo managed workflow\n';
|
|
6
|
+
export { LINKING_ERROR };
|
|
7
|
+
//# sourceMappingURL=FWErrorMessage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["FWErrorMessage.ts"],"names":["Platform","LINKING_ERROR","select","ios","default"],"mappings":"AAAA,SAASA,QAAT,QAAyB,cAAzB;AAEA,MAAMC,aAAa,GAChB,oFAAD,GACAD,QAAQ,CAACE,MAAT,CAAgB;AAAEC,EAAAA,GAAG,EAAE,gCAAP;AAAyCC,EAAAA,OAAO,EAAE;AAAlD,CAAhB,CADA,GAEA,sDAFA,GAGA,6CAJF;AAME,SACEH,aADF","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\n export {\n LINKING_ERROR,\n };\n"]}
|