react-native-firework-sdk 1.0.5 → 1.0.6-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/build.gradle +1 -1
- package/android/src/main/AndroidManifest.xml +3 -0
- package/android/src/main/java/com/reactnativefireworksdk/components/videofeed/FWVideoFeed.kt +20 -1
- package/android/src/main/java/com/reactnativefireworksdk/models/FWVideoPlayerConfigModel.kt +3 -1
- package/android/src/main/java/com/reactnativefireworksdk/models/FWVideoShoppingInterface.kt +2 -1
- package/android/src/main/java/com/reactnativefireworksdk/module/FWVideoShoppingModule.kt +43 -31
- package/android/src/main/java/com/reactnativefireworksdk/module/FireworkSDKModule.kt +0 -9
- package/android/src/main/java/com/reactnativefireworksdk/utils/FWEventUtils.kt +17 -4
- package/android/src/main/java/com/reactnativefireworksdk/utils/FWJsonUtils.kt +28 -0
- package/android/src/main/java/com/reactnativefireworksdk/utils/FWVideoPlayerUtils.kt +2 -0
- package/ios/Component/VideoFeed.swift +31 -3
- package/ios/Component/VideoFeedConfiguration.swift +1 -0
- package/ios/Component/VideoFeedManager.m +2 -0
- package/ios/Component/VideoPlayerConfiguration.swift +7 -0
- package/ios/Models/RCTConvert+Shopping.swift +15 -0
- package/ios/Models/RCTConvert+VideoFeed.swift +2 -1
- package/ios/Modules/FireworkSDKModule/FireworkSDKModule+EventTracking.swift +6 -1
- package/ios/Modules/FireworkSDKModule/FireworkSDKModule.swift +5 -1
- package/ios/Modules/Shopping/ShoppingModule.m +1 -1
- package/ios/Modules/Shopping/ShoppingModule.swift +10 -9
- package/lib/commonjs/VideoShopping.js +4 -3
- package/lib/commonjs/VideoShopping.js.map +1 -1
- package/lib/commonjs/components/VideoFeed.js +2 -1
- package/lib/commonjs/components/VideoFeed.js.map +1 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/models/FWEvents.js.map +1 -1
- package/lib/commonjs/modules/ShoppingModule.js.map +1 -1
- package/lib/module/VideoShopping.js +4 -3
- package/lib/module/VideoShopping.js.map +1 -1
- package/lib/module/components/VideoFeed.js +2 -1
- package/lib/module/components/VideoFeed.js.map +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/models/FWEvents.js.map +1 -1
- package/lib/module/modules/ShoppingModule.js.map +1 -1
- package/lib/typescript/VideoShopping.d.ts +1 -1
- package/lib/typescript/components/VideoFeed.d.ts +5 -1
- package/lib/typescript/models/FWEvents.d.ts +1 -1
- package/lib/typescript/models/VideoPlayerConfiguration.d.ts +8 -0
- package/lib/typescript/modules/ShoppingModule.d.ts +1 -1
- package/package.json +1 -1
- package/src/VideoShopping.ts +5 -4
- package/src/components/VideoFeed.tsx +8 -2
- package/src/index.tsx +1 -3
- package/src/models/FWEvents.ts +1 -1
- package/src/models/VideoPlayerConfiguration.ts +8 -0
- package/src/modules/ShoppingModule.ts +1 -1
package/android/build.gradle
CHANGED
|
@@ -165,7 +165,7 @@ def kotlin_version = getExtOrDefault('kotlinVersion')
|
|
|
165
165
|
dependencies {
|
|
166
166
|
|
|
167
167
|
// optional 1: firework sdk release verison
|
|
168
|
-
def firework_sdk_version = 'v5.
|
|
168
|
+
def firework_sdk_version = 'v5.9.0'
|
|
169
169
|
implementation "com.github.loopsocial:firework_sdk:$firework_sdk_version"
|
|
170
170
|
|
|
171
171
|
// optional 2: firework sdk local version,
|
package/android/src/main/java/com/reactnativefireworksdk/components/videofeed/FWVideoFeed.kt
CHANGED
|
@@ -9,11 +9,14 @@ import com.facebook.react.uimanager.ThemedReactContext
|
|
|
9
9
|
import com.loopnow.fireworklibrary.FeedType
|
|
10
10
|
import com.loopnow.fireworklibrary.models.FeedLayout
|
|
11
11
|
import com.loopnow.fireworklibrary.models.FeedTitlePosition
|
|
12
|
+
import com.loopnow.fireworklibrary.models.VideoContentStatus
|
|
12
13
|
import com.loopnow.fireworklibrary.views.OnItemClickedListener
|
|
14
|
+
import com.loopnow.fireworklibrary.views.OnVideoContentStatusListener
|
|
13
15
|
import com.loopnow.fireworklibrary.views.VideoFeedView
|
|
14
16
|
import com.reactnativefireworksdk.R
|
|
15
17
|
import com.reactnativefireworksdk.models.*
|
|
16
18
|
import com.reactnativefireworksdk.utils.FWEventUtils
|
|
19
|
+
import com.reactnativefireworksdk.utils.FWLogUtils
|
|
17
20
|
import com.reactnativefireworksdk.utils.FWVideoPlayerUtils
|
|
18
21
|
|
|
19
22
|
|
|
@@ -22,7 +25,6 @@ class FWVideoFeed(
|
|
|
22
25
|
attrs: AttributeSet?
|
|
23
26
|
) : RelativeLayout(context, attrs) {
|
|
24
27
|
|
|
25
|
-
// private val reactContext: ReactContext = context.reactApplicationContext
|
|
26
28
|
private val activity: Activity = context.currentActivity as Activity
|
|
27
29
|
|
|
28
30
|
private val videoFeedView: VideoFeedView
|
|
@@ -51,6 +53,23 @@ class FWVideoFeed(
|
|
|
51
53
|
return super.onItemClicked(index, feedId)
|
|
52
54
|
}
|
|
53
55
|
})
|
|
56
|
+
videoFeedView.addOnVideoContentStatusListener(object: OnVideoContentStatusListener {
|
|
57
|
+
override fun currentStatus(status: VideoContentStatus, extra: String) {
|
|
58
|
+
when (status) {
|
|
59
|
+
VideoContentStatus.LoadingContent -> {
|
|
60
|
+
FWLogUtils.d { "VideoContentStatus.LoadingContent" }
|
|
61
|
+
}
|
|
62
|
+
VideoContentStatus.LoadingContentFailed -> {
|
|
63
|
+
FWLogUtils.e { "VideoContentStatus.LoadingContentFailed" }
|
|
64
|
+
FWEventUtils.receiveVideoFeedLoadFinishedFailedEvent(context, id, VideoContentStatus.LoadingContentFailed.rawValue, extra)
|
|
65
|
+
}
|
|
66
|
+
VideoContentStatus.ContentLoaded -> {
|
|
67
|
+
FWLogUtils.d { "VideoContentStatus.ContentLoaded" }
|
|
68
|
+
FWEventUtils.receiveVideoFeedLoadFinishedSuccessEvent(context, id)
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
})
|
|
54
73
|
}
|
|
55
74
|
|
|
56
75
|
fun setSource(source: String?) {
|
|
@@ -8,7 +8,9 @@ data class FWVideoPlayerConfigModel(
|
|
|
8
8
|
val playerStyle: String?,
|
|
9
9
|
val videoCompleteAction: String?,
|
|
10
10
|
val showShareButton: Boolean?,
|
|
11
|
-
val ctaButtonStyle: FWCtaButtonStyleModel
|
|
11
|
+
val ctaButtonStyle: FWCtaButtonStyleModel?,
|
|
12
|
+
val showMuteButton: Boolean?,
|
|
13
|
+
val showPlaybackButton: Boolean?,
|
|
12
14
|
) : Parcelable {
|
|
13
15
|
|
|
14
16
|
@Parcelize
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
package com.reactnativefireworksdk.models
|
|
2
2
|
|
|
3
|
+
import com.facebook.react.bridge.ReadableArray
|
|
3
4
|
import com.facebook.react.bridge.ReadableMap
|
|
4
5
|
|
|
5
6
|
interface FWVideoShoppingInterface {
|
|
6
7
|
|
|
7
8
|
fun init()
|
|
8
|
-
fun
|
|
9
|
+
fun updateVideoProducts(productArray: ReadableArray?, videoId: String?)
|
|
9
10
|
fun updateProductViewConfig(config: ReadableMap?, callbackId: Int?)
|
|
10
11
|
fun updateAddToCartStatus(res: String?, tip: String?, callbackId: Int?)
|
|
11
12
|
fun jumpToCartPage(callbackId: Int?)
|
|
@@ -2,6 +2,7 @@ package com.reactnativefireworksdk.module
|
|
|
2
2
|
|
|
3
3
|
import android.app.Activity
|
|
4
4
|
import com.facebook.react.bridge.*
|
|
5
|
+
import com.fasterxml.jackson.core.type.TypeReference
|
|
5
6
|
import com.loopnow.fireworklibrary.baya.Baya
|
|
6
7
|
import com.loopnow.fireworklibrary.baya.UpdateCartStatus
|
|
7
8
|
import com.loopnow.fireworklibrary.models.Product
|
|
@@ -12,13 +13,14 @@ import com.reactnativefireworksdk.utils.FWEventUtils
|
|
|
12
13
|
import com.reactnativefireworksdk.utils.FWJsonUtils
|
|
13
14
|
import com.reactnativefireworksdk.utils.FWLogUtils
|
|
14
15
|
|
|
16
|
+
|
|
15
17
|
class FWVideoShoppingModule(
|
|
16
18
|
reactContext: ReactApplicationContext
|
|
17
19
|
) : ReactContextBaseJavaModule(reactContext), FWVideoShoppingInterface {
|
|
18
20
|
|
|
19
21
|
private var addToCartHandler: Triple<Int, String, String>? = null
|
|
20
22
|
private var cartClickHandler: Pair<Int, Activity>? = null
|
|
21
|
-
private val updateProductHandler: HashMap<String, Product
|
|
23
|
+
private val updateProductHandler: HashMap<String, List<Product>> = HashMap()
|
|
22
24
|
|
|
23
25
|
@ReactMethod
|
|
24
26
|
override fun init() {
|
|
@@ -27,40 +29,51 @@ class FWVideoShoppingModule(
|
|
|
27
29
|
}
|
|
28
30
|
|
|
29
31
|
@ReactMethod
|
|
30
|
-
override fun
|
|
31
|
-
FWLogUtils.d { "FWVideoShoppingModule updateVideoProduct: $
|
|
32
|
-
if (
|
|
32
|
+
override fun updateVideoProducts(productArray: ReadableArray?, videoId: String?) {
|
|
33
|
+
FWLogUtils.d { "FWVideoShoppingModule updateVideoProduct: $videoId" }
|
|
34
|
+
if (videoId.isNullOrBlank()) {
|
|
33
35
|
return
|
|
34
36
|
}
|
|
35
37
|
|
|
36
|
-
val
|
|
37
|
-
val
|
|
38
|
-
|
|
39
|
-
val productId = videoShoppingProduct.productId
|
|
40
|
-
if (productId.isNullOrBlank()) {
|
|
38
|
+
val configArrayList = productArray?.toArrayList()
|
|
39
|
+
val videoShoppingProducts = FWJsonUtils.fromJson(FWJsonUtils.toJson(configArrayList), object : TypeReference<List<FWVideoShoppingProduct>?>() {})
|
|
40
|
+
if (videoShoppingProducts.isNullOrEmpty()) {
|
|
41
41
|
return
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
val
|
|
44
|
+
val products = updateProductHandler[videoId] ?: return
|
|
45
45
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
for (product in products) {
|
|
47
|
+
for (videoShoppingProduct in videoShoppingProducts) {
|
|
48
|
+
if (product.extId == videoShoppingProduct.productId) {
|
|
49
|
+
|
|
50
|
+
if (videoShoppingProduct.name != null) {
|
|
51
|
+
product.name = videoShoppingProduct.name
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (videoShoppingProduct.description != null) {
|
|
55
|
+
product.description = videoShoppingProduct.description
|
|
56
|
+
}
|
|
49
57
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
58
|
+
if (videoShoppingProduct.units != null) {
|
|
59
|
+
for (videoShoppingProductUnit in videoShoppingProduct.units) {
|
|
60
|
+
for (productUnit in product.units) {
|
|
61
|
+
if (videoShoppingProductUnit.unitId.equals(productUnit.externalId)) {
|
|
62
|
+
productUnit.name = videoShoppingProductUnit.name
|
|
63
|
+
productUnit.price?.amount = videoShoppingProductUnit.price?.amount
|
|
64
|
+
productUnit.price?.currencyCode = videoShoppingProductUnit.price?.currencyCode
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
57
68
|
}
|
|
69
|
+
|
|
58
70
|
}
|
|
59
71
|
}
|
|
60
72
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
73
|
+
UiThreadUtil.runOnUiThread {
|
|
74
|
+
Baya.updateProductsComplete(videoId)
|
|
75
|
+
}
|
|
76
|
+
updateProductHandler.remove(videoId)
|
|
64
77
|
}
|
|
65
78
|
|
|
66
79
|
@ReactMethod
|
|
@@ -110,9 +123,8 @@ class FWVideoShoppingModule(
|
|
|
110
123
|
|
|
111
124
|
@ReactMethod
|
|
112
125
|
override fun exitCartPage() {
|
|
113
|
-
val activity = reactApplicationContext.currentActivity
|
|
114
126
|
UiThreadUtil.runOnUiThread {
|
|
115
|
-
|
|
127
|
+
currentActivity?.finish()
|
|
116
128
|
}
|
|
117
129
|
}
|
|
118
130
|
|
|
@@ -156,13 +168,13 @@ class FWVideoShoppingModule(
|
|
|
156
168
|
|
|
157
169
|
private fun productListener() {
|
|
158
170
|
Baya.productInterface = object: Baya.ProductInterface {
|
|
159
|
-
override fun
|
|
160
|
-
FWLogUtils.d { "FWVideoShoppingModule
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
updateProductHandler[id] = product
|
|
164
|
-
FWEventUtils.sendUpdateProductDetailsEvent(reactApplicationContext, id, callbackId)
|
|
171
|
+
override fun hydrateProducts(videoId: String, products: List<Product>) {
|
|
172
|
+
FWLogUtils.d { "FWVideoShoppingModule hydrateProducts, videoId: $videoId" }
|
|
173
|
+
if (videoId.isNullOrBlank() || products.isNullOrEmpty()) {
|
|
174
|
+
return
|
|
165
175
|
}
|
|
176
|
+
updateProductHandler[videoId] = products
|
|
177
|
+
FWEventUtils.sendUpdateProductsDetailsEvent(reactApplicationContext, products, videoId)
|
|
166
178
|
}
|
|
167
179
|
|
|
168
180
|
override fun displayProductInfo(
|
|
@@ -125,15 +125,6 @@ class FireworkSDKModule(
|
|
|
125
125
|
SdkStatus.RefreshTokenFailed -> {
|
|
126
126
|
FWEventUtils.sendInitFailedEvent(reactApplicationContext, extra)
|
|
127
127
|
}
|
|
128
|
-
SdkStatus.LoadingContent -> {
|
|
129
|
-
FWLogUtils.d { "LoadingContent" }
|
|
130
|
-
}
|
|
131
|
-
SdkStatus.LoadingContentFailed -> {
|
|
132
|
-
FWLogUtils.e { "LoadingContentFailed" }
|
|
133
|
-
}
|
|
134
|
-
SdkStatus.ContentLoaded -> {
|
|
135
|
-
FWLogUtils.d { "ContentLoaded" }
|
|
136
|
-
}
|
|
137
128
|
}
|
|
138
129
|
}
|
|
139
130
|
})
|
|
@@ -5,6 +5,7 @@ import com.facebook.react.bridge.ReactContext
|
|
|
5
5
|
import com.facebook.react.bridge.WritableMap
|
|
6
6
|
import com.facebook.react.modules.core.DeviceEventManagerModule
|
|
7
7
|
import com.facebook.react.uimanager.events.RCTEventEmitter
|
|
8
|
+
import com.loopnow.fireworklibrary.models.Product
|
|
8
9
|
import com.reactnativefireworksdk.models.*
|
|
9
10
|
|
|
10
11
|
object FWEventUtils {
|
|
@@ -86,10 +87,18 @@ object FWEventUtils {
|
|
|
86
87
|
sendEvent(reactContext, FWVideoShoppingEventName.ClickCartIcon.rawValue, eventMap)
|
|
87
88
|
}
|
|
88
89
|
|
|
89
|
-
fun
|
|
90
|
+
fun sendUpdateProductsDetailsEvent(reactContext: ReactContext, products: List<Product>?, videoId: String?) {
|
|
90
91
|
val eventMap = Arguments.createMap()
|
|
91
|
-
|
|
92
|
-
|
|
92
|
+
|
|
93
|
+
val productArray = Arguments.createArray()
|
|
94
|
+
if (!products.isNullOrEmpty()) {
|
|
95
|
+
for (product in products) {
|
|
96
|
+
productArray.pushString(product.extId)
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
eventMap.putArray("productIds", productArray)
|
|
101
|
+
eventMap.putString("callbackId", videoId)
|
|
93
102
|
sendEvent(reactContext, FWVideoShoppingEventName.UpdateProductDetails.rawValue, eventMap)
|
|
94
103
|
}
|
|
95
104
|
|
|
@@ -99,7 +108,11 @@ object FWEventUtils {
|
|
|
99
108
|
.emit(eventName, params)
|
|
100
109
|
}
|
|
101
110
|
|
|
102
|
-
fun
|
|
111
|
+
fun receiveVideoFeedLoadFinishedSuccessEvent(reactContext: ReactContext, targetTag: Int) {
|
|
112
|
+
receiveEvent(reactContext, targetTag, FWFeedViewEventName.VideoFeedLoadFinished.rawValue, Arguments.createMap())
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
fun receiveVideoFeedLoadFinishedFailedEvent(reactContext: ReactContext, targetTag: Int, name: String, reason: String?) {
|
|
103
116
|
val eventMap = Arguments.createMap()
|
|
104
117
|
eventMap.putString("name", name)
|
|
105
118
|
eventMap.putString("reason", reason)
|
|
@@ -2,6 +2,7 @@ package com.reactnativefireworksdk.utils
|
|
|
2
2
|
|
|
3
3
|
import android.os.Looper
|
|
4
4
|
import com.fasterxml.jackson.annotation.JsonInclude
|
|
5
|
+
import com.fasterxml.jackson.core.type.TypeReference
|
|
5
6
|
import com.fasterxml.jackson.databind.DeserializationFeature
|
|
6
7
|
import com.fasterxml.jackson.databind.ObjectMapper
|
|
7
8
|
import com.fasterxml.jackson.databind.SerializationFeature
|
|
@@ -54,4 +55,31 @@ object FWJsonUtils {
|
|
|
54
55
|
}
|
|
55
56
|
return null
|
|
56
57
|
}
|
|
58
|
+
|
|
59
|
+
@JvmStatic
|
|
60
|
+
fun <T> fromJson(json: String?, type: TypeReference<T>): T? {
|
|
61
|
+
if (json.isNullOrBlank()) {
|
|
62
|
+
return null
|
|
63
|
+
}
|
|
64
|
+
try {
|
|
65
|
+
return mapper.readValue(json, type)
|
|
66
|
+
} catch (e: Exception) {
|
|
67
|
+
e.printStackTrace()
|
|
68
|
+
logJsonError(e)
|
|
69
|
+
}
|
|
70
|
+
return null
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
@JvmStatic
|
|
74
|
+
fun toJson(obj: Any?): String? {
|
|
75
|
+
if (obj == null) {
|
|
76
|
+
return null
|
|
77
|
+
}
|
|
78
|
+
try {
|
|
79
|
+
return mapper.writeValueAsString(obj)
|
|
80
|
+
} catch (e: Exception) {
|
|
81
|
+
e.printStackTrace()
|
|
82
|
+
}
|
|
83
|
+
return null
|
|
84
|
+
}
|
|
57
85
|
}
|
|
@@ -14,5 +14,7 @@ object FWVideoPlayerUtils {
|
|
|
14
14
|
VideoPlayerProperties.loop = config?.videoCompleteAction != FWVideoPlayerConstant.FW_VIDEO_COMPLETE_ACTION_ADVANCE_TO_NEXT
|
|
15
15
|
// VideoPlayerProperties.autoPlayOnComplete = config?.videoCompleteAction != FWVideoPlayerConstant.FW_VIDEO_COMPLETE_ACTION_LOOP
|
|
16
16
|
VideoPlayerProperties.fullScreenPlayer = config?.playerStyle == FWVideoPlayerConstant.FW_PLAYER_STYLE_FULL
|
|
17
|
+
VideoPlayerProperties.enableOneTouchMute = config?.showMuteButton == true
|
|
18
|
+
VideoPlayerProperties.enablePlayPauseControl = config?.showPlaybackButton == true
|
|
17
19
|
}
|
|
18
20
|
}
|
|
@@ -31,7 +31,7 @@ public enum VideoFeedMode: Int {
|
|
|
31
31
|
|
|
32
32
|
@objc
|
|
33
33
|
public enum VideFeedSourceType: Int {
|
|
34
|
-
case discover, channel, playlist
|
|
34
|
+
case discover, channel, playlist, playlistGroup
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
public protocol VideoFeedViewDelegate: AnyObject {
|
|
@@ -47,6 +47,7 @@ public class VideoFeed: UIView, VideoFeedViewControllerDelegate {
|
|
|
47
47
|
@objc public var sourceType: VideFeedSourceType = .discover
|
|
48
48
|
@objc public var channel: String = ""
|
|
49
49
|
@objc public var playlist: String = ""
|
|
50
|
+
@objc public var playlistGroup: String = ""
|
|
50
51
|
@objc public var mode: VideoFeedMode = .row
|
|
51
52
|
@objc public var feedViewConfig: VideoFeedConfiguration? {
|
|
52
53
|
didSet {
|
|
@@ -78,6 +79,8 @@ public class VideoFeed: UIView, VideoFeedViewControllerDelegate {
|
|
|
78
79
|
return .channel(channelID: channel)
|
|
79
80
|
case .playlist:
|
|
80
81
|
return .channelPlaylist(channelID: channel, playlistID: playlist)
|
|
82
|
+
case .playlistGroup:
|
|
83
|
+
return .playlistGroup(groupID: playlistGroup)
|
|
81
84
|
}
|
|
82
85
|
}
|
|
83
86
|
|
|
@@ -113,11 +116,13 @@ public class VideoFeed: UIView, VideoFeedViewControllerDelegate {
|
|
|
113
116
|
}
|
|
114
117
|
|
|
115
118
|
public override func removeFromSuperview() {
|
|
116
|
-
guard let feedVC = feedVC,
|
|
119
|
+
guard let feedVC = feedVC, feedVC.parent != nil else {
|
|
117
120
|
return
|
|
118
121
|
}
|
|
119
122
|
|
|
120
|
-
|
|
123
|
+
feedVC.willMove(toParent: nil)
|
|
124
|
+
feedVC.removeFromParent()
|
|
125
|
+
feedVC.view.removeFromSuperview()
|
|
121
126
|
// feedVC.willMove(toParent: nil)
|
|
122
127
|
// feedVC.removeFromParent()
|
|
123
128
|
// feedVC.view.removeFromSuperview()
|
|
@@ -216,6 +221,9 @@ extension VideoFeed {
|
|
|
216
221
|
vfcConfig.titleLayoutConfiguration.titlePosition = .nested
|
|
217
222
|
}
|
|
218
223
|
}
|
|
224
|
+
if let showSponsored = config.showSponsored {
|
|
225
|
+
vfcConfig.sponsored.isHidden = !showSponsored
|
|
226
|
+
}
|
|
219
227
|
|
|
220
228
|
return vfcConfig
|
|
221
229
|
}
|
|
@@ -256,7 +264,27 @@ extension VideoFeed {
|
|
|
256
264
|
vpcConfig.ctaButton.font = UIFont.systemFont(ofSize: CGFloat(fontSize))
|
|
257
265
|
}
|
|
258
266
|
}
|
|
267
|
+
if let showPlaybackButton = config.showPlaybackButton {
|
|
268
|
+
vpcConfig.playbackButton.isHidden = !showPlaybackButton
|
|
269
|
+
}
|
|
270
|
+
if let showMuteButton = config.showMuteButton {
|
|
271
|
+
vpcConfig.muteButton.isHidden = !showMuteButton
|
|
272
|
+
if let launchBehavior = config.launchBehavior {
|
|
273
|
+
vpcConfig.onFirstLaunch = launchBehavior.behavior()
|
|
274
|
+
}
|
|
275
|
+
}
|
|
259
276
|
|
|
260
277
|
return vpcConfig
|
|
261
278
|
}
|
|
262
279
|
}
|
|
280
|
+
|
|
281
|
+
extension VideoPlayerConfiguration.VideoLaunchBehavior {
|
|
282
|
+
func behavior() -> VideoPlayerContentConfiguration.VideoLaunchBehavior {
|
|
283
|
+
switch self {
|
|
284
|
+
case .muteOnFirstLaunch:
|
|
285
|
+
return .muteOnFirstLaunch
|
|
286
|
+
default:
|
|
287
|
+
return .`default`
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
}
|
|
@@ -14,6 +14,7 @@ public class VideoFeedConfiguration: NSObject, Codable {
|
|
|
14
14
|
var title: VideoFeedTitleConfiguration?
|
|
15
15
|
var titlePosition: VideoFeedTitlePosition?
|
|
16
16
|
var playIcon: VideoFeedPlayIconConfiguration?
|
|
17
|
+
var showSponsored: Bool?
|
|
17
18
|
|
|
18
19
|
class VideoFeedTitleConfiguration: NSObject, Codable {
|
|
19
20
|
public var hidden: Bool?
|
|
@@ -21,6 +21,8 @@ RCT_CUSTOM_VIEW_PROPERTY(source, VideFeedSourceType, VideoFeed) {
|
|
|
21
21
|
}
|
|
22
22
|
RCT_EXPORT_VIEW_PROPERTY(channel, NSString)
|
|
23
23
|
RCT_EXPORT_VIEW_PROPERTY(playlist, NSString)
|
|
24
|
+
RCT_EXPORT_VIEW_PROPERTY(playlistGroup, NSString)
|
|
25
|
+
|
|
24
26
|
RCT_CUSTOM_VIEW_PROPERTY(mode, VideoFeedMode, VideoFeed) {
|
|
25
27
|
if (json) {
|
|
26
28
|
VideoFeedMode mode = [RCTConvert videoFeedMode:json];
|
|
@@ -13,6 +13,9 @@ public class VideoPlayerConfiguration: NSObject, Codable {
|
|
|
13
13
|
var videoCompleteAction: VideoPlayerCompleteAction?
|
|
14
14
|
var showShareButton: Bool?
|
|
15
15
|
var ctaButtonStyle: VideoPlayerCTAStyle?
|
|
16
|
+
var showPlaybackButton: Bool?
|
|
17
|
+
var showMuteButton: Bool?
|
|
18
|
+
var launchBehavior: VideoLaunchBehavior?
|
|
16
19
|
|
|
17
20
|
public enum VideoPlayerStyle: String, Codable {
|
|
18
21
|
case full, fit
|
|
@@ -27,4 +30,8 @@ public class VideoPlayerConfiguration: NSObject, Codable {
|
|
|
27
30
|
var textColor: String?
|
|
28
31
|
var fontSize: Int?
|
|
29
32
|
}
|
|
33
|
+
|
|
34
|
+
public enum VideoLaunchBehavior: String, Codable {
|
|
35
|
+
case `default`, muteOnFirstLaunch
|
|
36
|
+
}
|
|
30
37
|
}
|
|
@@ -8,6 +8,21 @@
|
|
|
8
8
|
import Foundation
|
|
9
9
|
|
|
10
10
|
extension RCTConvert {
|
|
11
|
+
static func buildProducts(_ rawProducts: [AnyObject]?) -> [Product]? {
|
|
12
|
+
guard let rRawProducts = rawProducts else {
|
|
13
|
+
return nil
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
var products = [Product]()
|
|
17
|
+
for rawProduct in rRawProducts {
|
|
18
|
+
let product = buildProduct(rawProduct as? [String : Any])
|
|
19
|
+
if let rProduct = product {
|
|
20
|
+
products.append(rProduct)
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return products
|
|
24
|
+
}
|
|
25
|
+
|
|
11
26
|
static func buildProduct(_ product: [String: Any]?) -> Product? {
|
|
12
27
|
guard let rProduct = product else {
|
|
13
28
|
return nil
|
|
@@ -69,7 +69,12 @@ extension FireworkSDKModule: FireworkVideoPlaybackDelegate {
|
|
|
69
69
|
|
|
70
70
|
extension FireworkSDKModule: FireworkVideoFeedDelegate {
|
|
71
71
|
func fireworkVideoDidTapThumbnail(_ eventDetails: FeedEventDetails) {
|
|
72
|
-
|
|
72
|
+
switch eventDetails.source {
|
|
73
|
+
case .playlistGroup(_): break
|
|
74
|
+
|
|
75
|
+
default:
|
|
76
|
+
sendEvent(withName: FWEventName.VideoFeedClick.rawValue, body: eventDetails.jsObject)
|
|
77
|
+
}
|
|
73
78
|
}
|
|
74
79
|
|
|
75
80
|
// func fireworkVideoDidTapVideoThumbnail(_ eventDetails: FeedEventDetails) {
|
|
@@ -65,6 +65,10 @@ class FireworkSDKModule: RCTEventEmitter, FireworkVideoSDKDelegate {
|
|
|
65
65
|
|
|
66
66
|
@objc(openVideoPlayer:config:)
|
|
67
67
|
func openVideoPlayer(_ url: String, config: [String:AnyObject]) {
|
|
68
|
+
guard let urlString = URL.init(string: url) else {
|
|
69
|
+
return
|
|
70
|
+
}
|
|
71
|
+
|
|
68
72
|
var finalConfig = RCTConvert.videoPlayerContentConfiguration(config)
|
|
69
73
|
if let baseUrl = gShareBaseURL {
|
|
70
74
|
finalConfig.shareButton.behavior.baseURL = URL(string: baseUrl)
|
|
@@ -74,7 +78,7 @@ class FireworkSDKModule: RCTEventEmitter, FireworkVideoSDKDelegate {
|
|
|
74
78
|
guard let presentedVC = RCTPresentedViewController() else {
|
|
75
79
|
return
|
|
76
80
|
}
|
|
77
|
-
VideoFeedViewController.openVideoPlayer(with:
|
|
81
|
+
VideoFeedViewController.openVideoPlayer(with: urlString, finalConfig, presentedVC) { _ in
|
|
78
82
|
|
|
79
83
|
}
|
|
80
84
|
}
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
_RCT_EXTERN_REMAP_METHOD(init, initialize, NO)
|
|
13
13
|
RCT_EXTERN_METHOD(setCartIconVisible:(BOOL)visible)
|
|
14
14
|
RCT_EXTERN_METHOD(setCartItemCount:(int)itemCounts)
|
|
15
|
-
RCT_EXTERN_METHOD(
|
|
15
|
+
RCT_EXTERN_METHOD(updateVideoProducts:(NSArray *)products cbId:(nonnull NSNumber *)cbid)
|
|
16
16
|
RCT_EXTERN_METHOD(updateProductViewConfig:(NSDictionary *)config cbId:(nonnull NSNumber *)cbid)
|
|
17
17
|
RCT_EXTERN_METHOD(updateAddToCartStatus:(NSString *)res tips:(nullable NSString *)tips cbId:(nonnull NSNumber *)cbid)
|
|
18
18
|
RCT_EXTERN_METHOD(jumpToCartPage:(nonnull NSNumber *)cbid)
|
|
@@ -63,16 +63,19 @@ class ShoppingModule: RCTEventEmitter, FireworkVideoShoppingDelegate, CartViewCo
|
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
@objc
|
|
66
|
-
func
|
|
67
|
-
let
|
|
68
|
-
|
|
66
|
+
func updateVideoProducts(_ products: [AnyObject]?, cbId: NSNumber) {
|
|
67
|
+
guard let rProducts = RCTConvert.buildProducts(products),
|
|
68
|
+
let productHydrating = productHydrating,
|
|
69
|
+
productHydrating.0 == Int(truncating: cbId) else {
|
|
69
70
|
return
|
|
70
71
|
}
|
|
71
72
|
|
|
72
73
|
DispatchQueue.main.async {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
74
|
+
for product in rProducts {
|
|
75
|
+
productHydrating.1.hydrateProduct(product.productId, { build in
|
|
76
|
+
return ShoppingModule.hydrateProduct(product, build)
|
|
77
|
+
})
|
|
78
|
+
}
|
|
76
79
|
}
|
|
77
80
|
}
|
|
78
81
|
|
|
@@ -136,9 +139,7 @@ class ShoppingModule: RCTEventEmitter, FireworkVideoShoppingDelegate, CartViewCo
|
|
|
136
139
|
let callbackId = ShoppingModule.generateCallbackId()
|
|
137
140
|
self.productHydrating = (callbackId, productHydrator)
|
|
138
141
|
|
|
139
|
-
|
|
140
|
-
sendEvent(withName: ShoppingEventName.UpdateProductDetails.rawValue, body: ["productId": productId, "callbackId": callbackId])
|
|
141
|
-
}
|
|
142
|
+
sendEvent(withName: ShoppingEventName.UpdateProductDetails.rawValue, body: ["productIds": products, "callbackId": callbackId])
|
|
142
143
|
}
|
|
143
144
|
|
|
144
145
|
func fireworkShopping(_ fireworkShopping: FireworkVideoShopping, addProductVariantToCart item: SelectedProductVariant, fromVideo video: VideoDetails, _ addToCartCompletionHandler: @escaping AddToCartHandler) {
|
|
@@ -142,10 +142,11 @@ class VideoShopping {
|
|
|
142
142
|
if (this.onUpdateProductDetails) {
|
|
143
143
|
const callbackId = event.callbackId;
|
|
144
144
|
delete event.callbackId;
|
|
145
|
-
const
|
|
145
|
+
const productList = await this.onUpdateProductDetails(event);
|
|
146
|
+
console.log('handleUpdateProductDetailsEvent productList', JSON.stringify(productList));
|
|
146
147
|
|
|
147
|
-
if (
|
|
148
|
-
_ShoppingModule.default.
|
|
148
|
+
if (productList) {
|
|
149
|
+
_ShoppingModule.default.updateVideoProducts(productList, callbackId);
|
|
149
150
|
}
|
|
150
151
|
}
|
|
151
152
|
}
|
|
@@ -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","
|
|
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","productList","console","log","JSON","stringify","updateVideoProducts","onWillDisplayProduct","config","updateProductViewConfig"],"mappings":";;;;;;;AAAA;;AAGA;;AAQA;;;;;;AAoBA;AACA;AACA;AACA,MAAMA,aAAN,CAAoB;AAIlB;AACF;AACA;AACA;AACA;;AAGE;AACF;AACA;AACA;AACA;;AAGE;AACF;AACA;AACA;AACA;;AAGE;AACF;AACA;AACA;AACA;;AAGE;AACF;AACA;AAC4B,MAAfC,eAAe,GAAY;AACpC,WAAO,KAAKC,gBAAZ;AACD;;AACyB,MAAfD,eAAe,CAACE,KAAD,EAAiB;AACzC,SAAKD,gBAAL,GAAwBC,KAAxB;;AACAC,4BAAeC,kBAAf,CAAkCF,KAAlC;AACD;;AAMwB,SAAXG,WAAW,GAAG;AAC1B,QAAI,CAACN,aAAa,CAACO,SAAnB,EAA8B;AAC5BP,MAAAA,aAAa,CAACO,SAAd,GAA0B,IAAIP,aAAJ,EAA1B;AACD;;AAED,WAAOA,aAAa,CAACO,SAArB;AACD;;AAEOC,EAAAA,WAAW,GAAG;AAAA,8CArDc,IAqDd;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AACpB,SAAKC,YAAL,GAAoB,IAAIC,+BAAJ,CAAuBN,uBAAvB,CAApB;AACA,SAAKK,YAAL,CAAkBE,WAAlB,CAA8BC,sBAAYC,SAA1C,EAAsDC,KAAD,IAAW;AAC9D,WAAKC,oBAAL,CAA0BD,KAA1B;AACD,KAFD;AAIA,SAAKL,YAAL,CAAkBE,WAAlB,CAA8BC,sBAAYI,aAA1C,EAA0DF,KAAD,IAAW;AAClE,WAAKG,wBAAL,CAA8BH,KAA9B;AACD,KAFD;AAIA,SAAKL,YAAL,CAAkBE,WAAlB,CAA8BC,sBAAYM,oBAA1C,EAAiEJ,KAAD,IAAW;AACzE,WAAKK,+BAAL,CAAqCL,KAArC;AACD,KAFD;AAIA,SAAKL,YAAL,CAAkBE,WAAlB,CAA8BC,sBAAYQ,kBAA1C,EAA+DN,KAAD,IAAW;AACvE,WAAKO,6BAAL,CAAmCP,KAAnC;AACD,KAFD;AAGD;AAED;AACF;AACA;AACA;AACA;;;AACSQ,EAAAA,YAAY,GAAG;AACpBlB,4BAAekB,YAAf;AACD;AAED;AACF;AACA;AACA;;;AACSC,EAAAA,gBAAgB,CAACC,KAAD,EAAgB;AACrCpB,4BAAemB,gBAAf,CAAgCC,KAAhC;AACD;;AAEiC,QAApBT,oBAAoB,CAACD,KAAD,EAAuC;AACvE,QAAI,KAAKW,WAAT,EAAsB;AACpB,YAAMC,UAAU,GAAGZ,KAAK,CAACY,UAAzB;AACA,aAAOZ,KAAK,CAACY,UAAb;AACA,YAAMC,MAAM,GAAG,MAAM,KAAKF,WAAL,CAAiBX,KAAjB,CAArB;;AACA,UAAIa,MAAJ,EAAY;AACVvB,gCAAewB,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;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,WAAW,GAAG,MAAM,KAAKD,sBAAL,CACxBrB,KADwB,CAA1B;AAGAuB,MAAAA,OAAO,CAACC,GAAR,CAAY,6CAAZ,EAA2DC,IAAI,CAACC,SAAL,CAAeJ,WAAf,CAA3D;;AACA,UAAIA,WAAJ,EAAiB;AACfhC,gCAAeqC,mBAAf,CAAmCL,WAAnC,EAAgDV,UAAhD;AACD;AACF;AACF;;AAE0C,QAA7BL,6BAA6B,CACzCP,KADyC,EAEzC;AACA,QAAI,KAAK4B,oBAAT,EAA+B;AAC7B,YAAMhB,UAAU,GAAGZ,KAAK,CAACY,UAAzB;AACA,aAAOZ,KAAK,CAACY,UAAb;AACA,YAAMiB,MAAM,GAAG,MAAM,KAAKD,oBAAL,CACnB5B,KADmB,CAArB;;AAGA,UAAI6B,MAAJ,EAAY;AACVvC,gCAAewC,uBAAf,CAAuCD,MAAvC,EAA+CjB,UAA/C;AACD;AACF;AACF;;AApJiB;;gBAAd1B,a;;eAuJSA,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 productList = await this.onUpdateProductDetails(\n event as UpdateProductDetailsEvent\n );\n console.log('handleUpdateProductDetailsEvent productList', JSON.stringify(productList));\n if (productList) {\n ShoppingModule.updateVideoProducts(productList, 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"]}
|
|
@@ -57,12 +57,13 @@ class VideoFeed extends _react.default.Component {
|
|
|
57
57
|
source,
|
|
58
58
|
channel = '',
|
|
59
59
|
playlist = '',
|
|
60
|
+
playlistGroup = '',
|
|
60
61
|
mode = 'row',
|
|
61
62
|
videoFeedConfiguration
|
|
62
63
|
} = this.props;
|
|
63
64
|
const titleHidden = (_videoFeedConfigurati = videoFeedConfiguration === null || videoFeedConfiguration === void 0 ? void 0 : (_videoFeedConfigurati2 = videoFeedConfiguration.title) === null || _videoFeedConfigurati2 === void 0 ? void 0 : _videoFeedConfigurati2.hidden) !== null && _videoFeedConfigurati !== void 0 ? _videoFeedConfigurati : false;
|
|
64
65
|
const titlePosition = (_videoFeedConfigurati3 = videoFeedConfiguration === null || videoFeedConfiguration === void 0 ? void 0 : videoFeedConfiguration.titlePosition) !== null && _videoFeedConfigurati3 !== void 0 ? _videoFeedConfigurati3 : 'nested';
|
|
65
|
-
const key = `source:${source}_channel:${channel}_playlist:${playlist}_mode:${mode}_titleHidden:${titleHidden}_titlePosition:${titlePosition}`;
|
|
66
|
+
const key = `source:${source}_channel:${channel}_playlist:${playlist}_playlistGroup:${playlistGroup}_mode:${mode}_titleHidden:${titleHidden}_titlePosition:${titlePosition}`;
|
|
66
67
|
return /*#__PURE__*/_react.default.createElement(_FWVideoFeed.default, _extends({
|
|
67
68
|
key: key
|
|
68
69
|
}, this.props, {
|
|
@@ -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","Object","assign","style","zIndex"],"mappings":";;;;;;;AAAA;;AACA;;AAKA;;;;;;;;
|
|
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","playlistGroup","mode","videoFeedConfiguration","titleHidden","title","hidden","titlePosition","key","_onVideoFeedLoadFinished","Object","assign","style","zIndex"],"mappings":";;;;;;;AAAA;;AACA;;AAKA;;;;;;;;AAkDA,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,aAAa,GAAG,EAJZ;AAKJC,MAAAA,IAAI,GAAG,KALH;AAMJC,MAAAA;AANI,QAOF,KAAKR,KAPT;AAQA,UAAMS,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,UAASV,MAAO,YAAWC,OAAQ,aAAYC,QAAS,kBAAiBC,aAAc,SAAQC,IAAK,gBAAeE,WAAY,kBAAiBG,aAAc,EAA3K;AAEA,wBACE,6BAAC,oBAAD;AACE,MAAA,GAAG,EAAEC;AADP,OAEM,KAAKb,KAFX;AAGE,MAAA,GAAG,EAAE,KAAKX,kBAHZ;AAIE,MAAA,uBAAuB,EAAE,KAAKyB,wBAJhC;AAKE,MAAA,IAAI,EAAEP,IALR;AAME,MAAA,KAAK,EAAEQ,MAAM,CAACC,MAAP,CAAc,EAAd,EAAkB,KAAKhB,KAAL,CAAWiB,KAA7B,EAAoC;AAACC,QAAAA,MAAM,EAAE,CAAC;AAAV,OAApC;AANT,OADF;AAUD;;AAxDqE;;;;gBAAnDlC,S,kBACG;AACpBuB,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' | 'playlistGroup';\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 /**\n * PlaylistGroup Id for selected content. Required when the source is set as playlistGroup.\n */\n playlistGroup?: 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 playlistGroup = '',\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}_playlistGroup:${playlistGroup}_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":["index.tsx"],"names":["AppRegistry","registerComponent","CartContainer","FireworkSDK"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AAEA;;AAMA;;AAOA;;
|
|
1
|
+
{"version":3,"sources":["index.tsx"],"names":["AppRegistry","registerComponent","CartContainer","FireworkSDK"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AAEA;;AAMA;;AAOA;;AA6BA;;AAaA;;;;AAEAA,yBAAYC,iBAAZ,CAA8B,oBAA9B,EAAoD,MAAMC,sBAA1D;;eAEeC,oB","sourcesContent":["import { AppRegistry } from 'react-native';\n\nimport CartContainer from './components/CartContainer';\nimport type {\n IVideoFeedProps,\n VideoFeedMode,\n VideoFeedSource,\n} from './components/VideoFeed';\nimport VideoFeed from './components/VideoFeed';\nimport type {\n CustomCTAClickCallback,\n SDKInitCallback,\n VideoFeedClickCallback,\n VideoPlaybackCallback,\n} from './FireworkSDK';\nimport FireworkSDK from './FireworkSDK';\nimport type ADConfig from './models/ADConfig';\nimport type AddToCartResult from './models/AddToCartResult';\nimport type FeedItemDetails from './models/FeedItemDetails';\nimport type FWError from './models/FWError';\nimport type {\n AddToCartEvent,\n CustomCTAClickEvent,\n SDKInitEvent,\n UpdateProductDetailsEvent,\n VideoPlaybackEvent,\n WillDisplayProductEvent,\n} from './models/FWEvents';\nimport type Product from './models/Product';\nimport type ProductInfoViewConfiguration from './models/ProductInfoViewConfiguration';\nimport type { AddToCartButtonConfiguration } from './models/ProductInfoViewConfiguration';\nimport type ProductUnit from './models/ProductUnit';\nimport type { ProductPrice } from './models/ProductUnit';\nimport type VideoFeedConfiguration from './models/VideoFeedConfiguration';\nimport type {\n VideoFeedPlayIconConfiguration,\n VideoFeedTitleConfiguration,\n VideoFeedTitlePosition,\n} from './models/VideoFeedConfiguration';\nimport type VideoPlaybackDetails from './models/VideoPlaybackDetails';\nimport type {\n VideoBadge,\n VideoPlayerSize,\n} from './models/VideoPlaybackDetails';\nimport VideoPlaybackEventName from './models/VideoPlaybackEventName';\nimport type VideoPlayerConfiguration from './models/VideoPlayerConfiguration';\nimport type {\n VideoPlayerCompleteAction,\n VideoPlayerCTAStyle,\n VideoPlayerStyle,\n} from './models/VideoPlayerConfiguration';\nimport type {\n AddToCartCallback,\n ClickCartIconCallback,\n UpdateProductDetailsCallback,\n WillDisplayProductCallback,\n} from './VideoShopping';\nimport VideoShopping from './VideoShopping';\n\nAppRegistry.registerComponent('FWShoppingCartPage', () => CartContainer);\n\nexport default FireworkSDK;\n\nexport {\n ADConfig,\n AddToCartButtonConfiguration,\n AddToCartCallback,\n AddToCartEvent,\n AddToCartResult,\n ClickCartIconCallback,\n CustomCTAClickCallback,\n CustomCTAClickEvent,\n FeedItemDetails,\n FWError,\n IVideoFeedProps,\n Product,\n ProductInfoViewConfiguration,\n ProductPrice,\n ProductUnit,\n SDKInitCallback,\n SDKInitEvent,\n UpdateProductDetailsCallback,\n UpdateProductDetailsEvent,\n VideoBadge,\n VideoFeed,\n VideoFeedClickCallback,\n VideoFeedConfiguration,\n VideoFeedMode,\n VideoFeedPlayIconConfiguration,\n VideoFeedSource,\n VideoFeedTitleConfiguration,\n VideoFeedTitlePosition,\n VideoPlaybackCallback,\n VideoPlaybackDetails,\n VideoPlaybackEvent,\n VideoPlaybackEventName,\n VideoPlayerCompleteAction,\n VideoPlayerConfiguration,\n VideoPlayerCTAStyle,\n VideoPlayerSize,\n VideoPlayerStyle,\n VideoShopping,\n WillDisplayProductCallback,\n WillDisplayProductEvent,\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["FWEvents.ts"],"names":["FWEventName"],"mappings":";;;;;;IAKYA,W;;;WAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;GAAAA,W,2BAAAA,W","sourcesContent":["import type VideoPlaybackDetails from './VideoPlaybackDetails';\nimport type FWError from './FWError';\nimport type VideoPlaybackEventName from './VideoPlaybackEventName';\nimport type FeedItemDetails from './FeedItemDetails';\n\nexport enum FWEventName {\n SDKInit = 'fw:sdk-init',\n CustomCTAClick = 'fw:custom-cta-click',\n VideoPlayback = 'fw:video-playback',\n VideoFeedClick = 'fw:video-feed-click',\n AddToCart = 'fw:shopping:add-to-cart',\n ClickCartIcon = 'fw:shopping:click-cart-icon',\n UpdateProductDetails = 'fw:shopping:update-product-details',\n WillDisplayProduct = 'fw:shopping:will-display-product',\n}\n\nexport interface SDKInitEvent {\n /**\n * If error equals undefined/null, it means the initialization is successful.\n */\n error?: FWError | null;\n}\n\nexport interface CustomCTAClickEvent {\n /**\n * Action URL that is associated with this CTA\n */\n url: string;\n}\n\nexport interface VideoPlaybackEvent {\n eventName: VideoPlaybackEventName;\n info: VideoPlaybackDetails;\n}\n\nexport interface VideoFeedClickEvent {\n info: FeedItemDetails;\n}\n\nexport interface AddToCartEvent {\n /**\n * A unique identifier of the product.\n */\n productId: string;\n /**\n * A unique identifier of the product unit.\n */\n unitId: string;\n}\n\nexport interface UpdateProductDetailsEvent {\n /**\n * A unique identifier of the product.\n */\n
|
|
1
|
+
{"version":3,"sources":["FWEvents.ts"],"names":["FWEventName"],"mappings":";;;;;;IAKYA,W;;;WAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;GAAAA,W,2BAAAA,W","sourcesContent":["import type VideoPlaybackDetails from './VideoPlaybackDetails';\nimport type FWError from './FWError';\nimport type VideoPlaybackEventName from './VideoPlaybackEventName';\nimport type FeedItemDetails from './FeedItemDetails';\n\nexport enum FWEventName {\n SDKInit = 'fw:sdk-init',\n CustomCTAClick = 'fw:custom-cta-click',\n VideoPlayback = 'fw:video-playback',\n VideoFeedClick = 'fw:video-feed-click',\n AddToCart = 'fw:shopping:add-to-cart',\n ClickCartIcon = 'fw:shopping:click-cart-icon',\n UpdateProductDetails = 'fw:shopping:update-product-details',\n WillDisplayProduct = 'fw:shopping:will-display-product',\n}\n\nexport interface SDKInitEvent {\n /**\n * If error equals undefined/null, it means the initialization is successful.\n */\n error?: FWError | null;\n}\n\nexport interface CustomCTAClickEvent {\n /**\n * Action URL that is associated with this CTA\n */\n url: string;\n}\n\nexport interface VideoPlaybackEvent {\n eventName: VideoPlaybackEventName;\n info: VideoPlaybackDetails;\n}\n\nexport interface VideoFeedClickEvent {\n info: FeedItemDetails;\n}\n\nexport interface AddToCartEvent {\n /**\n * A unique identifier of the product.\n */\n productId: string;\n /**\n * A unique identifier of the product unit.\n */\n unitId: string;\n}\n\nexport interface UpdateProductDetailsEvent {\n /**\n * A unique identifier of the product.\n */\n productIds: string[];\n}\n\nexport interface WillDisplayProductEvent {\n /**\n * A unique identifier of the video.\n */\n videoId: string;\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
|
|
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 updateVideoProducts(products: 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"]}
|
|
@@ -130,10 +130,11 @@ class VideoShopping {
|
|
|
130
130
|
if (this.onUpdateProductDetails) {
|
|
131
131
|
const callbackId = event.callbackId;
|
|
132
132
|
delete event.callbackId;
|
|
133
|
-
const
|
|
133
|
+
const productList = await this.onUpdateProductDetails(event);
|
|
134
|
+
console.log('handleUpdateProductDetailsEvent productList', JSON.stringify(productList));
|
|
134
135
|
|
|
135
|
-
if (
|
|
136
|
-
ShoppingModule.
|
|
136
|
+
if (productList) {
|
|
137
|
+
ShoppingModule.updateVideoProducts(productList, callbackId);
|
|
137
138
|
}
|
|
138
139
|
}
|
|
139
140
|
}
|
|
@@ -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","
|
|
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","productList","console","log","JSON","stringify","updateVideoProducts","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 productList = await this.onUpdateProductDetails(\n event as UpdateProductDetailsEvent\n );\n console.log('handleUpdateProductDetailsEvent productList', JSON.stringify(productList));\n if (productList) {\n ShoppingModule.updateVideoProducts(productList, 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"]}
|
|
@@ -43,12 +43,13 @@ export default class VideoFeed extends React.Component {
|
|
|
43
43
|
source,
|
|
44
44
|
channel = '',
|
|
45
45
|
playlist = '',
|
|
46
|
+
playlistGroup = '',
|
|
46
47
|
mode = 'row',
|
|
47
48
|
videoFeedConfiguration
|
|
48
49
|
} = this.props;
|
|
49
50
|
const titleHidden = (_videoFeedConfigurati = videoFeedConfiguration === null || videoFeedConfiguration === void 0 ? void 0 : (_videoFeedConfigurati2 = videoFeedConfiguration.title) === null || _videoFeedConfigurati2 === void 0 ? void 0 : _videoFeedConfigurati2.hidden) !== null && _videoFeedConfigurati !== void 0 ? _videoFeedConfigurati : false;
|
|
50
51
|
const titlePosition = (_videoFeedConfigurati3 = videoFeedConfiguration === null || videoFeedConfiguration === void 0 ? void 0 : videoFeedConfiguration.titlePosition) !== null && _videoFeedConfigurati3 !== void 0 ? _videoFeedConfigurati3 : 'nested';
|
|
51
|
-
const key = `source:${source}_channel:${channel}_playlist:${playlist}_mode:${mode}_titleHidden:${titleHidden}_titlePosition:${titlePosition}`;
|
|
52
|
+
const key = `source:${source}_channel:${channel}_playlist:${playlist}_playlistGroup:${playlistGroup}_mode:${mode}_titleHidden:${titleHidden}_titlePosition:${titlePosition}`;
|
|
52
53
|
return /*#__PURE__*/React.createElement(FWVideoFeed, _extends({
|
|
53
54
|
key: key
|
|
54
55
|
}, this.props, {
|
|
@@ -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","Object","assign","style","zIndex"],"mappings":";;;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAASC,SAAT,EAAoBC,cAApB,QAAgE,cAAhE;AAKA,OAAOC,WAAP,MAAwB,eAAxB;
|
|
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","playlistGroup","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;AAkDA,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,aAAa,GAAG,EAJZ;AAKJC,MAAAA,IAAI,GAAG,KALH;AAMJC,MAAAA;AANI,QAOF,KAAKR,KAPT;AAQA,UAAMS,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,UAASV,MAAO,YAAWC,OAAQ,aAAYC,QAAS,kBAAiBC,aAAc,SAAQC,IAAK,gBAAeE,WAAY,kBAAiBG,aAAc,EAA3K;AAEA,wBACE,oBAAC,WAAD;AACE,MAAA,GAAG,EAAEC;AADP,OAEM,KAAKb,KAFX;AAGE,MAAA,GAAG,EAAE,KAAKV,kBAHZ;AAIE,MAAA,uBAAuB,EAAE,KAAKwB,wBAJhC;AAKE,MAAA,IAAI,EAAEP,IALR;AAME,MAAA,KAAK,EAAEQ,MAAM,CAACC,MAAP,CAAc,EAAd,EAAkB,KAAKhB,KAAL,CAAWiB,KAA7B,EAAoC;AAACC,QAAAA,MAAM,EAAE,CAAC;AAAV,OAApC;AANT,OADF;AAUD;;AAxDqE;;gBAAnDhC,S,kBACG;AACpBqB,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' | 'playlistGroup';\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 /**\n * PlaylistGroup Id for selected content. Required when the source is set as playlistGroup.\n */\n playlistGroup?: 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 playlistGroup = '',\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}_playlistGroup:${playlistGroup}_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"]}
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index.tsx"],"names":["AppRegistry","CartContainer","VideoFeed","FireworkSDK","VideoPlaybackEventName","VideoShopping","registerComponent"],"mappings":"AAAA,SAASA,WAAT,QAA4B,cAA5B;AAEA,OAAOC,aAAP,MAA0B,4BAA1B;AAMA,OAAOC,SAAP,MAAsB,wBAAtB;AAOA,OAAOC,WAAP,MAAwB,eAAxB;
|
|
1
|
+
{"version":3,"sources":["index.tsx"],"names":["AppRegistry","CartContainer","VideoFeed","FireworkSDK","VideoPlaybackEventName","VideoShopping","registerComponent"],"mappings":"AAAA,SAASA,WAAT,QAA4B,cAA5B;AAEA,OAAOC,aAAP,MAA0B,4BAA1B;AAMA,OAAOC,SAAP,MAAsB,wBAAtB;AAOA,OAAOC,WAAP,MAAwB,eAAxB;AA6BA,OAAOC,sBAAP,MAAmC,iCAAnC;AAaA,OAAOC,aAAP,MAA0B,iBAA1B;AAEAL,WAAW,CAACM,iBAAZ,CAA8B,oBAA9B,EAAoD,MAAML,aAA1D;AAEA,eAAeE,WAAf;AAEA,SAqBED,SArBF,EAgCEE,sBAhCF,EAsCEC,aAtCF","sourcesContent":["import { AppRegistry } from 'react-native';\n\nimport CartContainer from './components/CartContainer';\nimport type {\n IVideoFeedProps,\n VideoFeedMode,\n VideoFeedSource,\n} from './components/VideoFeed';\nimport VideoFeed from './components/VideoFeed';\nimport type {\n CustomCTAClickCallback,\n SDKInitCallback,\n VideoFeedClickCallback,\n VideoPlaybackCallback,\n} from './FireworkSDK';\nimport FireworkSDK from './FireworkSDK';\nimport type ADConfig from './models/ADConfig';\nimport type AddToCartResult from './models/AddToCartResult';\nimport type FeedItemDetails from './models/FeedItemDetails';\nimport type FWError from './models/FWError';\nimport type {\n AddToCartEvent,\n CustomCTAClickEvent,\n SDKInitEvent,\n UpdateProductDetailsEvent,\n VideoPlaybackEvent,\n WillDisplayProductEvent,\n} from './models/FWEvents';\nimport type Product from './models/Product';\nimport type ProductInfoViewConfiguration from './models/ProductInfoViewConfiguration';\nimport type { AddToCartButtonConfiguration } from './models/ProductInfoViewConfiguration';\nimport type ProductUnit from './models/ProductUnit';\nimport type { ProductPrice } from './models/ProductUnit';\nimport type VideoFeedConfiguration from './models/VideoFeedConfiguration';\nimport type {\n VideoFeedPlayIconConfiguration,\n VideoFeedTitleConfiguration,\n VideoFeedTitlePosition,\n} from './models/VideoFeedConfiguration';\nimport type VideoPlaybackDetails from './models/VideoPlaybackDetails';\nimport type {\n VideoBadge,\n VideoPlayerSize,\n} from './models/VideoPlaybackDetails';\nimport VideoPlaybackEventName from './models/VideoPlaybackEventName';\nimport type VideoPlayerConfiguration from './models/VideoPlayerConfiguration';\nimport type {\n VideoPlayerCompleteAction,\n VideoPlayerCTAStyle,\n VideoPlayerStyle,\n} from './models/VideoPlayerConfiguration';\nimport type {\n AddToCartCallback,\n ClickCartIconCallback,\n UpdateProductDetailsCallback,\n WillDisplayProductCallback,\n} from './VideoShopping';\nimport VideoShopping from './VideoShopping';\n\nAppRegistry.registerComponent('FWShoppingCartPage', () => CartContainer);\n\nexport default FireworkSDK;\n\nexport {\n ADConfig,\n AddToCartButtonConfiguration,\n AddToCartCallback,\n AddToCartEvent,\n AddToCartResult,\n ClickCartIconCallback,\n CustomCTAClickCallback,\n CustomCTAClickEvent,\n FeedItemDetails,\n FWError,\n IVideoFeedProps,\n Product,\n ProductInfoViewConfiguration,\n ProductPrice,\n ProductUnit,\n SDKInitCallback,\n SDKInitEvent,\n UpdateProductDetailsCallback,\n UpdateProductDetailsEvent,\n VideoBadge,\n VideoFeed,\n VideoFeedClickCallback,\n VideoFeedConfiguration,\n VideoFeedMode,\n VideoFeedPlayIconConfiguration,\n VideoFeedSource,\n VideoFeedTitleConfiguration,\n VideoFeedTitlePosition,\n VideoPlaybackCallback,\n VideoPlaybackDetails,\n VideoPlaybackEvent,\n VideoPlaybackEventName,\n VideoPlayerCompleteAction,\n VideoPlayerConfiguration,\n VideoPlayerCTAStyle,\n VideoPlayerSize,\n VideoPlayerStyle,\n VideoShopping,\n WillDisplayProductCallback,\n WillDisplayProductEvent,\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["FWEvents.ts"],"names":["FWEventName"],"mappings":"AAKA,WAAYA,WAAZ;;WAAYA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;GAAAA,W,KAAAA,W","sourcesContent":["import type VideoPlaybackDetails from './VideoPlaybackDetails';\nimport type FWError from './FWError';\nimport type VideoPlaybackEventName from './VideoPlaybackEventName';\nimport type FeedItemDetails from './FeedItemDetails';\n\nexport enum FWEventName {\n SDKInit = 'fw:sdk-init',\n CustomCTAClick = 'fw:custom-cta-click',\n VideoPlayback = 'fw:video-playback',\n VideoFeedClick = 'fw:video-feed-click',\n AddToCart = 'fw:shopping:add-to-cart',\n ClickCartIcon = 'fw:shopping:click-cart-icon',\n UpdateProductDetails = 'fw:shopping:update-product-details',\n WillDisplayProduct = 'fw:shopping:will-display-product',\n}\n\nexport interface SDKInitEvent {\n /**\n * If error equals undefined/null, it means the initialization is successful.\n */\n error?: FWError | null;\n}\n\nexport interface CustomCTAClickEvent {\n /**\n * Action URL that is associated with this CTA\n */\n url: string;\n}\n\nexport interface VideoPlaybackEvent {\n eventName: VideoPlaybackEventName;\n info: VideoPlaybackDetails;\n}\n\nexport interface VideoFeedClickEvent {\n info: FeedItemDetails;\n}\n\nexport interface AddToCartEvent {\n /**\n * A unique identifier of the product.\n */\n productId: string;\n /**\n * A unique identifier of the product unit.\n */\n unitId: string;\n}\n\nexport interface UpdateProductDetailsEvent {\n /**\n * A unique identifier of the product.\n */\n
|
|
1
|
+
{"version":3,"sources":["FWEvents.ts"],"names":["FWEventName"],"mappings":"AAKA,WAAYA,WAAZ;;WAAYA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;GAAAA,W,KAAAA,W","sourcesContent":["import type VideoPlaybackDetails from './VideoPlaybackDetails';\nimport type FWError from './FWError';\nimport type VideoPlaybackEventName from './VideoPlaybackEventName';\nimport type FeedItemDetails from './FeedItemDetails';\n\nexport enum FWEventName {\n SDKInit = 'fw:sdk-init',\n CustomCTAClick = 'fw:custom-cta-click',\n VideoPlayback = 'fw:video-playback',\n VideoFeedClick = 'fw:video-feed-click',\n AddToCart = 'fw:shopping:add-to-cart',\n ClickCartIcon = 'fw:shopping:click-cart-icon',\n UpdateProductDetails = 'fw:shopping:update-product-details',\n WillDisplayProduct = 'fw:shopping:will-display-product',\n}\n\nexport interface SDKInitEvent {\n /**\n * If error equals undefined/null, it means the initialization is successful.\n */\n error?: FWError | null;\n}\n\nexport interface CustomCTAClickEvent {\n /**\n * Action URL that is associated with this CTA\n */\n url: string;\n}\n\nexport interface VideoPlaybackEvent {\n eventName: VideoPlaybackEventName;\n info: VideoPlaybackDetails;\n}\n\nexport interface VideoFeedClickEvent {\n info: FeedItemDetails;\n}\n\nexport interface AddToCartEvent {\n /**\n * A unique identifier of the product.\n */\n productId: string;\n /**\n * A unique identifier of the product unit.\n */\n unitId: string;\n}\n\nexport interface UpdateProductDetailsEvent {\n /**\n * A unique identifier of the product.\n */\n productIds: string[];\n}\n\nexport interface WillDisplayProductEvent {\n /**\n * A unique identifier of the video.\n */\n videoId: string;\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
|
|
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 updateVideoProducts(products: 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"]}
|
|
@@ -5,7 +5,7 @@ import type Product from './models/Product';
|
|
|
5
5
|
import type ProductInfoViewConfiguration from './models/ProductInfoViewConfiguration';
|
|
6
6
|
export declare type AddToCartCallback = (event: AddToCartEvent) => Promise<AddToCartResult | undefined | null>;
|
|
7
7
|
export declare type ClickCartIconCallback = () => Promise<React.ReactNode | undefined | null>;
|
|
8
|
-
export declare type UpdateProductDetailsCallback = (event: UpdateProductDetailsEvent) => Promise<Product | undefined | null>;
|
|
8
|
+
export declare type UpdateProductDetailsCallback = (event: UpdateProductDetailsEvent) => Promise<Product[] | undefined | null>;
|
|
9
9
|
export declare type WillDisplayProductCallback = (event: WillDisplayProductEvent) => Promise<ProductInfoViewConfiguration | undefined | null>;
|
|
10
10
|
/**
|
|
11
11
|
* Entry class of Video Shopping
|
|
@@ -3,7 +3,7 @@ import { StyleProp, ViewStyle } from 'react-native';
|
|
|
3
3
|
import type VideoPlayerConfiguration from '../models/VideoPlayerConfiguration';
|
|
4
4
|
import type VideoFeedConfiguration from '../models/VideoFeedConfiguration';
|
|
5
5
|
import type FWError from '../models/FWError';
|
|
6
|
-
export declare type VideoFeedSource = 'discover' | 'channel' | 'playlist';
|
|
6
|
+
export declare type VideoFeedSource = 'discover' | 'channel' | 'playlist' | 'playlistGroup';
|
|
7
7
|
export declare type VideoFeedMode = 'row' | 'column' | 'grid';
|
|
8
8
|
export interface IVideoFeedProps {
|
|
9
9
|
/**
|
|
@@ -22,6 +22,10 @@ export interface IVideoFeedProps {
|
|
|
22
22
|
* Playlist Id for selected content. Please note channel name is necessary. Required when the source is set as playlist.
|
|
23
23
|
*/
|
|
24
24
|
playlist?: string;
|
|
25
|
+
/**
|
|
26
|
+
* PlaylistGroup Id for selected content. Required when the source is set as playlistGroup.
|
|
27
|
+
*/
|
|
28
|
+
playlistGroup?: string;
|
|
25
29
|
/**
|
|
26
30
|
* One of three available display modes. Defaults to row.
|
|
27
31
|
*/
|
|
@@ -22,4 +22,12 @@ export default interface VideoPlayerConfiguration {
|
|
|
22
22
|
* The style of CTA button style. Only supported on iOS.
|
|
23
23
|
*/
|
|
24
24
|
ctaButtonStyle?: VideoPlayerCTAStyle;
|
|
25
|
+
/**
|
|
26
|
+
* Indicates if the video player shows playback button.
|
|
27
|
+
*/
|
|
28
|
+
showPlaybackButton?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Indicates if the video player shows mute button.
|
|
31
|
+
*/
|
|
32
|
+
showMuteButton?: boolean;
|
|
25
33
|
}
|
|
@@ -3,7 +3,7 @@ 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
|
-
|
|
6
|
+
updateVideoProducts(products: Product[], callbackId: number | string): void;
|
|
7
7
|
updateProductViewConfig(config: ProductInfoViewConfiguration, callbackId: number | string): void;
|
|
8
8
|
updateAddToCartStatus(res: string, tips: string, callbackId: number | string): void;
|
|
9
9
|
jumpToCartPage(callbackId: number | string): void;
|
package/package.json
CHANGED
package/src/VideoShopping.ts
CHANGED
|
@@ -21,7 +21,7 @@ export type ClickCartIconCallback = () => Promise<
|
|
|
21
21
|
|
|
22
22
|
export type UpdateProductDetailsCallback = (
|
|
23
23
|
event: UpdateProductDetailsEvent
|
|
24
|
-
) => Promise<Product | undefined | null>;
|
|
24
|
+
) => Promise<Product[] | undefined | null>;
|
|
25
25
|
|
|
26
26
|
export type WillDisplayProductCallback = (
|
|
27
27
|
event: WillDisplayProductEvent
|
|
@@ -157,11 +157,12 @@ class VideoShopping {
|
|
|
157
157
|
if (this.onUpdateProductDetails) {
|
|
158
158
|
const callbackId = event.callbackId;
|
|
159
159
|
delete event.callbackId;
|
|
160
|
-
const
|
|
160
|
+
const productList = await this.onUpdateProductDetails(
|
|
161
161
|
event as UpdateProductDetailsEvent
|
|
162
162
|
);
|
|
163
|
-
|
|
164
|
-
|
|
163
|
+
console.log('handleUpdateProductDetailsEvent productList', JSON.stringify(productList));
|
|
164
|
+
if (productList) {
|
|
165
|
+
ShoppingModule.updateVideoProducts(productList, callbackId!);
|
|
165
166
|
}
|
|
166
167
|
}
|
|
167
168
|
}
|
|
@@ -6,7 +6,7 @@ import type VideoFeedConfiguration from '../models/VideoFeedConfiguration';
|
|
|
6
6
|
import type FWError from '../models/FWError';
|
|
7
7
|
import FWVideoFeed from './FWVideoFeed';
|
|
8
8
|
|
|
9
|
-
export type VideoFeedSource = 'discover' | 'channel' | 'playlist';
|
|
9
|
+
export type VideoFeedSource = 'discover' | 'channel' | 'playlist' | 'playlistGroup';
|
|
10
10
|
export type VideoFeedMode = 'row' | 'column' | 'grid';
|
|
11
11
|
|
|
12
12
|
export interface IVideoFeedProps {
|
|
@@ -26,6 +26,11 @@ export interface IVideoFeedProps {
|
|
|
26
26
|
* Playlist Id for selected content. Please note channel name is necessary. Required when the source is set as playlist.
|
|
27
27
|
*/
|
|
28
28
|
playlist?: string;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* PlaylistGroup Id for selected content. Required when the source is set as playlistGroup.
|
|
32
|
+
*/
|
|
33
|
+
playlistGroup?: string;
|
|
29
34
|
/**
|
|
30
35
|
* One of three available display modes. Defaults to row.
|
|
31
36
|
*/
|
|
@@ -88,13 +93,14 @@ export default class VideoFeed extends React.Component<IVideoFeedProps> {
|
|
|
88
93
|
source,
|
|
89
94
|
channel = '',
|
|
90
95
|
playlist = '',
|
|
96
|
+
playlistGroup = '',
|
|
91
97
|
mode = 'row',
|
|
92
98
|
videoFeedConfiguration,
|
|
93
99
|
} = this.props;
|
|
94
100
|
const titleHidden = videoFeedConfiguration?.title?.hidden ?? false;
|
|
95
101
|
const titlePosition = videoFeedConfiguration?.titlePosition ?? 'nested';
|
|
96
102
|
|
|
97
|
-
const key = `source:${source}_channel:${channel}_playlist:${playlist}_mode:${mode}_titleHidden:${titleHidden}_titlePosition:${titlePosition}`;
|
|
103
|
+
const key = `source:${source}_channel:${channel}_playlist:${playlist}_playlistGroup:${playlistGroup}_mode:${mode}_titleHidden:${titleHidden}_titlePosition:${titlePosition}`;
|
|
98
104
|
|
|
99
105
|
return (
|
|
100
106
|
<FWVideoFeed
|
package/src/index.tsx
CHANGED
|
@@ -28,9 +28,7 @@ import type {
|
|
|
28
28
|
} from './models/FWEvents';
|
|
29
29
|
import type Product from './models/Product';
|
|
30
30
|
import type ProductInfoViewConfiguration from './models/ProductInfoViewConfiguration';
|
|
31
|
-
import type {
|
|
32
|
-
AddToCartButtonConfiguration,
|
|
33
|
-
} from './models/ProductInfoViewConfiguration';
|
|
31
|
+
import type { AddToCartButtonConfiguration } from './models/ProductInfoViewConfiguration';
|
|
34
32
|
import type ProductUnit from './models/ProductUnit';
|
|
35
33
|
import type { ProductPrice } from './models/ProductUnit';
|
|
36
34
|
import type VideoFeedConfiguration from './models/VideoFeedConfiguration';
|
package/src/models/FWEvents.ts
CHANGED
|
@@ -23,4 +23,12 @@ export default interface VideoPlayerConfiguration {
|
|
|
23
23
|
* The style of CTA button style. Only supported on iOS.
|
|
24
24
|
*/
|
|
25
25
|
ctaButtonStyle?: VideoPlayerCTAStyle;
|
|
26
|
+
/**
|
|
27
|
+
* Indicates if the video player shows playback button.
|
|
28
|
+
*/
|
|
29
|
+
showPlaybackButton?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Indicates if the video player shows mute button.
|
|
32
|
+
*/
|
|
33
|
+
showMuteButton?: boolean;
|
|
26
34
|
}
|
|
@@ -19,7 +19,7 @@ const ShoppingModule = NativeModules.ShoppingModule
|
|
|
19
19
|
|
|
20
20
|
interface IShoppingModule extends NativeModule {
|
|
21
21
|
init(): void;
|
|
22
|
-
|
|
22
|
+
updateVideoProducts(products: Product[], callbackId: number | string): void;
|
|
23
23
|
updateProductViewConfig(config: ProductInfoViewConfiguration, callbackId: number | string): void;
|
|
24
24
|
updateAddToCartStatus(res: string, tips: string, callbackId: number | string): void;
|
|
25
25
|
jumpToCartPage(callbackId: number | string): void;
|