react-native-firework-sdk 2.13.0 → 2.14.1
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/gradle.properties +1 -1
- 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/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/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/FWVideoShoppingModule.kt +29 -19
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FireworkSDKModule.kt +41 -17
- 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 +4 -0
- 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 +9 -1
- package/ios/Components/StoryBlock.swift +14 -3
- package/ios/Components/VideoFeed.swift +4 -0
- 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/FireworkSDKModule/SDKInitOptions.swift +9 -0
- 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 +14 -6
- 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/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 +13 -6
- 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/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 +15 -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/StoryBlockConfiguration.d.ts +0 -2
- package/lib/typescript/models/VideoFeedConfiguration.d.ts +0 -1
- package/lib/typescript/models/VideoPlayerConfiguration.d.ts +1 -1
- 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 +11 -1
- package/src/index.ts +38 -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/StoryBlockConfiguration.ts +0 -2
- package/src/models/VideoFeedConfiguration.ts +0 -1
- package/src/models/VideoPlayerConfiguration.ts +1 -1
- package/src/modules/FireworkSDKModule.ts +2 -0
- package/src/utils/FWGlobalState.ts +3 -0
|
@@ -36,8 +36,6 @@ export interface StoryBlockConfiguration {
|
|
|
36
36
|
showPlaybackButton?: boolean;
|
|
37
37
|
/**
|
|
38
38
|
* Indicates if the video player shows mute button.
|
|
39
|
-
* On Android, the property applies to full-screen and compact story block.
|
|
40
|
-
* Only supported on Android.
|
|
41
39
|
*/
|
|
42
40
|
showMuteButton?: boolean;
|
|
43
41
|
/**
|
|
@@ -29,7 +29,7 @@ export default interface VideoPlayerConfiguration {
|
|
|
29
29
|
ctaButtonStyle?: VideoPlayerCTAStyle;
|
|
30
30
|
/**
|
|
31
31
|
* Indicates if the video player shows playback button.
|
|
32
|
-
* Defaults to
|
|
32
|
+
* Defaults to true.
|
|
33
33
|
*/
|
|
34
34
|
showPlaybackButton?: boolean;
|
|
35
35
|
/**
|
|
@@ -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.4'
|
|
37
|
+
s.dependency 'FireworkVideo', '1.23.2'
|
|
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
|
|
|
@@ -281,6 +282,13 @@ class VideoFeed extends React.Component<IVideoFeedProps, IVideoFeedState> {
|
|
|
281
282
|
|
|
282
283
|
const { feedId } = event.nativeEvent;
|
|
283
284
|
|
|
285
|
+
if (feedId) {
|
|
286
|
+
FWGlobalState.getInstance().componentTypeByFeedIdMap.set(
|
|
287
|
+
feedId,
|
|
288
|
+
FWComponentType.videoFeed
|
|
289
|
+
);
|
|
290
|
+
}
|
|
291
|
+
|
|
284
292
|
if (onVideoFeedGetFeedId) {
|
|
285
293
|
onVideoFeedGetFeedId(feedId ?? '');
|
|
286
294
|
}
|
|
@@ -397,6 +405,7 @@ class VideoFeed extends React.Component<IVideoFeedProps, IVideoFeedState> {
|
|
|
397
405
|
const titleHidden = videoFeedConfiguration?.title?.hidden?.toString();
|
|
398
406
|
const titleTextColor = videoFeedConfiguration?.title?.textColor;
|
|
399
407
|
const titleFontSize = videoFeedConfiguration?.title?.fontSize?.toFixed(5);
|
|
408
|
+
const titleNumberOfLines = videoFeedConfiguration?.title?.numberOfLines;
|
|
400
409
|
const titleAndroidFontInfo = videoFeedConfiguration?.title?.androidFontInfo;
|
|
401
410
|
const titleGradientDrawable =
|
|
402
411
|
videoFeedConfiguration?.title?.gradientDrawable;
|
|
@@ -406,7 +415,7 @@ class VideoFeed extends React.Component<IVideoFeedProps, IVideoFeedState> {
|
|
|
406
415
|
videoFeedConfiguration?.playIcon?.iconWidth?.toFixed(5);
|
|
407
416
|
const showAdBadge = videoFeedConfiguration?.showAdBadge?.toString();
|
|
408
417
|
const enableAutoplay = videoFeedConfiguration?.enableAutoplay;
|
|
409
|
-
const gridColumns = videoFeedConfiguration?.gridColumns
|
|
418
|
+
const gridColumns = videoFeedConfiguration?.gridColumns;
|
|
410
419
|
const itemSpacing = videoFeedConfiguration?.itemSpacing?.toFixed(5);
|
|
411
420
|
|
|
412
421
|
const videoPlayerConfiguration = this._getVideoPlayerConfiguration();
|
|
@@ -473,6 +482,7 @@ class VideoFeed extends React.Component<IVideoFeedProps, IVideoFeedState> {
|
|
|
473
482
|
key += `_cornerRadius:${cornerRadius}`;
|
|
474
483
|
key += `_titleTextColor:${titleTextColor}`;
|
|
475
484
|
key += `_titleFontSize:${titleFontSize}`;
|
|
485
|
+
key += `_titleNumberOfLines:${titleNumberOfLines}`;
|
|
476
486
|
key += `_titleAndroidFontInfo.isCustom:${titleAndroidFontInfo?.isCustom}`;
|
|
477
487
|
key += `_titleAndroidFontInfo.typefaceName:${titleAndroidFontInfo?.typefaceName}`;
|
|
478
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,21 +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 { VideoPlayerCompleteAction } from './models/VideoPlayerCompleteAction';
|
|
109
105
|
import type { VideoPlayerLivestreamCountdownTimerTheme } from './models/VideoPlayerLivestreamCountdownTimerTheme';
|
|
110
|
-
import type VideoPlayerConfiguration from './models/VideoPlayerConfiguration';
|
|
111
106
|
import type {
|
|
112
107
|
VideoPlayerLogoConfiguration,
|
|
113
108
|
VideoPlayerLogoOption,
|
|
114
109
|
} from './models/VideoPlayerLogoConfiguration';
|
|
115
110
|
import type { VideoPlayerStyle } from './models/VideoPlayerStyle';
|
|
116
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';
|
|
117
121
|
|
|
118
122
|
export default FireworkSDK;
|
|
119
123
|
|
|
@@ -123,20 +127,24 @@ export {
|
|
|
123
127
|
AdConfiguration,
|
|
124
128
|
AndroidFontInfo,
|
|
125
129
|
ButtonInfo,
|
|
130
|
+
ClickProductCallback,
|
|
131
|
+
ClickProductEvent,
|
|
126
132
|
CountdownTimerAppearanceMode,
|
|
127
133
|
CountdownTimerConfiguration,
|
|
128
|
-
CustomCTAClickCallback,
|
|
129
|
-
CustomCTAClickEvent,
|
|
130
134
|
CustomClickCartIconCallback,
|
|
131
135
|
CustomClickCartIconEvent,
|
|
132
136
|
CustomClickLinkButtonCallback,
|
|
133
137
|
CustomClickLinkButtonEvent,
|
|
138
|
+
CustomCTAClickCallback,
|
|
139
|
+
CustomCTAClickEvent,
|
|
134
140
|
CustomTapProductCardCallback,
|
|
135
141
|
CustomTapProductCardEvent,
|
|
136
|
-
|
|
137
|
-
FWNavigator,
|
|
142
|
+
DataTrackingLevel,
|
|
138
143
|
FeedItemDetails,
|
|
139
144
|
FireworkSDK,
|
|
145
|
+
FWComponentType,
|
|
146
|
+
FWError,
|
|
147
|
+
FWNavigator,
|
|
140
148
|
GradientDrawable,
|
|
141
149
|
GradientDrawableOrientation,
|
|
142
150
|
IOSFontInfo,
|
|
@@ -153,12 +161,14 @@ export {
|
|
|
153
161
|
LiveStreamEventDetails,
|
|
154
162
|
LiveStreamEventName,
|
|
155
163
|
LiveStreamMessageDetails,
|
|
164
|
+
onLiveStreamChatEventCallback,
|
|
165
|
+
onLiveStreamEventCallback,
|
|
156
166
|
OpenVideoPlayerConfiguration,
|
|
157
167
|
PlayerHandler,
|
|
158
168
|
Product,
|
|
169
|
+
ProductCardConfiguration,
|
|
159
170
|
ProductCardCTAButtonStyle,
|
|
160
171
|
ProductCardCTAButtonText,
|
|
161
|
-
ProductCardConfiguration,
|
|
162
172
|
ProductCardIconConfiguration,
|
|
163
173
|
ProductCardLabelConfiguration,
|
|
164
174
|
ProductCardPriceConfiguration,
|
|
@@ -202,18 +212,16 @@ export {
|
|
|
202
212
|
VideoPlaybackEvent,
|
|
203
213
|
VideoPlaybackEventName,
|
|
204
214
|
VideoPlayerButtonConfiguration,
|
|
215
|
+
VideoPlayerCompleteAction,
|
|
216
|
+
VideoPlayerConfiguration,
|
|
205
217
|
VideoPlayerCTADelay,
|
|
206
218
|
VideoPlayerCTADelayType,
|
|
207
219
|
VideoPlayerCTAStyle,
|
|
208
220
|
VideoPlayerCTAWidth,
|
|
209
|
-
VideoPlayerCompleteAction,
|
|
210
221
|
VideoPlayerLivestreamCountdownTimerTheme,
|
|
211
|
-
VideoPlayerConfiguration,
|
|
212
222
|
VideoPlayerLogoConfiguration,
|
|
213
223
|
VideoPlayerLogoOption,
|
|
214
224
|
VideoPlayerSize,
|
|
215
225
|
VideoPlayerStyle,
|
|
216
226
|
VideoShopping,
|
|
217
|
-
onLiveStreamChatEventCallback,
|
|
218
|
-
onLiveStreamEventCallback,
|
|
219
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;
|
|
@@ -37,8 +37,6 @@ export interface StoryBlockConfiguration {
|
|
|
37
37
|
showPlaybackButton?: boolean;
|
|
38
38
|
/**
|
|
39
39
|
* Indicates if the video player shows mute button.
|
|
40
|
-
* On Android, the property applies to full-screen and compact story block.
|
|
41
|
-
* Only supported on Android.
|
|
42
40
|
*/
|
|
43
41
|
showMuteButton?: boolean;
|
|
44
42
|
/**
|
|
@@ -30,7 +30,7 @@ export default interface VideoPlayerConfiguration {
|
|
|
30
30
|
ctaButtonStyle?: VideoPlayerCTAStyle;
|
|
31
31
|
/**
|
|
32
32
|
* Indicates if the video player shows playback button.
|
|
33
|
-
* Defaults to
|
|
33
|
+
* Defaults to true.
|
|
34
34
|
*/
|
|
35
35
|
showPlaybackButton?: boolean;
|
|
36
36
|
/**
|
|
@@ -5,6 +5,7 @@ import type AdBadgeConfiguration from '../models/AdBadgeConfiguration';
|
|
|
5
5
|
import type SDKInitOptions from '../models/SDKInitOptions';
|
|
6
6
|
import type TrackPurchaseParameters from '../models/TrackPurchaseParameters';
|
|
7
7
|
import type VideoPlayerNativeConfiguration from '../models/VideoPlayerNativeConfiguration';
|
|
8
|
+
import type { DataTrackingLevel } from 'src/models/DataTrackingLevel';
|
|
8
9
|
|
|
9
10
|
const FireworkSDKModule = NativeModules.FireworkSDK
|
|
10
11
|
? NativeModules.FireworkSDK
|
|
@@ -30,6 +31,7 @@ interface IFireworkSDKModule extends NativeModule {
|
|
|
30
31
|
changeAppLanguage(language?: string | null): Promise<boolean>;
|
|
31
32
|
pausePlayer(callbackId: number | string): void; // Only supported on iOS
|
|
32
33
|
resumePlayer(callbackId: number | string): void; // Only supported on iOS
|
|
34
|
+
setDataTrackingLevel(level?: DataTrackingLevel): void; // Only supported on iOS
|
|
33
35
|
}
|
|
34
36
|
|
|
35
37
|
const FireworkSDKModuleEventEmitter = new NativeEventEmitter(FireworkSDKModule);
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
import type { FWComponentType } from 'src/models/FWComponentType';
|
|
2
|
+
|
|
1
3
|
class FWGlobalState {
|
|
2
4
|
private static _instance?: FWGlobalState;
|
|
3
5
|
private sdkInitCalledResolveFunc?: () => void;
|
|
4
6
|
sdkInitCalledPromise: Promise<void>;
|
|
5
7
|
sdkInitCalled: boolean = false;
|
|
8
|
+
componentTypeByFeedIdMap = new Map<string, FWComponentType>();
|
|
6
9
|
|
|
7
10
|
static getInstance() {
|
|
8
11
|
if (!FWGlobalState._instance) {
|