react-native-firework-sdk 2.10.0 → 2.11.0
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/gradle.properties +1 -1
- package/android/src/main/java/com/fireworksdk/bridge/components/storyblock/StoryBlockFragment.kt +18 -1
- package/android/src/main/java/com/fireworksdk/bridge/components/videofeed/FWVideoFeed.kt +4 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/FWSDKInitOptionsModel.kt +0 -1
- package/android/src/main/java/com/fireworksdk/bridge/models/FWSDKInitOptionsModelDeserializer.kt +0 -3
- package/android/src/main/java/com/fireworksdk/bridge/models/FWSDKInitOptionsModelSerializer.kt +0 -2
- package/android/src/main/java/com/fireworksdk/bridge/models/FWSdkInitResultModel.kt +6 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/FWTrackPurchaseModel.kt +9 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/FWTrackPurchaseModelDeserializer.kt +45 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/FWTrackPurchaseModelSerializer.kt +34 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoFeedItemDetailsModel.kt +1 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoPlaybackDetails.kt +1 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoPlayerConfigModel.kt +2 -1
- package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoPlayerConfigModelDeserializer.kt +4 -1
- package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoPlayerConfigModelSerializer.kt +2 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoPlayerLogoConfigurationModel.kt +8 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoPlayerLogoConfigurationModelDeserializer.kt +23 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoPlayerLogoConfigurationModelSerializer.kt +18 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/enums/FWEventName.kt +2 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/enums/FWVideoPlayerLogoOption.kt +19 -0
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/FWReactNativeSDK.kt +103 -0
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/manager/FWStoryBlockManager.kt +12 -0
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/manager/FWVideoFeedManager.kt +8 -0
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/models/FireworkSDKInterface.kt +2 -0
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FWLiveStreamModule.kt +2 -0
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FWVideoShoppingModule.kt +22 -9
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FireworkSDKModule.kt +78 -122
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/utils/FWEventUtils.kt +34 -9
- package/android/src/main/java/com/fireworksdk/bridge/utils/FWConfigUtil.kt +13 -0
- package/android/src/main/java/com/fireworksdk/bridge/utils/FWFragmentUtil.kt +3 -3
- package/android/src/main/java/com/fireworksdk/bridge/utils/FWGlobalDataUtil.kt +5 -2
- package/android/src/main/java/com/fireworksdk/bridge/utils/FWModelUtils.kt +64 -0
- package/ios/Components/ReplayBadgeConfiguration.swift +12 -0
- package/ios/Components/StoryBlock.swift +31 -0
- package/ios/Components/StoryBlockConfiguration.swift +1 -0
- package/ios/Components/StoryBlockManager.m +24 -0
- package/ios/Components/StoryBlockManager.swift +6 -3
- package/ios/Components/VideoFeed.swift +18 -3
- package/ios/Components/VideoFeedConfiguration.swift +1 -0
- package/ios/Components/VideoFeedManager.m +4 -1
- package/ios/Components/VideoFeedManager.swift +6 -3
- package/ios/Components/VideoPlayerConfiguration.swift +1 -0
- package/ios/FWReactNativeSDK.swift +14 -0
- package/ios/FireworkSdk.xcodeproj/project.pbxproj +4 -0
- package/ios/Modules/FireworkSDKModule/FireworkSDKModule+CTA.swift +17 -15
- package/ios/Modules/FireworkSDKModule/FireworkSDKModule+EventTracking.swift +1 -11
- package/ios/Modules/FireworkSDKModule/FireworkSDKModule.m +1 -0
- package/ios/Modules/FireworkSDKModule/FireworkSDKModule.swift +80 -81
- package/ios/Modules/FireworkSDKModule/SDKInitOptions.swift +9 -5
- package/ios/Modules/Shopping/ShoppingModule.swift +10 -74
- package/lib/commonjs/FireworkSDK.js +30 -25
- package/lib/commonjs/FireworkSDK.js.map +1 -1
- package/lib/commonjs/VideoShopping.js +6 -12
- package/lib/commonjs/VideoShopping.js.map +1 -1
- package/lib/commonjs/components/StoryBlock.js +54 -3
- package/lib/commonjs/components/StoryBlock.js.map +1 -1
- package/lib/commonjs/components/VideoFeed.js +46 -4
- package/lib/commonjs/components/VideoFeed.js.map +1 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/models/FWNativeErrorAction.js +14 -0
- package/lib/commonjs/models/FWNativeErrorAction.js.map +1 -0
- package/lib/commonjs/models/ReplayBadgeConfiguration.js +2 -0
- package/lib/commonjs/models/ReplayBadgeConfiguration.js.map +1 -0
- package/lib/commonjs/modules/FireworkSDKModule.js.map +1 -1
- package/lib/module/FireworkSDK.js +29 -25
- package/lib/module/FireworkSDK.js.map +1 -1
- package/lib/module/VideoShopping.js +6 -12
- package/lib/module/VideoShopping.js.map +1 -1
- package/lib/module/components/StoryBlock.js +53 -3
- package/lib/module/components/StoryBlock.js.map +1 -1
- package/lib/module/components/VideoFeed.js +42 -4
- package/lib/module/components/VideoFeed.js.map +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/models/FWNativeErrorAction.js +7 -0
- package/lib/module/models/FWNativeErrorAction.js.map +1 -0
- package/lib/module/models/ReplayBadgeConfiguration.js +2 -0
- package/lib/module/models/ReplayBadgeConfiguration.js.map +1 -0
- package/lib/module/modules/FireworkSDKModule.js.map +1 -1
- package/lib/typescript/VideoShopping.d.ts +2 -2
- package/lib/typescript/components/StoryBlock.d.ts +18 -1
- package/lib/typescript/components/VideoFeed.d.ts +7 -1
- package/lib/typescript/index.d.ts +2 -2
- package/lib/typescript/models/FWEvents.d.ts +26 -3
- package/lib/typescript/models/FWNativeErrorAction.d.ts +4 -0
- package/lib/typescript/models/FeedItemDetails.d.ts +6 -1
- package/lib/typescript/models/ReplayBadgeConfiguration.d.ts +7 -0
- package/lib/typescript/models/StoryBlockConfiguration.d.ts +6 -1
- package/lib/typescript/models/VideoFeedConfiguration.d.ts +6 -0
- package/lib/typescript/models/VideoPlayerConfiguration.d.ts +6 -1
- package/lib/typescript/modules/FireworkSDKModule.d.ts +1 -0
- package/package.json +1 -5
- package/react-native-firework-sdk.podspec +3 -5
- package/src/FireworkSDK.ts +27 -24
- package/src/VideoShopping.ts +9 -11
- package/src/components/StoryBlock.tsx +69 -7
- package/src/components/VideoFeed.tsx +57 -12
- package/src/index.ts +2 -0
- package/src/models/FWEvents.ts +28 -3
- package/src/models/FWNativeErrorAction.ts +4 -0
- package/src/models/FeedItemDetails.ts +7 -1
- package/src/models/ReplayBadgeConfiguration.ts +7 -0
- package/src/models/StoryBlockConfiguration.ts +6 -1
- package/src/models/VideoFeedConfiguration.ts +6 -0
- package/src/models/VideoPlayerConfiguration.ts +6 -1
- package/src/modules/FireworkSDKModule.ts +1 -0
- package/FireworkVideoUI.xcframework/Info.plist +0 -40
- package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/FireworkVideoUI +0 -0
- package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Headers/FireworkVideoUI-Swift.h +0 -280
- package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Headers/FireworkVideoUI.h +0 -18
- package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Info.plist +0 -0
- package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios.abi.json +0 -1313
- package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios.private.swiftinterface +0 -42
- package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
- package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios.swiftinterface +0 -42
- package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Modules/module.modulemap +0 -11
- package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/FireworkVideoUI +0 -0
- package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Headers/FireworkVideoUI-Swift.h +0 -556
- package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Headers/FireworkVideoUI.h +0 -18
- package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Info.plist +0 -0
- package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios-simulator.abi.json +0 -1313
- package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +0 -42
- package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
- package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios-simulator.swiftinterface +0 -42
- package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/x86_64-apple-ios-simulator.abi.json +0 -1313
- package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +0 -42
- package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
- package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +0 -42
- package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/module.modulemap +0 -11
- package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/_CodeSignature/CodeResources +0 -245
- package/ios/FireworkVideoUI/FireworkVideoUI/FireworkVideoUI.docc/FireworkVideoUI.md +0 -13
- package/ios/FireworkVideoUI/FireworkVideoUI/FireworkVideoUI.h +0 -18
- package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/AppLanguageManager.swift +0 -154
- package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/Foundation/Bundle+AppLanguage.swift +0 -73
- package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/Foundation/NumberFormatter+AppLanguage.swift +0 -25
- package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/Foundation/URLSession+AppLanguage.swift +0 -52
- package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/UIKit/UIImageView+AppLanguage.swift +0 -60
- package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/UIKit/UILabel+AppLanguage.swift +0 -98
- package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/UIKit/UITextField+AppLanguage.swift +0 -97
- package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/UIKit/UITextView+AppLanguage.swift +0 -97
- package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/UIKit/UIView+AppLanguage.swift +0 -71
- package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/UIKit/UIViewController+AppLanguage.swift +0 -48
- package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/UIKit/UIWindow+AppLanguage.swift +0 -26
- package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/LanguageUtil.swift +0 -43
- package/ios/FireworkVideoUI/FireworkVideoUI/Sources/LayoutFlip/Extensions/Foundation/NSObject+LayoutFlip.swift +0 -42
- package/ios/FireworkVideoUI/FireworkVideoUI/Sources/LayoutFlip/Extensions/UIKit/CALayer+LayoutFlip.swift +0 -149
- package/ios/FireworkVideoUI/FireworkVideoUI/Sources/LayoutFlip/Extensions/UIKit/UILabel+LayoutFlip.swift +0 -35
- package/ios/FireworkVideoUI/FireworkVideoUI/Sources/LayoutFlip/Extensions/UIKit/UIView+LayoutFlip.swift +0 -202
- package/ios/FireworkVideoUI/FireworkVideoUI/Sources/LayoutFlip/LayoutFlipManager.swift +0 -59
- package/ios/FireworkVideoUI/FireworkVideoUI/Sources/Utils/Extensions/Foundation/DispatchQueue+Once.swift +0 -32
- package/ios/FireworkVideoUI/FireworkVideoUI/Sources/Utils/Extensions/Foundation/String+Base64.swift +0 -18
- package/ios/FireworkVideoUI/FireworkVideoUI/Sources/Utils/Extensions/UIKit/UIView+UIHierarchy.swift +0 -46
- package/ios/FireworkVideoUI/FireworkVideoUI/Sources/Utils/Swizzle.swift +0 -37
- package/ios/FireworkVideoUI/FireworkVideoUI.xcodeproj/project.pbxproj +0 -766
- package/ios/FireworkVideoUI/FireworkVideoUI.xcworkspace/contents.xcworkspacedata +0 -10
- package/ios/FireworkVideoUI/FireworkVideoUI.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
- package/ios/FireworkVideoUI/FireworkVideoUITests/FireworkVideoUITests.swift +0 -37
- package/ios/FireworkVideoUI/Podfile +0 -15
- package/ios/FireworkVideoUI/Podfile.lock +0 -16
- package/ios/scripts/react_native_firework_sdk_pods.rb +0 -27
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
// Created by Jeff Zheng on 2021/12/30.
|
|
6
6
|
//
|
|
7
7
|
|
|
8
|
-
// swiftlint:disable file_length
|
|
8
|
+
// swiftlint:disable file_length
|
|
9
9
|
import FireworkVideo
|
|
10
10
|
import Foundation
|
|
11
11
|
|
|
@@ -75,55 +75,16 @@ class ShoppingModule: RCTEventEmitter, FireworkVideoShoppingDelegate {
|
|
|
75
75
|
|
|
76
76
|
@objc
|
|
77
77
|
func updateVideoProducts(_ products: [AnyObject]?, cbId: NSNumber) {
|
|
78
|
-
#if DEBUG
|
|
79
|
-
let formatter = DateFormatter()
|
|
80
|
-
formatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSZ"
|
|
81
|
-
let message1 = "[iOS] Call updateVideoProducts 1 \(formatter.string(from: Date()))"
|
|
82
|
-
print("[react-native-firework-sdk] [swift] \(message1)")
|
|
83
|
-
|
|
84
|
-
sendEvent(
|
|
85
|
-
withName: FWEventName.logMessage.rawValue,
|
|
86
|
-
body: [
|
|
87
|
-
"message": message1
|
|
88
|
-
])
|
|
89
|
-
#endif
|
|
90
|
-
|
|
91
78
|
guard let productHydrating = productHydratingMap[Int(truncating: cbId)] else {
|
|
92
79
|
return
|
|
93
80
|
}
|
|
94
81
|
|
|
95
82
|
productHydratingMap.removeValue(forKey: Int(truncating: cbId))
|
|
96
83
|
|
|
97
|
-
#if DEBUG
|
|
98
|
-
let message2 = "[iOS] Call updateVideoProducts 2 \(formatter.string(from: Date()))"
|
|
99
|
-
print("[react-native-firework-sdk] [swift] \(message2)")
|
|
100
|
-
|
|
101
|
-
sendEvent(
|
|
102
|
-
withName: FWEventName.logMessage.rawValue,
|
|
103
|
-
body: [
|
|
104
|
-
"message": message2
|
|
105
|
-
])
|
|
106
|
-
#endif
|
|
107
|
-
|
|
108
84
|
guard let rProducts = RCTConvert.buildProducts(products) else {
|
|
109
85
|
return
|
|
110
86
|
}
|
|
111
87
|
|
|
112
|
-
#if DEBUG
|
|
113
|
-
let productIds = rProducts.map({ product in
|
|
114
|
-
return product.productId
|
|
115
|
-
}).joined(separator: ",")
|
|
116
|
-
let message3 =
|
|
117
|
-
"[iOS] Call updateVideoProducts 3 productIds: \(productIds) \(formatter.string(from: Date()))"
|
|
118
|
-
print("[react-native-firework-sdk] [swift] \(message3)")
|
|
119
|
-
|
|
120
|
-
sendEvent(
|
|
121
|
-
withName: FWEventName.logMessage.rawValue,
|
|
122
|
-
body: [
|
|
123
|
-
"message": message3
|
|
124
|
-
])
|
|
125
|
-
#endif
|
|
126
|
-
|
|
127
88
|
for product in rProducts {
|
|
128
89
|
productHydrating.hydrateProduct(
|
|
129
90
|
product.productId, { build in
|
|
@@ -188,10 +149,6 @@ class ShoppingModule: RCTEventEmitter, FireworkVideoShoppingDelegate {
|
|
|
188
149
|
return
|
|
189
150
|
}
|
|
190
151
|
|
|
191
|
-
#if DEBUG
|
|
192
|
-
print("ctaResult res \(String(describing: ctaResult.res))")
|
|
193
|
-
#endif
|
|
194
|
-
|
|
195
152
|
guard let handler = shoppingCTAHandlerMap[Int(truncating: cbId)] else {
|
|
196
153
|
return
|
|
197
154
|
}
|
|
@@ -244,19 +201,6 @@ class ShoppingModule: RCTEventEmitter, FireworkVideoShoppingDelegate {
|
|
|
244
201
|
if let productInfoViewConfiguration = productInfoViewConfiguration {
|
|
245
202
|
ShoppingModule.hydrateProductViewConfig(productInfoViewConfiguration, productInfoViewConfigurator)
|
|
246
203
|
}
|
|
247
|
-
|
|
248
|
-
#if DEBUG
|
|
249
|
-
let formatter = DateFormatter()
|
|
250
|
-
formatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSZ"
|
|
251
|
-
|
|
252
|
-
let message =
|
|
253
|
-
"[iOS] Send WillDisplayProduct event videoId: \(video.videoID) \(formatter.string(from: Date()))"
|
|
254
|
-
print("[react-native-firework-sdk] [swift] \(message)")
|
|
255
|
-
|
|
256
|
-
sendEvent(
|
|
257
|
-
withName: FWEventName.logMessage.rawValue,
|
|
258
|
-
body: ["message": message])
|
|
259
|
-
#endif
|
|
260
204
|
}
|
|
261
205
|
|
|
262
206
|
func fireworkShopping(
|
|
@@ -266,24 +210,13 @@ class ShoppingModule: RCTEventEmitter, FireworkVideoShoppingDelegate {
|
|
|
266
210
|
let callbackId = ShoppingModule.generateCallbackId()
|
|
267
211
|
self.productHydratingMap[callbackId] = productHydrator
|
|
268
212
|
|
|
269
|
-
#if DEBUG
|
|
270
|
-
let formatter = DateFormatter()
|
|
271
|
-
formatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSZ"
|
|
272
|
-
|
|
273
|
-
let message = """
|
|
274
|
-
"[iOS] Send UpdateProductDetails event productIds: \(products) and \
|
|
275
|
-
videoId: \(video.videoID) \(formatter.string(from: Date()))
|
|
276
|
-
"""
|
|
277
|
-
print("[react-native-firework-sdk] [swift] \(message)")
|
|
278
|
-
|
|
279
|
-
sendEvent(
|
|
280
|
-
withName: FWEventName.logMessage.rawValue,
|
|
281
|
-
body: ["message": message])
|
|
282
|
-
#endif
|
|
283
|
-
|
|
284
213
|
sendEvent(
|
|
285
214
|
withName: ShoppingEventName.updateProductDetails.rawValue,
|
|
286
|
-
body: [
|
|
215
|
+
body: [
|
|
216
|
+
"productIds": products,
|
|
217
|
+
"callbackId": callbackId,
|
|
218
|
+
"video": video.jsObject
|
|
219
|
+
])
|
|
287
220
|
}
|
|
288
221
|
|
|
289
222
|
func fireworkShopping(
|
|
@@ -296,6 +229,7 @@ class ShoppingModule: RCTEventEmitter, FireworkVideoShoppingDelegate {
|
|
|
296
229
|
self.shoppingCTAHandlerMap[callbackId] = ctaCompletionHandler
|
|
297
230
|
var body = item.jsObject
|
|
298
231
|
body["callbackId"] = callbackId
|
|
232
|
+
body["video"] = video.jsObject
|
|
299
233
|
sendEvent(
|
|
300
234
|
withName: ShoppingEventName.ctaButtonClick.rawValue,
|
|
301
235
|
body: body)
|
|
@@ -319,7 +253,9 @@ class ShoppingModule: RCTEventEmitter, FireworkVideoShoppingDelegate {
|
|
|
319
253
|
didTapCartIconForVideo videoDetails: VideoDetails
|
|
320
254
|
) {
|
|
321
255
|
sendEvent(
|
|
322
|
-
withName: ShoppingEventName.clickCartIcon.rawValue, body: [
|
|
256
|
+
withName: ShoppingEventName.clickCartIcon.rawValue, body: [
|
|
257
|
+
"video": videoDetails.jsObject
|
|
258
|
+
])
|
|
323
259
|
}
|
|
324
260
|
|
|
325
261
|
func fireworkShopping(
|
|
@@ -208,8 +208,8 @@ class FireworkSDK {
|
|
|
208
208
|
this.eventEmitter.addListener(_FWEventName.FWEventName.SDKInit, event => {
|
|
209
209
|
_FWLoggerUtil.default.log(`Receive SDKInit event ${event === null || event === void 0 ? void 0 : event.error}`);
|
|
210
210
|
|
|
211
|
-
if (this.onSDKInit) {
|
|
212
|
-
this.onSDKInit(event
|
|
211
|
+
if (this.onSDKInit && event) {
|
|
212
|
+
this.onSDKInit(event);
|
|
213
213
|
}
|
|
214
214
|
});
|
|
215
215
|
this.eventEmitter.addListener(_FWEventName.FWEventName.LogMessage, event => {
|
|
@@ -220,36 +220,34 @@ class FireworkSDK {
|
|
|
220
220
|
|
|
221
221
|
_FWLoggerUtil.default.log(`Receive CustomCTAClick callbackId: ${event === null || event === void 0 ? void 0 : event.callbackId}`);
|
|
222
222
|
|
|
223
|
-
if (this.onCustomCTAClick) {
|
|
224
|
-
if (event) {
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
};
|
|
234
|
-
}
|
|
223
|
+
if (this.onCustomCTAClick && event) {
|
|
224
|
+
if (event.callbackId) {
|
|
225
|
+
const callbackId = event.callbackId;
|
|
226
|
+
delete event.callbackId;
|
|
227
|
+
|
|
228
|
+
if (_reactNative.Platform.OS === 'ios') {
|
|
229
|
+
event.playerHandler = {
|
|
230
|
+
pause: () => _FireworkSDKModule.default.pausePlayer(callbackId),
|
|
231
|
+
resume: () => _FireworkSDKModule.default.resumePlayer(callbackId)
|
|
232
|
+
};
|
|
235
233
|
}
|
|
236
234
|
}
|
|
237
235
|
|
|
238
|
-
this.onCustomCTAClick(event
|
|
236
|
+
this.onCustomCTAClick(event);
|
|
239
237
|
}
|
|
240
238
|
});
|
|
241
239
|
this.eventEmitter.addListener(_FWEventName.FWEventName.VideoPlayback, event => {
|
|
242
240
|
_FWLoggerUtil.default.log(`Receive VideoPlayback event eventName: ${event === null || event === void 0 ? void 0 : event.eventName}`);
|
|
243
241
|
|
|
244
|
-
if (this.onVideoPlayback) {
|
|
245
|
-
this.onVideoPlayback(event
|
|
242
|
+
if (this.onVideoPlayback && event) {
|
|
243
|
+
this.onVideoPlayback(event);
|
|
246
244
|
}
|
|
247
245
|
});
|
|
248
246
|
this.eventEmitter.addListener(_FWEventName.FWEventName.VideoFeedClick, event => {
|
|
249
247
|
_FWLoggerUtil.default.log(`Receive VideoFeedClick event id: ${event === null || event === void 0 ? void 0 : event.info.id}`);
|
|
250
248
|
|
|
251
|
-
if (this.onVideoFeedClick) {
|
|
252
|
-
this.onVideoFeedClick(event
|
|
249
|
+
if (this.onVideoFeedClick && event) {
|
|
250
|
+
this.onVideoFeedClick(event);
|
|
253
251
|
}
|
|
254
252
|
});
|
|
255
253
|
|
|
@@ -290,6 +288,15 @@ class FireworkSDK {
|
|
|
290
288
|
|
|
291
289
|
|
|
292
290
|
async markInitCalled() {
|
|
291
|
+
_FWLoggerUtil.default.log('Call FireworkSDK markInitCalled method');
|
|
292
|
+
|
|
293
|
+
const hasCalledSDKInitFromNative = await _FireworkSDKModule.default.markInitCalled();
|
|
294
|
+
|
|
295
|
+
if (hasCalledSDKInitFromNative) {
|
|
296
|
+
await _ShoppingModule.default.init();
|
|
297
|
+
await _LiveStreamModule.default.init();
|
|
298
|
+
}
|
|
299
|
+
|
|
293
300
|
_FWGlobalState.default.getInstance().resolveSdkInitCalled();
|
|
294
301
|
}
|
|
295
302
|
/**
|
|
@@ -313,13 +320,11 @@ class FireworkSDK {
|
|
|
313
320
|
|
|
314
321
|
|
|
315
322
|
async trackPurchase(parameters) {
|
|
316
|
-
if (
|
|
317
|
-
|
|
318
|
-
await _FWGlobalState.default.getInstance().sdkInitCalledPromise;
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
_FireworkSDKModule.default.trackPurchase(parameters);
|
|
323
|
+
if (!_FWGlobalState.default.getInstance().sdkInitCalled) {
|
|
324
|
+
await _FWGlobalState.default.getInstance().sdkInitCalledPromise;
|
|
322
325
|
}
|
|
326
|
+
|
|
327
|
+
_FireworkSDKModule.default.trackPurchase(parameters);
|
|
323
328
|
}
|
|
324
329
|
/**
|
|
325
330
|
* Change App level language.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["FireworkSDK.ts"],"names":["FireworkSDK","onVideoFeedClick","_onVideoFeedClick","value","Platform","OS","FireworkSDKModule","setVideoFeedClickCallbackEnabled","onCustomCTAClick","_onCustomCTAClick","FWLoggerUtil","log","setCustomCTAClickEnabled","onVideoPlayback","_onVideoPlayback","setVideoPlaybackEventEnabled","shareBaseURL","_shareBaseURL","updateInternalShareBaseURL","setShareBaseURL","adBadgeConfiguration","_adBadgeConfiguration","valueHasChanged","badgeTextType","backgroundColor","textColor","androidFontInfo","isCustom","typefaceName","eventEmitter","emit","FWEventName","AdBadgeConfigurationUpdated","setAdBadgeConfiguration","appLanguage","_appLanguage","debugLogsEnabled","enabled","videoLaunchBehavior","_videoLaunchBehavior","FireworkSDKModuleEventEmitter","shopping","_shopping","liveStream","_liveStream","navigator","_navigator","getInstance","_instance","constructor","VideoShopping","LiveStream","FWNavigator","addListener","SDKInit","event","error","onSDKInit","LogMessage","logNativeMessage","message","CustomCTAClick","url","callbackId","playerHandler","pause","pausePlayer","resume","resumePlayer","VideoPlayback","eventName","VideoFeedClick","info","id","NativeAppLanguageUpdated","language","updateInternalAppLanguage","init","options","videoLaunchBehaviorUpdated","VideoLaunchBehaviorUpdated","ShoppingModule","LiveStreamModule","FWGlobalState","resolveSdkInitCalled","markInitCalled","openVideoPlayer","config","sdkInitCalled","sdkInitCalledPromise","trackPurchase","parameters","changeAppLanguage","result","languageChanged","stopFloatingPlayer","AppLanguageUpdated","shareBaseURLChanged","ShareBaseURLUpdated"],"mappings":";;;;;;;AAAA;;AAEA;;AACA;;AAEA;;AAUA;;AAGA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;AAcA;AACA;AACA;AACA,MAAMA,WAAN,CAAkB;AAGhB;AACF;AACA;;AAGE;AACF;AACA;AAC6B,MAAhBC,gBAAgB,GAAuC;AAChE,WAAO,KAAKC,iBAAZ;AACD;;AAC0B,MAAhBD,gBAAgB,CAACE,KAAD,EAA4C;AACrE,SAAKD,iBAAL,GAAyBC,KAAzB;;AACA,QAAIC,sBAASC,EAAT,KAAgB,KAApB,EAA2B;AACzBC,iCAAkBC,gCAAlB,CAAmD,CAAC,CAACJ,KAArD;AACD;AACF;;AAGD;AACF;AACA;AAC6B,MAAhBK,gBAAgB,GAAuC;AAChE,WAAO,KAAKC,iBAAZ;AACD;;AAC0B,MAAhBD,gBAAgB,CAACL,KAAD,EAA4C;AACrEO,0BAAaC,GAAb,CAAkB,iCAAgC,CAAC,CAACR,KAAM,EAA1D;;AACA,SAAKM,iBAAL,GAAyBN,KAAzB;;AACAG,+BAAkBM,wBAAlB,CAA2CT,KAAK,GAAG,IAAH,GAAU,KAA1D;AACD;;AAGD;AACF;AACA;AAC4B,MAAfU,eAAe,GAAsC;AAC9D,WAAO,KAAKC,gBAAZ;AACD;;AACyB,MAAfD,eAAe,CAACV,KAAD,EAA2C;AACnE,SAAKW,gBAAL,GAAwBX,KAAxB;;AACAG,+BAAkBS,4BAAlB,CAA+CZ,KAAK,GAAG,IAAH,GAAU,KAA9D;AACD;;AAGD;AACF;AACA;AACA;AACyB,MAAZa,YAAY,GAAuB;AAC5C,WAAO,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AOkB,MAAP;AACD;;AAEOjB,EAAAA,yBAAyB,CAACD,QAAD,EAA2B;AAC1D,UAAMrD,eAAe,GAAG,KAAKa,YAAL,KAAsBwC,QAA9C;AACA,SAAKxC,YAAL,GAAoBwC,QAApB;;AACA,QAAIrD,eAAJ,EAAqB;AACnB,WAAKO,YAAL,CAAkBC,IAAlB,CAAuBC,yBAAYiE,kBAAnC;AACD;AACF;;AAEO9E,EAAAA,0BAA0B,CAACF,YAAD,EAAwB;AACxD,UAAMiF,mBAAmB,GAAG,KAAKhF,aAAL,KAAuBD,YAAnD;AACA,SAAKC,aAAL,GAAqBD,YAArB;;AACA,QAAIiF,mBAAJ,EAAyB;AACvB,WAAKpE,YAAL,CAAkBC,IAAlB,CAAuBC,yBAAYmE,mBAAnC;AACD;AACF;;AAtTe;;gBAAZlG,W;;eAyTSA,W","sourcesContent":["import { NativeEventEmitter, Platform } from 'react-native';\n\nimport FWNavigator from './FWNavigator';\nimport LiveStream from './LiveStream';\nimport type AdBadgeConfiguration from './models/AdBadgeConfiguration';\nimport { FWEventName } from './models/FWEventName';\nimport type {\n CustomCTAClickEvent,\n SDKInitEvent,\n VideoFeedClickEvent,\n VideoPlaybackEvent,\n} from './models/FWEvents';\nimport type SDKInitOptions from './models/SDKInitOptions';\nimport type { VideoLaunchBehavior } from './models/SDKInitOptions';\nimport type TrackPurchaseParameters from './models/TrackPurchaseParameters';\nimport FireworkSDKModule, {\n FireworkSDKModuleEventEmitter,\n} from './modules/FireworkSDKModule';\nimport LiveStreamModule from './modules/LiveStreamModule';\nimport ShoppingModule from './modules/ShoppingModule';\nimport FWLoggerUtil from './utils/FWLoggerUtil';\nimport VideoShopping from './VideoShopping';\nimport FWGlobalState from './utils/FWGlobalState';\nimport type OpenVideoPlayerConfiguration from './models/OpenVideoPlayerConfiguration';\n\nexport type SDKInitCallback = (event: SDKInitEvent) => Promise<void> | void;\nexport type CustomCTAClickCallback = (\n event: CustomCTAClickEvent\n) => Promise<void> | void;\nexport type VideoPlaybackCallback = (\n event: VideoPlaybackEvent\n) => Promise<void> | void;\nexport type VideoFeedClickCallback = (\n event: VideoFeedClickEvent\n) => Promise<void> | void;\n\n/**\n * Firework SDK.\n */\nclass FireworkSDK {\n private static _instance?: FireworkSDK;\n\n /**\n * The callback of SDK initialization.\n */\n public onSDKInit?: SDKInitCallback;\n\n /**\n * the callback of clicking Video Feed.\n */\n public get onVideoFeedClick(): VideoFeedClickCallback | undefined {\n return this._onVideoFeedClick;\n }\n public set onVideoFeedClick(value: VideoFeedClickCallback | undefined) {\n this._onVideoFeedClick = value;\n if (Platform.OS === 'ios') {\n FireworkSDKModule.setVideoFeedClickCallbackEnabled(!!value);\n }\n }\n private _onVideoFeedClick?: VideoFeedClickCallback | undefined;\n\n /**\n * The callback of clicking custom CTA.\n */\n public get onCustomCTAClick(): CustomCTAClickCallback | undefined {\n return this._onCustomCTAClick;\n }\n public set onCustomCTAClick(value: CustomCTAClickCallback | undefined) {\n FWLoggerUtil.log(`Set onCustomCTAClick callback ${!!value}`);\n this._onCustomCTAClick = value;\n FireworkSDKModule.setCustomCTAClickEnabled(value ? true : false);\n }\n private _onCustomCTAClick: CustomCTAClickCallback | undefined;\n\n /**\n * The callback of video playback.\n */\n public get onVideoPlayback(): VideoPlaybackCallback | undefined {\n return this._onVideoPlayback;\n }\n public set onVideoPlayback(value: VideoPlaybackCallback | undefined) {\n this._onVideoPlayback = value;\n FireworkSDKModule.setVideoPlaybackEventEnabled(value ? true : false);\n }\n private _onVideoPlayback?: VideoPlaybackCallback | undefined;\n\n /**\n * The global share base URL of the video.\n * The {@link VideoPlayerConfiguration.shareBaseURL} in {@link VideoPlayerConfiguration} will override this.\n */\n public get shareBaseURL(): string | undefined {\n return this._shareBaseURL;\n }\n public set shareBaseURL(value: string | undefined) {\n this.updateInternalShareBaseURL(value);\n FireworkSDKModule.setShareBaseURL(value ?? '');\n }\n private _shareBaseURL: string | undefined;\n\n /**\n * The configuration for ad badges.\n */\n public get adBadgeConfiguration(): AdBadgeConfiguration | undefined {\n return this._adBadgeConfiguration;\n }\n public set adBadgeConfiguration(value: AdBadgeConfiguration | undefined) {\n const valueHasChanged =\n this._adBadgeConfiguration?.badgeTextType !== value?.badgeTextType ||\n this._adBadgeConfiguration?.backgroundColor !== value?.backgroundColor ||\n this._adBadgeConfiguration?.textColor !== value?.textColor ||\n this._adBadgeConfiguration?.androidFontInfo?.isCustom !==\n value?.androidFontInfo?.isCustom ||\n this._adBadgeConfiguration?.androidFontInfo?.typefaceName !==\n value?.androidFontInfo?.typefaceName;\n this._adBadgeConfiguration = value;\n if (valueHasChanged) {\n this.eventEmitter.emit(FWEventName.AdBadgeConfigurationUpdated);\n }\n FireworkSDKModule.setAdBadgeConfiguration(value ?? {});\n }\n private _adBadgeConfiguration: AdBadgeConfiguration | undefined;\n\n public get appLanguage(): string | undefined | null {\n return this._appLanguage;\n }\n private _appLanguage: string | undefined | null;\n\n /**\n * Defaults to false.\n * You can enable debug logs by setting this property to true.\n */\n public get debugLogsEnabled(): boolean {\n return FWLoggerUtil.enabled;\n }\n public set debugLogsEnabled(value: boolean) {\n FWLoggerUtil.enabled = value;\n }\n\n /**\n * Get video launch behavior.\n */\n public get videoLaunchBehavior(): VideoLaunchBehavior | undefined {\n return this._videoLaunchBehavior;\n }\n private _videoLaunchBehavior: VideoLaunchBehavior | undefined;\n\n private get eventEmitter(): NativeEventEmitter {\n return FireworkSDKModuleEventEmitter;\n }\n\n /**\n * Get VideoShopping object.\n */\n public get shopping(): VideoShopping {\n return this._shopping;\n }\n private _shopping: VideoShopping = VideoShopping.getInstance();\n\n /**\n * Get LiveStream object.\n */\n public get liveStream(): LiveStream {\n return this._liveStream;\n }\n private _liveStream: LiveStream = LiveStream.getInstance();\n\n /**\n * Get FWNavigator object.\n */\n public get navigator(): FWNavigator {\n return this._navigator;\n }\n private _navigator: FWNavigator = FWNavigator.getInstance();\n\n /**\n * Get global single instance of FireworkSDK class.\n * @returns FireworkSDK\n */\n public static getInstance() {\n if (!FireworkSDK._instance) {\n FireworkSDK._instance = new FireworkSDK();\n }\n\n return FireworkSDK._instance!;\n }\n\n private constructor() {\n FWLoggerUtil.log('FireworkSDK constructor');\n\n this.eventEmitter.addListener(FWEventName.SDKInit, (event) => {\n FWLoggerUtil.log(`Receive SDKInit event ${event?.error}`);\n\n if (this.onSDKInit) {\n this.onSDKInit(event ?? {});\n }\n });\n\n this.eventEmitter.addListener(FWEventName.LogMessage, (event) => {\n FWLoggerUtil.logNativeMessage(event.message);\n });\n\n this.eventEmitter.addListener(FWEventName.CustomCTAClick, (event) => {\n FWLoggerUtil.log(`Receive CustomCTAClick url: ${event?.url}`);\n FWLoggerUtil.log(\n `Receive CustomCTAClick callbackId: ${event?.callbackId}`\n );\n\n if (this.onCustomCTAClick) {\n if (event) {\n if (event.callbackId) {\n const callbackId = event.callbackId;\n delete event.callbackId;\n if (Platform.OS === 'ios') {\n event.playerHandler = {\n pause: () => FireworkSDKModule.pausePlayer(callbackId),\n resume: () => FireworkSDKModule.resumePlayer(callbackId),\n };\n }\n }\n }\n\n this.onCustomCTAClick(event ?? {});\n }\n });\n\n this.eventEmitter.addListener(FWEventName.VideoPlayback, (event) => {\n FWLoggerUtil.log(\n `Receive VideoPlayback event eventName: ${event?.eventName}`\n );\n\n if (this.onVideoPlayback) {\n this.onVideoPlayback(event ?? {});\n }\n });\n\n this.eventEmitter.addListener(FWEventName.VideoFeedClick, (event) => {\n FWLoggerUtil.log(`Receive VideoFeedClick event id: ${event?.info.id}`);\n\n if (this.onVideoFeedClick) {\n this.onVideoFeedClick(event ?? {});\n }\n });\n\n if (Platform.OS === 'ios') {\n this.eventEmitter.addListener(\n FWEventName.NativeAppLanguageUpdated,\n (event) => {\n FWLoggerUtil.log(\n `Receive NativeAppLanguageUpdated event appLanguage: ${event.appLanguage}`\n );\n const language = event.appLanguage;\n this.updateInternalAppLanguage(language);\n }\n );\n }\n }\n\n /**\n * Initializes Firework SDK.\n * @param {SDKInitOptions?} options\n */\n public async init(options?: SDKInitOptions): Promise<void> {\n FWLoggerUtil.log('Call FireworkSDK init method');\n const videoLaunchBehaviorUpdated =\n this._videoLaunchBehavior !== options?.videoLaunchBehavior;\n this._videoLaunchBehavior = options?.videoLaunchBehavior;\n if (videoLaunchBehaviorUpdated) {\n this.eventEmitter.emit(FWEventName.VideoLaunchBehaviorUpdated);\n }\n await FireworkSDKModule.init(options);\n await ShoppingModule.init();\n await LiveStreamModule.init();\n\n FWGlobalState.getInstance().resolveSdkInitCalled();\n }\n\n /**\n * You only need to call this method when you call init method in native side instead of JS side.\n */\n public async markInitCalled(): Promise<void> {\n FWGlobalState.getInstance().resolveSdkInitCalled();\n }\n\n /**\n * Open Video URL.\n * @param {string} url\n * @param {VideoPlayerConfiguration} config\n */\n public async openVideoPlayer(\n url: string,\n config?: OpenVideoPlayerConfiguration\n ): Promise<void> {\n if (!FWGlobalState.getInstance().sdkInitCalled) {\n await FWGlobalState.getInstance().sdkInitCalledPromise;\n }\n FireworkSDKModule.openVideoPlayer(url, config ?? {});\n }\n\n /**\n * Records the user purchase. Only supported on iOS.\n * @param {TrackPurchaseParameters} parameters\n */\n public async trackPurchase(\n parameters: TrackPurchaseParameters\n ): Promise<void> {\n if (Platform.OS === 'ios') {\n if (!FWGlobalState.getInstance().sdkInitCalled) {\n await FWGlobalState.getInstance().sdkInitCalledPromise;\n }\n FireworkSDKModule.trackPurchase(parameters);\n }\n }\n\n /**\n * Change App level language.\n * @param {string | undefined | null} language Such as en, ar and en-US. If language is undefined or null or empty string, SDK will use system language.\n * @returns {Promise<boolean>} The result of changing app language.\n */\n public async changeAppLanguage(language?: string | null): Promise<boolean> {\n if (!FWGlobalState.getInstance().sdkInitCalled) {\n await FWGlobalState.getInstance().sdkInitCalledPromise;\n }\n\n const result = await FireworkSDKModule.changeAppLanguage(language);\n\n if (result) {\n const languageChanged = this._appLanguage !== language;\n if (Platform.OS === 'ios' && languageChanged) {\n await this.navigator.stopFloatingPlayer();\n }\n this.updateInternalAppLanguage(language);\n }\n return result;\n }\n\n private updateInternalAppLanguage(language?: string | null) {\n const valueHasChanged = this._appLanguage !== language;\n this._appLanguage = language;\n if (valueHasChanged) {\n this.eventEmitter.emit(FWEventName.AppLanguageUpdated);\n }\n }\n\n private updateInternalShareBaseURL(shareBaseURL?: string) {\n const shareBaseURLChanged = this._shareBaseURL !== shareBaseURL;\n this._shareBaseURL = shareBaseURL;\n if (shareBaseURLChanged) {\n this.eventEmitter.emit(FWEventName.ShareBaseURLUpdated);\n }\n }\n}\n\nexport default FireworkSDK;\n"]}
|
|
1
|
+
{"version":3,"sources":["FireworkSDK.ts"],"names":["FireworkSDK","onVideoFeedClick","_onVideoFeedClick","value","Platform","OS","FireworkSDKModule","setVideoFeedClickCallbackEnabled","onCustomCTAClick","_onCustomCTAClick","FWLoggerUtil","log","setCustomCTAClickEnabled","onVideoPlayback","_onVideoPlayback","setVideoPlaybackEventEnabled","shareBaseURL","_shareBaseURL","updateInternalShareBaseURL","setShareBaseURL","adBadgeConfiguration","_adBadgeConfiguration","valueHasChanged","badgeTextType","backgroundColor","textColor","androidFontInfo","isCustom","typefaceName","eventEmitter","emit","FWEventName","AdBadgeConfigurationUpdated","setAdBadgeConfiguration","appLanguage","_appLanguage","debugLogsEnabled","enabled","videoLaunchBehavior","_videoLaunchBehavior","FireworkSDKModuleEventEmitter","shopping","_shopping","liveStream","_liveStream","navigator","_navigator","getInstance","_instance","constructor","VideoShopping","LiveStream","FWNavigator","addListener","SDKInit","event","error","onSDKInit","LogMessage","logNativeMessage","message","CustomCTAClick","url","callbackId","playerHandler","pause","pausePlayer","resume","resumePlayer","VideoPlayback","eventName","VideoFeedClick","info","id","NativeAppLanguageUpdated","language","updateInternalAppLanguage","init","options","videoLaunchBehaviorUpdated","VideoLaunchBehaviorUpdated","ShoppingModule","LiveStreamModule","FWGlobalState","resolveSdkInitCalled","markInitCalled","hasCalledSDKInitFromNative","openVideoPlayer","config","sdkInitCalled","sdkInitCalledPromise","trackPurchase","parameters","changeAppLanguage","result","languageChanged","stopFloatingPlayer","AppLanguageUpdated","shareBaseURLChanged","ShareBaseURLUpdated"],"mappings":";;;;;;;AAAA;;AAEA;;AACA;;AAEA;;AAUA;;AAGA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;AAcA;AACA;AACA;AACA,MAAMA,WAAN,CAAkB;AAGhB;AACF;AACA;;AAGE;AACF;AACA;AAC6B,MAAhBC,gBAAgB,GAAuC;AAChE,WAAO,KAAKC,iBAAZ;AACD;;AAC0B,MAAhBD,gBAAgB,CAACE,KAAD,EAA4C;AACrE,SAAKD,iBAAL,GAAyBC,KAAzB;;AACA,QAAIC,sBAASC,EAAT,KAAgB,KAApB,EAA2B;AACzBC,iCAAkBC,gCAAlB,CAAmD,CAAC,CAACJ,KAArD;AACD;AACF;;AAGD;AACF;AACA;AAC6B,MAAhBK,gBAAgB,GAAuC;AAChE,WAAO,KAAKC,iBAAZ;AACD;;AAC0B,MAAhBD,gBAAgB,CAACL,KAAD,EAA4C;AACrEO,0BAAaC,GAAb,CAAkB,iCAAgC,CAAC,CAACR,KAAM,EAA1D;;AACA,SAAKM,iBAAL,GAAyBN,KAAzB;;AACAG,+BAAkBM,wBAAlB,CAA2CT,KAAK,GAAG,IAAH,GAAU,KAA1D;AACD;;AAGD;AACF;AACA;AAC4B,MAAfU,eAAe,GAAsC;AAC9D,WAAO,KAAKC,gBAAZ;AACD;;AACyB,MAAfD,eAAe,CAACV,KAAD,EAA2C;AACnE,SAAKW,gBAAL,GAAwBX,KAAxB;;AACAG,+BAAkBS,4BAAlB,CAA+CZ,KAAK,GAAG,IAAH,GAAU,KAA9D;AACD;;AAGD;AACF;AACA;AACA;AACyB,MAAZa,YAAY,GAAuB;AAC5C,WAAO,KAAKC,aAAZ;AACD;;AACsB,MAAZD,YAAY,CAACb,KAAD,EAA4B;AACjD,SAAKe,0BAAL,CAAgCf,KAAhC;;AACAG,+BAAkBa,eAAlB,CAAkChB,KAAlC,aAAkCA,KAAlC,cAAkCA,K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QAApB;;AACA,QAAIrD,eAAJ,EAAqB;AACnB,WAAKO,YAAL,CAAkBC,IAAlB,CAAuBC,yBAAYkE,kBAAnC;AACD;AACF;;AAEO/E,EAAAA,0BAA0B,CAACF,YAAD,EAAwB;AACxD,UAAMkF,mBAAmB,GAAG,KAAKjF,aAAL,KAAuBD,YAAnD;AACA,SAAKC,aAAL,GAAqBD,YAArB;;AACA,QAAIkF,mBAAJ,EAAyB;AACvB,WAAKrE,YAAL,CAAkBC,IAAlB,CAAuBC,yBAAYoE,mBAAnC;AACD;AACF;;AAzTe;;gBAAZnG,W;;eA4TSA,W","sourcesContent":["import { NativeEventEmitter, Platform } from 'react-native';\n\nimport FWNavigator from './FWNavigator';\nimport LiveStream from './LiveStream';\nimport type AdBadgeConfiguration from './models/AdBadgeConfiguration';\nimport { FWEventName } from './models/FWEventName';\nimport type {\n CustomCTAClickEvent,\n SDKInitEvent,\n VideoFeedClickEvent,\n VideoPlaybackEvent,\n} from './models/FWEvents';\nimport type SDKInitOptions from './models/SDKInitOptions';\nimport type { VideoLaunchBehavior } from './models/SDKInitOptions';\nimport type TrackPurchaseParameters from './models/TrackPurchaseParameters';\nimport FireworkSDKModule, {\n FireworkSDKModuleEventEmitter,\n} from './modules/FireworkSDKModule';\nimport LiveStreamModule from './modules/LiveStreamModule';\nimport ShoppingModule from './modules/ShoppingModule';\nimport FWLoggerUtil from './utils/FWLoggerUtil';\nimport VideoShopping from './VideoShopping';\nimport FWGlobalState from './utils/FWGlobalState';\nimport type OpenVideoPlayerConfiguration from './models/OpenVideoPlayerConfiguration';\n\nexport type SDKInitCallback = (event: SDKInitEvent) => Promise<void> | void;\nexport type CustomCTAClickCallback = (\n event: CustomCTAClickEvent\n) => Promise<void> | void;\nexport type VideoPlaybackCallback = (\n event: VideoPlaybackEvent\n) => Promise<void> | void;\nexport type VideoFeedClickCallback = (\n event: VideoFeedClickEvent\n) => Promise<void> | void;\n\n/**\n * Firework SDK.\n */\nclass FireworkSDK {\n private static _instance?: FireworkSDK;\n\n /**\n * The callback of SDK initialization.\n */\n public onSDKInit?: SDKInitCallback;\n\n /**\n * the callback of clicking Video Feed.\n */\n public get onVideoFeedClick(): VideoFeedClickCallback | undefined {\n return this._onVideoFeedClick;\n }\n public set onVideoFeedClick(value: VideoFeedClickCallback | undefined) {\n this._onVideoFeedClick = value;\n if (Platform.OS === 'ios') {\n FireworkSDKModule.setVideoFeedClickCallbackEnabled(!!value);\n }\n }\n private _onVideoFeedClick?: VideoFeedClickCallback | undefined;\n\n /**\n * The callback of clicking custom CTA.\n */\n public get onCustomCTAClick(): CustomCTAClickCallback | undefined {\n return this._onCustomCTAClick;\n }\n public set onCustomCTAClick(value: CustomCTAClickCallback | undefined) {\n FWLoggerUtil.log(`Set onCustomCTAClick callback ${!!value}`);\n this._onCustomCTAClick = value;\n FireworkSDKModule.setCustomCTAClickEnabled(value ? true : false);\n }\n private _onCustomCTAClick: CustomCTAClickCallback | undefined;\n\n /**\n * The callback of video playback.\n */\n public get onVideoPlayback(): VideoPlaybackCallback | undefined {\n return this._onVideoPlayback;\n }\n public set onVideoPlayback(value: VideoPlaybackCallback | undefined) {\n this._onVideoPlayback = value;\n FireworkSDKModule.setVideoPlaybackEventEnabled(value ? true : false);\n }\n private _onVideoPlayback?: VideoPlaybackCallback | undefined;\n\n /**\n * The global share base URL of the video.\n * The {@link VideoPlayerConfiguration.shareBaseURL} in {@link VideoPlayerConfiguration} will override this.\n */\n public get shareBaseURL(): string | undefined {\n return this._shareBaseURL;\n }\n public set shareBaseURL(value: string | undefined) {\n this.updateInternalShareBaseURL(value);\n FireworkSDKModule.setShareBaseURL(value ?? '');\n }\n private _shareBaseURL: string | undefined;\n\n /**\n * The configuration for ad badges.\n */\n public get adBadgeConfiguration(): AdBadgeConfiguration | undefined {\n return this._adBadgeConfiguration;\n }\n public set adBadgeConfiguration(value: AdBadgeConfiguration | undefined) {\n const valueHasChanged =\n this._adBadgeConfiguration?.badgeTextType !== value?.badgeTextType ||\n this._adBadgeConfiguration?.backgroundColor !== value?.backgroundColor ||\n this._adBadgeConfiguration?.textColor !== value?.textColor ||\n this._adBadgeConfiguration?.androidFontInfo?.isCustom !==\n value?.androidFontInfo?.isCustom ||\n this._adBadgeConfiguration?.androidFontInfo?.typefaceName !==\n value?.androidFontInfo?.typefaceName;\n this._adBadgeConfiguration = value;\n if (valueHasChanged) {\n this.eventEmitter.emit(FWEventName.AdBadgeConfigurationUpdated);\n }\n FireworkSDKModule.setAdBadgeConfiguration(value ?? {});\n }\n private _adBadgeConfiguration: AdBadgeConfiguration | undefined;\n\n public get appLanguage(): string | undefined | null {\n return this._appLanguage;\n }\n private _appLanguage: string | undefined | null;\n\n /**\n * Defaults to false.\n * You can enable debug logs by setting this property to true.\n */\n public get debugLogsEnabled(): boolean {\n return FWLoggerUtil.enabled;\n }\n public set debugLogsEnabled(value: boolean) {\n FWLoggerUtil.enabled = value;\n }\n\n /**\n * Get video launch behavior.\n */\n public get videoLaunchBehavior(): VideoLaunchBehavior | undefined {\n return this._videoLaunchBehavior;\n }\n private _videoLaunchBehavior: VideoLaunchBehavior | undefined;\n\n private get eventEmitter(): NativeEventEmitter {\n return FireworkSDKModuleEventEmitter;\n }\n\n /**\n * Get VideoShopping object.\n */\n public get shopping(): VideoShopping {\n return this._shopping;\n }\n private _shopping: VideoShopping = VideoShopping.getInstance();\n\n /**\n * Get LiveStream object.\n */\n public get liveStream(): LiveStream {\n return this._liveStream;\n }\n private _liveStream: LiveStream = LiveStream.getInstance();\n\n /**\n * Get FWNavigator object.\n */\n public get navigator(): FWNavigator {\n return this._navigator;\n }\n private _navigator: FWNavigator = FWNavigator.getInstance();\n\n /**\n * Get global single instance of FireworkSDK class.\n * @returns FireworkSDK\n */\n public static getInstance() {\n if (!FireworkSDK._instance) {\n FireworkSDK._instance = new FireworkSDK();\n }\n\n return FireworkSDK._instance!;\n }\n\n private constructor() {\n FWLoggerUtil.log('FireworkSDK constructor');\n\n this.eventEmitter.addListener(FWEventName.SDKInit, (event) => {\n FWLoggerUtil.log(`Receive SDKInit event ${event?.error}`);\n\n if (this.onSDKInit && event) {\n this.onSDKInit(event);\n }\n });\n\n this.eventEmitter.addListener(FWEventName.LogMessage, (event) => {\n FWLoggerUtil.logNativeMessage(event.message);\n });\n\n this.eventEmitter.addListener(FWEventName.CustomCTAClick, (event) => {\n FWLoggerUtil.log(`Receive CustomCTAClick url: ${event?.url}`);\n FWLoggerUtil.log(\n `Receive CustomCTAClick callbackId: ${event?.callbackId}`\n );\n\n if (this.onCustomCTAClick && event) {\n if (event.callbackId) {\n const callbackId = event.callbackId;\n delete event.callbackId;\n if (Platform.OS === 'ios') {\n event.playerHandler = {\n pause: () => FireworkSDKModule.pausePlayer(callbackId),\n resume: () => FireworkSDKModule.resumePlayer(callbackId),\n };\n }\n }\n this.onCustomCTAClick(event);\n }\n });\n\n this.eventEmitter.addListener(FWEventName.VideoPlayback, (event) => {\n FWLoggerUtil.log(\n `Receive VideoPlayback event eventName: ${event?.eventName}`\n );\n\n if (this.onVideoPlayback && event) {\n this.onVideoPlayback(event);\n }\n });\n\n this.eventEmitter.addListener(FWEventName.VideoFeedClick, (event) => {\n FWLoggerUtil.log(`Receive VideoFeedClick event id: ${event?.info.id}`);\n\n if (this.onVideoFeedClick && event) {\n this.onVideoFeedClick(event);\n }\n });\n\n if (Platform.OS === 'ios') {\n this.eventEmitter.addListener(\n FWEventName.NativeAppLanguageUpdated,\n (event) => {\n FWLoggerUtil.log(\n `Receive NativeAppLanguageUpdated event appLanguage: ${event.appLanguage}`\n );\n const language = event.appLanguage;\n this.updateInternalAppLanguage(language);\n }\n );\n }\n }\n\n /**\n * Initializes Firework SDK.\n * @param {SDKInitOptions?} options\n */\n public async init(options?: SDKInitOptions): Promise<void> {\n FWLoggerUtil.log('Call FireworkSDK init method');\n const videoLaunchBehaviorUpdated =\n this._videoLaunchBehavior !== options?.videoLaunchBehavior;\n this._videoLaunchBehavior = options?.videoLaunchBehavior;\n if (videoLaunchBehaviorUpdated) {\n this.eventEmitter.emit(FWEventName.VideoLaunchBehaviorUpdated);\n }\n await FireworkSDKModule.init(options);\n await ShoppingModule.init();\n await LiveStreamModule.init();\n\n FWGlobalState.getInstance().resolveSdkInitCalled();\n }\n\n /**\n * You only need to call this method when you call init method in native side instead of JS side.\n */\n public async markInitCalled(): Promise<void> {\n FWLoggerUtil.log('Call FireworkSDK markInitCalled method');\n\n const hasCalledSDKInitFromNative = await FireworkSDKModule.markInitCalled();\n if (hasCalledSDKInitFromNative) {\n await ShoppingModule.init();\n await LiveStreamModule.init();\n }\n\n FWGlobalState.getInstance().resolveSdkInitCalled();\n }\n\n /**\n * Open Video URL.\n * @param {string} url\n * @param {VideoPlayerConfiguration} config\n */\n public async openVideoPlayer(\n url: string,\n config?: OpenVideoPlayerConfiguration\n ): Promise<void> {\n if (!FWGlobalState.getInstance().sdkInitCalled) {\n await FWGlobalState.getInstance().sdkInitCalledPromise;\n }\n FireworkSDKModule.openVideoPlayer(url, config ?? {});\n }\n\n /**\n * Records the user purchase. Only supported on iOS.\n * @param {TrackPurchaseParameters} parameters\n */\n public async trackPurchase(\n parameters: TrackPurchaseParameters\n ): Promise<void> {\n if (!FWGlobalState.getInstance().sdkInitCalled) {\n await FWGlobalState.getInstance().sdkInitCalledPromise;\n }\n FireworkSDKModule.trackPurchase(parameters);\n }\n\n /**\n * Change App level language.\n * @param {string | undefined | null} language Such as en, ar and en-US. If language is undefined or null or empty string, SDK will use system language.\n * @returns {Promise<boolean>} The result of changing app language.\n */\n public async changeAppLanguage(language?: string | null): Promise<boolean> {\n if (!FWGlobalState.getInstance().sdkInitCalled) {\n await FWGlobalState.getInstance().sdkInitCalledPromise;\n }\n\n const result = await FireworkSDKModule.changeAppLanguage(language);\n\n if (result) {\n const languageChanged = this._appLanguage !== language;\n if (Platform.OS === 'ios' && languageChanged) {\n await this.navigator.stopFloatingPlayer();\n }\n this.updateInternalAppLanguage(language);\n }\n return result;\n }\n\n private updateInternalAppLanguage(language?: string | null) {\n const valueHasChanged = this._appLanguage !== language;\n this._appLanguage = language;\n if (valueHasChanged) {\n this.eventEmitter.emit(FWEventName.AppLanguageUpdated);\n }\n }\n\n private updateInternalShareBaseURL(shareBaseURL?: string) {\n const shareBaseURLChanged = this._shareBaseURL !== shareBaseURL;\n this._shareBaseURL = shareBaseURL;\n if (shareBaseURLChanged) {\n this.eventEmitter.emit(FWEventName.ShareBaseURLUpdated);\n }\n }\n}\n\nexport default FireworkSDK;\n"]}
|
|
@@ -163,10 +163,10 @@ class VideoShopping {
|
|
|
163
163
|
|
|
164
164
|
this.handleShoppingCTAEvent(event);
|
|
165
165
|
});
|
|
166
|
-
this.eventEmitter.addListener(_FWEventName.FWEventName.ClickCartIcon,
|
|
166
|
+
this.eventEmitter.addListener(_FWEventName.FWEventName.ClickCartIcon, event => {
|
|
167
167
|
_FWLoggerUtil.default.log('Receive ClickCartIcon event');
|
|
168
168
|
|
|
169
|
-
this.handleClickCartIconEvent();
|
|
169
|
+
this.handleClickCartIconEvent(event);
|
|
170
170
|
});
|
|
171
171
|
this.eventEmitter.addListener(_FWEventName.FWEventName.UpdateProductDetails, event => {
|
|
172
172
|
_FWLoggerUtil.default.log(`Receive UpdateProductDetails event productIds: ${event === null || event === void 0 ? void 0 : event.productIds}`);
|
|
@@ -183,12 +183,6 @@ class VideoShopping {
|
|
|
183
183
|
_FWLoggerUtil.default.log(`Receive CustomProductCardTap event url: ${event === null || event === void 0 ? void 0 : event.url}`);
|
|
184
184
|
|
|
185
185
|
if (event) {
|
|
186
|
-
if (!event.video) {
|
|
187
|
-
event.video = {
|
|
188
|
-
videoId: ''
|
|
189
|
-
};
|
|
190
|
-
}
|
|
191
|
-
|
|
192
186
|
if (event.callbackId) {
|
|
193
187
|
const callbackId = event.callbackId;
|
|
194
188
|
delete event.callbackId;
|
|
@@ -200,9 +194,9 @@ class VideoShopping {
|
|
|
200
194
|
};
|
|
201
195
|
}
|
|
202
196
|
}
|
|
203
|
-
}
|
|
204
197
|
|
|
205
|
-
|
|
198
|
+
this.handleCustomProductCardTapEvent(event);
|
|
199
|
+
}
|
|
206
200
|
});
|
|
207
201
|
}
|
|
208
202
|
/**
|
|
@@ -242,9 +236,9 @@ class VideoShopping {
|
|
|
242
236
|
}
|
|
243
237
|
}
|
|
244
238
|
|
|
245
|
-
async handleClickCartIconEvent() {
|
|
239
|
+
async handleClickCartIconEvent(event) {
|
|
246
240
|
if (this.onCustomClickCartIcon) {
|
|
247
|
-
this.onCustomClickCartIcon();
|
|
241
|
+
this.onCustomClickCartIcon(event);
|
|
248
242
|
}
|
|
249
243
|
}
|
|
250
244
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["VideoShopping.ts"],"names":["VideoShopping","onCustomClickLinkButton","_onCustomClickLinkButton","value","ShoppingModule","setCustomClickLinkButtonEnabled","onCustomTapProductCard","_onCustomTapProductCard","setCustomTapProductCardEnabled","cartIconVisible","_cartIconVisible","FWGlobalState","getInstance","sdkInitCalled","setCartIconVisible","sdkInitCalledPromise","then","productInfoViewConfiguration","_productInfoViewConfiguration","valueHasChanged","updateNativeProductInfoViewConfiguration","setProductInfoViewConfiguration","eventEmitter","emit","FWEventName","ProductInfoViewConfigurationUpdated","FWLoggerUtil","log","ShoppingModuleEventEmitter","_instance","constructor","addListener","ShoppingCTAButtonClick","event","productId","unitId","url","handleShoppingCTAEvent","ClickCartIcon","handleClickCartIconEvent","UpdateProductDetails","productIds","handleUpdateProductDetailsEvent","LogMessage","CustomLinkButtonClick","handleCustomLinkButtonClickEvent","CustomProductCardTap","video","videoId","callbackId","Platform","OS","playerHandler","pause","pausePlayer","resume","resumePlayer","handleCustomProductCardTapEvent","setCartItemCount","count","onShoppingCTA","result","updateShoppingCTAResult","clearCallbackId","onCustomClickCartIcon","onUpdateProductDetails","productList","map","product","length","updateVideoProducts"],"mappings":";;;;;;;AAAA;;AAEA;;AASA;;AAGA;;AAEA;;;;;;;;;;AAuBA;AACA;AACA;AACA,MAAMA,aAAN,CAAoB;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} from './models/FWEventName';\nimport type {\n CustomClickLinkButtonEvent,\n CustomTapProductCardEvent,\n ShoppingCTAEvent,\n UpdateProductDetailsEvent,\n} from './models/FWEvents';\nimport type Product from './models/Product';\nimport type ProductInfoViewConfiguration from './models/ProductInfoViewConfiguration';\nimport ShoppingModule, {\n ShoppingModuleEventEmitter,\n} from './modules/ShoppingModule';\nimport FWLoggerUtil from './utils/FWLoggerUtil';\nimport type ShoppingCTAResult from './models/ShoppingCTAResult';\nimport FWGlobalState from './utils/FWGlobalState';\n\nexport type ShoppingCTACallback = (\n event: ShoppingCTAEvent\n) => Promise<ShoppingCTAResult> | ShoppingCTAResult;\n\nexport type CustomClickCartIconCallback = () => Promise<void> | void;\n\nexport type UpdateProductDetailsCallbackResult = Product[] | undefined | null;\nexport type UpdateProductDetailsCallback = (\n event: UpdateProductDetailsEvent\n) =>\n | Promise<UpdateProductDetailsCallbackResult>\n | UpdateProductDetailsCallbackResult;\n\nexport type CustomClickLinkButtonCallback = (\n event: CustomClickLinkButtonEvent\n) => Promise<void> | void;\n\nexport type CustomTapProductCardCallback = (\n event: CustomTapProductCardEvent\n) => Promise<void> | void;\n\n/**\n * The 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\" or \"Shop now\" button.\n * The host app can return a ShoppingCTAResult object to tell SDK how to handle the result.\n */\n public onShoppingCTA?: ShoppingCTACallback;\n\n /**\n * This callback is triggered when the user clicks the shopping cart icon.\n *\n * The host app can customize the click event processing logic of\n * the shopping cart icon by setting the callback.\n */\n public onCustomClickCartIcon?: CustomClickCartIconCallback | undefined;\n\n /**\n * This callback is triggered when the video will be shown.\n *\n * The host app can return a Product list to update the latest product information.\n */\n public onUpdateProductDetails?: UpdateProductDetailsCallback;\n\n /**\n * This callback is triggered when the user clicks\n * the link button next to Add to cart button.\n *\n * The host app can customize the click event processing logic of\n * the link button by setting the callback.\n */\n public get onCustomClickLinkButton():\n | CustomClickLinkButtonCallback\n | undefined {\n return this._onCustomClickLinkButton;\n }\n public set onCustomClickLinkButton(\n value: CustomClickLinkButtonCallback | undefined\n ) {\n this._onCustomClickLinkButton = value;\n ShoppingModule.setCustomClickLinkButtonEnabled(!!value);\n }\n private _onCustomClickLinkButton?: CustomClickLinkButtonCallback | undefined;\n\n /**\n * This callback is triggered when the user clicks product card.\n *\n * The host app can customize the tap event processing logic of\n * the product card by setting the callback.\n */\n public get onCustomTapProductCard():\n | CustomTapProductCardCallback\n | undefined {\n return this._onCustomTapProductCard;\n }\n public set onCustomTapProductCard(\n value: CustomTapProductCardCallback | undefined\n ) {\n this._onCustomTapProductCard = value;\n ShoppingModule.setCustomTapProductCardEnabled(!!value);\n }\n private _onCustomTapProductCard?: CustomTapProductCardCallback | undefined;\n\n /**\n * Defaults to true.\n * 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 if (FWGlobalState.getInstance().sdkInitCalled) {\n ShoppingModule.setCartIconVisible(value);\n } else {\n FWGlobalState.getInstance().sdkInitCalledPromise.then(() => {\n ShoppingModule.setCartIconVisible(value);\n });\n }\n }\n private _cartIconVisible: boolean = true;\n\n /**\n * The configuration of product info view.\n * Please refer to {@link ProductInfoViewConfiguration} for more details.\n */\n public get productInfoViewConfiguration():\n | ProductInfoViewConfiguration\n | undefined {\n return this._productInfoViewConfiguration;\n }\n\n public set productInfoViewConfiguration(\n value: ProductInfoViewConfiguration | undefined\n ) {\n const valueHasChanged = this._productInfoViewConfiguration !== value;\n this._productInfoViewConfiguration = value;\n if (FWGlobalState.getInstance().sdkInitCalled) {\n this.updateNativeProductInfoViewConfiguration(value, valueHasChanged);\n } else {\n FWGlobalState.getInstance().sdkInitCalledPromise.then(() => {\n this.updateNativeProductInfoViewConfiguration(value, valueHasChanged);\n });\n }\n }\n\n private updateNativeProductInfoViewConfiguration(\n value: ProductInfoViewConfiguration | undefined,\n valueHasChanged: Boolean\n ) {\n ShoppingModule.setProductInfoViewConfiguration(value ?? {}).then(() => {\n if (valueHasChanged) {\n this.eventEmitter.emit(FWEventName.ProductInfoViewConfigurationUpdated);\n FWLoggerUtil.log('eventEmitter ProductInfoViewConfigurationUpdated');\n }\n });\n }\n\n private _productInfoViewConfiguration?:\n | ProductInfoViewConfiguration\n | undefined;\n\n private get eventEmitter(): NativeEventEmitter {\n return ShoppingModuleEventEmitter;\n }\n\n public static getInstance() {\n FWLoggerUtil.log('VideoShopping constructor');\n if (!VideoShopping._instance) {\n VideoShopping._instance = new VideoShopping();\n }\n\n return VideoShopping._instance!;\n }\n\n private constructor() {\n this.eventEmitter.addListener(\n FWEventName.ShoppingCTAButtonClick,\n (event) => {\n FWLoggerUtil.log(\n `Receive ShoppingCTA event productId: ${event?.productId} unitId: ${event?.unitId} url: ${event?.url}`\n );\n this.handleShoppingCTAEvent(event);\n }\n );\n\n this.eventEmitter.addListener(FWEventName.ClickCartIcon, () => {\n FWLoggerUtil.log('Receive ClickCartIcon event');\n this.handleClickCartIconEvent();\n });\n\n this.eventEmitter.addListener(FWEventName.UpdateProductDetails, (event) => {\n FWLoggerUtil.log(\n `Receive UpdateProductDetails event productIds: ${event?.productIds}`\n );\n this.handleUpdateProductDetailsEvent(event);\n });\n\n this.eventEmitter.addListener(FWEventName.LogMessage, () => {});\n\n this.eventEmitter.addListener(\n FWEventName.CustomLinkButtonClick,\n (event) => {\n FWLoggerUtil.log(\n `Receive CustomLinkButtonClick event url: ${event?.url}`\n );\n this.handleCustomLinkButtonClickEvent(event);\n }\n );\n\n this.eventEmitter.addListener(FWEventName.CustomProductCardTap, (event) => {\n FWLoggerUtil.log(`Receive CustomProductCardTap event url: ${event?.url}`);\n if (event) {\n if (!event.video) {\n event.video = { videoId: '' };\n }\n\n if (event.callbackId) {\n const callbackId = event.callbackId;\n delete event.callbackId;\n if (Platform.OS === 'ios') {\n event.playerHandler = {\n pause: () => ShoppingModule.pausePlayer(callbackId),\n resume: () => ShoppingModule.resumePlayer(callbackId),\n };\n }\n }\n }\n\n this.handleCustomProductCardTapEvent(event ?? {});\n });\n }\n\n /**\n *\n * @param {number} count The number of items in the host app cart.\n * The count should be greater than or equal to 0.\n * We just use count to show or hide red indicator on the cart icon.\n * If cound > 0, we will show the red indicator on the cart icon.\n * Otherwise, we will hide the red indicator on the cart icon.\n */\n public async setCartItemCount(count: number): Promise<void> {\n if (!FWGlobalState.getInstance().sdkInitCalled) {\n await FWGlobalState.getInstance().sdkInitCalledPromise;\n }\n ShoppingModule.setCartItemCount(count);\n }\n\n private async handleShoppingCTAEvent(event: any) {\n const callbackId = event.callbackId;\n delete event.callbackId;\n\n if (this.onShoppingCTA) {\n const result = await this.onShoppingCTA(event as ShoppingCTAEvent);\n if (callbackId) {\n ShoppingModule.updateShoppingCTAResult(result, callbackId);\n }\n } else {\n if (callbackId) {\n if (Platform.OS === 'ios') {\n ShoppingModule.clearCallbackId(\n callbackId,\n FWEventName.ShoppingCTAButtonClick\n );\n }\n }\n }\n }\n\n private async handleClickCartIconEvent() {\n if (this.onCustomClickCartIcon) {\n this.onCustomClickCartIcon();\n }\n }\n\n private async handleUpdateProductDetailsEvent(event: any) {\n const callbackId = event.callbackId;\n delete event.callbackId;\n if (this.onUpdateProductDetails) {\n FWLoggerUtil.log(\n `Call onUpdateProductDetails callback productIds: ${event.productIds} callbackId: ${callbackId}`\n );\n const productList = await this.onUpdateProductDetails(\n event as UpdateProductDetailsEvent\n );\n\n const productIds = (productList || []).map(\n (product) => product.productId ?? ''\n );\n\n FWLoggerUtil.log(\n `Get result from onUpdateProductDetails callback productIds: ${productIds} productListLength: ${\n (productList || []).length\n }`\n );\n\n if (productList) {\n if (callbackId) {\n ShoppingModule.updateVideoProducts(productList, callbackId);\n }\n } else {\n if (callbackId) {\n if (Platform.OS === 'ios') {\n ShoppingModule.clearCallbackId(\n callbackId,\n FWEventName.UpdateProductDetails\n );\n }\n }\n }\n } else {\n FWLoggerUtil.log('onUpdateProductDetails callback is not set.');\n if (callbackId) {\n if (Platform.OS === 'ios') {\n ShoppingModule.clearCallbackId(\n callbackId,\n FWEventName.UpdateProductDetails\n );\n }\n }\n }\n }\n\n private async handleCustomLinkButtonClickEvent(\n event: CustomClickLinkButtonEvent\n ) {\n if (this.onCustomClickLinkButton) {\n this.onCustomClickLinkButton(event);\n }\n }\n\n private async handleCustomProductCardTapEvent(\n event: CustomTapProductCardEvent\n ) {\n if (this.onCustomTapProductCard) {\n this.onCustomTapProductCard(event);\n }\n }\n}\n\nexport default VideoShopping;\n"]}
|
|
1
|
+
{"version":3,"sources":["VideoShopping.ts"],"names":["VideoShopping","onCustomClickLinkButton","_onCustomClickLinkButton","value","ShoppingModule","setCustomClickLinkButtonEnabled","onCustomTapProductCard","_onCustomTapProductCard","setCustomTapProductCardEnabled","cartIconVisible","_cartIconVisible","FWGlobalState","getInstance","sdkInitCalled","setCartIconVisible","sdkInitCalledPromise","then","productInfoViewConfiguration","_productInfoViewConfiguration","valueHasChanged","updateNativeProductInfoViewConfiguration","setProductInfoViewConfiguration","eventEmitter","emit","FWEventName","ProductInfoViewConfigurationUpdated","FWLoggerUtil","log","ShoppingModuleEventEmitter","_instance","constructor","addListener","ShoppingCTAButtonClick","event","productId","unitId","url","handleShoppingCTAEvent","ClickCartIcon","handleClickCartIconEvent","UpdateProductDetails","productIds","handleUpdateProductDetailsEvent","LogMessage","CustomLinkButtonClick","handleCustomLinkButtonClickEvent","CustomProductCardTap","callbackId","Platform","OS","playerHandler","pause","pausePlayer","resume","resumePlayer","handleCustomProductCardTapEvent","setCartItemCount","count","onShoppingCTA","result","updateShoppingCTAResult","clearCallbackId","onCustomClickCartIcon","onUpdateProductDetails","productList","map","product","length","updateVideoProducts"],"mappings":";;;;;;;AAAA;;AAEA;;AAUA;;AAGA;;AAEA;;;;;;;;;;AAyBA;AACA;AACA;AACA,MAAMA,aAAN,CAAoB;AAGlB;AACF;AACA;AACA;;AAGE;AACF;AACA;AACA;AAC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hB,EAAoBC,GAApB,CAChBC,OAAD;AAAA;;AAAA,qCAAaA,OAAO,CAAChC,SAArB,mEAAkC,EAAlC;AAAA,OADiB,CAAnB;;AAIAR,4BAAaC,GAAb,CACG,+DAA8Dc,UAAW,uBACxE,CAACuB,WAAW,IAAI,EAAhB,EAAoBG,MACrB,EAHH;;AAMA,UAAIH,WAAJ,EAAiB;AACf,YAAIjB,UAAJ,EAAgB;AACd3C,kCAAegE,mBAAf,CAAmCJ,WAAnC,EAAgDjB,UAAhD;AACD;AACF,OAJD,MAIO;AACL,YAAIA,UAAJ,EAAgB;AACd,cAAIC,sBAASC,EAAT,KAAgB,KAApB,EAA2B;AACzB7C,oCAAeyD,eAAf,CACEd,UADF,EAEEvB,yBAAYgB,oBAFd;AAID;AACF;AACF;AACF,KAhCD,MAgCO;AACLd,4BAAaC,GAAb,CAAiB,6CAAjB;;AACA,UAAIoB,UAAJ,EAAgB;AACd,YAAIC,sBAASC,EAAT,KAAgB,KAApB,EAA2B;AACzB7C,kCAAeyD,eAAf,CACEd,UADF,EAEEvB,yBAAYgB,oBAFd;AAID;AACF;AACF;AACF;;AAE6C,QAAhCK,gCAAgC,CAC5CZ,KAD4C,EAE5C;AACA,QAAI,KAAKhC,uBAAT,EAAkC;AAChC,WAAKA,uBAAL,CAA6BgC,KAA7B;AACD;AACF;;AAE4C,QAA/BsB,+BAA+B,CAC3CtB,KAD2C,EAE3C;AACA,QAAI,KAAK3B,sBAAT,EAAiC;AAC/B,WAAKA,sBAAL,CAA4B2B,KAA5B;AACD;AACF;;AApSiB;;gBAAdjC,a;;eAuSSA,a","sourcesContent":["import { NativeEventEmitter, Platform } from 'react-native';\n\nimport { FWEventName } from './models/FWEventName';\nimport type {\n CustomClickCartIconEvent,\n CustomClickLinkButtonEvent,\n CustomTapProductCardEvent,\n ShoppingCTAEvent,\n UpdateProductDetailsEvent,\n} from './models/FWEvents';\nimport type Product from './models/Product';\nimport type ProductInfoViewConfiguration from './models/ProductInfoViewConfiguration';\nimport ShoppingModule, {\n ShoppingModuleEventEmitter,\n} from './modules/ShoppingModule';\nimport FWLoggerUtil from './utils/FWLoggerUtil';\nimport type ShoppingCTAResult from './models/ShoppingCTAResult';\nimport FWGlobalState from './utils/FWGlobalState';\n\nexport type ShoppingCTACallback = (\n event: ShoppingCTAEvent\n) => Promise<ShoppingCTAResult> | ShoppingCTAResult;\n\nexport type CustomClickCartIconCallback = (\n event: CustomClickCartIconEvent\n) => Promise<void> | void;\n\nexport type UpdateProductDetailsCallbackResult = Product[] | undefined | null;\nexport type UpdateProductDetailsCallback = (\n event: UpdateProductDetailsEvent\n) =>\n | Promise<UpdateProductDetailsCallbackResult>\n | UpdateProductDetailsCallbackResult;\n\nexport type CustomClickLinkButtonCallback = (\n event: CustomClickLinkButtonEvent\n) => Promise<void> | void;\n\nexport type CustomTapProductCardCallback = (\n event: CustomTapProductCardEvent\n) => Promise<void> | void;\n\n/**\n * The 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\" or \"Shop now\" button.\n * The host app can return a ShoppingCTAResult object to tell SDK how to handle the result.\n */\n public onShoppingCTA?: ShoppingCTACallback;\n\n /**\n * This callback is triggered when the user clicks the shopping cart icon.\n *\n * The host app can customize the click event processing logic of\n * the shopping cart icon by setting the callback.\n */\n public onCustomClickCartIcon?: CustomClickCartIconCallback | undefined;\n\n /**\n * This callback is triggered when the video will be shown.\n *\n * The host app can return a Product list to update the latest product information.\n */\n public onUpdateProductDetails?: UpdateProductDetailsCallback;\n\n /**\n * This callback is triggered when the user clicks\n * the link button next to Add to cart button.\n *\n * The host app can customize the click event processing logic of\n * the link button by setting the callback.\n */\n public get onCustomClickLinkButton():\n | CustomClickLinkButtonCallback\n | undefined {\n return this._onCustomClickLinkButton;\n }\n public set onCustomClickLinkButton(\n value: CustomClickLinkButtonCallback | undefined\n ) {\n this._onCustomClickLinkButton = value;\n ShoppingModule.setCustomClickLinkButtonEnabled(!!value);\n }\n private _onCustomClickLinkButton?: CustomClickLinkButtonCallback | undefined;\n\n /**\n * This callback is triggered when the user clicks product card.\n *\n * The host app can customize the tap event processing logic of\n * the product card by setting the callback.\n */\n public get onCustomTapProductCard():\n | CustomTapProductCardCallback\n | undefined {\n return this._onCustomTapProductCard;\n }\n public set onCustomTapProductCard(\n value: CustomTapProductCardCallback | undefined\n ) {\n this._onCustomTapProductCard = value;\n ShoppingModule.setCustomTapProductCardEnabled(!!value);\n }\n private _onCustomTapProductCard?: CustomTapProductCardCallback | undefined;\n\n /**\n * Defaults to true.\n * 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 if (FWGlobalState.getInstance().sdkInitCalled) {\n ShoppingModule.setCartIconVisible(value);\n } else {\n FWGlobalState.getInstance().sdkInitCalledPromise.then(() => {\n ShoppingModule.setCartIconVisible(value);\n });\n }\n }\n private _cartIconVisible: boolean = true;\n\n /**\n * The configuration of product info view.\n * Please refer to {@link ProductInfoViewConfiguration} for more details.\n */\n public get productInfoViewConfiguration():\n | ProductInfoViewConfiguration\n | undefined {\n return this._productInfoViewConfiguration;\n }\n\n public set productInfoViewConfiguration(\n value: ProductInfoViewConfiguration | undefined\n ) {\n const valueHasChanged = this._productInfoViewConfiguration !== value;\n this._productInfoViewConfiguration = value;\n if (FWGlobalState.getInstance().sdkInitCalled) {\n this.updateNativeProductInfoViewConfiguration(value, valueHasChanged);\n } else {\n FWGlobalState.getInstance().sdkInitCalledPromise.then(() => {\n this.updateNativeProductInfoViewConfiguration(value, valueHasChanged);\n });\n }\n }\n\n private updateNativeProductInfoViewConfiguration(\n value: ProductInfoViewConfiguration | undefined,\n valueHasChanged: Boolean\n ) {\n ShoppingModule.setProductInfoViewConfiguration(value ?? {}).then(() => {\n if (valueHasChanged) {\n this.eventEmitter.emit(FWEventName.ProductInfoViewConfigurationUpdated);\n FWLoggerUtil.log('eventEmitter ProductInfoViewConfigurationUpdated');\n }\n });\n }\n\n private _productInfoViewConfiguration?:\n | ProductInfoViewConfiguration\n | undefined;\n\n private get eventEmitter(): NativeEventEmitter {\n return ShoppingModuleEventEmitter;\n }\n\n public static getInstance() {\n FWLoggerUtil.log('VideoShopping constructor');\n if (!VideoShopping._instance) {\n VideoShopping._instance = new VideoShopping();\n }\n\n return VideoShopping._instance!;\n }\n\n private constructor() {\n this.eventEmitter.addListener(\n FWEventName.ShoppingCTAButtonClick,\n (event) => {\n FWLoggerUtil.log(\n `Receive ShoppingCTA event productId: ${event?.productId} unitId: ${event?.unitId} url: ${event?.url}`\n );\n this.handleShoppingCTAEvent(event);\n }\n );\n\n this.eventEmitter.addListener(FWEventName.ClickCartIcon, (event) => {\n FWLoggerUtil.log('Receive ClickCartIcon event');\n this.handleClickCartIconEvent(event);\n });\n\n this.eventEmitter.addListener(FWEventName.UpdateProductDetails, (event) => {\n FWLoggerUtil.log(\n `Receive UpdateProductDetails event productIds: ${event?.productIds}`\n );\n this.handleUpdateProductDetailsEvent(event);\n });\n\n this.eventEmitter.addListener(FWEventName.LogMessage, () => {});\n\n this.eventEmitter.addListener(\n FWEventName.CustomLinkButtonClick,\n (event) => {\n FWLoggerUtil.log(\n `Receive CustomLinkButtonClick event url: ${event?.url}`\n );\n this.handleCustomLinkButtonClickEvent(event);\n }\n );\n\n this.eventEmitter.addListener(FWEventName.CustomProductCardTap, (event) => {\n FWLoggerUtil.log(`Receive CustomProductCardTap event url: ${event?.url}`);\n if (event) {\n if (event.callbackId) {\n const callbackId = event.callbackId;\n delete event.callbackId;\n if (Platform.OS === 'ios') {\n event.playerHandler = {\n pause: () => ShoppingModule.pausePlayer(callbackId),\n resume: () => ShoppingModule.resumePlayer(callbackId),\n };\n }\n }\n this.handleCustomProductCardTapEvent(event);\n }\n });\n }\n\n /**\n *\n * @param {number} count The number of items in the host app cart.\n * The count should be greater than or equal to 0.\n * We just use count to show or hide red indicator on the cart icon.\n * If cound > 0, we will show the red indicator on the cart icon.\n * Otherwise, we will hide the red indicator on the cart icon.\n */\n public async setCartItemCount(count: number): Promise<void> {\n if (!FWGlobalState.getInstance().sdkInitCalled) {\n await FWGlobalState.getInstance().sdkInitCalledPromise;\n }\n ShoppingModule.setCartItemCount(count);\n }\n\n private async handleShoppingCTAEvent(event: any) {\n const callbackId = event.callbackId;\n delete event.callbackId;\n\n if (this.onShoppingCTA) {\n const result = await this.onShoppingCTA(event as ShoppingCTAEvent);\n if (callbackId) {\n ShoppingModule.updateShoppingCTAResult(result, callbackId);\n }\n } else {\n if (callbackId) {\n if (Platform.OS === 'ios') {\n ShoppingModule.clearCallbackId(\n callbackId,\n FWEventName.ShoppingCTAButtonClick\n );\n }\n }\n }\n }\n\n private async handleClickCartIconEvent(event: any) {\n if (this.onCustomClickCartIcon) {\n this.onCustomClickCartIcon(event as CustomClickCartIconEvent);\n }\n }\n\n private async handleUpdateProductDetailsEvent(event: any) {\n const callbackId = event.callbackId;\n delete event.callbackId;\n if (this.onUpdateProductDetails) {\n FWLoggerUtil.log(\n `Call onUpdateProductDetails callback productIds: ${event.productIds} callbackId: ${callbackId}`\n );\n const productList = await this.onUpdateProductDetails(\n event as UpdateProductDetailsEvent\n );\n\n const productIds = (productList || []).map(\n (product) => product.productId ?? ''\n );\n\n FWLoggerUtil.log(\n `Get result from onUpdateProductDetails callback productIds: ${productIds} productListLength: ${\n (productList || []).length\n }`\n );\n\n if (productList) {\n if (callbackId) {\n ShoppingModule.updateVideoProducts(productList, callbackId);\n }\n } else {\n if (callbackId) {\n if (Platform.OS === 'ios') {\n ShoppingModule.clearCallbackId(\n callbackId,\n FWEventName.UpdateProductDetails\n );\n }\n }\n }\n } else {\n FWLoggerUtil.log('onUpdateProductDetails callback is not set.');\n if (callbackId) {\n if (Platform.OS === 'ios') {\n ShoppingModule.clearCallbackId(\n callbackId,\n FWEventName.UpdateProductDetails\n );\n }\n }\n }\n }\n\n private async handleCustomLinkButtonClickEvent(\n event: CustomClickLinkButtonEvent\n ) {\n if (this.onCustomClickLinkButton) {\n this.onCustomClickLinkButton(event);\n }\n }\n\n private async handleCustomProductCardTapEvent(\n event: CustomTapProductCardEvent\n ) {\n if (this.onCustomTapProductCard) {\n this.onCustomTapProductCard(event);\n }\n }\n}\n\nexport default VideoShopping;\n"]}
|
|
@@ -143,6 +143,21 @@ const StoryBlock = (props, forwardedRef) => {
|
|
|
143
143
|
}
|
|
144
144
|
};
|
|
145
145
|
|
|
146
|
+
const handleStoryBlockGetFeedId = event => {
|
|
147
|
+
_FWLoggerUtil.default.log(`StoryBlock handleStoryBlockGetFeedId ${JSON.stringify(event.nativeEvent)}`);
|
|
148
|
+
|
|
149
|
+
const {
|
|
150
|
+
onStoryBlockGetFeedId
|
|
151
|
+
} = props;
|
|
152
|
+
const {
|
|
153
|
+
feedId
|
|
154
|
+
} = event.nativeEvent;
|
|
155
|
+
|
|
156
|
+
if (onStoryBlockGetFeedId) {
|
|
157
|
+
onStoryBlockGetFeedId(feedId !== null && feedId !== void 0 ? feedId : '');
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
|
|
146
161
|
const generateDynamicContentParametersString = () => {
|
|
147
162
|
const {
|
|
148
163
|
dynamicContentParameters
|
|
@@ -260,12 +275,14 @@ const StoryBlock = (props, forwardedRef) => {
|
|
|
260
275
|
const ctaHighlightDelayValue = storyBlockConfiguration === null || storyBlockConfiguration === void 0 ? void 0 : (_storyBlockConfigurat5 = storyBlockConfiguration.ctaHighlightDelay) === null || _storyBlockConfigurat5 === void 0 ? void 0 : (_storyBlockConfigurat6 = _storyBlockConfigurat5.value) === null || _storyBlockConfigurat6 === void 0 ? void 0 : _storyBlockConfigurat6.toFixed(5);
|
|
261
276
|
const shareBaseURL = storyBlockConfiguration === null || storyBlockConfiguration === void 0 ? void 0 : storyBlockConfiguration.shareBaseURL;
|
|
262
277
|
const buttonConfiguration = storyBlockConfiguration === null || storyBlockConfiguration === void 0 ? void 0 : storyBlockConfiguration.buttonConfiguration;
|
|
278
|
+
const videoPlayerLogoConfigurationJsonKey = (0, _FWJsonUtil.default)(storyBlockConfiguration === null || storyBlockConfiguration === void 0 ? void 0 : storyBlockConfiguration.videoPlayerLogoConfiguration);
|
|
263
279
|
const ctaWidth = storyBlockConfiguration === null || storyBlockConfiguration === void 0 ? void 0 : storyBlockConfiguration.ctaWidth;
|
|
264
280
|
const showVideoDetailTitle = storyBlockConfiguration === null || storyBlockConfiguration === void 0 ? void 0 : storyBlockConfiguration.showVideoDetailTitle;
|
|
265
281
|
const requiresAds = adConfiguration === null || adConfiguration === void 0 ? void 0 : adConfiguration.requiresAds;
|
|
266
282
|
const adsFetchTimeout = adConfiguration === null || adConfiguration === void 0 ? void 0 : adConfiguration.adsFetchTimeout;
|
|
267
283
|
const vastAttributesString = generateVastAttributesString();
|
|
268
284
|
const productInfoViewConfigurationJsonKey = (0, _FWJsonUtil.default)(_FireworkSDK.default.getInstance().shopping.productInfoViewConfiguration);
|
|
285
|
+
const replayBadgeConfigurationJsonKey = (0, _FWJsonUtil.default)(storyBlockConfiguration === null || storyBlockConfiguration === void 0 ? void 0 : storyBlockConfiguration.replayBadgeConfiguration);
|
|
269
286
|
let key = `gShareBaseURL:${gShareBaseURL}`;
|
|
270
287
|
|
|
271
288
|
if (_reactNative.Platform.OS === 'ios') {
|
|
@@ -309,15 +326,22 @@ const StoryBlock = (props, forwardedRef) => {
|
|
|
309
326
|
key += `_buttonConfiguration.unmuteButton:${generateButtonInfoString(buttonConfiguration === null || buttonConfiguration === void 0 ? void 0 : buttonConfiguration.unmuteButton)}`;
|
|
310
327
|
key += `_buttonConfiguration.playButton:${generateButtonInfoString(buttonConfiguration === null || buttonConfiguration === void 0 ? void 0 : buttonConfiguration.playButton)}`;
|
|
311
328
|
key += `_buttonConfiguration.pauseButton:${generateButtonInfoString(buttonConfiguration === null || buttonConfiguration === void 0 ? void 0 : buttonConfiguration.pauseButton)}`;
|
|
329
|
+
|
|
330
|
+
if (_reactNative.Platform.OS === 'android') {
|
|
331
|
+
key += `_videoPlayerLogoConfiguration:${videoPlayerLogoConfigurationJsonKey}`;
|
|
332
|
+
}
|
|
333
|
+
|
|
312
334
|
key += `_showVideoDetailTitle:${showVideoDetailTitle}`;
|
|
313
335
|
key += `_requiresAds:${requiresAds}`;
|
|
314
336
|
key += `_adsFetchTimeout:${adsFetchTimeout}`;
|
|
315
337
|
key += `_vastAttributes:${vastAttributesString}`;
|
|
316
|
-
key += `
|
|
338
|
+
key += `_productInfoViewConfiguration:${productInfoViewConfigurationJsonKey}`;
|
|
339
|
+
key += `_replayBadgeConfiguration:${replayBadgeConfigurationJsonKey}`;
|
|
317
340
|
return key;
|
|
318
341
|
};
|
|
319
342
|
|
|
320
343
|
const key = generateKey();
|
|
344
|
+
console.log('story block key', key);
|
|
321
345
|
(0, _react.useImperativeHandle)(forwardedRef, () => {
|
|
322
346
|
const sendCommand = command => {
|
|
323
347
|
const nativeNodeHandle = (0, _reactNative.findNodeHandle)(nativeComponentRef.current);
|
|
@@ -328,7 +352,15 @@ const StoryBlock = (props, forwardedRef) => {
|
|
|
328
352
|
commandId = commandId.toString();
|
|
329
353
|
}
|
|
330
354
|
|
|
331
|
-
|
|
355
|
+
let reactTag = (0, _reactNative.findNodeHandle)(nativeNodeHandle);
|
|
356
|
+
|
|
357
|
+
_FWLoggerUtil.default.log(`StoryBlock sendCommand: ${command} commandId: ${commandId} nativeNodeHandle: ${nativeNodeHandle} reactTag: ${reactTag}`);
|
|
358
|
+
|
|
359
|
+
if (!nativeNodeHandle || !reactTag) {
|
|
360
|
+
return;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
_reactNative.UIManager.dispatchViewManagerCommand(reactTag, commandId, []);
|
|
332
364
|
};
|
|
333
365
|
|
|
334
366
|
return {
|
|
@@ -340,6 +372,20 @@ const StoryBlock = (props, forwardedRef) => {
|
|
|
340
372
|
},
|
|
341
373
|
openFullscreen: () => {
|
|
342
374
|
sendCommand('openFullscreen');
|
|
375
|
+
},
|
|
376
|
+
onViewportEntered: () => {
|
|
377
|
+
if (_reactNative.Platform.OS !== 'ios') {
|
|
378
|
+
return;
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
sendCommand('onViewportEntered');
|
|
382
|
+
},
|
|
383
|
+
onViewportLeft: () => {
|
|
384
|
+
if (_reactNative.Platform.OS !== 'ios') {
|
|
385
|
+
return;
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
sendCommand('onViewportLeft');
|
|
343
389
|
}
|
|
344
390
|
};
|
|
345
391
|
}, []);
|
|
@@ -389,6 +435,10 @@ const StoryBlock = (props, forwardedRef) => {
|
|
|
389
435
|
|
|
390
436
|
_FWLoggerUtil.default.log(`StoryBlock createFragment viewId: ${viewId}`);
|
|
391
437
|
|
|
438
|
+
if (!viewId) {
|
|
439
|
+
return;
|
|
440
|
+
}
|
|
441
|
+
|
|
392
442
|
_reactNative.UIManager.dispatchViewManagerCommand(viewId, _reactNative.UIManager.getViewManagerConfig(NativeComponentName).Commands.create.toString(), [viewId]);
|
|
393
443
|
}, 500);
|
|
394
444
|
}
|
|
@@ -421,7 +471,8 @@ const StoryBlock = (props, forwardedRef) => {
|
|
|
421
471
|
onStoryBlockLoadFinished: handleStoryBlockLoadFinished,
|
|
422
472
|
onStoryBlockEmpty: handleStoryBlockEmpty,
|
|
423
473
|
onStoryBlockDidStartPictureInPicture: handleStoryBlockDidStartPictureInPicture,
|
|
424
|
-
onStoryBlockDidStopPictureInPicture: handleStoryBlockDidStopPictureInPicture
|
|
474
|
+
onStoryBlockDidStopPictureInPicture: handleStoryBlockDidStopPictureInPicture,
|
|
475
|
+
onStoryBlockGetFeedId: handleStoryBlockGetFeedId
|
|
425
476
|
}));
|
|
426
477
|
};
|
|
427
478
|
|