react-native-firework-sdk 1.5.5 → 1.6.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.
@@ -24,6 +24,7 @@ public class StoryBlock: UIView, StoryBlockViewControllerDelegate {
24
24
  @objc public var channel: String = ""
25
25
  @objc public var playlist: String = ""
26
26
  @objc public var dynamicContentParameters: [String: [String]] = [:]
27
+ @objc public var enablePictureInPicture: Bool = false
27
28
 
28
29
  public weak var delegate: StoryBlockViewDelegate?
29
30
 
@@ -44,6 +45,8 @@ public class StoryBlock: UIView, StoryBlockViewControllerDelegate {
44
45
  }
45
46
  }
46
47
 
48
+ private var pipController: PictureInPictureController?
49
+
47
50
  public override init(frame: CGRect) {
48
51
  super.init(frame: frame)
49
52
  self.clipsToBounds = true
@@ -68,14 +71,20 @@ public class StoryBlock: UIView, StoryBlockViewControllerDelegate {
68
71
  }
69
72
 
70
73
  let storyBlockVC = StoryBlockViewController(source: source)
74
+ if self.enablePictureInPicture {
75
+ self.pipController = PictureInPictureController(storyBlock: storyBlockVC)
76
+ } else {
77
+ self.pipController = nil
78
+ }
79
+
71
80
  storyBlockVC.delegate = self
72
81
  self.storyBlockVC = storyBlockVC
73
-
74
82
  parentVC.attachChild(storyBlockVC, to: self)
75
83
  }
76
84
 
77
85
  public override func removeFromSuperview() {
78
86
  super.removeFromSuperview()
87
+ self.pipController = nil
79
88
 
80
89
  guard let storyBlockVC = self.storyBlockVC else {
81
90
  return
@@ -21,6 +21,7 @@ RCT_CUSTOM_VIEW_PROPERTY(source, StoryBlockSource, StoryBlock) {
21
21
  RCT_EXPORT_VIEW_PROPERTY(channel, NSString)
22
22
  RCT_EXPORT_VIEW_PROPERTY(playlist, NSString)
23
23
  RCT_EXPORT_VIEW_PROPERTY(dynamicContentParameters, NSDictionary)
24
+ RCT_EXPORT_VIEW_PROPERTY(enablePictureInPicture, BOOL)
24
25
 
25
26
 
26
27
  RCT_EXPORT_VIEW_PROPERTY(onStoryBlockLoadFinished, RCTBubblingEventBlock)
@@ -8,8 +8,8 @@
8
8
  import FireworkVideo
9
9
  import UIKit
10
10
 
11
- let gOnVideoTemporarilyReleasePipController = Notification.Name("gOnVideoTemporarilyReleasePipController");
12
- let gOnVideoRestorePipController = Notification.Name("gOnVideoRestorePipController");
11
+ let gOnVideoTemporarilyReleasePipController = Notification.Name("gOnVideoTemporarilyReleasePipController")
12
+ let gOnVideoRestorePipController = Notification.Name("gOnVideoRestorePipController")
13
13
 
14
14
  @objc
15
15
  public enum VideoFeedMode: Int {
@@ -160,6 +160,7 @@ public class VideoFeed: UIView, VideoFeedViewControllerDelegate {
160
160
  embed()
161
161
  }
162
162
 
163
+ // swiftlint:disable:next function_body_length
163
164
  private func embed() {
164
165
  guard let parentVC = parentViewController else {
165
166
  return
@@ -208,11 +209,21 @@ public class VideoFeed: UIView, VideoFeedViewControllerDelegate {
208
209
  feedVC.viewConfiguration = viewConfiguration
209
210
  }
210
211
 
212
+ // swiftlint:disable:next notification_center_detachment
211
213
  NotificationCenter.default.removeObserver(self)
212
214
  if feedViewConfig?.enablePictureInPicture == true {
213
215
  self.pipController = PictureInPictureController(videoFeed: feedVC)
214
- NotificationCenter.default.addObserver(self, selector: #selector(onVideoTemporarilyReleasePipController(_:)), name: gOnVideoTemporarilyReleasePipController, object: nil)
215
- NotificationCenter.default.addObserver(self, selector: #selector(onVideoRestorePipController(_:)), name: gOnVideoRestorePipController, object: nil)
216
+ NotificationCenter.default.addObserver(
217
+ self,
218
+ selector: #selector(onVideoTemporarilyReleasePipController(_:)),
219
+ name: gOnVideoTemporarilyReleasePipController,
220
+ object: nil
221
+ )
222
+ NotificationCenter.default.addObserver(
223
+ self,
224
+ selector: #selector(onVideoRestorePipController(_:)),
225
+ name: gOnVideoRestorePipController,
226
+ object: nil)
216
227
  } else {
217
228
  self.pipController = nil
218
229
  }
@@ -224,6 +235,7 @@ public class VideoFeed: UIView, VideoFeedViewControllerDelegate {
224
235
 
225
236
  public override func removeFromSuperview() {
226
237
  super.removeFromSuperview()
238
+ // swiftlint:disable:next notification_center_detachment
227
239
  NotificationCenter.default.removeObserver(self)
228
240
  self.pipController = nil
229
241
 
@@ -320,7 +332,7 @@ extension VideoFeed {
320
332
  }
321
333
 
322
334
  // swiftlint:disable:next cyclomatic_complexity
323
- private static func convertToVideoPlayerContentConfiguration(
335
+ static func convertToVideoPlayerContentConfiguration(
324
336
  _ config: VideoPlayerConfiguration?
325
337
  ) -> VideoPlayerContentConfiguration? {
326
338
  guard let config = config else {
@@ -372,6 +384,10 @@ extension VideoFeed {
372
384
  vpcConfig.videoDetail.fireworkAttribution.isHidden = !showBranding
373
385
  }
374
386
 
387
+ if let shareBaseUrl = gShareBaseURL {
388
+ vpcConfig.shareButton.behavior.baseURL = URL(string: shareBaseUrl)
389
+ }
390
+
375
391
  return vpcConfig
376
392
  }
377
393
 
@@ -393,9 +409,7 @@ extension VideoFeed {
393
409
  if let backgroundColor = feedViewConfig?.backgroundColor {
394
410
  videoConfig.backgroundColor = backgroundColor.uicolor()
395
411
  }
396
- if let shareBaseUrl = gShareBaseURL {
397
- videoConfig.playerView.shareButton.behavior.baseURL = URL(string: shareBaseUrl)
398
- }
412
+
399
413
  if let adBadge = FireworkSDKModule.convertToFWAdBadgeConfiguration(gAdBadgeConfiguration) {
400
414
  videoConfig.adBadge = adBadge
401
415
  }
@@ -406,20 +420,20 @@ extension VideoFeed {
406
420
 
407
421
  return videoConfig
408
422
  }
409
-
423
+
410
424
  @objc private func onVideoTemporarilyReleasePipController(_ notification: NSNotification) {
411
425
  self.pipController = nil
412
426
  }
413
-
427
+
414
428
  @objc private func onVideoRestorePipController(_ notification: NSNotification) {
415
429
  guard let feedVC = feedVC else {
416
- return;
430
+ return
417
431
  }
418
-
432
+
419
433
  guard feedViewConfig?.enablePictureInPicture == true else {
420
434
  return
421
435
  }
422
-
436
+
423
437
  self.pipController = PictureInPictureController(videoFeed: feedVC)
424
438
  }
425
439
  }
@@ -11,42 +11,9 @@ import UIKit
11
11
 
12
12
  extension RCTConvert {
13
13
  static func videoPlayerContentConfiguration(_ config: [String: AnyObject])
14
- -> VideoPlayerContentConfiguration {
15
- var finalConfig = VideoPlayerContentConfiguration()
16
-
17
- if let style = videoPlayerStyle(config["playerStyle"] as? String) {
18
- finalConfig.playerStyle = style
19
- }
20
-
21
- if let action = videoCompleteAction(config["videoCompleteAction"] as? String) {
22
- finalConfig.videoCompleteAction = action
23
- }
24
-
25
- if let showShareButton = config["showShareButton"] as? Bool {
26
- finalConfig.shareButton.isHidden = !showShareButton
27
- }
28
-
29
- if let ctaStyle = ctaButtonStyle(config["ctaButtonStyle"] as? Dictionary) {
30
- finalConfig.ctaButton.contentConfiguration = ctaStyle
31
- }
32
-
33
- if let showPlaybackButton = config["showPlaybackButton"] as? Bool {
34
- finalConfig.playbackButton.isHidden = !showPlaybackButton
35
- }
36
-
37
- if let showMuteButton = config["showMuteButton"] as? Bool {
38
- finalConfig.muteButton.isHidden = !showMuteButton
39
- }
40
-
41
- if let launchBehaviorString = config["launchBehavior"] as? String,
42
- let launchBehavior = VideoPlayerConfiguration.VideoLaunchBehavior(
43
- rawValue: launchBehaviorString) {
44
- finalConfig.onFirstLaunch = launchBehavior.behavior()
45
- }
46
-
47
- if let showBranding = config["showBranding"] as? Bool {
48
- finalConfig.videoDetail.fireworkAttribution.isHidden = !showBranding
49
- }
14
+ -> VideoPlayerContentConfiguration? {
15
+ let videoPlayerConfig = RCTConvert.videoPlayerConfiguration(config)
16
+ let finalConfig = VideoFeed.convertToVideoPlayerContentConfiguration(videoPlayerConfig)
50
17
 
51
18
  return finalConfig
52
19
  }
@@ -56,13 +56,13 @@ class FireworkSDKModule: RCTEventEmitter, FireworkVideoSDKDelegate {
56
56
  return
57
57
  }
58
58
 
59
- var finalConfig = RCTConvert.videoPlayerContentConfiguration(config)
60
- if let baseUrl = gShareBaseURL {
61
- finalConfig.shareButton.behavior.baseURL = URL(string: baseUrl)
62
- }
59
+ var vpcConfig = RCTConvert.videoPlayerContentConfiguration(config)
63
60
 
64
61
  var feedContentConfig = VideoFeedContentConfiguration()
65
- feedContentConfig.playerView = finalConfig
62
+ if let vpcConfig = vpcConfig {
63
+ feedContentConfig.playerView = vpcConfig
64
+ }
65
+
66
66
  if let adBadge = FireworkSDKModule.convertToFWAdBadgeConfiguration(gAdBadgeConfiguration) {
67
67
  feedContentConfig.adBadge = adBadge
68
68
  }
@@ -11,6 +11,7 @@ struct Product: Codable {
11
11
  var productId: String
12
12
  var name: String?
13
13
  var description: String?
14
+ var isAvailable: Bool?
14
15
  var units: [ProductUnit]?
15
16
 
16
17
  struct ProductUnit: Codable {
@@ -19,6 +20,7 @@ struct Product: Codable {
19
20
  var price: Price?
20
21
  var url: String?
21
22
  var imageUrl: String?
23
+ var isAvailable: Bool?
22
24
  var options: [VariantOption]?
23
25
  }
24
26
 
@@ -313,20 +313,23 @@ extension ShoppingModule {
313
313
 
314
314
  fileprivate static func hydrateProduct(_ product: Product, _ pbuild: ProductBuilder)
315
315
  -> ProductBuilder {
316
- if let name = product.name {
317
- pbuild.name(name)
318
- }
319
- if let description = product.description {
320
- pbuild.description(description)
321
- }
322
- if let variants = product.units {
323
- for variant in variants {
324
- pbuild.variant(variant.unitId) { pvBuild in
325
- return ShoppingModule.buildVariant(variant, pvBuild)
316
+ if let name = product.name {
317
+ pbuild.name(name)
318
+ }
319
+ if let description = product.description {
320
+ pbuild.description(description)
321
+ }
322
+ if let isAvailable = product.isAvailable {
323
+ pbuild.isAvailable(isAvailable)
324
+ }
325
+ if let variants = product.units {
326
+ for variant in variants {
327
+ pbuild.variant(variant.unitId) { pvBuild in
328
+ return ShoppingModule.buildVariant(variant, pvBuild)
329
+ }
326
330
  }
327
331
  }
328
- }
329
- return pbuild
332
+ return pbuild
330
333
  }
331
334
 
332
335
  fileprivate static func buildVariant(
@@ -335,17 +338,20 @@ extension ShoppingModule {
335
338
  if let name = variant.name {
336
339
  pvBuild.name(name)
337
340
  }
338
- if let price = variant.price {
339
- if let amount = price.amount, let currencyCode = price.currencyCode {
340
- pvBuild.formattedPrice(Decimal(amount), currencyCode: currencyCode)
341
- }
342
- }
343
341
  if let url = variant.url {
344
342
  pvBuild.url(url)
345
343
  }
346
344
  if let imageUrl = variant.imageUrl {
347
345
  pvBuild.imageUrl(imageUrl)
348
346
  }
347
+ if let price = variant.price {
348
+ if let amount = price.amount, let currencyCode = price.currencyCode {
349
+ pvBuild.formattedPrice(Decimal(amount), currencyCode: currencyCode)
350
+ }
351
+ }
352
+ if let isAvailable = variant.isAvailable {
353
+ pvBuild.isAvailable(isAvailable)
354
+ }
349
355
  let options = ShoppingModule.buildVariantOption(variant.options)
350
356
  if let options = options {
351
357
  pvBuild.options(options)
@@ -11,15 +11,15 @@ import FireworkVideo
11
11
  @objc(FWNavigatorUtils)
12
12
  public class FWNavigatorUtils: NSObject {
13
13
  @objc public static let shared = FWNavigatorUtils()
14
-
14
+
15
15
  @objc public var shouldDisablePlay = false
16
-
16
+
17
17
  private override init() {}
18
-
18
+
19
19
  public override func copy() -> Any {
20
20
  return self
21
21
  }
22
-
22
+
23
23
  public override func mutableCopy() -> Any {
24
24
  return self
25
25
  }
@@ -7,6 +7,8 @@ exports.default = void 0;
7
7
 
8
8
  var _react = _interopRequireDefault(require("react"));
9
9
 
10
+ var _reactNative = require("react-native");
11
+
10
12
  var _FireworkSDK = _interopRequireDefault(require("../FireworkSDK"));
11
13
 
12
14
  var _FWEventName = require("../models/FWEventName");
@@ -17,8 +19,6 @@ var _FWLoggerUtil = _interopRequireDefault(require("../utils/FWLoggerUtil"));
17
19
 
18
20
  var _FWStoryBlock = _interopRequireDefault(require("./FWStoryBlock"));
19
21
 
20
- var _reactNative = require("react-native");
21
-
22
22
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
23
23
 
24
24
  function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
@@ -121,7 +121,8 @@ class StoryBlock extends _react.default.Component {
121
121
  const {
122
122
  source,
123
123
  channel = '',
124
- playlist = ''
124
+ playlist = '',
125
+ enablePictureInPicture = false
125
126
  } = this.props;
126
127
  const shareBaseURL = (_FireworkSDK$getInsta = _FireworkSDK.default.getInstance().shareBaseURL) !== null && _FireworkSDK$getInsta !== void 0 ? _FireworkSDK$getInsta : '';
127
128
  const adBadgeConfiguration = (_FireworkSDK$getInsta2 = _FireworkSDK.default.getInstance().adBadgeConfiguration) !== null && _FireworkSDK$getInsta2 !== void 0 ? _FireworkSDK$getInsta2 : {};
@@ -139,6 +140,7 @@ class StoryBlock extends _react.default.Component {
139
140
  key += `_backgroundColorOfAdBadge:${backgroundColorOfAdBadge}`;
140
141
  key += `_textColorOfAdBadge:${textColorOfAdBadge}`;
141
142
  key += `_dynamicContentParameters:${dynamicContentParametersString}`;
143
+ key += `_enablePictureInPicture:${enablePictureInPicture}`;
142
144
  return key;
143
145
  }
144
146
 
@@ -1 +1 @@
1
- {"version":3,"sources":["StoryBlock.tsx"],"names":["NativeComponentName","createFragment","viewId","Platform","OS","UIManager","dispatchViewManagerCommand","getViewManagerConfig","Commands","create","toString","StoryBlock","React","Component","createRef","event","FWLoggerUtil","log","nativeEvent","name","onStoryBlockLoadFinished","props","reason","componentDidMount","subscriptionOfShareBaseURLUpdated","FireworkSDKModuleEventEmitter","addListener","FWEventName","ShareBaseURLUpdated","setState","subscriptions","push","subscriptionOfAdBadgeConfigurationUpdated","AdBadgeConfigurationUpdated","nativeComponentRef","current","componentWillUnmount","forEach","value","remove","render","style","_generateKey","_onStoryBlockLoadFinished","Object","assign","zIndex","source","channel","playlist","shareBaseURL","FireworkSDK","getInstance","adBadgeConfiguration","adBadgeTextType","badgeTextType","backgroundColorOfAdBadge","backgroundColor","textColorOfAdBadge","textColor","dynamicContentParametersString","_generateDynamicContentParametersString","key","dynamicContentParameters","resultString","sortedKeyList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AhB;AACD;;AAEDA,MAAAA,YAAY,IAAK,GAAEF,GAAI,IAAGM,WAAY,EAAtC;AACD;;AAED,WAAOJ,YAAP;AACD;;AAvHuE","sourcesContent":["import React from 'react';\n\nimport type {\n EmitterSubscription,\n NativeSyntheticEvent,\n StyleProp,\n ViewStyle,\n} from 'react-native';\n\nimport FireworkSDK from '../FireworkSDK';\nimport type FWError from '../models/FWError';\nimport { FWEventName } from '../models/FWEventName';\nimport type { StoryBlockSource } from '../models/StoryBlockSource';\nimport { FireworkSDKModuleEventEmitter } from '../modules/FireworkSDKModule';\nimport FWLoggerUtil from '../utils/FWLoggerUtil';\nimport FWStoryBlock from './FWStoryBlock';\nimport { findNodeHandle, UIManager, Platform } from 'react-native';\n\nconst NativeComponentName = 'FWStoryBlock';\n\nconst createFragment = (viewId: any) => {\n if (Platform.OS === 'android') {\n UIManager.dispatchViewManagerCommand(\n viewId,\n UIManager.getViewManagerConfig(\n NativeComponentName\n ).Commands.create.toString(),\n [viewId]\n );\n }\n};\n\nexport interface IStoryBlockProps {\n /**\n * Standard React Native View Style.\n */\n style?: StyleProp<ViewStyle>;\n /**\n * One of four available story block sources.\n */\n source: StoryBlockSource;\n /**\n * Channel id of the story block. Required when the source is set as channel or playlist or dynamicContent.\n */\n channel?: string;\n /**\n * Playlist id of the story block. Please note channel id is necessary. Required when the source is set as playlist.\n */\n playlist?: string;\n /**\n * The dynamic content parameters of the story block. Required when the source is set as dynamicContent.\n */\n dynamicContentParameters?: { [key: string]: string[] };\n /**\n * The feed loading result callback. It means loading successfully when error equals to undefined.\n */\n onStoryBlockLoadFinished?: (error?: FWError) => void;\n}\n\nexport default class StoryBlock extends React.Component<IStoryBlockProps> {\n nativeComponentRef = React.createRef<any>();\n\n subscriptions: EmitterSubscription[] = [];\n componentDidMount() {\n const subscriptionOfShareBaseURLUpdated =\n FireworkSDKModuleEventEmitter.addListener(\n FWEventName.ShareBaseURLUpdated,\n () => {\n this.setState({});\n }\n );\n this.subscriptions.push(subscriptionOfShareBaseURLUpdated);\n\n const subscriptionOfAdBadgeConfigurationUpdated =\n FireworkSDKModuleEventEmitter.addListener(\n FWEventName.AdBadgeConfigurationUpdated,\n () => {\n this.setState({});\n }\n );\n this.subscriptions.push(subscriptionOfAdBadgeConfigurationUpdated);\n\n if (Platform.OS === 'android') {\n const viewId = findNodeHandle(this.nativeComponentRef.current);\n FWLoggerUtil.log(\n `StoryBlock componentDidMount createFragment viewId: ${viewId}`\n );\n createFragment(viewId);\n }\n }\n\n componentWillUnmount() {\n this.subscriptions.forEach((value) => {\n value.remove();\n });\n\n this.subscriptions = [];\n }\n\n render() {\n const { style } = this.props;\n\n return (\n <FWStoryBlock\n ref={this.nativeComponentRef}\n key={this._generateKey()}\n {...this.props}\n onStoryBlockLoadFinished={this._onStoryBlockLoadFinished}\n style={Object.assign({}, style, { zIndex: -1 })}\n />\n );\n }\n\n private _onStoryBlockLoadFinished = (event: NativeSyntheticEvent<any>) => {\n FWLoggerUtil.log(\n `StoryBlock _onStoryBlockLoadFinished ${event.nativeEvent.name}`\n );\n\n const { onStoryBlockLoadFinished } = this.props;\n const { name, reason } = event.nativeEvent;\n\n if (onStoryBlockLoadFinished) {\n if (name) {\n if (reason) {\n onStoryBlockLoadFinished({ name, reason });\n } else {\n onStoryBlockLoadFinished({ name });\n }\n } else {\n onStoryBlockLoadFinished();\n }\n }\n };\n\n private _generateKey(): string {\n const { source, channel = '', playlist = '' } = this.props;\n\n const shareBaseURL = FireworkSDK.getInstance().shareBaseURL ?? '';\n const adBadgeConfiguration =\n FireworkSDK.getInstance().adBadgeConfiguration ?? {};\n const adBadgeTextType = adBadgeConfiguration.badgeTextType ?? '';\n const backgroundColorOfAdBadge = adBadgeConfiguration.backgroundColor ?? '';\n const textColorOfAdBadge = adBadgeConfiguration.textColor ?? '';\n const dynamicContentParametersString =\n this._generateDynamicContentParametersString();\n\n let key = `source:${source}`;\n key += `_channel:${channel}`;\n key += `_playlist:${playlist}`;\n key += `_shareBaseURL:${shareBaseURL}`;\n key += `_adBadgeTextType:${adBadgeTextType}`;\n key += `_backgroundColorOfAdBadge:${backgroundColorOfAdBadge}`;\n key += `_textColorOfAdBadge:${textColorOfAdBadge}`;\n key += `_dynamicContentParameters:${dynamicContentParametersString}`;\n\n return key;\n }\n\n private _generateDynamicContentParametersString(): string {\n const { dynamicContentParameters } = this.props;\n\n if (!dynamicContentParameters) {\n return '';\n }\n\n let resultString = '';\n const sortedKeyList = Object.keys(dynamicContentParameters).sort();\n for (const key of sortedKeyList) {\n const value = dynamicContentParameters[key];\n const valueString = value.join(',');\n if (resultString.length > 0) {\n resultString += '_';\n }\n\n resultString += `${key}:${valueString}`;\n }\n\n return resultString;\n }\n}\n"]}
1
+ {"version":3,"sources":["StoryBlock.tsx"],"names":["NativeComponentName","createFragment","viewId","Platform","OS","UIManager","dispatchViewManagerCommand","getViewManagerConfig","Commands","create","toString","StoryBlock","React","Component","createRef","event","FWLoggerUtil","log","nativeEvent","name","onStoryBlockLoadFinished","props","reason","componentDidMount","subscriptionOfShareBaseURLUpdated","FireworkSDKModuleEventEmitter","addListener","FWEventName","ShareBaseURLUpdated","setState","subscriptions","push","subscriptionOfAdBadgeConfigurationUpdated","AdBadgeConfigurationUpdated","nativeComponentRef","current","componentWillUnmount","forEach","value","remove","render","style","_generateKey","_onStoryBlockLoadFinished","Object","assign","zIndex","source","channel","playlist","enablePictureInPicture","shareBaseURL","FireworkSDK","getInstance","adBadgeConfiguration","adBadgeTextType","badgeTextType","backgroundColorOfAdBadge","backgroundColor","textColorOfAdBadge","textColor","dynamicContentParametersString","_generateDynamicContentParametersString","key","dynamicContentParameters","resultString","sortedKeyList","keys","sort","valueString","join","length"],"mappings":";;;;;;;AAAA;;AAQA;;AAEA;;AAEA;;AAEA;;AACA;;AACA;;;;;;;;AAEA,MAAMA,mBAAmB,GAAG,cAA5B;;AAEA,MAAMC,cAAc,GAAIC,MAAD,IAAiB;AACtC,MAAIC,sBAASC,EAAT,KAAgB,SAApB,EAA+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 'react';\n\nimport type {\n EmitterSubscription,\n NativeSyntheticEvent,\n StyleProp,\n ViewStyle,\n} from 'react-native';\nimport { findNodeHandle, Platform, UIManager } from 'react-native';\n\nimport FireworkSDK from '../FireworkSDK';\nimport type FWError from '../models/FWError';\nimport { FWEventName } from '../models/FWEventName';\nimport type { StoryBlockSource } from '../models/StoryBlockSource';\nimport { FireworkSDKModuleEventEmitter } from '../modules/FireworkSDKModule';\nimport FWLoggerUtil from '../utils/FWLoggerUtil';\nimport FWStoryBlock from './FWStoryBlock';\n\nconst NativeComponentName = 'FWStoryBlock';\n\nconst createFragment = (viewId: any) => {\n if (Platform.OS === 'android') {\n UIManager.dispatchViewManagerCommand(\n viewId,\n UIManager.getViewManagerConfig(\n NativeComponentName\n ).Commands.create.toString(),\n [viewId]\n );\n }\n};\n\nexport interface IStoryBlockProps {\n /**\n * Standard React Native View Style.\n */\n style?: StyleProp<ViewStyle>;\n /**\n * One of four available story block sources.\n */\n source: StoryBlockSource;\n /**\n * Channel id of the story block. Required when the source is set as channel or playlist or dynamicContent.\n */\n channel?: string;\n /**\n * Playlist id of the story block. Please note channel id is necessary. Required when the source is set as playlist.\n */\n playlist?: string;\n /**\n * The dynamic content parameters of the story block. Required when the source is set as dynamicContent.\n */\n dynamicContentParameters?: { [key: string]: string[] };\n /**\n * Specifies if Picture in Picture is enabled. Only supported on iOS.\n */\n enablePictureInPicture?: boolean;\n /**\n * The feed loading result callback. It means loading successfully when error equals to undefined.\n */\n onStoryBlockLoadFinished?: (error?: FWError) => void;\n}\n\nexport default class StoryBlock extends React.Component<IStoryBlockProps> {\n nativeComponentRef = React.createRef<any>();\n\n subscriptions: EmitterSubscription[] = [];\n componentDidMount() {\n const subscriptionOfShareBaseURLUpdated =\n FireworkSDKModuleEventEmitter.addListener(\n FWEventName.ShareBaseURLUpdated,\n () => {\n this.setState({});\n }\n );\n this.subscriptions.push(subscriptionOfShareBaseURLUpdated);\n\n const subscriptionOfAdBadgeConfigurationUpdated =\n FireworkSDKModuleEventEmitter.addListener(\n FWEventName.AdBadgeConfigurationUpdated,\n () => {\n this.setState({});\n }\n );\n this.subscriptions.push(subscriptionOfAdBadgeConfigurationUpdated);\n\n if (Platform.OS === 'android') {\n const viewId = findNodeHandle(this.nativeComponentRef.current);\n FWLoggerUtil.log(\n `StoryBlock componentDidMount createFragment viewId: ${viewId}`\n );\n createFragment(viewId);\n }\n }\n\n componentWillUnmount() {\n this.subscriptions.forEach((value) => {\n value.remove();\n });\n\n this.subscriptions = [];\n }\n\n render() {\n const { style } = this.props;\n\n return (\n <FWStoryBlock\n ref={this.nativeComponentRef}\n key={this._generateKey()}\n {...this.props}\n onStoryBlockLoadFinished={this._onStoryBlockLoadFinished}\n style={Object.assign({}, style, { zIndex: -1 })}\n />\n );\n }\n\n private _onStoryBlockLoadFinished = (event: NativeSyntheticEvent<any>) => {\n FWLoggerUtil.log(\n `StoryBlock _onStoryBlockLoadFinished ${event.nativeEvent.name}`\n );\n\n const { onStoryBlockLoadFinished } = this.props;\n const { name, reason } = event.nativeEvent;\n\n if (onStoryBlockLoadFinished) {\n if (name) {\n if (reason) {\n onStoryBlockLoadFinished({ name, reason });\n } else {\n onStoryBlockLoadFinished({ name });\n }\n } else {\n onStoryBlockLoadFinished();\n }\n }\n };\n\n private _generateKey(): string {\n const {\n source,\n channel = '',\n playlist = '',\n enablePictureInPicture = false,\n } = this.props;\n\n const shareBaseURL = FireworkSDK.getInstance().shareBaseURL ?? '';\n const adBadgeConfiguration =\n FireworkSDK.getInstance().adBadgeConfiguration ?? {};\n const adBadgeTextType = adBadgeConfiguration.badgeTextType ?? '';\n const backgroundColorOfAdBadge = adBadgeConfiguration.backgroundColor ?? '';\n const textColorOfAdBadge = adBadgeConfiguration.textColor ?? '';\n const dynamicContentParametersString =\n this._generateDynamicContentParametersString();\n\n let key = `source:${source}`;\n key += `_channel:${channel}`;\n key += `_playlist:${playlist}`;\n key += `_shareBaseURL:${shareBaseURL}`;\n key += `_adBadgeTextType:${adBadgeTextType}`;\n key += `_backgroundColorOfAdBadge:${backgroundColorOfAdBadge}`;\n key += `_textColorOfAdBadge:${textColorOfAdBadge}`;\n key += `_dynamicContentParameters:${dynamicContentParametersString}`;\n key += `_enablePictureInPicture:${enablePictureInPicture}`;\n\n return key;\n }\n\n private _generateDynamicContentParametersString(): string {\n const { dynamicContentParameters } = this.props;\n\n if (!dynamicContentParameters) {\n return '';\n }\n\n let resultString = '';\n const sortedKeyList = Object.keys(dynamicContentParameters).sort();\n for (const key of sortedKeyList) {\n const value = dynamicContentParameters[key];\n const valueString = value.join(',');\n if (resultString.length > 0) {\n resultString += '_';\n }\n\n resultString += `${key}:${valueString}`;\n }\n\n return resultString;\n }\n}\n"]}
@@ -3,12 +3,12 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
3
3
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
4
4
 
5
5
  import React from 'react';
6
+ import { findNodeHandle, Platform, UIManager } from 'react-native';
6
7
  import FireworkSDK from '../FireworkSDK';
7
8
  import { FWEventName } from '../models/FWEventName';
8
9
  import { FireworkSDKModuleEventEmitter } from '../modules/FireworkSDKModule';
9
10
  import FWLoggerUtil from '../utils/FWLoggerUtil';
10
11
  import FWStoryBlock from './FWStoryBlock';
11
- import { findNodeHandle, UIManager, Platform } from 'react-native';
12
12
  const NativeComponentName = 'FWStoryBlock';
13
13
 
14
14
  const createFragment = viewId => {
@@ -99,7 +99,8 @@ export default class StoryBlock extends React.Component {
99
99
  const {
100
100
  source,
101
101
  channel = '',
102
- playlist = ''
102
+ playlist = '',
103
+ enablePictureInPicture = false
103
104
  } = this.props;
104
105
  const shareBaseURL = (_FireworkSDK$getInsta = FireworkSDK.getInstance().shareBaseURL) !== null && _FireworkSDK$getInsta !== void 0 ? _FireworkSDK$getInsta : '';
105
106
  const adBadgeConfiguration = (_FireworkSDK$getInsta2 = FireworkSDK.getInstance().adBadgeConfiguration) !== null && _FireworkSDK$getInsta2 !== void 0 ? _FireworkSDK$getInsta2 : {};
@@ -117,6 +118,7 @@ export default class StoryBlock extends React.Component {
117
118
  key += `_backgroundColorOfAdBadge:${backgroundColorOfAdBadge}`;
118
119
  key += `_textColorOfAdBadge:${textColorOfAdBadge}`;
119
120
  key += `_dynamicContentParameters:${dynamicContentParametersString}`;
121
+ key += `_enablePictureInPicture:${enablePictureInPicture}`;
120
122
  return key;
121
123
  }
122
124
 
@@ -1 +1 @@
1
- {"version":3,"sources":["StoryBlock.tsx"],"names":["React","FireworkSDK","FWEventName","FireworkSDKModuleEventEmitter","FWLoggerUtil","FWStoryBlock","findNodeHandle","UIManager","Platform","NativeComponentName","createFragment","viewId","OS","dispatchViewManagerCommand","getViewManagerConfig","Commands","create","toString","StoryBlock","Component","createRef","event","log","nativeEvent","name","onStoryBlockLoadFinished","props","reason","componentDidMount","subscriptionOfShareBaseURLUpdated","addListener","ShareBaseURLUpdated","setState","subscriptions","push","subscriptionOfAdBadgeConfigurationUpdated","AdBadgeConfigurationUpdated","nativeComponentRef","current","componentWillUnmount","forEach","value","remove","render","style","_generateKey","_onStoryBlockLoadFinished","Object","assign","zIndex","source","channel","playlist","shareBaseURL","getInstance","adBadgeConfiguration","adBadgeTextType","badgeTextType","backgroundColorOfAdBadge","backgroundColor","textColorOfAdBadge","textColor","dynamicContentParametersString","_generateDynamicContentParametersString","key","dynamicContentParameters","resultString","sortedKeyList","keys","sort","valueString","join","length"],"mappings":";;;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AASA,OAAOC,WAAP,MAAwB,gBAAxB;AAEA,SAASC,WAAT,QAA4B,uBAA5B;AAEA,SAASC,6BAAT,QAA8C,8BAA9C;AACA,OAAOC,YAAP,MAAyB,uBAAzB;AACA,OAAOC,YAAP,MAAyB,gBAAzB;AACA,SAASC,cAAT,EAAyBC,SAAzB,EAAoCC,QAApC,QAAoD,cAApD;AAEA,MAAMC,mBAAmB,GAAG,cAA5B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AEDA,MAAAA,YAAY,IAAK,GAAEF,GAAI,IAAGM,WAAY,EAAtC;AACD;;AAED,WAAOJ,YAAP;AACD;;AAvHuE","sourcesContent":["import React from 'react';\n\nimport type {\n EmitterSubscription,\n NativeSyntheticEvent,\n StyleProp,\n ViewStyle,\n} from 'react-native';\n\nimport FireworkSDK from '../FireworkSDK';\nimport type FWError from '../models/FWError';\nimport { FWEventName } from '../models/FWEventName';\nimport type { StoryBlockSource } from '../models/StoryBlockSource';\nimport { FireworkSDKModuleEventEmitter } from '../modules/FireworkSDKModule';\nimport FWLoggerUtil from '../utils/FWLoggerUtil';\nimport FWStoryBlock from './FWStoryBlock';\nimport { findNodeHandle, UIManager, Platform } from 'react-native';\n\nconst NativeComponentName = 'FWStoryBlock';\n\nconst createFragment = (viewId: any) => {\n if (Platform.OS === 'android') {\n UIManager.dispatchViewManagerCommand(\n viewId,\n UIManager.getViewManagerConfig(\n NativeComponentName\n ).Commands.create.toString(),\n [viewId]\n );\n }\n};\n\nexport interface IStoryBlockProps {\n /**\n * Standard React Native View Style.\n */\n style?: StyleProp<ViewStyle>;\n /**\n * One of four available story block sources.\n */\n source: StoryBlockSource;\n /**\n * Channel id of the story block. Required when the source is set as channel or playlist or dynamicContent.\n */\n channel?: string;\n /**\n * Playlist id of the story block. Please note channel id is necessary. Required when the source is set as playlist.\n */\n playlist?: string;\n /**\n * The dynamic content parameters of the story block. Required when the source is set as dynamicContent.\n */\n dynamicContentParameters?: { [key: string]: string[] };\n /**\n * The feed loading result callback. It means loading successfully when error equals to undefined.\n */\n onStoryBlockLoadFinished?: (error?: FWError) => void;\n}\n\nexport default class StoryBlock extends React.Component<IStoryBlockProps> {\n nativeComponentRef = React.createRef<any>();\n\n subscriptions: EmitterSubscription[] = [];\n componentDidMount() {\n const subscriptionOfShareBaseURLUpdated =\n FireworkSDKModuleEventEmitter.addListener(\n FWEventName.ShareBaseURLUpdated,\n () => {\n this.setState({});\n }\n );\n this.subscriptions.push(subscriptionOfShareBaseURLUpdated);\n\n const subscriptionOfAdBadgeConfigurationUpdated =\n FireworkSDKModuleEventEmitter.addListener(\n FWEventName.AdBadgeConfigurationUpdated,\n () => {\n this.setState({});\n }\n );\n this.subscriptions.push(subscriptionOfAdBadgeConfigurationUpdated);\n\n if (Platform.OS === 'android') {\n const viewId = findNodeHandle(this.nativeComponentRef.current);\n FWLoggerUtil.log(\n `StoryBlock componentDidMount createFragment viewId: ${viewId}`\n );\n createFragment(viewId);\n }\n }\n\n componentWillUnmount() {\n this.subscriptions.forEach((value) => {\n value.remove();\n });\n\n this.subscriptions = [];\n }\n\n render() {\n const { style } = this.props;\n\n return (\n <FWStoryBlock\n ref={this.nativeComponentRef}\n key={this._generateKey()}\n {...this.props}\n onStoryBlockLoadFinished={this._onStoryBlockLoadFinished}\n style={Object.assign({}, style, { zIndex: -1 })}\n />\n );\n }\n\n private _onStoryBlockLoadFinished = (event: NativeSyntheticEvent<any>) => {\n FWLoggerUtil.log(\n `StoryBlock _onStoryBlockLoadFinished ${event.nativeEvent.name}`\n );\n\n const { onStoryBlockLoadFinished } = this.props;\n const { name, reason } = event.nativeEvent;\n\n if (onStoryBlockLoadFinished) {\n if (name) {\n if (reason) {\n onStoryBlockLoadFinished({ name, reason });\n } else {\n onStoryBlockLoadFinished({ name });\n }\n } else {\n onStoryBlockLoadFinished();\n }\n }\n };\n\n private _generateKey(): string {\n const { source, channel = '', playlist = '' } = this.props;\n\n const shareBaseURL = FireworkSDK.getInstance().shareBaseURL ?? '';\n const adBadgeConfiguration =\n FireworkSDK.getInstance().adBadgeConfiguration ?? {};\n const adBadgeTextType = adBadgeConfiguration.badgeTextType ?? '';\n const backgroundColorOfAdBadge = adBadgeConfiguration.backgroundColor ?? '';\n const textColorOfAdBadge = adBadgeConfiguration.textColor ?? '';\n const dynamicContentParametersString =\n this._generateDynamicContentParametersString();\n\n let key = `source:${source}`;\n key += `_channel:${channel}`;\n key += `_playlist:${playlist}`;\n key += `_shareBaseURL:${shareBaseURL}`;\n key += `_adBadgeTextType:${adBadgeTextType}`;\n key += `_backgroundColorOfAdBadge:${backgroundColorOfAdBadge}`;\n key += `_textColorOfAdBadge:${textColorOfAdBadge}`;\n key += `_dynamicContentParameters:${dynamicContentParametersString}`;\n\n return key;\n }\n\n private _generateDynamicContentParametersString(): string {\n const { dynamicContentParameters } = this.props;\n\n if (!dynamicContentParameters) {\n return '';\n }\n\n let resultString = '';\n const sortedKeyList = Object.keys(dynamicContentParameters).sort();\n for (const key of sortedKeyList) {\n const value = dynamicContentParameters[key];\n const valueString = value.join(',');\n if (resultString.length > 0) {\n resultString += '_';\n }\n\n resultString += `${key}:${valueString}`;\n }\n\n return resultString;\n }\n}\n"]}
1
+ {"version":3,"sources":["StoryBlock.tsx"],"names":["React","findNodeHandle","Platform","UIManager","FireworkSDK","FWEventName","FireworkSDKModuleEventEmitter","FWLoggerUtil","FWStoryBlock","NativeComponentName","createFragment","viewId","OS","dispatchViewManagerCommand","getViewManagerConfig","Commands","create","toString","StoryBlock","Component","createRef","event","log","nativeEvent","name","onStoryBlockLoadFinished","props","reason","componentDidMount","subscriptionOfShareBaseURLUpdated","addListener","ShareBaseURLUpdated","setState","subscriptions","push","subscriptionOfAdBadgeConfigurationUpdated","AdBadgeConfigurationUpdated","nativeComponentRef","current","componentWillUnmount","forEach","value","remove","render","style","_generateKey","_onStoryBlockLoadFinished","Object","assign","zIndex","source","channel","playlist","enablePictureInPicture","shareBaseURL","getInstance","adBadgeConfiguration","adBadgeTextType","badgeTextType","backgroundColorOfAdBadge","backgroundColor","textColorOfAdBadge","textColor","dynamicContentParametersString","_generateDynamicContentParametersString","key","dynamicContentParameters","resultString","sortedKeyList","keys","sort","valueString","join","length"],"mappings":";;;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AAQA,SAASC,cAAT,EAAyBC,QAAzB,EAAmCC,SAAnC,QAAoD,cAApD;AAEA,OAAOC,WAAP,MAAwB,gBAAxB;AAEA,SAASC,WAAT,QAA4B,uBAA5B;AAEA,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KAAK,GAAGyB,wBAAwB,CAACD,GAAD,CAAtC;AACA,YAAMM,WAAW,GAAG9B,KAAK,CAAC+B,IAAN,CAAW,GAAX,CAApB;;AACA,UAAIL,YAAY,CAACM,MAAb,GAAsB,CAA1B,EAA6B;AAC3BN,QAAAA,YAAY,IAAI,GAAhB;AACD;;AAEDA,MAAAA,YAAY,IAAK,GAAEF,GAAI,IAAGM,WAAY,EAAtC;AACD;;AAED,WAAOJ,YAAP;AACD;;AA7HuE","sourcesContent":["import React from 'react';\n\nimport type {\n EmitterSubscription,\n NativeSyntheticEvent,\n StyleProp,\n ViewStyle,\n} from 'react-native';\nimport { findNodeHandle, Platform, UIManager } from 'react-native';\n\nimport FireworkSDK from '../FireworkSDK';\nimport type FWError from '../models/FWError';\nimport { FWEventName } from '../models/FWEventName';\nimport type { StoryBlockSource } from '../models/StoryBlockSource';\nimport { FireworkSDKModuleEventEmitter } from '../modules/FireworkSDKModule';\nimport FWLoggerUtil from '../utils/FWLoggerUtil';\nimport FWStoryBlock from './FWStoryBlock';\n\nconst NativeComponentName = 'FWStoryBlock';\n\nconst createFragment = (viewId: any) => {\n if (Platform.OS === 'android') {\n UIManager.dispatchViewManagerCommand(\n viewId,\n UIManager.getViewManagerConfig(\n NativeComponentName\n ).Commands.create.toString(),\n [viewId]\n );\n }\n};\n\nexport interface IStoryBlockProps {\n /**\n * Standard React Native View Style.\n */\n style?: StyleProp<ViewStyle>;\n /**\n * One of four available story block sources.\n */\n source: StoryBlockSource;\n /**\n * Channel id of the story block. Required when the source is set as channel or playlist or dynamicContent.\n */\n channel?: string;\n /**\n * Playlist id of the story block. Please note channel id is necessary. Required when the source is set as playlist.\n */\n playlist?: string;\n /**\n * The dynamic content parameters of the story block. Required when the source is set as dynamicContent.\n */\n dynamicContentParameters?: { [key: string]: string[] };\n /**\n * Specifies if Picture in Picture is enabled. Only supported on iOS.\n */\n enablePictureInPicture?: boolean;\n /**\n * The feed loading result callback. It means loading successfully when error equals to undefined.\n */\n onStoryBlockLoadFinished?: (error?: FWError) => void;\n}\n\nexport default class StoryBlock extends React.Component<IStoryBlockProps> {\n nativeComponentRef = React.createRef<any>();\n\n subscriptions: EmitterSubscription[] = [];\n componentDidMount() {\n const subscriptionOfShareBaseURLUpdated =\n FireworkSDKModuleEventEmitter.addListener(\n FWEventName.ShareBaseURLUpdated,\n () => {\n this.setState({});\n }\n );\n this.subscriptions.push(subscriptionOfShareBaseURLUpdated);\n\n const subscriptionOfAdBadgeConfigurationUpdated =\n FireworkSDKModuleEventEmitter.addListener(\n FWEventName.AdBadgeConfigurationUpdated,\n () => {\n this.setState({});\n }\n );\n this.subscriptions.push(subscriptionOfAdBadgeConfigurationUpdated);\n\n if (Platform.OS === 'android') {\n const viewId = findNodeHandle(this.nativeComponentRef.current);\n FWLoggerUtil.log(\n `StoryBlock componentDidMount createFragment viewId: ${viewId}`\n );\n createFragment(viewId);\n }\n }\n\n componentWillUnmount() {\n this.subscriptions.forEach((value) => {\n value.remove();\n });\n\n this.subscriptions = [];\n }\n\n render() {\n const { style } = this.props;\n\n return (\n <FWStoryBlock\n ref={this.nativeComponentRef}\n key={this._generateKey()}\n {...this.props}\n onStoryBlockLoadFinished={this._onStoryBlockLoadFinished}\n style={Object.assign({}, style, { zIndex: -1 })}\n />\n );\n }\n\n private _onStoryBlockLoadFinished = (event: NativeSyntheticEvent<any>) => {\n FWLoggerUtil.log(\n `StoryBlock _onStoryBlockLoadFinished ${event.nativeEvent.name}`\n );\n\n const { onStoryBlockLoadFinished } = this.props;\n const { name, reason } = event.nativeEvent;\n\n if (onStoryBlockLoadFinished) {\n if (name) {\n if (reason) {\n onStoryBlockLoadFinished({ name, reason });\n } else {\n onStoryBlockLoadFinished({ name });\n }\n } else {\n onStoryBlockLoadFinished();\n }\n }\n };\n\n private _generateKey(): string {\n const {\n source,\n channel = '',\n playlist = '',\n enablePictureInPicture = false,\n } = this.props;\n\n const shareBaseURL = FireworkSDK.getInstance().shareBaseURL ?? '';\n const adBadgeConfiguration =\n FireworkSDK.getInstance().adBadgeConfiguration ?? {};\n const adBadgeTextType = adBadgeConfiguration.badgeTextType ?? '';\n const backgroundColorOfAdBadge = adBadgeConfiguration.backgroundColor ?? '';\n const textColorOfAdBadge = adBadgeConfiguration.textColor ?? '';\n const dynamicContentParametersString =\n this._generateDynamicContentParametersString();\n\n let key = `source:${source}`;\n key += `_channel:${channel}`;\n key += `_playlist:${playlist}`;\n key += `_shareBaseURL:${shareBaseURL}`;\n key += `_adBadgeTextType:${adBadgeTextType}`;\n key += `_backgroundColorOfAdBadge:${backgroundColorOfAdBadge}`;\n key += `_textColorOfAdBadge:${textColorOfAdBadge}`;\n key += `_dynamicContentParameters:${dynamicContentParametersString}`;\n key += `_enablePictureInPicture:${enablePictureInPicture}`;\n\n return key;\n }\n\n private _generateDynamicContentParametersString(): string {\n const { dynamicContentParameters } = this.props;\n\n if (!dynamicContentParameters) {\n return '';\n }\n\n let resultString = '';\n const sortedKeyList = Object.keys(dynamicContentParameters).sort();\n for (const key of sortedKeyList) {\n const value = dynamicContentParameters[key];\n const valueString = value.join(',');\n if (resultString.length > 0) {\n resultString += '_';\n }\n\n resultString += `${key}:${valueString}`;\n }\n\n return resultString;\n }\n}\n"]}
@@ -25,6 +25,10 @@ export interface IStoryBlockProps {
25
25
  dynamicContentParameters?: {
26
26
  [key: string]: string[];
27
27
  };
28
+ /**
29
+ * Specifies if Picture in Picture is enabled. Only supported on iOS.
30
+ */
31
+ enablePictureInPicture?: boolean;
28
32
  /**
29
33
  * The feed loading result callback. It means loading successfully when error equals to undefined.
30
34
  */
@@ -12,6 +12,10 @@ export default interface Product {
12
12
  * The description of the product.
13
13
  */
14
14
  description?: string | null;
15
+ /**
16
+ * The availability of the product. Only supported on iOS.
17
+ */
18
+ isAvailable?: boolean;
15
19
  /**
16
20
  * The unit array of the product
17
21
  */
@@ -27,6 +27,10 @@ export default interface ProductUnit {
27
27
  * The price of the product unit.
28
28
  */
29
29
  price?: ProductPrice;
30
+ /**
31
+ * The availability of the product unit. Only supported on iOS.
32
+ */
33
+ isAvailable?: boolean;
30
34
  /**
31
35
  * The options of the product unit.
32
36
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-firework-sdk",
3
- "version": "1.5.5",
3
+ "version": "1.6.0",
4
4
  "description": "Firework React Native SDK",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -28,6 +28,6 @@ cp $module_header_path "${PODS_ROOT}/Headers/Public/react_native_firework_sdk/"'
28
28
 
29
29
  s.dependency "React-Core"
30
30
 
31
- s.dependency "FireworkVideo", "1.3.0"
31
+ s.dependency "FireworkVideo", "1.5.0"
32
32
 
33
33
  end
@@ -6,6 +6,7 @@ import type {
6
6
  StyleProp,
7
7
  ViewStyle,
8
8
  } from 'react-native';
9
+ import { findNodeHandle, Platform, UIManager } from 'react-native';
9
10
 
10
11
  import FireworkSDK from '../FireworkSDK';
11
12
  import type FWError from '../models/FWError';
@@ -14,7 +15,6 @@ import type { StoryBlockSource } from '../models/StoryBlockSource';
14
15
  import { FireworkSDKModuleEventEmitter } from '../modules/FireworkSDKModule';
15
16
  import FWLoggerUtil from '../utils/FWLoggerUtil';
16
17
  import FWStoryBlock from './FWStoryBlock';
17
- import { findNodeHandle, UIManager, Platform } from 'react-native';
18
18
 
19
19
  const NativeComponentName = 'FWStoryBlock';
20
20
 
@@ -51,6 +51,10 @@ export interface IStoryBlockProps {
51
51
  * The dynamic content parameters of the story block. Required when the source is set as dynamicContent.
52
52
  */
53
53
  dynamicContentParameters?: { [key: string]: string[] };
54
+ /**
55
+ * Specifies if Picture in Picture is enabled. Only supported on iOS.
56
+ */
57
+ enablePictureInPicture?: boolean;
54
58
  /**
55
59
  * The feed loading result callback. It means loading successfully when error equals to undefined.
56
60
  */
@@ -133,7 +137,12 @@ export default class StoryBlock extends React.Component<IStoryBlockProps> {
133
137
  };
134
138
 
135
139
  private _generateKey(): string {
136
- const { source, channel = '', playlist = '' } = this.props;
140
+ const {
141
+ source,
142
+ channel = '',
143
+ playlist = '',
144
+ enablePictureInPicture = false,
145
+ } = this.props;
137
146
 
138
147
  const shareBaseURL = FireworkSDK.getInstance().shareBaseURL ?? '';
139
148
  const adBadgeConfiguration =
@@ -152,6 +161,7 @@ export default class StoryBlock extends React.Component<IStoryBlockProps> {
152
161
  key += `_backgroundColorOfAdBadge:${backgroundColorOfAdBadge}`;
153
162
  key += `_textColorOfAdBadge:${textColorOfAdBadge}`;
154
163
  key += `_dynamicContentParameters:${dynamicContentParametersString}`;
164
+ key += `_enablePictureInPicture:${enablePictureInPicture}`;
155
165
 
156
166
  return key;
157
167
  }
@@ -13,6 +13,10 @@ export default interface Product {
13
13
  * The description of the product.
14
14
  */
15
15
  description?: string | null;
16
+ /**
17
+ * The availability of the product. Only supported on iOS.
18
+ */
19
+ isAvailable?: boolean;
16
20
  /**
17
21
  * The unit array of the product
18
22
  */
@@ -29,6 +29,10 @@ export default interface ProductUnit {
29
29
  * The price of the product unit.
30
30
  */
31
31
  price?: ProductPrice;
32
+ /**
33
+ * The availability of the product unit. Only supported on iOS.
34
+ */
35
+ isAvailable?: boolean;
32
36
  /**
33
37
  * The options of the product unit.
34
38
  */