react-native-firework-sdk 2.0.0-beta.1 → 2.0.0-beta.5

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.
Files changed (83) hide show
  1. package/README.md +1 -1
  2. package/android/build.gradle +1 -1
  3. package/android/src/main/java/com/fireworksdk/bridge/models/FWFontInfoModel.kt +10 -0
  4. package/android/src/main/java/com/fireworksdk/bridge/models/FWFontInfoModelDeserializer.kt +21 -0
  5. package/android/src/main/java/com/fireworksdk/bridge/models/FWSDKInitOptionsModel.kt +11 -0
  6. package/android/src/main/java/com/fireworksdk/bridge/models/FWSDKInitOptionsModelDeserializer.kt +24 -0
  7. package/android/src/main/java/com/fireworksdk/bridge/models/FWSystemTypeface.kt +9 -0
  8. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoFeedConfigModel.kt +1 -0
  9. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoFeedConfigModelDeserializer.kt +4 -1
  10. package/android/src/main/java/com/fireworksdk/bridge/reactnative/manager/FWVideoFeedManager.kt +24 -1
  11. package/android/src/main/java/com/fireworksdk/bridge/reactnative/models/FireworkSDKInterface.kt +1 -1
  12. package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FireworkSDKModule.kt +29 -12
  13. package/android/src/main/java/com/fireworksdk/bridge/utils/FWConfigUtil.kt +33 -6
  14. package/ios/Components/VideoFeed.swift +12 -23
  15. package/ios/Components/VideoPlayerConfiguration.swift +0 -5
  16. package/ios/FireworkSdk.xcodeproj/project.pbxproj +4 -0
  17. package/ios/Models/NativeToRN/FireworkEventName.swift +1 -0
  18. package/ios/Models/RNToNative/RCTConvert+FireworkSDKModule.swift +20 -0
  19. package/ios/Modules/FWNavigatorModule/FWNavigatorModule.swift +30 -5
  20. package/ios/Modules/FireworkSDKModule/FireworkSDKModule.m +1 -1
  21. package/ios/Modules/FireworkSDKModule/FireworkSDKModule.swift +13 -3
  22. package/ios/Modules/FireworkSDKModule/SDKInitOptions.swift +29 -0
  23. package/lib/commonjs/FireworkSDK.js +42 -26
  24. package/lib/commonjs/FireworkSDK.js.map +1 -1
  25. package/lib/commonjs/VideoShopping.js.map +1 -1
  26. package/lib/commonjs/components/StoryBlock.js +20 -5
  27. package/lib/commonjs/components/StoryBlock.js.map +1 -1
  28. package/lib/commonjs/components/VideoFeed.js +22 -19
  29. package/lib/commonjs/components/VideoFeed.js.map +1 -1
  30. package/lib/commonjs/index.js +6 -0
  31. package/lib/commonjs/index.js.map +1 -1
  32. package/lib/commonjs/models/AndroidFontInfo.js +2 -0
  33. package/lib/commonjs/models/AndroidFontInfo.js.map +1 -0
  34. package/lib/commonjs/models/FWEventName.js +1 -0
  35. package/lib/commonjs/models/FWEventName.js.map +1 -1
  36. package/lib/commonjs/models/SDKInitOptions.js +2 -0
  37. package/lib/commonjs/models/SDKInitOptions.js.map +1 -0
  38. package/lib/commonjs/modules/FireworkSDKModule.js.map +1 -1
  39. package/lib/module/FireworkSDK.js +43 -25
  40. package/lib/module/FireworkSDK.js.map +1 -1
  41. package/lib/module/VideoShopping.js.map +1 -1
  42. package/lib/module/components/StoryBlock.js +18 -5
  43. package/lib/module/components/StoryBlock.js.map +1 -1
  44. package/lib/module/components/VideoFeed.js +20 -18
  45. package/lib/module/components/VideoFeed.js.map +1 -1
  46. package/lib/module/index.js +1 -1
  47. package/lib/module/index.js.map +1 -1
  48. package/lib/module/models/AndroidFontInfo.js +2 -0
  49. package/lib/module/models/AndroidFontInfo.js.map +1 -0
  50. package/lib/module/models/FWEventName.js +1 -0
  51. package/lib/module/models/FWEventName.js.map +1 -1
  52. package/lib/module/models/SDKInitOptions.js +2 -0
  53. package/lib/module/models/SDKInitOptions.js.map +1 -0
  54. package/lib/module/modules/FireworkSDKModule.js +1 -2
  55. package/lib/module/modules/FireworkSDKModule.js.map +1 -1
  56. package/lib/typescript/FireworkSDK.d.ts +23 -14
  57. package/lib/typescript/LiveStream.d.ts +2 -2
  58. package/lib/typescript/VideoShopping.d.ts +4 -4
  59. package/lib/typescript/components/StoryBlock.d.ts +6 -2
  60. package/lib/typescript/components/VideoFeed.d.ts +9 -2
  61. package/lib/typescript/index.d.ts +7 -3
  62. package/lib/typescript/models/AdBadgeConfiguration.d.ts +1 -1
  63. package/lib/typescript/models/AndroidFontInfo.d.ts +14 -0
  64. package/lib/typescript/models/FWEventName.d.ts +1 -0
  65. package/lib/typescript/models/IOSFontInfo.d.ts +2 -2
  66. package/lib/typescript/models/SDKInitOptions.d.ts +6 -0
  67. package/lib/typescript/models/StoryBlockSource.d.ts +1 -1
  68. package/lib/typescript/models/VideoFeedConfiguration.d.ts +9 -12
  69. package/lib/typescript/models/VideoFeedSource.d.ts +1 -1
  70. package/lib/typescript/models/VideoPlayerConfiguration.d.ts +4 -9
  71. package/lib/typescript/modules/FireworkSDKModule.d.ts +4 -3
  72. package/package.json +7 -4
  73. package/src/FireworkSDK.ts +42 -24
  74. package/src/VideoShopping.ts +3 -7
  75. package/src/components/StoryBlock.tsx +22 -4
  76. package/src/components/VideoFeed.tsx +24 -11
  77. package/src/index.ts +10 -1
  78. package/src/models/AndroidFontInfo.ts +14 -0
  79. package/src/models/FWEventName.ts +1 -0
  80. package/src/models/SDKInitOptions.ts +7 -0
  81. package/src/models/VideoFeedConfiguration.ts +8 -11
  82. package/src/models/VideoPlayerConfiguration.ts +1 -7
  83. package/src/modules/FireworkSDKModule.ts +6 -6
@@ -10,6 +10,8 @@ import type {
10
10
  VideoFeedClickEvent,
11
11
  VideoPlaybackEvent,
12
12
  } from './models/FWEvents';
13
+ import type SDKInitOptions from './models/SDKInitOptions';
14
+ import type { VideoLaunchBehavior } from './models/SDKInitOptions';
13
15
  import type TrackPurchaseParameters from './models/TrackPurchaseParameters';
14
16
  import type VideoPlayerConfiguration from './models/VideoPlayerConfiguration';
15
17
  import FireworkSDKModule, {
@@ -26,7 +28,7 @@ export type VideoPlaybackCallback = (event: VideoPlaybackEvent) => void;
26
28
  export type VideoFeedClickCallback = (event: VideoFeedClickEvent) => void;
27
29
 
28
30
  /**
29
- * Entry class of Firework SDK, which supports the sdk initialization and global configuration.
31
+ * Firework SDK.
30
32
  */
31
33
  class FireworkSDK {
32
34
  private static _instance?: FireworkSDK;
@@ -67,39 +69,34 @@ class FireworkSDK {
67
69
  private _onVideoPlayback?: VideoPlaybackCallback | undefined;
68
70
 
69
71
  /**
70
- * The share base URL of videos. Only supported on iOS.
72
+ * Get share base URL.
71
73
  */
72
- public get shareBaseURL(): string | undefined {
74
+ public getShareBaseURL(): string | undefined {
73
75
  return this._shareBaseURL;
74
76
  }
75
- public set shareBaseURL(value: string | undefined) {
76
- const valueHasChanged = this._shareBaseURL !== value;
77
- this._shareBaseURL = value;
78
- FireworkSDKModule.setShareBaseURL(value ?? '').then(() => {
79
- if (valueHasChanged) {
80
- this.eventEmitter.emit(FWEventName.ShareBaseURLUpdated);
81
- }
82
- });
83
- }
84
77
  private _shareBaseURL: string | undefined;
85
78
 
86
79
  /**
87
- * The configuration for ad badges. Only supported on iOS.
80
+ * Get the configuration for ad badges. Only supported on iOS.
88
81
  */
89
- public get adBadgeConfiguration(): AdBadgeConfiguration | undefined {
82
+ public getAdBadgeConfiguration(): AdBadgeConfiguration | undefined {
90
83
  return this._adBadgeConfiguration;
91
84
  }
92
- public set adBadgeConfiguration(value: AdBadgeConfiguration | undefined) {
85
+ /**
86
+ * Set the configuration for ad badges. Only supported on iOS.
87
+ */
88
+ public async setAdBadgeConfiguration(
89
+ value: AdBadgeConfiguration | undefined
90
+ ): Promise<void> {
91
+ await FireworkSDKModule.setAdBadgeConfiguration(value ?? {});
93
92
  const valueHasChanged =
94
93
  this._adBadgeConfiguration?.badgeTextType !== value?.badgeTextType ||
95
94
  this._adBadgeConfiguration?.backgroundColor !== value?.backgroundColor ||
96
95
  this._adBadgeConfiguration?.textColor !== value?.textColor;
97
96
  this._adBadgeConfiguration = value;
98
- FireworkSDKModule.setAdBadgeConfiguration(value ?? {}).then(() => {
99
- if (valueHasChanged) {
100
- this.eventEmitter.emit(FWEventName.AdBadgeConfigurationUpdated);
101
- }
102
- });
97
+ if (valueHasChanged) {
98
+ this.eventEmitter.emit(FWEventName.AdBadgeConfigurationUpdated);
99
+ }
103
100
  }
104
101
  private _adBadgeConfiguration: AdBadgeConfiguration | undefined;
105
102
 
@@ -114,6 +111,14 @@ class FireworkSDK {
114
111
  FWLoggerUtil.enabled = value;
115
112
  }
116
113
 
114
+ /**
115
+ * Get video launch behavior.
116
+ */
117
+ public getVideoLaunchBehavior(): VideoLaunchBehavior | undefined {
118
+ return this._videoLaunchBehavior;
119
+ }
120
+ private _videoLaunchBehavior: VideoLaunchBehavior | undefined;
121
+
117
122
  private get eventEmitter(): NativeEventEmitter {
118
123
  return FireworkSDKModuleEventEmitter;
119
124
  }
@@ -197,12 +202,25 @@ class FireworkSDK {
197
202
 
198
203
  /**
199
204
  * Initializes Firework SDK.
200
- * @param {string?} userId An id to uniquely identify device or user.
205
+ * @param {SDKInitOptions?} options
201
206
  */
202
- public init(userId?: string) {
207
+ public async init(options?: SDKInitOptions): Promise<void> {
203
208
  FWLoggerUtil.log('Call FireworkSDK init method');
204
209
 
205
- FireworkSDKModule.init(userId);
210
+ FireworkSDKModule.init(options).then(() => {
211
+ const shareBaseURLChanged = this._shareBaseURL !== options?.shareBaseURL;
212
+ this._shareBaseURL = options?.shareBaseURL;
213
+ if (shareBaseURLChanged) {
214
+ this.eventEmitter.emit(FWEventName.ShareBaseURLUpdated);
215
+ }
216
+
217
+ const videoLaunchBehaviorUpdated =
218
+ this._videoLaunchBehavior !== options?.videoLaunchBehavior;
219
+ this._videoLaunchBehavior = options?.videoLaunchBehavior;
220
+ if (videoLaunchBehaviorUpdated) {
221
+ this.eventEmitter.emit(FWEventName.VideoLaunchBehaviorUpdated);
222
+ }
223
+ });
206
224
  ShoppingModule.init();
207
225
  LiveStreamModule.init();
208
226
  }
@@ -229,7 +247,7 @@ class FireworkSDK {
229
247
  /**
230
248
  * Change App level language. Only supported on Android.
231
249
  * @param {string} language Such as en, ar and en-US
232
- * @returns
250
+ * @returns {Promise<boolean>}
233
251
  */
234
252
  public async changeAppLanguage(language: string): Promise<boolean> {
235
253
  if (Platform.OS === 'android') {
@@ -1,12 +1,12 @@
1
1
  import { NativeEventEmitter, Platform } from 'react-native';
2
2
 
3
3
  import type AddToCartResult from './models/AddToCartResult';
4
+ import { FWEventName } from './models/FWEventName';
4
5
  import type {
5
6
  AddToCartEvent,
6
7
  CustomClickLinkButtonEvent,
7
8
  UpdateProductDetailsEvent,
8
9
  } from './models/FWEvents';
9
- import { FWEventName } from './models/FWEventName';
10
10
  import type Product from './models/Product';
11
11
  import type ProductInfoViewConfiguration from './models/ProductInfoViewConfiguration';
12
12
  import ShoppingModule, {
@@ -28,8 +28,6 @@ export type CustomClickLinkButtonCallback = (
28
28
  event: CustomClickLinkButtonEvent
29
29
  ) => Promise<void>;
30
30
 
31
- type CallbackInfo = { callbackId?: number | string };
32
-
33
31
  /**
34
32
  * The entry class of video shopping.
35
33
  */
@@ -188,7 +186,7 @@ class VideoShopping {
188
186
  ShoppingModule.setCartItemCount(count);
189
187
  }
190
188
 
191
- private async handleAddToCartEvent(event: AddToCartEvent & CallbackInfo) {
189
+ private async handleAddToCartEvent(event: any) {
192
190
  const callbackId = event.callbackId;
193
191
  delete event.callbackId;
194
192
  if (this.onAddToCart) {
@@ -223,9 +221,7 @@ class VideoShopping {
223
221
  }
224
222
  }
225
223
 
226
- private async handleUpdateProductDetailsEvent(
227
- event: UpdateProductDetailsEvent & CallbackInfo
228
- ) {
224
+ private async handleUpdateProductDetailsEvent(event: any) {
229
225
  const callbackId = event.callbackId;
230
226
  delete event.callbackId;
231
227
  if (this.onUpdateProductDetails) {
@@ -30,6 +30,9 @@ const createFragment = (viewId: any) => {
30
30
  }
31
31
  };
32
32
 
33
+ /**
34
+ * The props type of StoryBlock component.
35
+ */
33
36
  export interface IStoryBlockProps {
34
37
  /**
35
38
  * Standard React Native View Style.
@@ -62,9 +65,9 @@ export interface IStoryBlockProps {
62
65
  }
63
66
 
64
67
  /**
65
- * Only supported on iOS.
68
+ * StoryBlock component. Only supported on iOS.
66
69
  */
67
- export default class StoryBlock extends React.Component<IStoryBlockProps> {
70
+ class StoryBlock extends React.Component<IStoryBlockProps> {
68
71
  nativeComponentRef = React.createRef<any>();
69
72
 
70
73
  subscriptions: EmitterSubscription[] = [];
@@ -87,6 +90,16 @@ export default class StoryBlock extends React.Component<IStoryBlockProps> {
87
90
  );
88
91
  this.subscriptions.push(subscriptionOfAdBadgeConfigurationUpdated);
89
92
 
93
+ const subscriptionOfVideoLaunchBehaviorUpdated =
94
+ FireworkSDKModuleEventEmitter.addListener(
95
+ FWEventName.VideoLaunchBehaviorUpdated,
96
+ () => {
97
+ FWLoggerUtil.log('Receive FWEventName.VideoLaunchBehaviorUpdated');
98
+ this.setState({});
99
+ }
100
+ );
101
+ this.subscriptions.push(subscriptionOfVideoLaunchBehaviorUpdated);
102
+
90
103
  if (Platform.OS === 'android') {
91
104
  const viewId = findNodeHandle(this.nativeComponentRef.current);
92
105
  FWLoggerUtil.log(
@@ -147,14 +160,16 @@ export default class StoryBlock extends React.Component<IStoryBlockProps> {
147
160
  enablePictureInPicture = false,
148
161
  } = this.props;
149
162
 
150
- const shareBaseURL = FireworkSDK.getInstance().shareBaseURL ?? '';
163
+ const shareBaseURL = FireworkSDK.getInstance().getShareBaseURL() ?? '';
151
164
  const adBadgeConfiguration =
152
- FireworkSDK.getInstance().adBadgeConfiguration ?? {};
165
+ FireworkSDK.getInstance().getAdBadgeConfiguration() ?? {};
153
166
  const adBadgeTextType = adBadgeConfiguration.badgeTextType ?? '';
154
167
  const backgroundColorOfAdBadge = adBadgeConfiguration.backgroundColor ?? '';
155
168
  const textColorOfAdBadge = adBadgeConfiguration.textColor ?? '';
156
169
  const dynamicContentParametersString =
157
170
  this._generateDynamicContentParametersString();
171
+ const videoLaunchBehavior =
172
+ FireworkSDK.getInstance().getVideoLaunchBehavior() ?? 'default';
158
173
 
159
174
  let key = `source:${source}`;
160
175
  key += `_channel:${channel}`;
@@ -165,6 +180,7 @@ export default class StoryBlock extends React.Component<IStoryBlockProps> {
165
180
  key += `_textColorOfAdBadge:${textColorOfAdBadge}`;
166
181
  key += `_dynamicContentParameters:${dynamicContentParametersString}`;
167
182
  key += `_enablePictureInPicture:${enablePictureInPicture}`;
183
+ key += `_videoLaunchBehavior:${videoLaunchBehavior}`;
168
184
 
169
185
  return key;
170
186
  }
@@ -191,3 +207,5 @@ export default class StoryBlock extends React.Component<IStoryBlockProps> {
191
207
  return resultString;
192
208
  }
193
209
  }
210
+
211
+ export default StoryBlock;
@@ -23,6 +23,9 @@ import FWVideoFeed from './FWVideoFeed';
23
23
 
24
24
  export type VideoFeedMode = 'row' | 'column' | 'grid';
25
25
 
26
+ /**
27
+ * The props of VideoFeed component.
28
+ */
26
29
  export interface IVideoFeedProps {
27
30
  /**
28
31
  * Standard React Native View Style.
@@ -76,7 +79,10 @@ export interface IVideoFeedProps {
76
79
 
77
80
  const NativeComponentName = 'FWVideoFeed';
78
81
 
79
- export default class VideoFeed extends React.Component<IVideoFeedProps> {
82
+ /**
83
+ * VideoFeed component.
84
+ */
85
+ class VideoFeed extends React.Component<IVideoFeedProps> {
80
86
  static defaultProps = {
81
87
  mode: 'row',
82
88
  };
@@ -151,6 +157,16 @@ export default class VideoFeed extends React.Component<IVideoFeedProps> {
151
157
  }
152
158
  );
153
159
  this.subscriptions.push(subscriptionOfAdBadgeConfigurationUpdated);
160
+
161
+ const subscriptionOfVideoLaunchBehaviorUpdated =
162
+ FireworkSDKModuleEventEmitter.addListener(
163
+ FWEventName.VideoLaunchBehaviorUpdated,
164
+ () => {
165
+ FWLoggerUtil.log('Receive FWEventName.VideoLaunchBehaviorUpdated');
166
+ this.setState({});
167
+ }
168
+ );
169
+ this.subscriptions.push(subscriptionOfVideoLaunchBehaviorUpdated);
154
170
  }
155
171
 
156
172
  componentWillUnmount() {
@@ -180,10 +196,9 @@ export default class VideoFeed extends React.Component<IVideoFeedProps> {
180
196
  const videoFeedConfiguration = this._getVideoFeedConfiguration();
181
197
  const titleHidden = videoFeedConfiguration?.title?.hidden ?? false;
182
198
  const titlePosition = videoFeedConfiguration?.titlePosition ?? 'nested';
183
- const customLayoutName = videoFeedConfiguration?.customLayoutName ?? '';
184
- const shareBaseURL = FireworkSDK.getInstance().shareBaseURL ?? '';
199
+ const shareBaseURL = FireworkSDK.getInstance().getShareBaseURL() ?? '';
185
200
  const adBadgeConfiguration =
186
- FireworkSDK.getInstance().adBadgeConfiguration ?? {};
201
+ FireworkSDK.getInstance().getAdBadgeConfiguration() ?? {};
187
202
  const adBadgeTextType = adBadgeConfiguration.badgeTextType ?? '';
188
203
  const backgroundColorOfAdBadge = adBadgeConfiguration.backgroundColor ?? '';
189
204
  const textColorOfAdBadge = adBadgeConfiguration.textColor ?? '';
@@ -191,16 +206,13 @@ export default class VideoFeed extends React.Component<IVideoFeedProps> {
191
206
  this._generateDynamicContentParametersString();
192
207
  const enableAutoplay = videoFeedConfiguration?.enableAutoplay ?? false;
193
208
 
194
- let enablePictureInPictureLegacy = false;
195
- if (videoFeedConfiguration) {
196
- enablePictureInPictureLegacy =
197
- (videoFeedConfiguration as any).enablePictureInPicture ?? false;
198
- }
199
209
  const gridColumns = videoFeedConfiguration?.gridColumns ?? 2;
200
210
  const requiresAds = adConfiguration?.requiresAds ?? false;
201
211
  const adsFetchTimeout = adConfiguration?.adsFetchTimeout ?? 10;
202
212
  const vastAttributesString = this._generateVastAttributesString();
203
213
  const showAdBadge = videoFeedConfiguration?.showAdBadge ?? false;
214
+ const videoLaunchBehavior =
215
+ FireworkSDK.getInstance().getVideoLaunchBehavior() ?? 'default';
204
216
 
205
217
  let key = `source:${source}`;
206
218
  key += `_channel:${channel}`;
@@ -209,7 +221,6 @@ export default class VideoFeed extends React.Component<IVideoFeedProps> {
209
221
  key += `_mode:${mode}`;
210
222
  key += `_titleHidden:${titleHidden}`;
211
223
  key += `_titlePosition:${titlePosition}`;
212
- key += `_customLayoutName:${customLayoutName}`;
213
224
  key += `_shareBaseURL:${shareBaseURL}`;
214
225
  key += `_adBadgeTextType:${adBadgeTextType}`;
215
226
  key += `_backgroundColorOfAdBadge:${backgroundColorOfAdBadge}`;
@@ -217,12 +228,12 @@ export default class VideoFeed extends React.Component<IVideoFeedProps> {
217
228
  key += `_dynamicContentParameters:${dynamicContentParametersString}`;
218
229
  key += `_enableAutoplay:${enableAutoplay}`;
219
230
  key += `_enablePictureInPicture:${enablePictureInPicture}`;
220
- key += `_enablePictureInPictureLegacy:${enablePictureInPictureLegacy}`;
221
231
  key += `_gridColumns:${gridColumns}`;
222
232
  key += `_requiresAds:${requiresAds}`;
223
233
  key += `_adsFetchTimeout:${adsFetchTimeout}`;
224
234
  key += `_vastAttributes:${vastAttributesString}`;
225
235
  key += `_showAdBadge:${showAdBadge}`;
236
+ key += `_videoLaunchBehavior:${videoLaunchBehavior}`;
226
237
 
227
238
  return (
228
239
  <FWVideoFeed
@@ -295,3 +306,5 @@ export default class VideoFeed extends React.Component<IVideoFeedProps> {
295
306
  }
296
307
  }
297
308
  }
309
+
310
+ export default VideoFeed;
package/src/index.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import type { IStoryBlockProps } from './components/StoryBlock';
1
2
  import StoryBlock from './components/StoryBlock';
2
3
  import type { IVideoFeedProps, VideoFeedMode } from './components/VideoFeed';
3
4
  import VideoFeed from './components/VideoFeed';
@@ -19,6 +20,7 @@ import type { AdBadgeTextType } from './models/AdBadgeConfiguration';
19
20
  import type AdConfiguration from './models/AdConfiguration';
20
21
  import type { VastAttribute } from './models/AdConfiguration';
21
22
  import type AddToCartResult from './models/AddToCartResult';
23
+ import type AndroidFontInfo from './models/AndroidFontInfo';
22
24
  import type FeedItemDetails from './models/FeedItemDetails';
23
25
  import type FWError from './models/FWError';
24
26
  import type {
@@ -29,6 +31,7 @@ import type {
29
31
  LiveStreamEvent,
30
32
  SDKInitEvent,
31
33
  UpdateProductDetailsEvent,
34
+ VideoFeedClickEvent,
32
35
  VideoPlaybackEvent,
33
36
  } from './models/FWEvents';
34
37
  import type IOSFontInfo from './models/IOSFontInfo';
@@ -48,6 +51,8 @@ import type {
48
51
  } from './models/ProductInfoViewConfiguration';
49
52
  import type ProductUnit from './models/ProductUnit';
50
53
  import type { ProductPrice, ProductUnitOption } from './models/ProductUnit';
54
+ import type SDKInitOptions from './models/SDKInitOptions';
55
+ import type { VideoLaunchBehavior } from './models/SDKInitOptions';
51
56
  import type { StoryBlockSource } from './models/StoryBlockSource';
52
57
  import type TrackPurchaseParameters from './models/TrackPurchaseParameters';
53
58
  import type VideoFeedConfiguration from './models/VideoFeedConfiguration';
@@ -63,7 +68,6 @@ import type { VideoPlayerSize } from './models/VideoPlaybackDetails';
63
68
  import VideoPlaybackEventName from './models/VideoPlaybackEventName';
64
69
  import type VideoPlayerConfiguration from './models/VideoPlayerConfiguration';
65
70
  import type {
66
- VideoLaunchBehavior,
67
71
  VideoPlayerCompleteAction,
68
72
  VideoPlayerCTADelay,
69
73
  VideoPlayerCTADelayType,
@@ -88,17 +92,20 @@ export {
88
92
  AddToCartCallback,
89
93
  AddToCartEvent,
90
94
  AddToCartResult,
95
+ AndroidFontInfo,
91
96
  CustomClickCartIconCallback,
92
97
  CustomClickLinkButtonCallback,
93
98
  CustomClickLinkButtonEvent,
94
99
  CustomCTAClickCallback,
95
100
  CustomCTAClickEvent,
96
101
  FeedItemDetails,
102
+ FireworkSDK,
97
103
  FWError,
98
104
  FWNavigator,
99
105
  IOSFontInfo,
100
106
  IOSSystemFontStyle,
101
107
  IOSSystemFontWeight,
108
+ IStoryBlockProps,
102
109
  IVideoFeedProps,
103
110
  LinkButtonConfiguration,
104
111
  LiveStream,
@@ -117,6 +124,7 @@ export {
117
124
  ProductUnitOption,
118
125
  SDKInitCallback,
119
126
  SDKInitEvent,
127
+ SDKInitOptions,
120
128
  StoryBlock,
121
129
  StoryBlockSource,
122
130
  TrackPurchaseParameters,
@@ -125,6 +133,7 @@ export {
125
133
  VastAttribute,
126
134
  VideoFeed,
127
135
  VideoFeedClickCallback,
136
+ VideoFeedClickEvent,
128
137
  VideoFeedConfiguration,
129
138
  VideoFeedContentPadding,
130
139
  VideoFeedMode,
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Only supported on Android.
3
+ */
4
+ export default interface AndroidFontInfo {
5
+ /**
6
+ * Whether to use a custom font. Default is false.
7
+ */
8
+ isCustom?: boolean;
9
+ /**
10
+ * The Android system typeface name, such as "DEFAULT", "DEFAULT_BOLD", "SANS_SERIF", "SERIF", "MONOSPACE".
11
+ * Or custom font name, such as: "fonts/kaushanscript_regular.ttf". (You need to set the isCustom=true and put the font file in the "assets" directory: app/src/main/assets/fonts/kaushanscript_regular.ttf)
12
+ */
13
+ typefaceName?: string;
14
+ }
@@ -9,6 +9,7 @@ export enum FWEventName {
9
9
  LiveStream = 'fw:livestream',
10
10
  LiveStreamChat = 'fw:livestream-chat',
11
11
  ShareBaseURLUpdated = 'fw:share-base-url-updated',
12
+ VideoLaunchBehaviorUpdated = 'fw:video-launch-behavior-updated',
12
13
  AdBadgeConfigurationUpdated = 'fw:ad-badge-configuration-updated',
13
14
  LogMessage = 'fw:log-message',
14
15
  CustomLinkButtonClick = 'fw:shopping:custom-link-button-click',
@@ -0,0 +1,7 @@
1
+ export type VideoLaunchBehavior = 'default' | 'muteOnFirstLaunch';
2
+
3
+ export default interface SDKInitOptions {
4
+ userId?: string;
5
+ shareBaseURL?: string;
6
+ videoLaunchBehavior?: VideoLaunchBehavior;
7
+ }
@@ -1,4 +1,5 @@
1
1
  import type IOSFontInfo from './IOSFontInfo';
2
+ import type AndroidFontInfo from './AndroidFontInfo';
2
3
 
3
4
  export interface VideoFeedTitleConfiguration {
4
5
  /**
@@ -14,11 +15,17 @@ export interface VideoFeedTitleConfiguration {
14
15
  */
15
16
  fontSize?: number;
16
17
  /**
17
- * The iOS font info of "Add to cart" button.
18
+ * The iOS font info of video feed title.
18
19
  * The property is ignored when fontSize is not set.
19
20
  * Only supported on iOS.
20
21
  */
21
22
  iOSFontInfo?: IOSFontInfo;
23
+ /**
24
+ * The Android font info of "VideoFeedTitle".
25
+ * The property is ignored when fontSize is not set.
26
+ * Only supported on Android.
27
+ */
28
+ androidFontInfo?: AndroidFontInfo;
22
29
  }
23
30
 
24
31
  export interface VideoFeedPlayIconConfiguration {
@@ -60,10 +67,6 @@ export default interface VideoFeedConfiguration {
60
67
  * Indicates if the video feed item shows ad badge.
61
68
  */
62
69
  showAdBadge?: boolean;
63
- /**
64
- * Custom layout name for video feed item. Only supported on Android. Deprecate
65
- */
66
- customLayoutName?: string;
67
70
  /**
68
71
  * The aspect ratio(width / height) for video feed item. Only supported on iOS.
69
72
  */
@@ -86,10 +89,4 @@ export default interface VideoFeedConfiguration {
86
89
  * The property value needs to be an integer and greater than 0.
87
90
  */
88
91
  gridColumns?: number;
89
- /**
90
- * Please use the enablePictureInPicture in IVideoFeedProps. Deprecate
91
- *
92
- * @deprecated The property will be deprecated since RN SDK V2.
93
- */
94
- enablePictureInPicture?: boolean;
95
92
  }
@@ -16,7 +16,7 @@ export interface VideoPlayerCTAStyle {
16
16
  */
17
17
  fontSize?: number;
18
18
  /**
19
- * The iOS font info of "Add to cart" button.
19
+ * The iOS font info of CTA button.
20
20
  * The property is ignored when fontSize is not set.
21
21
  * Only supported on iOS.
22
22
  */
@@ -35,8 +35,6 @@ export interface VideoPlayerCTADelay {
35
35
  value: number;
36
36
  }
37
37
 
38
- export type VideoLaunchBehavior = 'default' | 'muteOnFirstLaunch';
39
-
40
38
  export default interface VideoPlayerConfiguration {
41
39
  /**
42
40
  * Sets the proportion of the video player to its container.
@@ -62,10 +60,6 @@ export default interface VideoPlayerConfiguration {
62
60
  * Indicates if the video player shows mute button.
63
61
  */
64
62
  showMuteButton?: boolean;
65
- /**
66
- * Specifies the video player launch behavior. Only supported on iOS.
67
- */
68
- launchBehavior?: VideoLaunchBehavior;
69
63
  /**
70
64
  * Indicates if Firework branding should be showed or not.
71
65
  */
@@ -1,10 +1,10 @@
1
- import { NativeEventEmitter, NativeModule } from 'react-native';
2
- import { NativeModules } from 'react-native';
3
- import type AdBadgeConfiguration from '../models/AdBadgeConfiguration';
1
+ import { NativeEventEmitter, NativeModule, NativeModules } from 'react-native';
4
2
 
5
3
  import { LINKING_ERROR } from '../constants/FWErrorMessage';
6
- import type VideoPlayerConfiguration from '../models/VideoPlayerConfiguration';
4
+ import type AdBadgeConfiguration from '../models/AdBadgeConfiguration';
5
+ import type SDKInitOptions from '../models/SDKInitOptions';
7
6
  import type TrackPurchaseParameters from '../models/TrackPurchaseParameters';
7
+ import type VideoPlayerConfiguration from '../models/VideoPlayerConfiguration';
8
8
 
9
9
  const FireworkSDKModule = NativeModules.FireworkSDK
10
10
  ? NativeModules.FireworkSDK
@@ -18,7 +18,7 @@ const FireworkSDKModule = NativeModules.FireworkSDK
18
18
  );
19
19
 
20
20
  interface IFireworkSDKModule extends NativeModule {
21
- init(userId?: string): void;
21
+ init(options?: SDKInitOptions): Promise<any>;
22
22
  openVideoPlayer(url: string, config?: VideoPlayerConfiguration): void;
23
23
  setCustomCTAClickEnabled(enabled: boolean): void;
24
24
  setShareBaseURL(url?: string): Promise<any>;
@@ -26,7 +26,7 @@ interface IFireworkSDKModule extends NativeModule {
26
26
  setAdBadgeConfiguration(config?: AdBadgeConfiguration): Promise<any>;
27
27
  trackPurchase(parameters: TrackPurchaseParameters): void;
28
28
  changeAppLanguage(language: string): Promise<boolean>;
29
- restart(): Promise<void>;
29
+ restart(): Promise<any>;
30
30
  }
31
31
 
32
32
  const FireworkSDKModuleEventEmitter = new NativeEventEmitter(FireworkSDKModule);