react-native-firework-sdk 2.12.1 → 2.14.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/.idea/codeStyles/Project.xml +124 -0
- package/android/.idea/codeStyles/codeStyleConfig.xml +5 -0
- package/android/build.gradle +3 -2
- package/android/gradle.properties +4 -3
- package/android/src/main/AndroidManifest.xml +14 -0
- package/android/src/main/java/com/fireworksdk/bridge/FWInitializationProvider.kt +4 -0
- package/android/src/main/java/com/fireworksdk/bridge/components/storyblock/StoryBlockFragment.kt +1 -2
- package/android/src/main/java/com/fireworksdk/bridge/models/FWLiveStreamEventDetailsModel.kt +1 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoFeedConfigModel.kt +1 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoFeedConfigModelDeserializer.kt +3 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoFeedConfigModelSerializer.kt +2 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoPlayerLogoConfigurationModel.kt +1 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoPlayerLogoConfigurationModelDeserializer.kt +3 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoPlayerLogoConfigurationModelSerializer.kt +2 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/enums/FWDataTrackingLevel.kt +7 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/enums/FWEventName.kt +2 -1
- package/android/src/main/java/com/fireworksdk/bridge/models/enums/FWSwitchLanguageBehavior.kt +6 -0
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/FWReactNativeSDK.kt +19 -7
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/models/FWNavigatorInterface.kt +2 -0
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/models/FireworkSDKInterface.kt +1 -0
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FWLiveStreamModule.kt +6 -4
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FWNavigatorModule.kt +26 -0
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FWVideoShoppingModule.kt +29 -19
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FireworkSDKModule.kt +43 -19
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/utils/FWEventUtils.kt +25 -13
- package/android/src/main/java/com/fireworksdk/bridge/utils/FWConfigUtil.kt +25 -2
- package/android/src/main/java/com/fireworksdk/bridge/utils/FWGlobalDataUtil.kt +5 -0
- package/android/src/main/java/com/fireworksdk/bridge/utils/FWLanguageUtil.kt +57 -15
- package/android/src/main/java/com/fireworksdk/bridge/utils/FWModelUtils.kt +16 -8
- package/ios/Components/StoryBlock.swift +5 -8
- package/ios/Components/VideoFeed.swift +1 -5
- package/ios/FireworkSdk.xcodeproj/project.pbxproj +4 -0
- package/ios/Models/NativeToRN/FireworkEventName.swift +1 -0
- package/ios/Models/NativeToRN/FireworkSDK+Json.swift +6 -2
- package/ios/Models/RNToNative/RCTConvert+FireworkSDKModule.swift +13 -0
- package/ios/Modules/FireworkSDKModule/FireworkSDKModule+CTA.swift +8 -16
- package/ios/Modules/FireworkSDKModule/FireworkSDKModule+EventTracking.swift +9 -1
- package/ios/Modules/FireworkSDKModule/FireworkSDKModule.m +1 -0
- package/ios/Modules/FireworkSDKModule/FireworkSDKModule.swift +96 -31
- package/ios/Modules/Shopping/ShoppingModule.swift +12 -3
- package/ios/Utils/Extensions/NumberFormatter+AppLanguage.swift +27 -0
- package/lib/commonjs/FireworkSDK.js +66 -12
- package/lib/commonjs/FireworkSDK.js.map +1 -1
- package/lib/commonjs/VideoShopping.js +15 -0
- package/lib/commonjs/VideoShopping.js.map +1 -1
- package/lib/commonjs/components/StoryBlock.js +6 -0
- package/lib/commonjs/components/StoryBlock.js.map +1 -1
- package/lib/commonjs/components/VideoFeed.js +29 -12
- package/lib/commonjs/components/VideoFeed.js.map +1 -1
- package/lib/commonjs/index.js +14 -6
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/models/DataTrackingLevel.js +2 -0
- package/lib/commonjs/models/DataTrackingLevel.js.map +1 -0
- package/lib/commonjs/models/FWComponentType.js +14 -0
- package/lib/commonjs/models/FWComponentType.js.map +1 -0
- package/lib/commonjs/models/FWEventName.js +1 -0
- package/lib/commonjs/models/FWEventName.js.map +1 -1
- package/lib/commonjs/models/VideoPlayerLivestreamCountdownTimerTheme.js +2 -0
- package/lib/commonjs/models/VideoPlayerLivestreamCountdownTimerTheme.js.map +1 -0
- package/lib/commonjs/modules/FireworkSDKModule.js.map +1 -1
- package/lib/commonjs/utils/FWGlobalState.js +2 -0
- package/lib/commonjs/utils/FWGlobalState.js.map +1 -1
- package/lib/module/FireworkSDK.js +64 -11
- package/lib/module/FireworkSDK.js.map +1 -1
- package/lib/module/VideoShopping.js +15 -0
- package/lib/module/VideoShopping.js.map +1 -1
- package/lib/module/components/StoryBlock.js +5 -0
- package/lib/module/components/StoryBlock.js.map +1 -1
- package/lib/module/components/VideoFeed.js +28 -11
- package/lib/module/components/VideoFeed.js.map +1 -1
- package/lib/module/index.js +6 -5
- package/lib/module/index.js.map +1 -1
- package/lib/module/models/DataTrackingLevel.js +2 -0
- package/lib/module/models/DataTrackingLevel.js.map +1 -0
- package/lib/module/models/FWComponentType.js +7 -0
- package/lib/module/models/FWComponentType.js.map +1 -0
- package/lib/module/models/FWEventName.js +1 -0
- package/lib/module/models/FWEventName.js.map +1 -1
- package/lib/module/models/VideoPlayerLivestreamCountdownTimerTheme.js +2 -0
- package/lib/module/models/VideoPlayerLivestreamCountdownTimerTheme.js.map +1 -0
- package/lib/module/modules/FireworkSDKModule.js.map +1 -1
- package/lib/module/utils/FWGlobalState.js +2 -0
- package/lib/module/utils/FWGlobalState.js.map +1 -1
- package/lib/typescript/FireworkSDK.d.ts +22 -1
- package/lib/typescript/VideoShopping.d.ts +8 -1
- package/lib/typescript/index.d.ts +16 -13
- package/lib/typescript/models/DataTrackingLevel.d.ts +1 -0
- package/lib/typescript/models/FWComponentType.d.ts +4 -0
- package/lib/typescript/models/FWEventName.d.ts +2 -1
- package/lib/typescript/models/FWEvents.d.ts +18 -1
- package/lib/typescript/models/FeedItemDetails.d.ts +0 -1
- package/lib/typescript/models/LiveStreamEventDetails.d.ts +1 -0
- package/lib/typescript/models/ReplayBadgeConfiguration.d.ts +1 -1
- package/lib/typescript/models/StoryBlockConfiguration.d.ts +0 -2
- package/lib/typescript/models/VideoFeedConfiguration.d.ts +0 -1
- package/lib/typescript/models/VideoPlayerLivestreamCountdownTimerTheme.d.ts +1 -0
- package/lib/typescript/modules/FireworkSDKModule.d.ts +2 -0
- package/lib/typescript/utils/FWGlobalState.d.ts +2 -0
- package/package.json +1 -1
- package/react-native-firework-sdk.podspec +4 -3
- package/src/FireworkSDK.ts +59 -14
- package/src/VideoShopping.ts +24 -0
- package/src/components/StoryBlock.tsx +8 -0
- package/src/components/VideoFeed.tsx +24 -7
- package/src/index.ts +40 -30
- package/src/models/DataTrackingLevel.ts +1 -0
- package/src/models/FWComponentType.ts +4 -0
- package/src/models/FWEventName.ts +1 -0
- package/src/models/FWEvents.ts +19 -1
- package/src/models/FeedItemDetails.ts +0 -1
- package/src/models/LiveStreamEventDetails.ts +1 -0
- package/src/models/ReplayBadgeConfiguration.ts +1 -1
- package/src/models/StoryBlockConfiguration.ts +0 -2
- package/src/models/VideoFeedConfiguration.ts +0 -1
- package/src/models/VideoPlayerLivestreamCountdownTimerTheme.ts +1 -0
- package/src/modules/FireworkSDKModule.ts +2 -0
- package/src/utils/FWGlobalState.ts +3 -0
|
@@ -32,8 +32,6 @@ export interface StoryBlockConfiguration {
|
|
|
32
32
|
ctaButtonStyle?: VideoPlayerCTAStyle;
|
|
33
33
|
/**
|
|
34
34
|
* Indicates if the video player shows playback button.
|
|
35
|
-
* The property only applies to full-screen story block but not to compact story block.
|
|
36
|
-
* Only supported on Android.
|
|
37
35
|
*/
|
|
38
36
|
showPlaybackButton?: boolean;
|
|
39
37
|
/**
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type VideoPlayerLivestreamCountdownTimerTheme = 'dark' | 'light';
|
|
@@ -3,6 +3,7 @@ import type AdBadgeConfiguration from '../models/AdBadgeConfiguration';
|
|
|
3
3
|
import type SDKInitOptions from '../models/SDKInitOptions';
|
|
4
4
|
import type TrackPurchaseParameters from '../models/TrackPurchaseParameters';
|
|
5
5
|
import type VideoPlayerNativeConfiguration from '../models/VideoPlayerNativeConfiguration';
|
|
6
|
+
import type { DataTrackingLevel } from 'src/models/DataTrackingLevel';
|
|
6
7
|
interface IFireworkSDKModule extends NativeModule {
|
|
7
8
|
init(options?: SDKInitOptions): Promise<any>;
|
|
8
9
|
markInitCalled(): Promise<boolean>;
|
|
@@ -16,6 +17,7 @@ interface IFireworkSDKModule extends NativeModule {
|
|
|
16
17
|
changeAppLanguage(language?: string | null): Promise<boolean>;
|
|
17
18
|
pausePlayer(callbackId: number | string): void;
|
|
18
19
|
resumePlayer(callbackId: number | string): void;
|
|
20
|
+
setDataTrackingLevel(level?: DataTrackingLevel): void;
|
|
19
21
|
}
|
|
20
22
|
declare const FireworkSDKModuleEventEmitter: NativeEventEmitter;
|
|
21
23
|
export { FireworkSDKModuleEventEmitter };
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import type { FWComponentType } from 'src/models/FWComponentType';
|
|
1
2
|
declare class FWGlobalState {
|
|
2
3
|
private static _instance?;
|
|
3
4
|
private sdkInitCalledResolveFunc?;
|
|
4
5
|
sdkInitCalledPromise: Promise<void>;
|
|
5
6
|
sdkInitCalled: boolean;
|
|
7
|
+
componentTypeByFeedIdMap: Map<string, FWComponentType>;
|
|
6
8
|
static getInstance(): FWGlobalState;
|
|
7
9
|
private constructor();
|
|
8
10
|
resolveSdkInitCalled(): void;
|
package/package.json
CHANGED
|
@@ -29,9 +29,10 @@ fi
|
|
|
29
29
|
s.exclude_files = [
|
|
30
30
|
'ios/Support/**/*'
|
|
31
31
|
]
|
|
32
|
-
|
|
32
|
+
s.frameworks = 'Network'
|
|
33
33
|
s.static_framework = true
|
|
34
|
+
|
|
34
35
|
s.dependency 'React-Core'
|
|
35
|
-
s.dependency 'FireworkVideoUI', '0.1.
|
|
36
|
-
s.dependency 'FireworkVideo', '1.
|
|
36
|
+
s.dependency 'FireworkVideoUI', '0.1.2'
|
|
37
|
+
s.dependency 'FireworkVideo', '1.21.0'
|
|
37
38
|
end
|
package/src/FireworkSDK.ts
CHANGED
|
@@ -22,6 +22,7 @@ import FWLoggerUtil from './utils/FWLoggerUtil';
|
|
|
22
22
|
import VideoShopping from './VideoShopping';
|
|
23
23
|
import FWGlobalState from './utils/FWGlobalState';
|
|
24
24
|
import type OpenVideoPlayerConfiguration from './models/OpenVideoPlayerConfiguration';
|
|
25
|
+
import type { DataTrackingLevel } from './models/DataTrackingLevel';
|
|
25
26
|
|
|
26
27
|
export type SDKInitCallback = (event: SDKInitEvent) => Promise<void> | void;
|
|
27
28
|
export type CustomCTAClickCallback = (
|
|
@@ -125,6 +126,18 @@ class FireworkSDK {
|
|
|
125
126
|
}
|
|
126
127
|
private _appLanguage: string | undefined | null;
|
|
127
128
|
|
|
129
|
+
/**
|
|
130
|
+
* The configuration for data tracking level.
|
|
131
|
+
*/
|
|
132
|
+
public get dataTrackingLevel(): DataTrackingLevel {
|
|
133
|
+
return this._dataTrackingLevel;
|
|
134
|
+
}
|
|
135
|
+
public set dataTrackingLevel(value: DataTrackingLevel) {
|
|
136
|
+
this._dataTrackingLevel = value;
|
|
137
|
+
FireworkSDKModule.setDataTrackingLevel(value);
|
|
138
|
+
}
|
|
139
|
+
private _dataTrackingLevel: DataTrackingLevel = 'all';
|
|
140
|
+
|
|
128
141
|
/**
|
|
129
142
|
* Defaults to false.
|
|
130
143
|
* You can enable debug logs by setting this property to true.
|
|
@@ -172,6 +185,8 @@ class FireworkSDK {
|
|
|
172
185
|
}
|
|
173
186
|
private _navigator: FWNavigator = FWNavigator.getInstance();
|
|
174
187
|
|
|
188
|
+
private hasCalledSDKInitCallback: boolean = false;
|
|
189
|
+
|
|
175
190
|
/**
|
|
176
191
|
* Get global single instance of FireworkSDK class.
|
|
177
192
|
* @returns FireworkSDK
|
|
@@ -190,8 +205,15 @@ class FireworkSDK {
|
|
|
190
205
|
this.eventEmitter.addListener(FWEventName.SDKInit, (event) => {
|
|
191
206
|
FWLoggerUtil.log(`Receive SDKInit event ${event?.error}`);
|
|
192
207
|
|
|
193
|
-
if (
|
|
194
|
-
this.
|
|
208
|
+
if (event && !event.error) {
|
|
209
|
+
this.completeRemainingInitialization();
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
if (!this.hasCalledSDKInitCallback) {
|
|
213
|
+
this.hasCalledSDKInitCallback = true;
|
|
214
|
+
if (this.onSDKInit && event) {
|
|
215
|
+
this.onSDKInit(event);
|
|
216
|
+
}
|
|
195
217
|
}
|
|
196
218
|
});
|
|
197
219
|
|
|
@@ -265,25 +287,29 @@ class FireworkSDK {
|
|
|
265
287
|
this.eventEmitter.emit(FWEventName.VideoLaunchBehaviorUpdated);
|
|
266
288
|
}
|
|
267
289
|
await FireworkSDKModule.init(options);
|
|
268
|
-
await
|
|
269
|
-
await LiveStreamModule.init();
|
|
270
|
-
|
|
271
|
-
FWGlobalState.getInstance().resolveSdkInitCalled();
|
|
290
|
+
await this.completeRemainingInitialization();
|
|
272
291
|
}
|
|
273
292
|
|
|
274
293
|
/**
|
|
275
294
|
* You only need to call this method when you call init method in native side instead of JS side.
|
|
276
295
|
*/
|
|
277
|
-
|
|
296
|
+
/**
|
|
297
|
+
* You need to call this method when you call init method in native side.
|
|
298
|
+
* @param nativeLazyInit
|
|
299
|
+
* Genenally, you should call naitve init in application(:, didFinishLaunchingWithOptions:) -> Bool on iOS
|
|
300
|
+
* and MainApplication.onCreate on Android. If not, you should pass nativeLazyInit as true.
|
|
301
|
+
*/
|
|
302
|
+
public async markInitCalled(nativeLazyInit: boolean = false): Promise<void> {
|
|
278
303
|
FWLoggerUtil.log('Call FireworkSDK markInitCalled method');
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
await
|
|
304
|
+
if (!nativeLazyInit) {
|
|
305
|
+
await this.completeRemainingInitialization();
|
|
306
|
+
await FireworkSDKModule.markInitCalled();
|
|
307
|
+
} else {
|
|
308
|
+
const hasCalledSDKInit = await FireworkSDKModule.markInitCalled();
|
|
309
|
+
if (hasCalledSDKInit) {
|
|
310
|
+
await this.completeRemainingInitialization();
|
|
311
|
+
}
|
|
284
312
|
}
|
|
285
|
-
|
|
286
|
-
FWGlobalState.getInstance().resolveSdkInitCalled();
|
|
287
313
|
}
|
|
288
314
|
|
|
289
315
|
/**
|
|
@@ -336,6 +362,15 @@ class FireworkSDK {
|
|
|
336
362
|
return result;
|
|
337
363
|
}
|
|
338
364
|
|
|
365
|
+
/**
|
|
366
|
+
* Get the component type based on feedId.
|
|
367
|
+
* @param {string} feedId
|
|
368
|
+
* @returns {string | undefined} The component type based on feedId.
|
|
369
|
+
*/
|
|
370
|
+
public getComponentType(feedId: string) {
|
|
371
|
+
return FWGlobalState.getInstance().componentTypeByFeedIdMap.get(feedId);
|
|
372
|
+
}
|
|
373
|
+
|
|
339
374
|
private updateInternalAppLanguage(language?: string | null) {
|
|
340
375
|
const valueHasChanged = this._appLanguage !== language;
|
|
341
376
|
this._appLanguage = language;
|
|
@@ -351,6 +386,16 @@ class FireworkSDK {
|
|
|
351
386
|
this.eventEmitter.emit(FWEventName.ShareBaseURLUpdated);
|
|
352
387
|
}
|
|
353
388
|
}
|
|
389
|
+
|
|
390
|
+
private async completeRemainingInitialization(): Promise<void> {
|
|
391
|
+
if (FWGlobalState.getInstance().sdkInitCalled) {
|
|
392
|
+
return;
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
FWGlobalState.getInstance().resolveSdkInitCalled();
|
|
396
|
+
await ShoppingModule.init();
|
|
397
|
+
await LiveStreamModule.init();
|
|
398
|
+
}
|
|
354
399
|
}
|
|
355
400
|
|
|
356
401
|
export default FireworkSDK;
|
package/src/VideoShopping.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { NativeEventEmitter, Platform } from 'react-native';
|
|
|
2
2
|
|
|
3
3
|
import { FWEventName } from './models/FWEventName';
|
|
4
4
|
import type {
|
|
5
|
+
ClickProductEvent,
|
|
5
6
|
CustomClickCartIconEvent,
|
|
6
7
|
CustomClickLinkButtonEvent,
|
|
7
8
|
CustomTapProductCardEvent,
|
|
@@ -40,6 +41,10 @@ export type CustomTapProductCardCallback = (
|
|
|
40
41
|
event: CustomTapProductCardEvent
|
|
41
42
|
) => Promise<void> | void;
|
|
42
43
|
|
|
44
|
+
export type ClickProductCallback = (
|
|
45
|
+
event: ClickProductEvent
|
|
46
|
+
) => Promise<void> | void;
|
|
47
|
+
|
|
43
48
|
/**
|
|
44
49
|
* The entry class of video shopping.
|
|
45
50
|
*/
|
|
@@ -106,6 +111,12 @@ class VideoShopping {
|
|
|
106
111
|
}
|
|
107
112
|
private _onCustomTapProductCard?: CustomTapProductCardCallback | undefined;
|
|
108
113
|
|
|
114
|
+
/**
|
|
115
|
+
* This callback is triggered when the user clicks product card.
|
|
116
|
+
* Only supported on iOS
|
|
117
|
+
*/
|
|
118
|
+
public onClickProduct?: ClickProductCallback;
|
|
119
|
+
|
|
109
120
|
/**
|
|
110
121
|
* Defaults to true.
|
|
111
122
|
* You can hide the cart icon by setting this property to false.
|
|
@@ -229,6 +240,13 @@ class VideoShopping {
|
|
|
229
240
|
this.handleCustomProductCardTapEvent(event);
|
|
230
241
|
}
|
|
231
242
|
});
|
|
243
|
+
|
|
244
|
+
this.eventEmitter.addListener(FWEventName.ProductClick, (event) => {
|
|
245
|
+
FWLoggerUtil.log(`Receive ProductClick event url: ${event?.url}`);
|
|
246
|
+
if (event) {
|
|
247
|
+
this.handleProductClickEvent(event);
|
|
248
|
+
}
|
|
249
|
+
});
|
|
232
250
|
}
|
|
233
251
|
|
|
234
252
|
/**
|
|
@@ -336,6 +354,12 @@ class VideoShopping {
|
|
|
336
354
|
this.onCustomTapProductCard(event);
|
|
337
355
|
}
|
|
338
356
|
}
|
|
357
|
+
|
|
358
|
+
private async handleProductClickEvent(event: ClickProductEvent) {
|
|
359
|
+
if (this.onClickProduct) {
|
|
360
|
+
this.onClickProduct(event);
|
|
361
|
+
}
|
|
362
|
+
}
|
|
339
363
|
}
|
|
340
364
|
|
|
341
365
|
export default VideoShopping;
|
|
@@ -30,6 +30,7 @@ import FWLoggerUtil from '../utils/FWLoggerUtil';
|
|
|
30
30
|
import FWStoryBlock from './FWStoryBlock';
|
|
31
31
|
import type ButtonInfo from '../models/ButtonInfo';
|
|
32
32
|
import gennerateJsonKey from '../utils/FWJsonUtil';
|
|
33
|
+
import { FWComponentType } from '../models/FWComponentType';
|
|
33
34
|
|
|
34
35
|
const NativeComponentName = 'FWStoryBlock';
|
|
35
36
|
|
|
@@ -250,6 +251,13 @@ const StoryBlock: ForwardRefRenderFunction<
|
|
|
250
251
|
|
|
251
252
|
const { feedId } = event.nativeEvent;
|
|
252
253
|
|
|
254
|
+
if (feedId) {
|
|
255
|
+
FWGlobalState.getInstance().componentTypeByFeedIdMap.set(
|
|
256
|
+
feedId,
|
|
257
|
+
FWComponentType.storyBlock
|
|
258
|
+
);
|
|
259
|
+
}
|
|
260
|
+
|
|
253
261
|
if (onStoryBlockGetFeedId) {
|
|
254
262
|
onStoryBlockGetFeedId(feedId ?? '');
|
|
255
263
|
}
|
|
@@ -25,6 +25,7 @@ import FWGlobalState from '../utils/FWGlobalState';
|
|
|
25
25
|
import gennerateJsonKey from '../utils/FWJsonUtil';
|
|
26
26
|
import FWLoggerUtil from '../utils/FWLoggerUtil';
|
|
27
27
|
import FWVideoFeed from './FWVideoFeed';
|
|
28
|
+
import { FWComponentType } from '../models/FWComponentType';
|
|
28
29
|
|
|
29
30
|
export type VideoFeedMode = 'row' | 'column' | 'grid';
|
|
30
31
|
|
|
@@ -163,7 +164,7 @@ class VideoFeed extends React.Component<IVideoFeedProps, IVideoFeedState> {
|
|
|
163
164
|
}
|
|
164
165
|
let reactTag: number | null = findNodeHandle(nativeNodeHandle);
|
|
165
166
|
FWLoggerUtil.log(
|
|
166
|
-
`
|
|
167
|
+
`VideoFeed refresh commandId: ${commandId} nativeNodeHandle: ${nativeNodeHandle} reactTag: ${reactTag}`
|
|
167
168
|
);
|
|
168
169
|
if (!nativeNodeHandle || !reactTag) {
|
|
169
170
|
return;
|
|
@@ -172,9 +173,6 @@ class VideoFeed extends React.Component<IVideoFeedProps, IVideoFeedState> {
|
|
|
172
173
|
};
|
|
173
174
|
|
|
174
175
|
private _onVideoFeedLoadFinished = (event: NativeSyntheticEvent<any>) => {
|
|
175
|
-
FWLoggerUtil.log(
|
|
176
|
-
`VideoFeed _onVideoFeedLoadFinished ${JSON.stringify(event.nativeEvent)}`
|
|
177
|
-
);
|
|
178
176
|
const { onVideoFeedLoadFinished, onVideoFeedEmpty } = this.props;
|
|
179
177
|
|
|
180
178
|
const { name, reason, action } = event.nativeEvent;
|
|
@@ -185,8 +183,11 @@ class VideoFeed extends React.Component<IVideoFeedProps, IVideoFeedState> {
|
|
|
185
183
|
if (reason) {
|
|
186
184
|
error.reason = reason;
|
|
187
185
|
}
|
|
188
|
-
|
|
186
|
+
|
|
189
187
|
if (Platform.OS === 'android') {
|
|
188
|
+
if (!this._loaded) {
|
|
189
|
+
onVideoFeedLoadFinished(error);
|
|
190
|
+
}
|
|
190
191
|
if (
|
|
191
192
|
action === FWNativeErrorAction.loadingFirstPage ||
|
|
192
193
|
!this._loaded
|
|
@@ -194,12 +195,19 @@ class VideoFeed extends React.Component<IVideoFeedProps, IVideoFeedState> {
|
|
|
194
195
|
onVideoFeedEmpty?.(error);
|
|
195
196
|
}
|
|
196
197
|
} else {
|
|
198
|
+
onVideoFeedLoadFinished(error);
|
|
197
199
|
if (!this._loaded) {
|
|
198
200
|
onVideoFeedEmpty?.(error);
|
|
199
201
|
}
|
|
200
202
|
}
|
|
201
203
|
} else {
|
|
202
|
-
|
|
204
|
+
if (Platform.OS === 'android') {
|
|
205
|
+
if (!this._loaded) {
|
|
206
|
+
onVideoFeedLoadFinished();
|
|
207
|
+
}
|
|
208
|
+
} else {
|
|
209
|
+
onVideoFeedLoadFinished();
|
|
210
|
+
}
|
|
203
211
|
this._loaded = true;
|
|
204
212
|
}
|
|
205
213
|
}
|
|
@@ -274,6 +282,13 @@ class VideoFeed extends React.Component<IVideoFeedProps, IVideoFeedState> {
|
|
|
274
282
|
|
|
275
283
|
const { feedId } = event.nativeEvent;
|
|
276
284
|
|
|
285
|
+
if (feedId) {
|
|
286
|
+
FWGlobalState.getInstance().componentTypeByFeedIdMap.set(
|
|
287
|
+
feedId,
|
|
288
|
+
FWComponentType.videoFeed
|
|
289
|
+
);
|
|
290
|
+
}
|
|
291
|
+
|
|
277
292
|
if (onVideoFeedGetFeedId) {
|
|
278
293
|
onVideoFeedGetFeedId(feedId ?? '');
|
|
279
294
|
}
|
|
@@ -390,6 +405,7 @@ class VideoFeed extends React.Component<IVideoFeedProps, IVideoFeedState> {
|
|
|
390
405
|
const titleHidden = videoFeedConfiguration?.title?.hidden?.toString();
|
|
391
406
|
const titleTextColor = videoFeedConfiguration?.title?.textColor;
|
|
392
407
|
const titleFontSize = videoFeedConfiguration?.title?.fontSize?.toFixed(5);
|
|
408
|
+
const titleNumberOfLines = videoFeedConfiguration?.title?.numberOfLines;
|
|
393
409
|
const titleAndroidFontInfo = videoFeedConfiguration?.title?.androidFontInfo;
|
|
394
410
|
const titleGradientDrawable =
|
|
395
411
|
videoFeedConfiguration?.title?.gradientDrawable;
|
|
@@ -399,7 +415,7 @@ class VideoFeed extends React.Component<IVideoFeedProps, IVideoFeedState> {
|
|
|
399
415
|
videoFeedConfiguration?.playIcon?.iconWidth?.toFixed(5);
|
|
400
416
|
const showAdBadge = videoFeedConfiguration?.showAdBadge?.toString();
|
|
401
417
|
const enableAutoplay = videoFeedConfiguration?.enableAutoplay;
|
|
402
|
-
const gridColumns = videoFeedConfiguration?.gridColumns
|
|
418
|
+
const gridColumns = videoFeedConfiguration?.gridColumns;
|
|
403
419
|
const itemSpacing = videoFeedConfiguration?.itemSpacing?.toFixed(5);
|
|
404
420
|
|
|
405
421
|
const videoPlayerConfiguration = this._getVideoPlayerConfiguration();
|
|
@@ -466,6 +482,7 @@ class VideoFeed extends React.Component<IVideoFeedProps, IVideoFeedState> {
|
|
|
466
482
|
key += `_cornerRadius:${cornerRadius}`;
|
|
467
483
|
key += `_titleTextColor:${titleTextColor}`;
|
|
468
484
|
key += `_titleFontSize:${titleFontSize}`;
|
|
485
|
+
key += `_titleNumberOfLines:${titleNumberOfLines}`;
|
|
469
486
|
key += `_titleAndroidFontInfo.isCustom:${titleAndroidFontInfo?.isCustom}`;
|
|
470
487
|
key += `_titleAndroidFontInfo.typefaceName:${titleAndroidFontInfo?.typefaceName}`;
|
|
471
488
|
key += `_titleGradientDrawable.orientation:${titleGradientDrawable?.orientation}`;
|
package/src/index.ts
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type {
|
|
2
|
+
IStoryBlockMethods,
|
|
3
|
+
IStoryBlockProps,
|
|
4
|
+
} from './components/StoryBlock';
|
|
5
|
+
import StoryBlock from './components/StoryBlock';
|
|
6
|
+
import type { IVideoFeedProps, VideoFeedMode } from './components/VideoFeed';
|
|
7
|
+
import VideoFeed from './components/VideoFeed';
|
|
2
8
|
import type {
|
|
3
9
|
CustomCTAClickCallback,
|
|
4
10
|
SDKInitCallback,
|
|
@@ -6,26 +12,12 @@ import type {
|
|
|
6
12
|
VideoPlaybackCallback,
|
|
7
13
|
} from './FireworkSDK';
|
|
8
14
|
import FireworkSDK from './FireworkSDK';
|
|
15
|
+
import FWNavigator from './FWNavigator';
|
|
9
16
|
import type {
|
|
10
17
|
onLiveStreamChatEventCallback,
|
|
11
18
|
onLiveStreamEventCallback,
|
|
12
19
|
} from './LiveStream';
|
|
13
20
|
import LiveStream from './LiveStream';
|
|
14
|
-
import type {
|
|
15
|
-
CustomClickCartIconCallback,
|
|
16
|
-
CustomClickLinkButtonCallback,
|
|
17
|
-
CustomTapProductCardCallback,
|
|
18
|
-
ShoppingCTACallback,
|
|
19
|
-
UpdateProductDetailsCallback,
|
|
20
|
-
} from './VideoShopping';
|
|
21
|
-
import VideoShopping from './VideoShopping';
|
|
22
|
-
import type {
|
|
23
|
-
IStoryBlockMethods,
|
|
24
|
-
IStoryBlockProps,
|
|
25
|
-
} from './components/StoryBlock';
|
|
26
|
-
import StoryBlock from './components/StoryBlock';
|
|
27
|
-
import type { IVideoFeedProps, VideoFeedMode } from './components/VideoFeed';
|
|
28
|
-
import VideoFeed from './components/VideoFeed';
|
|
29
21
|
import type AdBadgeConfiguration from './models/AdBadgeConfiguration';
|
|
30
22
|
import type { AdBadgeTextType } from './models/AdBadgeConfiguration';
|
|
31
23
|
import type AdConfiguration from './models/AdConfiguration';
|
|
@@ -34,11 +26,15 @@ import type AndroidFontInfo from './models/AndroidFontInfo';
|
|
|
34
26
|
import type ButtonInfo from './models/ButtonInfo';
|
|
35
27
|
import type CountdownTimerConfiguration from './models/CountdownTimerConfiguration';
|
|
36
28
|
import type { CountdownTimerAppearanceMode } from './models/CountdownTimerConfiguration';
|
|
29
|
+
import type { DataTrackingLevel } from './models/DataTrackingLevel';
|
|
30
|
+
import type FeedItemDetails from './models/FeedItemDetails';
|
|
31
|
+
import { FWComponentType } from './models/FWComponentType';
|
|
37
32
|
import type FWError from './models/FWError';
|
|
38
33
|
import type {
|
|
39
|
-
|
|
34
|
+
ClickProductEvent,
|
|
40
35
|
CustomClickCartIconEvent,
|
|
41
36
|
CustomClickLinkButtonEvent,
|
|
37
|
+
CustomCTAClickEvent,
|
|
42
38
|
CustomTapProductCardEvent,
|
|
43
39
|
LiveStreamChatEvent,
|
|
44
40
|
LiveStreamEvent,
|
|
@@ -49,7 +45,6 @@ import type {
|
|
|
49
45
|
VideoFeedClickEvent,
|
|
50
46
|
VideoPlaybackEvent,
|
|
51
47
|
} from './models/FWEvents';
|
|
52
|
-
import type FeedItemDetails from './models/FeedItemDetails';
|
|
53
48
|
import type GradientDrawable from './models/GradientDrawable';
|
|
54
49
|
import type { GradientDrawableOrientation } from './models/GradientDrawable';
|
|
55
50
|
import type IOSFontInfo from './models/IOSFontInfo';
|
|
@@ -66,9 +61,9 @@ import type Product from './models/Product';
|
|
|
66
61
|
import type ProductInfoViewConfiguration from './models/ProductInfoViewConfiguration';
|
|
67
62
|
import type {
|
|
68
63
|
LinkButtonConfiguration,
|
|
64
|
+
ProductCardConfiguration,
|
|
69
65
|
ProductCardCTAButtonStyle,
|
|
70
66
|
ProductCardCTAButtonText,
|
|
71
|
-
ProductCardConfiguration,
|
|
72
67
|
ProductCardIconConfiguration,
|
|
73
68
|
ProductCardLabelConfiguration,
|
|
74
69
|
ProductCardPriceConfiguration,
|
|
@@ -99,20 +94,30 @@ import type VideoPlaybackDetails from './models/VideoPlaybackDetails';
|
|
|
99
94
|
import type { VideoPlayerSize } from './models/VideoPlaybackDetails';
|
|
100
95
|
import VideoPlaybackEventName from './models/VideoPlaybackEventName';
|
|
101
96
|
import type VideoPlayerButtonConfiguration from './models/VideoPlayerButtonConfiguration';
|
|
97
|
+
import type { VideoPlayerCompleteAction } from './models/VideoPlayerCompleteAction';
|
|
98
|
+
import type VideoPlayerConfiguration from './models/VideoPlayerConfiguration';
|
|
102
99
|
import type {
|
|
103
100
|
VideoPlayerCTADelay,
|
|
104
101
|
VideoPlayerCTADelayType,
|
|
105
102
|
} from './models/VideoPlayerCTADelay';
|
|
106
103
|
import type { VideoPlayerCTAStyle } from './models/VideoPlayerCTAStyle';
|
|
107
104
|
import type { VideoPlayerCTAWidth } from './models/VideoPlayerCTAWidth';
|
|
108
|
-
import type {
|
|
109
|
-
import type VideoPlayerConfiguration from './models/VideoPlayerConfiguration';
|
|
105
|
+
import type { VideoPlayerLivestreamCountdownTimerTheme } from './models/VideoPlayerLivestreamCountdownTimerTheme';
|
|
110
106
|
import type {
|
|
111
107
|
VideoPlayerLogoConfiguration,
|
|
112
108
|
VideoPlayerLogoOption,
|
|
113
109
|
} from './models/VideoPlayerLogoConfiguration';
|
|
114
110
|
import type { VideoPlayerStyle } from './models/VideoPlayerStyle';
|
|
115
111
|
import VideoFeedUtil from './utils/VideoFeedUtil';
|
|
112
|
+
import type {
|
|
113
|
+
ClickProductCallback,
|
|
114
|
+
CustomClickCartIconCallback,
|
|
115
|
+
CustomClickLinkButtonCallback,
|
|
116
|
+
CustomTapProductCardCallback,
|
|
117
|
+
ShoppingCTACallback,
|
|
118
|
+
UpdateProductDetailsCallback,
|
|
119
|
+
} from './VideoShopping';
|
|
120
|
+
import VideoShopping from './VideoShopping';
|
|
116
121
|
|
|
117
122
|
export default FireworkSDK;
|
|
118
123
|
|
|
@@ -122,20 +127,24 @@ export {
|
|
|
122
127
|
AdConfiguration,
|
|
123
128
|
AndroidFontInfo,
|
|
124
129
|
ButtonInfo,
|
|
130
|
+
ClickProductCallback,
|
|
131
|
+
ClickProductEvent,
|
|
125
132
|
CountdownTimerAppearanceMode,
|
|
126
133
|
CountdownTimerConfiguration,
|
|
127
|
-
CustomCTAClickCallback,
|
|
128
|
-
CustomCTAClickEvent,
|
|
129
134
|
CustomClickCartIconCallback,
|
|
130
135
|
CustomClickCartIconEvent,
|
|
131
136
|
CustomClickLinkButtonCallback,
|
|
132
137
|
CustomClickLinkButtonEvent,
|
|
138
|
+
CustomCTAClickCallback,
|
|
139
|
+
CustomCTAClickEvent,
|
|
133
140
|
CustomTapProductCardCallback,
|
|
134
141
|
CustomTapProductCardEvent,
|
|
135
|
-
|
|
136
|
-
FWNavigator,
|
|
142
|
+
DataTrackingLevel,
|
|
137
143
|
FeedItemDetails,
|
|
138
144
|
FireworkSDK,
|
|
145
|
+
FWComponentType,
|
|
146
|
+
FWError,
|
|
147
|
+
FWNavigator,
|
|
139
148
|
GradientDrawable,
|
|
140
149
|
GradientDrawableOrientation,
|
|
141
150
|
IOSFontInfo,
|
|
@@ -152,12 +161,14 @@ export {
|
|
|
152
161
|
LiveStreamEventDetails,
|
|
153
162
|
LiveStreamEventName,
|
|
154
163
|
LiveStreamMessageDetails,
|
|
164
|
+
onLiveStreamChatEventCallback,
|
|
165
|
+
onLiveStreamEventCallback,
|
|
155
166
|
OpenVideoPlayerConfiguration,
|
|
156
167
|
PlayerHandler,
|
|
157
168
|
Product,
|
|
169
|
+
ProductCardConfiguration,
|
|
158
170
|
ProductCardCTAButtonStyle,
|
|
159
171
|
ProductCardCTAButtonText,
|
|
160
|
-
ProductCardConfiguration,
|
|
161
172
|
ProductCardIconConfiguration,
|
|
162
173
|
ProductCardLabelConfiguration,
|
|
163
174
|
ProductCardPriceConfiguration,
|
|
@@ -201,17 +212,16 @@ export {
|
|
|
201
212
|
VideoPlaybackEvent,
|
|
202
213
|
VideoPlaybackEventName,
|
|
203
214
|
VideoPlayerButtonConfiguration,
|
|
215
|
+
VideoPlayerCompleteAction,
|
|
216
|
+
VideoPlayerConfiguration,
|
|
204
217
|
VideoPlayerCTADelay,
|
|
205
218
|
VideoPlayerCTADelayType,
|
|
206
219
|
VideoPlayerCTAStyle,
|
|
207
220
|
VideoPlayerCTAWidth,
|
|
208
|
-
|
|
209
|
-
VideoPlayerConfiguration,
|
|
221
|
+
VideoPlayerLivestreamCountdownTimerTheme,
|
|
210
222
|
VideoPlayerLogoConfiguration,
|
|
211
223
|
VideoPlayerLogoOption,
|
|
212
224
|
VideoPlayerSize,
|
|
213
225
|
VideoPlayerStyle,
|
|
214
226
|
VideoShopping,
|
|
215
|
-
onLiveStreamChatEventCallback,
|
|
216
|
-
onLiveStreamEventCallback,
|
|
217
227
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type DataTrackingLevel = 'all' | 'essentialOnly' | 'none';
|
|
@@ -18,4 +18,5 @@ export enum FWEventName {
|
|
|
18
18
|
CustomLinkButtonClick = 'fw:shopping:custom-link-button-click',
|
|
19
19
|
CustomProductCardTap = 'fw:shopping:custom-product-card-tap',
|
|
20
20
|
ProductInfoViewConfigurationUpdated = 'fw:product-info-view-configuration-updated',
|
|
21
|
+
ProductClick = 'fw:shopping:product-click',
|
|
21
22
|
}
|
package/src/models/FWEvents.ts
CHANGED
|
@@ -100,7 +100,6 @@ export interface CustomClickLinkButtonEvent {
|
|
|
100
100
|
unitId: string;
|
|
101
101
|
/**
|
|
102
102
|
* The video playback details for the event.
|
|
103
|
-
* Only supported on Android.
|
|
104
103
|
*/
|
|
105
104
|
video?: VideoPlaybackDetails;
|
|
106
105
|
}
|
|
@@ -128,6 +127,25 @@ export interface CustomTapProductCardEvent {
|
|
|
128
127
|
playerHandler?: PlayerHandler;
|
|
129
128
|
}
|
|
130
129
|
|
|
130
|
+
export interface ClickProductEvent {
|
|
131
|
+
/**
|
|
132
|
+
* The url for the product unit
|
|
133
|
+
*/
|
|
134
|
+
url: string;
|
|
135
|
+
/**
|
|
136
|
+
* A unique identifier of the product.
|
|
137
|
+
*/
|
|
138
|
+
productId: string;
|
|
139
|
+
/**
|
|
140
|
+
* A unique identifier of the product unit.
|
|
141
|
+
*/
|
|
142
|
+
unitId: string;
|
|
143
|
+
/**
|
|
144
|
+
* The video playback details for the event.
|
|
145
|
+
*/
|
|
146
|
+
video: VideoPlaybackDetails;
|
|
147
|
+
}
|
|
148
|
+
|
|
131
149
|
export interface LiveStreamEvent {
|
|
132
150
|
eventName: LiveStreamEventName;
|
|
133
151
|
info: LiveStreamEventDetails;
|
|
@@ -33,8 +33,6 @@ export interface StoryBlockConfiguration {
|
|
|
33
33
|
ctaButtonStyle?: VideoPlayerCTAStyle;
|
|
34
34
|
/**
|
|
35
35
|
* Indicates if the video player shows playback button.
|
|
36
|
-
* The property only applies to full-screen story block but not to compact story block.
|
|
37
|
-
* Only supported on Android.
|
|
38
36
|
*/
|
|
39
37
|
showPlaybackButton?: boolean;
|
|
40
38
|
/**
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type VideoPlayerLivestreamCountdownTimerTheme = 'dark' | 'light';
|