react-native-firework-sdk 2.0.0 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/build.gradle +5 -3
- package/android/src/main/java/com/fireworksdk/bridge/components/videofeed/StoryBlockFragment.kt +129 -0
- package/android/src/main/java/com/fireworksdk/bridge/components/videofeed/StoryBlockFrameLayout.kt +84 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/FWEventName.kt +2 -1
- package/android/src/main/java/com/fireworksdk/bridge/models/FWProductInfoViewConfiguration.kt +18 -5
- package/android/src/main/java/com/fireworksdk/bridge/models/FWProductInfoViewConfigurationDeserializer.kt +33 -9
- package/android/src/main/java/com/fireworksdk/bridge/models/FWShoppingCtaResult.kt +17 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/FWShoppingCtaResultDeserializer.kt +33 -0
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/manager/FWStoryBlockManager.kt +126 -45
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/manager/FWVideoFeedManager.kt +6 -3
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/models/FWVideoShoppingInterface.kt +2 -2
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FWNavigatorModule.kt +9 -1
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FWVideoShoppingModule.kt +81 -50
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/utils/FWEventUtils.kt +9 -2
- package/android/src/main/java/com/fireworksdk/bridge/utils/FWConfigUtil.kt +1 -1
- package/android/src/main/java/com/fireworksdk/bridge/utils/FWGlobalDataUtil.kt +4 -0
- package/android/src/main/java/com/fireworksdk/bridge/utils/FWLanguageUtil.kt +48 -16
- package/android/src/main/res/layout/fw_bridge_story_block.xml +24 -0
- package/ios/Components/StoryBlock.swift +33 -2
- package/ios/Components/StoryBlockManager.m +32 -0
- package/ios/Components/VideoFeed.swift +9 -29
- package/ios/Components/VideoFeedManager.m +11 -6
- package/ios/FireworkSdk.xcodeproj/project.pbxproj +378 -104
- package/ios/Models/NativeToRN/FireworkEventName.swift +3 -1
- package/ios/Models/RNToNative/RCTConvert+Shopping.swift +21 -0
- package/ios/Models/RNToNative/RCTConvert+VideoFeed.swift +27 -0
- package/ios/Modules/FWNavigatorModule/FWNavigatorModule.swift +5 -1
- package/ios/Modules/FireworkSDKModule/FireworkSDKModule.m +1 -0
- package/ios/Modules/FireworkSDKModule/FireworkSDKModule.swift +30 -0
- package/ios/Modules/Shopping/ProductInfoViewConfiguration.swift +13 -0
- package/ios/Modules/Shopping/ShoppingCTAResult.swift +16 -0
- package/ios/Modules/Shopping/ShoppingModule.m +2 -1
- package/ios/Modules/Shopping/ShoppingModule.swift +106 -30
- package/ios/Support/MultiHostStreaming/FWMultiHostStreaming.podspec +24 -0
- package/ios/Support/MultiHostStreaming/src/MultiHostStreamingSDK.swift +17 -0
- package/ios/Utils/AppLanguage/Bundle+FWSwizzle.swift +58 -0
- package/ios/Utils/AppLanguage/FWAppLanguageManager.swift +139 -0
- package/ios/Utils/AppLanguage/FWLanguageUtil.swift +43 -0
- package/ios/Utils/AppLanguage/NumberFormatter+FWSwizzle.swift +25 -0
- package/ios/Utils/AppLanguage/UIImageView+FWSwizzle.swift +91 -0
- package/ios/Utils/AppLanguage/UILabel+FWSwizzle.swift +98 -0
- package/ios/Utils/AppLanguage/UITextField+FWSwizzle.swift +97 -0
- package/ios/Utils/AppLanguage/UITextView+FWSwizzle.swift +97 -0
- package/ios/Utils/AppLanguage/UIView+FWSwizzle.swift +38 -0
- package/ios/Utils/AppLanguage/UIViewController+FWSwizzle.swift +32 -0
- package/ios/Utils/AppLanguage/UIWindow+FWSwizzle.swift +26 -0
- package/ios/Utils/AppLanguage/URLSession+FWSwizzle.swift +69 -0
- package/ios/Utils/{DispatchQueue+FWOnce.swift → Extensions/DispatchQueue+FWOnce.swift} +3 -3
- package/ios/Utils/{UINavigationController+FWSwizzle.swift → Extensions/Swizzle/UINavigationController+FWSwizzle.swift} +6 -8
- package/ios/Utils/Extensions/UIView+FWUIHierarchy.swift +47 -0
- package/ios/Utils/FWRTL/Classes/Manager/FWRTLManager.h +25 -0
- package/ios/Utils/FWRTL/Classes/Manager/FWRTLManager.m +75 -0
- package/ios/Utils/FWRTL/Classes/UICategories/CALayer+FWRTL.h +21 -0
- package/ios/Utils/FWRTL/Classes/UICategories/CALayer+FWRTL.m +124 -0
- package/ios/Utils/FWRTL/Classes/UICategories/FWRTLRemoteViewControllerAdaptor.h +11 -0
- package/ios/Utils/FWRTL/Classes/UICategories/FWRTLRemoteViewControllerAdaptor.m +86 -0
- package/ios/Utils/FWRTL/Classes/UICategories/FWRTLWhiteListManager.h +16 -0
- package/ios/Utils/FWRTL/Classes/UICategories/FWRTLWhiteListManager.m +55 -0
- package/ios/Utils/FWRTL/Classes/UICategories/UILabel+FWRTL.h +18 -0
- package/ios/Utils/FWRTL/Classes/UICategories/UILabel+FWRTL.m +39 -0
- package/ios/Utils/FWRTL/Classes/UICategories/UIView+FWRTL.h +54 -0
- package/ios/Utils/FWRTL/Classes/UICategories/UIView+FWRTL.m +141 -0
- package/ios/Utils/FWRTL/Classes/UICategories/UIWindow+FWRTL.h +16 -0
- package/ios/Utils/FWRTL/Classes/UICategories/UIWindow+FWRTL.m +20 -0
- package/ios/Utils/FWRTL/Classes/Utils/FWRTLDefinitions.h +52 -0
- package/ios/Utils/FWRTL/Classes/Utils/NSObject+FWRTLReloadBlock.h +19 -0
- package/ios/Utils/FWRTL/Classes/Utils/NSObject+FWRTLReloadBlock.m +49 -0
- package/ios/Utils/FWRTL/Classes/Utils/NSString+FWRTL.h +21 -0
- package/ios/Utils/FWRTL/Classes/Utils/NSString+FWRTL.m +38 -0
- package/ios/Utils/FWRTL/Classes/Utils/UIImage+FWRTL.h +18 -0
- package/ios/Utils/FWRTL/Classes/Utils/UIImage+FWRTL.m +43 -0
- package/ios/Utils/FWSwizzleLoader.m +6 -1
- package/ios/Utils/FWSwizzleLoader.swift +13 -0
- package/ios/Utils/FWSwizzleUtil.swift +17 -9
- package/ios/react_native_firework_sdk.h +1 -0
- package/ios/scripts/react_native_firework_sdk_pods.rb +31 -0
- package/lib/commonjs/FireworkSDK.js +21 -4
- package/lib/commonjs/FireworkSDK.js.map +1 -1
- package/lib/commonjs/VideoShopping.js +20 -37
- package/lib/commonjs/VideoShopping.js.map +1 -1
- package/lib/commonjs/components/StoryBlock.js +190 -125
- package/lib/commonjs/components/StoryBlock.js.map +1 -1
- package/lib/commonjs/components/VideoFeed.js +11 -1
- package/lib/commonjs/components/VideoFeed.js.map +1 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/models/FWEventName.js +2 -0
- package/lib/commonjs/models/FWEventName.js.map +1 -1
- package/lib/commonjs/models/ShoppingCTAResult.js +2 -0
- package/lib/commonjs/modules/FireworkSDKModule.js.map +1 -1
- package/lib/commonjs/modules/ShoppingModule.js.map +1 -1
- package/lib/module/FireworkSDK.js +21 -4
- package/lib/module/FireworkSDK.js.map +1 -1
- package/lib/module/VideoShopping.js +20 -39
- package/lib/module/VideoShopping.js.map +1 -1
- package/lib/module/components/StoryBlock.js +179 -131
- package/lib/module/components/StoryBlock.js.map +1 -1
- package/lib/module/components/VideoFeed.js +10 -1
- package/lib/module/components/VideoFeed.js.map +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/models/FWEventName.js +2 -0
- package/lib/module/models/FWEventName.js.map +1 -1
- package/lib/module/models/ShoppingCTAResult.js +2 -0
- package/lib/module/modules/FireworkSDKModule.js.map +1 -1
- package/lib/module/modules/ShoppingModule.js.map +1 -1
- package/lib/typescript/FireworkSDK.d.ts +7 -4
- package/lib/typescript/VideoShopping.d.ts +9 -11
- package/lib/typescript/components/StoryBlock.d.ts +19 -25
- package/lib/typescript/index.d.ts +6 -6
- package/lib/typescript/models/FWEventName.d.ts +2 -0
- package/lib/typescript/models/FWEvents.d.ts +14 -1
- package/lib/typescript/models/ProductInfoViewConfiguration.d.ts +36 -1
- package/lib/typescript/models/ShoppingCTAResult.d.ts +11 -0
- package/lib/typescript/modules/FireworkSDKModule.d.ts +1 -2
- package/lib/typescript/modules/ShoppingModule.d.ts +2 -1
- package/package.json +2 -2
- package/react-native-firework-sdk.podspec +26 -24
- package/src/FireworkSDK.ts +18 -5
- package/src/VideoShopping.ts +40 -53
- package/src/components/StoryBlock.tsx +199 -96
- package/src/components/VideoFeed.tsx +11 -0
- package/src/index.ts +15 -7
- package/src/models/FWEventName.ts +2 -0
- package/src/models/FWEvents.ts +14 -1
- package/src/models/ProductInfoViewConfiguration.ts +38 -1
- package/src/models/ShoppingCTAResult.ts +11 -0
- package/src/modules/FireworkSDKModule.ts +1 -2
- package/src/modules/ShoppingModule.ts +5 -5
- package/android/src/main/java/com/fireworksdk/bridge/constants/FWCommandConstant.kt +0 -6
- package/ios/Utils/UIView+ParentViewController.swift +0 -21
- package/lib/commonjs/models/AddToCartResult.js +0 -2
- package/lib/module/models/AddToCartResult.js +0 -2
- package/lib/typescript/models/AddToCartResult.d.ts +0 -10
- package/src/models/AddToCartResult.ts +0 -10
- /package/ios/Utils/{String+Color.swift → Extensions/String+Color.swift} +0 -0
- /package/ios/Utils/{UIView+Constraints.swift → Extensions/UIView+Constraints.swift} +0 -0
- /package/ios/Utils/{UIViewController+AttachChild.swift → Extensions/UIViewController+AttachChild.swift} +0 -0
- /package/lib/commonjs/models/{AddToCartResult.js.map → ShoppingCTAResult.js.map} +0 -0
- /package/lib/module/models/{AddToCartResult.js.map → ShoppingCTAResult.js.map} +0 -0
|
@@ -26,10 +26,8 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
|
26
26
|
*/
|
|
27
27
|
class VideoShopping {
|
|
28
28
|
/**
|
|
29
|
-
* This callback is triggered when the user clicks the "Add to cart" button.
|
|
30
|
-
*
|
|
31
|
-
* The host apps can return an AddToCartResult object to tell FireworkSDK the result of adding to cart.
|
|
32
|
-
* If the host apps want to customize the processing logic of clicking "Add to cart" button, they could return null or undefined in the callback.
|
|
29
|
+
* This callback is triggered when the user clicks the "Add to cart" or "Shop now" button.
|
|
30
|
+
* The host app can return a ShoppingCTAResult object to tell SDK how to handle the result.
|
|
33
31
|
*/
|
|
34
32
|
|
|
35
33
|
/**
|
|
@@ -65,8 +63,8 @@ class VideoShopping {
|
|
|
65
63
|
}
|
|
66
64
|
|
|
67
65
|
/**
|
|
68
|
-
* The
|
|
69
|
-
*
|
|
66
|
+
* The configuration of product info view.
|
|
67
|
+
* Please refer to {@link ProductInfoViewConfiguration} for more details.
|
|
70
68
|
*/
|
|
71
69
|
get productInfoViewConfiguration() {
|
|
72
70
|
return this._productInfoViewConfiguration;
|
|
@@ -75,9 +73,7 @@ class VideoShopping {
|
|
|
75
73
|
set productInfoViewConfiguration(value) {
|
|
76
74
|
this._productInfoViewConfiguration = value;
|
|
77
75
|
|
|
78
|
-
|
|
79
|
-
_ShoppingModule.default.setProductInfoViewConfiguration(value !== null && value !== void 0 ? value : {});
|
|
80
|
-
}
|
|
76
|
+
_ShoppingModule.default.setProductInfoViewConfiguration(value !== null && value !== void 0 ? value : {});
|
|
81
77
|
}
|
|
82
78
|
|
|
83
79
|
/**
|
|
@@ -94,9 +90,7 @@ class VideoShopping {
|
|
|
94
90
|
set onCustomClickLinkButton(value) {
|
|
95
91
|
this._onCustomClickLinkButton = value;
|
|
96
92
|
|
|
97
|
-
|
|
98
|
-
_ShoppingModule.default.setCustomClickLinkButtonEnabled(!!value);
|
|
99
|
-
}
|
|
93
|
+
_ShoppingModule.default.setCustomClickLinkButtonEnabled(!!value);
|
|
100
94
|
}
|
|
101
95
|
|
|
102
96
|
get eventEmitter() {
|
|
@@ -114,7 +108,7 @@ class VideoShopping {
|
|
|
114
108
|
}
|
|
115
109
|
|
|
116
110
|
constructor() {
|
|
117
|
-
_defineProperty(this, "
|
|
111
|
+
_defineProperty(this, "onShoppingCTA", void 0);
|
|
118
112
|
|
|
119
113
|
_defineProperty(this, "_onCustomClickCartIcon", void 0);
|
|
120
114
|
|
|
@@ -126,10 +120,10 @@ class VideoShopping {
|
|
|
126
120
|
|
|
127
121
|
_defineProperty(this, "_onCustomClickLinkButton", void 0);
|
|
128
122
|
|
|
129
|
-
this.eventEmitter.addListener(_FWEventName.FWEventName.
|
|
130
|
-
_FWLoggerUtil.default.log(`Receive
|
|
123
|
+
this.eventEmitter.addListener(_FWEventName.FWEventName.ShoppingCTAButtonClick, event => {
|
|
124
|
+
_FWLoggerUtil.default.log(`Receive ShoppingCTA event productId: ${event === null || event === void 0 ? void 0 : event.productId} unitId: ${event === null || event === void 0 ? void 0 : event.unitId} url: ${event === null || event === void 0 ? void 0 : event.url}`);
|
|
131
125
|
|
|
132
|
-
this.
|
|
126
|
+
this.handleShoppingCTAEvent(event);
|
|
133
127
|
});
|
|
134
128
|
this.eventEmitter.addListener(_FWEventName.FWEventName.ClickCartIcon, () => {
|
|
135
129
|
_FWLoggerUtil.default.log('Receive ClickCartIcon event');
|
|
@@ -142,14 +136,11 @@ class VideoShopping {
|
|
|
142
136
|
this.handleUpdateProductDetailsEvent(event);
|
|
143
137
|
});
|
|
144
138
|
this.eventEmitter.addListener(_FWEventName.FWEventName.LogMessage, () => {});
|
|
139
|
+
this.eventEmitter.addListener(_FWEventName.FWEventName.CustomLinkButtonClick, event => {
|
|
140
|
+
_FWLoggerUtil.default.log(`Receive CustomLinkButtonClick event url: ${event === null || event === void 0 ? void 0 : event.url}`);
|
|
145
141
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
_FWLoggerUtil.default.log(`Receive CustomLinkButtonClick event url: ${event === null || event === void 0 ? void 0 : event.url}`);
|
|
149
|
-
|
|
150
|
-
this.handleCustomLinkButtonClickEvent(event);
|
|
151
|
-
});
|
|
152
|
-
}
|
|
142
|
+
this.handleCustomLinkButtonClickEvent(event);
|
|
143
|
+
});
|
|
153
144
|
}
|
|
154
145
|
/**
|
|
155
146
|
*
|
|
@@ -165,28 +156,20 @@ class VideoShopping {
|
|
|
165
156
|
_ShoppingModule.default.setCartItemCount(count);
|
|
166
157
|
}
|
|
167
158
|
|
|
168
|
-
async
|
|
159
|
+
async handleShoppingCTAEvent(event) {
|
|
169
160
|
const callbackId = event.callbackId;
|
|
170
161
|
delete event.callbackId;
|
|
171
162
|
|
|
172
|
-
if (this.
|
|
173
|
-
const result = await this.
|
|
163
|
+
if (this.onShoppingCTA) {
|
|
164
|
+
const result = await this.onShoppingCTA(event);
|
|
174
165
|
|
|
175
|
-
if (
|
|
176
|
-
|
|
177
|
-
_ShoppingModule.default.updateAddToCartStatus(result.res, result.tips, callbackId);
|
|
178
|
-
}
|
|
179
|
-
} else {
|
|
180
|
-
if (callbackId) {
|
|
181
|
-
if (_reactNative.Platform.OS === 'ios') {
|
|
182
|
-
_ShoppingModule.default.clearCallbackId(callbackId, _FWEventName.FWEventName.AddToCart);
|
|
183
|
-
}
|
|
184
|
-
}
|
|
166
|
+
if (callbackId) {
|
|
167
|
+
_ShoppingModule.default.updateShoppingCTAResult(result, callbackId);
|
|
185
168
|
}
|
|
186
169
|
} else {
|
|
187
170
|
if (callbackId) {
|
|
188
171
|
if (_reactNative.Platform.OS === 'ios') {
|
|
189
|
-
_ShoppingModule.default.clearCallbackId(callbackId, _FWEventName.FWEventName.
|
|
172
|
+
_ShoppingModule.default.clearCallbackId(callbackId, _FWEventName.FWEventName.ShoppingCTAButtonClick);
|
|
190
173
|
}
|
|
191
174
|
}
|
|
192
175
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["VideoShopping.ts"],"names":["VideoShopping","onCustomClickCartIcon","_onCustomClickCartIcon","value","Platform","OS","ShoppingModule","setCustomClickCartIconEnabled","cartIconVisible","_cartIconVisible","setCartIconVisible","productInfoViewConfiguration","_productInfoViewConfiguration","setProductInfoViewConfiguration","onCustomClickLinkButton","_onCustomClickLinkButton","setCustomClickLinkButtonEnabled","eventEmitter","ShoppingModuleEventEmitter","getInstance","FWLoggerUtil","log","_instance","constructor","addListener","FWEventName","AddToCart","event","productId","unitId","handleAddToCartEvent","ClickCartIcon","handleClickCartIconEvent","UpdateProductDetails","productIds","handleUpdateProductDetailsEvent","LogMessage","CustomLinkButtonClick","url","handleCustomLinkButtonClickEvent","setCartItemCount","count","callbackId","onAddToCart","result","updateAddToCartStatus","res","tips","clearCallbackId","onUpdateProductDetails","productList","map","product","length","updateVideoProducts"],"mappings":";;;;;;;AAAA;;AAGA;;AAQA;;AAGA;;;;;;;;;;AAgBA;AACA;AACA;AACA,MAAMA,aAAN,CAAoB;AAGlB;AACF;AACA;AACA;AACA;AACA;;AAGE;AACF;AACA;AACA;AACA;AACA;AACkC,MAArBC,qBAAqB,GAA4C;AAC1E,WAAO,KAAKC,sBAAZ;AACD;;AAC+B,MAArBD,qBAAqB,CAC9BE,KAD8B,EAE9B;AACA,SAAKD,sBAAL,GAA8BC,KAA9B;;AACA,QAAIC,sBAASC,EAAT,KAAgB,KAApB,EAA2B;AACzBC,8BAAeC,6BAAf,CAA6C,CAAC,CAACJ,KAA/C;AACD;AACF;;AAUD;AACF;AACA;AACA;AAC4B,MAAfK,eAAe,GAAY;AACpC,WAAO,KAAKC,gBAAZ;AACD;;AACyB,MAAfD,eAAe,CAACL,KAAD,EAAiB;AACzC,SAAKM,gBAAL,GAAwBN,KAAxB;;AACAG,4BAAeI,kBAAf,CAAkCP,KAAlC;AACD;;AAGD;AACF;AACA;AACA;AACyC,MAA5BQ,4BAA4B,GAEzB;AACZ,WAAO,KAAKC,6BAAZ;AACD;;AAEsC,MAA5BD,4BAA4B,CACrCR,KADqC,EAErC;AACA,SAAKS,6BAAL,GAAqCT,KAArC;;AACA,QAAIC,sBAASC,EAAT,KAAgB,KAApB,EAA2B;AACzBC,8BAAeO,+BAAf,CAA+CV,KAA/C,aAA+CA,KAA/C,cAA+CA,KAA/C,GAAwD,EAAxD;AACD;AACF;;AAMD;AACF;AACA;AACA;AACA;AACA;AACA;AACoC,MAAvBW,uBAAuB,GAEpB;AACZ,WAAO,KAAKC,wBAAZ;AACD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Content":["import { NativeEventEmitter, Platform } from 'react-native';\n\nimport type AddToCartResult from './models/AddToCartResult';\nimport { FWEventName } from './models/FWEventName';\nimport type {\n AddToCartEvent,\n CustomClickLinkButtonEvent,\n UpdateProductDetailsEvent,\n} from './models/FWEvents';\nimport type Product from './models/Product';\nimport type ProductInfoViewConfiguration from './models/ProductInfoViewConfiguration';\nimport ShoppingModule, {\n ShoppingModuleEventEmitter,\n} from './modules/ShoppingModule';\nimport FWLoggerUtil from './utils/FWLoggerUtil';\n\nexport type AddToCartCallback = (\n event: AddToCartEvent\n) => Promise<AddToCartResult | undefined | null>;\n\nexport type CustomClickCartIconCallback = () => Promise<void>;\n\nexport type UpdateProductDetailsCallback = (\n event: UpdateProductDetailsEvent\n) => Promise<Product[] | undefined | null>;\n\nexport type CustomClickLinkButtonCallback = (\n event: CustomClickLinkButtonEvent\n) => Promise<void>;\n\n/**\n * The entry class of video shopping.\n */\nclass VideoShopping {\n private static _instance?: VideoShopping;\n\n /**\n * This callback is triggered when the user clicks the \"Add to cart\" button.\n *\n * The host apps can return an AddToCartResult object to tell FireworkSDK the result of adding to cart.\n * If the host apps want to customize the processing logic of clicking \"Add to cart\" button, they could return null or undefined in the callback.\n */\n public onAddToCart?: AddToCartCallback;\n\n /**\n * This callback is triggered when the user clicks the shopping cart icon.\n *\n * The host app can customize the click event processing logic of\n * the shopping cart icon by setting the callback.\n */\n public get onCustomClickCartIcon(): CustomClickCartIconCallback | undefined {\n return this._onCustomClickCartIcon;\n }\n public set onCustomClickCartIcon(\n value: CustomClickCartIconCallback | undefined\n ) {\n this._onCustomClickCartIcon = value;\n if (Platform.OS === 'ios') {\n ShoppingModule.setCustomClickCartIconEnabled(!!value);\n }\n }\n private _onCustomClickCartIcon?: CustomClickCartIconCallback | undefined;\n\n /**\n * This callback is triggered when the video will be shown.\n *\n * The host app can return a Product list to update the latest product information.\n */\n public onUpdateProductDetails?: UpdateProductDetailsCallback;\n\n /**\n * Defaults to true.\n * You can hide the cart icon by setting this property to false.\n */\n public get cartIconVisible(): boolean {\n return this._cartIconVisible;\n }\n public set cartIconVisible(value: boolean) {\n this._cartIconVisible = value;\n ShoppingModule.setCartIconVisible(value);\n }\n private _cartIconVisible: boolean = true;\n\n /**\n * The host app can use this property to configure \"Add to cart\" button style\n * and hide the link button next to \"Add to cart\" button. Only supported on iOS.\n */\n public get productInfoViewConfiguration():\n | ProductInfoViewConfiguration\n | undefined {\n return this._productInfoViewConfiguration;\n }\n\n public set productInfoViewConfiguration(\n value: ProductInfoViewConfiguration | undefined\n ) {\n this._productInfoViewConfiguration = value;\n if (Platform.OS === 'ios') {\n ShoppingModule.setProductInfoViewConfiguration(value ?? {});\n }\n }\n\n private _productInfoViewConfiguration?:\n | ProductInfoViewConfiguration\n | undefined;\n\n /**\n * This callback is triggered when the user clicks\n * the link button next to Add to cart button. Only supported on Android.\n *\n * The host app can customize the click event processing logic of\n * the link button by setting the callback.\n */\n public get onCustomClickLinkButton():\n | CustomClickLinkButtonCallback\n | undefined {\n return this._onCustomClickLinkButton;\n }\n public set onCustomClickLinkButton(\n value: CustomClickLinkButtonCallback | undefined\n ) {\n this._onCustomClickLinkButton = value;\n if (Platform.OS === 'android') {\n ShoppingModule.setCustomClickLinkButtonEnabled(!!value);\n }\n }\n private _onCustomClickLinkButton?: CustomClickLinkButtonCallback | undefined;\n\n private get eventEmitter(): NativeEventEmitter {\n return ShoppingModuleEventEmitter;\n }\n\n public static getInstance() {\n FWLoggerUtil.log('VideoShopping constructor');\n if (!VideoShopping._instance) {\n VideoShopping._instance = new VideoShopping();\n }\n\n return VideoShopping._instance!;\n }\n\n private constructor() {\n this.eventEmitter.addListener(FWEventName.AddToCart, (event) => {\n FWLoggerUtil.log(\n `Receive AddToCart event productId: ${event?.productId} unitId: ${event?.unitId}`\n );\n this.handleAddToCartEvent(event);\n });\n\n this.eventEmitter.addListener(FWEventName.ClickCartIcon, () => {\n FWLoggerUtil.log('Receive ClickCartIcon event');\n this.handleClickCartIconEvent();\n });\n\n this.eventEmitter.addListener(FWEventName.UpdateProductDetails, (event) => {\n FWLoggerUtil.log(\n `Receive UpdateProductDetails event productIds: ${event?.productIds}`\n );\n this.handleUpdateProductDetailsEvent(event);\n });\n\n this.eventEmitter.addListener(FWEventName.LogMessage, () => {});\n\n if (Platform.OS === 'android') {\n this.eventEmitter.addListener(\n FWEventName.CustomLinkButtonClick,\n (event) => {\n FWLoggerUtil.log(\n `Receive CustomLinkButtonClick event url: ${event?.url}`\n );\n this.handleCustomLinkButtonClickEvent(event);\n }\n );\n }\n }\n\n /**\n *\n * @param {number} count The number of items in the host app cart.\n * The count should be greater than or equal to 0.\n * We just use count to show or hide red indicator on the cart icon.\n * If cound > 0, we will show the red indicator on the cart icon.\n * Otherwise, we will hide the red indicator on the cart icon.\n */\n public setCartItemCount(count: number) {\n ShoppingModule.setCartItemCount(count);\n }\n\n private async handleAddToCartEvent(event: any) {\n const callbackId = event.callbackId;\n delete event.callbackId;\n if (this.onAddToCart) {\n const result = await this.onAddToCart(event as AddToCartEvent);\n if (result) {\n if (callbackId) {\n ShoppingModule.updateAddToCartStatus(\n result.res,\n result.tips,\n callbackId\n );\n }\n } else {\n if (callbackId) {\n if (Platform.OS === 'ios') {\n ShoppingModule.clearCallbackId(callbackId, FWEventName.AddToCart);\n }\n }\n }\n } else {\n if (callbackId) {\n if (Platform.OS === 'ios') {\n ShoppingModule.clearCallbackId(callbackId, FWEventName.AddToCart);\n }\n }\n }\n }\n\n private async handleClickCartIconEvent() {\n if (this.onCustomClickCartIcon) {\n this.onCustomClickCartIcon();\n }\n }\n\n private async handleUpdateProductDetailsEvent(event: any) {\n const callbackId = event.callbackId;\n delete event.callbackId;\n if (this.onUpdateProductDetails) {\n FWLoggerUtil.log(\n `Call onUpdateProductDetails callback productIds: ${event.productIds} callbackId: ${callbackId}`\n );\n const productList = await this.onUpdateProductDetails(\n event as UpdateProductDetailsEvent\n );\n\n const productIds = (productList || []).map(\n (product) => product.productId ?? ''\n );\n\n FWLoggerUtil.log(\n `Get result from onUpdateProductDetails callback productIds: ${productIds} productListLength: ${\n (productList || []).length\n }`\n );\n\n if (productList) {\n if (callbackId) {\n ShoppingModule.updateVideoProducts(productList, callbackId);\n }\n } else {\n if (callbackId) {\n if (Platform.OS === 'ios') {\n ShoppingModule.clearCallbackId(\n callbackId,\n FWEventName.UpdateProductDetails\n );\n }\n }\n }\n } else {\n FWLoggerUtil.log('onUpdateProductDetails callback is not set.');\n if (callbackId) {\n if (Platform.OS === 'ios') {\n ShoppingModule.clearCallbackId(\n callbackId,\n FWEventName.UpdateProductDetails\n );\n }\n }\n }\n }\n\n private async handleCustomLinkButtonClickEvent(\n event: CustomClickLinkButtonEvent\n ) {\n if (this.onCustomClickLinkButton) {\n this.onCustomClickLinkButton(event);\n }\n }\n}\n\nexport default VideoShopping;\n"]}
|
|
1
|
+
{"version":3,"sources":["VideoShopping.ts"],"names":["VideoShopping","onCustomClickCartIcon","_onCustomClickCartIcon","value","Platform","OS","ShoppingModule","setCustomClickCartIconEnabled","cartIconVisible","_cartIconVisible","setCartIconVisible","productInfoViewConfiguration","_productInfoViewConfiguration","setProductInfoViewConfiguration","onCustomClickLinkButton","_onCustomClickLinkButton","setCustomClickLinkButtonEnabled","eventEmitter","ShoppingModuleEventEmitter","getInstance","FWLoggerUtil","log","_instance","constructor","addListener","FWEventName","ShoppingCTAButtonClick","event","productId","unitId","url","handleShoppingCTAEvent","ClickCartIcon","handleClickCartIconEvent","UpdateProductDetails","productIds","handleUpdateProductDetailsEvent","LogMessage","CustomLinkButtonClick","handleCustomLinkButtonClickEvent","setCartItemCount","count","callbackId","onShoppingCTA","result","updateShoppingCTAResult","clearCallbackId","onUpdateProductDetails","productList","map","product","length","updateVideoProducts"],"mappings":";;;;;;;AAAA;;AAEA;;AAQA;;AAGA;;;;;;;;;;AAiBA;AACA;AACA;AACA,MAAMA,aAAN,CAAoB;AAGlB;AACF;AACA;AACA;;AAGE;AACF;AACA;AACA;AACA;AACA;AACkC,MAArBC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,EAAgB;AACd,cAAItC,sBAASC,EAAT,KAAgB,KAApB,EAA2B;AACzBC,oCAAewC,eAAf,CACEJ,UADF,EAEEjB,yBAAYS,oBAFd;AAID;AACF;AACF;AACF,KAhCD,MAgCO;AACLd,4BAAaC,GAAb,CAAiB,6CAAjB;;AACA,UAAIqB,UAAJ,EAAgB;AACd,YAAItC,sBAASC,EAAT,KAAgB,KAApB,EAA2B;AACzBC,kCAAewC,eAAf,CACEJ,UADF,EAEEjB,yBAAYS,oBAFd;AAID;AACF;AACF;AACF;;AAE6C,QAAhCK,gCAAgC,CAC5CZ,KAD4C,EAE5C;AACA,QAAI,KAAKb,uBAAT,EAAkC;AAChC,WAAKA,uBAAL,CAA6Ba,KAA7B;AACD;AACF;;AAvOiB;;gBAAd3B,a;;eA0OSA,a","sourcesContent":["import { NativeEventEmitter, Platform } from 'react-native';\n\nimport { FWEventName } from './models/FWEventName';\nimport type {\n CustomClickLinkButtonEvent,\n ShoppingCTAEvent,\n UpdateProductDetailsEvent,\n} from './models/FWEvents';\nimport type Product from './models/Product';\nimport type ProductInfoViewConfiguration from './models/ProductInfoViewConfiguration';\nimport ShoppingModule, {\n ShoppingModuleEventEmitter,\n} from './modules/ShoppingModule';\nimport FWLoggerUtil from './utils/FWLoggerUtil';\nimport type ShoppingCTAResult from './models/ShoppingCTAResult';\n\nexport type ShoppingCTACallback = (\n event: ShoppingCTAEvent\n) => Promise<ShoppingCTAResult>;\n\nexport type CustomClickCartIconCallback = () => Promise<void>;\n\nexport type UpdateProductDetailsCallback = (\n event: UpdateProductDetailsEvent\n) => Promise<Product[] | undefined | null>;\n\nexport type CustomClickLinkButtonCallback = (\n event: CustomClickLinkButtonEvent\n) => Promise<void>;\n\n/**\n * The entry class of video shopping.\n */\nclass VideoShopping {\n private static _instance?: VideoShopping;\n\n /**\n * This callback is triggered when the user clicks the \"Add to cart\" or \"Shop now\" button.\n * The host app can return a ShoppingCTAResult object to tell SDK how to handle the result.\n */\n public onShoppingCTA?: ShoppingCTACallback;\n\n /**\n * This callback is triggered when the user clicks the shopping cart icon.\n *\n * The host app can customize the click event processing logic of\n * the shopping cart icon by setting the callback.\n */\n public get onCustomClickCartIcon(): CustomClickCartIconCallback | undefined {\n return this._onCustomClickCartIcon;\n }\n public set onCustomClickCartIcon(\n value: CustomClickCartIconCallback | undefined\n ) {\n this._onCustomClickCartIcon = value;\n if (Platform.OS === 'ios') {\n ShoppingModule.setCustomClickCartIconEnabled(!!value);\n }\n }\n private _onCustomClickCartIcon?: CustomClickCartIconCallback | undefined;\n\n /**\n * This callback is triggered when the video will be shown.\n *\n * The host app can return a Product list to update the latest product information.\n */\n public onUpdateProductDetails?: UpdateProductDetailsCallback;\n\n /**\n * Defaults to true.\n * You can hide the cart icon by setting this property to false.\n */\n public get cartIconVisible(): boolean {\n return this._cartIconVisible;\n }\n public set cartIconVisible(value: boolean) {\n this._cartIconVisible = value;\n ShoppingModule.setCartIconVisible(value);\n }\n private _cartIconVisible: boolean = true;\n\n /**\n * The configuration of product info view.\n * Please refer to {@link ProductInfoViewConfiguration} for more details.\n */\n public get productInfoViewConfiguration():\n | ProductInfoViewConfiguration\n | undefined {\n return this._productInfoViewConfiguration;\n }\n\n public set productInfoViewConfiguration(\n value: ProductInfoViewConfiguration | undefined\n ) {\n this._productInfoViewConfiguration = value;\n ShoppingModule.setProductInfoViewConfiguration(value ?? {});\n }\n\n private _productInfoViewConfiguration?:\n | ProductInfoViewConfiguration\n | undefined;\n\n /**\n * This callback is triggered when the user clicks\n * the link button next to Add to cart button. Only supported on Android.\n *\n * The host app can customize the click event processing logic of\n * the link button by setting the callback.\n */\n public get onCustomClickLinkButton():\n | CustomClickLinkButtonCallback\n | undefined {\n return this._onCustomClickLinkButton;\n }\n public set onCustomClickLinkButton(\n value: CustomClickLinkButtonCallback | undefined\n ) {\n this._onCustomClickLinkButton = value;\n ShoppingModule.setCustomClickLinkButtonEnabled(!!value);\n }\n private _onCustomClickLinkButton?: CustomClickLinkButtonCallback | undefined;\n\n private get eventEmitter(): NativeEventEmitter {\n return ShoppingModuleEventEmitter;\n }\n\n public static getInstance() {\n FWLoggerUtil.log('VideoShopping constructor');\n if (!VideoShopping._instance) {\n VideoShopping._instance = new VideoShopping();\n }\n\n return VideoShopping._instance!;\n }\n\n private constructor() {\n this.eventEmitter.addListener(\n FWEventName.ShoppingCTAButtonClick,\n (event) => {\n FWLoggerUtil.log(\n `Receive ShoppingCTA event productId: ${event?.productId} unitId: ${event?.unitId} url: ${event?.url}`\n );\n this.handleShoppingCTAEvent(event);\n }\n );\n\n this.eventEmitter.addListener(FWEventName.ClickCartIcon, () => {\n FWLoggerUtil.log('Receive ClickCartIcon event');\n this.handleClickCartIconEvent();\n });\n\n this.eventEmitter.addListener(FWEventName.UpdateProductDetails, (event) => {\n FWLoggerUtil.log(\n `Receive UpdateProductDetails event productIds: ${event?.productIds}`\n );\n this.handleUpdateProductDetailsEvent(event);\n });\n\n this.eventEmitter.addListener(FWEventName.LogMessage, () => {});\n\n this.eventEmitter.addListener(\n FWEventName.CustomLinkButtonClick,\n (event) => {\n FWLoggerUtil.log(\n `Receive CustomLinkButtonClick event url: ${event?.url}`\n );\n this.handleCustomLinkButtonClickEvent(event);\n }\n );\n }\n\n /**\n *\n * @param {number} count The number of items in the host app cart.\n * The count should be greater than or equal to 0.\n * We just use count to show or hide red indicator on the cart icon.\n * If cound > 0, we will show the red indicator on the cart icon.\n * Otherwise, we will hide the red indicator on the cart icon.\n */\n public setCartItemCount(count: number) {\n ShoppingModule.setCartItemCount(count);\n }\n\n private async handleShoppingCTAEvent(event: any) {\n const callbackId = event.callbackId;\n delete event.callbackId;\n\n if (this.onShoppingCTA) {\n const result = await this.onShoppingCTA(event as ShoppingCTAEvent);\n if (callbackId) {\n ShoppingModule.updateShoppingCTAResult(result, callbackId);\n }\n } else {\n if (callbackId) {\n if (Platform.OS === 'ios') {\n ShoppingModule.clearCallbackId(\n callbackId,\n FWEventName.ShoppingCTAButtonClick\n );\n }\n }\n }\n }\n\n private async handleClickCartIconEvent() {\n if (this.onCustomClickCartIcon) {\n this.onCustomClickCartIcon();\n }\n }\n\n private async handleUpdateProductDetailsEvent(event: any) {\n const callbackId = event.callbackId;\n delete event.callbackId;\n if (this.onUpdateProductDetails) {\n FWLoggerUtil.log(\n `Call onUpdateProductDetails callback productIds: ${event.productIds} callbackId: ${callbackId}`\n );\n const productList = await this.onUpdateProductDetails(\n event as UpdateProductDetailsEvent\n );\n\n const productIds = (productList || []).map(\n (product) => product.productId ?? ''\n );\n\n FWLoggerUtil.log(\n `Get result from onUpdateProductDetails callback productIds: ${productIds} productListLength: ${\n (productList || []).length\n }`\n );\n\n if (productList) {\n if (callbackId) {\n ShoppingModule.updateVideoProducts(productList, callbackId);\n }\n } else {\n if (callbackId) {\n if (Platform.OS === 'ios') {\n ShoppingModule.clearCallbackId(\n callbackId,\n FWEventName.UpdateProductDetails\n );\n }\n }\n }\n } else {\n FWLoggerUtil.log('onUpdateProductDetails callback is not set.');\n if (callbackId) {\n if (Platform.OS === 'ios') {\n ShoppingModule.clearCallbackId(\n callbackId,\n FWEventName.UpdateProductDetails\n );\n }\n }\n }\n }\n\n private async handleCustomLinkButtonClickEvent(\n event: CustomClickLinkButtonEvent\n ) {\n if (this.onCustomClickLinkButton) {\n this.onCustomClickLinkButton(event);\n }\n }\n}\n\nexport default VideoShopping;\n"]}
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
|
|
8
|
-
var _react =
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
9
|
|
|
10
10
|
var _reactNative = require("react-native");
|
|
11
11
|
|
|
@@ -21,186 +21,251 @@ var _FWStoryBlock = _interopRequireDefault(require("./FWStoryBlock"));
|
|
|
21
21
|
|
|
22
22
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
23
|
|
|
24
|
-
function
|
|
24
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
25
|
+
|
|
26
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
25
27
|
|
|
26
|
-
function
|
|
28
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
27
29
|
|
|
28
30
|
const NativeComponentName = 'FWStoryBlock';
|
|
29
31
|
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
*/
|
|
43
|
-
class StoryBlock extends _react.default.Component {
|
|
44
|
-
constructor() {
|
|
45
|
-
super(...arguments);
|
|
46
|
-
|
|
47
|
-
_defineProperty(this, "_nativeComponentRef", /*#__PURE__*/_react.default.createRef());
|
|
48
|
-
|
|
49
|
-
_defineProperty(this, "_subscriptions", []);
|
|
50
|
-
|
|
51
|
-
_defineProperty(this, "_onStoryBlockLoadFinished", event => {
|
|
52
|
-
_FWLoggerUtil.default.log(`StoryBlock _onStoryBlockLoadFinished ${event.nativeEvent.name}`);
|
|
53
|
-
|
|
54
|
-
const {
|
|
55
|
-
onStoryBlockLoadFinished
|
|
56
|
-
} = this.props;
|
|
57
|
-
const {
|
|
58
|
-
name,
|
|
59
|
-
reason
|
|
60
|
-
} = event.nativeEvent;
|
|
61
|
-
|
|
62
|
-
if (onStoryBlockLoadFinished) {
|
|
63
|
-
if (name) {
|
|
64
|
-
if (reason) {
|
|
65
|
-
onStoryBlockLoadFinished({
|
|
66
|
-
name,
|
|
67
|
-
reason
|
|
68
|
-
});
|
|
69
|
-
} else {
|
|
70
|
-
onStoryBlockLoadFinished({
|
|
71
|
-
name
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
} else {
|
|
75
|
-
onStoryBlockLoadFinished();
|
|
76
|
-
}
|
|
32
|
+
const StoryBlock = (props, forwardedRef) => {
|
|
33
|
+
const nativeComponentRef = (0, _react.useRef)(null);
|
|
34
|
+
const [isFullscreenState, setIsFullscreenState] = (0, _react.useState)(false);
|
|
35
|
+
const [, forceUpdate] = (0, _react.useReducer)(x => x + 1, 0);
|
|
36
|
+
(0, _react.useImperativeHandle)(forwardedRef, () => {
|
|
37
|
+
const sendCommand = command => {
|
|
38
|
+
const nativeNodeHandle = (0, _reactNative.findNodeHandle)(nativeComponentRef.current);
|
|
39
|
+
|
|
40
|
+
let commandId = _reactNative.UIManager.getViewManagerConfig(NativeComponentName).Commands[command];
|
|
41
|
+
|
|
42
|
+
if (_reactNative.Platform.OS === 'android') {
|
|
43
|
+
commandId = commandId.toString();
|
|
77
44
|
}
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
45
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
46
|
+
_reactNative.UIManager.dispatchViewManagerCommand((0, _reactNative.findNodeHandle)(nativeNodeHandle), commandId, []);
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
return {
|
|
50
|
+
play: () => {
|
|
51
|
+
sendCommand('play');
|
|
52
|
+
},
|
|
53
|
+
pause: () => {
|
|
54
|
+
sendCommand('pause');
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
}, []);
|
|
58
|
+
(0, _react.useEffect)(() => {
|
|
85
59
|
const subscriptionOfShareBaseURLUpdated = _FireworkSDKModule.FireworkSDKModuleEventEmitter.addListener(_FWEventName.FWEventName.ShareBaseURLUpdated, () => {
|
|
86
|
-
|
|
87
|
-
});
|
|
60
|
+
_FWLoggerUtil.default.log('Receive FWEventName.ShareBaseURLUpdated');
|
|
88
61
|
|
|
89
|
-
|
|
62
|
+
forceUpdate();
|
|
63
|
+
});
|
|
90
64
|
|
|
91
65
|
const subscriptionOfAdBadgeConfigurationUpdated = _FireworkSDKModule.FireworkSDKModuleEventEmitter.addListener(_FWEventName.FWEventName.AdBadgeConfigurationUpdated, () => {
|
|
92
|
-
|
|
93
|
-
});
|
|
66
|
+
_FWLoggerUtil.default.log('Receive FWEventName.AdBadgeConfigurationUpdated');
|
|
94
67
|
|
|
95
|
-
|
|
68
|
+
forceUpdate();
|
|
69
|
+
});
|
|
96
70
|
|
|
97
71
|
const subscriptionOfVideoLaunchBehaviorUpdated = _FireworkSDKModule.FireworkSDKModuleEventEmitter.addListener(_FWEventName.FWEventName.VideoLaunchBehaviorUpdated, () => {
|
|
98
72
|
_FWLoggerUtil.default.log('Receive FWEventName.VideoLaunchBehaviorUpdated');
|
|
99
73
|
|
|
100
|
-
|
|
74
|
+
forceUpdate();
|
|
101
75
|
});
|
|
102
76
|
|
|
103
|
-
|
|
77
|
+
const subscriptionOfAppLanguageUpdated = _FireworkSDKModule.FireworkSDKModuleEventEmitter.addListener(_FWEventName.FWEventName.AppLanguageUpdated, () => {
|
|
78
|
+
_FWLoggerUtil.default.log('Receive FWEventName.AppLanguageUpdated');
|
|
79
|
+
|
|
80
|
+
forceUpdate();
|
|
81
|
+
});
|
|
104
82
|
|
|
105
83
|
if (_reactNative.Platform.OS === 'android') {
|
|
106
|
-
|
|
84
|
+
setTimeout(() => {
|
|
85
|
+
const viewId = (0, _reactNative.findNodeHandle)(nativeComponentRef.current);
|
|
107
86
|
|
|
108
|
-
|
|
87
|
+
_FWLoggerUtil.default.log(`StoryBlock createFragment viewId: ${viewId}`);
|
|
109
88
|
|
|
110
|
-
|
|
89
|
+
_reactNative.UIManager.dispatchViewManagerCommand(viewId, _reactNative.UIManager.getViewManagerConfig(NativeComponentName).Commands.create.toString(), [viewId]);
|
|
90
|
+
}, 500);
|
|
111
91
|
}
|
|
112
|
-
}
|
|
113
|
-
/**
|
|
114
|
-
* @ignore
|
|
115
|
-
*/
|
|
116
92
|
|
|
93
|
+
return () => {
|
|
94
|
+
subscriptionOfShareBaseURLUpdated.remove();
|
|
95
|
+
subscriptionOfAdBadgeConfigurationUpdated.remove();
|
|
96
|
+
subscriptionOfVideoLaunchBehaviorUpdated.remove();
|
|
97
|
+
subscriptionOfAppLanguageUpdated.remove();
|
|
98
|
+
};
|
|
99
|
+
}, []);
|
|
117
100
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
101
|
+
const handleStoryBlockLoadFinished = event => {
|
|
102
|
+
_FWLoggerUtil.default.log(`StoryBlock handleStoryBlockLoadFinished ${event.nativeEvent.name}`);
|
|
103
|
+
|
|
104
|
+
const {
|
|
105
|
+
onStoryBlockLoadFinished
|
|
106
|
+
} = props;
|
|
107
|
+
const {
|
|
108
|
+
name,
|
|
109
|
+
reason
|
|
110
|
+
} = event.nativeEvent;
|
|
111
|
+
|
|
112
|
+
if (onStoryBlockLoadFinished) {
|
|
113
|
+
if (name) {
|
|
114
|
+
if (reason) {
|
|
115
|
+
onStoryBlockLoadFinished({
|
|
116
|
+
name,
|
|
117
|
+
reason
|
|
118
|
+
});
|
|
119
|
+
} else {
|
|
120
|
+
onStoryBlockLoadFinished({
|
|
121
|
+
name
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
} else {
|
|
125
|
+
onStoryBlockLoadFinished();
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
const handleStoryBlockFullscreenStateChanged = event => {
|
|
131
|
+
_FWLoggerUtil.default.log(`StoryBlock handleStoryBlockFullscreenStateChanged ${event.nativeEvent.isFullScreen}`);
|
|
132
|
+
|
|
133
|
+
const {
|
|
134
|
+
isFullScreen
|
|
135
|
+
} = event.nativeEvent;
|
|
136
|
+
setIsFullscreenState(isFullScreen);
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
const generateDynamicContentParametersString = () => {
|
|
140
|
+
const {
|
|
141
|
+
dynamicContentParameters
|
|
142
|
+
} = props;
|
|
143
|
+
|
|
144
|
+
if (!dynamicContentParameters) {
|
|
145
|
+
return '';
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
let resultString = '';
|
|
149
|
+
const sortedKeyList = Object.keys(dynamicContentParameters).sort();
|
|
150
|
+
|
|
151
|
+
for (const key of sortedKeyList) {
|
|
152
|
+
const value = dynamicContentParameters[key];
|
|
153
|
+
const valueString = value.join(',');
|
|
154
|
+
|
|
155
|
+
if (resultString.length > 0) {
|
|
156
|
+
resultString += '_';
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
resultString += `${key}:${valueString}`;
|
|
160
|
+
}
|
|
122
161
|
|
|
123
|
-
|
|
124
|
-
}
|
|
125
|
-
/**
|
|
126
|
-
* @ignore
|
|
127
|
-
*/
|
|
162
|
+
return resultString;
|
|
163
|
+
};
|
|
128
164
|
|
|
165
|
+
const generateVastAttributesString = () => {
|
|
166
|
+
var _adConfiguration$vast;
|
|
129
167
|
|
|
130
|
-
render() {
|
|
131
168
|
const {
|
|
132
|
-
|
|
133
|
-
} =
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
169
|
+
adConfiguration
|
|
170
|
+
} = props;
|
|
171
|
+
const vastAttributes = (_adConfiguration$vast = adConfiguration === null || adConfiguration === void 0 ? void 0 : adConfiguration.vastAttributes) !== null && _adConfiguration$vast !== void 0 ? _adConfiguration$vast : '';
|
|
172
|
+
|
|
173
|
+
if (!vastAttributes) {
|
|
174
|
+
return '';
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
let resultString = '';
|
|
178
|
+
|
|
179
|
+
for (const attribute of vastAttributes) {
|
|
180
|
+
var _attribute$name;
|
|
181
|
+
|
|
182
|
+
if (resultString.length > 0) {
|
|
183
|
+
resultString += '_';
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
resultString += `${(_attribute$name = attribute.name) !== null && _attribute$name !== void 0 ? _attribute$name : ''}:${attribute.value}`;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
return resultString;
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
const generateKey = () => {
|
|
193
|
+
var _FireworkSDK$getInsta, _FireworkSDK$getInsta2, _adBadgeConfiguration, _adBadgeConfiguration2, _adBadgeConfiguration3, _FireworkSDK$getInsta3, _adConfiguration$requ, _adConfiguration$adsF;
|
|
147
194
|
|
|
148
195
|
const {
|
|
149
196
|
source,
|
|
150
197
|
channel = '',
|
|
151
198
|
playlist = '',
|
|
152
|
-
enablePictureInPicture = false
|
|
153
|
-
|
|
199
|
+
enablePictureInPicture = false,
|
|
200
|
+
adConfiguration
|
|
201
|
+
} = props;
|
|
154
202
|
const shareBaseURL = (_FireworkSDK$getInsta = _FireworkSDK.default.getInstance().getShareBaseURL()) !== null && _FireworkSDK$getInsta !== void 0 ? _FireworkSDK$getInsta : '';
|
|
203
|
+
|
|
204
|
+
const videoLaunchBehavior = _FireworkSDK.default.getInstance().getVideoLaunchBehavior();
|
|
205
|
+
|
|
155
206
|
const adBadgeConfiguration = (_FireworkSDK$getInsta2 = _FireworkSDK.default.getInstance().getAdBadgeConfiguration()) !== null && _FireworkSDK$getInsta2 !== void 0 ? _FireworkSDK$getInsta2 : {};
|
|
156
207
|
const adBadgeTextType = (_adBadgeConfiguration = adBadgeConfiguration.badgeTextType) !== null && _adBadgeConfiguration !== void 0 ? _adBadgeConfiguration : '';
|
|
157
208
|
const backgroundColorOfAdBadge = (_adBadgeConfiguration2 = adBadgeConfiguration.backgroundColor) !== null && _adBadgeConfiguration2 !== void 0 ? _adBadgeConfiguration2 : '';
|
|
158
209
|
const textColorOfAdBadge = (_adBadgeConfiguration3 = adBadgeConfiguration.textColor) !== null && _adBadgeConfiguration3 !== void 0 ? _adBadgeConfiguration3 : '';
|
|
159
|
-
|
|
160
|
-
const
|
|
161
|
-
|
|
162
|
-
const
|
|
210
|
+
const dynamicContentParametersString = generateDynamicContentParametersString();
|
|
211
|
+
const appLanguage = (_FireworkSDK$getInsta3 = _FireworkSDK.default.getInstance().appLanguage) !== null && _FireworkSDK$getInsta3 !== void 0 ? _FireworkSDK$getInsta3 : '';
|
|
212
|
+
const requiresAds = (_adConfiguration$requ = adConfiguration === null || adConfiguration === void 0 ? void 0 : adConfiguration.requiresAds) !== null && _adConfiguration$requ !== void 0 ? _adConfiguration$requ : false;
|
|
213
|
+
const adsFetchTimeout = (_adConfiguration$adsF = adConfiguration === null || adConfiguration === void 0 ? void 0 : adConfiguration.adsFetchTimeout) !== null && _adConfiguration$adsF !== void 0 ? _adConfiguration$adsF : 10;
|
|
214
|
+
const vastAttributesString = generateVastAttributesString();
|
|
163
215
|
let key = `source:${source}`;
|
|
164
216
|
key += `_channel:${channel}`;
|
|
165
217
|
key += `_playlist:${playlist}`;
|
|
166
218
|
key += `_shareBaseURL:${shareBaseURL}`;
|
|
219
|
+
key += `_videoLaunchBehavior:${videoLaunchBehavior}`;
|
|
167
220
|
key += `_adBadgeTextType:${adBadgeTextType}`;
|
|
168
221
|
key += `_backgroundColorOfAdBadge:${backgroundColorOfAdBadge}`;
|
|
169
222
|
key += `_textColorOfAdBadge:${textColorOfAdBadge}`;
|
|
170
223
|
key += `_dynamicContentParameters:${dynamicContentParametersString}`;
|
|
171
224
|
key += `_enablePictureInPicture:${enablePictureInPicture}`;
|
|
172
|
-
key += `
|
|
225
|
+
key += `_appLanguage:${appLanguage}`;
|
|
226
|
+
key += `_requiresAds:${requiresAds}`;
|
|
227
|
+
key += `_adsFetchTimeout:${adsFetchTimeout}`;
|
|
228
|
+
key += `_vastAttributes:${vastAttributesString}`;
|
|
173
229
|
return key;
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
_generateDynamicContentParametersString() {
|
|
177
|
-
const {
|
|
178
|
-
dynamicContentParameters
|
|
179
|
-
} = this.props;
|
|
230
|
+
};
|
|
180
231
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
232
|
+
(0, _react.useEffect)(() => {
|
|
233
|
+
if (_reactNative.Platform.OS === 'android') {
|
|
234
|
+
const onBackPress = () => {
|
|
235
|
+
if (isFullscreenState) {
|
|
236
|
+
_FireworkSDK.default.getInstance().navigator.popNativeContainer();
|
|
184
237
|
|
|
185
|
-
|
|
186
|
-
|
|
238
|
+
return true;
|
|
239
|
+
}
|
|
187
240
|
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
const valueString = value.join(',');
|
|
241
|
+
return false;
|
|
242
|
+
};
|
|
191
243
|
|
|
192
|
-
|
|
193
|
-
resultString += '_';
|
|
194
|
-
}
|
|
244
|
+
const subscription = _reactNative.BackHandler.addEventListener('hardwareBackPress', onBackPress);
|
|
195
245
|
|
|
196
|
-
|
|
246
|
+
return () => {
|
|
247
|
+
subscription.remove();
|
|
248
|
+
};
|
|
197
249
|
}
|
|
198
250
|
|
|
199
|
-
return
|
|
200
|
-
}
|
|
251
|
+
return;
|
|
252
|
+
}, [isFullscreenState]);
|
|
253
|
+
const {
|
|
254
|
+
style
|
|
255
|
+
} = props;
|
|
256
|
+
return /*#__PURE__*/_react.default.createElement(_FWStoryBlock.default, _extends({
|
|
257
|
+
ref: nativeComponentRef,
|
|
258
|
+
key: generateKey()
|
|
259
|
+
}, props, {
|
|
260
|
+
onStoryBlockLoadFinished: handleStoryBlockLoadFinished,
|
|
261
|
+
onStoryBlockFullScreenStateChanged: handleStoryBlockFullscreenStateChanged,
|
|
262
|
+
style: Object.assign({}, style, {
|
|
263
|
+
zIndex: -1
|
|
264
|
+
})
|
|
265
|
+
}));
|
|
266
|
+
};
|
|
201
267
|
|
|
202
|
-
|
|
268
|
+
var _default = /*#__PURE__*/(0, _react.forwardRef)(StoryBlock);
|
|
203
269
|
|
|
204
|
-
var _default = StoryBlock;
|
|
205
270
|
exports.default = _default;
|
|
206
271
|
//# sourceMappingURL=StoryBlock.js.map
|