react-native-firework-sdk 2.2.0 → 2.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/FireworkVideoUI.xcframework/Info.plist +5 -5
- package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/FireworkVideoUI +0 -0
- package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Info.plist +0 -0
- package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/FireworkVideoUI +0 -0
- package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Info.plist +0 -0
- package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/_CodeSignature/CodeResources +1 -1
- package/ios/Components/VideoFeed.swift +9 -9
- package/ios/Models/NativeToRN/FireworkSDK+Json.swift +6 -2
- package/lib/commonjs/FireworkSDK.js +15 -19
- package/lib/commonjs/FireworkSDK.js.map +1 -1
- package/lib/commonjs/components/StoryBlock.js +23 -17
- package/lib/commonjs/components/StoryBlock.js.map +1 -1
- package/lib/commonjs/components/VideoFeed.js +39 -30
- package/lib/commonjs/components/VideoFeed.js.map +1 -1
- package/lib/module/FireworkSDK.js +14 -19
- package/lib/module/FireworkSDK.js.map +1 -1
- package/lib/module/components/StoryBlock.js +24 -17
- package/lib/module/components/StoryBlock.js.map +1 -1
- package/lib/module/components/VideoFeed.js +39 -30
- package/lib/module/components/VideoFeed.js.map +1 -1
- package/lib/typescript/FireworkSDK.d.ts +3 -6
- package/lib/typescript/components/VideoFeed.d.ts +4 -4
- package/lib/typescript/models/FeedItemDetails.d.ts +7 -0
- package/package.json +1 -1
- package/src/FireworkSDK.ts +13 -22
- package/src/components/StoryBlock.tsx +26 -19
- package/src/components/VideoFeed.tsx +55 -39
- package/src/models/FeedItemDetails.ts +7 -0
|
@@ -6,30 +6,30 @@
|
|
|
6
6
|
<array>
|
|
7
7
|
<dict>
|
|
8
8
|
<key>LibraryIdentifier</key>
|
|
9
|
-
<string>ios-
|
|
9
|
+
<string>ios-arm64</string>
|
|
10
10
|
<key>LibraryPath</key>
|
|
11
11
|
<string>FireworkVideoUI.framework</string>
|
|
12
12
|
<key>SupportedArchitectures</key>
|
|
13
13
|
<array>
|
|
14
14
|
<string>arm64</string>
|
|
15
|
-
<string>x86_64</string>
|
|
16
15
|
</array>
|
|
17
16
|
<key>SupportedPlatform</key>
|
|
18
17
|
<string>ios</string>
|
|
19
|
-
<key>SupportedPlatformVariant</key>
|
|
20
|
-
<string>simulator</string>
|
|
21
18
|
</dict>
|
|
22
19
|
<dict>
|
|
23
20
|
<key>LibraryIdentifier</key>
|
|
24
|
-
<string>ios-
|
|
21
|
+
<string>ios-arm64_x86_64-simulator</string>
|
|
25
22
|
<key>LibraryPath</key>
|
|
26
23
|
<string>FireworkVideoUI.framework</string>
|
|
27
24
|
<key>SupportedArchitectures</key>
|
|
28
25
|
<array>
|
|
29
26
|
<string>arm64</string>
|
|
27
|
+
<string>x86_64</string>
|
|
30
28
|
</array>
|
|
31
29
|
<key>SupportedPlatform</key>
|
|
32
30
|
<string>ios</string>
|
|
31
|
+
<key>SupportedPlatformVariant</key>
|
|
32
|
+
<string>simulator</string>
|
|
33
33
|
</dict>
|
|
34
34
|
</array>
|
|
35
35
|
<key>CFBundlePackageType</key>
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Info.plist
CHANGED
|
Binary file
|
|
@@ -168,15 +168,15 @@ public class VideoFeed: UIView, VideoFeedViewControllerDelegate {
|
|
|
168
168
|
return
|
|
169
169
|
}
|
|
170
170
|
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
171
|
+
if let subView = feedVC.view.subviews.first {
|
|
172
|
+
let constraints = feedVC.view.constraints
|
|
173
|
+
for constraint in constraints {
|
|
174
|
+
if (constraint.firstItem as? NSObject) == subView || (constraint.secondItem as? NSObject) == subView {
|
|
175
|
+
constraint.isActive = false
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
NSLayoutConstraint.activate(subView.constraints(equalTo: feedVC.view))
|
|
179
|
+
}
|
|
180
180
|
|
|
181
181
|
var viewConfiguration = convertToVideoFeedContentConfiguration()
|
|
182
182
|
if viewConfiguration.itemView.autoplay.isEnabled {
|
|
@@ -28,8 +28,8 @@ extension VideoPlaybackDetails {
|
|
|
28
28
|
[
|
|
29
29
|
"videoId": videoID,
|
|
30
30
|
"duration": duration,
|
|
31
|
-
"caption": caption,
|
|
32
|
-
"badge": badge,
|
|
31
|
+
"caption": caption ?? "",
|
|
32
|
+
"badge": badge ?? "",
|
|
33
33
|
"playerSize": [
|
|
34
34
|
"width": playerSize.width,
|
|
35
35
|
"height": playerSize.height
|
|
@@ -96,6 +96,10 @@ extension FeedEventDetails {
|
|
|
96
96
|
sourceStr = "dynamicContent"
|
|
97
97
|
result["channel"] = channelID
|
|
98
98
|
result["dynamicContentParameters"] = parameters
|
|
99
|
+
case .hashtagPlaylist(let channelID, let hashtagFilterExpression):
|
|
100
|
+
sourceStr = "hashtagPlaylist"
|
|
101
|
+
result["channel"] = channelID
|
|
102
|
+
result["hashtagFilterExpression"] = hashtagFilterExpression
|
|
99
103
|
default:
|
|
100
104
|
break
|
|
101
105
|
}
|
|
@@ -80,32 +80,29 @@ class FireworkSDK {
|
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
set shareBaseURL(value) {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
83
|
+
this.updateInternalShareBaseURL(value);
|
|
84
|
+
|
|
85
|
+
_FireworkSDKModule.default.setShareBaseURL(value !== null && value !== void 0 ? value : '');
|
|
86
86
|
}
|
|
87
87
|
|
|
88
88
|
/**
|
|
89
|
-
*
|
|
89
|
+
* The configuration for ad badges.
|
|
90
90
|
*/
|
|
91
|
-
|
|
91
|
+
get adBadgeConfiguration() {
|
|
92
92
|
return this._adBadgeConfiguration;
|
|
93
93
|
}
|
|
94
|
-
/**
|
|
95
|
-
* Set the configuration for ad badges. Only supported on iOS.
|
|
96
|
-
*/
|
|
97
|
-
|
|
98
94
|
|
|
99
|
-
|
|
95
|
+
set adBadgeConfiguration(value) {
|
|
100
96
|
var _this$_adBadgeConfigu, _this$_adBadgeConfigu2, _this$_adBadgeConfigu3;
|
|
101
97
|
|
|
102
|
-
await _FireworkSDKModule.default.setAdBadgeConfiguration(value !== null && value !== void 0 ? value : {});
|
|
103
98
|
const valueHasChanged = ((_this$_adBadgeConfigu = this._adBadgeConfiguration) === null || _this$_adBadgeConfigu === void 0 ? void 0 : _this$_adBadgeConfigu.badgeTextType) !== (value === null || value === void 0 ? void 0 : value.badgeTextType) || ((_this$_adBadgeConfigu2 = this._adBadgeConfiguration) === null || _this$_adBadgeConfigu2 === void 0 ? void 0 : _this$_adBadgeConfigu2.backgroundColor) !== (value === null || value === void 0 ? void 0 : value.backgroundColor) || ((_this$_adBadgeConfigu3 = this._adBadgeConfiguration) === null || _this$_adBadgeConfigu3 === void 0 ? void 0 : _this$_adBadgeConfigu3.textColor) !== (value === null || value === void 0 ? void 0 : value.textColor);
|
|
104
99
|
this._adBadgeConfiguration = value;
|
|
105
100
|
|
|
106
101
|
if (valueHasChanged) {
|
|
107
102
|
this.eventEmitter.emit(_FWEventName.FWEventName.AdBadgeConfigurationUpdated);
|
|
108
103
|
}
|
|
104
|
+
|
|
105
|
+
_FireworkSDKModule.default.setAdBadgeConfiguration(value !== null && value !== void 0 ? value : {});
|
|
109
106
|
}
|
|
110
107
|
|
|
111
108
|
get appLanguage() {
|
|
@@ -245,14 +242,14 @@ class FireworkSDK {
|
|
|
245
242
|
async init(options) {
|
|
246
243
|
_FWLoggerUtil.default.log('Call FireworkSDK init method');
|
|
247
244
|
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
this._videoLaunchBehavior = options === null || options === void 0 ? void 0 : options.videoLaunchBehavior;
|
|
245
|
+
const videoLaunchBehaviorUpdated = this._videoLaunchBehavior !== (options === null || options === void 0 ? void 0 : options.videoLaunchBehavior);
|
|
246
|
+
this._videoLaunchBehavior = options === null || options === void 0 ? void 0 : options.videoLaunchBehavior;
|
|
251
247
|
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
248
|
+
if (videoLaunchBehaviorUpdated) {
|
|
249
|
+
this.eventEmitter.emit(_FWEventName.FWEventName.VideoLaunchBehaviorUpdated);
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
_FireworkSDKModule.default.init(options);
|
|
256
253
|
|
|
257
254
|
_ShoppingModule.default.init();
|
|
258
255
|
|
|
@@ -312,7 +309,6 @@ class FireworkSDK {
|
|
|
312
309
|
|
|
313
310
|
updateInternalShareBaseURL(shareBaseURL) {
|
|
314
311
|
const shareBaseURLChanged = this._shareBaseURL !== shareBaseURL;
|
|
315
|
-
console.log('updateInternalShareBaseURL shareBaseURL', shareBaseURL);
|
|
316
312
|
this._shareBaseURL = shareBaseURL;
|
|
317
313
|
|
|
318
314
|
if (shareBaseURLChanged) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["FireworkSDK.ts"],"names":["FireworkSDK","onCustomCTAClick","_onCustomCTAClick","value","FWLoggerUtil","log","FireworkSDKModule","setCustomCTAClickEnabled","onVideoPlayback","_onVideoPlayback","setVideoPlaybackEventEnabled","shareBaseURL","_shareBaseURL","setShareBaseURL","then","updateInternalShareBaseURL","getAdBadgeConfiguration","_adBadgeConfiguration","setAdBadgeConfiguration","valueHasChanged","badgeTextType","backgroundColor","textColor","eventEmitter","emit","FWEventName","AdBadgeConfigurationUpdated","appLanguage","_appLanguage","debugLogsEnabled","enabled","videoLaunchBehavior","_videoLaunchBehavior","FireworkSDKModuleEventEmitter","shopping","_shopping","liveStream","_liveStream","navigator","_navigator","getInstance","_instance","constructor","VideoShopping","LiveStream","FWNavigator","addListener","SDKInit","event","error","onSDKInit","LogMessage","logNativeMessage","message","CustomCTAClick","url","VideoPlayback","eventName","VideoFeedClick","info","id","onVideoFeedClick","Platform","OS","NativeAppLanguageUpdated","language","updateInternalAppLanguage","init","options","videoLaunchBehaviorUpdated","VideoLaunchBehaviorUpdated","ShoppingModule","LiveStreamModule","openVideoPlayer","config","trackPurchase","parameters","changeAppLanguage","result","AppLanguageUpdated","shareBaseURLChanged","console","ShareBaseURLUpdated"],"mappings":";;;;;;;AAAA;;AAEA;;AACA;;AAEA;;AAWA;;AAGA;;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;AACA;AACyB,MAAZQ,YAAY,GAAuB;AAC5C,WAAO,KAAKC,aAAZ;AACD;;AACsB,MAAZD,YAAY,CAACR,KAAD,EAA4B;AACjDG,+BAAkBO,eAAlB,CAAkCV,KAAlC,aAAkCA,KAAlC,cAAkCA,KAAlC,GAA2C,EAA3C,EAA+CW,IAA/C,CAAoD,MAAM;AACxD,W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C;AACD;AACF;;AAEOhE,EAAAA,0BAA0B,CAACJ,YAAD,EAAwB;AACxD,UAAMqE,mBAAmB,GAAG,KAAKpE,aAAL,KAAuBD,YAAnD;AACAsE,IAAAA,OAAO,CAAC5E,GAAR,CAAY,yCAAZ,EAAuDM,YAAvD;AACA,SAAKC,aAAL,GAAqBD,YAArB;;AACA,QAAIqE,mBAAJ,EAAyB;AACvB,WAAKzD,YAAL,CAAkBC,IAAlB,CAAuBC,yBAAYyD,mBAAnC;AACD;AACF;;AAzQe;;gBAAZlF,W;;eA4QSA,W","sourcesContent":["import { NativeEventEmitter, Platform } from 'react-native';\n\nimport FWNavigator from './FWNavigator';\nimport LiveStream from './LiveStream';\nimport type AdBadgeConfiguration from './models/AdBadgeConfiguration';\nimport { FWEventName } from './models/FWEventName';\nimport type {\n CustomCTAClickEvent,\n SDKInitEvent,\n VideoFeedClickEvent,\n VideoPlaybackEvent,\n} from './models/FWEvents';\nimport type SDKInitOptions from './models/SDKInitOptions';\nimport type { VideoLaunchBehavior } from './models/SDKInitOptions';\nimport type TrackPurchaseParameters from './models/TrackPurchaseParameters';\nimport type VideoPlayerConfiguration from './models/VideoPlayerConfiguration';\nimport FireworkSDKModule, {\n FireworkSDKModuleEventEmitter,\n} from './modules/FireworkSDKModule';\nimport LiveStreamModule from './modules/LiveStreamModule';\nimport ShoppingModule from './modules/ShoppingModule';\nimport FWLoggerUtil from './utils/FWLoggerUtil';\nimport VideoShopping from './VideoShopping';\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 * Firework SDK.\n */\nclass FireworkSDK {\n private static _instance?: FireworkSDK;\n\n /**\n * The callback of SDK initialization.\n */\n public onSDKInit?: SDKInitCallback;\n\n /**\n * the callback of clicking Video Feed.\n */\n public 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 global share base URL of the video.\n * The {@link VideoPlayerConfiguration.shareBaseURL} in {@link VideoPlayerConfiguration} will override this.\n */\n public get shareBaseURL(): string | undefined {\n return this._shareBaseURL;\n }\n public set shareBaseURL(value: string | undefined) {\n FireworkSDKModule.setShareBaseURL(value ?? '').then(() => {\n this.updateInternalShareBaseURL(value);\n });\n }\n private _shareBaseURL: string | undefined;\n\n /**\n * Get the configuration for ad badges. Only supported on iOS.\n */\n public getAdBadgeConfiguration(): AdBadgeConfiguration | undefined {\n return this._adBadgeConfiguration;\n }\n /**\n * Set the configuration for ad badges. Only supported on iOS.\n */\n public async setAdBadgeConfiguration(\n value: AdBadgeConfiguration | undefined\n ): Promise<void> {\n await FireworkSDKModule.setAdBadgeConfiguration(value ?? {});\n const valueHasChanged =\n this._adBadgeConfiguration?.badgeTextType !== value?.badgeTextType ||\n this._adBadgeConfiguration?.backgroundColor !== value?.backgroundColor ||\n this._adBadgeConfiguration?.textColor !== value?.textColor;\n this._adBadgeConfiguration = value;\n if (valueHasChanged) {\n this.eventEmitter.emit(FWEventName.AdBadgeConfigurationUpdated);\n }\n }\n private _adBadgeConfiguration: AdBadgeConfiguration | undefined;\n\n public get appLanguage(): string | undefined | null {\n return this._appLanguage;\n }\n private _appLanguage: string | undefined | null;\n\n /**\n * Defaults to false.\n * You can enable debug logs by setting this property to true.\n */\n public get debugLogsEnabled(): boolean {\n return FWLoggerUtil.enabled;\n }\n public set debugLogsEnabled(value: boolean) {\n FWLoggerUtil.enabled = value;\n }\n\n /**\n * Get video launch behavior.\n */\n public get videoLaunchBehavior(): VideoLaunchBehavior | undefined {\n return this._videoLaunchBehavior;\n }\n private _videoLaunchBehavior: VideoLaunchBehavior | undefined;\n\n private get eventEmitter(): NativeEventEmitter {\n return FireworkSDKModuleEventEmitter;\n }\n\n /**\n * Get VideoShopping object.\n */\n public get shopping(): VideoShopping {\n return this._shopping;\n }\n private _shopping: VideoShopping = VideoShopping.getInstance();\n\n /**\n * Get LiveStream object.\n */\n public get liveStream(): LiveStream {\n return this._liveStream;\n }\n private _liveStream: LiveStream = LiveStream.getInstance();\n\n /**\n * Get FWNavigator object.\n */\n public get navigator(): FWNavigator {\n return this._navigator;\n }\n private _navigator: FWNavigator = FWNavigator.getInstance();\n\n /**\n * Get global single instance of FireworkSDK class.\n * @returns FireworkSDK\n */\n public static getInstance() {\n if (!FireworkSDK._instance) {\n FireworkSDK._instance = new FireworkSDK();\n }\n\n return FireworkSDK._instance!;\n }\n\n private constructor() {\n FWLoggerUtil.log('FireworkSDK constructor');\n 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(\n `Receive VideoPlayback event eventName: ${event?.eventName}`\n );\n\n if (this.onVideoPlayback) {\n this.onVideoPlayback(event ?? {});\n }\n });\n\n this.eventEmitter.addListener(FWEventName.VideoFeedClick, (event) => {\n FWLoggerUtil.log(`Receive VideoFeedClick event id: ${event?.info.id}`);\n\n if (this.onVideoFeedClick) {\n this.onVideoFeedClick(event ?? {});\n }\n });\n\n if (Platform.OS === 'ios') {\n this.eventEmitter.addListener(\n FWEventName.NativeAppLanguageUpdated,\n (event) => {\n FWLoggerUtil.log(\n `Receive NativeAppLanguageUpdated event appLanguage: ${event.appLanguage}`\n );\n const language = event.appLanguage;\n this.updateInternalAppLanguage(language);\n }\n );\n }\n }\n\n /**\n * Initializes Firework SDK.\n * @param {SDKInitOptions?} options\n */\n public async init(options?: SDKInitOptions): Promise<void> {\n FWLoggerUtil.log('Call FireworkSDK init method');\n\n FireworkSDKModule.init(options).then(() => {\n const videoLaunchBehaviorUpdated =\n this._videoLaunchBehavior !== options?.videoLaunchBehavior;\n this._videoLaunchBehavior = options?.videoLaunchBehavior;\n if (videoLaunchBehaviorUpdated) {\n this.eventEmitter.emit(FWEventName.VideoLaunchBehaviorUpdated);\n }\n });\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 /**\n * Records the user purchase. Only supported on iOS.\n * @param {TrackPurchaseParameters} parameters\n */\n public trackPurchase(parameters: TrackPurchaseParameters) {\n if (Platform.OS === 'ios') {\n FireworkSDKModule.trackPurchase(parameters);\n }\n }\n\n /**\n * Change App level language. Only supported on iOS.\n * @param {string | undefined | null} language Such as en, ar and en-US\n * If language is null or undefined or empty string, SDK will use system language.\n * @returns {Promise<boolean>} The result of changing app language.\n */\n public async changeAppLanguage(language?: string | null): Promise<boolean> {\n if (Platform.OS === 'ios') {\n const result = await FireworkSDKModule.changeAppLanguage(language);\n if (result) {\n this.updateInternalAppLanguage(language);\n }\n return result;\n }\n\n return false;\n }\n\n private updateInternalAppLanguage(language?: string | null) {\n const valueHasChanged = this._appLanguage !== language;\n this._appLanguage = language;\n if (valueHasChanged) {\n this.eventEmitter.emit(FWEventName.AppLanguageUpdated);\n }\n }\n\n private updateInternalShareBaseURL(shareBaseURL?: string) {\n const shareBaseURLChanged = this._shareBaseURL !== shareBaseURL;\n console.log('updateInternalShareBaseURL shareBaseURL', shareBaseURL);\n this._shareBaseURL = shareBaseURL;\n if (shareBaseURLChanged) {\n this.eventEmitter.emit(FWEventName.ShareBaseURLUpdated);\n }\n }\n}\n\nexport default FireworkSDK;\n"]}
|
|
1
|
+
{"version":3,"sources":["FireworkSDK.ts"],"names":["FireworkSDK","onCustomCTAClick","_onCustomCTAClick","value","FWLoggerUtil","log","FireworkSDKModule","setCustomCTAClickEnabled","onVideoPlayback","_onVideoPlayback","setVideoPlaybackEventEnabled","shareBaseURL","_shareBaseURL","updateInternalShareBaseURL","setShareBaseURL","adBadgeConfiguration","_adBadgeConfiguration","valueHasChanged","badgeTextType","backgroundColor","textColor","eventEmitter","emit","FWEventName","AdBadgeConfigurationUpdated","setAdBadgeConfiguration","appLanguage","_appLanguage","debugLogsEnabled","enabled","videoLaunchBehavior","_videoLaunchBehavior","FireworkSDKModuleEventEmitter","shopping","_shopping","liveStream","_liveStream","navigator","_navigator","getInstance","_instance","constructor","VideoShopping","LiveStream","FWNavigator","addListener","SDKInit","event","error","onSDKInit","LogMessage","logNativeMessage","message","CustomCTAClick","url","VideoPlayback","eventName","VideoFeedClick","info","id","onVideoFeedClick","Platform","OS","NativeAppLanguageUpdated","language","updateInternalAppLanguage","init","options","videoLaunchBehaviorUpdated","VideoLaunchBehaviorUpdated","ShoppingModule","LiveStreamModule","openVideoPlayer","config","trackPurchase","parameters","changeAppLanguage","result","AppLanguageUpdated","shareBaseURLChanged","ShareBase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cmB,MAAd,EAAiD;AACrEnE,+BAAkBkE,eAAlB,CAAkClB,GAAlC,EAAuCmB,MAAvC,aAAuCA,MAAvC,cAAuCA,MAAvC,GAAiD,EAAjD;AACD;AAED;AACF;AACA;AACA;;;AACSC,EAAAA,aAAa,CAACC,UAAD,EAAsC;AACxD,QAAId,sBAASC,EAAT,KAAgB,KAApB,EAA2B;AACzBxD,iCAAkBoE,aAAlB,CAAgCC,UAAhC;AACD;AACF;AAED;AACF;AACA;AACA;AACA;AACA;;;AACgC,QAAjBC,iBAAiB,CAACZ,QAAD,EAA6C;AACzE,QAAIH,sBAASC,EAAT,KAAgB,KAApB,EAA2B;AACzB,YAAMe,MAAM,GAAG,MAAMvE,2BAAkBsE,iBAAlB,CAAoCZ,QAApC,CAArB;;AACA,UAAIa,MAAJ,EAAY;AACV,aAAKZ,yBAAL,CAA+BD,QAA/B;AACD;;AACD,aAAOa,MAAP;AACD;;AAED,WAAO,KAAP;AACD;;AAEOZ,EAAAA,yBAAyB,CAACD,QAAD,EAA2B;AAC1D,UAAM/C,eAAe,GAAG,KAAKU,YAAL,KAAsBqC,QAA9C;AACA,SAAKrC,YAAL,GAAoBqC,QAApB;;AACA,QAAI/C,eAAJ,EAAqB;AACnB,WAAKI,YAAL,CAAkBC,IAAlB,CAAuBC,yBAAYuD,kBAAnC;AACD;AACF;;AAEOjE,EAAAA,0BAA0B,CAACF,YAAD,EAAwB;AACxD,UAAMoE,mBAAmB,GAAG,KAAKnE,aAAL,KAAuBD,YAAnD;AACA,SAAKC,aAAL,GAAqBD,YAArB;;AACA,QAAIoE,mBAAJ,EAAyB;AACvB,WAAK1D,YAAL,CAAkBC,IAAlB,CAAuBC,yBAAYyD,mBAAnC;AACD;AACF;;AAhQe;;gBAAZhF,W;;eAmQSA,W","sourcesContent":["import { NativeEventEmitter, Platform } from 'react-native';\n\nimport FWNavigator from './FWNavigator';\nimport LiveStream from './LiveStream';\nimport type AdBadgeConfiguration from './models/AdBadgeConfiguration';\nimport { FWEventName } from './models/FWEventName';\nimport type {\n CustomCTAClickEvent,\n SDKInitEvent,\n VideoFeedClickEvent,\n VideoPlaybackEvent,\n} from './models/FWEvents';\nimport type SDKInitOptions from './models/SDKInitOptions';\nimport type { VideoLaunchBehavior } from './models/SDKInitOptions';\nimport type TrackPurchaseParameters from './models/TrackPurchaseParameters';\nimport type VideoPlayerConfiguration from './models/VideoPlayerConfiguration';\nimport FireworkSDKModule, {\n FireworkSDKModuleEventEmitter,\n} from './modules/FireworkSDKModule';\nimport LiveStreamModule from './modules/LiveStreamModule';\nimport ShoppingModule from './modules/ShoppingModule';\nimport FWLoggerUtil from './utils/FWLoggerUtil';\nimport VideoShopping from './VideoShopping';\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 * Firework SDK.\n */\nclass FireworkSDK {\n private static _instance?: FireworkSDK;\n\n /**\n * The callback of SDK initialization.\n */\n public onSDKInit?: SDKInitCallback;\n\n /**\n * the callback of clicking Video Feed.\n */\n public 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 global share base URL of the video.\n * The {@link VideoPlayerConfiguration.shareBaseURL} in {@link VideoPlayerConfiguration} will override this.\n */\n public get shareBaseURL(): string | undefined {\n return this._shareBaseURL;\n }\n public set shareBaseURL(value: string | undefined) {\n this.updateInternalShareBaseURL(value);\n FireworkSDKModule.setShareBaseURL(value ?? '');\n }\n private _shareBaseURL: string | undefined;\n\n /**\n * The configuration for ad badges.\n */\n public get adBadgeConfiguration(): AdBadgeConfiguration | undefined {\n return this._adBadgeConfiguration;\n }\n public set adBadgeConfiguration(value: AdBadgeConfiguration | undefined) {\n const valueHasChanged =\n this._adBadgeConfiguration?.badgeTextType !== value?.badgeTextType ||\n this._adBadgeConfiguration?.backgroundColor !== value?.backgroundColor ||\n this._adBadgeConfiguration?.textColor !== value?.textColor;\n this._adBadgeConfiguration = value;\n if (valueHasChanged) {\n this.eventEmitter.emit(FWEventName.AdBadgeConfigurationUpdated);\n }\n FireworkSDKModule.setAdBadgeConfiguration(value ?? {});\n }\n private _adBadgeConfiguration: AdBadgeConfiguration | undefined;\n\n public get appLanguage(): string | undefined | null {\n return this._appLanguage;\n }\n private _appLanguage: string | undefined | null;\n\n /**\n * Defaults to false.\n * You can enable debug logs by setting this property to true.\n */\n public get debugLogsEnabled(): boolean {\n return FWLoggerUtil.enabled;\n }\n public set debugLogsEnabled(value: boolean) {\n FWLoggerUtil.enabled = value;\n }\n\n /**\n * Get video launch behavior.\n */\n public get videoLaunchBehavior(): VideoLaunchBehavior | undefined {\n return this._videoLaunchBehavior;\n }\n private _videoLaunchBehavior: VideoLaunchBehavior | undefined;\n\n private get eventEmitter(): NativeEventEmitter {\n return FireworkSDKModuleEventEmitter;\n }\n\n /**\n * Get VideoShopping object.\n */\n public get shopping(): VideoShopping {\n return this._shopping;\n }\n private _shopping: VideoShopping = VideoShopping.getInstance();\n\n /**\n * Get LiveStream object.\n */\n public get liveStream(): LiveStream {\n return this._liveStream;\n }\n private _liveStream: LiveStream = LiveStream.getInstance();\n\n /**\n * Get FWNavigator object.\n */\n public get navigator(): FWNavigator {\n return this._navigator;\n }\n private _navigator: FWNavigator = FWNavigator.getInstance();\n\n /**\n * Get global single instance of FireworkSDK class.\n * @returns FireworkSDK\n */\n public static getInstance() {\n if (!FireworkSDK._instance) {\n FireworkSDK._instance = new FireworkSDK();\n }\n\n return FireworkSDK._instance!;\n }\n\n private constructor() {\n FWLoggerUtil.log('FireworkSDK constructor');\n 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(\n `Receive VideoPlayback event eventName: ${event?.eventName}`\n );\n\n if (this.onVideoPlayback) {\n this.onVideoPlayback(event ?? {});\n }\n });\n\n this.eventEmitter.addListener(FWEventName.VideoFeedClick, (event) => {\n FWLoggerUtil.log(`Receive VideoFeedClick event id: ${event?.info.id}`);\n\n if (this.onVideoFeedClick) {\n this.onVideoFeedClick(event ?? {});\n }\n });\n\n if (Platform.OS === 'ios') {\n this.eventEmitter.addListener(\n FWEventName.NativeAppLanguageUpdated,\n (event) => {\n FWLoggerUtil.log(\n `Receive NativeAppLanguageUpdated event appLanguage: ${event.appLanguage}`\n );\n const language = event.appLanguage;\n this.updateInternalAppLanguage(language);\n }\n );\n }\n }\n\n /**\n * Initializes Firework SDK.\n * @param {SDKInitOptions?} options\n */\n public async init(options?: SDKInitOptions): Promise<void> {\n FWLoggerUtil.log('Call FireworkSDK init method');\n const videoLaunchBehaviorUpdated =\n this._videoLaunchBehavior !== options?.videoLaunchBehavior;\n this._videoLaunchBehavior = options?.videoLaunchBehavior;\n if (videoLaunchBehaviorUpdated) {\n this.eventEmitter.emit(FWEventName.VideoLaunchBehaviorUpdated);\n }\n FireworkSDKModule.init(options);\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 /**\n * Records the user purchase. Only supported on iOS.\n * @param {TrackPurchaseParameters} parameters\n */\n public trackPurchase(parameters: TrackPurchaseParameters) {\n if (Platform.OS === 'ios') {\n FireworkSDKModule.trackPurchase(parameters);\n }\n }\n\n /**\n * Change App level language. Only supported on iOS.\n * @param {string | undefined | null} language Such as en, ar and en-US\n * If language is null or undefined or empty string, SDK will use system language.\n * @returns {Promise<boolean>} The result of changing app language.\n */\n public async changeAppLanguage(language?: string | null): Promise<boolean> {\n if (Platform.OS === 'ios') {\n const result = await FireworkSDKModule.changeAppLanguage(language);\n if (result) {\n this.updateInternalAppLanguage(language);\n }\n return result;\n }\n\n return false;\n }\n\n private updateInternalAppLanguage(language?: string | null) {\n const valueHasChanged = this._appLanguage !== language;\n this._appLanguage = language;\n if (valueHasChanged) {\n this.eventEmitter.emit(FWEventName.AppLanguageUpdated);\n }\n }\n\n private updateInternalShareBaseURL(shareBaseURL?: string) {\n const shareBaseURLChanged = this._shareBaseURL !== shareBaseURL;\n this._shareBaseURL = shareBaseURL;\n if (shareBaseURLChanged) {\n this.eventEmitter.emit(FWEventName.ShareBaseURLUpdated);\n }\n }\n}\n\nexport default FireworkSDK;\n"]}
|
|
@@ -77,7 +77,9 @@ const StoryBlock = (props, forwardedRef) => {
|
|
|
77
77
|
const subscriptionOfAppLanguageUpdated = _FireworkSDKModule.FireworkSDKModuleEventEmitter.addListener(_FWEventName.FWEventName.AppLanguageUpdated, () => {
|
|
78
78
|
_FWLoggerUtil.default.log('Receive FWEventName.AppLanguageUpdated');
|
|
79
79
|
|
|
80
|
-
|
|
80
|
+
if (_reactNative.Platform.OS === 'android') {
|
|
81
|
+
forceUpdate();
|
|
82
|
+
}
|
|
81
83
|
});
|
|
82
84
|
|
|
83
85
|
if (_reactNative.Platform.OS === 'android') {
|
|
@@ -192,40 +194,44 @@ const StoryBlock = (props, forwardedRef) => {
|
|
|
192
194
|
const generateKey = () => {
|
|
193
195
|
var _FireworkSDK$getInsta, _FireworkSDK$getInsta2, _FireworkSDK$getInsta3, _adBadgeConfiguration, _adBadgeConfiguration2, _adBadgeConfiguration3, _FireworkSDK$getInsta4, _adConfiguration$requ, _adConfiguration$adsF;
|
|
194
196
|
|
|
197
|
+
const gShareBaseURL = (_FireworkSDK$getInsta = _FireworkSDK.default.getInstance().shareBaseURL) !== null && _FireworkSDK$getInsta !== void 0 ? _FireworkSDK$getInsta : '';
|
|
198
|
+
const appLanguage = (_FireworkSDK$getInsta2 = _FireworkSDK.default.getInstance().appLanguage) !== null && _FireworkSDK$getInsta2 !== void 0 ? _FireworkSDK$getInsta2 : '';
|
|
199
|
+
const adBadgeConfiguration = (_FireworkSDK$getInsta3 = _FireworkSDK.default.getInstance().adBadgeConfiguration) !== null && _FireworkSDK$getInsta3 !== void 0 ? _FireworkSDK$getInsta3 : {};
|
|
200
|
+
const adBadgeTextType = (_adBadgeConfiguration = adBadgeConfiguration.badgeTextType) !== null && _adBadgeConfiguration !== void 0 ? _adBadgeConfiguration : '';
|
|
201
|
+
const backgroundColorOfAdBadge = (_adBadgeConfiguration2 = adBadgeConfiguration.backgroundColor) !== null && _adBadgeConfiguration2 !== void 0 ? _adBadgeConfiguration2 : '';
|
|
202
|
+
const textColorOfAdBadge = (_adBadgeConfiguration3 = adBadgeConfiguration.textColor) !== null && _adBadgeConfiguration3 !== void 0 ? _adBadgeConfiguration3 : '';
|
|
203
|
+
const videoLaunchBehavior = (_FireworkSDK$getInsta4 = _FireworkSDK.default.getInstance().videoLaunchBehavior) !== null && _FireworkSDK$getInsta4 !== void 0 ? _FireworkSDK$getInsta4 : 'default';
|
|
195
204
|
const {
|
|
196
205
|
source,
|
|
197
206
|
channel = '',
|
|
198
207
|
playlist = '',
|
|
208
|
+
hashtagFilterExpression = '',
|
|
199
209
|
enablePictureInPicture = false,
|
|
200
|
-
adConfiguration
|
|
201
|
-
hashtagFilterExpression = ''
|
|
210
|
+
adConfiguration
|
|
202
211
|
} = props;
|
|
203
|
-
const gShareBaseURL = (_FireworkSDK$getInsta = _FireworkSDK.default.getInstance().shareBaseURL) !== null && _FireworkSDK$getInsta !== void 0 ? _FireworkSDK$getInsta : '';
|
|
204
|
-
const videoLaunchBehavior = (_FireworkSDK$getInsta2 = _FireworkSDK.default.getInstance().videoLaunchBehavior) !== null && _FireworkSDK$getInsta2 !== void 0 ? _FireworkSDK$getInsta2 : 'default';
|
|
205
|
-
const adBadgeConfiguration = (_FireworkSDK$getInsta3 = _FireworkSDK.default.getInstance().getAdBadgeConfiguration()) !== null && _FireworkSDK$getInsta3 !== void 0 ? _FireworkSDK$getInsta3 : {};
|
|
206
|
-
const adBadgeTextType = (_adBadgeConfiguration = adBadgeConfiguration.badgeTextType) !== null && _adBadgeConfiguration !== void 0 ? _adBadgeConfiguration : '';
|
|
207
|
-
const backgroundColorOfAdBadge = (_adBadgeConfiguration2 = adBadgeConfiguration.backgroundColor) !== null && _adBadgeConfiguration2 !== void 0 ? _adBadgeConfiguration2 : '';
|
|
208
|
-
const textColorOfAdBadge = (_adBadgeConfiguration3 = adBadgeConfiguration.textColor) !== null && _adBadgeConfiguration3 !== void 0 ? _adBadgeConfiguration3 : '';
|
|
209
212
|
const dynamicContentParametersString = generateDynamicContentParametersString();
|
|
210
|
-
const appLanguage = (_FireworkSDK$getInsta4 = _FireworkSDK.default.getInstance().appLanguage) !== null && _FireworkSDK$getInsta4 !== void 0 ? _FireworkSDK$getInsta4 : '';
|
|
211
213
|
const requiresAds = (_adConfiguration$requ = adConfiguration === null || adConfiguration === void 0 ? void 0 : adConfiguration.requiresAds) !== null && _adConfiguration$requ !== void 0 ? _adConfiguration$requ : false;
|
|
212
214
|
const adsFetchTimeout = (_adConfiguration$adsF = adConfiguration === null || adConfiguration === void 0 ? void 0 : adConfiguration.adsFetchTimeout) !== null && _adConfiguration$adsF !== void 0 ? _adConfiguration$adsF : 10;
|
|
213
215
|
const vastAttributesString = generateVastAttributesString();
|
|
214
|
-
let key = `
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
216
|
+
let key = `gShareBaseURL:${gShareBaseURL}`;
|
|
217
|
+
|
|
218
|
+
if (_reactNative.Platform.OS === 'ios') {
|
|
219
|
+
key += `_appLanguage:${appLanguage}`;
|
|
220
|
+
}
|
|
221
|
+
|
|
219
222
|
key += `_adBadgeTextType:${adBadgeTextType}`;
|
|
220
223
|
key += `_backgroundColorOfAdBadge:${backgroundColorOfAdBadge}`;
|
|
221
224
|
key += `_textColorOfAdBadge:${textColorOfAdBadge}`;
|
|
225
|
+
key += `_videoLaunchBehavior:${videoLaunchBehavior}`;
|
|
226
|
+
key += `_source:${source}`;
|
|
227
|
+
key += `_channel:${channel}`;
|
|
228
|
+
key += `_playlist:${playlist}`;
|
|
222
229
|
key += `_dynamicContentParameters:${dynamicContentParametersString}`;
|
|
230
|
+
key += `_hashtagFilterExpression:${hashtagFilterExpression}`;
|
|
223
231
|
key += `_enablePictureInPicture:${enablePictureInPicture}`;
|
|
224
|
-
key += `_appLanguage:${appLanguage}`;
|
|
225
232
|
key += `_requiresAds:${requiresAds}`;
|
|
226
233
|
key += `_adsFetchTimeout:${adsFetchTimeout}`;
|
|
227
234
|
key += `_vastAttributes:${vastAttributesString}`;
|
|
228
|
-
key += `_hashtagFilterExpression:${hashtagFilterExpression}`;
|
|
229
235
|
return key;
|
|
230
236
|
};
|
|
231
237
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["StoryBlock.tsx"],"names":["NativeComponentName","StoryBlock","props","forwardedRef","nativeComponentRef","isFullscreenState","setIsFullscreenState","forceUpdate","x","sendCommand","command","nativeNodeHandle","current","commandId","UIManager","getViewManagerConfig","Commands","Platform","OS","toString","dispatchViewManagerCommand","play","pause","subscriptionOfShareBaseURLUpdated","FireworkSDKModuleEventEmitter","addListener","FWEventName","ShareBaseURLUpdated","FWLoggerUtil","log","subscriptionOfAdBadgeConfigurationUpdated","AdBadgeConfigurationUpdated","subscriptionOfVideoLaunchBehaviorUpdated","VideoLaunchBehaviorUpdated","subscriptionOfAppLanguageUpdated","AppLanguageUpdated","setTimeout","viewId","create","remove","handleStoryBlockLoadFinished","event","nativeEvent","name","onStoryBlockLoadFinished","reason","handleStoryBlockFullscreenStateChanged","isFullScreen","generateDynamicContentParametersString","dynamicContentParameters","resultString","sortedKeyList","Object","keys","sort","key","value","valueString","join","length","generateVastAttributesString","adConfiguration","vastAttributes","attribute","generateKey","source","channel","playlist","enablePictureInPicture","hashtagFilterExpression","gShareBaseURL","FireworkSDK","getInstance","shareBaseURL","videoLaunchBehavior","adBadgeConfiguration","getAdBadgeConfiguration","adBadgeTextType","badgeTextType","backgroundColorOfAdBadge","backgroundColor","textColorOfAdBadge","textColor","dynamicContentParametersString","appLanguage","requiresAds","adsFetchTimeout","vastAttributesString","onBackPress","navigator","popNativeContainer","subscription","BackHandler","addEventListener","style","assign","zIndex"],"mappings":";;;;;;;AACA;;AASA;;AAUA;;AAGA;;AAEA;;AACA;;AACA;;;;;;;;;;AAEA,MAAMA,mBAAmB,GAAG,cAA5B;;AA0DA,MAAMC,UAGL,GAAG,CAACC,KAAD,EAA0BC,YAA1B,KAA2C;AAC7C,QAAMC,kBAAkB,GAAG,mBAAO,IAAP,CAA3B;AACA,QAAM,CAACC,iBAAD,EAAoBC,oBAApB,IAA4C,qBAAkB,KAAlB,CAAlD;AACA,QAAM,GAAGC,WAAH,IAAkB,uBAAYC,CAAD,IAAOA,CAAC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;AACE,IAAA,GAAG,EAAEE,kBADP;AAEE,IAAA,GAAG,EAAE4D,WAAW;AAFlB,KAGM9D,KAHN;AAIE,IAAA,wBAAwB,EAAEsC,4BAJ5B;AAKE,IAAA,kCAAkC,EAChCM,sCANJ;AAQE,IAAA,KAAK,EAAEM,MAAM,CAAC2C,MAAP,CAAc,EAAd,EAAkBD,KAAlB,EAAyB;AAAEE,MAAAA,MAAM,EAAE,CAAC;AAAX,KAAzB;AART,KADF;AAYD,CAnPD;;4BAqPe,uBAAW/F,UAAX,C","sourcesContent":["import type { ForwardRefRenderFunction } from 'react';\nimport React, {\n forwardRef,\n useEffect,\n useImperativeHandle,\n useReducer,\n useRef,\n useState,\n} from 'react';\n\nimport {\n BackHandler,\n findNodeHandle,\n NativeSyntheticEvent,\n Platform,\n StyleProp,\n UIManager,\n ViewStyle,\n} from 'react-native';\n\nimport FireworkSDK from '../FireworkSDK';\nimport type AdConfiguration from '../models/AdConfiguration';\nimport type FWError from '../models/FWError';\nimport { FWEventName } from '../models/FWEventName';\nimport type { StoryBlockSource } from '../models/StoryBlockSource';\nimport { FireworkSDKModuleEventEmitter } from '../modules/FireworkSDKModule';\nimport FWLoggerUtil from '../utils/FWLoggerUtil';\nimport FWStoryBlock from './FWStoryBlock';\n\nconst NativeComponentName = 'FWStoryBlock';\n\nexport interface IStoryBlockMethods {\n /**\n * Play the story block.\n */\n play: () => void;\n /**\n * Pause the story block.\n */\n pause: () => void;\n}\n\n/**\n * The props type of StoryBlock component.\n */\nexport interface IStoryBlockProps {\n /**\n * Standard React Native View Style.\n */\n style?: StyleProp<ViewStyle>;\n /**\n * One of four available story block sources.\n */\n source: StoryBlockSource;\n /**\n * Channel id of the story block. Required when the source is set as channel or playlist or dynamicContent.\n */\n channel?: string;\n /**\n * Playlist id of the story block. Please note channel id is necessary. Required when the source is set as playlist.\n */\n playlist?: string;\n /**\n * The dynamic content parameters of the story block. Required when the source is set as dynamicContent.\n */\n dynamicContentParameters?: { [key: string]: string[] };\n /**\n * Hashtag filter expression is an s-expression used to provide feeds filtered by hashtags with specified criteria.\n * Queries are specified with boolean predicates on what hashtags are there on the video.\n * For instance, (and sport food) (or sport food) (and sport (or food comedy)) sport are all valid expressions.\n * Non-UTF-8 characters are not allowed. If using boolean predicates, the expression needs to be wrapped with parenthesis.\n */\n hashtagFilterExpression?: string;\n /**\n * Specifies if Picture in Picture is enabled. Only supported on iOS.\n */\n enablePictureInPicture?: boolean;\n /**\n * Ad configuration of the feed. Only supported on iOS.\n */\n adConfiguration?: AdConfiguration;\n /**\n * The feed loading result callback. It means loading successfully when error equals to undefined.\n */\n onStoryBlockLoadFinished?: (error?: FWError) => void;\n}\n\nconst StoryBlock: ForwardRefRenderFunction<\n IStoryBlockMethods,\n IStoryBlockProps\n> = (props: IStoryBlockProps, forwardedRef) => {\n const nativeComponentRef = useRef(null);\n const [isFullscreenState, setIsFullscreenState] = useState<boolean>(false);\n const [, forceUpdate] = useReducer((x) => x + 1, 0);\n useImperativeHandle(\n forwardedRef,\n () => {\n const sendCommand = (command: string) => {\n const nativeNodeHandle = findNodeHandle(nativeComponentRef.current);\n\n let commandId: string | number =\n UIManager.getViewManagerConfig(NativeComponentName).Commands[command];\n if (Platform.OS === 'android') {\n commandId = commandId.toString();\n }\n\n UIManager.dispatchViewManagerCommand(\n findNodeHandle(nativeNodeHandle),\n commandId,\n []\n );\n };\n return {\n play: () => {\n sendCommand('play');\n },\n pause: () => {\n sendCommand('pause');\n },\n };\n },\n []\n );\n useEffect(() => {\n const subscriptionOfShareBaseURLUpdated =\n FireworkSDKModuleEventEmitter.addListener(\n FWEventName.ShareBaseURLUpdated,\n () => {\n FWLoggerUtil.log('Receive FWEventName.ShareBaseURLUpdated');\n forceUpdate();\n }\n );\n const subscriptionOfAdBadgeConfigurationUpdated =\n FireworkSDKModuleEventEmitter.addListener(\n FWEventName.AdBadgeConfigurationUpdated,\n () => {\n FWLoggerUtil.log('Receive FWEventName.AdBadgeConfigurationUpdated');\n forceUpdate();\n }\n );\n\n const subscriptionOfVideoLaunchBehaviorUpdated =\n FireworkSDKModuleEventEmitter.addListener(\n FWEventName.VideoLaunchBehaviorUpdated,\n () => {\n FWLoggerUtil.log('Receive FWEventName.VideoLaunchBehaviorUpdated');\n forceUpdate();\n }\n );\n\n const subscriptionOfAppLanguageUpdated =\n FireworkSDKModuleEventEmitter.addListener(\n FWEventName.AppLanguageUpdated,\n () => {\n FWLoggerUtil.log('Receive FWEventName.AppLanguageUpdated');\n forceUpdate();\n }\n );\n\n if (Platform.OS === 'android') {\n setTimeout(() => {\n const viewId = findNodeHandle(nativeComponentRef.current);\n FWLoggerUtil.log(`StoryBlock createFragment viewId: ${viewId}`);\n UIManager.dispatchViewManagerCommand(\n viewId,\n UIManager.getViewManagerConfig(\n NativeComponentName\n ).Commands.create.toString(),\n [viewId]\n );\n }, 500);\n }\n\n return () => {\n subscriptionOfShareBaseURLUpdated.remove();\n subscriptionOfAdBadgeConfigurationUpdated.remove();\n subscriptionOfVideoLaunchBehaviorUpdated.remove();\n subscriptionOfAppLanguageUpdated.remove();\n };\n }, []);\n\n const handleStoryBlockLoadFinished = (event: NativeSyntheticEvent<any>) => {\n FWLoggerUtil.log(\n `StoryBlock handleStoryBlockLoadFinished ${event.nativeEvent.name}`\n );\n\n const { onStoryBlockLoadFinished } = props;\n const { name, reason } = event.nativeEvent;\n\n if (onStoryBlockLoadFinished) {\n if (name) {\n if (reason) {\n onStoryBlockLoadFinished({ name, reason });\n } else {\n onStoryBlockLoadFinished({ name });\n }\n } else {\n onStoryBlockLoadFinished();\n }\n }\n };\n\n const handleStoryBlockFullscreenStateChanged = (\n event: NativeSyntheticEvent<any>\n ) => {\n FWLoggerUtil.log(\n `StoryBlock handleStoryBlockFullscreenStateChanged ${event.nativeEvent.isFullScreen}`\n );\n const { isFullScreen } = event.nativeEvent;\n setIsFullscreenState(isFullScreen);\n };\n\n const generateDynamicContentParametersString = (): string => {\n const { dynamicContentParameters } = props;\n\n if (!dynamicContentParameters) {\n return '';\n }\n\n let resultString = '';\n const sortedKeyList = Object.keys(dynamicContentParameters).sort();\n for (const key of sortedKeyList) {\n const value = dynamicContentParameters[key];\n const valueString = value.join(',');\n if (resultString.length > 0) {\n resultString += '_';\n }\n\n resultString += `${key}:${valueString}`;\n }\n\n return resultString;\n };\n\n const generateVastAttributesString = () => {\n const { adConfiguration } = props;\n const vastAttributes = adConfiguration?.vastAttributes ?? '';\n if (!vastAttributes) {\n return '';\n }\n\n let resultString = '';\n for (const attribute of vastAttributes) {\n if (resultString.length > 0) {\n resultString += '_';\n }\n resultString += `${attribute.name ?? ''}:${attribute.value}`;\n }\n\n return resultString;\n };\n\n const generateKey = (): string => {\n const {\n source,\n channel = '',\n playlist = '',\n enablePictureInPicture = false,\n adConfiguration,\n hashtagFilterExpression = '',\n } = props;\n\n const gShareBaseURL = FireworkSDK.getInstance().shareBaseURL ?? '';\n const videoLaunchBehavior =\n FireworkSDK.getInstance().videoLaunchBehavior ?? 'default';\n const adBadgeConfiguration =\n FireworkSDK.getInstance().getAdBadgeConfiguration() ?? {};\n const adBadgeTextType = adBadgeConfiguration.badgeTextType ?? '';\n const backgroundColorOfAdBadge = adBadgeConfiguration.backgroundColor ?? '';\n const textColorOfAdBadge = adBadgeConfiguration.textColor ?? '';\n const dynamicContentParametersString =\n generateDynamicContentParametersString();\n const appLanguage = FireworkSDK.getInstance().appLanguage ?? '';\n const requiresAds = adConfiguration?.requiresAds ?? false;\n const adsFetchTimeout = adConfiguration?.adsFetchTimeout ?? 10;\n const vastAttributesString = generateVastAttributesString();\n\n let key = `source:${source}`;\n key += `_channel:${channel}`;\n key += `_playlist:${playlist}`;\n key += `_gShareBaseURL:${gShareBaseURL}`;\n key += `_videoLaunchBehavior:${videoLaunchBehavior}`;\n key += `_adBadgeTextType:${adBadgeTextType}`;\n key += `_backgroundColorOfAdBadge:${backgroundColorOfAdBadge}`;\n key += `_textColorOfAdBadge:${textColorOfAdBadge}`;\n key += `_dynamicContentParameters:${dynamicContentParametersString}`;\n key += `_enablePictureInPicture:${enablePictureInPicture}`;\n key += `_appLanguage:${appLanguage}`;\n key += `_requiresAds:${requiresAds}`;\n key += `_adsFetchTimeout:${adsFetchTimeout}`;\n key += `_vastAttributes:${vastAttributesString}`;\n key += `_hashtagFilterExpression:${hashtagFilterExpression}`;\n\n return key;\n };\n\n useEffect(() => {\n if (Platform.OS === 'android') {\n const onBackPress = () => {\n if (isFullscreenState) {\n FireworkSDK.getInstance().navigator.popNativeContainer();\n return true;\n }\n return false;\n };\n const subscription = BackHandler.addEventListener(\n 'hardwareBackPress',\n onBackPress\n );\n return () => {\n subscription.remove();\n };\n }\n\n return;\n }, [isFullscreenState]);\n\n const { style } = props;\n return (\n <FWStoryBlock\n ref={nativeComponentRef}\n key={generateKey()}\n {...props}\n onStoryBlockLoadFinished={handleStoryBlockLoadFinished}\n onStoryBlockFullScreenStateChanged={\n handleStoryBlockFullscreenStateChanged\n }\n style={Object.assign({}, style, { zIndex: -1 })}\n />\n );\n};\n\nexport default forwardRef(StoryBlock);\n"]}
|
|
1
|
+
{"version":3,"sources":["StoryBlock.tsx"],"names":["NativeComponentName","StoryBlock","props","forwardedRef","nativeComponentRef","isFullscreenState","setIsFullscreenState","forceUpdate","x","sendCommand","command","nativeNodeHandle","current","commandId","UIManager","getViewManagerConfig","Commands","Platform","OS","toString","dispatchViewManagerCommand","play","pause","subscriptionOfShareBaseURLUpdated","FireworkSDKModuleEventEmitter","addListener","FWEventName","ShareBaseURLUpdated","FWLoggerUtil","log","subscriptionOfAdBadgeConfigurationUpdated","AdBadgeConfigurationUpdated","subscriptionOfVideoLaunchBehaviorUpdated","VideoLaunchBehaviorUpdated","subscriptionOfAppLanguageUpdated","AppLanguageUpdated","setTimeout","viewId","create","remove","handleStoryBlockLoadFinished","event","nativeEvent","name","onStoryBlockLoadFinished","reason","handleStoryBlockFullscreenStateChanged","isFullScreen","generateDynamicContentParametersString","dynamicContentParameters","resultString","sortedKeyList","Object","keys","sort","key","value","valueString","join","length","generateVastAttributesString","adConfiguration","vastAttributes","attribute","generateKey","gShareBaseURL","FireworkSDK","getInstance","shareBaseURL","appLanguage","adBadgeConfiguration","adBadgeTextType","badgeTextType","backgroundColorOfAdBadge","backgroundColor","textColorOfAdBadge","textColor","videoLaunchBehavior","source","channel","playlist","hashtagFilterExpression","enablePictureInPicture","dynamicContentParametersString","requiresAds","adsFetchTimeout","vastAttributesString","onBackPress","navigator","popNativeContainer","subscription","BackHandler","addEventListener","style","assign","zIndex"],"mappings":";;;;;;;AACA;;AASA;;AAUA;;AAGA;;AAEA;;AACA;;AACA;;;;;;;;;;AAEA,MAAMA,mBAAmB,GAAG,cAA5B;;AA0DA,MAAMC,UAGL,GAAG,CAACC,KAAD,EAA0BC,YAA1B,KAA2C;AAC7C,QAAMC,kBAAkB,GAAG,mBAAO,IAAP,CAA3B;AACA,QAAM,CAACC,iBAAD,EAAoBC,oBAApB,IAA4C,qBAAkB,KAAlB,CAAlD;AACA,QAAM,GAAGC,WAAH,IAAkB,uBAAYC,CAAD,IAAOA,CAAC,GAAG,CAAtB,EAAyB,CAAzB,CAAxB;AACA,kCACEL,YADF,EAEE,MAAM;AACJ,UAAMM,WAAW,GAAIC,OAAD,IAAqB;AACvC,YAAMC,gBAAgB,GAAG,iCAAeP,kBAAkB,CAACQ,OAAlC,CAAzB;;AAEA,UAAIC,SAA0B,GAC5BC,uBAAUC,oBAAV,CAA+Bf,mBAA/B,EAAoDgB,QAApD,CAA6DN,OAA7D,CADF;;AAEA,UAAIO,sBAASC,EAAT,KAAgB,SAApB,EAA+B;AAC7BL,QAAAA,SAAS,GAAGA,SAAS,CAACM,QAAV,EAAZ;AACD;;AAEDL,6BAAUM,0BAAV,CACE,iCAAeT,gBAAf,CADF,EAEEE,SAFF,EAGE,EAHF;AAKD,KAdD;;AAeA,WAAO;AACLQ,MAAAA,IAAI,EAAE,MAAM;AACVZ,QAAAA,WAAW,CAAC,MAAD,CAAX;AACD,OAHI;AAILa,MAAAA,KAA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B,uBAAwB,EAA3D;AACA1B,IAAAA,GAAG,IAAK,2BAA0B2B,sBAAuB,EAAzD;AAEA3B,IAAAA,GAAG,IAAK,gBAAe6B,WAAY,EAAnC;AACA7B,IAAAA,GAAG,IAAK,oBAAmB8B,eAAgB,EAA3C;AACA9B,IAAAA,GAAG,IAAK,mBAAkB+B,oBAAqB,EAA/C;AAEA,WAAO/B,GAAP;AACD,GA/CD;;AAiDA,wBAAU,MAAM;AACd,QAAItC,sBAASC,EAAT,KAAgB,SAApB,EAA+B;AAC7B,YAAMqE,WAAW,GAAG,MAAM;AACxB,YAAIlF,iBAAJ,EAAuB;AACrB6D,+BAAYC,WAAZ,GAA0BqB,SAA1B,CAAoCC,kBAApC;;AACA,iBAAO,IAAP;AACD;;AACD,eAAO,KAAP;AACD,OAND;;AAOA,YAAMC,YAAY,GAAGC,yBAAYC,gBAAZ,CACnB,mBADmB,EAEnBL,WAFmB,CAArB;;AAIA,aAAO,MAAM;AACXG,QAAAA,YAAY,CAACnD,MAAb;AACD,OAFD;AAGD;;AAED;AACD,GAnBD,EAmBG,CAAClC,iBAAD,CAnBH;AAqBA,QAAM;AAAEwF,IAAAA;AAAF,MAAY3F,KAAlB;AACA,sBACE,6BAAC,qBAAD;AACE,IAAA,GAAG,EAAEE,kBADP;AAEE,IAAA,GAAG,EAAE4D,WAAW;AAFlB,KAGM9D,KAHN;AAIE,IAAA,wBAAwB,EAAEsC,4BAJ5B;AAKE,IAAA,kCAAkC,EAChCM,sCANJ;AAQE,IAAA,KAAK,EAAEM,MAAM,CAAC0C,MAAP,CAAc,EAAd,EAAkBD,KAAlB,EAAyB;AAAEE,MAAAA,MAAM,EAAE,CAAC;AAAX,KAAzB;AART,KADF;AAYD,CA1PD;;4BA4Pe,uBAAW9F,UAAX,C","sourcesContent":["import type { ForwardRefRenderFunction } from 'react';\nimport React, {\n forwardRef,\n useEffect,\n useImperativeHandle,\n useReducer,\n useRef,\n useState,\n} from 'react';\n\nimport {\n BackHandler,\n findNodeHandle,\n NativeSyntheticEvent,\n Platform,\n StyleProp,\n UIManager,\n ViewStyle,\n} from 'react-native';\n\nimport FireworkSDK from '../FireworkSDK';\nimport type AdConfiguration from '../models/AdConfiguration';\nimport type FWError from '../models/FWError';\nimport { FWEventName } from '../models/FWEventName';\nimport type { StoryBlockSource } from '../models/StoryBlockSource';\nimport { FireworkSDKModuleEventEmitter } from '../modules/FireworkSDKModule';\nimport FWLoggerUtil from '../utils/FWLoggerUtil';\nimport FWStoryBlock from './FWStoryBlock';\n\nconst NativeComponentName = 'FWStoryBlock';\n\nexport interface IStoryBlockMethods {\n /**\n * Play the story block.\n */\n play: () => void;\n /**\n * Pause the story block.\n */\n pause: () => void;\n}\n\n/**\n * The props type of StoryBlock component.\n */\nexport interface IStoryBlockProps {\n /**\n * Standard React Native View Style.\n */\n style?: StyleProp<ViewStyle>;\n /**\n * One of four available story block sources.\n */\n source: StoryBlockSource;\n /**\n * Channel id of the story block. Required when the source is set as channel or playlist or dynamicContent.\n */\n channel?: string;\n /**\n * Playlist id of the story block. Please note channel id is necessary. Required when the source is set as playlist.\n */\n playlist?: string;\n /**\n * The dynamic content parameters of the story block. Required when the source is set as dynamicContent.\n */\n dynamicContentParameters?: { [key: string]: string[] };\n /**\n * Hashtag filter expression is an s-expression used to provide feeds filtered by hashtags with specified criteria.\n * Queries are specified with boolean predicates on what hashtags are there on the video.\n * For instance, (and sport food) (or sport food) (and sport (or food comedy)) sport are all valid expressions.\n * Non-UTF-8 characters are not allowed. If using boolean predicates, the expression needs to be wrapped with parenthesis.\n */\n hashtagFilterExpression?: string;\n /**\n * Specifies if Picture in Picture is enabled. Only supported on iOS.\n */\n enablePictureInPicture?: boolean;\n /**\n * Ad configuration of the feed. Only supported on iOS.\n */\n adConfiguration?: AdConfiguration;\n /**\n * The feed loading result callback. It means loading successfully when error equals to undefined.\n */\n onStoryBlockLoadFinished?: (error?: FWError) => void;\n}\n\nconst StoryBlock: ForwardRefRenderFunction<\n IStoryBlockMethods,\n IStoryBlockProps\n> = (props: IStoryBlockProps, forwardedRef) => {\n const nativeComponentRef = useRef(null);\n const [isFullscreenState, setIsFullscreenState] = useState<boolean>(false);\n const [, forceUpdate] = useReducer((x) => x + 1, 0);\n useImperativeHandle(\n forwardedRef,\n () => {\n const sendCommand = (command: string) => {\n const nativeNodeHandle = findNodeHandle(nativeComponentRef.current);\n\n let commandId: string | number =\n UIManager.getViewManagerConfig(NativeComponentName).Commands[command];\n if (Platform.OS === 'android') {\n commandId = commandId.toString();\n }\n\n UIManager.dispatchViewManagerCommand(\n findNodeHandle(nativeNodeHandle),\n commandId,\n []\n );\n };\n return {\n play: () => {\n sendCommand('play');\n },\n pause: () => {\n sendCommand('pause');\n },\n };\n },\n []\n );\n useEffect(() => {\n const subscriptionOfShareBaseURLUpdated =\n FireworkSDKModuleEventEmitter.addListener(\n FWEventName.ShareBaseURLUpdated,\n () => {\n FWLoggerUtil.log('Receive FWEventName.ShareBaseURLUpdated');\n forceUpdate();\n }\n );\n const subscriptionOfAdBadgeConfigurationUpdated =\n FireworkSDKModuleEventEmitter.addListener(\n FWEventName.AdBadgeConfigurationUpdated,\n () => {\n FWLoggerUtil.log('Receive FWEventName.AdBadgeConfigurationUpdated');\n forceUpdate();\n }\n );\n\n const subscriptionOfVideoLaunchBehaviorUpdated =\n FireworkSDKModuleEventEmitter.addListener(\n FWEventName.VideoLaunchBehaviorUpdated,\n () => {\n FWLoggerUtil.log('Receive FWEventName.VideoLaunchBehaviorUpdated');\n forceUpdate();\n }\n );\n\n const subscriptionOfAppLanguageUpdated =\n FireworkSDKModuleEventEmitter.addListener(\n FWEventName.AppLanguageUpdated,\n () => {\n FWLoggerUtil.log('Receive FWEventName.AppLanguageUpdated');\n if (Platform.OS === 'android') {\n forceUpdate();\n }\n }\n );\n\n if (Platform.OS === 'android') {\n setTimeout(() => {\n const viewId = findNodeHandle(nativeComponentRef.current);\n FWLoggerUtil.log(`StoryBlock createFragment viewId: ${viewId}`);\n UIManager.dispatchViewManagerCommand(\n viewId,\n UIManager.getViewManagerConfig(\n NativeComponentName\n ).Commands.create.toString(),\n [viewId]\n );\n }, 500);\n }\n\n return () => {\n subscriptionOfShareBaseURLUpdated.remove();\n subscriptionOfAdBadgeConfigurationUpdated.remove();\n subscriptionOfVideoLaunchBehaviorUpdated.remove();\n subscriptionOfAppLanguageUpdated.remove();\n };\n }, []);\n\n const handleStoryBlockLoadFinished = (event: NativeSyntheticEvent<any>) => {\n FWLoggerUtil.log(\n `StoryBlock handleStoryBlockLoadFinished ${event.nativeEvent.name}`\n );\n\n const { onStoryBlockLoadFinished } = props;\n const { name, reason } = event.nativeEvent;\n\n if (onStoryBlockLoadFinished) {\n if (name) {\n if (reason) {\n onStoryBlockLoadFinished({ name, reason });\n } else {\n onStoryBlockLoadFinished({ name });\n }\n } else {\n onStoryBlockLoadFinished();\n }\n }\n };\n\n const handleStoryBlockFullscreenStateChanged = (\n event: NativeSyntheticEvent<any>\n ) => {\n FWLoggerUtil.log(\n `StoryBlock handleStoryBlockFullscreenStateChanged ${event.nativeEvent.isFullScreen}`\n );\n const { isFullScreen } = event.nativeEvent;\n setIsFullscreenState(isFullScreen);\n };\n\n const generateDynamicContentParametersString = (): string => {\n const { dynamicContentParameters } = props;\n\n if (!dynamicContentParameters) {\n return '';\n }\n\n let resultString = '';\n const sortedKeyList = Object.keys(dynamicContentParameters).sort();\n for (const key of sortedKeyList) {\n const value = dynamicContentParameters[key];\n const valueString = value.join(',');\n if (resultString.length > 0) {\n resultString += '_';\n }\n\n resultString += `${key}:${valueString}`;\n }\n\n return resultString;\n };\n\n const generateVastAttributesString = () => {\n const { adConfiguration } = props;\n const vastAttributes = adConfiguration?.vastAttributes ?? '';\n if (!vastAttributes) {\n return '';\n }\n\n let resultString = '';\n for (const attribute of vastAttributes) {\n if (resultString.length > 0) {\n resultString += '_';\n }\n resultString += `${attribute.name ?? ''}:${attribute.value}`;\n }\n\n return resultString;\n };\n\n const generateKey = (): string => {\n const gShareBaseURL = FireworkSDK.getInstance().shareBaseURL ?? '';\n const appLanguage = FireworkSDK.getInstance().appLanguage ?? '';\n const adBadgeConfiguration =\n FireworkSDK.getInstance().adBadgeConfiguration ?? {};\n const adBadgeTextType = adBadgeConfiguration.badgeTextType ?? '';\n const backgroundColorOfAdBadge = adBadgeConfiguration.backgroundColor ?? '';\n const textColorOfAdBadge = adBadgeConfiguration.textColor ?? '';\n const videoLaunchBehavior =\n FireworkSDK.getInstance().videoLaunchBehavior ?? 'default';\n\n const {\n source,\n channel = '',\n playlist = '',\n hashtagFilterExpression = '',\n enablePictureInPicture = false,\n adConfiguration,\n } = props;\n const dynamicContentParametersString =\n generateDynamicContentParametersString();\n\n const requiresAds = adConfiguration?.requiresAds ?? false;\n const adsFetchTimeout = adConfiguration?.adsFetchTimeout ?? 10;\n const vastAttributesString = generateVastAttributesString();\n\n let key = `gShareBaseURL:${gShareBaseURL}`;\n if (Platform.OS === 'ios') {\n key += `_appLanguage:${appLanguage}`;\n }\n key += `_adBadgeTextType:${adBadgeTextType}`;\n key += `_backgroundColorOfAdBadge:${backgroundColorOfAdBadge}`;\n key += `_textColorOfAdBadge:${textColorOfAdBadge}`;\n key += `_videoLaunchBehavior:${videoLaunchBehavior}`;\n\n key += `_source:${source}`;\n key += `_channel:${channel}`;\n key += `_playlist:${playlist}`;\n key += `_dynamicContentParameters:${dynamicContentParametersString}`;\n key += `_hashtagFilterExpression:${hashtagFilterExpression}`;\n key += `_enablePictureInPicture:${enablePictureInPicture}`;\n\n key += `_requiresAds:${requiresAds}`;\n key += `_adsFetchTimeout:${adsFetchTimeout}`;\n key += `_vastAttributes:${vastAttributesString}`;\n\n return key;\n };\n\n useEffect(() => {\n if (Platform.OS === 'android') {\n const onBackPress = () => {\n if (isFullscreenState) {\n FireworkSDK.getInstance().navigator.popNativeContainer();\n return true;\n }\n return false;\n };\n const subscription = BackHandler.addEventListener(\n 'hardwareBackPress',\n onBackPress\n );\n return () => {\n subscription.remove();\n };\n }\n\n return;\n }, [isFullscreenState]);\n\n const { style } = props;\n return (\n <FWStoryBlock\n ref={nativeComponentRef}\n key={generateKey()}\n {...props}\n onStoryBlockLoadFinished={handleStoryBlockLoadFinished}\n onStoryBlockFullScreenStateChanged={\n handleStoryBlockFullscreenStateChanged\n }\n style={Object.assign({}, style, { zIndex: -1 })}\n />\n );\n};\n\nexport default forwardRef(StoryBlock);\n"]}
|
|
@@ -112,13 +112,15 @@ class VideoFeed extends _react.default.Component {
|
|
|
112
112
|
|
|
113
113
|
this._subscriptions.push(subscriptionOfVideoLaunchBehaviorUpdated);
|
|
114
114
|
|
|
115
|
-
|
|
116
|
-
|
|
115
|
+
if (_reactNative.Platform.OS === 'ios') {
|
|
116
|
+
const subscriptionOfAppLanguageUpdated = _FireworkSDKModule.FireworkSDKModuleEventEmitter.addListener(_FWEventName.FWEventName.AppLanguageUpdated, () => {
|
|
117
|
+
_FWLoggerUtil.default.log('Receive FWEventName.AppLanguageUpdated');
|
|
117
118
|
|
|
118
|
-
|
|
119
|
-
|
|
119
|
+
this.setState({});
|
|
120
|
+
});
|
|
120
121
|
|
|
121
|
-
|
|
122
|
+
this._subscriptions.push(subscriptionOfAppLanguageUpdated);
|
|
123
|
+
}
|
|
122
124
|
}
|
|
123
125
|
/**
|
|
124
126
|
* @ignore
|
|
@@ -140,68 +142,75 @@ class VideoFeed extends _react.default.Component {
|
|
|
140
142
|
|
|
141
143
|
|
|
142
144
|
render() {
|
|
143
|
-
var
|
|
145
|
+
var _FireworkSDK$getInsta, _FireworkSDK$getInsta2, _FireworkSDK$getInsta3, _adBadgeConfiguration, _adBadgeConfiguration2, _adBadgeConfiguration3, _FireworkSDK$getInsta4, _videoFeedConfigurati, _videoFeedConfigurati2, _videoFeedConfigurati3, _videoFeedConfigurati4, _videoFeedConfigurati5, _videoFeedConfigurati6, _videoPlayerConfigura, _adConfiguration$requ, _adConfiguration$adsF;
|
|
144
146
|
|
|
145
147
|
_FWLoggerUtil.default.log(`VideoFeed render ${JSON.stringify(this.props)}`);
|
|
146
148
|
|
|
149
|
+
const gShareBaseURL = (_FireworkSDK$getInsta = _FireworkSDK.default.getInstance().shareBaseURL) !== null && _FireworkSDK$getInsta !== void 0 ? _FireworkSDK$getInsta : '';
|
|
150
|
+
const appLanguage = (_FireworkSDK$getInsta2 = _FireworkSDK.default.getInstance().appLanguage) !== null && _FireworkSDK$getInsta2 !== void 0 ? _FireworkSDK$getInsta2 : '';
|
|
151
|
+
const adBadgeConfiguration = (_FireworkSDK$getInsta3 = _FireworkSDK.default.getInstance().adBadgeConfiguration) !== null && _FireworkSDK$getInsta3 !== void 0 ? _FireworkSDK$getInsta3 : {};
|
|
152
|
+
const adBadgeTextType = (_adBadgeConfiguration = adBadgeConfiguration.badgeTextType) !== null && _adBadgeConfiguration !== void 0 ? _adBadgeConfiguration : '';
|
|
153
|
+
const backgroundColorOfAdBadge = (_adBadgeConfiguration2 = adBadgeConfiguration.backgroundColor) !== null && _adBadgeConfiguration2 !== void 0 ? _adBadgeConfiguration2 : '';
|
|
154
|
+
const textColorOfAdBadge = (_adBadgeConfiguration3 = adBadgeConfiguration.textColor) !== null && _adBadgeConfiguration3 !== void 0 ? _adBadgeConfiguration3 : '';
|
|
155
|
+
const videoLaunchBehavior = (_FireworkSDK$getInsta4 = _FireworkSDK.default.getInstance().videoLaunchBehavior) !== null && _FireworkSDK$getInsta4 !== void 0 ? _FireworkSDK$getInsta4 : 'default';
|
|
147
156
|
const {
|
|
148
157
|
source,
|
|
149
158
|
channel = '',
|
|
150
159
|
playlist = '',
|
|
151
160
|
playlistGroup = '',
|
|
161
|
+
hashtagFilterExpression = '',
|
|
152
162
|
mode = 'row',
|
|
153
|
-
adConfiguration,
|
|
154
163
|
enablePictureInPicture = false,
|
|
155
|
-
|
|
164
|
+
adConfiguration,
|
|
165
|
+
videoPlayerConfiguration
|
|
156
166
|
} = this.props;
|
|
157
167
|
|
|
168
|
+
const dynamicContentParametersString = this._generateDynamicContentParametersString();
|
|
169
|
+
|
|
158
170
|
const videoFeedConfiguration = this._getVideoFeedConfiguration();
|
|
159
171
|
|
|
160
172
|
const titleHidden = (_videoFeedConfigurati = videoFeedConfiguration === null || videoFeedConfiguration === void 0 ? void 0 : (_videoFeedConfigurati2 = videoFeedConfiguration.title) === null || _videoFeedConfigurati2 === void 0 ? void 0 : _videoFeedConfigurati2.hidden) !== null && _videoFeedConfigurati !== void 0 ? _videoFeedConfigurati : false;
|
|
161
173
|
const titlePosition = (_videoFeedConfigurati3 = videoFeedConfiguration === null || videoFeedConfiguration === void 0 ? void 0 : videoFeedConfiguration.titlePosition) !== null && _videoFeedConfigurati3 !== void 0 ? _videoFeedConfigurati3 : 'nested';
|
|
162
|
-
const gShareBaseURL = (_FireworkSDK$getInsta = _FireworkSDK.default.getInstance().shareBaseURL) !== null && _FireworkSDK$getInsta !== void 0 ? _FireworkSDK$getInsta : '';
|
|
163
|
-
const adBadgeConfiguration = (_FireworkSDK$getInsta2 = _FireworkSDK.default.getInstance().getAdBadgeConfiguration()) !== null && _FireworkSDK$getInsta2 !== void 0 ? _FireworkSDK$getInsta2 : {};
|
|
164
|
-
const adBadgeTextType = (_adBadgeConfiguration = adBadgeConfiguration.badgeTextType) !== null && _adBadgeConfiguration !== void 0 ? _adBadgeConfiguration : '';
|
|
165
|
-
const backgroundColorOfAdBadge = (_adBadgeConfiguration2 = adBadgeConfiguration.backgroundColor) !== null && _adBadgeConfiguration2 !== void 0 ? _adBadgeConfiguration2 : '';
|
|
166
|
-
const textColorOfAdBadge = (_adBadgeConfiguration3 = adBadgeConfiguration.textColor) !== null && _adBadgeConfiguration3 !== void 0 ? _adBadgeConfiguration3 : '';
|
|
167
|
-
|
|
168
|
-
const dynamicContentParametersString = this._generateDynamicContentParametersString();
|
|
169
|
-
|
|
170
174
|
const enableAutoplay = (_videoFeedConfigurati4 = videoFeedConfiguration === null || videoFeedConfiguration === void 0 ? void 0 : videoFeedConfiguration.enableAutoplay) !== null && _videoFeedConfigurati4 !== void 0 ? _videoFeedConfigurati4 : false;
|
|
171
175
|
const gridColumns = (_videoFeedConfigurati5 = videoFeedConfiguration === null || videoFeedConfiguration === void 0 ? void 0 : videoFeedConfiguration.gridColumns) !== null && _videoFeedConfigurati5 !== void 0 ? _videoFeedConfigurati5 : 2;
|
|
176
|
+
const showAdBadge = (_videoFeedConfigurati6 = videoFeedConfiguration === null || videoFeedConfiguration === void 0 ? void 0 : videoFeedConfiguration.showAdBadge) !== null && _videoFeedConfigurati6 !== void 0 ? _videoFeedConfigurati6 : false;
|
|
177
|
+
const shareBaseURL = (_videoPlayerConfigura = videoPlayerConfiguration === null || videoPlayerConfiguration === void 0 ? void 0 : videoPlayerConfiguration.shareBaseURL) !== null && _videoPlayerConfigura !== void 0 ? _videoPlayerConfigura : '';
|
|
172
178
|
const requiresAds = (_adConfiguration$requ = adConfiguration === null || adConfiguration === void 0 ? void 0 : adConfiguration.requiresAds) !== null && _adConfiguration$requ !== void 0 ? _adConfiguration$requ : false;
|
|
173
179
|
const adsFetchTimeout = (_adConfiguration$adsF = adConfiguration === null || adConfiguration === void 0 ? void 0 : adConfiguration.adsFetchTimeout) !== null && _adConfiguration$adsF !== void 0 ? _adConfiguration$adsF : 10;
|
|
174
180
|
|
|
175
181
|
const vastAttributesString = this._generateVastAttributesString();
|
|
176
182
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
183
|
+
let key = `gShareBaseURL:${gShareBaseURL}`;
|
|
184
|
+
|
|
185
|
+
if (_reactNative.Platform.OS === 'ios') {
|
|
186
|
+
key += `_appLanguage:${appLanguage}`;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
key += `_adBadgeTextType:${adBadgeTextType}`;
|
|
190
|
+
key += `_backgroundColorOfAdBadge:${backgroundColorOfAdBadge}`;
|
|
191
|
+
key += `_textColorOfAdBadge:${textColorOfAdBadge}`;
|
|
192
|
+
key += `_videoLaunchBehavior:${videoLaunchBehavior}`;
|
|
193
|
+
key += `_source:${source}`;
|
|
181
194
|
key += `_channel:${channel}`;
|
|
182
195
|
key += `_playlist:${playlist}`;
|
|
183
196
|
key += `_playlistGroup:${playlistGroup}`;
|
|
197
|
+
key += `_dynamicContentParameters:${dynamicContentParametersString}`;
|
|
198
|
+
key += `_hashtagFilterExpression:${hashtagFilterExpression}`;
|
|
184
199
|
key += `_mode:${mode}`;
|
|
200
|
+
key += `_enablePictureInPicture:${enablePictureInPicture}`;
|
|
185
201
|
key += `_titleHidden:${titleHidden}`;
|
|
186
202
|
key += `_titlePosition:${titlePosition}`;
|
|
187
|
-
key += `_gShareBaseURL:${gShareBaseURL}`;
|
|
188
|
-
key += `_adBadgeTextType:${adBadgeTextType}`;
|
|
189
|
-
key += `_backgroundColorOfAdBadge:${backgroundColorOfAdBadge}`;
|
|
190
|
-
key += `_textColorOfAdBadge:${textColorOfAdBadge}`;
|
|
191
|
-
key += `_dynamicContentParameters:${dynamicContentParametersString}`;
|
|
192
203
|
key += `_enableAutoplay:${enableAutoplay}`;
|
|
193
|
-
key += `_enablePictureInPicture:${enablePictureInPicture}`;
|
|
194
204
|
key += `_gridColumns:${gridColumns}`;
|
|
205
|
+
key += `_showAdBadge:${showAdBadge}`;
|
|
206
|
+
key += `_shareBaseURL:${shareBaseURL}`;
|
|
195
207
|
key += `_requiresAds:${requiresAds}`;
|
|
196
208
|
key += `_adsFetchTimeout:${adsFetchTimeout}`;
|
|
197
209
|
key += `_vastAttributes:${vastAttributesString}`;
|
|
198
|
-
key += `_showAdBadge:${showAdBadge}`;
|
|
199
|
-
key += `_videoLaunchBehavior:${videoLaunchBehavior}`;
|
|
200
|
-
key += `_appLanguage:${appLanguage}`;
|
|
201
|
-
key += `_hashtagFilterExpression:${hashtagFilterExpression}`;
|
|
202
210
|
return /*#__PURE__*/_react.default.createElement(_FWVideoFeed.default, _extends({
|
|
203
211
|
key: key
|
|
204
212
|
}, this.props, {
|
|
213
|
+
videoFeedConfiguration: videoFeedConfiguration,
|
|
205
214
|
ref: this._nativeComponentRef,
|
|
206
215
|
onVideoFeedLoadFinished: this._onVideoFeedLoadFinished,
|
|
207
216
|
mode: mode,
|