react-native-firework-sdk 1.0.0-beta.1 → 1.0.4

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.
Files changed (31) hide show
  1. package/README.md +26 -24
  2. package/android/build.gradle +26 -23
  3. package/android/src/main/AndroidManifest.xml +4 -1
  4. package/android/src/main/java/com/reactnativefireworksdk/components/videofeed/FWVideoFeed.kt +4 -3
  5. package/ios/Component/VideoFeedManager.m +2 -1
  6. package/ios/FireworkSdk-Bridging-Header.h +2 -0
  7. package/ios/Models/FireworkSDK+JsModel.swift +1 -1
  8. package/ios/Modules/FireworkSDKModule/FireworkSDKModule+EventTracking.swift +5 -1
  9. package/ios/react_native_firework_sdk.h +14 -0
  10. package/lib/commonjs/VideoShopping.js.map +1 -1
  11. package/lib/commonjs/components/VideoFeed.js +4 -1
  12. package/lib/commonjs/components/VideoFeed.js.map +1 -1
  13. package/lib/commonjs/modules/ShoppingModule.js.map +1 -1
  14. package/lib/module/VideoShopping.js.map +1 -1
  15. package/lib/module/components/VideoFeed.js +4 -1
  16. package/lib/module/components/VideoFeed.js.map +1 -1
  17. package/lib/module/modules/ShoppingModule.js.map +1 -1
  18. package/lib/typescript/models/ADConfig.d.ts +2 -2
  19. package/lib/typescript/models/ProductInfoViewConfiguration.d.ts +1 -1
  20. package/lib/typescript/models/VideoFeedConfiguration.d.ts +2 -2
  21. package/lib/typescript/models/VideoPlayerConfiguration.d.ts +1 -1
  22. package/lib/typescript/modules/ShoppingModule.d.ts +4 -4
  23. package/package.json +1 -21
  24. package/react-native-firework-sdk.podspec +12 -3
  25. package/src/VideoShopping.ts +1 -1
  26. package/src/components/VideoFeed.tsx +1 -0
  27. package/src/models/ADConfig.ts +2 -2
  28. package/src/models/ProductInfoViewConfiguration.ts +1 -1
  29. package/src/models/VideoFeedConfiguration.ts +2 -2
  30. package/src/models/VideoPlayerConfiguration.ts +1 -1
  31. 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
- ```js
14
- import { multiply } from "react-native-firework-sdk";
15
-
16
- // ...
17
-
18
- const result = await multiply(3, 7);
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
- ## Contributing
22
-
23
- See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.
24
-
25
- ## Running Example
31
+ ### Video Feed Integration
32
+ ```ts
33
+ import {
34
+ VideoFeed,
35
+ } from 'react-native-firework-sdk';
26
36
 
27
- ### Run iOS Example
28
- 1. `npm run setup_ios`
29
- 2. `cd example && npm start`
30
- 3. open `example/ios/FireworkSdkExample.xcworkspace` using Xcode
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
+ ```
@@ -37,7 +37,7 @@ android {
37
37
  defaultConfig {
38
38
  minSdkVersion 21
39
39
  targetSdkVersion getExtOrIntegerDefault('targetSdkVersion')
40
- versionCode 100000
40
+ versionCode 100002
41
41
  versionName "1.0.0"
42
42
  }
43
43
 
@@ -64,33 +64,34 @@ android {
64
64
  targetCompatibility JavaVersion.VERSION_1_8
65
65
  }
66
66
 
67
- afterEvaluate {
68
- libraryVariants.all { variant ->
69
- variant.variantData.outputFactory.apkDataList.each { apkData ->
70
- def flavor = variant.mergedFlavor
71
- def name = flavor.getVersionName()
72
- def code = flavor.getVersionCode()
73
-
74
- // project.name ->
75
- // buildType.name -> debug
76
- // apkData.outputFileName -> ${project.name}-${buildType.name}.aar
77
- if (variant.name == 'debug') {
78
- apkData.outputFileName = "firework-react-native-sdk" + "-" + variant.name + ".aar"
79
- // apkData.outputFileName = apkData.outputFileName.replace(".aar","-" + name + ".aar" )
80
- } else if (variant.name == 'release') {
81
- apkData.outputFileName = "firework-react-native-sdk" + "-" + variant.name + ".aar"
82
- // apkData.outputFileName = apkData.outputFileName.replace(".aar","-" + name + ".aar" )
83
- }
84
- }
85
- }
86
- }
67
+ // when set classpath("com.android.tools.build:gradle:4.2.2"), will show error:
68
+ // No such property: outputFactory for class: com.android.build.gradle.internal.variant.LibraryVariantData
69
+ // afterEvaluate {
70
+ // libraryVariants.all { variant ->
71
+ // variant.variantData.outputFactory.apkDataList.each { apkData ->
72
+ // def flavor = variant.mergedFlavor
73
+ // def name = flavor.getVersionName()
74
+ // def code = flavor.getVersionCode()
75
+ //
76
+ // // project.name ->
77
+ // // buildType.name -> debug
78
+ // // apkData.outputFileName -> ${project.name}-${buildType.name}.aar
79
+ // if (variant.name == 'debug') {
80
+ // apkData.outputFileName = "firework-react-native-sdk" + "-" + variant.name + ".aar"
81
+ // // apkData.outputFileName = apkData.outputFileName.replace(".aar","-" + name + ".aar" )
82
+ // } else if (variant.name == 'release') {
83
+ // apkData.outputFileName = "firework-react-native-sdk" + "-" + variant.name + ".aar"
84
+ // // apkData.outputFileName = apkData.outputFileName.replace(".aar","-" + name + ".aar" )
85
+ // }
86
+ // }
87
+ // }
88
+ // }
87
89
 
88
90
  }
89
91
 
90
92
  repositories {
91
93
  maven { url 'https://jitpack.io' }
92
94
  mavenCentral()
93
- jcenter()
94
95
  google()
95
96
 
96
97
  def found = false
@@ -179,10 +180,12 @@ dependencies {
179
180
  implementation "com.fasterxml.jackson.module:jackson-module-kotlin:2.9.6"
180
181
  implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
181
182
  // required to avoid crash on Android 12 API 31
182
- // implementation 'androidx.work:work-runtime-ktx:2.7.0'
183
+ implementation 'androidx.work:work-runtime-ktx:2.7.0'
183
184
  // if RN is 0.66.4, you cannot use okhttp3 3.x versions
184
185
  implementation 'com.squareup.okhttp3:okhttp:4.9.0'
185
186
  implementation 'com.squareup.okhttp3:logging-interceptor:4.9.0'
187
+ // react-native 0.61.3
188
+ implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"
186
189
  }
187
190
 
188
191
  configurations.all {
@@ -1,5 +1,5 @@
1
1
  <manifest xmlns:android="http://schemas.android.com/apk/res/android"
2
- package="com.reactnativefireworksdk">
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>
@@ -14,7 +14,6 @@ import com.loopnow.fireworklibrary.views.VideoFeedView
14
14
  import com.reactnativefireworksdk.R
15
15
  import com.reactnativefireworksdk.models.*
16
16
  import com.reactnativefireworksdk.utils.FWEventUtils
17
- import com.reactnativefireworksdk.utils.FWLogUtils
18
17
  import com.reactnativefireworksdk.utils.FWVideoPlayerUtils
19
18
 
20
19
 
@@ -24,7 +23,7 @@ class FWVideoFeed(
24
23
  ) : RelativeLayout(context, attrs) {
25
24
 
26
25
  // private val reactContext: ReactContext = context.reactApplicationContext
27
- private val activity: Activity = context.reactApplicationContext.currentActivity as Activity
26
+ private val activity: Activity = context.currentActivity as Activity
28
27
 
29
28
  private val videoFeedView: VideoFeedView
30
29
  private var channelId: String? = null
@@ -41,7 +40,7 @@ class FWVideoFeed(
41
40
  videoFeedView.addOnItemClickedListener(object: OnItemClickedListener {
42
41
  override fun onItemClicked(index: Int, title: String, id: String, videoDuration: Long) {
43
42
  val fwVideoFeedItemDetailsModel = FWVideoFeedItemDetailsModel(index, id, videoDuration.toInt())
44
- FWEventUtils.sendVideoFeedClickEvent(context.reactApplicationContext, fwVideoFeedItemDetailsModel)
43
+ FWEventUtils.sendVideoFeedClickEvent(context, fwVideoFeedItemDetailsModel)
45
44
  }
46
45
 
47
46
  override fun onItemClicked(index: Int) {
@@ -92,6 +91,8 @@ class FWVideoFeed(
92
91
  val backgroundColor = config?.backgroundColor
93
92
  if (!backgroundColor.isNullOrBlank()) {
94
93
  videoFeedView.setBackgroundColor(Color.parseColor(backgroundColor))
94
+ } else {
95
+ videoFeedView.setBackgroundColor(Color.TRANSPARENT)
95
96
  }
96
97
 
97
98
  videoFeedView.setTitleVisible(config?.title?.hidden != true)
@@ -8,7 +8,8 @@
8
8
 
9
9
  #import <React/RCTBridgeModule.h>
10
10
  #import <React/RCTViewManager.h>
11
- #import <react_native_firework_sdk/react_native_firework_sdk-Swift.h>
11
+ #import <React/RCTUIManager.h>
12
+ #import "react_native_firework_sdk-Swift.h"
12
13
 
13
14
  @interface RCT_EXTERN_REMAP_MODULE(FWVideoFeed, VideoFeedManager, NSObject)
14
15
 
@@ -4,3 +4,5 @@
4
4
  #import <React/RCTEventEmitter.h>
5
5
  #import <React/RCTComponent.h>
6
6
  #import <React/RCTLog.h>
7
+ #import <React/RCTRootView.h>
8
+ #import <React/RCTBridge+Private.h>
@@ -56,7 +56,7 @@ extension VideoFeedError {
56
56
  extension FeedEventDetails {
57
57
  var jsObject: [String: Any] {
58
58
  return ["index": index,
59
- "videoId": videoID,
59
+ "videoId": id,
60
60
  "duration": duration]
61
61
  }
62
62
  }
@@ -68,7 +68,11 @@ extension FireworkSDKModule: FireworkVideoPlaybackDelegate {
68
68
  }
69
69
 
70
70
  extension FireworkSDKModule: FireworkVideoFeedDelegate {
71
- func fireworkVideoDidTapVideoThumbnail(_ eventDetails: FeedEventDetails) {
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
  }
@@ -0,0 +1,14 @@
1
+ //
2
+ // react_native_firework_sdk.h
3
+ // react-native-firework-sdk
4
+ //
5
+ // Created by Jeff Zheng on 2022/2/8.
6
+ //
7
+
8
+ #ifndef react_native_firework_sdk_h
9
+ #define react_native_firework_sdk_h
10
+
11
+ //#import "FireworkSdk-Bridging-Header.h"
12
+
13
+
14
+ #endif /* react_native_firework_sdk_h */
@@ -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,4BA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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;;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,GAA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K,CAACY,UAAb;AACA,YAAMM,QAAQ,GAAG,MAAM,KAAKD,eAAL,EAAvB;AACA,WAAKE,eAAL,GAAuBD,QAAvB;;AAEA,UAAIA,QAAJ,EAAc;AACZ5B,gCAAe8B,cAAf,CAA8BR,UAA9B;AACD;AACF;AACF;;AAE4C,QAA/BP,+BAA+B,CAC3CL,KAD2C,EAE3C;AACA,QAAI,KAAKqB,sBAAT,EAAiC;AAC/B,YAAMT,UAAU,GAAGZ,KAAK,CAACY,UAAzB;AACA,aAAOZ,KAAK,CAACY,UAAb;AACA,YAAMU,OAAO,GAAG,MAAM,KAAKD,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 | 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,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;AALR,OADF;AASD;;AAtDqE;;;;gBAAnDtB,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 />\n );\n }\n}\n"]}
1
+ {"version":3,"sources":["VideoFeed.tsx"],"names":["NativeComponentName","VideoFeed","React","Component","createRef","nativeNodeHandle","nativeComponentRef","current","UIManager","dispatchViewManagerCommand","getViewManagerConfig","Commands","refresh","event","name","reason","nativeEvent","props","onVideoFeedLoadFinished","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;AACpC,WAAO,KAAKC,gBAAZ;AACD;;AACyB,MAAfD,eAAe,CAACE,KAAD,EAAiB;AACzC,SAAKD,gBAAL,GAAwBC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,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,CAAkCD,KAAlC;AACD;;AAMwB,SAAXE,WAAW,GAAG;AAC1B,QAAI,CAACL,aAAa,CAACM,SAAnB,EAA8B;AAC5BN,MAAAA,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AACVzB,QAAAA,cAAc,CAAC0B,qBAAf,CACED,MAAM,CAACE,GADT,EAEEF,MAAM,CAACG,IAFT,EAGEJ,UAHF;AAKD;AACF;AACF;;AAEqC,QAAxBT,wBAAwB,CAACH,KAAD,EAAsB;AAC1D,QAAI,KAAKiB,eAAT,EAA0B;AACxB,YAAML,UAAU,GAAGZ,KAAK,CAACY,UAAzB;AACA,aAAOZ,KAAK,CAACY,UAAb;AACA,YAAMM,QAAQ,GAAG,MAAM,KAAKD,eAAL,EAAvB;AACA,WAAKE,eAAL,GAAuBD,QAAvB;;AAEA,UAAIA,QAAJ,EAAc;AACZ9B,QAAAA,cAAc,CAACgC,cAAf,CAA8BR,UAA9B;AACD;AACF;AACF;;AAE4C,QAA/BP,+BAA+B,CAC3CL,KAD2C,EAE3C;AACA,QAAI,KAAKqB,sBAAT,EAAiC;AAC/B,YAAMT,UAAU,GAAGZ,KAAK,CAACY,UAAzB;AACA,aAAOZ,KAAK,CAACY,UAAb;AACA,YAAMU,OAAO,GAAG,MAAM,KAAKD,sBAAL,CACpBrB,KADoB,CAAtB;;AAGA,UAAIsB,OAAJ,EAAa;AACXlC,QAAAA,cAAc,CAACmC,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;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 | 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,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"]}
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","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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c,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
  }
@@ -19,7 +19,7 @@ export default interface VideoPlayerConfiguration {
19
19
  */
20
20
  showShareButton?: boolean;
21
21
  /**
22
- * The style of CTA button style.
22
+ * The style of CTA button style. Only supported on iOS.
23
23
  */
24
24
  ctaButtonStyle?: VideoPlayerCTAStyle;
25
25
  }
@@ -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.0-beta.1",
3
+ "version": "1.0.4",
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": [
@@ -10,13 +10,22 @@ Pod::Spec.new do |s|
10
10
  s.license = package["license"]
11
11
  s.authors = package["author"]
12
12
 
13
- s.platforms = { :ios => "11.0" }
13
+ s.platforms = { :ios => "12.0" }
14
14
  s.source = { :git => "https://github.com/loopsocial/bogano.git", :tag => "#{s.version}" }
15
15
 
16
+ s.swift_version = '5.0'
17
+ # s.header_dir = "ios"
18
+ # s.public_header_files = "ios/*.h"
16
19
  s.source_files = "ios/**/*.{h,m,mm,swift}"
17
- s.pod_target_xcconfig = { 'FRAMEWORK_SEARCH_PATHS' => ["${PODS_ROOT}/FireworkVideoGIMASupport","${PODS_ROOT}/FireworkVideoGAMSupport"]}
20
+
21
+ 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"']}
22
+
23
+ s.script_phase = { :name => 'Copy module header files', :script => 'echo "react-native-firework-sdk module_header_path path is"
24
+ module_header_path=${PODS_TARGET_SRCROOT}"/ios/react_native_firework_sdk.h"
25
+ echo $module_header_path
26
+ cp $module_header_path "${PODS_ROOT}/Headers/Public/react_native_firework_sdk/"', :execution_position => :before_compile }
18
27
 
19
28
 
20
29
  s.dependency "React-Core"
21
- s.dependency "FireworkVideo","~>0.12.0"
30
+ s.dependency "FireworkVideo","0.13.0"
22
31
  end
@@ -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
  }
@@ -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
  }
@@ -20,7 +20,7 @@ export default interface VideoPlayerConfiguration {
20
20
  */
21
21
  showShareButton?: boolean;
22
22
  /**
23
- * The style of CTA button style.
23
+ * The style of CTA button style. Only supported on iOS.
24
24
  */
25
25
  ctaButtonStyle?: VideoPlayerCTAStyle;
26
26
  }
@@ -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;