react-native-firework-sdk 1.0.0-beta.1 → 1.0.1
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 +26 -24
- package/android/build.gradle +0 -1
- package/android/src/main/AndroidManifest.xml +4 -1
- package/android/src/main/java/com/reactnativefireworksdk/components/videofeed/FWVideoFeed.kt +2 -0
- package/ios/Models/FireworkSDK+JsModel.swift +1 -1
- package/ios/Modules/FireworkSDKModule/FireworkSDKModule+EventTracking.swift +5 -1
- package/lib/commonjs/VideoShopping.js.map +1 -1
- package/lib/commonjs/components/VideoFeed.js +4 -1
- package/lib/commonjs/components/VideoFeed.js.map +1 -1
- package/lib/commonjs/modules/ShoppingModule.js.map +1 -1
- package/lib/module/VideoShopping.js.map +1 -1
- package/lib/module/components/VideoFeed.js +4 -1
- package/lib/module/components/VideoFeed.js.map +1 -1
- package/lib/module/modules/ShoppingModule.js.map +1 -1
- package/lib/typescript/models/ADConfig.d.ts +2 -2
- package/lib/typescript/models/ProductInfoViewConfiguration.d.ts +1 -1
- package/lib/typescript/models/VideoFeedConfiguration.d.ts +2 -2
- package/lib/typescript/models/VideoPlayerConfiguration.d.ts +1 -1
- package/lib/typescript/modules/ShoppingModule.d.ts +4 -4
- package/package.json +1 -21
- package/react-native-firework-sdk.podspec +3 -3
- package/src/VideoShopping.ts +1 -1
- package/src/components/VideoFeed.tsx +1 -0
- package/src/models/ADConfig.ts +2 -2
- package/src/models/ProductInfoViewConfiguration.ts +1 -1
- package/src/models/VideoFeedConfiguration.ts +2 -2
- package/src/models/VideoPlayerConfiguration.ts +1 -1
- package/src/modules/ShoppingModule.ts +4 -4
package/README.md
CHANGED
|
@@ -6,34 +6,36 @@ Firework React Native SDK
|
|
|
6
6
|
|
|
7
7
|
```sh
|
|
8
8
|
npm install react-native-firework-sdk
|
|
9
|
+
# or
|
|
10
|
+
yarn add react-native-firework-sdk
|
|
9
11
|
```
|
|
10
12
|
|
|
11
13
|
## Usage
|
|
12
14
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
### SDK Initialization
|
|
16
|
+
```ts
|
|
17
|
+
/*
|
|
18
|
+
Optional: set listener for SDK init
|
|
19
|
+
*/
|
|
20
|
+
FireworkSDK.getInstance().onSDKInit = (event) => {
|
|
21
|
+
console.log('onSDKInit', event);
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
/*
|
|
25
|
+
It is recommended to call the init method when the application starts,
|
|
26
|
+
for example, in the index.tsx.
|
|
27
|
+
*/
|
|
28
|
+
FireworkSDK.getInstance().init();
|
|
19
29
|
```
|
|
20
30
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
31
|
+
### Video Feed Integration
|
|
32
|
+
```ts
|
|
33
|
+
import {
|
|
34
|
+
VideoFeed,
|
|
35
|
+
} from 'react-native-firework-sdk';
|
|
26
36
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
### Run Android Example
|
|
33
|
-
1. `npm run setup_android`
|
|
34
|
-
2. `cd example && npm start`
|
|
35
|
-
3. open `example/android` using Android Studio
|
|
36
|
-
|
|
37
|
-
## License
|
|
38
|
-
|
|
39
|
-
MIT
|
|
37
|
+
<VideoFeed
|
|
38
|
+
style={{ height: 200 }}
|
|
39
|
+
source="discover"
|
|
40
|
+
/>
|
|
41
|
+
```
|
package/android/build.gradle
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
|
2
|
-
|
|
2
|
+
package="com.reactnativefireworksdk">
|
|
3
3
|
|
|
4
4
|
<uses-permission android:name="android.permission.INTERNET" />
|
|
5
5
|
|
|
@@ -11,6 +11,9 @@
|
|
|
11
11
|
android:name="com.reactnativefireworksdk.pages.FWVideoShoppingCartActivity"
|
|
12
12
|
android:theme="@style/Theme.AppCompat.Light.NoActionBar"
|
|
13
13
|
/>
|
|
14
|
+
<meta-data
|
|
15
|
+
android:name="com.google.android.gms.ads.AD_MANAGER_APP"
|
|
16
|
+
android:value="true" />
|
|
14
17
|
</application>
|
|
15
18
|
|
|
16
19
|
</manifest>
|
package/android/src/main/java/com/reactnativefireworksdk/components/videofeed/FWVideoFeed.kt
CHANGED
|
@@ -92,6 +92,8 @@ class FWVideoFeed(
|
|
|
92
92
|
val backgroundColor = config?.backgroundColor
|
|
93
93
|
if (!backgroundColor.isNullOrBlank()) {
|
|
94
94
|
videoFeedView.setBackgroundColor(Color.parseColor(backgroundColor))
|
|
95
|
+
} else {
|
|
96
|
+
videoFeedView.setBackgroundColor(Color.TRANSPARENT)
|
|
95
97
|
}
|
|
96
98
|
|
|
97
99
|
videoFeedView.setTitleVisible(config?.title?.hidden != true)
|
|
@@ -68,7 +68,11 @@ extension FireworkSDKModule: FireworkVideoPlaybackDelegate {
|
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
extension FireworkSDKModule: FireworkVideoFeedDelegate {
|
|
71
|
-
func
|
|
71
|
+
func fireworkVideoDidTapThumbnail(_ eventDetails: FeedEventDetails) {
|
|
72
72
|
sendEvent(withName: FWEventName.VideoFeedClick.rawValue, body: eventDetails.jsObject)
|
|
73
73
|
}
|
|
74
|
+
|
|
75
|
+
// func fireworkVideoDidTapVideoThumbnail(_ eventDetails: FeedEventDetails) {
|
|
76
|
+
// sendEvent(withName: FWEventName.VideoFeedClick.rawValue, body: eventDetails.jsObject)
|
|
77
|
+
// }
|
|
74
78
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["VideoShopping.ts"],"names":["VideoShopping","cartIconVisible","_cartIconVisible","value","ShoppingModule","setCartIconVisible","getInstance","_instance","constructor","eventEmitter","NativeEventEmitter","addListener","FWEventName","AddToCart","event","handleAddToCartEvent","ClickCartIcon","handleClickCartIconEvent","UpdateProductDetails","handleUpdateProductDetailsEvent","WillDisplayProduct","handleWillDisplayProductEvent","exitCartPage","setCartItemCount","count","onAddToCart","callbackId","result","updateAddToCartStatus","res","tips","onClickCartIcon","cartPage","currentCartPage","jumpToCartPage","onUpdateProductDetails","product","updateVideoProduct","onWillDisplayProduct","config","updateProductViewConfig"],"mappings":";;;;;;;AAAA;;AAGA;;AAQA;;;;;;AAoBA;AACA;AACA;AACA,MAAMA,aAAN,CAAoB;AAIlB;AACF;AACA;AACA;AACA;;AAGE;AACF;AACA;AACA;AACA;;AAGE;AACF;AACA;AACA;AACA;;AAGE;AACF;AACA;AACA;AACA;;AAGE;AACF;AACA;AAC4B,MAAfC,eAAe,GAAY;AACpC,WAAO,KAAKC,gBAAZ;AACD;;AACyB,MAAfD,eAAe,CAACE,KAAD,EAAiB;AACzC,SAAKD,gBAAL,GAAwBC,KAAxB;;AACAC,4BAAeC,kBAAf,CAAkCF,KAAlC;AACD;;AAMwB,SAAXG,WAAW,GAAG;AAC1B,QAAI,CAACN,aAAa,CAACO,SAAnB,EAA8B;AAC5BP,MAAAA,aAAa,CAACO,SAAd,GAA0B,IAAIP,aAAJ,EAA1B;AACD;;AAED,WAAOA,aAAa,CAACO,SAArB;AACD;;AAEOC,EAAAA,WAAW,GAAG;AAAA,8CArDc,IAqDd;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AACpB,SAAKC,YAAL,GAAoB,IAAIC,+BAAJ,CAAuBN,uBAAvB,CAApB;AACA,SAAKK,YAAL,CAAkBE,WAAlB,CAA8BC,sBAAYC,SAA1C,EAAsDC,KAAD,IAAW;AAC9D,WAAKC,oBAAL,CAA0BD,KAA1B;AACD,KAFD;AAIA,SAAKL,YAAL,CAAkBE,WAAlB,CAA8BC,sBAAYI,aAA1C,EAA0DF,KAAD,IAAW;AAClE,WAAKG,wBAAL,CAA8BH,KAA9B;AACD,KAFD;AAIA,SAAKL,YAAL,CAAkBE,WAAlB,CAA8BC,sBAAYM,oBAA1C,EAAiEJ,KAAD,IAAW;A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D,sBAAL,CACpBrB,KADoB,CAAtB;;AAGA,UAAIsB,OAAJ,EAAa;AACXhC,gCAAeiC,kBAAf,CAAkCD,OAAlC,EAA2CV,UAA3C;AACD;AACF;AACF;;AAE0C,QAA7BL,6BAA6B,CACzCP,KADyC,EAEzC;AACA,QAAI,KAAKwB,oBAAT,EAA+B;AAC7B,YAAMZ,UAAU,GAAGZ,KAAK,CAACY,UAAzB;AACA,aAAOZ,KAAK,CAACY,UAAb;AACA,YAAMa,MAAM,GAAG,MAAM,KAAKD,oBAAL,CACnBxB,KADmB,CAArB;;AAGA,UAAIyB,MAAJ,EAAY;AACVnC,gCAAeoC,uBAAf,CAAuCD,MAAvC,EAA+Cb,UAA/C;AACD;AACF;AACF;;AAnJiB;;gBAAd1B,a;;eAsJSA,a","sourcesContent":["import { NativeEventEmitter } from 'react-native';\n\nimport type AddToCartResult from './models/AddToCartResult';\nimport {\n AddToCartEvent,\n FWEventName,\n UpdateProductDetailsEvent,\n WillDisplayProductEvent,\n} from './models/FWEvents';\nimport type Product from './models/Product';\nimport type ProductInfoViewConfiguration from './models/ProductInfoViewConfiguration';\nimport ShoppingModule from './modules/ShoppingModule';\n\nexport type AddToCartCallback = (\n event: AddToCartEvent\n) => Promise<AddToCartResult | undefined | null>;\n\nexport type ClickCartIconCallback = () => Promise<\n React.ReactNode | undefined | null\n>;\n\nexport type UpdateProductDetailsCallback = (\n event: UpdateProductDetailsEvent\n) => Promise<Product | undefined | null>;\n\nexport type WillDisplayProductCallback = (\n event: WillDisplayProductEvent\n) => Promise<ProductInfoViewConfiguration | undefined | null>;\n\ntype CallbackInfo = { callbackId?: number };\n\n/**\n * Entry class of Video Shopping\n */\nclass VideoShopping {\n private static _instance?: VideoShopping;\n private _cartIconVisible: boolean = true;\n\n /**\n * This callback is triggered when the user clicks the \"Add to cart\" button.\n *\n * The host app can return an AddToCartResult object to tell FireworkSDK the result of adding to cart.\n */\n public onAddToCart?: AddToCartCallback;\n\n /**\n * This callback is triggered when the user clicks the shopping cart icon.\n *\n * The host app can return a React.Node to integrate custom cart page to shopping flow.\n */\n public onClickCartIcon?: ClickCartIconCallback;\n\n /**\n * This callback is triggered when the video will be shown.\n *\n * The host app can return a Product object to update the latest product information.\n */\n public onUpdateProductDetails?: UpdateProductDetailsCallback;\n\n /**\n * This callback is triggered when the product will be shown.\n *\n * The host app can return a ProductInfoViewConfiguration object to configure \"Add to cart\" button style and cart icon style.\n */\n public onWillDisplayProduct?: WillDisplayProductCallback;\n\n /**\n * Defaults to true. You can hide the cart icon by setting this property to false. \n */\n public get cartIconVisible(): boolean {\n return this._cartIconVisible;\n }\n public set cartIconVisible(value: boolean) {\n this._cartIconVisible = value;\n ShoppingModule.setCartIconVisible(value);\n }\n\n public currentCartPage?: React.ReactNode;\n\n private eventEmitter: NativeEventEmitter;\n\n public static getInstance() {\n if (!VideoShopping._instance) {\n VideoShopping._instance = new VideoShopping();\n }\n\n return VideoShopping._instance!;\n }\n\n private constructor() {\n this.eventEmitter = new NativeEventEmitter(ShoppingModule);\n this.eventEmitter.addListener(FWEventName.AddToCart, (event) => {\n this.handleAddToCartEvent(event);\n });\n\n this.eventEmitter.addListener(FWEventName.ClickCartIcon, (event) => {\n this.handleClickCartIconEvent(event);\n });\n\n this.eventEmitter.addListener(FWEventName.UpdateProductDetails, (event) => {\n this.handleUpdateProductDetailsEvent(event);\n });\n\n this.eventEmitter.addListener(FWEventName.WillDisplayProduct, (event) => {\n this.handleWillDisplayProductEvent(event);\n });\n }\n\n /**\n * Exit Cart Page.\n *\n * The host app can call this method to exit their cart page.\n */\n public exitCartPage() {\n ShoppingModule.exitCartPage();\n }\n\n /**\n * \n * @param {number} count The number of items in the host app cart\n */\n public setCartItemCount(count: number) {\n ShoppingModule.setCartItemCount(count);\n }\n\n private async handleAddToCartEvent(event: AddToCartEvent & CallbackInfo) {\n if (this.onAddToCart) {\n const callbackId = event.callbackId;\n delete event.callbackId;\n const result = await this.onAddToCart(event as AddToCartEvent);\n if (result) {\n ShoppingModule.updateAddToCartStatus(\n result.res,\n result.tips,\n callbackId!,\n );\n }\n }\n }\n\n private async handleClickCartIconEvent(event: CallbackInfo) {\n if (this.onClickCartIcon) {\n const callbackId = event.callbackId;\n delete event.callbackId;\n const cartPage = await this.onClickCartIcon();\n this.currentCartPage = cartPage;\n\n if (cartPage) {\n ShoppingModule.jumpToCartPage(callbackId!);\n }\n }\n }\n\n private async handleUpdateProductDetailsEvent(\n event: UpdateProductDetailsEvent & CallbackInfo\n ) {\n if (this.onUpdateProductDetails) {\n const callbackId = event.callbackId;\n delete event.callbackId;\n const 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"]}
|
|
1
|
+
{"version":3,"sources":["VideoShopping.ts"],"names":["VideoShopping","cartIconVisible","_cartIconVisible","value","ShoppingModule","setCartIconVisible","getInstance","_instance","constructor","eventEmitter","NativeEventEmitter","addListener","FWEventName","AddToCart","event","handleAddToCartEvent","ClickCartIcon","handleClickCartIconEvent","UpdateProductDetails","handleUpdateProductDetailsEvent","WillDisplayProduct","handleWillDisplayProductEvent","exitCartPage","setCartItemCount","count","onAddToCart","callbackId","result","updateAddToCartStatus","res","tips","onClickCartIcon","cartPage","currentCartPage","jumpToCartPage","onUpdateProductDetails","product","updateVideoProduct","onWillDisplayProduct","config","updateProductViewConfig"],"mappings":";;;;;;;AAAA;;AAGA;;AAQA;;;;;;AAoBA;AACA;AACA;AACA,MAAMA,aAAN,CAAoB;AAIlB;AACF;AACA;AACA;AACA;;AAGE;AACF;AACA;AACA;AACA;;AA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M,KAAKD,oBAAL,CACnBxB,KADmB,CAArB;;AAGA,UAAIyB,MAAJ,EAAY;AACVnC,gCAAeoC,uBAAf,CAAuCD,MAAvC,EAA+Cb,UAA/C;AACD;AACF;AACF;;AAnJiB;;gBAAd1B,a;;eAsJSA,a","sourcesContent":["import { NativeEventEmitter } from 'react-native';\n\nimport type AddToCartResult from './models/AddToCartResult';\nimport {\n AddToCartEvent,\n FWEventName,\n UpdateProductDetailsEvent,\n WillDisplayProductEvent,\n} from './models/FWEvents';\nimport type Product from './models/Product';\nimport type ProductInfoViewConfiguration from './models/ProductInfoViewConfiguration';\nimport ShoppingModule from './modules/ShoppingModule';\n\nexport type AddToCartCallback = (\n event: AddToCartEvent\n) => Promise<AddToCartResult | undefined | null>;\n\nexport type ClickCartIconCallback = () => Promise<\n React.ReactNode | undefined | null\n>;\n\nexport type UpdateProductDetailsCallback = (\n event: UpdateProductDetailsEvent\n) => Promise<Product | undefined | null>;\n\nexport type WillDisplayProductCallback = (\n event: WillDisplayProductEvent\n) => Promise<ProductInfoViewConfiguration | undefined | null>;\n\ntype CallbackInfo = { callbackId?: number | string };\n\n/**\n * Entry class of Video Shopping\n */\nclass VideoShopping {\n private static _instance?: VideoShopping;\n private _cartIconVisible: boolean = true;\n\n /**\n * This callback is triggered when the user clicks the \"Add to cart\" button.\n *\n * The host app can return an AddToCartResult object to tell FireworkSDK the result of adding to cart.\n */\n public onAddToCart?: AddToCartCallback;\n\n /**\n * This callback is triggered when the user clicks the shopping cart icon.\n *\n * The host app can return a React.Node to integrate custom cart page to shopping flow.\n */\n public onClickCartIcon?: ClickCartIconCallback;\n\n /**\n * This callback is triggered when the video will be shown.\n *\n * The host app can return a Product object to update the latest product information.\n */\n public onUpdateProductDetails?: UpdateProductDetailsCallback;\n\n /**\n * This callback is triggered when the product will be shown.\n *\n * The host app can return a ProductInfoViewConfiguration object to configure \"Add to cart\" button style and cart icon style.\n */\n public onWillDisplayProduct?: WillDisplayProductCallback;\n\n /**\n * Defaults to true. You can hide the cart icon by setting this property to false. \n */\n public get cartIconVisible(): boolean {\n return this._cartIconVisible;\n }\n public set cartIconVisible(value: boolean) {\n this._cartIconVisible = value;\n ShoppingModule.setCartIconVisible(value);\n }\n\n public currentCartPage?: React.ReactNode;\n\n private eventEmitter: NativeEventEmitter;\n\n public static getInstance() {\n if (!VideoShopping._instance) {\n VideoShopping._instance = new VideoShopping();\n }\n\n return VideoShopping._instance!;\n }\n\n private constructor() {\n this.eventEmitter = new NativeEventEmitter(ShoppingModule);\n this.eventEmitter.addListener(FWEventName.AddToCart, (event) => {\n this.handleAddToCartEvent(event);\n });\n\n this.eventEmitter.addListener(FWEventName.ClickCartIcon, (event) => {\n this.handleClickCartIconEvent(event);\n });\n\n this.eventEmitter.addListener(FWEventName.UpdateProductDetails, (event) => {\n this.handleUpdateProductDetailsEvent(event);\n });\n\n this.eventEmitter.addListener(FWEventName.WillDisplayProduct, (event) => {\n this.handleWillDisplayProductEvent(event);\n });\n }\n\n /**\n * Exit Cart Page.\n *\n * The host app can call this method to exit their cart page.\n */\n public exitCartPage() {\n ShoppingModule.exitCartPage();\n }\n\n /**\n * \n * @param {number} count The number of items in the host app cart\n */\n public setCartItemCount(count: number) {\n ShoppingModule.setCartItemCount(count);\n }\n\n private async handleAddToCartEvent(event: AddToCartEvent & CallbackInfo) {\n if (this.onAddToCart) {\n const callbackId = event.callbackId;\n delete event.callbackId;\n const result = await this.onAddToCart(event as AddToCartEvent);\n if (result) {\n ShoppingModule.updateAddToCartStatus(\n result.res,\n result.tips,\n callbackId!,\n );\n }\n }\n }\n\n private async handleClickCartIconEvent(event: CallbackInfo) {\n if (this.onClickCartIcon) {\n const callbackId = event.callbackId;\n delete event.callbackId;\n const cartPage = await this.onClickCartIcon();\n this.currentCartPage = cartPage;\n\n if (cartPage) {\n ShoppingModule.jumpToCartPage(callbackId!);\n }\n }\n }\n\n private async handleUpdateProductDetailsEvent(\n event: UpdateProductDetailsEvent & CallbackInfo\n ) {\n if (this.onUpdateProductDetails) {\n const callbackId = event.callbackId;\n delete event.callbackId;\n const 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"]}
|
|
@@ -68,7 +68,10 @@ class VideoFeed extends _react.default.Component {
|
|
|
68
68
|
}, this.props, {
|
|
69
69
|
ref: this.nativeComponentRef,
|
|
70
70
|
onVideoFeedLoadFinished: this._onVideoFeedLoadFinished,
|
|
71
|
-
mode: mode
|
|
71
|
+
mode: mode,
|
|
72
|
+
style: Object.assign({}, this.props.style, {
|
|
73
|
+
zIndex: -1
|
|
74
|
+
})
|
|
72
75
|
}));
|
|
73
76
|
}
|
|
74
77
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["VideoFeed.tsx"],"names":["NativeComponentName","VideoFeed","React","Component","createRef","nativeNodeHandle","nativeComponentRef","current","UIManager","dispatchViewManagerCommand","getViewManagerConfig","Commands","refresh","event","name","reason","nativeEvent","props","onVideoFeedLoadFinished","render","source","channel","playlist","mode","videoFeedConfiguration","titleHidden","title","hidden","titlePosition","key","_onVideoFeedLoadFinished"],"mappings":";;;;;;;AAAA;;AACA;;AAKA;;;;;;;;AA6CA,MAAMA,mBAAmB,GAAG,aAA5B;;AAEe,MAAMC,SAAN,SAAwBC,eAAMC,SAA9B,CAAyD;AAAA;AAAA;;AAAA,6DAKjDD,eAAME,SAAN,EALiD;;AAAA,qCASrD,MAAM;AACrB,YAAMC,gBAAgB,GAAG,iCAAe,KAAKC,kBAAL,CAAwBC,OAAvC,CAAzB;;AAEAC,6BA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["VideoFeed.tsx"],"names":["NativeComponentName","VideoFeed","React","Component","createRef","nativeNodeHandle","nativeComponentRef","current","UIManager","dispatchViewManagerCommand","getViewManagerConfig","Commands","refresh","event","name","reason","nativeEvent","props","onVideoFeedLoadFinished","render","source","channel","playlist","mode","videoFeedConfiguration","titleHidden","title","hidden","titlePosition","key","_onVideoFeedLoadFinished","Object","assign","style","zIndex"],"mappings":";;;;;;;AAAA;;AACA;;AAKA;;;;;;;;AA6CA,MAAMA,mBAAmB,GAAG,aAA5B;;AAEe,MAAMC,SAAN,SAAwBC,eAAMC,SAA9B,CAAyD;AAAA;AAAA;;AAAA,6DAKjDD,eAAME,SAAN,EALiD;;AAAA,qCASrD,MAAM;AACrB,YAAMC,gBAAgB,GAAG,iCAAe,KAAKC,kBAAL,CAAwBC,OAAvC,CAAzB;;AAEAC,6BAAUC,0BAAV,CACE,iCAAeJ,gBAAf,CADF,EAEEG,uBAAUE,oBAAV,CAA+BV,mBAA/B,EAAoDW,QAApD,CAA6DC,OAF/D,EAGE,EAHF;AAKD,KAjBqE;;AAAA,sDAoBpEC,KADiC,IAE9B;AACH,YAAM;AAAEC,QAAAA,IAAF;AAAQC,QAAAA;AAAR,UAAmBF,KAAK,CAACG,WAA/B;;AACA,UAAI,KAAKC,KAAL,CAAWC,uBAAf,EAAwC;AACtC,YAAIJ,IAAJ,EAAU;AACR,eAAKG,KAAL,CAAWC,uBAAX,CAAmC;AAAEJ,YAAAA,IAAF;AAAQC,YAAAA;AAAR,WAAnC;AACD,SAFD,MAEO;AACL,eAAKE,KAAL,CAAWC,uBAAX;AACD;AACF;AACF,KA9BqE;AAAA;;AAgCtEC,EAAAA,MAAM,GAAG;AAAA;;AACP,UAAM;AACJC,MAAAA,MADI;AAEJC,MAAAA,OAAO,GAAG,EAFN;AAGJC,MAAAA,QAAQ,GAAG,EAHP;AAIJC,MAAAA,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,6BAAC,oBAAD;AACE,MAAA,GAAG,EAAEC;AADP,OAEM,KAAKZ,KAFX;AAGE,MAAA,GAAG,EAAE,KAAKX,kBAHZ;AAIE,MAAA,uBAAuB,EAAE,KAAKwB,wBAJhC;AAKE,MAAA,IAAI,EAAEP,IALR;AAME,MAAA,KAAK,EAAEQ,MAAM,CAACC,MAAP,CAAc,EAAd,EAAkB,KAAKf,KAAL,CAAWgB,KAA7B,EAAoC;AAACC,QAAAA,MAAM,EAAE,CAAC;AAAV,OAApC;AANT,OADF;AAUD;;AAvDqE;;;;gBAAnDjC,S,kBACG;AACpBsB,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 style={Object.assign({}, this.props.style, {zIndex: -1})}\n />\n );\n }\n}\n"]}
|
|
@@ -1 +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;eAsBeL,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 setCartIconVisible(visible: boolean): void;\n setCartItemCount(count: number): void;\n}\n\nexport default ShoppingModule as IShoppingModule;\n"]}
|
|
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;eAsBeL,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 | string): void;\n updateProductViewConfig(config: ProductInfoViewConfiguration, callbackId: number | string): void;\n updateAddToCartStatus(res: string, tips: string, callbackId: number | string): void;\n jumpToCartPage(callbackId: number | string): void;\n exitCartPage(): void;\n setCartIconVisible(visible: boolean): void;\n setCartItemCount(count: number): void;\n}\n\nexport default ShoppingModule as IShoppingModule;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["VideoShopping.ts"],"names":["NativeEventEmitter","FWEventName","ShoppingModule","VideoShopping","cartIconVisible","_cartIconVisible","value","setCartIconVisible","getInstance","_instance","constructor","eventEmitter","addListener","AddToCart","event","handleAddToCartEvent","ClickCartIcon","handleClickCartIconEvent","UpdateProductDetails","handleUpdateProductDetailsEvent","WillDisplayProduct","handleWillDisplayProductEvent","exitCartPage","setCartItemCount","count","onAddToCart","callbackId","result","updateAddToCartStatus","res","tips","onClickCartIcon","cartPage","currentCartPage","jumpToCartPage","onUpdateProductDetails","product","updateVideoProduct","onWillDisplayProduct","config","updateProductViewConfig"],"mappings":";;AAAA,SAASA,kBAAT,QAAmC,cAAnC;AAGA,SAEEC,WAFF,QAKO,mBALP;AAQA,OAAOC,cAAP,MAA2B,0BAA3B;;AAoBA;AACA;AACA;AACA,MAAMC,aAAN,CAAoB;AAIlB;AACF;AACA;AACA;AACA;;AAGE;AACF;AACA;AACA;AACA;;AAGE;AACF;AACA;AACA;AACA;;AAGE;AACF;AACA;AACA;AACA;;AAGE;AACF;AACA;AAC4B,MAAfC,eAAe,GAAY;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,oBAAL,CACnBxB,KADmB,CAArB;;AAGA,UAAIyB,MAAJ,EAAY;AACVrC,QAAAA,cAAc,CAACsC,uBAAf,CAAuCD,MAAvC,EAA+Cb,UAA/C;AACD;AACF;AACF;;AAnJiB;;gBAAdvB,a;;AAsJN,eAAeA,aAAf","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 private _cartIconVisible: boolean = true;\n\n /**\n * This callback is triggered when the user clicks the \"Add to cart\" button.\n *\n * The host app can return an AddToCartResult object to tell FireworkSDK the result of adding to cart.\n */\n public onAddToCart?: AddToCartCallback;\n\n /**\n * This callback is triggered when the user clicks the shopping cart icon.\n *\n * The host app can return a React.Node to integrate custom cart page to shopping flow.\n */\n public onClickCartIcon?: ClickCartIconCallback;\n\n /**\n * This callback is triggered when the video will be shown.\n *\n * The host app can return a Product object to update the latest product information.\n */\n public onUpdateProductDetails?: UpdateProductDetailsCallback;\n\n /**\n * This callback is triggered when the product will be shown.\n *\n * The host app can return a ProductInfoViewConfiguration object to configure \"Add to cart\" button style and cart icon style.\n */\n public onWillDisplayProduct?: WillDisplayProductCallback;\n\n /**\n * Defaults to true. You can hide the cart icon by setting this property to false. \n */\n public get cartIconVisible(): boolean {\n return this._cartIconVisible;\n }\n public set cartIconVisible(value: boolean) {\n this._cartIconVisible = value;\n ShoppingModule.setCartIconVisible(value);\n }\n\n public currentCartPage?: React.ReactNode;\n\n private eventEmitter: NativeEventEmitter;\n\n public static getInstance() {\n if (!VideoShopping._instance) {\n VideoShopping._instance = new VideoShopping();\n }\n\n return VideoShopping._instance!;\n }\n\n private constructor() {\n this.eventEmitter = new NativeEventEmitter(ShoppingModule);\n this.eventEmitter.addListener(FWEventName.AddToCart, (event) => {\n this.handleAddToCartEvent(event);\n });\n\n this.eventEmitter.addListener(FWEventName.ClickCartIcon, (event) => {\n this.handleClickCartIconEvent(event);\n });\n\n this.eventEmitter.addListener(FWEventName.UpdateProductDetails, (event) => {\n this.handleUpdateProductDetailsEvent(event);\n });\n\n this.eventEmitter.addListener(FWEventName.WillDisplayProduct, (event) => {\n this.handleWillDisplayProductEvent(event);\n });\n }\n\n /**\n * Exit Cart Page.\n *\n * The host app can call this method to exit their cart page.\n */\n public exitCartPage() {\n ShoppingModule.exitCartPage();\n }\n\n /**\n * \n * @param {number} count The number of items in the host app cart\n */\n public setCartItemCount(count: number) {\n ShoppingModule.setCartItemCount(count);\n }\n\n private async handleAddToCartEvent(event: AddToCartEvent & CallbackInfo) {\n if (this.onAddToCart) {\n const callbackId = event.callbackId;\n delete event.callbackId;\n const result = await this.onAddToCart(event as AddToCartEvent);\n if (result) {\n ShoppingModule.updateAddToCartStatus(\n result.res,\n result.tips,\n callbackId!,\n );\n }\n }\n }\n\n private async handleClickCartIconEvent(event: CallbackInfo) {\n if (this.onClickCartIcon) {\n const callbackId = event.callbackId;\n delete event.callbackId;\n const cartPage = await this.onClickCartIcon();\n this.currentCartPage = cartPage;\n\n if (cartPage) {\n ShoppingModule.jumpToCartPage(callbackId!);\n }\n }\n }\n\n private async handleUpdateProductDetailsEvent(\n event: UpdateProductDetailsEvent & CallbackInfo\n ) {\n if (this.onUpdateProductDetails) {\n const callbackId = event.callbackId;\n delete event.callbackId;\n const 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"]}
|
|
1
|
+
{"version":3,"sources":["VideoShopping.ts"],"names":["NativeEventEmitter","FWEventName","ShoppingModule","VideoShopping","cartIconVisible","_cartIconVisible","value","setCartIconVisible","getInstance","_instance","constructor","eventEmitter","addListener","AddToCart","event","handleAddToCartEvent","ClickCartIcon","handleClickCartIconEvent","UpdateProductDetails","handleUpdateProductDetailsEvent","WillDisplayProduct","handleWillDisplayProductEvent","exitCartPage","setCartItemCount","count","onAddToCart","callbackId","result","updateAddToCartStatus","res","tips","onClickCartIcon","cartPage","currentCartPage","jumpToCartPage","onUpdateProductDetails","product","updateVideoProduct","onWillDisplayProduct","config","updateProductViewConfig"],"mappings":";;AAAA,SAASA,kBAAT,QAAmC,cAAnC;AAGA,SAEEC,WAFF,QAKO,mBALP;AAQA,OAAOC,cAAP,MAA2B,0BAA3B;;AAoBA;AACA;AACA;AACA,MAAMC,aAAN,CAAoB;AAIlB;AACF;AACA;AACA;AACA;;AAGE;AACF;AACA;AACA;AACA;;AAGE;AACF;AACA;AACA;AACA;;AAGE;AACF;AACA;AACA;AACA;;AAGE;AACF;AACA;AAC4B,MAAfC,eAAe,GAAY;AACpC,WAAO,KAAKC,gBAAZ;AACD;;AACyB,MAAfD,eAAe,CAACE,KAAD,EAAiB;AACzC,SAAKD,gBAAL,GAAwBC,KAAxB;AACAJ,IAAAA,cAAc,CAACK,kBAAf,CA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JiB;;gBAAdvB,a;;AAsJN,eAAeA,aAAf","sourcesContent":["import { NativeEventEmitter } from 'react-native';\n\nimport type AddToCartResult from './models/AddToCartResult';\nimport {\n AddToCartEvent,\n FWEventName,\n UpdateProductDetailsEvent,\n WillDisplayProductEvent,\n} from './models/FWEvents';\nimport type Product from './models/Product';\nimport type ProductInfoViewConfiguration from './models/ProductInfoViewConfiguration';\nimport ShoppingModule from './modules/ShoppingModule';\n\nexport type AddToCartCallback = (\n event: AddToCartEvent\n) => Promise<AddToCartResult | undefined | null>;\n\nexport type ClickCartIconCallback = () => Promise<\n React.ReactNode | undefined | null\n>;\n\nexport type UpdateProductDetailsCallback = (\n event: UpdateProductDetailsEvent\n) => Promise<Product | undefined | null>;\n\nexport type WillDisplayProductCallback = (\n event: WillDisplayProductEvent\n) => Promise<ProductInfoViewConfiguration | undefined | null>;\n\ntype CallbackInfo = { callbackId?: number | string };\n\n/**\n * Entry class of Video Shopping\n */\nclass VideoShopping {\n private static _instance?: VideoShopping;\n private _cartIconVisible: boolean = true;\n\n /**\n * This callback is triggered when the user clicks the \"Add to cart\" button.\n *\n * The host app can return an AddToCartResult object to tell FireworkSDK the result of adding to cart.\n */\n public onAddToCart?: AddToCartCallback;\n\n /**\n * This callback is triggered when the user clicks the shopping cart icon.\n *\n * The host app can return a React.Node to integrate custom cart page to shopping flow.\n */\n public onClickCartIcon?: ClickCartIconCallback;\n\n /**\n * This callback is triggered when the video will be shown.\n *\n * The host app can return a Product object to update the latest product information.\n */\n public onUpdateProductDetails?: UpdateProductDetailsCallback;\n\n /**\n * This callback is triggered when the product will be shown.\n *\n * The host app can return a ProductInfoViewConfiguration object to configure \"Add to cart\" button style and cart icon style.\n */\n public onWillDisplayProduct?: WillDisplayProductCallback;\n\n /**\n * Defaults to true. You can hide the cart icon by setting this property to false. \n */\n public get cartIconVisible(): boolean {\n return this._cartIconVisible;\n }\n public set cartIconVisible(value: boolean) {\n this._cartIconVisible = value;\n ShoppingModule.setCartIconVisible(value);\n }\n\n public currentCartPage?: React.ReactNode;\n\n private eventEmitter: NativeEventEmitter;\n\n public static getInstance() {\n if (!VideoShopping._instance) {\n VideoShopping._instance = new VideoShopping();\n }\n\n return VideoShopping._instance!;\n }\n\n private constructor() {\n this.eventEmitter = new NativeEventEmitter(ShoppingModule);\n this.eventEmitter.addListener(FWEventName.AddToCart, (event) => {\n this.handleAddToCartEvent(event);\n });\n\n this.eventEmitter.addListener(FWEventName.ClickCartIcon, (event) => {\n this.handleClickCartIconEvent(event);\n });\n\n this.eventEmitter.addListener(FWEventName.UpdateProductDetails, (event) => {\n this.handleUpdateProductDetailsEvent(event);\n });\n\n this.eventEmitter.addListener(FWEventName.WillDisplayProduct, (event) => {\n this.handleWillDisplayProductEvent(event);\n });\n }\n\n /**\n * Exit Cart Page.\n *\n * The host app can call this method to exit their cart page.\n */\n public exitCartPage() {\n ShoppingModule.exitCartPage();\n }\n\n /**\n * \n * @param {number} count The number of items in the host app cart\n */\n public setCartItemCount(count: number) {\n ShoppingModule.setCartItemCount(count);\n }\n\n private async handleAddToCartEvent(event: AddToCartEvent & CallbackInfo) {\n if (this.onAddToCart) {\n const callbackId = event.callbackId;\n delete event.callbackId;\n const result = await this.onAddToCart(event as AddToCartEvent);\n if (result) {\n ShoppingModule.updateAddToCartStatus(\n result.res,\n result.tips,\n callbackId!,\n );\n }\n }\n }\n\n private async handleClickCartIconEvent(event: CallbackInfo) {\n if (this.onClickCartIcon) {\n const callbackId = event.callbackId;\n delete event.callbackId;\n const cartPage = await this.onClickCartIcon();\n this.currentCartPage = cartPage;\n\n if (cartPage) {\n ShoppingModule.jumpToCartPage(callbackId!);\n }\n }\n }\n\n private async handleUpdateProductDetailsEvent(\n event: UpdateProductDetailsEvent & CallbackInfo\n ) {\n if (this.onUpdateProductDetails) {\n const callbackId = event.callbackId;\n delete event.callbackId;\n const 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"]}
|
|
@@ -54,7 +54,10 @@ export default class VideoFeed extends React.Component {
|
|
|
54
54
|
}, this.props, {
|
|
55
55
|
ref: this.nativeComponentRef,
|
|
56
56
|
onVideoFeedLoadFinished: this._onVideoFeedLoadFinished,
|
|
57
|
-
mode: mode
|
|
57
|
+
mode: mode,
|
|
58
|
+
style: Object.assign({}, this.props.style, {
|
|
59
|
+
zIndex: -1
|
|
60
|
+
})
|
|
58
61
|
}));
|
|
59
62
|
}
|
|
60
63
|
|
|
@@ -1 +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,C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,"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","Object","assign","style","zIndex"],"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,IALR;AAME,MAAA,KAAK,EAAEQ,MAAM,CAACC,MAAP,CAAc,EAAd,EAAkB,KAAKf,KAAL,CAAWgB,KAA7B,EAAoC;AAACC,QAAAA,MAAM,EAAE,CAAC;AAAV,OAApC;AANT,OADF;AAUD;;AAvDqE;;gBAAnD/B,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 style={Object.assign({}, this.props.style, {zIndex: -1})}\n />\n );\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["ShoppingModule.ts"],"names":["NativeModules","LINKING_ERROR","ShoppingModule","Proxy","get","Error"],"mappings":"AAAA,SAEEA,aAFF,QAGO,cAHP;AAMA,SAASC,aAAT,QAA8B,6BAA9B;AAEA,MAAMC,cAAc,GAAGF,aAAa,CAACE,cAAd,GACnBF,aAAa,CAACE,cADK,GAEnB,IAAIC,KAAJ,CACE,EADF,EAEE;AACEC,EAAAA,GAAG,GAAG;AACJ,UAAM,IAAIC,KAAJ,CAAUJ,aAAV,CAAN;AACD;;AAHH,CAFF,CAFJ;AAsBA,eAAeC,cAAf","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 setCartIconVisible(visible: boolean): void;\n setCartItemCount(count: number): void;\n}\n\nexport default ShoppingModule as IShoppingModule;\n"]}
|
|
1
|
+
{"version":3,"sources":["ShoppingModule.ts"],"names":["NativeModules","LINKING_ERROR","ShoppingModule","Proxy","get","Error"],"mappings":"AAAA,SAEEA,aAFF,QAGO,cAHP;AAMA,SAASC,aAAT,QAA8B,6BAA9B;AAEA,MAAMC,cAAc,GAAGF,aAAa,CAACE,cAAd,GACnBF,aAAa,CAACE,cADK,GAEnB,IAAIC,KAAJ,CACE,EADF,EAEE;AACEC,EAAAA,GAAG,GAAG;AACJ,UAAM,IAAIC,KAAJ,CAAUJ,aAAV,CAAN;AACD;;AAHH,CAFF,CAFJ;AAsBA,eAAeC,cAAf","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 | string): void;\n updateProductViewConfig(config: ProductInfoViewConfiguration, callbackId: number | string): void;\n updateAddToCartStatus(res: string, tips: string, callbackId: number | string): void;\n jumpToCartPage(callbackId: number | string): void;\n exitCartPage(): void;\n setCartIconVisible(visible: boolean): void;\n setCartItemCount(count: number): void;\n}\n\nexport default ShoppingModule as IShoppingModule;\n"]}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
export default interface ADConfig {
|
|
2
2
|
/**
|
|
3
|
-
* Defaults to none.
|
|
3
|
+
* Defaults to none. Only supported on iOS.
|
|
4
4
|
*/
|
|
5
5
|
type?: 'none' | 'admob' | 'ima';
|
|
6
6
|
/**
|
|
7
|
-
* Defaults to true. The property only takes effect when type is admob.
|
|
7
|
+
* Defaults to true. The property only takes effect when type is admob. Only supported on iOS.
|
|
8
8
|
*/
|
|
9
9
|
startMobileAds?: boolean;
|
|
10
10
|
}
|
|
@@ -5,7 +5,7 @@ export interface AddToCartButtonConfiguration {
|
|
|
5
5
|
}
|
|
6
6
|
export default interface ProductInfoViewConfiguration {
|
|
7
7
|
/**
|
|
8
|
-
* Configuration of "Add to cart" button.
|
|
8
|
+
* Configuration of "Add to cart" button. Only supported on iOS.
|
|
9
9
|
*/
|
|
10
10
|
addToCartButton?: AddToCartButtonConfiguration;
|
|
11
11
|
}
|
|
@@ -14,7 +14,7 @@ export default interface VideoFeedConfiguration {
|
|
|
14
14
|
*/
|
|
15
15
|
backgroundColor?: string;
|
|
16
16
|
/**
|
|
17
|
-
* CornerRadius of video feed.
|
|
17
|
+
* CornerRadius of video feed. Only supported on iOS.
|
|
18
18
|
*/
|
|
19
19
|
cornerRadius?: number;
|
|
20
20
|
/**
|
|
@@ -26,7 +26,7 @@ export default interface VideoFeedConfiguration {
|
|
|
26
26
|
*/
|
|
27
27
|
titlePosition?: VideoFeedTitlePosition;
|
|
28
28
|
/**
|
|
29
|
-
* Configuration of video feed play icon.
|
|
29
|
+
* Configuration of video feed play icon. Only supported on iOS.
|
|
30
30
|
*/
|
|
31
31
|
playIcon?: VideoFeedPlayIconConfiguration;
|
|
32
32
|
}
|
|
@@ -3,10 +3,10 @@ import type Product from '../models/Product';
|
|
|
3
3
|
import type ProductInfoViewConfiguration from '../models/ProductInfoViewConfiguration';
|
|
4
4
|
interface IShoppingModule extends NativeModule {
|
|
5
5
|
init(): void;
|
|
6
|
-
updateVideoProduct(production: Product, callbackId: number): void;
|
|
7
|
-
updateProductViewConfig(config: ProductInfoViewConfiguration, callbackId: number): void;
|
|
8
|
-
updateAddToCartStatus(res: string, tips: string, callbackId: number): void;
|
|
9
|
-
jumpToCartPage(callbackId: number): void;
|
|
6
|
+
updateVideoProduct(production: Product, callbackId: number | string): void;
|
|
7
|
+
updateProductViewConfig(config: ProductInfoViewConfiguration, callbackId: number | string): void;
|
|
8
|
+
updateAddToCartStatus(res: string, tips: string, callbackId: number | string): void;
|
|
9
|
+
jumpToCartPage(callbackId: number | string): void;
|
|
10
10
|
exitCartPage(): void;
|
|
11
11
|
setCartIconVisible(visible: boolean): void;
|
|
12
12
|
setCartItemCount(count: number): void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-firework-sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Firework React Native SDK",
|
|
5
5
|
"main": "lib/commonjs/index",
|
|
6
6
|
"module": "lib/module/index",
|
|
@@ -26,7 +26,6 @@
|
|
|
26
26
|
"typescript": "tsc --noEmit",
|
|
27
27
|
"lint": "eslint \"**/*.{js,ts,tsx}\"",
|
|
28
28
|
"prepare": "bob build",
|
|
29
|
-
"release": "release-it",
|
|
30
29
|
"install_js_depencies": "npm i && cd example && npm i",
|
|
31
30
|
"setup_ios": "npm run install_js_depencies && cd example && pod-install",
|
|
32
31
|
"setup_android": "npm run install_js_depencies"
|
|
@@ -49,7 +48,6 @@
|
|
|
49
48
|
"devDependencies": {
|
|
50
49
|
"@commitlint/config-conventional": "^11.0.0",
|
|
51
50
|
"@react-native-community/eslint-config": "^2.0.0",
|
|
52
|
-
"@release-it/conventional-changelog": "^2.0.0",
|
|
53
51
|
"@types/jest": "^26.0.23",
|
|
54
52
|
"@types/react": "^17.0.37",
|
|
55
53
|
"@types/react-native": "^0.66.4",
|
|
@@ -64,7 +62,6 @@
|
|
|
64
62
|
"react": "17.0.2",
|
|
65
63
|
"react-native": "0.66.4",
|
|
66
64
|
"react-native-builder-bob": "^0.18.0",
|
|
67
|
-
"release-it": "^14.2.2",
|
|
68
65
|
"typescript": "^4.4.4"
|
|
69
66
|
},
|
|
70
67
|
"peerDependencies": {
|
|
@@ -83,23 +80,6 @@
|
|
|
83
80
|
"@commitlint/config-conventional"
|
|
84
81
|
]
|
|
85
82
|
},
|
|
86
|
-
"release-it": {
|
|
87
|
-
"git": {
|
|
88
|
-
"commitMessage": "chore: release ${version}",
|
|
89
|
-
"tagName": "v${version}"
|
|
90
|
-
},
|
|
91
|
-
"npm": {
|
|
92
|
-
"publish": true
|
|
93
|
-
},
|
|
94
|
-
"github": {
|
|
95
|
-
"release": true
|
|
96
|
-
},
|
|
97
|
-
"plugins": {
|
|
98
|
-
"@release-it/conventional-changelog": {
|
|
99
|
-
"preset": "angular"
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
},
|
|
103
83
|
"eslintConfig": {
|
|
104
84
|
"root": true,
|
|
105
85
|
"extends": [
|
|
@@ -14,9 +14,9 @@ Pod::Spec.new do |s|
|
|
|
14
14
|
s.source = { :git => "https://github.com/loopsocial/bogano.git", :tag => "#{s.version}" }
|
|
15
15
|
|
|
16
16
|
s.source_files = "ios/**/*.{h,m,mm,swift}"
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
|
|
18
|
+
s.pod_target_xcconfig = { 'FRAMEWORK_SEARCH_PATHS' => ['"${PODS_ROOT}/FireworkVideoGIMASupport"','"${PODS_ROOT}/FireworkVideoGAMSupport"','"${PODS_XCFRAMEWORKS_BUILD_DIR}/FireworkVideoGIMASupport"','"${PODS_XCFRAMEWORKS_BUILD_DIR}/FireworkVideoGAMSupport"','"${PODS_ROOT}/GoogleAds-IMA-iOS-SDK"']}
|
|
19
19
|
|
|
20
20
|
s.dependency "React-Core"
|
|
21
|
-
s.dependency "FireworkVideo","
|
|
21
|
+
s.dependency "FireworkVideo","0.13.0"
|
|
22
22
|
end
|
package/src/VideoShopping.ts
CHANGED
|
@@ -27,7 +27,7 @@ export type WillDisplayProductCallback = (
|
|
|
27
27
|
event: WillDisplayProductEvent
|
|
28
28
|
) => Promise<ProductInfoViewConfiguration | undefined | null>;
|
|
29
29
|
|
|
30
|
-
type CallbackInfo = { callbackId?: number };
|
|
30
|
+
type CallbackInfo = { callbackId?: number | string };
|
|
31
31
|
|
|
32
32
|
/**
|
|
33
33
|
* Entry class of Video Shopping
|
|
@@ -103,6 +103,7 @@ export default class VideoFeed extends React.Component<IVideoFeedProps> {
|
|
|
103
103
|
ref={this.nativeComponentRef}
|
|
104
104
|
onVideoFeedLoadFinished={this._onVideoFeedLoadFinished}
|
|
105
105
|
mode={mode}
|
|
106
|
+
style={Object.assign({}, this.props.style, {zIndex: -1})}
|
|
106
107
|
/>
|
|
107
108
|
);
|
|
108
109
|
}
|
package/src/models/ADConfig.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
export default interface ADConfig {
|
|
2
2
|
/**
|
|
3
|
-
* Defaults to none.
|
|
3
|
+
* Defaults to none. Only supported on iOS.
|
|
4
4
|
*/
|
|
5
5
|
type?: 'none' | 'admob' | 'ima',
|
|
6
6
|
/**
|
|
7
|
-
* Defaults to true. The property only takes effect when type is admob.
|
|
7
|
+
* Defaults to true. The property only takes effect when type is admob. Only supported on iOS.
|
|
8
8
|
*/
|
|
9
9
|
startMobileAds?: boolean,
|
|
10
10
|
}
|
|
@@ -6,7 +6,7 @@ export interface AddToCartButtonConfiguration {
|
|
|
6
6
|
|
|
7
7
|
export default interface ProductInfoViewConfiguration {
|
|
8
8
|
/**
|
|
9
|
-
* Configuration of "Add to cart" button.
|
|
9
|
+
* Configuration of "Add to cart" button. Only supported on iOS.
|
|
10
10
|
*/
|
|
11
11
|
addToCartButton?: AddToCartButtonConfiguration;
|
|
12
12
|
}
|
|
@@ -17,7 +17,7 @@ export default interface VideoFeedConfiguration {
|
|
|
17
17
|
*/
|
|
18
18
|
backgroundColor?: string;
|
|
19
19
|
/**
|
|
20
|
-
* CornerRadius of video feed.
|
|
20
|
+
* CornerRadius of video feed. Only supported on iOS.
|
|
21
21
|
*/
|
|
22
22
|
cornerRadius?: number;
|
|
23
23
|
/**
|
|
@@ -29,7 +29,7 @@ export default interface VideoFeedConfiguration {
|
|
|
29
29
|
*/
|
|
30
30
|
titlePosition?: VideoFeedTitlePosition;
|
|
31
31
|
/**
|
|
32
|
-
* Configuration of video feed play icon.
|
|
32
|
+
* Configuration of video feed play icon. Only supported on iOS.
|
|
33
33
|
*/
|
|
34
34
|
playIcon?: VideoFeedPlayIconConfiguration;
|
|
35
35
|
}
|
|
@@ -19,10 +19,10 @@ const ShoppingModule = NativeModules.ShoppingModule
|
|
|
19
19
|
|
|
20
20
|
interface IShoppingModule extends NativeModule {
|
|
21
21
|
init(): void;
|
|
22
|
-
updateVideoProduct(production: Product, callbackId: number): void;
|
|
23
|
-
updateProductViewConfig(config: ProductInfoViewConfiguration, callbackId: number): void;
|
|
24
|
-
updateAddToCartStatus(res: string, tips: string, callbackId: number): void;
|
|
25
|
-
jumpToCartPage(callbackId: number): void;
|
|
22
|
+
updateVideoProduct(production: Product, callbackId: number | string): void;
|
|
23
|
+
updateProductViewConfig(config: ProductInfoViewConfiguration, callbackId: number | string): void;
|
|
24
|
+
updateAddToCartStatus(res: string, tips: string, callbackId: number | string): void;
|
|
25
|
+
jumpToCartPage(callbackId: number | string): void;
|
|
26
26
|
exitCartPage(): void;
|
|
27
27
|
setCartIconVisible(visible: boolean): void;
|
|
28
28
|
setCartItemCount(count: number): void;
|