react-native-firework-sdk 1.2.0-beta.7 → 1.2.0-beta.8
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/src/main/java/com/fireworksdk/bridge/reactnative/utils/FWEventUtils.kt +6 -3
- package/ios/FireworkSdk.xcodeproj/project.pbxproj +0 -4
- package/ios/Modules/FWNavigatorModule/FWNavigatorContainerViewController.swift +3 -11
- package/ios/Modules/FWNavigatorModule/FWNavigatorModule.m +2 -2
- package/ios/Modules/FWNavigatorModule/FWNavigatorModule.swift +23 -4
- package/ios/Modules/FWNavigatorModule/FWNavigatorProtocol.swift +2 -2
- package/ios/Modules/FireworkSDKModule/FireworkSDKModule+CTA.swift +16 -6
- package/ios/Modules/FireworkSDKModule/FireworkSDKModule.m +2 -1
- package/ios/Modules/FireworkSDKModule/FireworkSDKModule.swift +12 -4
- package/lib/commonjs/FWNavigator.js +7 -13
- package/lib/commonjs/FWNavigator.js.map +1 -1
- package/lib/commonjs/FireworkSDK.js +22 -10
- package/lib/commonjs/FireworkSDK.js.map +1 -1
- package/lib/commonjs/index.js +0 -8
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/modules/FWNavigatorModule.js.map +1 -1
- package/lib/commonjs/modules/FireworkSDKModule.js.map +1 -1
- package/lib/commonjs/utils/FWLoggerUtil.js +6 -2
- package/lib/commonjs/utils/FWLoggerUtil.js.map +1 -1
- package/lib/module/FWNavigator.js +8 -14
- package/lib/module/FWNavigator.js.map +1 -1
- package/lib/module/FireworkSDK.js +21 -9
- package/lib/module/FireworkSDK.js.map +1 -1
- package/lib/module/index.js +0 -4
- package/lib/module/index.js.map +1 -1
- package/lib/module/modules/FWNavigatorModule.js.map +1 -1
- package/lib/module/modules/FireworkSDKModule.js.map +1 -1
- package/lib/module/utils/FWLoggerUtil.js +6 -2
- package/lib/module/utils/FWLoggerUtil.js.map +1 -1
- package/lib/typescript/FWNavigator.d.ts +8 -7
- package/lib/typescript/FireworkSDK.d.ts +11 -6
- package/lib/typescript/modules/FWNavigatorModule.d.ts +3 -1
- package/lib/typescript/modules/FireworkSDKModule.d.ts +2 -1
- package/lib/typescript/utils/FWLoggerUtil.d.ts +1 -0
- package/package.json +1 -1
- package/src/FWNavigator.tsx +12 -11
- package/src/FireworkSDK.ts +22 -18
- package/src/index.tsx +0 -10
- package/src/modules/FWNavigatorModule.ts +1 -1
- package/src/modules/FireworkSDKModule.ts +2 -1
- package/src/utils/FWLoggerUtil.ts +3 -2
- package/ios/Modules/FireworkSDKModule/FWCustomCTALinkContentContainerViewController.swift +0 -31
- package/lib/commonjs/components/CustomCTALinkContentContainer.js +0 -43
- package/lib/commonjs/components/CustomCTALinkContentContainer.js.map +0 -1
- package/lib/commonjs/components/NavigationContainer.js +0 -40
- package/lib/commonjs/components/NavigationContainer.js.map +0 -1
- package/lib/module/components/CustomCTALinkContentContainer.js +0 -26
- package/lib/module/components/CustomCTALinkContentContainer.js.map +0 -1
- package/lib/module/components/NavigationContainer.js +0 -23
- package/lib/module/components/NavigationContainer.js.map +0 -1
- package/lib/typescript/components/CustomCTALinkContentContainer.d.ts +0 -6
- package/lib/typescript/components/NavigationContainer.d.ts +0 -6
- package/src/components/CustomCTALinkContentContainer.tsx +0 -28
- package/src/components/NavigationContainer.tsx +0 -24
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
package com.fireworksdk.bridge.reactnative.utils
|
|
2
2
|
|
|
3
|
+
import android.util.Log
|
|
3
4
|
import com.facebook.react.bridge.Arguments
|
|
4
5
|
import com.facebook.react.bridge.ReactContext
|
|
5
6
|
import com.facebook.react.bridge.WritableMap
|
|
@@ -113,9 +114,11 @@ object FWEventUtils {
|
|
|
113
114
|
fun sendLogMessageEvent(reactContext: ReactContext, message: String?) {
|
|
114
115
|
FWLogUtils.d { message }
|
|
115
116
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
117
|
+
if (Log.DEBUG >= FWLogUtils.logLevel) {
|
|
118
|
+
val eventMap = Arguments.createMap()
|
|
119
|
+
eventMap.putString("message", message)
|
|
120
|
+
sendEvent(reactContext, FWEventName.LogMessage.rawValue, eventMap)
|
|
121
|
+
}
|
|
119
122
|
}
|
|
120
123
|
|
|
121
124
|
fun receiveVideoFeedLoadFinishedSuccessEvent(reactContext: ReactContext, targetTag: Int) {
|
|
@@ -37,7 +37,6 @@
|
|
|
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 */; };
|
|
41
40
|
/* End PBXBuildFile section */
|
|
42
41
|
|
|
43
42
|
/* Begin PBXCopyFilesBuildPhase section */
|
|
@@ -86,7 +85,6 @@
|
|
|
86
85
|
897523832817DEF80070EBB6 /* FireworkSDKModule.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FireworkSDKModule.m; sourceTree = "<group>"; };
|
|
87
86
|
897523852817DEF80070EBB6 /* LiveStreamModule.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LiveStreamModule.swift; sourceTree = "<group>"; };
|
|
88
87
|
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>"; };
|
|
90
88
|
/* End PBXFileReference section */
|
|
91
89
|
|
|
92
90
|
/* Begin PBXFrameworksBuildPhase section */
|
|
@@ -214,7 +212,6 @@
|
|
|
214
212
|
897523812817DEF80070EBB6 /* AdBadgeConfiguration.swift */,
|
|
215
213
|
897523822817DEF80070EBB6 /* FireworkSDKModule+CTA.swift */,
|
|
216
214
|
897523832817DEF80070EBB6 /* FireworkSDKModule.m */,
|
|
217
|
-
89BA1733283619FE00C2287A /* FWCustomCTALinkContentContainerViewController.swift */,
|
|
218
215
|
);
|
|
219
216
|
path = FireworkSDKModule;
|
|
220
217
|
sourceTree = "<group>";
|
|
@@ -304,7 +301,6 @@
|
|
|
304
301
|
8975239A2817DEF80070EBB6 /* FireworkSDKModule+EventTracking.swift in Sources */,
|
|
305
302
|
8975239E2817DEF80070EBB6 /* FireworkSDKModule.m in Sources */,
|
|
306
303
|
897523962817DEF80070EBB6 /* ProductInfoViewConfiguration.swift in Sources */,
|
|
307
|
-
89BA1734283619FE00C2287A /* FWCustomCTALinkContentContainerViewController.swift in Sources */,
|
|
308
304
|
8975238D2817DEF80070EBB6 /* RCTConvert+VideoFeed.swift in Sources */,
|
|
309
305
|
8975238C2817DEF80070EBB6 /* RCTConvert+Shopping.swift in Sources */,
|
|
310
306
|
897523602817DEEE0070EBB6 /* VideoFeed.swift in Sources */,
|
|
@@ -8,16 +8,8 @@
|
|
|
8
8
|
import UIKit
|
|
9
9
|
|
|
10
10
|
class FWNavigatorContainerViewController: UIViewController {
|
|
11
|
-
var
|
|
12
|
-
|
|
13
|
-
init(callbackId: String) {
|
|
14
|
-
self.callbackId = callbackId
|
|
15
|
-
super.init(nibName: nil, bundle: nil)
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
required init?(coder: NSCoder) {
|
|
19
|
-
super.init(coder: coder)
|
|
20
|
-
}
|
|
11
|
+
var moduleName: String = ""
|
|
12
|
+
var properties: [String: Any] = [:]
|
|
21
13
|
|
|
22
14
|
override func viewDidLoad() {
|
|
23
15
|
super.viewDidLoad()
|
|
@@ -25,7 +17,7 @@ class FWNavigatorContainerViewController: UIViewController {
|
|
|
25
17
|
}
|
|
26
18
|
|
|
27
19
|
private func loadContent() {
|
|
28
|
-
let rctRootView = RCTRootView.init(bridge: RCTBridge.current(), moduleName:
|
|
20
|
+
let rctRootView = RCTRootView.init(bridge: RCTBridge.current(), moduleName: moduleName, initialProperties: properties)
|
|
29
21
|
view.addSubview(rctRootView)
|
|
30
22
|
rctRootView.translatesAutoresizingMaskIntoConstraints = false
|
|
31
23
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// FWNavigatorModule.m
|
|
3
3
|
// react-native-firework-sdk
|
|
4
4
|
//
|
|
5
|
-
// Created by
|
|
5
|
+
// Created by Big Bear Xiong on 2022/4/22.
|
|
6
6
|
//
|
|
7
7
|
|
|
8
8
|
// The FireworkNavigatorModule exposes instances of Objective-C (native) classes to JavaScript (JS) as JS objects
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
|
|
12
12
|
@interface RCT_EXTERN_REMAP_MODULE(FWNavigatorModule, FWNavigatorModule, NSObject)
|
|
13
13
|
|
|
14
|
-
RCT_EXTERN_METHOD(pushNativeContainer:(
|
|
14
|
+
RCT_EXTERN_METHOD(pushNativeContainer:(NSDictionary *)props resolver:(RCTPromiseResolveBlock)resolver rejecter:(RCTPromiseRejectBlock)rejecter)
|
|
15
15
|
RCT_EXTERN_METHOD(popNativeContainer:(RCTPromiseResolveBlock)resolver rejecter:(RCTPromiseRejectBlock)rejecter)
|
|
16
16
|
|
|
17
17
|
@end
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// File.swift
|
|
3
3
|
// react-native-firework-sdk
|
|
4
4
|
//
|
|
5
|
-
// Created by
|
|
5
|
+
// Created by Big Bear Xiong on 2022/4/21.
|
|
6
6
|
//
|
|
7
7
|
|
|
8
8
|
import FireworkVideo
|
|
@@ -18,13 +18,20 @@ class FWNavigatorModule: RCTEventEmitter, FWNavigator {
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
@objc(pushNativeContainer:resolver:rejecter:)
|
|
21
|
-
func pushNativeContainer(_
|
|
21
|
+
func pushNativeContainer(_ props: NSDictionary?, resolver: @escaping RCTPromiseResolveBlock, rejecter: @escaping RCTPromiseRejectBlock) {
|
|
22
|
+
#if DEBUG
|
|
22
23
|
let formatter = DateFormatter()
|
|
23
24
|
formatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSZ"
|
|
24
25
|
sendEvent(withName: FWEventName.LogMessage.rawValue, body: ["message": "[iOS] Enter pushNativeContainer \(formatter.string(from: Date()))"])
|
|
26
|
+
#endif
|
|
25
27
|
|
|
26
28
|
DispatchQueue.main.async {
|
|
27
|
-
guard let
|
|
29
|
+
guard let props = props as? [String: Any] else {
|
|
30
|
+
resolver(false)
|
|
31
|
+
return
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
guard let appComponentName = gAppComponentName else {
|
|
28
35
|
resolver(false)
|
|
29
36
|
return
|
|
30
37
|
}
|
|
@@ -33,18 +40,30 @@ class FWNavigatorModule: RCTEventEmitter, FWNavigator {
|
|
|
33
40
|
resolver(false)
|
|
34
41
|
return
|
|
35
42
|
}
|
|
43
|
+
|
|
44
|
+
#if DEBUG
|
|
36
45
|
self.sendEvent(withName: FWEventName.LogMessage.rawValue, body: ["message": "[iOS] Before creating containerViewController \(formatter.string(from: Date()))"])
|
|
46
|
+
#endif
|
|
37
47
|
|
|
38
|
-
let containerViewController = FWNavigatorContainerViewController(
|
|
48
|
+
let containerViewController = FWNavigatorContainerViewController()
|
|
39
49
|
|
|
50
|
+
#if DEBUG
|
|
40
51
|
self.sendEvent(withName: FWEventName.LogMessage.rawValue, body: ["message": "[iOS] After creating containerViewController \(formatter.string(from: Date()))"])
|
|
52
|
+
#endif
|
|
41
53
|
|
|
54
|
+
containerViewController.moduleName = appComponentName
|
|
55
|
+
containerViewController.properties = props
|
|
42
56
|
containerViewController.modalPresentationStyle = .fullScreen
|
|
43
57
|
|
|
58
|
+
#if DEBUG
|
|
44
59
|
self.sendEvent(withName: FWEventName.LogMessage.rawValue, body: ["message": "[iOS] Present containerViewController \(formatter.string(from: Date()))"])
|
|
60
|
+
#endif
|
|
45
61
|
|
|
46
62
|
presentedVC.present(containerViewController, animated: true) {
|
|
63
|
+
#if DEBUG
|
|
47
64
|
self.sendEvent(withName: FWEventName.LogMessage.rawValue, body: ["message": "[iOS] Finish presenting containerViewController \(formatter.string(from: Date()))"])
|
|
65
|
+
#endif
|
|
66
|
+
|
|
48
67
|
resolver(true)
|
|
49
68
|
}
|
|
50
69
|
}
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
// FWNavigatorProtocol.swift
|
|
3
3
|
// react-native-firework-sdk
|
|
4
4
|
//
|
|
5
|
-
// Created by
|
|
5
|
+
// Created by Big Bear Xiong on 2022/4/21.
|
|
6
6
|
//
|
|
7
7
|
|
|
8
8
|
import Foundation
|
|
9
9
|
|
|
10
10
|
protocol FWNavigator {
|
|
11
|
-
func pushNativeContainer(_
|
|
11
|
+
func pushNativeContainer(_ props: NSDictionary?, resolver: @escaping RCTPromiseResolveBlock, rejecter: @escaping RCTPromiseRejectBlock)
|
|
12
12
|
func popNativeContainer(resolver: @escaping RCTPromiseResolveBlock, rejecter: @escaping RCTPromiseRejectBlock)
|
|
13
13
|
}
|
|
@@ -10,21 +10,31 @@ import FireworkVideo
|
|
|
10
10
|
|
|
11
11
|
extension FireworkSDKModule: FireworkVideoCTADelegate {
|
|
12
12
|
func handleCustomCTAClick(_ viewController: PlayerViewController, url: URL) -> Bool {
|
|
13
|
+
#if DEBUG
|
|
13
14
|
let formatter = DateFormatter()
|
|
14
15
|
formatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSZ"
|
|
15
16
|
sendEvent(withName: FWEventName.LogMessage.rawValue, body: ["message": "[iOS] Receive CustomCTAClick event \(formatter.string(from: Date()))"])
|
|
17
|
+
#endif
|
|
16
18
|
|
|
17
19
|
sendEvent(withName: FWEventName.CustomCTAClick.rawValue, body: ["url": url.absoluteString])
|
|
18
20
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
var customCTALinkContentPageEnabled = false
|
|
22
|
+
if let moduleName = gAppComponentName,
|
|
23
|
+
let initialRouteName = customCTALinkContentPageRouteName,
|
|
24
|
+
let presentedVC = RCTPresentedViewController() {
|
|
25
|
+
customCTALinkContentPageEnabled = true
|
|
26
|
+
let containerViewController = FWNavigatorContainerViewController()
|
|
27
|
+
containerViewController.moduleName = moduleName
|
|
28
|
+
containerViewController.properties = [
|
|
29
|
+
"initialRouteName": initialRouteName,
|
|
30
|
+
"initialParams": ["url": url.absoluteString]
|
|
31
|
+
]
|
|
32
|
+
containerViewController.modalPresentationStyle = .fullScreen
|
|
33
|
+
presentedVC.present(containerViewController, animated: true) {
|
|
24
34
|
|
|
25
35
|
}
|
|
26
36
|
}
|
|
27
37
|
|
|
28
|
-
return customCTAClickEnabled ||
|
|
38
|
+
return customCTAClickEnabled || customCTALinkContentPageEnabled
|
|
29
39
|
}
|
|
30
40
|
}
|
|
@@ -13,9 +13,10 @@
|
|
|
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(
|
|
16
|
+
RCT_EXTERN_METHOD(setCustomCTALinkContentPageRouteName:(NSString *)name resolver: (RCTPromiseResolveBlock)resolver rejecter:(RCTPromiseRejectBlock)rejecter)
|
|
17
17
|
RCT_EXTERN_METHOD(setShareBaseURL:(NSString *)url resolver: (RCTPromiseResolveBlock)resolver rejecter:(RCTPromiseRejectBlock)rejecter)
|
|
18
18
|
RCT_EXTERN_METHOD(setVideoPlaybackEventEnabled:(BOOL)enabled)
|
|
19
19
|
RCT_EXTERN_METHOD(setAdBadgeConfiguration:(NSDictionary *)config resolver: (RCTPromiseResolveBlock)resolver rejecter:(RCTPromiseRejectBlock)rejecter)
|
|
20
|
+
RCT_EXTERN_METHOD(setAppComponentName:(NSString *)name resolver: (RCTPromiseResolveBlock)resolver rejecter:(RCTPromiseRejectBlock)rejecter)
|
|
20
21
|
|
|
21
22
|
@end
|
|
@@ -11,13 +11,14 @@ import FireworkVideo
|
|
|
11
11
|
|
|
12
12
|
var gShareBaseURL: String?
|
|
13
13
|
var gAdBadgeConfiguration: AdBadgeConfiguration?
|
|
14
|
+
var gAppComponentName: String?
|
|
14
15
|
|
|
15
16
|
@objc(FireworkSDKModule)
|
|
16
17
|
class FireworkSDKModule: RCTEventEmitter, FireworkVideoSDKDelegate {
|
|
17
18
|
// var shareBaseURL: String?
|
|
18
19
|
var customCTAClickEnabled: Bool = false
|
|
19
20
|
|
|
20
|
-
var
|
|
21
|
+
var customCTALinkContentPageRouteName: String?
|
|
21
22
|
|
|
22
23
|
/// Decide whether to send video playback event to RN.
|
|
23
24
|
var enableVideoPlayBackEvent: Bool = false
|
|
@@ -73,9 +74,10 @@ class FireworkSDKModule: RCTEventEmitter, FireworkVideoSDKDelegate {
|
|
|
73
74
|
customCTAClickEnabled = enabled
|
|
74
75
|
}
|
|
75
76
|
|
|
76
|
-
@objc(
|
|
77
|
-
func
|
|
78
|
-
|
|
77
|
+
@objc(setCustomCTALinkContentPageRouteName:resolver:rejecter:)
|
|
78
|
+
func setCustomCTALinkContentPageRouteName(_ name: String, resolver: RCTPromiseResolveBlock, rejecter: RCTPromiseRejectBlock) {
|
|
79
|
+
customCTALinkContentPageRouteName = name
|
|
80
|
+
resolver([:])
|
|
79
81
|
}
|
|
80
82
|
|
|
81
83
|
@objc(setShareBaseURL:resolver:rejecter:)
|
|
@@ -94,6 +96,12 @@ class FireworkSDKModule: RCTEventEmitter, FireworkVideoSDKDelegate {
|
|
|
94
96
|
gAdBadgeConfiguration = RCTConvert.adBadgeConfiguration(config)
|
|
95
97
|
resolver([:])
|
|
96
98
|
}
|
|
99
|
+
|
|
100
|
+
@objc(setAppComponentName:resolver:rejecter:)
|
|
101
|
+
func setAppComponentName(_ name: String, resolver: RCTPromiseResolveBlock, rejecter: RCTPromiseRejectBlock) {
|
|
102
|
+
gAppComponentName = name
|
|
103
|
+
resolver([:])
|
|
104
|
+
}
|
|
97
105
|
|
|
98
106
|
// MARK: - FireworkVideoSDKDelegate
|
|
99
107
|
func fireworkVideoDidLoadSuccessfully() {
|
|
@@ -32,26 +32,20 @@ class FWNavigator {
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
constructor() {
|
|
35
|
-
_defineProperty(this, "_currentCallbackId", 0);
|
|
36
|
-
|
|
37
|
-
_defineProperty(this, "navigatorPages", new Map());
|
|
38
|
-
|
|
39
35
|
_FWNavigatorModule.FWNavigatorModuleEventEmitter.addListener(_FWEventName.FWEventName.LogMessage, () => {});
|
|
40
36
|
}
|
|
41
37
|
/**
|
|
42
|
-
* Push
|
|
43
|
-
*
|
|
44
|
-
* @
|
|
38
|
+
* Push a new native container. We will render your app component in new native container.
|
|
39
|
+
* Please set your app component name through FireworkSDK.getInstance().appComponentName before calling this method
|
|
40
|
+
* @param {FWNativeContainerProps} props We will pass the props to your app component.
|
|
41
|
+
* @returns {Promise<boolean>} The result of pushing RN page from native page.
|
|
45
42
|
*/
|
|
46
43
|
|
|
47
44
|
|
|
48
|
-
pushNativeContainer(
|
|
49
|
-
_FWLoggerUtil.default.log(`Enter
|
|
45
|
+
pushNativeContainer(props) {
|
|
46
|
+
_FWLoggerUtil.default.log(`Enter pushNewNativeContainer`);
|
|
50
47
|
|
|
51
|
-
|
|
52
|
-
const callbackId = `${this._currentCallbackId}`;
|
|
53
|
-
this.navigatorPages.set(callbackId, page);
|
|
54
|
-
return _FWNavigatorModule.default.pushNativeContainer(callbackId);
|
|
48
|
+
return _FWNavigatorModule.default.pushNativeContainer(props);
|
|
55
49
|
}
|
|
56
50
|
/**
|
|
57
51
|
* Pop top-most native container. The native container embed the RN page.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["FWNavigator.tsx"],"names":["FWNavigator","getInstance","_instance","constructor","
|
|
1
|
+
{"version":3,"sources":["FWNavigator.tsx"],"names":["FWNavigator","getInstance","_instance","constructor","FWNavigatorModuleEventEmitter","addListener","FWEventName","LogMessage","pushNativeContainer","props","FWLoggerUtil","log","FWNavigatorModule","popNativeContainer"],"mappings":";;;;;;;AAAA;;AACA;;AAGA;;;;;;;;;;AAMA;AACA;AACA;AACA,MAAMA,WAAN,CAAkB;AAGS,SAAXC,WAAW,GAAgB;AACvC,QAAI,CAACD,WAAW,CAACE,SAAjB,EAA4B;AAC1BF,MAAAA,WAAW,CAACE,SAAZ,GAAwB,IAAIF,WAAJ,EAAxB;AACD;;AACD,WAAOA,WAAW,CAACE,SAAnB;AACD;;AAEOC,EAAAA,WAAW,GAAG;AACpBC,qDAA8BC,WAA9B,CAA0CC,yBAAYC,UAAtD,EAAkE,MAAM,CAAE,CAA1E;AACD;AAED;AACF;AACA;AACA;AACA;AACA;;;AACSC,EAAAA,mBAAmB,CAACC,KAAD,EAAkD;AAC1EC,0BAAaC,GAAb,CAAkB,8BAAlB;;AAEA,WAAOC,2BAAkBJ,mBAAlB,CAAsCC,KAAtC,CAAP;AACD;AAED;AACF;AACA;AACA;;;AACSI,EAAAA,kBAAkB,GAAqB;AAC5C,WAAOD,2BAAkBC,kBAAlB,EAAP;AACD;;AAhCe;;gBAAZb,W;;eAmCSA,W","sourcesContent":["import { FWEventName } from './models/FWEventName';\nimport FWNavigatorModule, {\n FWNavigatorModuleEventEmitter,\n} from './modules/FWNavigatorModule';\nimport FWLoggerUtil from './utils/FWLoggerUtil';\n\ntype FWNativeContainerProps = {\n [key: string]: any;\n};\n\n/**\n * You can use this class for pushing RN page from the native page.\n */\nclass FWNavigator {\n private static _instance?: FWNavigator;\n\n public static getInstance(): FWNavigator {\n if (!FWNavigator._instance) {\n FWNavigator._instance = new FWNavigator();\n }\n return FWNavigator._instance!;\n }\n\n private constructor() {\n FWNavigatorModuleEventEmitter.addListener(FWEventName.LogMessage, () => {});\n }\n\n /**\n * Push a new native container. We will render your app component in new native container.\n * Please set your app component name through FireworkSDK.getInstance().appComponentName before calling this method\n * @param {FWNativeContainerProps} props We will pass the props to your app component.\n * @returns {Promise<boolean>} The result of pushing RN page from native page.\n */\n public pushNativeContainer(props: FWNativeContainerProps): Promise<boolean> {\n FWLoggerUtil.log(`Enter pushNewNativeContainer`);\n\n return FWNavigatorModule.pushNativeContainer(props);\n }\n\n /**\n * Pop top-most native container. The native container embed the RN page.\n * @returns {Promise<boolean>} The result of poping top-most native container.\n */\n public popNativeContainer(): Promise<boolean> {\n return FWNavigatorModule.popNativeContainer();\n }\n}\n\nexport default FWNavigator;\n"]}
|
|
@@ -57,19 +57,16 @@ class FireworkSDK {
|
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
/**
|
|
60
|
-
* The custom
|
|
61
|
-
* We will show a native container to display the element returned by the render method.
|
|
60
|
+
* The custom CTA link content page route name.
|
|
62
61
|
*/
|
|
63
|
-
get
|
|
64
|
-
return this.
|
|
62
|
+
get customCTALinkContentPageRouteName() {
|
|
63
|
+
return this._customCTALinkContentPageRouteName;
|
|
65
64
|
}
|
|
66
65
|
|
|
67
|
-
set
|
|
68
|
-
|
|
66
|
+
set customCTALinkContentPageRouteName(value) {
|
|
67
|
+
this._customCTALinkContentPageRouteName = value;
|
|
69
68
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
_FireworkSDKModule.default.setCustomCTALinkContentRenderEnabled(value ? true : false);
|
|
69
|
+
_FireworkSDKModule.default.setCustomCTALinkContentPageRouteName(value);
|
|
73
70
|
}
|
|
74
71
|
|
|
75
72
|
/**
|
|
@@ -115,6 +112,19 @@ class FireworkSDK {
|
|
|
115
112
|
});
|
|
116
113
|
}
|
|
117
114
|
|
|
115
|
+
/**
|
|
116
|
+
* The app component name.
|
|
117
|
+
*/
|
|
118
|
+
get appComponentName() {
|
|
119
|
+
return this._appComponentName;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
set appComponentName(value) {
|
|
123
|
+
this._appComponentName = value;
|
|
124
|
+
|
|
125
|
+
_FireworkSDKModule.default.setAppComponentName(value);
|
|
126
|
+
}
|
|
127
|
+
|
|
118
128
|
get eventEmitter() {
|
|
119
129
|
return _FireworkSDKModule.FireworkSDKModuleEventEmitter;
|
|
120
130
|
}
|
|
@@ -163,7 +173,7 @@ class FireworkSDK {
|
|
|
163
173
|
|
|
164
174
|
_defineProperty(this, "_onCustomCTAClick", void 0);
|
|
165
175
|
|
|
166
|
-
_defineProperty(this, "
|
|
176
|
+
_defineProperty(this, "_customCTALinkContentPageRouteName", void 0);
|
|
167
177
|
|
|
168
178
|
_defineProperty(this, "_onVideoPlayback", void 0);
|
|
169
179
|
|
|
@@ -171,6 +181,8 @@ class FireworkSDK {
|
|
|
171
181
|
|
|
172
182
|
_defineProperty(this, "_adBadgeConfiguration", void 0);
|
|
173
183
|
|
|
184
|
+
_defineProperty(this, "_appComponentName", void 0);
|
|
185
|
+
|
|
174
186
|
this.eventEmitter.addListener(_FWEventName.FWEventName.SDKInit, event => {
|
|
175
187
|
_FWLoggerUtil.default.log(`Receive SDKInit event ${event === null || event === void 0 ? void 0 : event.error}`);
|
|
176
188
|
|
|
@@ -1 +1 @@
|
|
|
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;;AAQA;;AAGA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;AAUA;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;AACA;AACuC,MAA1BK,0BAA0B,GAEvB;AACZ,WAAO,KAAKC,2BAAZ;AACD;;AACoC,MAA1BD,0BAA0B,CACnCL,KADmC,EAEnC;AACAC,0BAAaC,GAAb,CAAkB,kCAAiC,CAAC,CAACF,KAAM,EAA3D;;AACA,SAAKM,2BAAL,GAAmCN,KAAnC;;AACAG,+BAAkBI,oCAAlB,CACEP,KAAK,GAAG,IAAH,GAAU,KADjB;AAGD;;AAGD;AACF;AACA;AAC4B,MAAfQ,eAAe,GAAsC;AAC9D,WAAO,KAAKC,gBAAZ;AACD;;AACyB,MAAfD,eAAe,CAACR,KAAD,EAA2C;AACnE,SAAK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BAAaC,GAAb,CAAkB,gCAA+BiC,KAAhC,aAAgCA,KAAhC,uBAAgCA,KAAK,CAAEW,IAAP,CAAYC,EAAG,EAAhE;;AAEA,UAAI,KAAKC,gBAAT,EAA2B;AACzB,aAAKA,gBAAL,CAAsBb,KAAtB,aAAsBA,KAAtB,cAAsBA,KAAtB,GAA+B,EAA/B;AACD;AACF,KAND;AAOD;AAED;AACF;AACA;AACA;;;AACSc,EAAAA,IAAI,CAACC,MAAD,EAAkB;AAC3B/C,+BAAkB8C,IAAlB,CAAuBC,MAAvB;;AACAC,4BAAeF,IAAf;;AACAG,8BAAiBH,IAAjB;AACD;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"]}
|
|
1
|
+
{"version":3,"sources":["FireworkSDK.ts"],"names":["FireworkSDK","onCustomCTAClick","_onCustomCTAClick","value","FWLoggerUtil","log","FireworkSDKModule","setCustomCTAClickEnabled","customCTALinkContentPageRouteName","_customCTALinkContentPageRouteName","setCustomCTALinkContentPageRouteName","onVideoPlayback","_onVideoPlayback","setVideoPlaybackEventEnabled","shareBaseURL","_shareBaseURL","setShareBaseURL","then","eventEmitter","emit","FWEventName","ShareBaseURLUpdated","adBadgeConfiguration","_adBadgeConfiguration","setAdBadgeConfiguration","AdBadgeConfigurationUpdated","appComponentName","_appComponentName","setAppComponentName","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;;AAQA;;AAGA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;AAUA;AACA;AACA;AACA,MAAMA,WAAN,CAAkB;AAGhB;AACF;AACA;;AAGE;AACF;AACA;;AAGE;AACF;AACA;AAC6B,MAAhBC,gBAAgB,GAAuC;AAChE,WAAO,KAAKC,iBAA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AcY,MAAd,EAAiD;AACrEtD,+BAAkBqD,eAAlB,CAAkCX,GAAlC,EAAuCY,MAAvC,aAAuCA,MAAvC,cAAuCA,MAAvC,GAAiD,EAAjD;AACD;;AAtLe;;gBAAZ5D,W;;eAyLSA,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 CTA link content page route name.\n */\n public get customCTALinkContentPageRouteName(): string | undefined {\n return this._customCTALinkContentPageRouteName;\n }\n public set customCTALinkContentPageRouteName(value: string | undefined) {\n this._customCTALinkContentPageRouteName = value;\n FireworkSDKModule.setCustomCTALinkContentPageRouteName(value);\n }\n private _customCTALinkContentPageRouteName: string | 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 /**\n * The app component name.\n */\n public get appComponentName(): string | undefined {\n return this._appComponentName;\n }\n public set appComponentName(value: string | undefined) {\n this._appComponentName = value;\n FireworkSDKModule.setAppComponentName(value);\n }\n private _appComponentName: string | 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"]}
|
package/lib/commonjs/index.js
CHANGED
|
@@ -51,10 +51,6 @@ var _reactNative = require("react-native");
|
|
|
51
51
|
|
|
52
52
|
var _CartContainer = _interopRequireDefault(require("./components/CartContainer"));
|
|
53
53
|
|
|
54
|
-
var _CustomCTALinkContentContainer = _interopRequireDefault(require("./components/CustomCTALinkContentContainer"));
|
|
55
|
-
|
|
56
|
-
var _NavigationContainer = _interopRequireDefault(require("./components/NavigationContainer"));
|
|
57
|
-
|
|
58
54
|
var _VideoFeed = _interopRequireDefault(require("./components/VideoFeed"));
|
|
59
55
|
|
|
60
56
|
var _FireworkSDK = _interopRequireDefault(require("./FireworkSDK"));
|
|
@@ -75,10 +71,6 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
75
71
|
|
|
76
72
|
_reactNative.AppRegistry.registerComponent('FWShoppingCartPage', () => _CartContainer.default);
|
|
77
73
|
|
|
78
|
-
_reactNative.AppRegistry.registerComponent('FWNavigationContainer', () => _NavigationContainer.default);
|
|
79
|
-
|
|
80
|
-
_reactNative.AppRegistry.registerComponent('FWCustomCTALinkContentContainer', () => _CustomCTALinkContentContainer.default);
|
|
81
|
-
|
|
82
74
|
var _default = _FireworkSDK.default;
|
|
83
75
|
exports.default = _default;
|
|
84
76
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index.tsx"],"names":["AppRegistry","registerComponent","CartContainer","
|
|
1
|
+
{"version":3,"sources":["index.tsx"],"names":["AppRegistry","registerComponent","CartContainer","FireworkSDK"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AAEA;;AAEA;;AAQA;;AACA;;AAKA;;AAgBA;;AAEA;;AAgBA;;AAcA;;;;AAEAA,yBAAYC,iBAAZ,CAA8B,oBAA9B,EAAoD,MAAMC,sBAA1D;;eAEeC,oB","sourcesContent":["import { AppRegistry } from 'react-native';\n\nimport CartContainer from './components/CartContainer';\nimport type { IVideoFeedProps, VideoFeedMode } from './components/VideoFeed';\nimport VideoFeed from './components/VideoFeed';\nimport type {\n CustomCTAClickCallback,\n CustomCTALinkContentRender,\n SDKInitCallback,\n VideoFeedClickCallback,\n VideoPlaybackCallback,\n} from './FireworkSDK';\nimport FireworkSDK from './FireworkSDK';\nimport FWNavigator from './FWNavigator';\nimport type {\n onLiveStreamChatEventCallback,\n onLiveStreamEventCallback,\n} from './LiveStream';\nimport LiveStream from './LiveStream';\nimport type AdBadgeConfiguration from './models/AdBadgeConfiguration';\nimport type { AdBadgeTextType } from './models/AdBadgeConfiguration';\nimport type AddToCartResult from './models/AddToCartResult';\nimport type FeedItemDetails from './models/FeedItemDetails';\nimport type FWError from './models/FWError';\nimport type {\n AddToCartEvent,\n CustomCTAClickEvent,\n LiveStreamChatEvent,\n LiveStreamEvent,\n SDKInitEvent,\n UpdateProductDetailsEvent,\n VideoPlaybackEvent,\n WillDisplayProductEvent,\n} from './models/FWEvents';\nimport LiveStreamChatEventName from './models/LiveStreamChatEventName';\nimport type LiveStreamEventDetails from './models/LiveStreamEventDetails';\nimport LiveStreamEventName from './models/LiveStreamEventName';\nimport type LiveStreamMessageDetails from './models/LiveStreamMessageDetails';\nimport type Product from './models/Product';\nimport type ProductInfoViewConfiguration from './models/ProductInfoViewConfiguration';\nimport type { AddToCartButtonConfiguration } from './models/ProductInfoViewConfiguration';\nimport type ProductUnit from './models/ProductUnit';\nimport type { ProductPrice } from './models/ProductUnit';\nimport type VideoFeedConfiguration from './models/VideoFeedConfiguration';\nimport type {\n VideoFeedPlayIconConfiguration,\n VideoFeedTitleConfiguration,\n VideoFeedTitlePosition,\n} from './models/VideoFeedConfiguration';\nimport type { VideoFeedSource } from './models/VideoFeedSource';\nimport type VideoPlaybackDetails from './models/VideoPlaybackDetails';\nimport type { VideoPlayerSize } from './models/VideoPlaybackDetails';\nimport VideoPlaybackEventName from './models/VideoPlaybackEventName';\nimport type VideoPlayerConfiguration from './models/VideoPlayerConfiguration';\nimport type {\n VideoLaunchBehavior,\n VideoPlayerCompleteAction,\n VideoPlayerCTAStyle,\n VideoPlayerStyle,\n} from './models/VideoPlayerConfiguration';\nimport type {\n AddToCartCallback,\n ClickCartIconCallback,\n UpdateProductDetailsCallback,\n WillDisplayProductCallback,\n} from './VideoShopping';\nimport VideoShopping from './VideoShopping';\n\nAppRegistry.registerComponent('FWShoppingCartPage', () => CartContainer);\n\nexport default FireworkSDK;\n\nexport {\n AdBadgeConfiguration,\n AdBadgeTextType,\n AddToCartButtonConfiguration,\n AddToCartCallback,\n AddToCartEvent,\n AddToCartResult,\n ClickCartIconCallback,\n CustomCTAClickCallback,\n CustomCTAClickEvent,\n CustomCTALinkContentRender,\n FeedItemDetails,\n FWError,\n FWNavigator,\n IVideoFeedProps,\n LiveStream,\n LiveStreamChatEvent,\n LiveStreamChatEventName,\n LiveStreamEvent,\n LiveStreamEventDetails,\n LiveStreamEventName,\n LiveStreamMessageDetails,\n onLiveStreamChatEventCallback,\n onLiveStreamEventCallback,\n Product,\n ProductInfoViewConfiguration,\n ProductPrice,\n ProductUnit,\n SDKInitCallback,\n SDKInitEvent,\n UpdateProductDetailsCallback,\n UpdateProductDetailsEvent,\n VideoFeed,\n VideoFeedClickCallback,\n VideoFeedConfiguration,\n VideoFeedMode,\n VideoFeedPlayIconConfiguration,\n VideoFeedSource,\n VideoFeedTitleConfiguration,\n VideoFeedTitlePosition,\n VideoLaunchBehavior,\n VideoPlaybackCallback,\n VideoPlaybackDetails,\n VideoPlaybackEvent,\n VideoPlaybackEventName,\n VideoPlayerCompleteAction,\n VideoPlayerConfiguration,\n VideoPlayerCTAStyle,\n VideoPlayerSize,\n VideoPlayerStyle,\n VideoShopping,\n WillDisplayProductCallback,\n WillDisplayProductEvent,\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["FWNavigatorModule.ts"],"names":["FWNavigatorModule","NativeModules","Proxy","get","Error","LINKING_ERROR","FWNavigatorModuleEventEmitter","NativeEventEmitter"],"mappings":";;;;;;;AAAA;;AAEA;;AAEA,MAAMA,iBAAiB,GAAGC,2BAAcD,iBAAd,GACtBC,2BAAcD,iBADQ,GAEtB,IAAIE,KAAJ,CACE,EADF,EAEE;AACEC,EAAAA,GAAG,GAAG;AACJ,UAAM,IAAIC,KAAJ,CAAUC,6BAAV,CAAN;AACD;;AAHH,CAFF,CAFJ;AAeA,MAAMC,6BAA6B,GAAG,IAAIC,+BAAJ,CAAuBP,iBAAvB,CAAtC;;eAEeA,iB","sourcesContent":["import { NativeEventEmitter, NativeModule } from 'react-native';\nimport { NativeModules } from 'react-native';\nimport { LINKING_ERROR } from '../constants/FWErrorMessage';\n\nconst FWNavigatorModule = NativeModules.FWNavigatorModule\n ? NativeModules.FWNavigatorModule\n : new Proxy(\n {},\n {\n get() {\n throw new Error(LINKING_ERROR);\n },\n }\n );\ninterface IFWNavigatorModule extends NativeModule {\n pushNativeContainer(
|
|
1
|
+
{"version":3,"sources":["FWNavigatorModule.ts"],"names":["FWNavigatorModule","NativeModules","Proxy","get","Error","LINKING_ERROR","FWNavigatorModuleEventEmitter","NativeEventEmitter"],"mappings":";;;;;;;AAAA;;AAEA;;AAEA,MAAMA,iBAAiB,GAAGC,2BAAcD,iBAAd,GACtBC,2BAAcD,iBADQ,GAEtB,IAAIE,KAAJ,CACE,EADF,EAEE;AACEC,EAAAA,GAAG,GAAG;AACJ,UAAM,IAAIC,KAAJ,CAAUC,6BAAV,CAAN;AACD;;AAHH,CAFF,CAFJ;AAeA,MAAMC,6BAA6B,GAAG,IAAIC,+BAAJ,CAAuBP,iBAAvB,CAAtC;;eAEeA,iB","sourcesContent":["import { NativeEventEmitter, NativeModule } from 'react-native';\nimport { NativeModules } from 'react-native';\nimport { LINKING_ERROR } from '../constants/FWErrorMessage';\n\nconst FWNavigatorModule = NativeModules.FWNavigatorModule\n ? NativeModules.FWNavigatorModule\n : new Proxy(\n {},\n {\n get() {\n throw new Error(LINKING_ERROR);\n },\n }\n );\ninterface IFWNavigatorModule extends NativeModule {\n pushNativeContainer(props: { [key: string]: any }): Promise<boolean>;\n popNativeContainer(): Promise<boolean>;\n}\n\nconst FWNavigatorModuleEventEmitter = new NativeEventEmitter(FWNavigatorModule);\nexport { FWNavigatorModuleEventEmitter };\nexport default FWNavigatorModule as IFWNavigatorModule;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["FireworkSDKModule.ts"],"names":["FireworkSDKModule","NativeModules","FireworkSDK","Proxy","get","Error","LINKING_ERROR","FireworkSDKModuleEventEmitter","NativeEventEmitter"],"mappings":";;;;;;;AAAA;;AAIA;;AAGA,MAAMA,iBAAiB,GAAGC,2BAAcC,WAAd,GACtBD,2BAAcC,WADQ,GAEtB,IAAIC,KAAJ,CACE,EADF,EAEE;AACEC,EAAAA,GAAG,GAAG;AACJ,UAAM,IAAIC,KAAJ,CAAUC,6BAAV,CAAN;AACD;;AAHH,CAFF,CAFJ;
|
|
1
|
+
{"version":3,"sources":["FireworkSDKModule.ts"],"names":["FireworkSDKModule","NativeModules","FireworkSDK","Proxy","get","Error","LINKING_ERROR","FireworkSDKModuleEventEmitter","NativeEventEmitter"],"mappings":";;;;;;;AAAA;;AAIA;;AAGA,MAAMA,iBAAiB,GAAGC,2BAAcC,WAAd,GACtBD,2BAAcC,WADQ,GAEtB,IAAIC,KAAJ,CACE,EADF,EAEE;AACEC,EAAAA,GAAG,GAAG;AACJ,UAAM,IAAIC,KAAJ,CAAUC,6BAAV,CAAN;AACD;;AAHH,CAFF,CAFJ;AAsBA,MAAMC,6BAA6B,GAAG,IAAIC,+BAAJ,CAAuBR,iBAAvB,CAAtC;;eAEeA,iB","sourcesContent":["import { NativeEventEmitter, NativeModule } from 'react-native';\nimport { NativeModules } from 'react-native';\nimport type AdBadgeConfiguration from '../models/AdBadgeConfiguration';\n\nimport { LINKING_ERROR } from '../constants/FWErrorMessage';\nimport type VideoPlayerConfiguration from '../models/VideoPlayerConfiguration';\n\nconst FireworkSDKModule = NativeModules.FireworkSDK\n ? NativeModules.FireworkSDK\n : new Proxy(\n {},\n {\n get() {\n throw new Error(LINKING_ERROR);\n },\n }\n );\n\ninterface IFireworkSDKModule extends NativeModule {\n init(userId?: string): void;\n openVideoPlayer(url: string, config?: VideoPlayerConfiguration): void;\n setCustomCTAClickEnabled(enabled: boolean): void;\n setCustomCTALinkContentPageRouteName(name?: string): Promise<any>;\n setShareBaseURL(url?: string): Promise<any>;\n setVideoPlaybackEventEnabled(enabled: boolean): void;\n setAdBadgeConfiguration(config?: AdBadgeConfiguration): Promise<any>;\n setAppComponentName(name?: string): Promise<any>;\n}\n\nconst FireworkSDKModuleEventEmitter = new NativeEventEmitter(FireworkSDKModule);\nexport { FireworkSDKModuleEventEmitter };\nexport default FireworkSDKModule as IFireworkSDKModule;\n"]}
|
|
@@ -5,16 +5,18 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
|
|
8
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
9
|
+
|
|
8
10
|
class FWLoggerUtil {
|
|
9
11
|
static log(message) {
|
|
10
|
-
if (process.env.NODE_ENV === 'development') {
|
|
12
|
+
if (FWLoggerUtil.enabled && process.env.NODE_ENV === 'development') {
|
|
11
13
|
const currentDate = new Date();
|
|
12
14
|
console.log('[react-native-firework-sdk]', `${message} ${FWLoggerUtil.toISOString(currentDate)}`);
|
|
13
15
|
}
|
|
14
16
|
}
|
|
15
17
|
|
|
16
18
|
static logNativeMessage(nativeMessage) {
|
|
17
|
-
if (process.env.NODE_ENV === 'development') {
|
|
19
|
+
if (FWLoggerUtil.enabled && process.env.NODE_ENV === 'development') {
|
|
18
20
|
console.log('[react-native-firework-sdk] [native]', nativeMessage);
|
|
19
21
|
}
|
|
20
22
|
}
|
|
@@ -38,4 +40,6 @@ class FWLoggerUtil {
|
|
|
38
40
|
}
|
|
39
41
|
|
|
40
42
|
exports.default = FWLoggerUtil;
|
|
43
|
+
|
|
44
|
+
_defineProperty(FWLoggerUtil, "enabled", false);
|
|
41
45
|
//# sourceMappingURL=FWLoggerUtil.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["FWLoggerUtil.ts"],"names":["FWLoggerUtil","log","message","process","env","NODE_ENV","currentDate","Date","console","toISOString","logNativeMessage","nativeMessage","date","timezoneOffset","getTimezoneOffset","timezoneSymbol","timezoneHours","Math","floor","abs","toString","padStart","timezoneMinutes","timezoneString","year","getFullYear","month","getMonth","day","getDate","hours","getHours","minutes","getMinutes","seconds","getSeconds","milliseconds","getMilliseconds"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["FWLoggerUtil.ts"],"names":["FWLoggerUtil","log","message","enabled","process","env","NODE_ENV","currentDate","Date","console","toISOString","logNativeMessage","nativeMessage","date","timezoneOffset","getTimezoneOffset","timezoneSymbol","timezoneHours","Math","floor","abs","toString","padStart","timezoneMinutes","timezoneString","year","getFullYear","month","getMonth","day","getDate","hours","getHours","minutes","getMinutes","seconds","getSeconds","milliseconds","getMilliseconds"],"mappings":";;;;;;;;;AAAe,MAAMA,YAAN,CAAmB;AAEtB,SAAHC,GAAG,CAACC,OAAD,EAAkB;AAC1B,QAAIF,YAAY,CAACG,OAAb,IAAwBC,OAAO,CAACC,GAAR,CAAYC,QAAZ,KAAyB,aAArD,EAAoE;AAClE,YAAMC,WAAW,GAAG,IAAIC,IAAJ,EAApB;AAEAC,MAAAA,OAAO,CAACR,GAAR,CACE,6BADF,EAEG,GAAEC,OAAQ,IAAGF,YAAY,CAACU,WAAb,CAAyBH,WAAzB,CAAsC,EAFtD;AAID;AACF;;AAEsB,SAAhBI,gBAAgB,CAACC,aAAD,EAAwB;AAC7C,QAAIZ,YAAY,CAACG,OAAb,IAAwBC,OAAO,CAACC,GAAR,CAAYC,QAAZ,KAAyB,aAArD,EAAoE;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C,GAAzC,CAAd;AACA,QAAIe,YAAY,GAAGxB,IAAI,CAACyB,eAAL,GAAuBjB,QAAvB,GAAkCC,QAAlC,CAA2C,CAA3C,EAA8C,GAA9C,CAAnB;AAEA,WAAQ,GAAEG,IAAK,IAAGE,KAAM,IAAGE,GAAI,IAAGE,KAAM,IAAGE,OAAQ,IAAGE,OAAQ,IAAGE,YAAa,GAAEb,cAAe,EAA/F;AACD;;AAtC+B;;;;gBAAbxB,Y,aACO,K","sourcesContent":["export default class FWLoggerUtil {\n static enabled: boolean = false;\n static log(message: string) {\n if (FWLoggerUtil.enabled && process.env.NODE_ENV === 'development') {\n const currentDate = new Date();\n\n console.log(\n '[react-native-firework-sdk]',\n `${message} ${FWLoggerUtil.toISOString(currentDate)}`\n );\n }\n }\n\n static logNativeMessage(nativeMessage: string) {\n if (FWLoggerUtil.enabled && process.env.NODE_ENV === 'development') {\n console.log('[react-native-firework-sdk] [native]', nativeMessage);\n }\n }\n\n private static toISOString(date: Date): string {\n let timezoneOffset = -date.getTimezoneOffset();\n let timezoneSymbol = timezoneOffset >= 0 ? '+' : '-';\n let timezoneHours = Math.floor(Math.abs(timezoneOffset) / 60)\n .toString()\n .padStart(2, '0');\n let timezoneMinutes = (Math.abs(timezoneOffset) % 60)\n .toString()\n .padStart(2, '0');\n let timezoneString = `${timezoneSymbol}${timezoneHours}:${timezoneMinutes}`;\n let year = date.getFullYear().toString();\n let month = (date.getMonth() + 1).toString().padStart(2, '0');\n let day = date.getDate().toString().padStart(2, '0');\n let hours = date.getHours().toString().padStart(2, '0');\n let minutes = date.getMinutes().toString().padStart(2, '0');\n let seconds = date.getSeconds().toString().padStart(2, '0');\n let milliseconds = date.getMilliseconds().toString().padStart(3, '0');\n\n return `${year}-${month}-${day}T${hours}:${minutes}:${seconds}.${milliseconds}${timezoneString}`;\n }\n}\n"]}
|
|
@@ -3,10 +3,10 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
|
3
3
|
import { FWEventName } from './models/FWEventName';
|
|
4
4
|
import FWNavigatorModule, { FWNavigatorModuleEventEmitter } from './modules/FWNavigatorModule';
|
|
5
5
|
import FWLoggerUtil from './utils/FWLoggerUtil';
|
|
6
|
+
|
|
6
7
|
/**
|
|
7
8
|
* You can use this class for pushing RN page from the native page.
|
|
8
9
|
*/
|
|
9
|
-
|
|
10
10
|
class FWNavigator {
|
|
11
11
|
static getInstance() {
|
|
12
12
|
if (!FWNavigator._instance) {
|
|
@@ -17,25 +17,19 @@ class FWNavigator {
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
constructor() {
|
|
20
|
-
_defineProperty(this, "_currentCallbackId", 0);
|
|
21
|
-
|
|
22
|
-
_defineProperty(this, "navigatorPages", new Map());
|
|
23
|
-
|
|
24
20
|
FWNavigatorModuleEventEmitter.addListener(FWEventName.LogMessage, () => {});
|
|
25
21
|
}
|
|
26
22
|
/**
|
|
27
|
-
* Push
|
|
28
|
-
*
|
|
29
|
-
* @
|
|
23
|
+
* Push a new native container. We will render your app component in new native container.
|
|
24
|
+
* Please set your app component name through FireworkSDK.getInstance().appComponentName before calling this method
|
|
25
|
+
* @param {FWNativeContainerProps} props We will pass the props to your app component.
|
|
26
|
+
* @returns {Promise<boolean>} The result of pushing RN page from native page.
|
|
30
27
|
*/
|
|
31
28
|
|
|
32
29
|
|
|
33
|
-
pushNativeContainer(
|
|
34
|
-
FWLoggerUtil.log(`Enter
|
|
35
|
-
|
|
36
|
-
const callbackId = `${this._currentCallbackId}`;
|
|
37
|
-
this.navigatorPages.set(callbackId, page);
|
|
38
|
-
return FWNavigatorModule.pushNativeContainer(callbackId);
|
|
30
|
+
pushNativeContainer(props) {
|
|
31
|
+
FWLoggerUtil.log(`Enter pushNewNativeContainer`);
|
|
32
|
+
return FWNavigatorModule.pushNativeContainer(props);
|
|
39
33
|
}
|
|
40
34
|
/**
|
|
41
35
|
* Pop top-most native container. The native container embed the RN page.
|