react-native-firework-sdk 1.2.0-beta.2 → 1.2.0-beta.6
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/java/com/fireworksdk/bridge/components/videofeed/FWVideoFeed.kt +17 -4
- package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoFeedPropsModel.kt +1 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoFeedSource.kt +1 -0
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/manager/FWVideoFeedManager.kt +6 -0
- package/ios/Components/VideoFeed.swift +6 -25
- package/ios/Components/VideoFeedManager.m +1 -0
- package/ios/FireworkSdk.xcodeproj/project.pbxproj +4 -0
- package/ios/Models/RNToNative/RCTConvert+VideoFeed.swift +2 -1
- package/ios/Modules/FWNavigatorModule/FWNavigatorContainerViewController.swift +1 -1
- package/ios/Modules/FWNavigatorModule/FWNavigatorModule.swift +2 -6
- package/ios/Modules/FireworkSDKModule/FWCustomCTALinkContentContainerViewController.swift +31 -0
- package/ios/Modules/FireworkSDKModule/FireworkSDKModule+CTA.swift +10 -1
- package/ios/Modules/FireworkSDKModule/FireworkSDKModule.m +1 -0
- package/ios/Modules/FireworkSDKModule/FireworkSDKModule.swift +41 -3
- package/lib/commonjs/FireworkSDK.js +25 -1
- package/lib/commonjs/FireworkSDK.js.map +1 -1
- package/lib/commonjs/VideoShopping.js +0 -1
- package/lib/commonjs/VideoShopping.js.map +1 -1
- package/lib/commonjs/components/CustomCTALinkContentContainer.js +39 -0
- package/lib/commonjs/components/CustomCTALinkContentContainer.js.map +1 -0
- package/lib/commonjs/components/VideoFeed.js +30 -0
- package/lib/commonjs/components/VideoFeed.js.map +1 -1
- package/lib/commonjs/index.js +4 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/modules/FireworkSDKModule.js.map +1 -1
- package/lib/commonjs/utils/FWLoggerUtil.js +7 -3
- package/lib/commonjs/utils/FWLoggerUtil.js.map +1 -1
- package/lib/module/FireworkSDK.js +23 -1
- package/lib/module/FireworkSDK.js.map +1 -1
- package/lib/module/VideoShopping.js +0 -1
- package/lib/module/VideoShopping.js.map +1 -1
- package/lib/module/components/CustomCTALinkContentContainer.js +24 -0
- package/lib/module/components/CustomCTALinkContentContainer.js.map +1 -0
- package/lib/module/components/VideoFeed.js +30 -0
- package/lib/module/components/VideoFeed.js.map +1 -1
- package/lib/module/index.js +2 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/modules/FireworkSDKModule.js.map +1 -1
- package/lib/module/utils/FWLoggerUtil.js +7 -3
- package/lib/module/utils/FWLoggerUtil.js.map +1 -1
- package/lib/typescript/FireworkSDK.d.ts +9 -0
- package/lib/typescript/components/CustomCTALinkContentContainer.d.ts +6 -0
- package/lib/typescript/components/VideoFeed.d.ts +7 -0
- package/lib/typescript/index.d.ts +2 -2
- package/lib/typescript/models/VideoFeedSource.d.ts +1 -1
- package/lib/typescript/modules/FireworkSDKModule.d.ts +2 -1
- package/package.json +1 -1
- package/react-native-firework-sdk.podspec +1 -1
- package/src/FireworkSDK.ts +30 -1
- package/src/VideoShopping.ts +0 -1
- package/src/components/CustomCTALinkContentContainer.tsx +26 -0
- package/src/components/VideoFeed.tsx +45 -13
- package/src/index.tsx +7 -0
- package/src/models/VideoFeedSource.ts +1 -1
- package/src/modules/FireworkSDKModule.ts +2 -3
- package/src/utils/FWLoggerUtil.ts +10 -6
package/android/build.gradle
CHANGED
|
@@ -168,7 +168,7 @@ def kotlin_version = getExtOrDefault('kotlinVersion')
|
|
|
168
168
|
dependencies {
|
|
169
169
|
|
|
170
170
|
// optional 1: firework sdk release verison
|
|
171
|
-
def firework_sdk_version = 'v5.
|
|
171
|
+
def firework_sdk_version = 'v5.12.0'
|
|
172
172
|
implementation "com.github.loopsocial:firework_sdk:$firework_sdk_version"
|
|
173
173
|
|
|
174
174
|
// optional 2: firework sdk local version,
|
|
@@ -40,6 +40,7 @@ class FWVideoFeed(
|
|
|
40
40
|
videoFeedPropsModel.mode = props.mode
|
|
41
41
|
videoFeedPropsModel.videoFeedConfiguration = props.videoFeedConfiguration
|
|
42
42
|
videoFeedPropsModel.videoPlayerConfiguration = props.videoPlayerConfiguration
|
|
43
|
+
videoFeedPropsModel.dynamicContentParameters = props.dynamicContentParameters
|
|
43
44
|
}
|
|
44
45
|
setData()
|
|
45
46
|
}
|
|
@@ -69,6 +70,11 @@ class FWVideoFeed(
|
|
|
69
70
|
setData()
|
|
70
71
|
}
|
|
71
72
|
|
|
73
|
+
fun setDynamicContentParametersProps(dynamicContentParameters: HashMap<String, List<String>>?) {
|
|
74
|
+
videoFeedPropsModel.dynamicContentParameters = dynamicContentParameters
|
|
75
|
+
setData()
|
|
76
|
+
}
|
|
77
|
+
|
|
72
78
|
fun setVideoFeedConfigProps(config: FWVideoFeedConfigModel?) {
|
|
73
79
|
videoFeedPropsModel.videoFeedConfiguration = config
|
|
74
80
|
setData()
|
|
@@ -87,6 +93,7 @@ class FWVideoFeed(
|
|
|
87
93
|
private fun setData() {
|
|
88
94
|
val source = videoFeedPropsModel.source
|
|
89
95
|
val mode = videoFeedPropsModel.mode
|
|
96
|
+
val dynamicContentParameters = videoFeedPropsModel.dynamicContentParameters
|
|
90
97
|
val channel = videoFeedPropsModel.channel
|
|
91
98
|
val playlist = videoFeedPropsModel.playlist
|
|
92
99
|
val playlistGroup = videoFeedPropsModel.playlistGroup
|
|
@@ -100,14 +107,17 @@ class FWVideoFeed(
|
|
|
100
107
|
FWVideoFeedSource.PlaylistGroup.rawValue -> {
|
|
101
108
|
setPlaylistGroupFeed(mode, playlistGroup, videoFeedConfiguration, videoPlayerConfiguration)
|
|
102
109
|
}
|
|
110
|
+
FWVideoFeedSource.DynamicContent.rawValue -> {
|
|
111
|
+
setFeed(mode, channel, playlist, FeedType.DYNAMIC_CONTENT, dynamicContentParameters, videoFeedConfiguration, videoPlayerConfiguration)
|
|
112
|
+
}
|
|
103
113
|
FWVideoFeedSource.Playlist.rawValue -> {
|
|
104
|
-
setFeed(mode, channel, playlist, FeedType.PLAYLIST, videoFeedConfiguration, videoPlayerConfiguration)
|
|
114
|
+
setFeed(mode, channel, playlist, FeedType.PLAYLIST, null, videoFeedConfiguration, videoPlayerConfiguration)
|
|
105
115
|
}
|
|
106
116
|
FWVideoFeedSource.Channel.rawValue -> {
|
|
107
|
-
setFeed(mode, channel, null, FeedType.CHANNEL, videoFeedConfiguration, videoPlayerConfiguration)
|
|
117
|
+
setFeed(mode, channel, null, FeedType.CHANNEL, null, videoFeedConfiguration, videoPlayerConfiguration)
|
|
108
118
|
}
|
|
109
119
|
else -> {
|
|
110
|
-
setFeed(mode, null, null, FeedType.DISCOVER, videoFeedConfiguration, videoPlayerConfiguration)
|
|
120
|
+
setFeed(mode, null, null, FeedType.DISCOVER, null, videoFeedConfiguration, videoPlayerConfiguration)
|
|
111
121
|
}
|
|
112
122
|
}
|
|
113
123
|
}
|
|
@@ -115,6 +125,7 @@ class FWVideoFeed(
|
|
|
115
125
|
private fun setFeed(
|
|
116
126
|
mode: String?,
|
|
117
127
|
channelId: String?, playlistId: String?, feedType: FeedType?,
|
|
128
|
+
dynamicContentParameters: HashMap<String, List<String>>?,
|
|
118
129
|
videoFeedConfiguration: FWVideoFeedConfigModel?,
|
|
119
130
|
videoPlayerConfiguration: FWVideoPlayerConfigModel?,
|
|
120
131
|
) {
|
|
@@ -133,7 +144,9 @@ class FWVideoFeed(
|
|
|
133
144
|
}
|
|
134
145
|
|
|
135
146
|
// set channel playlistId feedType
|
|
136
|
-
if (feedType == FeedType.
|
|
147
|
+
if (feedType == FeedType.DYNAMIC_CONTENT && !channelId.isNullOrBlank()) {
|
|
148
|
+
videoFeedView?.setDynamicContent(channelId, dynamicContentParameters?:hashMapOf())
|
|
149
|
+
} else if (feedType == FeedType.CHANNEL && !channelId.isNullOrBlank()) {
|
|
137
150
|
videoFeedView?.setFeed(channelId, null, FeedType.CHANNEL)
|
|
138
151
|
} else if (feedType == FeedType.PLAYLIST && !channelId.isNullOrBlank() && !playlistId.isNullOrBlank()) {
|
|
139
152
|
videoFeedView?.setFeed(channelId, playlistId, FeedType.PLAYLIST)
|
|
@@ -15,4 +15,5 @@ data class FWVideoFeedPropsModel(
|
|
|
15
15
|
var mode: String? = null,
|
|
16
16
|
var videoFeedConfiguration: FWVideoFeedConfigModel? = null,
|
|
17
17
|
var videoPlayerConfiguration: FWVideoPlayerConfigModel? = null,
|
|
18
|
+
var dynamicContentParameters: HashMap<String, List<String>>? = null,
|
|
18
19
|
) : Parcelable
|
package/android/src/main/java/com/fireworksdk/bridge/reactnative/manager/FWVideoFeedManager.kt
CHANGED
|
@@ -133,6 +133,12 @@ class FWVideoFeedManager : SimpleViewManager<FWVideoFeed>() {
|
|
|
133
133
|
view.setModeProps(mode)
|
|
134
134
|
}
|
|
135
135
|
|
|
136
|
+
@ReactProp(name = "dynamicContentParameters")
|
|
137
|
+
fun setDynamicContentParameters(view: FWVideoFeed, parameters: ReadableMap?) {
|
|
138
|
+
val parametersMap = parameters?.toHashMap() as? HashMap<String, List<String>>
|
|
139
|
+
view.setDynamicContentParametersProps(parametersMap)
|
|
140
|
+
}
|
|
141
|
+
|
|
136
142
|
@ReactProp(name = "videoFeedConfiguration")
|
|
137
143
|
fun setVideoFeedConfig(view: FWVideoFeed, config: ReadableMap?) {
|
|
138
144
|
val configMap = config?.toHashMap()
|
|
@@ -31,7 +31,7 @@ public enum VideoFeedMode: Int {
|
|
|
31
31
|
|
|
32
32
|
@objc
|
|
33
33
|
public enum VideFeedSourceType: Int {
|
|
34
|
-
case discover, channel, playlist, playlistGroup
|
|
34
|
+
case discover, channel, playlist, playlistGroup, dynamicContent
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
public protocol VideoFeedViewDelegate: AnyObject {
|
|
@@ -48,6 +48,7 @@ public class VideoFeed: UIView, VideoFeedViewControllerDelegate {
|
|
|
48
48
|
@objc public var channel: String = ""
|
|
49
49
|
@objc public var playlist: String = ""
|
|
50
50
|
@objc public var playlistGroup: String = ""
|
|
51
|
+
@objc public var dynamicContentParameters: NSDictionary = NSDictionary()
|
|
51
52
|
@objc public var mode: VideoFeedMode = .row
|
|
52
53
|
@objc public var feedViewConfig: VideoFeedConfiguration? {
|
|
53
54
|
didSet {
|
|
@@ -81,6 +82,9 @@ public class VideoFeed: UIView, VideoFeedViewControllerDelegate {
|
|
|
81
82
|
return .channelPlaylist(channelID: channel, playlistID: playlist)
|
|
82
83
|
case .playlistGroup:
|
|
83
84
|
return .playlistGroup(groupID: playlistGroup)
|
|
85
|
+
case .dynamicContent:
|
|
86
|
+
let parameters = dynamicContentParameters as? [String: [String]]
|
|
87
|
+
return .dynamicContent(channelID: channel, parameters: parameters ?? [:])
|
|
84
88
|
}
|
|
85
89
|
}
|
|
86
90
|
|
|
@@ -153,28 +157,6 @@ public class VideoFeed: UIView, VideoFeedViewControllerDelegate {
|
|
|
153
157
|
}
|
|
154
158
|
|
|
155
159
|
extension VideoFeed {
|
|
156
|
-
private func convertToFWAdBadgeConfiguration(_ adBadgeConfiguration: AdBadgeConfiguration?) -> FireworkVideo.AdBadgeConfiguration? {
|
|
157
|
-
guard let adBadgeConfiguration = adBadgeConfiguration else {
|
|
158
|
-
return nil
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
var fwAdBadgeConfiguration = FireworkVideo.AdBadgeConfiguration()
|
|
162
|
-
if let textColor = adBadgeConfiguration.textColor {
|
|
163
|
-
fwAdBadgeConfiguration.textColor = textColor.uicolor()
|
|
164
|
-
}
|
|
165
|
-
if let backgroundColor = adBadgeConfiguration.backgroundColor {
|
|
166
|
-
fwAdBadgeConfiguration.backgroundColor = backgroundColor.uicolor()
|
|
167
|
-
}
|
|
168
|
-
switch adBadgeConfiguration.badgeTextType {
|
|
169
|
-
case .sponsored:
|
|
170
|
-
fwAdBadgeConfiguration.badgeText = FireworkVideo.AdBadgeConfiguration.BadgeText.sponsored
|
|
171
|
-
default:
|
|
172
|
-
fwAdBadgeConfiguration.badgeText = FireworkVideo.AdBadgeConfiguration.BadgeText.ad
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
return fwAdBadgeConfiguration
|
|
176
|
-
}
|
|
177
|
-
|
|
178
160
|
private func convertToVideoFeedConentConfiguration() -> VideoFeedContentConfiguration {
|
|
179
161
|
var videoConfig = VideoFeedContentConfiguration()
|
|
180
162
|
//set default value so that behavior will the same with Android
|
|
@@ -196,8 +178,7 @@ extension VideoFeed {
|
|
|
196
178
|
if let shareBaseUrl = gShareBaseURL {
|
|
197
179
|
videoConfig.playerView.shareButton.behavior.baseURL = URL(string:shareBaseUrl)
|
|
198
180
|
}
|
|
199
|
-
let adBadge =
|
|
200
|
-
if let adBadge = adBadge {
|
|
181
|
+
if let adBadge = FireworkSDKModule.convertToFWAdBadgeConfiguration(gAdBadgeConfiguration) {
|
|
201
182
|
videoConfig.adBadge = adBadge
|
|
202
183
|
}
|
|
203
184
|
|
|
@@ -22,6 +22,7 @@ RCT_CUSTOM_VIEW_PROPERTY(source, VideFeedSourceType, VideoFeed) {
|
|
|
22
22
|
RCT_EXPORT_VIEW_PROPERTY(channel, NSString)
|
|
23
23
|
RCT_EXPORT_VIEW_PROPERTY(playlist, NSString)
|
|
24
24
|
RCT_EXPORT_VIEW_PROPERTY(playlistGroup, NSString)
|
|
25
|
+
RCT_EXPORT_VIEW_PROPERTY(dynamicContentParameters, NSDictionary)
|
|
25
26
|
|
|
26
27
|
RCT_CUSTOM_VIEW_PROPERTY(mode, VideoFeedMode, VideoFeed) {
|
|
27
28
|
if (json) {
|
|
@@ -37,6 +37,7 @@
|
|
|
37
37
|
8975239E2817DEF80070EBB6 /* FireworkSDKModule.m in Sources */ = {isa = PBXBuildFile; fileRef = 897523832817DEF80070EBB6 /* FireworkSDKModule.m */; };
|
|
38
38
|
8975239F2817DEF80070EBB6 /* LiveStreamModule.swift in Sources */ = {isa = PBXBuildFile; fileRef = 897523852817DEF80070EBB6 /* LiveStreamModule.swift */; };
|
|
39
39
|
897523A02817DEF80070EBB6 /* LiveStreamModule.m in Sources */ = {isa = PBXBuildFile; fileRef = 897523862817DEF80070EBB6 /* LiveStreamModule.m */; };
|
|
40
|
+
89BA1734283619FE00C2287A /* FWCustomCTALinkContentContainerViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 89BA1733283619FE00C2287A /* FWCustomCTALinkContentContainerViewController.swift */; };
|
|
40
41
|
/* End PBXBuildFile section */
|
|
41
42
|
|
|
42
43
|
/* Begin PBXCopyFilesBuildPhase section */
|
|
@@ -85,6 +86,7 @@
|
|
|
85
86
|
897523832817DEF80070EBB6 /* FireworkSDKModule.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FireworkSDKModule.m; sourceTree = "<group>"; };
|
|
86
87
|
897523852817DEF80070EBB6 /* LiveStreamModule.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LiveStreamModule.swift; sourceTree = "<group>"; };
|
|
87
88
|
897523862817DEF80070EBB6 /* LiveStreamModule.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LiveStreamModule.m; sourceTree = "<group>"; };
|
|
89
|
+
89BA1733283619FE00C2287A /* FWCustomCTALinkContentContainerViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FWCustomCTALinkContentContainerViewController.swift; sourceTree = "<group>"; };
|
|
88
90
|
/* End PBXFileReference section */
|
|
89
91
|
|
|
90
92
|
/* Begin PBXFrameworksBuildPhase section */
|
|
@@ -212,6 +214,7 @@
|
|
|
212
214
|
897523812817DEF80070EBB6 /* AdBadgeConfiguration.swift */,
|
|
213
215
|
897523822817DEF80070EBB6 /* FireworkSDKModule+CTA.swift */,
|
|
214
216
|
897523832817DEF80070EBB6 /* FireworkSDKModule.m */,
|
|
217
|
+
89BA1733283619FE00C2287A /* FWCustomCTALinkContentContainerViewController.swift */,
|
|
215
218
|
);
|
|
216
219
|
path = FireworkSDKModule;
|
|
217
220
|
sourceTree = "<group>";
|
|
@@ -301,6 +304,7 @@
|
|
|
301
304
|
8975239A2817DEF80070EBB6 /* FireworkSDKModule+EventTracking.swift in Sources */,
|
|
302
305
|
8975239E2817DEF80070EBB6 /* FireworkSDKModule.m in Sources */,
|
|
303
306
|
897523962817DEF80070EBB6 /* ProductInfoViewConfiguration.swift in Sources */,
|
|
307
|
+
89BA1734283619FE00C2287A /* FWCustomCTALinkContentContainerViewController.swift in Sources */,
|
|
304
308
|
8975238D2817DEF80070EBB6 /* RCTConvert+VideoFeed.swift in Sources */,
|
|
305
309
|
8975238C2817DEF80070EBB6 /* RCTConvert+Shopping.swift in Sources */,
|
|
306
310
|
897523602817DEEE0070EBB6 /* VideoFeed.swift in Sources */,
|
|
@@ -58,12 +58,8 @@ class FWNavigatorModule: RCTEventEmitter, FWNavigator {
|
|
|
58
58
|
return
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
resolver(true)
|
|
64
|
-
}
|
|
65
|
-
} else {
|
|
66
|
-
resolver(false)
|
|
61
|
+
presentedVC.dismiss(animated: true) {
|
|
62
|
+
resolver(true)
|
|
67
63
|
}
|
|
68
64
|
}
|
|
69
65
|
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
//
|
|
2
|
+
// FWCustomCTALinkContentContainerViewController.swift
|
|
3
|
+
// FireworkSdk
|
|
4
|
+
//
|
|
5
|
+
// Created by linjie jiang on 2022/5/19.
|
|
6
|
+
// Copyright © 2022 Facebook. All rights reserved.
|
|
7
|
+
//
|
|
8
|
+
|
|
9
|
+
import UIKit
|
|
10
|
+
|
|
11
|
+
class FWCustomCTALinkContentContainerViewController: UIViewController {
|
|
12
|
+
var url: String?
|
|
13
|
+
|
|
14
|
+
override func viewDidLoad() {
|
|
15
|
+
super.viewDidLoad()
|
|
16
|
+
loadContent()
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
private func loadContent() {
|
|
20
|
+
let rctRootView = RCTRootView.init(bridge: RCTBridge.current(), moduleName: "FWCustomCTALinkContentContainer", initialProperties: ["url": url ?? ""])
|
|
21
|
+
view.addSubview(rctRootView)
|
|
22
|
+
rctRootView.translatesAutoresizingMaskIntoConstraints = false
|
|
23
|
+
|
|
24
|
+
NSLayoutConstraint.activate([
|
|
25
|
+
rctRootView.leftAnchor.constraint(equalTo: view.leftAnchor),
|
|
26
|
+
rctRootView.topAnchor.constraint(equalTo: view.topAnchor),
|
|
27
|
+
rctRootView.rightAnchor.constraint(equalTo: view.rightAnchor),
|
|
28
|
+
rctRootView.bottomAnchor.constraint(equalTo: view.bottomAnchor)
|
|
29
|
+
])
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -15,7 +15,16 @@ extension FireworkSDKModule: FireworkVideoCTADelegate {
|
|
|
15
15
|
sendEvent(withName: FWEventName.LogMessage.rawValue, body: ["message": "[iOS] Receive CustomCTAClick event \(formatter.string(from: Date()))"])
|
|
16
16
|
|
|
17
17
|
sendEvent(withName: FWEventName.CustomCTAClick.rawValue, body: ["url": url.absoluteString])
|
|
18
|
+
|
|
19
|
+
if customCTALinkContentRenderEnabled, let presentedVC = RCTPresentedViewController() {
|
|
20
|
+
let customCTALinkContentContainerVC = FWCustomCTALinkContentContainerViewController()
|
|
21
|
+
customCTALinkContentContainerVC.modalPresentationStyle = .fullScreen
|
|
22
|
+
customCTALinkContentContainerVC.url = url.absoluteString
|
|
23
|
+
presentedVC.present(customCTALinkContentContainerVC, animated: true) {
|
|
24
|
+
|
|
25
|
+
}
|
|
26
|
+
}
|
|
18
27
|
|
|
19
|
-
return customCTAClickEnabled
|
|
28
|
+
return customCTAClickEnabled || customCTALinkContentRenderEnabled
|
|
20
29
|
}
|
|
21
30
|
}
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
_RCT_EXTERN_REMAP_METHOD(init, initializeSDK:(NSString * __nullable)userId, NO)
|
|
14
14
|
RCT_EXTERN_METHOD(openVideoPlayer:(NSString *)url config:(NSDictionary *)config)
|
|
15
15
|
RCT_EXTERN_METHOD(setCustomCTAClickEnabled:(BOOL)enabled)
|
|
16
|
+
RCT_EXTERN_METHOD(setCustomCTALinkContentRenderEnabled:(BOOL)enabled)
|
|
16
17
|
RCT_EXTERN_METHOD(setShareBaseURL:(NSString *)url resolver: (RCTPromiseResolveBlock)resolver rejecter:(RCTPromiseRejectBlock)rejecter)
|
|
17
18
|
RCT_EXTERN_METHOD(setVideoPlaybackEventEnabled:(BOOL)enabled)
|
|
18
19
|
RCT_EXTERN_METHOD(setAdBadgeConfiguration:(NSDictionary *)config resolver: (RCTPromiseResolveBlock)resolver rejecter:(RCTPromiseRejectBlock)rejecter)
|
|
@@ -16,7 +16,9 @@ var gAdBadgeConfiguration: AdBadgeConfiguration?
|
|
|
16
16
|
class FireworkSDKModule: RCTEventEmitter, FireworkVideoSDKDelegate {
|
|
17
17
|
// var shareBaseURL: String?
|
|
18
18
|
var customCTAClickEnabled: Bool = false
|
|
19
|
-
|
|
19
|
+
|
|
20
|
+
var customCTALinkContentRenderEnabled: Bool = false
|
|
21
|
+
|
|
20
22
|
/// Decide whether to send video playback event to RN.
|
|
21
23
|
var enableVideoPlayBackEvent: Bool = false
|
|
22
24
|
|
|
@@ -48,13 +50,20 @@ class FireworkSDKModule: RCTEventEmitter, FireworkVideoSDKDelegate {
|
|
|
48
50
|
if let baseUrl = gShareBaseURL {
|
|
49
51
|
finalConfig.shareButton.behavior.baseURL = URL(string: baseUrl)
|
|
50
52
|
}
|
|
53
|
+
|
|
54
|
+
var feedContentConfig = VideoFeedContentConfiguration()
|
|
55
|
+
feedContentConfig.playerView = finalConfig
|
|
56
|
+
if let adBadge = FireworkSDKModule.convertToFWAdBadgeConfiguration(gAdBadgeConfiguration) {
|
|
57
|
+
feedContentConfig.adBadge = adBadge;
|
|
58
|
+
}
|
|
51
59
|
|
|
52
60
|
DispatchQueue.main.async {
|
|
53
61
|
guard let presentedVC = RCTPresentedViewController() else {
|
|
54
62
|
return
|
|
55
63
|
}
|
|
56
|
-
|
|
57
|
-
|
|
64
|
+
|
|
65
|
+
VideoFeedViewController.openVideoPlayer(with: urlString, feedContentConfig, presentedVC) { _ in
|
|
66
|
+
|
|
58
67
|
}
|
|
59
68
|
}
|
|
60
69
|
}
|
|
@@ -63,6 +72,11 @@ class FireworkSDKModule: RCTEventEmitter, FireworkVideoSDKDelegate {
|
|
|
63
72
|
func setCustomCTAClickEnabled(_ enabled: Bool) {
|
|
64
73
|
customCTAClickEnabled = enabled
|
|
65
74
|
}
|
|
75
|
+
|
|
76
|
+
@objc(setCustomCTALinkContentRenderEnabled:)
|
|
77
|
+
func setCustomCTALinkContentRenderEnabled(_ enabled: Bool) {
|
|
78
|
+
customCTALinkContentRenderEnabled = enabled
|
|
79
|
+
}
|
|
66
80
|
|
|
67
81
|
@objc(setShareBaseURL:resolver:rejecter:)
|
|
68
82
|
func setShareBaseURL(_ url: String, resolver: RCTPromiseResolveBlock, rejecter: RCTPromiseRejectBlock) {
|
|
@@ -90,3 +104,27 @@ class FireworkSDKModule: RCTEventEmitter, FireworkVideoSDKDelegate {
|
|
|
90
104
|
sendEvent(withName: FWEventName.SDKInit.rawValue, body: ["error": ["name": error.jsErrorName, "reason": error.recoverySuggestion ?? "default"]])
|
|
91
105
|
}
|
|
92
106
|
}
|
|
107
|
+
|
|
108
|
+
extension FireworkSDKModule {
|
|
109
|
+
static func convertToFWAdBadgeConfiguration(_ adBadgeConfiguration: AdBadgeConfiguration?) -> FireworkVideo.AdBadgeConfiguration? {
|
|
110
|
+
guard let adBadgeConfiguration = adBadgeConfiguration else {
|
|
111
|
+
return nil
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
var fwAdBadgeConfiguration = FireworkVideo.AdBadgeConfiguration()
|
|
115
|
+
if let textColor = adBadgeConfiguration.textColor {
|
|
116
|
+
fwAdBadgeConfiguration.textColor = textColor.uicolor()
|
|
117
|
+
}
|
|
118
|
+
if let backgroundColor = adBadgeConfiguration.backgroundColor {
|
|
119
|
+
fwAdBadgeConfiguration.backgroundColor = backgroundColor.uicolor()
|
|
120
|
+
}
|
|
121
|
+
switch adBadgeConfiguration.badgeTextType {
|
|
122
|
+
case .sponsored:
|
|
123
|
+
fwAdBadgeConfiguration.badgeText = FireworkVideo.AdBadgeConfiguration.BadgeText.sponsored
|
|
124
|
+
default:
|
|
125
|
+
fwAdBadgeConfiguration.badgeText = FireworkVideo.AdBadgeConfiguration.BadgeText.ad
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
return fwAdBadgeConfiguration
|
|
129
|
+
}
|
|
130
|
+
}
|
|
@@ -56,6 +56,22 @@ class FireworkSDK {
|
|
|
56
56
|
_FireworkSDKModule.default.setCustomCTAClickEnabled(value ? true : false);
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
+
/**
|
|
60
|
+
* The custom render method of CTA link content.
|
|
61
|
+
* We will show a native container to display the element returned by the render method.
|
|
62
|
+
*/
|
|
63
|
+
get customCTALinkContentRender() {
|
|
64
|
+
return this._customCTALinkContentRender;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
set customCTALinkContentRender(value) {
|
|
68
|
+
_FWLoggerUtil.default.log(`Set customCTALinkContentRender ${!!value}`);
|
|
69
|
+
|
|
70
|
+
this._customCTALinkContentRender = value;
|
|
71
|
+
|
|
72
|
+
_FireworkSDKModule.default.setCustomCTALinkContentRenderEnabled(value ? true : false);
|
|
73
|
+
}
|
|
74
|
+
|
|
59
75
|
/**
|
|
60
76
|
* The callback of video playback.
|
|
61
77
|
*/
|
|
@@ -147,6 +163,8 @@ class FireworkSDK {
|
|
|
147
163
|
|
|
148
164
|
_defineProperty(this, "_onCustomCTAClick", void 0);
|
|
149
165
|
|
|
166
|
+
_defineProperty(this, "_customCTALinkContentRender", void 0);
|
|
167
|
+
|
|
150
168
|
_defineProperty(this, "_onVideoPlayback", void 0);
|
|
151
169
|
|
|
152
170
|
_defineProperty(this, "_shareBaseURL", void 0);
|
|
@@ -154,6 +172,8 @@ class FireworkSDK {
|
|
|
154
172
|
_defineProperty(this, "_adBadgeConfiguration", void 0);
|
|
155
173
|
|
|
156
174
|
this.eventEmitter.addListener(_FWEventName.FWEventName.SDKInit, event => {
|
|
175
|
+
_FWLoggerUtil.default.log(`Receive SDKInit event ${event === null || event === void 0 ? void 0 : event.error}`);
|
|
176
|
+
|
|
157
177
|
if (this.onSDKInit) {
|
|
158
178
|
this.onSDKInit(event !== null && event !== void 0 ? event : {});
|
|
159
179
|
}
|
|
@@ -162,18 +182,22 @@ class FireworkSDK {
|
|
|
162
182
|
_FWLoggerUtil.default.logNativeMessage(event.message);
|
|
163
183
|
});
|
|
164
184
|
this.eventEmitter.addListener(_FWEventName.FWEventName.CustomCTAClick, event => {
|
|
165
|
-
_FWLoggerUtil.default.log(`Receive CustomCTAClick url ${event.url}`);
|
|
185
|
+
_FWLoggerUtil.default.log(`Receive CustomCTAClick url ${event === null || event === void 0 ? void 0 : event.url}`);
|
|
166
186
|
|
|
167
187
|
if (this.onCustomCTAClick) {
|
|
168
188
|
this.onCustomCTAClick(event !== null && event !== void 0 ? event : {});
|
|
169
189
|
}
|
|
170
190
|
});
|
|
171
191
|
this.eventEmitter.addListener(_FWEventName.FWEventName.VideoPlayback, event => {
|
|
192
|
+
_FWLoggerUtil.default.log(`Receive VideoPlayback event ${event === null || event === void 0 ? void 0 : event.eventName}`);
|
|
193
|
+
|
|
172
194
|
if (this.onVideoPlayback) {
|
|
173
195
|
this.onVideoPlayback(event !== null && event !== void 0 ? event : {});
|
|
174
196
|
}
|
|
175
197
|
});
|
|
176
198
|
this.eventEmitter.addListener(_FWEventName.FWEventName.VideoFeedClick, event => {
|
|
199
|
+
_FWLoggerUtil.default.log(`Receive VideoFeedClick event ${event === null || event === void 0 ? void 0 : event.info.id}`);
|
|
200
|
+
|
|
177
201
|
if (this.onVideoFeedClick) {
|
|
178
202
|
this.onVideoFeedClick(event !== null && event !== void 0 ? event : {});
|
|
179
203
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["FireworkSDK.ts"],"names":["FireworkSDK","onCustomCTAClick","_onCustomCTAClick","value","FWLoggerUtil","log","FireworkSDKModule","setCustomCTAClickEnabled","onVideoPlayback","_onVideoPlayback","setVideoPlaybackEventEnabled","shareBaseURL","_shareBaseURL","setShareBaseURL","then","eventEmitter","emit","FWEventName","ShareBaseURLUpdated","adBadgeConfiguration","_adBadgeConfiguration","setAdBadgeConfiguration","AdBadgeConfigurationUpdated","FireworkSDKModuleEventEmitter","shopping","VideoShopping","getInstance","liveStream","LiveStream","navigator","FWNavigator","_instance","constructor","addListener","SDKInit","event","onSDKInit","LogMessage","logNativeMessage","message","CustomCTAClick","url","VideoPlayback","VideoFeedClick","onVideoFeedClick","init","userId","ShoppingModule","LiveStreamModule","openVideoPlayer","config"],"mappings":";;;;;;;AACA;;AAGA;;AAQA;;AAGA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;AAOA;AACA;AACA;AACA,MAAMA,WAAN,CAAkB;AAGhB;AACF;AACA;;AAGE;AACF;AACA;;AAGE;AACF;AACA;AAC6B,MAAhBC,gBAAgB,GAAuC;AAChE,WAAO,KAAKC,iBAAZ;AACD;;AAC0B,MAAhBD,gBAAgB,CAACE,KAAD,EAA4C;AACrEC,0BAAaC,GAAb,CAAkB,iCAAgC,CAAC,CAACF,KAAM,EAA1D;;AACA,SAAKD,iBAAL,GAAyBC,KAAzB;;AACAG,+BAAkBC,wBAAlB,CAA2CJ,KAAK,GAAG,IAAH,GAAU,KAA1D;AACD;;AAGD;AACF;AACA;AAC4B,MAAfK,eAAe,GAAsC;AAC9D,WAAO,KAAKC,gBAAZ;AACD;;AACyB,MAAfD,eAAe,CAACL,KAAD,EAA2C;AACnE,SAAKM,gBAAL,GAAwBN,KAAxB;;AACAG,+BAAkBI,4BAAlB,CAA+CP,KAAK,GAAG,IAAH,GAAU,KAA9D;AACD;;AAGD;AACF;AACA;AACyB,MAAZQ,YAAY,GAAu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AkB2C,eAAlB,CAAkCR,GAAlC,EAAuCS,MAAvC,aAAuCA,MAAvC,cAAuCA,MAAvC,GAAiD,EAAjD;AACD;;AAxJe;;gBAAZlD,W;;eA2JSA,W","sourcesContent":["import type { NativeEventEmitter } from 'react-native';\nimport LiveStream from './LiveStream';\n\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 VideoPlayerConfiguration from './models/VideoPlayerConfiguration';\nimport FireworkSDKModule, {\n FireworkSDKModuleEventEmitter,\n} from './modules/FireworkSDKModule';\nimport LiveStreamModule from './modules/LiveStreamModule';\nimport ShoppingModule from './modules/ShoppingModule';\nimport VideoShopping from './VideoShopping';\nimport FWNavigator from './FWNavigator';\nimport FWLoggerUtil from './utils/FWLoggerUtil';\n\nexport type SDKInitCallback = (event: SDKInitEvent) => void;\nexport type CustomCTAClickCallback = (event: CustomCTAClickEvent) => void;\nexport type VideoPlaybackCallback = (event: VideoPlaybackEvent) => void;\nexport type VideoFeedClickCallback = (event: VideoFeedClickEvent) => void;\n\n/**\n * Entry class of Firework SDK, which supports the sdk initialization and global configuration.\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 onVideoFeedClick?: VideoFeedClickCallback;\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 share base URL of videos.\n */\n public get shareBaseURL(): string | undefined {\n return this._shareBaseURL;\n }\n public set shareBaseURL(value: string | undefined) {\n this._shareBaseURL = value;\n FireworkSDKModule.setShareBaseURL(value).then(() => {\n this.eventEmitter.emit(FWEventName.ShareBaseURLUpdated);\n });\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 this._adBadgeConfiguration = value;\n FireworkSDKModule.setAdBadgeConfiguration(value).then(() => {\n this.eventEmitter.emit(FWEventName.AdBadgeConfigurationUpdated);\n });\n }\n private _adBadgeConfiguration?: AdBadgeConfiguration | 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 VideoShopping.getInstance();\n }\n\n /**\n * Get LiveStream object.\n */\n public get liveStream(): LiveStream {\n return LiveStream.getInstance();\n }\n\n /**\n * Get FWNavigator object.\n */\n public get navigator(): FWNavigator {\n return FWNavigator.getInstance();\n }\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 this.eventEmitter.addListener(FWEventName.SDKInit, (event) => {\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\n if (this.onCustomCTAClick) {\n this.onCustomCTAClick(event ?? {});\n }\n });\n\n this.eventEmitter.addListener(FWEventName.VideoPlayback, (event) => {\n if (this.onVideoPlayback) {\n this.onVideoPlayback(event ?? {});\n }\n });\n\n this.eventEmitter.addListener(FWEventName.VideoFeedClick, (event) => {\n if (this.onVideoFeedClick) {\n this.onVideoFeedClick(event ?? {});\n }\n });\n }\n\n /**\n * Initializes Firework SDK.\n * @param {string?} userId An id to uniquely identify device or user.\n */\n public init(userId?: string) {\n FireworkSDKModule.init(userId);\n ShoppingModule.init();\n LiveStreamModule.init();\n }\n\n /**\n * Open Video URL.\n * @param {string} url\n * @param {VideoPlayerConfiguration} config\n */\n public openVideoPlayer(url: string, config?: VideoPlayerConfiguration) {\n FireworkSDKModule.openVideoPlayer(url, config ?? {});\n }\n}\n\nexport default FireworkSDK;\n"]}
|
|
1
|
+
{"version":3,"sources":["FireworkSDK.ts"],"names":["FireworkSDK","onCustomCTAClick","_onCustomCTAClick","value","FWLoggerUtil","log","FireworkSDKModule","setCustomCTAClickEnabled","customCTALinkContentRender","_customCTALinkContentRender","setCustomCTALinkContentRenderEnabled","onVideoPlayback","_onVideoPlayback","setVideoPlaybackEventEnabled","shareBaseURL","_shareBaseURL","setShareBaseURL","then","eventEmitter","emit","FWEventName","ShareBaseURLUpdated","adBadgeConfiguration","_adBadgeConfiguration","setAdBadgeConfiguration","AdBadgeConfigurationUpdated","FireworkSDKModuleEventEmitter","shopping","VideoShopping","getInstance","liveStream","LiveStream","navigator","FWNavigator","_instance","constructor","addListener","SDKInit","event","error","onSDKInit","LogMessage","logNativeMessage","message","CustomCTAClick","url","VideoPlayback","eventName","VideoFeedClick","info","id","onVideoFeedClick","init","userId","ShoppingModule","LiveStreamModule","openVideoPlayer","config"],"mappings":";;;;;;;AACA;;AAGA;;A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D;AAED;AACF;AACA;AACA;AACA;;;AACSI,EAAAA,eAAe,CAACX,GAAD,EAAcY,MAAd,EAAiD;AACrEnD,+BAAkBkD,eAAlB,CAAkCX,GAAlC,EAAuCY,MAAvC,aAAuCA,MAAvC,cAAuCA,MAAvC,GAAiD,EAAjD;AACD;;AAlLe;;gBAAZzD,W;;eAqLSA,W","sourcesContent":["import type { NativeEventEmitter } from 'react-native';\nimport LiveStream from './LiveStream';\n\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 VideoPlayerConfiguration from './models/VideoPlayerConfiguration';\nimport FireworkSDKModule, {\n FireworkSDKModuleEventEmitter,\n} from './modules/FireworkSDKModule';\nimport LiveStreamModule from './modules/LiveStreamModule';\nimport ShoppingModule from './modules/ShoppingModule';\nimport VideoShopping from './VideoShopping';\nimport FWNavigator from './FWNavigator';\nimport FWLoggerUtil from './utils/FWLoggerUtil';\n\nexport type SDKInitCallback = (event: SDKInitEvent) => void;\nexport type CustomCTAClickCallback = (event: CustomCTAClickEvent) => void;\nexport type CustomCTALinkContentRender = (\n event: CustomCTAClickEvent\n) => React.ReactNode | null;\nexport type VideoPlaybackCallback = (event: VideoPlaybackEvent) => void;\nexport type VideoFeedClickCallback = (event: VideoFeedClickEvent) => void;\n\n/**\n * Entry class of Firework SDK, which supports the sdk initialization and global configuration.\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 onVideoFeedClick?: VideoFeedClickCallback;\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 custom render method of CTA link content.\n * We will show a native container to display the element returned by the render method.\n */\n public get customCTALinkContentRender():\n | CustomCTALinkContentRender\n | undefined {\n return this._customCTALinkContentRender;\n }\n public set customCTALinkContentRender(\n value: CustomCTALinkContentRender | undefined\n ) {\n FWLoggerUtil.log(`Set customCTALinkContentRender ${!!value}`);\n this._customCTALinkContentRender = value;\n FireworkSDKModule.setCustomCTALinkContentRenderEnabled(\n value ? true : false\n );\n }\n private _customCTALinkContentRender: CustomCTALinkContentRender | 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 share base URL of videos.\n */\n public get shareBaseURL(): string | undefined {\n return this._shareBaseURL;\n }\n public set shareBaseURL(value: string | undefined) {\n this._shareBaseURL = value;\n FireworkSDKModule.setShareBaseURL(value).then(() => {\n this.eventEmitter.emit(FWEventName.ShareBaseURLUpdated);\n });\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 this._adBadgeConfiguration = value;\n FireworkSDKModule.setAdBadgeConfiguration(value).then(() => {\n this.eventEmitter.emit(FWEventName.AdBadgeConfigurationUpdated);\n });\n }\n private _adBadgeConfiguration?: AdBadgeConfiguration | 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 VideoShopping.getInstance();\n }\n\n /**\n * Get LiveStream object.\n */\n public get liveStream(): LiveStream {\n return LiveStream.getInstance();\n }\n\n /**\n * Get FWNavigator object.\n */\n public get navigator(): FWNavigator {\n return FWNavigator.getInstance();\n }\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 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\n if (this.onCustomCTAClick) {\n this.onCustomCTAClick(event ?? {});\n }\n });\n\n this.eventEmitter.addListener(FWEventName.VideoPlayback, (event) => {\n FWLoggerUtil.log(`Receive VideoPlayback event ${event?.eventName}`);\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 ${event?.info.id}`);\n\n if (this.onVideoFeedClick) {\n this.onVideoFeedClick(event ?? {});\n }\n });\n }\n\n /**\n * Initializes Firework SDK.\n * @param {string?} userId An id to uniquely identify device or user.\n */\n public init(userId?: string) {\n FireworkSDKModule.init(userId);\n ShoppingModule.init();\n LiveStreamModule.init();\n }\n\n /**\n * Open Video URL.\n * @param {string} url\n * @param {VideoPlayerConfiguration} config\n */\n public openVideoPlayer(url: string, config?: VideoPlayerConfiguration) {\n FireworkSDKModule.openVideoPlayer(url, config ?? {});\n }\n}\n\nexport default FireworkSDK;\n"]}
|
|
@@ -144,7 +144,6 @@ class VideoShopping {
|
|
|
144
144
|
const callbackId = event.callbackId;
|
|
145
145
|
delete event.callbackId;
|
|
146
146
|
const productList = await this.onUpdateProductDetails(event);
|
|
147
|
-
console.log('handleUpdateProductDetailsEvent productList', JSON.stringify(productList));
|
|
148
147
|
|
|
149
148
|
if (productList) {
|
|
150
149
|
_ShoppingModule.default.updateVideoProducts(productList, callbackId);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["VideoShopping.ts"],"names":["VideoShopping","cartIconVisible","_cartIconVisible","value","ShoppingModule","setCartIconVisible","eventEmitter","ShoppingModuleEventEmitter","getInstance","_instance","constructor","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","
|
|
1
|
+
{"version":3,"sources":["VideoShopping.ts"],"names":["VideoShopping","cartIconVisible","_cartIconVisible","value","ShoppingModule","setCartIconVisible","eventEmitter","ShoppingModuleEventEmitter","getInstance","_instance","constructor","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","updateVideoProducts","onWillDisplayProduct","config","updateProductViewConfig"],"mappings":";;;;;;;AAQA;;AAGA;;;;;;;;AAoBA;AACA;AACA;AACA,MAAMA,aAAN,CAAoB;AAGlB;AACF;AACA;AACA;AACA;;AAGE;AACF;AACA;AACA;AACA;;AAGE;AACF;AACA;AACA;AACA;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B;;AAGA,UAAIyB,MAAJ,EAAY;AACVnC,gCAAeoC,uBAAf,CAAuCD,MAAvC,EAA+Cb,UAA/C;AACD;AACF;AACF;;AApJiB;;gBAAd1B,a;;eAuJSA,a","sourcesContent":["import type { NativeEventEmitter } from 'react-native';\n\nimport type AddToCartResult from './models/AddToCartResult';\nimport type {\n AddToCartEvent,\n UpdateProductDetailsEvent,\n WillDisplayProductEvent,\n} from './models/FWEvents';\nimport { FWEventName } from './models/FWEventName';\nimport type Product from './models/Product';\nimport type ProductInfoViewConfiguration from './models/ProductInfoViewConfiguration';\nimport ShoppingModule, { ShoppingModuleEventEmitter } 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 * 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\" 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 list 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 private _cartIconVisible: boolean = true;\n\n public currentCartPage?: React.ReactNode;\n\n private get eventEmitter(): NativeEventEmitter {\n return ShoppingModuleEventEmitter;\n }\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.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 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"]}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
|
|
10
|
+
var _reactNative = require("react-native");
|
|
11
|
+
|
|
12
|
+
var _FireworkSDK = _interopRequireDefault(require("../FireworkSDK"));
|
|
13
|
+
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
+
|
|
16
|
+
const CustomCTALinkContentContainer = _ref => {
|
|
17
|
+
let {
|
|
18
|
+
url = ''
|
|
19
|
+
} = _ref;
|
|
20
|
+
|
|
21
|
+
const customCTALinkContentRender = _FireworkSDK.default.getInstance().customCTALinkContentRender;
|
|
22
|
+
|
|
23
|
+
let content = customCTALinkContentRender === null || customCTALinkContentRender === void 0 ? void 0 : customCTALinkContentRender({
|
|
24
|
+
url
|
|
25
|
+
});
|
|
26
|
+
return /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
27
|
+
style: styles.container
|
|
28
|
+
}, content);
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
var _default = CustomCTALinkContentContainer;
|
|
32
|
+
exports.default = _default;
|
|
33
|
+
|
|
34
|
+
const styles = _reactNative.StyleSheet.create({
|
|
35
|
+
container: {
|
|
36
|
+
flex: 1
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
//# sourceMappingURL=CustomCTALinkContentContainer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["CustomCTALinkContentContainer.tsx"],"names":["CustomCTALinkContentContainer","url","customCTALinkContentRender","FireworkSDK","getInstance","content","styles","container","StyleSheet","create","flex"],"mappings":";;;;;;;AAAA;;AAEA;;AAEA;;;;AAMA,MAAMA,6BAA6B,GAAG,QAEK;AAAA,MAFJ;AACrCC,IAAAA,GAAG,GAAG;AAD+B,GAEI;;AACzC,QAAMC,0BAA0B,GAC9BC,qBAAYC,WAAZ,GAA0BF,0BAD5B;;AAEA,MAAIG,OAAO,GAAGH,0BAAH,aAAGA,0BAAH,uBAAGA,0BAA0B,CAAG;AAAED,IAAAA;AAAF,GAAH,CAAxC;AACA,sBAAO,6BAAC,iBAAD;AAAM,IAAA,KAAK,EAAEK,MAAM,CAACC;AAApB,KAAgCF,OAAhC,CAAP;AACD,CAPD;;eASeL,6B;;;AAEf,MAAMM,MAAM,GAAGE,wBAAWC,MAAX,CAAkB;AAC/BF,EAAAA,SAAS,EAAE;AACTG,IAAAA,IAAI,EAAE;AADG;AADoB,CAAlB,CAAf","sourcesContent":["import React from 'react';\n\nimport { StyleSheet, View } from 'react-native';\n\nimport FireworkSDK from '../FireworkSDK';\n\nexport interface ICustomCTALinkContentContainerProps {\n url?: string;\n}\n\nconst CustomCTALinkContentContainer = ({\n url = '',\n}: ICustomCTALinkContentContainerProps) => {\n const customCTALinkContentRender =\n FireworkSDK.getInstance().customCTALinkContentRender;\n let content = customCTALinkContentRender?.({ url });\n return <View style={styles.container}>{content}</View>;\n};\n\nexport default CustomCTALinkContentContainer;\n\nconst styles = StyleSheet.create({\n container: {\n flex: 1,\n },\n});\n"]}
|