react-native-firework-sdk 1.7.0 → 1.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. package/android/src/main/java/com/fireworksdk/bridge/components/videofeed/FWVideoFeed.kt +0 -1
  2. package/android/src/main/java/com/fireworksdk/bridge/models/FWEventName.kt +1 -0
  3. package/android/src/main/java/com/fireworksdk/bridge/reactnative/models/FWVideoShoppingInterface.kt +1 -0
  4. package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FWVideoShoppingModule.kt +11 -1
  5. package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FireworkSDKModule.kt +3 -3
  6. package/android/src/main/java/com/fireworksdk/bridge/reactnative/utils/FWEventUtils.kt +9 -0
  7. package/android/src/main/java/com/fireworksdk/bridge/utils/FWLanguageUtil.kt +20 -2
  8. package/android/src/main/java/com/fireworksdk/bridge/utils/FWVideoPlayerUtils.kt +1 -0
  9. package/ios/Components/StoryBlock.swift +1 -8
  10. package/ios/Components/StoryBlockManager.swift +4 -0
  11. package/ios/Components/VideoFeed.swift +9 -14
  12. package/ios/Components/VideoFeedConfiguration.swift +2 -0
  13. package/ios/Components/VideoFeedManager.m +2 -0
  14. package/ios/Components/VideoFeedManager.swift +4 -0
  15. package/ios/Components/VideoPlayerConfiguration.swift +1 -0
  16. package/ios/FireworkSdk.xcodeproj/project.pbxproj +12 -8
  17. package/ios/Models/Common/FontInfo.swift +57 -0
  18. package/ios/Modules/FWNavigatorModule/FWNavigatorModule.m +2 -0
  19. package/ios/Modules/FWNavigatorModule/FWNavigatorModule.swift +249 -103
  20. package/ios/Modules/FireworkSDKModule/FireworkSDKModule+EventTracking.swift +0 -2
  21. package/ios/Modules/FireworkSDKModule/FireworkSDKModule.swift +12 -12
  22. package/ios/Modules/LiveStream/LiveStreamModule.swift +5 -3
  23. package/ios/Modules/Shopping/ProductInfoViewConfiguration.swift +7 -2
  24. package/ios/Modules/Shopping/ShoppingModule.m +1 -1
  25. package/ios/Modules/Shopping/ShoppingModule.swift +72 -63
  26. package/ios/Utils/FWSwizzleLoader.m +0 -1
  27. package/lib/commonjs/FWNavigator.js +32 -1
  28. package/lib/commonjs/FWNavigator.js.map +1 -1
  29. package/lib/commonjs/FireworkSDK.js +9 -12
  30. package/lib/commonjs/FireworkSDK.js.map +1 -1
  31. package/lib/commonjs/VideoShopping.js +64 -9
  32. package/lib/commonjs/VideoShopping.js.map +1 -1
  33. package/lib/commonjs/components/VideoFeed.js +14 -5
  34. package/lib/commonjs/components/VideoFeed.js.map +1 -1
  35. package/lib/commonjs/index.js.map +1 -1
  36. package/lib/commonjs/models/FWEventName.js +1 -0
  37. package/lib/commonjs/models/FWEventName.js.map +1 -1
  38. package/lib/commonjs/models/IOSFontInfo.js +2 -0
  39. package/lib/commonjs/models/IOSFontInfo.js.map +1 -0
  40. package/lib/commonjs/modules/FWNavigatorModule.js.map +1 -1
  41. package/lib/commonjs/modules/ShoppingModule.js.map +1 -1
  42. package/lib/module/FWNavigator.js +31 -1
  43. package/lib/module/FWNavigator.js.map +1 -1
  44. package/lib/module/FireworkSDK.js +10 -11
  45. package/lib/module/FireworkSDK.js.map +1 -1
  46. package/lib/module/VideoShopping.js +63 -9
  47. package/lib/module/VideoShopping.js.map +1 -1
  48. package/lib/module/components/VideoFeed.js +14 -5
  49. package/lib/module/components/VideoFeed.js.map +1 -1
  50. package/lib/module/index.js.map +1 -1
  51. package/lib/module/models/FWEventName.js +1 -0
  52. package/lib/module/models/FWEventName.js.map +1 -1
  53. package/lib/module/models/IOSFontInfo.js +2 -0
  54. package/lib/module/models/IOSFontInfo.js.map +1 -0
  55. package/lib/module/modules/FWNavigatorModule.js.map +1 -1
  56. package/lib/module/modules/ShoppingModule.js.map +1 -1
  57. package/lib/typescript/FWNavigator.d.ts +16 -1
  58. package/lib/typescript/FireworkSDK.d.ts +2 -0
  59. package/lib/typescript/VideoShopping.d.ts +28 -6
  60. package/lib/typescript/components/VideoFeed.d.ts +4 -0
  61. package/lib/typescript/index.d.ts +6 -4
  62. package/lib/typescript/models/FWEventName.d.ts +2 -1
  63. package/lib/typescript/models/FWEvents.d.ts +5 -0
  64. package/lib/typescript/models/IOSFontInfo.d.ts +19 -0
  65. package/lib/typescript/models/ProductInfoViewConfiguration.d.ts +23 -0
  66. package/lib/typescript/models/VideoFeedConfiguration.d.ts +19 -1
  67. package/lib/typescript/models/VideoPlayerConfiguration.d.ts +16 -0
  68. package/lib/typescript/modules/FWNavigatorModule.d.ts +2 -0
  69. package/lib/typescript/modules/ShoppingModule.d.ts +2 -1
  70. package/package.json +1 -1
  71. package/react-native-firework-sdk.podspec +1 -1
  72. package/src/{FWNavigator.tsx → FWNavigator.ts} +29 -1
  73. package/src/FireworkSDK.ts +10 -10
  74. package/src/VideoShopping.ts +83 -11
  75. package/src/components/VideoFeed.tsx +12 -2
  76. package/src/{index.tsx → index.ts} +17 -1
  77. package/src/models/FWEventName.ts +1 -0
  78. package/src/models/FWEvents.ts +6 -0
  79. package/src/models/IOSFontInfo.ts +29 -0
  80. package/src/models/ProductInfoViewConfiguration.ts +25 -0
  81. package/src/models/VideoFeedConfiguration.ts +20 -1
  82. package/src/models/VideoPlayerConfiguration.ts +17 -0
  83. package/src/modules/FWNavigatorModule.ts +2 -0
  84. package/src/modules/ShoppingModule.ts +2 -4
  85. package/ios/Utils/FWPiPManager.swift +0 -24
  86. package/ios/Utils/UIButton+FWSwizzle.swift +0 -33
@@ -5,6 +5,8 @@ interface IFWNavigatorModule extends NativeModule {
5
5
  }): Promise<boolean>;
6
6
  popNativeContainer(): Promise<boolean>;
7
7
  canPopNativeContainer(): Promise<boolean>;
8
+ startFloatingPlayer(): Promise<boolean>;
9
+ stopFloatingPlayer(): Promise<boolean>;
8
10
  }
9
11
  declare const FWNavigatorModuleEventEmitter: NativeEventEmitter;
10
12
  export { FWNavigatorModuleEventEmitter };
@@ -5,13 +5,14 @@ import type ProductInfoViewConfiguration from '../models/ProductInfoViewConfigur
5
5
  interface IShoppingModule extends NativeModule {
6
6
  init(): void;
7
7
  updateVideoProducts(products: Product[], callbackId: number | string): void;
8
- updateProductViewConfig(config: ProductInfoViewConfiguration, callbackId: number | string): void;
9
8
  updateAddToCartStatus(res: string, tips: string, callbackId: number | string): void;
10
9
  jumpToCartPage(callbackId: number | string, props: NewNativeContainerProps): void;
11
10
  setCartIconVisible(visible: boolean): void;
12
11
  setCartItemCount(count: number): void;
13
12
  setCustomClickCartIconEnabled(enabled: boolean): Promise<void>;
14
13
  clearCallbackId(callbackId: number | string, eventName: string): void;
14
+ setProductInfoViewConfiguration(config: ProductInfoViewConfiguration): void;
15
+ setCustomClickLinkButtonEnabled(enabled: boolean): Promise<void>;
15
16
  }
16
17
  declare const ShoppingModuleEventEmitter: NativeEventEmitter;
17
18
  export { ShoppingModuleEventEmitter };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-firework-sdk",
3
- "version": "1.7.0",
3
+ "version": "1.8.0",
4
4
  "description": "Firework React Native SDK",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -26,6 +26,6 @@ cp $module_header_path "${PODS_ROOT}/Headers/Public/react_native_firework_sdk/"'
26
26
 
27
27
  s.dependency "React-Core"
28
28
 
29
- s.dependency "FireworkVideo", "1.6.0"
29
+ s.dependency "FireworkVideo", "1.7.0"
30
30
 
31
31
  end
@@ -1,3 +1,4 @@
1
+ import { Platform } from 'react-native';
1
2
  import { FWEventName } from './models/FWEventName';
2
3
  import FWNavigatorModule, {
3
4
  FWNavigatorModuleEventEmitter,
@@ -31,6 +32,8 @@ class FWNavigator {
31
32
  * Please set your app component name through FireworkSDK.getInstance().appComponentName before calling this method
32
33
  * @param {FWNativeContainerProps} props We will pass the props to your app component.
33
34
  * @returns {Promise<boolean>} The result of pushing RN page from native page.
35
+ *
36
+ * @deprecated The property will be deprecated since RN SDK V2.
34
37
  */
35
38
  public pushNativeContainer(props: FWNativeContainerProps): Promise<boolean> {
36
39
  FWLoggerUtil.log(`Enter pushNewNativeContainer`);
@@ -48,11 +51,36 @@ class FWNavigator {
48
51
 
49
52
  /**
50
53
  * Indicate if we can pop top-most native container.
51
- * @returns {Promise<boolean>} If the result is true, we could call popNativeContainer to pop top-most native container.
54
+ * @returns {Promise<boolean>} If the result is true,
55
+ * we could call popNativeContainer to pop top-most native container.
56
+ *
57
+ * @deprecated The property will be deprecated since RN SDK V2.
52
58
  */
53
59
  public canPopNativeContainer(): Promise<boolean> {
54
60
  return FWNavigatorModule.canPopNativeContainer();
55
61
  }
62
+
63
+ /**
64
+ * Change current fullscreen player to floating player.
65
+ * @returns {Promise<boolean>} If the result is true, it means that the fullscreen
66
+ * player is changed to floating player. Only supported on iOS.
67
+ */
68
+ public async startFloatingPlayer(): Promise<boolean> {
69
+ if (Platform.OS === 'ios') {
70
+ return FWNavigatorModule.startFloatingPlayer();
71
+ }
72
+
73
+ return true;
74
+ }
75
+
76
+ /**
77
+ * Stop current floating player. Only supported on iOS.
78
+ */
79
+ public async stopFloatingPlayer(): Promise<void> {
80
+ if (Platform.OS === 'ios') {
81
+ await FWNavigatorModule.stopFloatingPlayer();
82
+ }
83
+ }
56
84
  }
57
85
 
58
86
  export default FWNavigator;
@@ -80,14 +80,15 @@ class FireworkSDK {
80
80
 
81
81
  /**
82
82
  * The share base URL of videos.
83
+ * The set accessor is async.
83
84
  */
84
85
  public get shareBaseURL(): string | undefined {
85
86
  return this._shareBaseURL;
86
87
  }
87
88
  public set shareBaseURL(value: string | undefined) {
88
- const valueHasChanged = this._shareBaseURL !== value;
89
- this._shareBaseURL = value;
90
89
  FireworkSDKModule.setShareBaseURL(value ?? '').then(() => {
90
+ const valueHasChanged = this._shareBaseURL !== value;
91
+ this._shareBaseURL = value;
91
92
  if (valueHasChanged) {
92
93
  this.eventEmitter.emit(FWEventName.ShareBaseURLUpdated);
93
94
  }
@@ -97,17 +98,19 @@ class FireworkSDK {
97
98
 
98
99
  /**
99
100
  * The configuration for ad badges.
101
+ * The set accessor is async.
100
102
  */
101
103
  public get adBadgeConfiguration(): AdBadgeConfiguration | undefined {
102
104
  return this._adBadgeConfiguration;
103
105
  }
104
106
  public set adBadgeConfiguration(value: AdBadgeConfiguration | undefined) {
105
- const valueHasChanged =
106
- this._adBadgeConfiguration?.badgeTextType !== value?.badgeTextType ||
107
- this._adBadgeConfiguration?.backgroundColor !== value?.backgroundColor ||
108
- this._adBadgeConfiguration?.textColor !== value?.textColor;
109
- this._adBadgeConfiguration = value;
110
107
  FireworkSDKModule.setAdBadgeConfiguration(value ?? {}).then(() => {
108
+ const valueHasChanged =
109
+ this._adBadgeConfiguration?.badgeTextType !== value?.badgeTextType ||
110
+ this._adBadgeConfiguration?.backgroundColor !==
111
+ value?.backgroundColor ||
112
+ this._adBadgeConfiguration?.textColor !== value?.textColor;
113
+ this._adBadgeConfiguration = value;
111
114
  if (valueHasChanged) {
112
115
  this.eventEmitter.emit(FWEventName.AdBadgeConfigurationUpdated);
113
116
  }
@@ -257,9 +260,6 @@ class FireworkSDK {
257
260
  public async changeAppLanguage(language: string): Promise<boolean> {
258
261
  if (Platform.OS === 'android') {
259
262
  const result = await FireworkSDKModule.changeAppLanguage(language);
260
- if (result) {
261
- await FireworkSDKModule.restart();
262
- }
263
263
  return result;
264
264
  }
265
265
 
@@ -3,6 +3,7 @@ import { NativeEventEmitter, Platform } from 'react-native';
3
3
  import type AddToCartResult from './models/AddToCartResult';
4
4
  import type {
5
5
  AddToCartEvent,
6
+ CustomClickLinkButtonEvent,
6
7
  UpdateProductDetailsEvent,
7
8
  WillDisplayProductEvent,
8
9
  } from './models/FWEvents';
@@ -33,6 +34,10 @@ export type WillDisplayProductCallback = (
33
34
  event: WillDisplayProductEvent
34
35
  ) => Promise<ProductInfoViewConfiguration | undefined | null>;
35
36
 
37
+ export type CustomClickLinkButtonCallback = (
38
+ event: CustomClickLinkButtonEvent
39
+ ) => Promise<void>;
40
+
36
41
  type CallbackInfo = { callbackId?: number | string };
37
42
 
38
43
  /**
@@ -52,14 +57,16 @@ class VideoShopping {
52
57
  /**
53
58
  * This callback is triggered when the user clicks the shopping cart icon.
54
59
  *
55
- * The host app can return NewNativeContainerProps object and we will push a new native container with the props.
60
+ * The host app can return NewNativeContainerProps object
61
+ * and we will push a new native container with the props.
56
62
  */
57
63
  public onClickCartIcon?: ClickCartIconCallback;
58
64
 
59
65
  /**
60
66
  * This callback is triggered when the user clicks the shopping cart icon.
61
67
  *
62
- * The host app can customize the processing logic of clicking the shopping cart icon by setting the callback.
68
+ * The host app can customize the click event processing logic of
69
+ * the shopping cart icon by setting the callback.
63
70
  */
64
71
  public get onCustomClickCartIcon(): CustomClickCartIconCallback | undefined {
65
72
  return this._onCustomClickCartIcon;
@@ -82,14 +89,15 @@ class VideoShopping {
82
89
  public onUpdateProductDetails?: UpdateProductDetailsCallback;
83
90
 
84
91
  /**
85
- * This callback is triggered when the product will be shown. Only supported on iOS.
92
+ * Please use productInfoViewConfiguration property. Only supported on iOS.
86
93
  *
87
- * The host app can return a ProductInfoViewConfiguration object to configure "Add to cart" button style and cart icon style.
94
+ * @deprecated The property will be deprecated since RN SDK V2.
88
95
  */
89
96
  public onWillDisplayProduct?: WillDisplayProductCallback;
90
97
 
91
98
  /**
92
- * Defaults to true. You can hide the cart icon by setting this property to false.
99
+ * Defaults to true.
100
+ * You can hide the cart icon by setting this property to false.
93
101
  */
94
102
  public get cartIconVisible(): boolean {
95
103
  return this._cartIconVisible;
@@ -100,6 +108,51 @@ class VideoShopping {
100
108
  }
101
109
  private _cartIconVisible: boolean = true;
102
110
 
111
+ /**
112
+ * The host app can use this property to configure "Add to cart" button style
113
+ * and hide the link button next to "Add to cart" button. Only supported on iOS.
114
+ */
115
+ public get productInfoViewConfiguration():
116
+ | ProductInfoViewConfiguration
117
+ | undefined {
118
+ return this._productInfoViewConfiguration;
119
+ }
120
+
121
+ public set productInfoViewConfiguration(
122
+ value: ProductInfoViewConfiguration | undefined
123
+ ) {
124
+ this._productInfoViewConfiguration = value;
125
+ if (Platform.OS === 'ios') {
126
+ ShoppingModule.setProductInfoViewConfiguration(value ?? {});
127
+ }
128
+ }
129
+
130
+ private _productInfoViewConfiguration?:
131
+ | ProductInfoViewConfiguration
132
+ | undefined;
133
+
134
+ /**
135
+ * This callback is triggered when the user clicks
136
+ * the link button next to Add to cart button. Only supported on Android.
137
+ *
138
+ * The host app can customize the click event processing logic of
139
+ * the link button by setting the callback.
140
+ */
141
+ public get onCustomClickLinkButton():
142
+ | CustomClickLinkButtonCallback
143
+ | undefined {
144
+ return this._onCustomClickLinkButton;
145
+ }
146
+ public set onCustomClickLinkButton(
147
+ value: CustomClickLinkButtonCallback | undefined
148
+ ) {
149
+ this._onCustomClickLinkButton = value;
150
+ if (Platform.OS === 'android') {
151
+ ShoppingModule.setCustomClickLinkButtonEnabled(!!value);
152
+ }
153
+ }
154
+ private _onCustomClickLinkButton?: CustomClickLinkButtonCallback | undefined;
155
+
103
156
  private get eventEmitter(): NativeEventEmitter {
104
157
  return ShoppingModuleEventEmitter;
105
158
  }
@@ -116,7 +169,7 @@ class VideoShopping {
116
169
  private constructor() {
117
170
  this.eventEmitter.addListener(FWEventName.AddToCart, (event) => {
118
171
  FWLoggerUtil.log(
119
- `Receive AddToCart event productId: ${event.productId} unitId: ${event.unitId}`
172
+ `Receive AddToCart event productId: ${event?.productId} unitId: ${event?.unitId}`
120
173
  );
121
174
  this.handleAddToCartEvent(event);
122
175
  });
@@ -128,18 +181,30 @@ class VideoShopping {
128
181
 
129
182
  this.eventEmitter.addListener(FWEventName.UpdateProductDetails, (event) => {
130
183
  FWLoggerUtil.log(
131
- `Receive UpdateProductDetails event productIds: ${event.productIds}`
184
+ `Receive UpdateProductDetails event productIds: ${event?.productIds}`
132
185
  );
133
186
  this.handleUpdateProductDetailsEvent(event);
134
187
  });
135
188
 
136
189
  this.eventEmitter.addListener(FWEventName.WillDisplayProduct, (event) => {
137
190
  FWLoggerUtil.log(
138
- `Receive WillDisplayProduct event videoId: ${event.videoId}`
191
+ `Receive WillDisplayProduct event videoId: ${event?.videoId}`
139
192
  );
140
193
  this.handleWillDisplayProductEvent(event);
141
194
  });
142
195
  this.eventEmitter.addListener(FWEventName.LogMessage, () => {});
196
+
197
+ if (Platform.OS === 'android') {
198
+ this.eventEmitter.addListener(
199
+ FWEventName.CustomLinkButtonClick,
200
+ (event) => {
201
+ FWLoggerUtil.log(
202
+ `Receive CustomLinkButtonClick event url: ${event?.url}`
203
+ );
204
+ this.handleCustomLinkButtonClickEvent(event);
205
+ }
206
+ );
207
+ }
143
208
  }
144
209
 
145
210
  /**
@@ -250,16 +315,23 @@ class VideoShopping {
250
315
  event: WillDisplayProductEvent & CallbackInfo
251
316
  ) {
252
317
  if (this.onWillDisplayProduct) {
253
- const callbackId = event.callbackId;
254
318
  delete event.callbackId;
255
319
  const config = await this.onWillDisplayProduct(
256
320
  event as WillDisplayProductEvent
257
321
  );
258
- if (config && callbackId) {
259
- ShoppingModule.updateProductViewConfig(config, callbackId);
322
+ if (config) {
323
+ ShoppingModule.setProductInfoViewConfiguration(config);
260
324
  }
261
325
  }
262
326
  }
327
+
328
+ private async handleCustomLinkButtonClickEvent(
329
+ event: CustomClickLinkButtonEvent
330
+ ) {
331
+ if (this.onCustomClickLinkButton) {
332
+ this.onCustomClickLinkButton(event);
333
+ }
334
+ }
263
335
  }
264
336
 
265
337
  export default VideoShopping;
@@ -64,6 +64,10 @@ export interface IVideoFeedProps {
64
64
  * Ad configuration of the feed. Only supported on iOS.
65
65
  */
66
66
  adConfiguration?: AdConfiguration;
67
+ /**
68
+ * Specifies if Picture in Picture is enabled. Only supported on iOS.
69
+ */
70
+ enablePictureInPicture?: boolean;
67
71
  /**
68
72
  * The feed loading result callback. It means loading successfully when error equals to undefined.
69
73
  */
@@ -171,6 +175,7 @@ export default class VideoFeed extends React.Component<IVideoFeedProps> {
171
175
  playlistGroup = '',
172
176
  mode = 'row',
173
177
  adConfiguration,
178
+ enablePictureInPicture = false,
174
179
  } = this.props;
175
180
  const videoFeedConfiguration = this._getVideoFeedConfiguration();
176
181
  const titleHidden = videoFeedConfiguration?.title?.hidden ?? false;
@@ -185,8 +190,12 @@ export default class VideoFeed extends React.Component<IVideoFeedProps> {
185
190
  const dynamicContentParametersString =
186
191
  this._generateDynamicContentParametersString();
187
192
  const enableAutoplay = videoFeedConfiguration?.enableAutoplay ?? false;
188
- const enablePictureInPicture =
189
- videoFeedConfiguration?.enablePictureInPicture ?? false;
193
+
194
+ let enablePictureInPictureLegacy = false;
195
+ if (videoFeedConfiguration) {
196
+ enablePictureInPictureLegacy =
197
+ (videoFeedConfiguration as any).enablePictureInPicture ?? false;
198
+ }
190
199
  const gridColumns = videoFeedConfiguration?.gridColumns ?? 2;
191
200
  const requiresAds = adConfiguration?.requiresAds ?? false;
192
201
  const adsFetchTimeout = adConfiguration?.adsFetchTimeout ?? 10;
@@ -208,6 +217,7 @@ export default class VideoFeed extends React.Component<IVideoFeedProps> {
208
217
  key += `_dynamicContentParameters:${dynamicContentParametersString}`;
209
218
  key += `_enableAutoplay:${enableAutoplay}`;
210
219
  key += `_enablePictureInPicture:${enablePictureInPicture}`;
220
+ key += `_enablePictureInPictureLegacy:${enablePictureInPictureLegacy}`;
211
221
  key += `_gridColumns:${gridColumns}`;
212
222
  key += `_requiresAds:${requiresAds}`;
213
223
  key += `_adsFetchTimeout:${adsFetchTimeout}`;
@@ -23,6 +23,7 @@ import type FeedItemDetails from './models/FeedItemDetails';
23
23
  import type FWError from './models/FWError';
24
24
  import type {
25
25
  AddToCartEvent,
26
+ CustomClickLinkButtonEvent,
26
27
  CustomCTAClickEvent,
27
28
  LiveStreamChatEvent,
28
29
  LiveStreamEvent,
@@ -31,6 +32,11 @@ import type {
31
32
  VideoPlaybackEvent,
32
33
  WillDisplayProductEvent,
33
34
  } from './models/FWEvents';
35
+ import type IOSFontInfo from './models/IOSFontInfo';
36
+ import type {
37
+ IOSSystemFontStyle,
38
+ IOSSystemFontWeight,
39
+ } from './models/IOSFontInfo';
34
40
  import LiveStreamChatEventName from './models/LiveStreamChatEventName';
35
41
  import type LiveStreamEventDetails from './models/LiveStreamEventDetails';
36
42
  import LiveStreamEventName from './models/LiveStreamEventName';
@@ -38,7 +44,10 @@ import type LiveStreamMessageDetails from './models/LiveStreamMessageDetails';
38
44
  import type { NewNativeContainerProps } from './models/NewNativeContainerProps';
39
45
  import type Product from './models/Product';
40
46
  import type ProductInfoViewConfiguration from './models/ProductInfoViewConfiguration';
41
- import type { AddToCartButtonConfiguration } from './models/ProductInfoViewConfiguration';
47
+ import type {
48
+ AddToCartButtonConfiguration,
49
+ LinkButtonConfiguration,
50
+ } from './models/ProductInfoViewConfiguration';
42
51
  import type ProductUnit from './models/ProductUnit';
43
52
  import type { ProductPrice, ProductUnitOption } from './models/ProductUnit';
44
53
  import type { StoryBlockSource } from './models/StoryBlockSource';
@@ -67,6 +76,7 @@ import type {
67
76
  AddToCartCallback,
68
77
  ClickCartIconCallback,
69
78
  CustomClickCartIconCallback,
79
+ CustomClickLinkButtonCallback,
70
80
  UpdateProductDetailsCallback,
71
81
  WillDisplayProductCallback,
72
82
  } from './VideoShopping';
@@ -84,12 +94,18 @@ export {
84
94
  AddToCartResult,
85
95
  ClickCartIconCallback,
86
96
  CustomClickCartIconCallback,
97
+ CustomClickLinkButtonCallback,
98
+ CustomClickLinkButtonEvent,
87
99
  CustomCTAClickCallback,
88
100
  CustomCTAClickEvent,
89
101
  FeedItemDetails,
90
102
  FWError,
91
103
  FWNavigator,
104
+ IOSFontInfo,
105
+ IOSSystemFontStyle,
106
+ IOSSystemFontWeight,
92
107
  IVideoFeedProps,
108
+ LinkButtonConfiguration,
93
109
  LiveStream,
94
110
  LiveStreamChatEvent,
95
111
  LiveStreamChatEventName,
@@ -12,4 +12,5 @@ export enum FWEventName {
12
12
  ShareBaseURLUpdated = 'fw:share-base-url-updated',
13
13
  AdBadgeConfigurationUpdated = 'fw:ad-badge-configuration-updated',
14
14
  LogMessage = 'fw:log-message',
15
+ CustomLinkButtonClick = 'fw:shopping:custom-link-button-click',
15
16
  }
@@ -65,3 +65,9 @@ export interface LiveStreamChatEvent {
65
65
  message: LiveStreamMessageDetails;
66
66
  liveStream: LiveStreamEventDetails;
67
67
  }
68
+
69
+ export interface CustomClickLinkButtonEvent {
70
+ url: string;
71
+ productId: string;
72
+ unitId: string;
73
+ }
@@ -0,0 +1,29 @@
1
+ export type IOSSystemFontStyle = 'normal' | 'italic';
2
+ export type IOSSystemFontWeight =
3
+ | 'ultraLight'
4
+ | 'thin'
5
+ | 'light'
6
+ | 'regular'
7
+ | 'medium'
8
+ | 'semibold'
9
+ | 'bold'
10
+ | 'heavy'
11
+ | 'black';
12
+
13
+ export default interface IOSFontInfo {
14
+ /**
15
+ * The iOS font name, such as "Helvetica", "Helvetica-Bold".
16
+ * Only supported on iOS.
17
+ */
18
+ fontName?: string;
19
+ /**
20
+ * The iOS system font style.
21
+ * The property is ignored when fontName is non-empty.
22
+ */
23
+ systemFontStyle?: IOSSystemFontStyle;
24
+ /**
25
+ * The iOS system font weight.
26
+ * The property is ignored when fontName is non-empty or systemFontStyle is italic.
27
+ */
28
+ systemFontWeight?: IOSSystemFontWeight;
29
+ }
@@ -1,7 +1,28 @@
1
+ import type IOSFontInfo from './IOSFontInfo';
2
+
1
3
  export interface AddToCartButtonConfiguration {
4
+ /**
5
+ * The background color of "Add to cart" button.
6
+ */
2
7
  backgroundColor?: string;
8
+ /**
9
+ * The text color of "Add to cart" button.
10
+ */
3
11
  textColor?: string;
12
+ /**
13
+ * The font size of "Add to cart" button.
14
+ */
4
15
  fontSize?: number;
16
+ /**
17
+ * The iOS font info of "Add to cart" button.
18
+ * The property is ignored when fontSize is not set.
19
+ * Only supported on iOS.
20
+ */
21
+ iOSFontInfo?: IOSFontInfo;
22
+ }
23
+
24
+ export interface LinkButtonConfiguration {
25
+ isHidden?: boolean;
5
26
  }
6
27
 
7
28
  export default interface ProductInfoViewConfiguration {
@@ -9,4 +30,8 @@ export default interface ProductInfoViewConfiguration {
9
30
  * Configuration of "Add to cart" button. Only supported on iOS.
10
31
  */
11
32
  addToCartButton?: AddToCartButtonConfiguration;
33
+ /**
34
+ * Configuration of link button next to "Add to cart" button. Only supported on iOS.
35
+ */
36
+ linkButton?: LinkButtonConfiguration;
12
37
  }
@@ -1,7 +1,24 @@
1
+ import type IOSFontInfo from './IOSFontInfo';
2
+
1
3
  export interface VideoFeedTitleConfiguration {
4
+ /**
5
+ * Specifies if the video feed title is hidden.
6
+ */
2
7
  hidden?: boolean;
8
+ /**
9
+ * The text color of video feed title. Only supported on iOS.
10
+ */
3
11
  textColor?: string;
12
+ /**
13
+ * The font size of video feed title. Only supported on iOS.
14
+ */
4
15
  fontSize?: number;
16
+ /**
17
+ * The iOS font info of "Add to cart" button.
18
+ * The property is ignored when fontSize is not set.
19
+ * Only supported on iOS.
20
+ */
21
+ iOSFontInfo?: IOSFontInfo;
5
22
  }
6
23
 
7
24
  export interface VideoFeedPlayIconConfiguration {
@@ -70,7 +87,9 @@ export default interface VideoFeedConfiguration {
70
87
  */
71
88
  gridColumns?: number;
72
89
  /**
73
- * Specifies if Picture in Picture is enabled. Only supported on iOS.
90
+ * Please use the enablePictureInPicture in IVideoFeedProps. Only supported on iOS.
91
+ *
92
+ * @deprecated The property will be deprecated since RN SDK V2.
74
93
  */
75
94
  enablePictureInPicture?: boolean;
76
95
  }
@@ -1,9 +1,26 @@
1
+ import type IOSFontInfo from './IOSFontInfo';
2
+
1
3
  export type VideoPlayerStyle = 'full' | 'fit';
2
4
  export type VideoPlayerCompleteAction = 'loop' | 'advanceToNext';
3
5
  export interface VideoPlayerCTAStyle {
6
+ /**
7
+ * The background color of CTA button.
8
+ */
4
9
  backgroundColor?: string;
10
+ /**
11
+ * The text color of CTA button.
12
+ */
5
13
  textColor?: string;
14
+ /**
15
+ * The font size of CTA button.
16
+ */
6
17
  fontSize?: number;
18
+ /**
19
+ * The iOS font info of "Add to cart" button.
20
+ * The property is ignored when fontSize is not set.
21
+ * Only supported on iOS.
22
+ */
23
+ iOSFontInfo?: IOSFontInfo;
7
24
  }
8
25
 
9
26
  export type VideoPlayerCTADelayType = 'constant' | 'percentage';
@@ -16,6 +16,8 @@ interface IFWNavigatorModule extends NativeModule {
16
16
  pushNativeContainer(props: { [key: string]: any }): Promise<boolean>;
17
17
  popNativeContainer(): Promise<boolean>;
18
18
  canPopNativeContainer(): Promise<boolean>;
19
+ startFloatingPlayer(): Promise<boolean>;
20
+ stopFloatingPlayer(): Promise<boolean>;
19
21
  }
20
22
 
21
23
  const FWNavigatorModuleEventEmitter = new NativeEventEmitter(FWNavigatorModule);
@@ -19,10 +19,6 @@ const ShoppingModule = NativeModules.ShoppingModule
19
19
  interface IShoppingModule extends NativeModule {
20
20
  init(): void;
21
21
  updateVideoProducts(products: Product[], callbackId: number | string): void;
22
- updateProductViewConfig(
23
- config: ProductInfoViewConfiguration,
24
- callbackId: number | string
25
- ): void;
26
22
  updateAddToCartStatus(
27
23
  res: string,
28
24
  tips: string,
@@ -36,6 +32,8 @@ interface IShoppingModule extends NativeModule {
36
32
  setCartItemCount(count: number): void;
37
33
  setCustomClickCartIconEnabled(enabled: boolean): Promise<void>; // Only supported on iOS
38
34
  clearCallbackId(callbackId: number | string, eventName: string): void; // Only supported on iOS
35
+ setProductInfoViewConfiguration(config: ProductInfoViewConfiguration): void; // Only supported on iOS
36
+ setCustomClickLinkButtonEnabled(enabled: boolean): Promise<void>; // Only supported on Android
39
37
  }
40
38
 
41
39
  const ShoppingModuleEventEmitter = new NativeEventEmitter(ShoppingModule);
@@ -1,24 +0,0 @@
1
- //
2
- // FWPiPManager.swift
3
- //
4
- // Created by linjie jiang on 2023/2/8.
5
- //
6
-
7
- import Foundation
8
- import FireworkVideo
9
-
10
- class FWPiPManager {
11
- static let shared = FWPiPManager()
12
- // store the pipController corresponding to Video Feed or Story block being removed
13
- var pipControllerList: [PictureInPictureController] = []
14
-
15
- private init() {}
16
-
17
- func addPiPController(_ pipController: PictureInPictureController) {
18
- pipControllerList.append(pipController)
19
- }
20
-
21
- func removeAllPiPControllers() {
22
- pipControllerList.removeAll()
23
- }
24
- }
@@ -1,33 +0,0 @@
1
- //
2
- // UIButton+FWSwizzle.swift
3
- //
4
- // Created by linjie jiang on 2023/2/8.
5
- //
6
-
7
- import UIKit
8
- import FireworkVideo
9
-
10
- extension UIButton {
11
- @objc public static func fw_swizzleMethods() {
12
- DispatchQueue.fw_once {
13
- FWSwizzleUtil.swizzleSelector(
14
- cls: self,
15
- orginalSelector: #selector(sendAction(_:to:for:)),
16
- customSelector: #selector(fw_sendAction(_:to:for:))
17
- )
18
- }
19
- }
20
-
21
- @objc func fw_sendAction(_ action: Selector, to target: Any?, for event: UIEvent?) {
22
- if let targetImage = self.image(for: .normal) {
23
- let iOSSDKBundle = Bundle(for: FireworkVideoSDK.self)
24
- let closeImage = UIImage(named: "closeX", in: iOSSDKBundle, compatibleWith: nil)
25
- if targetImage.isEqual(closeImage) {
26
- DispatchQueue.main.asyncAfter(wallDeadline: .now() + 0.1) {
27
- FWPiPManager.shared.removeAllPiPControllers()
28
- }
29
- }
30
- }
31
- self.fw_sendAction(action, to: target, for: event)
32
- }
33
- }