react-native-firework-sdk 2.3.1 → 2.4.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (119) hide show
  1. package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/FireworkVideoUI +0 -0
  2. package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Info.plist +0 -0
  3. package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios.abi.json +24 -10
  4. package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios.private.swiftinterface +1 -1
  5. package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
  6. package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios.swiftinterface +1 -1
  7. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/FireworkVideoUI +0 -0
  8. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Info.plist +0 -0
  9. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios-simulator.abi.json +24 -10
  10. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +1 -1
  11. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
  12. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios-simulator.swiftinterface +1 -1
  13. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/x86_64-apple-ios-simulator.abi.json +24 -10
  14. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +1 -1
  15. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
  16. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +1 -1
  17. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/_CodeSignature/CodeResources +21 -21
  18. package/android/gradle.properties +1 -1
  19. package/android/src/main/java/com/fireworksdk/bridge/components/storyblock/StoryBlockFragment.kt +20 -0
  20. package/android/src/main/java/com/fireworksdk/bridge/components/videofeed/FWVideoFeed.kt +1 -69
  21. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoFeedPropsModel.kt +3 -1
  22. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoFeedPropsModelDeserializer.kt +21 -4
  23. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoFeedPropsModelSerializer.kt +15 -3
  24. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoPlayerConfigModel.kt +2 -1
  25. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoPlayerConfigModelDeserializer.kt +3 -0
  26. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoPlayerConfigModelSerializer.kt +2 -0
  27. package/android/src/main/java/com/fireworksdk/bridge/models/enums/FWVideoFeedSource.kt +3 -1
  28. package/android/src/main/java/com/fireworksdk/bridge/reactnative/FWReactNativeSDK.kt +6 -0
  29. package/android/src/main/java/com/fireworksdk/bridge/reactnative/manager/FWStoryBlockManager.kt +20 -15
  30. package/android/src/main/java/com/fireworksdk/bridge/reactnative/manager/FWVideoFeedManager.kt +45 -16
  31. package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FireworkSDKModule.kt +5 -0
  32. package/android/src/main/java/com/fireworksdk/bridge/utils/FWConfigUtil.kt +11 -1
  33. package/android/src/main/java/com/fireworksdk/bridge/utils/FWImageLoaderUtil.kt +16 -0
  34. package/ios/Components/StoryBlock.swift +9 -7
  35. package/ios/Components/StoryBlockConfiguration.swift +13 -0
  36. package/ios/Components/StoryBlockManager.m +6 -1
  37. package/ios/Components/VideoFeed.swift +5 -10
  38. package/ios/Components/VideoFeedManager.m +1 -2
  39. package/ios/Components/VideoPlayerConfiguration.swift +1 -0
  40. package/ios/FireworkSdk.xcodeproj/project.pbxproj +4 -26
  41. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/AppLanguageManager.swift +13 -2
  42. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/UIKit/UIImageView+AppLanguage.swift +0 -34
  43. package/ios/FireworkVideoUI/Podfile +1 -1
  44. package/ios/FireworkVideoUI/Podfile.lock +4 -4
  45. package/ios/Models/RNToNative/RCTConvert+FireworkSDKModule.swift +1 -0
  46. package/ios/Models/RNToNative/RCTConvert+StoryBlock.swift +16 -1
  47. package/ios/Models/RNToNative/RCTConvert+VideoFeed.swift +2 -1
  48. package/ios/Modules/FireworkSDKModule/FireworkSDKModule.swift +8 -4
  49. package/ios/Modules/Shopping/ShoppingModule.swift +6 -5
  50. package/ios/react_native_firework_sdk.h +0 -1
  51. package/lib/commonjs/FireworkSDK.js.map +1 -1
  52. package/lib/commonjs/components/StoryBlock.js +71 -33
  53. package/lib/commonjs/components/StoryBlock.js.map +1 -1
  54. package/lib/commonjs/components/VideoFeed.js +83 -57
  55. package/lib/commonjs/components/VideoFeed.js.map +1 -1
  56. package/lib/commonjs/index.js.map +1 -1
  57. package/lib/commonjs/models/OpenVideoPlayerConfiguration.js +2 -0
  58. package/lib/commonjs/models/OpenVideoPlayerConfiguration.js.map +1 -0
  59. package/lib/commonjs/models/StoryBlockNativeConfiguration.js +2 -0
  60. package/lib/commonjs/models/StoryBlockNativeConfiguration.js.map +1 -0
  61. package/lib/commonjs/models/VideoPlayerNativeConfiguration.js +2 -0
  62. package/lib/commonjs/models/VideoPlayerNativeConfiguration.js.map +1 -0
  63. package/lib/commonjs/modules/FireworkSDKModule.js.map +1 -1
  64. package/lib/module/FireworkSDK.js.map +1 -1
  65. package/lib/module/components/StoryBlock.js +67 -33
  66. package/lib/module/components/StoryBlock.js.map +1 -1
  67. package/lib/module/components/VideoFeed.js +79 -57
  68. package/lib/module/components/VideoFeed.js.map +1 -1
  69. package/lib/module/index.js.map +1 -1
  70. package/lib/module/models/OpenVideoPlayerConfiguration.js +2 -0
  71. package/lib/module/models/OpenVideoPlayerConfiguration.js.map +1 -0
  72. package/lib/module/models/StoryBlockNativeConfiguration.js +2 -0
  73. package/lib/module/models/StoryBlockNativeConfiguration.js.map +1 -0
  74. package/lib/module/models/VideoPlayerNativeConfiguration.js +2 -0
  75. package/lib/module/models/VideoPlayerNativeConfiguration.js.map +1 -0
  76. package/lib/module/modules/FireworkSDKModule.js.map +1 -1
  77. package/lib/typescript/FireworkSDK.d.ts +2 -2
  78. package/lib/typescript/components/StoryBlock.d.ts +8 -0
  79. package/lib/typescript/components/VideoFeed.d.ts +8 -1
  80. package/lib/typescript/index.d.ts +2 -1
  81. package/lib/typescript/models/AdBadgeConfiguration.d.ts +3 -0
  82. package/lib/typescript/models/AndroidFontInfo.d.ts +1 -1
  83. package/lib/typescript/models/OpenVideoPlayerConfiguration.d.ts +7 -0
  84. package/lib/typescript/models/Product.d.ts +1 -1
  85. package/lib/typescript/models/ProductUnit.d.ts +1 -1
  86. package/lib/typescript/models/StoryBlockConfiguration.d.ts +1 -1
  87. package/lib/typescript/models/StoryBlockNativeConfiguration.d.ts +7 -0
  88. package/lib/typescript/models/StoryBlockSource.d.ts +1 -1
  89. package/lib/typescript/models/VideoFeedConfiguration.d.ts +29 -4
  90. package/lib/typescript/models/VideoFeedSource.d.ts +1 -1
  91. package/lib/typescript/models/VideoPlayerCTAStyle.d.ts +6 -0
  92. package/lib/typescript/models/VideoPlayerConfiguration.d.ts +10 -1
  93. package/lib/typescript/models/VideoPlayerNativeConfiguration.d.ts +7 -0
  94. package/lib/typescript/modules/FireworkSDKModule.d.ts +2 -2
  95. package/package.json +2 -2
  96. package/react-native-firework-sdk.podspec +1 -1
  97. package/src/FireworkSDK.ts +2 -2
  98. package/src/components/StoryBlock.tsx +65 -36
  99. package/src/components/VideoFeed.tsx +87 -74
  100. package/src/index.ts +2 -0
  101. package/src/models/AdBadgeConfiguration.ts +3 -0
  102. package/src/models/AndroidFontInfo.ts +1 -1
  103. package/src/models/OpenVideoPlayerConfiguration.ts +9 -0
  104. package/src/models/Product.ts +1 -1
  105. package/src/models/ProductUnit.ts +1 -1
  106. package/src/models/StoryBlockConfiguration.ts +1 -1
  107. package/src/models/StoryBlockNativeConfiguration.ts +9 -0
  108. package/src/models/StoryBlockSource.ts +2 -1
  109. package/src/models/VideoFeedConfiguration.ts +29 -4
  110. package/src/models/VideoFeedSource.ts +2 -1
  111. package/src/models/VideoPlayerCTAStyle.ts +6 -0
  112. package/src/models/VideoPlayerConfiguration.ts +10 -1
  113. package/src/models/VideoPlayerNativeConfiguration.ts +9 -0
  114. package/src/modules/FireworkSDKModule.ts +2 -2
  115. package/ios/Modules/Shopping/FWCartViewController.swift +0 -14
  116. package/ios/Utils/Extensions/Swizzle/UINavigationController+FWSwizzle.swift +0 -31
  117. package/ios/Utils/FWSwizzleLoader.h +0 -15
  118. package/ios/Utils/FWSwizzleLoader.m +0 -21
  119. package/ios/Utils/FWSwizzleLoader.swift +0 -13
@@ -21,6 +21,7 @@ import { FireworkSDKModuleEventEmitter } from '../modules/FireworkSDKModule';
21
21
  import FWGlobalState from '../utils/FWGlobalState';
22
22
  import FWLoggerUtil from '../utils/FWLoggerUtil';
23
23
  import FWVideoFeed from './FWVideoFeed';
24
+ import type VideoPlayerNativeConfiguration from '../models/VideoPlayerNativeConfiguration';
24
25
 
25
26
  export type VideoFeedMode = 'row' | 'column' | 'grid';
26
27
 
@@ -33,7 +34,8 @@ export interface IVideoFeedProps {
33
34
  */
34
35
  style?: StyleProp<ViewStyle>;
35
36
  /**
36
- * One of five available video feed sources.The playlistGroup is only supported on iOS
37
+ * One of five available video feed sources.The playlistGroup is only supported on iOS.
38
+ * Defaults to discover.
37
39
  */
38
40
  source: VideoFeedSource;
39
41
  /**
@@ -57,8 +59,13 @@ export interface IVideoFeedProps {
57
59
  * Queries are specified with boolean predicates on what hashtags are there on the video.
58
60
  * For instance, (and sport food) (or sport food) (and sport (or food comedy)) sport are all valid expressions.
59
61
  * Non-UTF-8 characters are not allowed. If using boolean predicates, the expression needs to be wrapped with parenthesis.
62
+ * Required when the source is set as hashtagPlaylist.
60
63
  */
61
64
  hashtagFilterExpression?: string;
65
+ /**
66
+ * Product ids used to generate the sku feed
67
+ */
68
+ productIds?: string[];
62
69
  /**
63
70
  * One of three available display modes. Defaults to row.
64
71
  */
@@ -238,80 +245,68 @@ class VideoFeed extends React.Component<IVideoFeedProps, IVideoFeedState> {
238
245
  return null;
239
246
  }
240
247
 
241
- const gShareBaseURL = FireworkSDK.getInstance().shareBaseURL ?? '';
242
- const appLanguage = FireworkSDK.getInstance().appLanguage ?? '';
243
- const videoLaunchBehavior =
244
- FireworkSDK.getInstance().videoLaunchBehavior ?? '';
245
- const adBadgeConfiguration =
246
- FireworkSDK.getInstance().adBadgeConfiguration ?? {};
247
- const adBadgeTextType = adBadgeConfiguration.badgeTextType ?? '';
248
- const backgroundColorOfAdBadge = adBadgeConfiguration.backgroundColor ?? '';
249
- const textColorOfAdBadge = adBadgeConfiguration.textColor ?? '';
248
+ const gShareBaseURL = FireworkSDK.getInstance().shareBaseURL;
249
+ const appLanguage = FireworkSDK.getInstance().appLanguage;
250
+ const videoLaunchBehavior = FireworkSDK.getInstance().videoLaunchBehavior;
251
+ const adBadgeConfiguration = FireworkSDK.getInstance().adBadgeConfiguration;
252
+ const adBadgeTextType = adBadgeConfiguration?.badgeTextType;
253
+ const backgroundColorOfAdBadge = adBadgeConfiguration?.backgroundColor;
254
+ const textColorOfAdBadge = adBadgeConfiguration?.textColor;
250
255
  const androidFontIsCustomOfAdBadge =
251
- adBadgeConfiguration.androidFontInfo?.isCustom?.toString() ?? '';
256
+ adBadgeConfiguration?.androidFontInfo?.isCustom?.toString();
252
257
  const androidFontTypefaceNameOfAdBadge =
253
- adBadgeConfiguration.androidFontInfo?.typefaceName ?? '';
258
+ adBadgeConfiguration?.androidFontInfo?.typefaceName;
254
259
 
255
260
  const {
256
261
  source,
257
- channel = '',
258
- playlist = '',
259
- playlistGroup = '',
260
- hashtagFilterExpression = '',
261
- mode = 'row',
262
- enablePictureInPicture = false,
262
+ channel,
263
+ playlist,
264
+ playlistGroup,
265
+ hashtagFilterExpression,
266
+ productIds,
267
+ mode,
268
+ enablePictureInPicture,
263
269
  adConfiguration,
264
- videoPlayerConfiguration,
265
270
  } = this.props;
266
271
  const dynamicContentParametersString =
267
272
  this._generateDynamicContentParametersString();
268
273
 
269
274
  const videoFeedConfiguration = this._getVideoFeedConfiguration();
270
- const cornerRadius = videoFeedConfiguration?.cornerRadius?.toFixed(5) ?? '';
275
+ const cornerRadius = videoFeedConfiguration?.cornerRadius?.toFixed(5);
271
276
 
272
- const titleHidden = videoFeedConfiguration?.title?.hidden?.toString() ?? '';
273
- const titleTextColor = videoFeedConfiguration?.title?.textColor ?? '';
274
- const titleFontSize =
275
- videoFeedConfiguration?.title?.fontSize?.toFixed(5) ?? '';
277
+ const titleHidden = videoFeedConfiguration?.title?.hidden?.toString();
278
+ const titleTextColor = videoFeedConfiguration?.title?.textColor;
279
+ const titleFontSize = videoFeedConfiguration?.title?.fontSize?.toFixed(5);
276
280
  const titleAndroidFontInfo = videoFeedConfiguration?.title?.androidFontInfo;
277
281
  const titleGradientDrawable =
278
282
  videoFeedConfiguration?.title?.gradientDrawable;
279
- const titlePosition = videoFeedConfiguration?.titlePosition ?? '';
280
- const playIconHidden =
281
- videoFeedConfiguration?.playIcon?.hidden?.toString() ?? '';
283
+ const titlePosition = videoFeedConfiguration?.titlePosition;
284
+ const playIconHidden = videoFeedConfiguration?.playIcon?.hidden;
282
285
  const playIconWidth =
283
- videoFeedConfiguration?.playIcon?.iconWidth?.toFixed(5) ?? '';
284
- const showAdBadge = videoFeedConfiguration?.showAdBadge?.toString() ?? '';
285
- const enableAutoplay =
286
- videoFeedConfiguration?.enableAutoplay?.toString() ?? '';
287
- const gridColumns = videoFeedConfiguration?.gridColumns?.toFixed(5) ?? '';
288
- const itemSpacing = videoFeedConfiguration?.itemSpacing?.toFixed(5) ?? '';
289
-
290
- const playerStyle = videoPlayerConfiguration?.playerStyle ?? '';
291
- const videoCompleteAction =
292
- videoPlayerConfiguration?.videoCompleteAction ?? '';
293
- const showShareButton =
294
- videoPlayerConfiguration?.showShareButton?.toString() ?? '';
295
- const showPlaybackButton =
296
- videoPlayerConfiguration?.showPlaybackButton?.toString() ?? '';
297
- const showMuteButton =
298
- videoPlayerConfiguration?.showMuteButton?.toString() ?? '';
299
- const showBranding =
300
- videoPlayerConfiguration?.showBranding?.toString() ?? '';
301
- const ctaDelayType = videoPlayerConfiguration?.ctaDelay?.type ?? '';
302
- const ctaDelayValue = (
303
- videoPlayerConfiguration?.ctaDelay?.value ?? 0
304
- ).toFixed(5);
286
+ videoFeedConfiguration?.playIcon?.iconWidth?.toFixed(5);
287
+ const showAdBadge = videoFeedConfiguration?.showAdBadge?.toString();
288
+ const enableAutoplay = videoFeedConfiguration?.enableAutoplay;
289
+ const gridColumns = videoFeedConfiguration?.gridColumns?.toFixed(5);
290
+ const itemSpacing = videoFeedConfiguration?.itemSpacing?.toFixed(5);
291
+
292
+ const videoPlayerConfiguration = this._getVideoPlayerConfiguration();
293
+ const playerStyle = videoPlayerConfiguration?.playerStyle;
294
+ const videoCompleteAction = videoPlayerConfiguration?.videoCompleteAction;
295
+ const showShareButton = videoPlayerConfiguration?.showShareButton;
296
+ const showPlaybackButton = videoPlayerConfiguration?.showPlaybackButton;
297
+ const showMuteButton = videoPlayerConfiguration?.showMuteButton;
298
+ const showBranding = videoPlayerConfiguration?.showBranding;
299
+ const ctaDelayType = videoPlayerConfiguration?.ctaDelay?.type;
300
+ const ctaDelayValue = videoPlayerConfiguration?.ctaDelay?.value?.toFixed(5);
305
301
  const ctaHighlightDelayType =
306
- videoPlayerConfiguration?.ctaHighlightDelay?.type ?? '';
307
- const ctaHighlightDelayValue = (
308
- videoPlayerConfiguration?.ctaHighlightDelay?.value ?? 0
309
- ).toFixed(5);
310
- const shareBaseURL = videoPlayerConfiguration?.shareBaseURL ?? '';
311
- const ctaWidth = videoPlayerConfiguration?.ctaWidth ?? '';
312
-
313
- const requiresAds = adConfiguration?.requiresAds?.toString() ?? '';
314
- const adsFetchTimeout = adConfiguration?.adsFetchTimeout ?? 10;
302
+ videoPlayerConfiguration?.ctaHighlightDelay?.type;
303
+ const ctaHighlightDelayValue =
304
+ videoPlayerConfiguration?.ctaHighlightDelay?.value?.toFixed(5);
305
+ const shareBaseURL = videoPlayerConfiguration?.shareBaseURL;
306
+ const ctaWidth = videoPlayerConfiguration?.ctaWidth;
307
+
308
+ const requiresAds = adConfiguration?.requiresAds;
309
+ const adsFetchTimeout = adConfiguration?.adsFetchTimeout;
315
310
  const vastAttributesString = this._generateVastAttributesString();
316
311
 
317
312
  let key = `gShareBaseURL:${gShareBaseURL}`;
@@ -333,6 +328,7 @@ class VideoFeed extends React.Component<IVideoFeedProps, IVideoFeedState> {
333
328
  key += `_playlistGroup:${playlistGroup}`;
334
329
  key += `_dynamicContentParameters:${dynamicContentParametersString}`;
335
330
  key += `_hashtagFilterExpression:${hashtagFilterExpression}`;
331
+ key += `_productIds:${productIds?.join(',')}`;
336
332
  key += `_mode:${mode}`;
337
333
  key += `_enablePictureInPicture:${enablePictureInPicture}`;
338
334
 
@@ -341,18 +337,12 @@ class VideoFeed extends React.Component<IVideoFeedProps, IVideoFeedState> {
341
337
  key += `_cornerRadius:${cornerRadius}`;
342
338
  key += `_titleTextColor:${titleTextColor}`;
343
339
  key += `_titleFontSize:${titleFontSize}`;
344
- key += `_titleAndroidFontInfo.isCustom:${
345
- titleAndroidFontInfo?.isCustom?.toString() ?? ''
346
- }`;
347
- key += `_titleAndroidFontInfo.typefaceName:${
348
- titleAndroidFontInfo?.typefaceName ?? ''
349
- }`;
350
- key += `_titleGradientDrawable.orientation:${
351
- titleGradientDrawable?.orientation ?? ''
352
- }`;
353
- key += `_titleGradientDrawable.colors:${(
354
- titleGradientDrawable?.colors ?? []
355
- ).join(',')}`;
340
+ key += `_titleAndroidFontInfo.isCustom:${titleAndroidFontInfo?.isCustom}`;
341
+ key += `_titleAndroidFontInfo.typefaceName:${titleAndroidFontInfo?.typefaceName}`;
342
+ key += `_titleGradientDrawable.orientation:${titleGradientDrawable?.orientation}`;
343
+ key += `_titleGradientDrawable.colors:${titleGradientDrawable?.colors?.join(
344
+ ','
345
+ )}`;
356
346
  key += `_playIconHidden:${playIconHidden}`;
357
347
  key += `_playIconWidth:${playIconWidth}`;
358
348
  key += `_showAdBadge:${showAdBadge}`;
@@ -386,10 +376,12 @@ class VideoFeed extends React.Component<IVideoFeedProps, IVideoFeedState> {
386
376
  <FWVideoFeed
387
377
  key={key}
388
378
  {...this.props}
379
+ enablePictureInPicture={undefined}
389
380
  videoFeedConfiguration={videoFeedConfiguration}
381
+ videoPlayerConfiguration={videoPlayerConfiguration}
390
382
  ref={this._nativeComponentRef}
391
383
  onVideoFeedLoadFinished={this._onVideoFeedLoadFinished}
392
- mode={mode}
384
+ mode={mode ?? 'row'}
393
385
  />
394
386
  );
395
387
  }
@@ -415,9 +407,9 @@ class VideoFeed extends React.Component<IVideoFeedProps, IVideoFeedState> {
415
407
  return resultString;
416
408
  }
417
409
 
418
- private _generateVastAttributesString(): string {
410
+ private _generateVastAttributesString(): string | undefined {
419
411
  const { adConfiguration } = this.props;
420
- const vastAttributes = adConfiguration?.vastAttributes ?? '';
412
+ const vastAttributes = adConfiguration?.vastAttributes;
421
413
  if (!vastAttributes) {
422
414
  return '';
423
415
  }
@@ -427,7 +419,7 @@ class VideoFeed extends React.Component<IVideoFeedProps, IVideoFeedState> {
427
419
  if (resultString.length > 0) {
428
420
  resultString += '_';
429
421
  }
430
- resultString += `${attribute.name ?? ''}:${attribute.value}`;
422
+ resultString += `${attribute.name}:${attribute.value}`;
431
423
  }
432
424
 
433
425
  return resultString;
@@ -473,6 +465,27 @@ class VideoFeed extends React.Component<IVideoFeedProps, IVideoFeedState> {
473
465
 
474
466
  return resultVideoFeedConfiguration;
475
467
  }
468
+
469
+ private _getVideoPlayerConfiguration():
470
+ | VideoPlayerNativeConfiguration
471
+ | undefined {
472
+ const { videoPlayerConfiguration, enablePictureInPicture } = this.props;
473
+
474
+ let resultVideoPlayerConfiguration:
475
+ | VideoPlayerNativeConfiguration
476
+ | undefined = videoPlayerConfiguration;
477
+ if (typeof enablePictureInPicture === 'boolean') {
478
+ if (!resultVideoPlayerConfiguration) {
479
+ resultVideoPlayerConfiguration = {};
480
+ }
481
+ resultVideoPlayerConfiguration = {
482
+ ...resultVideoPlayerConfiguration,
483
+ enablePictureInPicture,
484
+ };
485
+ }
486
+
487
+ return resultVideoPlayerConfiguration;
488
+ }
476
489
  }
477
490
 
478
491
  export default VideoFeed;
package/src/index.ts CHANGED
@@ -47,6 +47,7 @@ import LiveStreamChatEventName from './models/LiveStreamChatEventName';
47
47
  import type LiveStreamEventDetails from './models/LiveStreamEventDetails';
48
48
  import LiveStreamEventName from './models/LiveStreamEventName';
49
49
  import type LiveStreamMessageDetails from './models/LiveStreamMessageDetails';
50
+ import type OpenVideoPlayerConfiguration from './models/OpenVideoPlayerConfiguration';
50
51
  import type Product from './models/Product';
51
52
  import type ProductInfoViewConfiguration from './models/ProductInfoViewConfiguration';
52
53
  import type {
@@ -124,6 +125,7 @@ export {
124
125
  LiveStreamMessageDetails,
125
126
  onLiveStreamChatEventCallback,
126
127
  onLiveStreamEventCallback,
128
+ OpenVideoPlayerConfiguration,
127
129
  Product,
128
130
  ProductInfoViewConfiguration,
129
131
  ProductPrice,
@@ -5,14 +5,17 @@ export type AdBadgeTextType = 'ad' | 'sponsored';
5
5
  export default interface AdBadgeConfiguration {
6
6
  /**
7
7
  * The text type of the ad badge.
8
+ * Defaults to sponsored.
8
9
  */
9
10
  badgeTextType?: AdBadgeTextType;
10
11
  /**
11
12
  * The background color of the ad badge.
13
+ * Defaults to #000000 on iOS. Defaults to #5178EE with alpha is 96.5% on Android.
12
14
  */
13
15
  backgroundColor?: string;
14
16
  /**
15
17
  * The color of the ad badge text.
18
+ * Defaults to #ffffff.
16
19
  */
17
20
  textColor?: string;
18
21
  /**
@@ -3,7 +3,7 @@
3
3
  */
4
4
  export default interface AndroidFontInfo {
5
5
  /**
6
- * Whether to use a custom font. Default is false.
6
+ * Whether to use a custom font. Defaults to false.
7
7
  */
8
8
  isCustom?: boolean;
9
9
  /**
@@ -0,0 +1,9 @@
1
+ import type VideoPlayerConfiguration from './VideoPlayerConfiguration';
2
+
3
+ export default interface OpenVideoPlayerConfiguration
4
+ extends VideoPlayerConfiguration {
5
+ /**
6
+ * Specifies if Picture in Picture is enabled.
7
+ */
8
+ enablePictureInPicture?: boolean;
9
+ }
@@ -14,7 +14,7 @@ export default interface Product {
14
14
  */
15
15
  description?: string | null;
16
16
  /**
17
- * The availability of the product. Only supported on iOS.
17
+ * The availability of the product.
18
18
  */
19
19
  isAvailable?: boolean;
20
20
  /**
@@ -30,7 +30,7 @@ export default interface ProductUnit {
30
30
  */
31
31
  price?: ProductPrice;
32
32
  /**
33
- * The availability of the product unit. Only supported on iOS.
33
+ * The availability of the product unit.
34
34
  */
35
35
  isAvailable?: boolean;
36
36
  /**
@@ -24,7 +24,7 @@ export interface StoryBlockConfiguration {
24
24
  */
25
25
  ctaDelay?: VideoPlayerCTADelay;
26
26
  /**
27
- * Specifies the delay before the highlight animation occurs. Only supported on iOS.
27
+ * Specifies the delay before the highlight animation occurs.
28
28
  */
29
29
  ctaHighlightDelay?: VideoPlayerCTADelay;
30
30
  /**
@@ -0,0 +1,9 @@
1
+ import type { StoryBlockConfiguration } from './StoryBlockConfiguration';
2
+
3
+ export default interface StoryBlockNativeConfiguration
4
+ extends StoryBlockConfiguration {
5
+ /**
6
+ * Specifies if Picture in Picture is enabled.
7
+ */
8
+ enablePictureInPicture?: boolean;
9
+ }
@@ -3,4 +3,5 @@ export type StoryBlockSource =
3
3
  | 'channel'
4
4
  | 'playlist'
5
5
  | 'dynamicContent'
6
- | 'hashtagPlaylist';
6
+ | 'hashtagPlaylist'
7
+ | 'sku';
@@ -5,19 +5,23 @@ import type GradientDrawable from './GradientDrawable';
5
5
  export interface VideoFeedTitleConfiguration {
6
6
  /**
7
7
  * Specifies if the video feed title is hidden.
8
+ * Defaults to false.
8
9
  */
9
10
  hidden?: boolean;
10
11
  /**
11
12
  * The text color of video feed title.
13
+ * If you don't set this property, the text color will be white with alpha is 0.98 on iOS and #ffffff on Android.
12
14
  */
13
15
  textColor?: string;
14
16
  /**
15
17
  * The font size of video feed title.
18
+ * If you don't set this property, the font size will be 12 on iOS and 14sp on Android.
16
19
  */
17
20
  fontSize?: number;
18
21
  /**
19
22
  * Specifies the number of allowed lines for the label.
20
23
  * Only supported on iOS.
24
+ * Defaults to 2.
21
25
  */
22
26
  numberOfLines?: number;
23
27
  /**
@@ -46,7 +50,15 @@ export interface VideoFeedTitleConfiguration {
46
50
  }
47
51
 
48
52
  export interface VideoFeedPlayIconConfiguration {
53
+ /**
54
+ * Specifies if the play icon is hidden.
55
+ * Defaults to false.
56
+ */
49
57
  hidden?: boolean;
58
+ /**
59
+ * The width of play icon.
60
+ * If you don't set this property, the icon width will be 40 on iOS and 36dp on Android.
61
+ */
50
62
  iconWidth?: number;
51
63
  }
52
64
 
@@ -61,11 +73,13 @@ export interface VideoFeedPadding {
61
73
 
62
74
  export default interface VideoFeedConfiguration {
63
75
  /**
64
- * Background color of video feed.
76
+ * Background color of video feed, such as #c0c0c0.
77
+ * If you don't set this property, the background will be transparent.
65
78
  */
66
79
  backgroundColor?: string;
67
80
  /**
68
81
  * Corner radius of video feed item.
82
+ * Defaults to 10 on iOS. Defaults to 0 on Android.
69
83
  */
70
84
  cornerRadius?: number;
71
85
  /**
@@ -74,10 +88,13 @@ export default interface VideoFeedConfiguration {
74
88
  title?: VideoFeedTitleConfiguration;
75
89
  /**
76
90
  * Title position of video feed item.
91
+ * Defaults to nested.
77
92
  */
78
93
  titlePosition?: VideoFeedTitlePosition;
79
94
  /**
80
- * The padding of video feed title. Only supported on iOS.
95
+ * The padding of video feed title.
96
+ * Defaults to { top: 8, right: 8, bottom: 8, left: 8 }.
97
+ * Only supported on iOS.
81
98
  */
82
99
  titlePadding?: VideoFeedPadding;
83
100
  /**
@@ -86,28 +103,36 @@ export default interface VideoFeedConfiguration {
86
103
  playIcon?: VideoFeedPlayIconConfiguration;
87
104
  /**
88
105
  * Indicates if the video feed item shows ad badge.
106
+ * Defaults to false.
89
107
  */
90
108
  showAdBadge?: boolean;
91
109
  /**
92
- * The aspect ratio(width / height) for video feed item. Only supported on iOS.
110
+ * The aspect ratio(width / height) for video feed item.
111
+ * Defaults to 4 / 6.
112
+ * Only supported on iOS.
93
113
  */
94
114
  aspectRatio?: number;
95
115
  /**
96
- * The padding of video feed content. Only supported on iOS.
116
+ * The padding of video feed content.
117
+ * Defaults to { top: 10, right: 10, bottom: 10, left: 10 }.
118
+ * Only supported on iOS.
97
119
  */
98
120
  contentPadding?: VideoFeedPadding;
99
121
  /**
100
122
  * The item spacing for video feed.
123
+ * If you don't set this property, the item spacing will be 10 on iOS and 4px on Android.
101
124
  */
102
125
  itemSpacing?: number;
103
126
  /**
104
127
  * Specifies if autoplay is enabled.
128
+ * Defaults to false.
105
129
  */
106
130
  enableAutoplay?: boolean;
107
131
  /**
108
132
  * The number of feed items to be displayed per row.
109
133
  * The property only takes effect when video feed mode is grid.
110
134
  * The property value needs to be an integer and greater than 0.
135
+ * Defaults to 2.
111
136
  */
112
137
  gridColumns?: number;
113
138
  }
@@ -4,4 +4,5 @@ export type VideoFeedSource =
4
4
  | 'playlist'
5
5
  | 'playlistGroup'
6
6
  | 'dynamicContent'
7
- | 'hashtagPlaylist';
7
+ | 'hashtagPlaylist'
8
+ | 'sku';
@@ -1,16 +1,22 @@
1
1
  import type IOSFontInfo from './IOSFontInfo';
2
2
 
3
+ /**
4
+ * Only supported on iOS.
5
+ */
3
6
  export interface VideoPlayerCTAStyle {
4
7
  /**
5
8
  * The background color of CTA button.
9
+ * Defaults to #3A86FF.
6
10
  */
7
11
  backgroundColor?: string;
8
12
  /**
9
13
  * The text color of CTA button.
14
+ * Defaults to #FFFFFF.
10
15
  */
11
16
  textColor?: string;
12
17
  /**
13
18
  * The font size of CTA button.
19
+ * Defaults to 14.
14
20
  */
15
21
  fontSize?: number;
16
22
  /**
@@ -7,14 +7,17 @@ import type { VideoPlayerStyle } from './VideoPlayerStyle';
7
7
  export default interface VideoPlayerConfiguration {
8
8
  /**
9
9
  * Sets the proportion of the video player to its container.
10
+ * Defaults to full.
10
11
  */
11
12
  playerStyle?: VideoPlayerStyle;
12
13
  /**
13
14
  * Behavior occurring after video is complete.
15
+ * Defaults to advanceToNext.
14
16
  */
15
17
  videoCompleteAction?: VideoPlayerCompleteAction;
16
18
  /**
17
19
  * Indicates if the video player shows share button.
20
+ * Defaults to true.
18
21
  */
19
22
  showShareButton?: boolean;
20
23
  /**
@@ -23,22 +26,27 @@ export default interface VideoPlayerConfiguration {
23
26
  ctaButtonStyle?: VideoPlayerCTAStyle;
24
27
  /**
25
28
  * Indicates if the video player shows playback button.
29
+ * Defaults to false on iOS. Default to true on Android.
26
30
  */
27
31
  showPlaybackButton?: boolean;
28
32
  /**
29
33
  * Indicates if the video player shows mute button.
34
+ * Defaults to true.
30
35
  */
31
36
  showMuteButton?: boolean;
32
37
  /**
33
38
  * Indicates if Firework branding should be showed or not.
39
+ * Defaults to true.
34
40
  */
35
41
  showBranding?: boolean;
36
42
  /**
37
43
  * Specifies the delay before showing the CTA.
44
+ * Defaults to { type: constant, value: 3 }.
38
45
  */
39
46
  ctaDelay?: VideoPlayerCTADelay;
40
47
  /**
41
- * Specifies the delay before the highlight animation occurs. Only supported on iOS.
48
+ * Specifies the delay before the highlight animation occurs.
49
+ * Defaults to { type: constant, value: 2 }.
42
50
  */
43
51
  ctaHighlightDelay?: VideoPlayerCTADelay;
44
52
  /**
@@ -47,6 +55,7 @@ export default interface VideoPlayerConfiguration {
47
55
  shareBaseURL?: string;
48
56
  /**
49
57
  * Specifies the desired width for the Video Player CTA button.
58
+ * Defaults to fullWidth.
50
59
  */
51
60
  ctaWidth?: VideoPlayerCTAWidth;
52
61
  }
@@ -0,0 +1,9 @@
1
+ import type VideoPlayerConfiguration from './VideoPlayerConfiguration';
2
+
3
+ export default interface VideoPlayerNativeConfiguration
4
+ extends VideoPlayerConfiguration {
5
+ /**
6
+ * Specifies if Picture in Picture is enabled.
7
+ */
8
+ enablePictureInPicture?: boolean;
9
+ }
@@ -4,7 +4,7 @@ import { LINKING_ERROR } from '../constants/FWErrorMessage';
4
4
  import type AdBadgeConfiguration from '../models/AdBadgeConfiguration';
5
5
  import type SDKInitOptions from '../models/SDKInitOptions';
6
6
  import type TrackPurchaseParameters from '../models/TrackPurchaseParameters';
7
- import type VideoPlayerConfiguration from '../models/VideoPlayerConfiguration';
7
+ import type VideoPlayerNativeConfiguration from '../models/VideoPlayerNativeConfiguration';
8
8
 
9
9
  const FireworkSDKModule = NativeModules.FireworkSDK
10
10
  ? NativeModules.FireworkSDK
@@ -19,7 +19,7 @@ const FireworkSDKModule = NativeModules.FireworkSDK
19
19
 
20
20
  interface IFireworkSDKModule extends NativeModule {
21
21
  init(options?: SDKInitOptions): Promise<any>;
22
- openVideoPlayer(url: string, config?: VideoPlayerConfiguration): void;
22
+ openVideoPlayer(url: string, config?: VideoPlayerNativeConfiguration): void;
23
23
  setCustomCTAClickEnabled(enabled: boolean): void;
24
24
  setShareBaseURL(url?: string): Promise<any>;
25
25
  setVideoPlaybackEventEnabled(enabled: boolean): void;
@@ -1,14 +0,0 @@
1
- //
2
- // FWCartViewController.swift
3
- // react-native-firework-sdk
4
- //
5
- // Created by Jeff Zheng on 2021/12/31.
6
- //
7
-
8
- import FireworkVideo
9
- import UIKit
10
-
11
- @objc(FWCartViewController)
12
- public class FWCartViewController: UIViewController, CartViewRepresentable {
13
-
14
- }
@@ -1,31 +0,0 @@
1
- //
2
- // UINavigationController+FWSwizzle.swift
3
- //
4
- // Created by linjie jiang on 2023/2/8.
5
- //
6
-
7
- import UIKit
8
- #if canImport(FireworkVideoUI)
9
- import FireworkVideoUI
10
- #endif
11
-
12
- extension UINavigationController {
13
- static func swizzleMethodsForNavigationController() {
14
- Swizzle.swizzleSelector(
15
- cls: self,
16
- originalSelector: #selector(UINavigationController.pushViewController(_:animated:)),
17
- customSelector: #selector(UINavigationController.fw_pushViewController(_:animated:))
18
- )
19
- }
20
-
21
- @objc func fw_pushViewController(
22
- _ viewController: UIViewController,
23
- animated: Bool
24
- ) {
25
- if viewController is FWCartViewController {
26
- return
27
- }
28
-
29
- self.fw_pushViewController(viewController, animated: animated)
30
- }
31
- }
@@ -1,15 +0,0 @@
1
- //
2
- // FWSwizzleLoader.h
3
- //
4
- // Created by linjie jiang on 2023/2/8.
5
- //
6
-
7
- #import <UIKit/UIKit.h>
8
-
9
- NS_ASSUME_NONNULL_BEGIN
10
-
11
- @interface FWSwizzleLoader : NSObject
12
-
13
- @end
14
-
15
- NS_ASSUME_NONNULL_END
@@ -1,21 +0,0 @@
1
- //
2
- // FWSwizzleLoader.m
3
- //
4
- // Created by linjie jiang on 2023/2/8.
5
- //
6
-
7
- #import "FWSwizzleLoader.h"
8
-
9
- #if __has_include(<react_native_firework_sdk/react_native_firework_sdk-Swift.h>)
10
- #import <react_native_firework_sdk/react_native_firework_sdk-Swift.h>
11
- #else
12
- #import "react_native_firework_sdk-Swift.h"
13
- #endif
14
-
15
- @implementation FWSwizzleLoader
16
-
17
- + (void)load {
18
- [self swizzelMethods];
19
- }
20
-
21
- @end