react-native-firework-sdk 1.0.0-beta → 1.0.3

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 (45) hide show
  1. package/README.md +26 -24
  2. package/android/build.gradle +24 -23
  3. package/android/src/main/AndroidManifest.xml +4 -1
  4. package/android/src/main/java/com/reactnativefireworksdk/components/videofeed/FWVideoFeed.kt +2 -0
  5. package/android/src/main/java/com/reactnativefireworksdk/models/FWVideoShoppingInterface.kt +2 -0
  6. package/android/src/main/java/com/reactnativefireworksdk/module/FWVideoShoppingModule.kt +14 -0
  7. package/ios/Component/VideoFeedManager.m +2 -1
  8. package/ios/FireworkSdk-Bridging-Header.h +2 -0
  9. package/ios/Models/FireworkSDK+JsModel.swift +1 -1
  10. package/ios/Models/RCTConvert+FireworkSDKModule.swift +10 -10
  11. package/ios/Models/RCTConvert+Shopping.swift +8 -8
  12. package/ios/Models/RCTConvert+VideoFeed.swift +12 -12
  13. package/ios/Modules/FireworkSDKModule/FireworkSDKModule+EventTracking.swift +5 -1
  14. package/ios/Modules/Shopping/ShoppingModule.m +2 -0
  15. package/ios/Modules/Shopping/ShoppingModule.swift +31 -5
  16. package/ios/react_native_firework_sdk.h +14 -0
  17. package/lib/commonjs/VideoShopping.js +25 -0
  18. package/lib/commonjs/VideoShopping.js.map +1 -1
  19. package/lib/commonjs/components/VideoFeed.js +4 -1
  20. package/lib/commonjs/components/VideoFeed.js.map +1 -1
  21. package/lib/commonjs/index.js.map +1 -1
  22. package/lib/commonjs/modules/ShoppingModule.js.map +1 -1
  23. package/lib/module/VideoShopping.js +24 -0
  24. package/lib/module/VideoShopping.js.map +1 -1
  25. package/lib/module/components/VideoFeed.js +4 -1
  26. package/lib/module/components/VideoFeed.js.map +1 -1
  27. package/lib/module/index.js.map +1 -1
  28. package/lib/module/modules/ShoppingModule.js.map +1 -1
  29. package/lib/typescript/VideoShopping.d.ts +11 -0
  30. package/lib/typescript/index.d.ts +2 -2
  31. package/lib/typescript/models/ADConfig.d.ts +2 -2
  32. package/lib/typescript/models/ProductInfoViewConfiguration.d.ts +1 -8
  33. package/lib/typescript/models/VideoFeedConfiguration.d.ts +2 -2
  34. package/lib/typescript/models/VideoPlayerConfiguration.d.ts +1 -1
  35. package/lib/typescript/modules/ShoppingModule.d.ts +6 -4
  36. package/package.json +2 -22
  37. package/react-native-firework-sdk.podspec +11 -2
  38. package/src/VideoShopping.ts +22 -2
  39. package/src/components/VideoFeed.tsx +1 -0
  40. package/src/index.tsx +0 -2
  41. package/src/models/ADConfig.ts +2 -2
  42. package/src/models/ProductInfoViewConfiguration.ts +1 -9
  43. package/src/models/VideoFeedConfiguration.ts +2 -2
  44. package/src/models/VideoPlayerConfiguration.ts +1 -1
  45. package/src/modules/ShoppingModule.ts +6 -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,7 +180,7 @@ 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'
@@ -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>
@@ -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)
@@ -10,4 +10,6 @@ interface FWVideoShoppingInterface {
10
10
  fun updateAddToCartStatus(res: String?, tip: String?, callbackId: Int?)
11
11
  fun jumpToCartPage(callbackId: Int?)
12
12
  fun exitCartPage()
13
+ fun setCartIconVisible(visible: Boolean?)
14
+ fun setCartItemCount(count: Int?)
13
15
  }
@@ -116,6 +116,20 @@ class FWVideoShoppingModule(
116
116
  }
117
117
  }
118
118
 
119
+ @ReactMethod
120
+ override fun setCartIconVisible(visible: Boolean?) {
121
+ UiThreadUtil.runOnUiThread {
122
+ Baya.willUseCustomCart(visible?:true)
123
+ }
124
+ }
125
+
126
+ @ReactMethod
127
+ override fun setCartItemCount(count: Int?) {
128
+ UiThreadUtil.runOnUiThread {
129
+ Baya.itemCount.value = count?:0
130
+ }
131
+ }
132
+
119
133
  private fun cartListener() {
120
134
  Baya.cartInterface = object: Baya.CartInterface {
121
135
 
@@ -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
  }
@@ -30,10 +30,10 @@ extension RCTConvert {
30
30
  }
31
31
 
32
32
  static func videoPlayerStyle(_ style: String?) -> VideoPlayerContentConfiguration.VideoPlayerStyle? {
33
- guard let style = style else {
33
+ guard let rStyle = style else {
34
34
  return nil
35
35
  }
36
- if style == "fit" {
36
+ if rStyle == "fit" {
37
37
  return .fit
38
38
  } else {
39
39
  return .fullBleed
@@ -52,17 +52,17 @@ extension RCTConvert {
52
52
  }
53
53
 
54
54
  static func ctaButtonStyle(_ style: [String: AnyObject]?) -> ButtonContentConfiguration? {
55
- guard let style = style else {
55
+ guard let rStyle = style else {
56
56
  return nil
57
57
  }
58
58
  var btnContentConfig = ButtonContentConfiguration()
59
- if let backgroundColor = style["backgroundColor"] as? String {
59
+ if let backgroundColor = rStyle["backgroundColor"] as? String {
60
60
  btnContentConfig.backgroundColor = backgroundColor.uicolor()
61
61
  }
62
- if let textColor = style["textColor"] as? String {
62
+ if let textColor = rStyle["textColor"] as? String {
63
63
  btnContentConfig.textColor = textColor.uicolor()
64
64
  }
65
- if let fontSize = style["fontSize"] as? Float {
65
+ if let fontSize = rStyle["fontSize"] as? Float {
66
66
  btnContentConfig.font = UIFont.systemFont(ofSize: CGFloat(fontSize))
67
67
  }
68
68
 
@@ -70,18 +70,18 @@ extension RCTConvert {
70
70
  }
71
71
 
72
72
  static func mobileADConfiguration(_ config: [String: AnyObject]?) -> MobileADConfiguration? {
73
- guard let config = config else {
73
+ guard let rConfig = config else {
74
74
  return nil
75
75
  }
76
76
 
77
- let jsonData = try? JSONSerialization.data(withJSONObject: config, options: .prettyPrinted)
78
- guard let jsonData = jsonData else {
77
+ let jsonData = try? JSONSerialization.data(withJSONObject: rConfig, options: .prettyPrinted)
78
+ guard let rJsonData = jsonData else {
79
79
  return nil
80
80
  }
81
81
 
82
82
  var result: MobileADConfiguration?
83
83
  do {
84
- result = try JSONDecoder().decode(MobileADConfiguration.self, from: jsonData)
84
+ result = try JSONDecoder().decode(MobileADConfiguration.self, from: rJsonData)
85
85
  } catch let error {
86
86
  print(error.localizedDescription)
87
87
  }
@@ -9,18 +9,18 @@ import Foundation
9
9
 
10
10
  extension RCTConvert {
11
11
  static func buildProduct(_ product: [String: Any]?) -> Product? {
12
- guard let product = product else {
12
+ guard let rProduct = product else {
13
13
  return nil
14
14
  }
15
15
 
16
- let jsonData = try? JSONSerialization.data(withJSONObject: product, options: .prettyPrinted)
17
- guard let jsonData = jsonData else {
16
+ let jsonData = try? JSONSerialization.data(withJSONObject: rProduct, options: .prettyPrinted)
17
+ guard let rJsonData = jsonData else {
18
18
  return nil
19
19
  }
20
20
 
21
21
  var result: Product?
22
22
  do {
23
- result = try JSONDecoder().decode(Product.self, from: jsonData)
23
+ result = try JSONDecoder().decode(Product.self, from: rJsonData)
24
24
  } catch let error {
25
25
  print(error.localizedDescription)
26
26
  }
@@ -28,18 +28,18 @@ extension RCTConvert {
28
28
  }
29
29
 
30
30
  static func buildProductInfoViewConfiguration(_ config: [String: Any]?) -> ProductInfoViewConfiguration? {
31
- guard let config = config else {
31
+ guard let rConfig = config else {
32
32
  return nil
33
33
  }
34
34
 
35
- let jsonData = try? JSONSerialization.data(withJSONObject: config, options: .prettyPrinted)
36
- guard let jsonData = jsonData else {
35
+ let jsonData = try? JSONSerialization.data(withJSONObject: rConfig, options: .prettyPrinted)
36
+ guard let rJsonData = jsonData else {
37
37
  return nil
38
38
  }
39
39
 
40
40
  var result: ProductInfoViewConfiguration?
41
41
  do {
42
- result = try JSONDecoder().decode(ProductInfoViewConfiguration.self, from: jsonData)
42
+ result = try JSONDecoder().decode(ProductInfoViewConfiguration.self, from: rJsonData)
43
43
  } catch let error {
44
44
  print(error.localizedDescription)
45
45
  }
@@ -26,44 +26,44 @@ extension VideoFeedMode {
26
26
  @objc
27
27
  public extension RCTConvert {
28
28
  static func videoFeedSourceType(_ type: String?) -> VideFeedSourceType {
29
- guard let type = type else {
29
+ guard let rType = type else {
30
30
  return .discover
31
31
  }
32
32
 
33
- return .feedTypeMapper[type] ?? .discover
33
+ return VideFeedSourceType.feedTypeMapper[rType] ?? .discover
34
34
  }
35
35
 
36
36
  static func videoFeedMode(_ type: String?) -> VideoFeedMode {
37
- guard let type = type else {
37
+ guard let rType = type else {
38
38
  return .row
39
39
  }
40
40
 
41
- return .feedModeMapper[type] ?? .row
41
+ return VideoFeedMode.feedModeMapper[rType] ?? .row
42
42
  }
43
43
 
44
44
  static func videoFeedConfiguration(_ config: [String: AnyObject]?) -> VideoFeedConfiguration? {
45
- guard let config = config else {
45
+ guard let rConfig = config else {
46
46
  return nil
47
47
  }
48
48
 
49
- let jsonData = try? JSONSerialization.data(withJSONObject: config, options: .prettyPrinted)
50
- guard let jsonData = jsonData else {
49
+ let jsonData = try? JSONSerialization.data(withJSONObject: rConfig, options: .prettyPrinted)
50
+ guard let rJsonData = jsonData else {
51
51
  return nil
52
52
  }
53
53
 
54
- return try? JSONDecoder().decode(VideoFeedConfiguration.self, from: jsonData)
54
+ return try? JSONDecoder().decode(VideoFeedConfiguration.self, from: rJsonData)
55
55
  }
56
56
 
57
57
  static func videoPlayerConfiguration(_ config: [String: AnyObject]?) -> VideoPlayerConfiguration? {
58
- guard let config = config else {
58
+ guard let rConfig = config else {
59
59
  return nil
60
60
  }
61
61
 
62
- let jsonData = try? JSONSerialization.data(withJSONObject: config, options: .prettyPrinted)
63
- guard let jsonData = jsonData else {
62
+ let jsonData = try? JSONSerialization.data(withJSONObject: rConfig, options: .prettyPrinted)
63
+ guard let rJsonData = jsonData else {
64
64
  return nil
65
65
  }
66
66
 
67
- return try? JSONDecoder().decode(VideoPlayerConfiguration.self, from: jsonData)
67
+ return try? JSONDecoder().decode(VideoPlayerConfiguration.self, from: rJsonData)
68
68
  }
69
69
  }
@@ -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
  }
@@ -10,6 +10,8 @@
10
10
  @interface RCT_EXTERN_REMAP_MODULE(ShoppingModule, ShoppingModule, NSObject)
11
11
 
12
12
  _RCT_EXTERN_REMAP_METHOD(init, initialize, NO)
13
+ RCT_EXTERN_METHOD(setCartIconVisible:(BOOL)visible)
14
+ RCT_EXTERN_METHOD(setCartItemCount:(int)itemCounts)
13
15
  RCT_EXTERN_METHOD(updateVideoProduct:(NSDictionary *)product cbId:(nonnull NSNumber *)cbid)
14
16
  RCT_EXTERN_METHOD(updateProductViewConfig:(NSDictionary *)config cbId:(nonnull NSNumber *)cbid)
15
17
  RCT_EXTERN_METHOD(updateAddToCartStatus:(NSString *)res tips:(nullable NSString *)tips cbId:(nonnull NSNumber *)cbid)
@@ -15,6 +15,8 @@ class ShoppingModule: RCTEventEmitter, FireworkVideoShoppingDelegate, CartViewCo
15
15
  private var addToCartHandler: (Int, AddToCartHandler)?
16
16
  private var productHydrating: (Int, ProductHydrating)?
17
17
  private var cartViewController: CartViewController?
18
+ private var cartIconVisible = true
19
+ private var itemCounts = 0
18
20
 
19
21
  override func supportedEvents() -> [String]! {
20
22
  ShoppingEventName.allCases.map { $0.rawValue }
@@ -41,16 +43,35 @@ class ShoppingModule: RCTEventEmitter, FireworkVideoShoppingDelegate, CartViewCo
41
43
  }
42
44
  }
43
45
 
46
+ @objc
47
+ func setCartIconVisible(_ visible: Bool) {
48
+ cartIconVisible = visible
49
+ }
50
+
51
+ @objc
52
+ func setCartItemCount(_ itemCounts: Int) {
53
+ self.itemCounts = itemCounts
54
+
55
+ guard let rProductInfoViewConfigurator = productInfoViewConfigurator else {
56
+ return
57
+ }
58
+ DispatchQueue.main.async {
59
+ var shoppingCartIconConfiguration = rProductInfoViewConfigurator.1.shoppingCartIconConfiguration
60
+ shoppingCartIconConfiguration.indicator.isHidden = itemCounts == 0
61
+ rProductInfoViewConfigurator.1.shoppingCartIconConfiguration = shoppingCartIconConfiguration
62
+ }
63
+ }
64
+
44
65
  @objc
45
66
  func updateVideoProduct(_ product: [String: Any]?, cbId: NSNumber) {
46
67
  let product = RCTConvert.buildProduct(product)
47
- guard let product = product, let productHydrating = productHydrating, productHydrating.0 == Int(truncating: cbId) else {
68
+ guard let rProduct = product, let productHydrating = productHydrating, productHydrating.0 == Int(truncating: cbId) else {
48
69
  return
49
70
  }
50
71
 
51
72
  DispatchQueue.main.async {
52
- productHydrating.1.hydrateProduct(product.productId, { build in
53
- return ShoppingModule.hydrateProduct(product, build)
73
+ productHydrating.1.hydrateProduct(rProduct.productId, { build in
74
+ return ShoppingModule.hydrateProduct(rProduct, build)
54
75
  })
55
76
  }
56
77
  }
@@ -58,12 +79,16 @@ class ShoppingModule: RCTEventEmitter, FireworkVideoShoppingDelegate, CartViewCo
58
79
  @objc
59
80
  func updateProductViewConfig(_ config: [String: Any]?, cbId: NSNumber) {
60
81
  let config = RCTConvert.buildProductInfoViewConfiguration(config)
61
- guard let config = config, let productInfoViewConfigurator = productInfoViewConfigurator, productInfoViewConfigurator.0 == Int(truncating: cbId) else {
82
+ guard let rConfig = config, let rProductInfoViewConfigurator = productInfoViewConfigurator, rProductInfoViewConfigurator.0 == Int(truncating: cbId) else {
62
83
  return
63
84
  }
64
85
 
65
86
  DispatchQueue.main.async {
66
- ShoppingModule.hydrateProductViewConfig(config, productInfoViewConfigurator.1)
87
+ //The configuration of CartIcon'visible determined by global cartIconVisible
88
+ rProductInfoViewConfigurator.1.shoppingCartIconConfiguration.isHidden = !self.cartIconVisible
89
+ //The configuration of CartIcon'indicator'visible determined by global itemCounts
90
+ rProductInfoViewConfigurator.1.shoppingCartIconConfiguration.indicator.isHidden = self.itemCounts == 0
91
+ ShoppingModule.hydrateProductViewConfig(rConfig, rProductInfoViewConfigurator.1)
67
92
  }
68
93
  }
69
94
 
@@ -74,6 +99,7 @@ class ShoppingModule: RCTEventEmitter, FireworkVideoShoppingDelegate, CartViewCo
74
99
  }
75
100
 
76
101
  DispatchQueue.main.async {
102
+ // config.indicator.isHidden = itemCounts == 0
77
103
  if res == "success" {
78
104
  handler.1(.feedbackOnly(.success(message: tips ?? "success")))
79
105
  } else {
@@ -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 */
@@ -42,6 +42,20 @@ class VideoShopping {
42
42
  *
43
43
  * The host app can return a ProductInfoViewConfiguration object to configure "Add to cart" button style and cart icon style.
44
44
  */
45
+
46
+ /**
47
+ * Defaults to true. You can hide the cart icon by setting this property to false.
48
+ */
49
+ get cartIconVisible() {
50
+ return this._cartIconVisible;
51
+ }
52
+
53
+ set cartIconVisible(value) {
54
+ this._cartIconVisible = value;
55
+
56
+ _ShoppingModule.default.setCartIconVisible(value);
57
+ }
58
+
45
59
  static getInstance() {
46
60
  if (!VideoShopping._instance) {
47
61
  VideoShopping._instance = new VideoShopping();
@@ -51,6 +65,8 @@ class VideoShopping {
51
65
  }
52
66
 
53
67
  constructor() {
68
+ _defineProperty(this, "_cartIconVisible", true);
69
+
54
70
  _defineProperty(this, "onAddToCart", void 0);
55
71
 
56
72
  _defineProperty(this, "onClickCartIcon", void 0);
@@ -87,6 +103,15 @@ class VideoShopping {
87
103
  exitCartPage() {
88
104
  _ShoppingModule.default.exitCartPage();
89
105
  }
106
+ /**
107
+ *
108
+ * @param {number} count The number of items in the host app cart
109
+ */
110
+
111
+
112
+ setCartItemCount(count) {
113
+ _ShoppingModule.default.setCartItemCount(count);
114
+ }
90
115
 
91
116
  async handleAddToCartEvent(event) {
92
117
  if (this.onAddToCart) {
@@ -1 +1 @@
1
- {"version":3,"sources":["VideoShopping.ts"],"names":["VideoShopping","getInstance","_instance","constructor","eventEmitter","NativeEventEmitter","ShoppingModule","addListener","FWEventName","AddToCart","event","handleAddToCartEvent","ClickCartIcon","handleClickCartIconEvent","UpdateProductDetails","handleUpdateProductDetailsEvent","WillDisplayProduct","handleWillDisplayProductEvent","exitCartPage","onAddToCart","callbackId","result","updateAddToCartStatus","res","tips","onClickCartIcon","cartPage","currentCartPage","jumpToCartPage","onUpdateProductDetails","product","updateVideoProduct","onWillDisplayProduct","config","updateProductViewConfig"],"mappings":"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","sourcesContent":["import { NativeEventEmitter } from 'react-native';\n\nimport type AddToCartResult from './models/AddToCartResult';\nimport {\n AddToCartEvent,\n FWEventName,\n UpdateProductDetailsEvent,\n WillDisplayProductEvent,\n} from './models/FWEvents';\nimport type Product from './models/Product';\nimport type ProductInfoViewConfiguration from './models/ProductInfoViewConfiguration';\nimport ShoppingModule from './modules/ShoppingModule';\n\nexport type AddToCartCallback = (\n event: AddToCartEvent\n) => Promise<AddToCartResult | undefined | null>;\n\nexport type ClickCartIconCallback = () => Promise<\n React.ReactNode | undefined | null\n>;\n\nexport type UpdateProductDetailsCallback = (\n event: UpdateProductDetailsEvent\n) => Promise<Product | undefined | null>;\n\nexport type WillDisplayProductCallback = (\n event: WillDisplayProductEvent\n) => Promise<ProductInfoViewConfiguration | undefined | null>;\n\ntype CallbackInfo = { callbackId?: number };\n\n/**\n * Entry class of Video Shopping\n */\nclass VideoShopping {\n private static _instance?: VideoShopping;\n\n /**\n * This callback is triggered when the user clicks the \"Add to cart\" button.\n *\n * The host app can return an AddToCartResult object to tell FireworkSDK the result of adding to cart.\n */\n public onAddToCart?: AddToCartCallback;\n\n /**\n * This callback is triggered when the user clicks the shopping cart icon.\n *\n * The host app can return a React.Node to integrate custom cart page to shopping flow.\n */\n public onClickCartIcon?: ClickCartIconCallback;\n\n /**\n * This callback is triggered when the video will be shown.\n *\n * The host app can return a Product object to update the latest product information.\n */\n public onUpdateProductDetails?: UpdateProductDetailsCallback;\n\n /**\n * This callback is triggered when the product will be shown.\n *\n * The host app can return a ProductInfoViewConfiguration object to configure \"Add to cart\" button style and cart icon style.\n */\n public onWillDisplayProduct?: WillDisplayProductCallback;\n\n public currentCartPage?: React.ReactNode;\n\n private eventEmitter: NativeEventEmitter;\n\n public static getInstance() {\n if (!VideoShopping._instance) {\n VideoShopping._instance = new VideoShopping();\n }\n\n return VideoShopping._instance!;\n }\n\n private constructor() {\n this.eventEmitter = new NativeEventEmitter(ShoppingModule);\n this.eventEmitter.addListener(FWEventName.AddToCart, (event) => {\n this.handleAddToCartEvent(event);\n });\n\n this.eventEmitter.addListener(FWEventName.ClickCartIcon, (event) => {\n this.handleClickCartIconEvent(event);\n });\n\n this.eventEmitter.addListener(FWEventName.UpdateProductDetails, (event) => {\n this.handleUpdateProductDetailsEvent(event);\n });\n\n this.eventEmitter.addListener(FWEventName.WillDisplayProduct, (event) => {\n this.handleWillDisplayProductEvent(event);\n });\n }\n\n /**\n * Exit Cart Page.\n *\n * The host app can call this method to exit their cart page.\n */\n public exitCartPage() {\n ShoppingModule.exitCartPage();\n }\n\n private async handleAddToCartEvent(event: AddToCartEvent & CallbackInfo) {\n if (this.onAddToCart) {\n const callbackId = event.callbackId;\n delete event.callbackId;\n const result = await this.onAddToCart(event as AddToCartEvent);\n if (result) {\n ShoppingModule.updateAddToCartStatus(\n result.res,\n result.tips,\n callbackId!\n );\n }\n }\n }\n\n private async handleClickCartIconEvent(event: CallbackInfo) {\n if (this.onClickCartIcon) {\n const callbackId = event.callbackId;\n delete event.callbackId;\n const cartPage = await this.onClickCartIcon();\n this.currentCartPage = cartPage;\n\n if (cartPage) {\n ShoppingModule.jumpToCartPage(callbackId!);\n }\n }\n }\n\n private async handleUpdateProductDetailsEvent(\n event: UpdateProductDetailsEvent & CallbackInfo\n ) {\n if (this.onUpdateProductDetails) {\n const callbackId = event.callbackId;\n delete event.callbackId;\n const product = await this.onUpdateProductDetails(\n event as UpdateProductDetailsEvent\n );\n if (product) {\n ShoppingModule.updateVideoProduct(product, callbackId!);\n }\n }\n }\n\n private async handleWillDisplayProductEvent(\n event: WillDisplayProductEvent & CallbackInfo\n ) {\n if (this.onWillDisplayProduct) {\n const callbackId = event.callbackId;\n delete event.callbackId;\n const config = await this.onWillDisplayProduct(\n event as WillDisplayProductEvent\n );\n if (config) {\n ShoppingModule.updateProductViewConfig(config, callbackId!);\n }\n }\n }\n}\n\nexport default VideoShopping;\n"]}
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":"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","sourcesContent":["import { NativeEventEmitter } from 'react-native';\n\nimport type AddToCartResult from './models/AddToCartResult';\nimport {\n AddToCartEvent,\n FWEventName,\n UpdateProductDetailsEvent,\n WillDisplayProductEvent,\n} from './models/FWEvents';\nimport type Product from './models/Product';\nimport type ProductInfoViewConfiguration from './models/ProductInfoViewConfiguration';\nimport ShoppingModule from './modules/ShoppingModule';\n\nexport type AddToCartCallback = (\n event: AddToCartEvent\n) => Promise<AddToCartResult | undefined | null>;\n\nexport type ClickCartIconCallback = () => Promise<\n React.ReactNode | undefined | null\n>;\n\nexport type UpdateProductDetailsCallback = (\n event: UpdateProductDetailsEvent\n) => Promise<Product | undefined | null>;\n\nexport type WillDisplayProductCallback = (\n event: WillDisplayProductEvent\n) => Promise<ProductInfoViewConfiguration | undefined | null>;\n\ntype CallbackInfo = { callbackId?: number | 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"]}