react-native-firework-sdk 2.0.0-beta.5 → 2.0.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.
@@ -44,9 +44,9 @@ class StoryBlock extends _react.default.Component {
44
44
  constructor() {
45
45
  super(...arguments);
46
46
 
47
- _defineProperty(this, "nativeComponentRef", /*#__PURE__*/_react.default.createRef());
47
+ _defineProperty(this, "_nativeComponentRef", /*#__PURE__*/_react.default.createRef());
48
48
 
49
- _defineProperty(this, "subscriptions", []);
49
+ _defineProperty(this, "_subscriptions", []);
50
50
 
51
51
  _defineProperty(this, "_onStoryBlockLoadFinished", event => {
52
52
  _FWLoggerUtil.default.log(`StoryBlock _onStoryBlockLoadFinished ${event.nativeEvent.name}`);
@@ -78,18 +78,21 @@ class StoryBlock extends _react.default.Component {
78
78
  });
79
79
  }
80
80
 
81
+ /**
82
+ * @ignore
83
+ */
81
84
  componentDidMount() {
82
85
  const subscriptionOfShareBaseURLUpdated = _FireworkSDKModule.FireworkSDKModuleEventEmitter.addListener(_FWEventName.FWEventName.ShareBaseURLUpdated, () => {
83
86
  this.setState({});
84
87
  });
85
88
 
86
- this.subscriptions.push(subscriptionOfShareBaseURLUpdated);
89
+ this._subscriptions.push(subscriptionOfShareBaseURLUpdated);
87
90
 
88
91
  const subscriptionOfAdBadgeConfigurationUpdated = _FireworkSDKModule.FireworkSDKModuleEventEmitter.addListener(_FWEventName.FWEventName.AdBadgeConfigurationUpdated, () => {
89
92
  this.setState({});
90
93
  });
91
94
 
92
- this.subscriptions.push(subscriptionOfAdBadgeConfigurationUpdated);
95
+ this._subscriptions.push(subscriptionOfAdBadgeConfigurationUpdated);
93
96
 
94
97
  const subscriptionOfVideoLaunchBehaviorUpdated = _FireworkSDKModule.FireworkSDKModuleEventEmitter.addListener(_FWEventName.FWEventName.VideoLaunchBehaviorUpdated, () => {
95
98
  _FWLoggerUtil.default.log('Receive FWEventName.VideoLaunchBehaviorUpdated');
@@ -97,30 +100,39 @@ class StoryBlock extends _react.default.Component {
97
100
  this.setState({});
98
101
  });
99
102
 
100
- this.subscriptions.push(subscriptionOfVideoLaunchBehaviorUpdated);
103
+ this._subscriptions.push(subscriptionOfVideoLaunchBehaviorUpdated);
101
104
 
102
105
  if (_reactNative.Platform.OS === 'android') {
103
- const viewId = (0, _reactNative.findNodeHandle)(this.nativeComponentRef.current);
106
+ const viewId = (0, _reactNative.findNodeHandle)(this._nativeComponentRef.current);
104
107
 
105
108
  _FWLoggerUtil.default.log(`StoryBlock componentDidMount createFragment viewId: ${viewId}`);
106
109
 
107
110
  createFragment(viewId);
108
111
  }
109
112
  }
113
+ /**
114
+ * @ignore
115
+ */
116
+
110
117
 
111
118
  componentWillUnmount() {
112
- this.subscriptions.forEach(value => {
119
+ this._subscriptions.forEach(value => {
113
120
  value.remove();
114
121
  });
115
- this.subscriptions = [];
122
+
123
+ this._subscriptions = [];
116
124
  }
125
+ /**
126
+ * @ignore
127
+ */
128
+
117
129
 
118
130
  render() {
119
131
  const {
120
132
  style
121
133
  } = this.props;
122
134
  return /*#__PURE__*/_react.default.createElement(_FWStoryBlock.default, _extends({
123
- ref: this.nativeComponentRef,
135
+ ref: this._nativeComponentRef,
124
136
  key: this._generateKey()
125
137
  }, this.props, {
126
138
  onStoryBlockLoadFinished: this._onStoryBlockLoadFinished,
@@ -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","subscriptionOfVideoLaunchBehaviorUpdated","VideoLaunchBehaviorUpdated","nativeComponentRef","current","componentWillUnmount","forEach","value","remove","render","style","_generateKey","_onStoryBlockLoadFinished","Object","assign","zIndex","source","channel","playlist","enablePictureInPicture","shareBaseURL","FireworkSDK","getInstance","getShareBaseURL","adBadgeConfiguration","getAdBadgeConfiguration","adBadgeTextType","badgeTextType","backgroundColorOfAdBadge","backgroundColor","textColorOfAdBadge","textColor","dynamicContentParametersString","_generateDynamicContentParametersString","videoLaunchBehavior","getVideoLaunchBehavior","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+B;AAC7BC,2BAAUC,0BAAV,CACEJ,MADF,EAEEG,uBAAUE,oBAAV,CACEP,mBADF,EAEEQ,QAFF,CAEWC,MAFX,CAEkBC,QAFlB,EAFF,EAKE,CAACR,MAAD,CALF;AAOD;AACF,CAVD;AAYA;AACA;AACA;;;AAgCA;AACA;AACA;AACA,MAAMS,UAAN,SAAyBC,eAAMC,SAA/B,CAA2D;AAAA;AAAA;;AAAA,6DACpCD,eAAME,SAAN,EADoC;;AAAA,2CAGlB,EAHkB;;AAAA,uDAgEpBC,KAAD,IAAsC;AACxEC,4BAAaC,GAAb,CACG,wCAAuCF,KAAK,CAACG,WAAN,CAAkBC,IAAK,EADjE;;AAIA,YAAM;AAAEC,QAAAA;AAAF,UAA+B,KAAKC,KAA1C;AACA,YAAM;AAAEF,QAAAA,IAAF;AAAQG,QAAAA;AAAR,UAAmBP,KAAK,CAACG,WAA/B;;AAEA,UAAIE,wBAAJ,EAA8B;AAC5B,YAAID,IAAJ,EAAU;AACR,cAAIG,MAAJ,EAAY;AACVF,YAAAA,wBAAwB,CAAC;AAAED,cAAAA,IAAF;AAAQG,cAAAA;AAAR,aAAD,CAAxB;AACD,WAF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A,GAAG,IAAK,6BAA4BR,wBAAyB,EAA7D;AACAQ,IAAAA,GAAG,IAAK,uBAAsBN,kBAAmB,EAAjD;AACAM,IAAAA,GAAG,IAAK,6BAA4BJ,8BAA+B,EAAnE;AACAI,IAAAA,GAAG,IAAK,2BAA0BjB,sBAAuB,EAAzD;AACAiB,IAAAA,GAAG,IAAK,wBAAuBF,mBAAoB,EAAnD;AAEA,WAAOE,GAAP;AACD;;AAEOH,EAAAA,uCAAuC,GAAW;AACxD,UAAM;AAAEI,MAAAA;AAAF,QAA+B,KAAKjD,KAA1C;;AAEA,QAAI,CAACiD,wBAAL,EAA+B;AAC7B,aAAO,EAAP;AACD;;AAED,QAAIC,YAAY,GAAG,EAAnB;AACA,UAAMC,aAAa,GAAG1B,MAAM,CAAC2B,IAAP,CAAYH,wBAAZ,EAAsCI,IAAtC,EAAtB;;AACA,SAAK,MAAML,GAAX,IAAkBG,aAAlB,EAAiC;AAC/B,YAAMhC,KAAK,GAAG8B,wBAAwB,CAACD,GAAD,CAAtC;AACA,YAAMM,WAAW,GAAGnC,KAAK,CAACoC,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;;AA1IwD;;eA6I5C5D,U","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\n/**\n * The props type of StoryBlock component.\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.\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\n/**\n * StoryBlock component. Only supported on iOS.\n */\nclass 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 const subscriptionOfVideoLaunchBehaviorUpdated =\n FireworkSDKModuleEventEmitter.addListener(\n FWEventName.VideoLaunchBehaviorUpdated,\n () => {\n FWLoggerUtil.log('Receive FWEventName.VideoLaunchBehaviorUpdated');\n this.setState({});\n }\n );\n this.subscriptions.push(subscriptionOfVideoLaunchBehaviorUpdated);\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().getShareBaseURL() ?? '';\n const adBadgeConfiguration =\n FireworkSDK.getInstance().getAdBadgeConfiguration() ?? {};\n const adBadgeTextType = adBadgeConfiguration.badgeTextType ?? '';\n const backgroundColorOfAdBadge = adBadgeConfiguration.backgroundColor ?? '';\n const textColorOfAdBadge = adBadgeConfiguration.textColor ?? '';\n const dynamicContentParametersString =\n this._generateDynamicContentParametersString();\n const videoLaunchBehavior =\n FireworkSDK.getInstance().getVideoLaunchBehavior() ?? 'default';\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 key += `_videoLaunchBehavior:${videoLaunchBehavior}`;\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\nexport default StoryBlock;\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","subscriptionOfVideoLaunchBehaviorUpdated","VideoLaunchBehaviorUpdated","_nativeComponentRef","current","componentWillUnmount","forEach","value","remove","render","style","_generateKey","_onStoryBlockLoadFinished","Object","assign","zIndex","source","channel","playlist","enablePictureInPicture","shareBaseURL","FireworkSDK","getInstance","getShareBaseURL","adBadgeConfiguration","getAdBadgeConfiguration","adBadgeTextType","badgeTextType","backgroundColorOfAdBadge","backgroundColor","textColorOfAdBadge","textColor","dynamicContentParametersString","_generateDynamicContentParametersString","videoLaunchBehavior","getVideoLaunchBehavior","key","dynamicContentParameters","resultString","sortedKeyList","keys","sort","valueString","join","length"],"mappings":";;;;;;;AAAA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GAAW;AACxD,UAAM;AAAEI,MAAAA;AAAF,QAA+B,KAAKjD,KAA1C;;AAEA,QAAI,CAACiD,wBAAL,EAA+B;AAC7B,aAAO,EAAP;AACD;;AAED,QAAIC,YAAY,GAAG,EAAnB;AACA,UAAMC,aAAa,GAAG1B,MAAM,CAAC2B,IAAP,CAAYH,wBAAZ,EAAsCI,IAAtC,EAAtB;;AACA,SAAK,MAAML,GAAX,IAAkBG,aAAlB,EAAiC;AAC/B,YAAMhC,KAAK,GAAG8B,wBAAwB,CAACD,GAAD,CAAtC;AACA,YAAMM,WAAW,GAAGnC,KAAK,CAACoC,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;;AApJwD;;eAuJ5C5D,U","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\n/**\n * The props type of StoryBlock component.\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.\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\n/**\n * StoryBlock component. Only supported on iOS.\n */\nclass StoryBlock extends React.Component<IStoryBlockProps> {\n private _nativeComponentRef = React.createRef<any>();\n\n private _subscriptions: EmitterSubscription[] = [];\n\n /**\n * @ignore\n */\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 const subscriptionOfVideoLaunchBehaviorUpdated =\n FireworkSDKModuleEventEmitter.addListener(\n FWEventName.VideoLaunchBehaviorUpdated,\n () => {\n FWLoggerUtil.log('Receive FWEventName.VideoLaunchBehaviorUpdated');\n this.setState({});\n }\n );\n this._subscriptions.push(subscriptionOfVideoLaunchBehaviorUpdated);\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 /**\n * @ignore\n */\n componentWillUnmount() {\n this._subscriptions.forEach((value) => {\n value.remove();\n });\n\n this._subscriptions = [];\n }\n\n /**\n * @ignore\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().getShareBaseURL() ?? '';\n const adBadgeConfiguration =\n FireworkSDK.getInstance().getAdBadgeConfiguration() ?? {};\n const adBadgeTextType = adBadgeConfiguration.badgeTextType ?? '';\n const backgroundColorOfAdBadge = adBadgeConfiguration.backgroundColor ?? '';\n const textColorOfAdBadge = adBadgeConfiguration.textColor ?? '';\n const dynamicContentParametersString =\n this._generateDynamicContentParametersString();\n const videoLaunchBehavior =\n FireworkSDK.getInstance().getVideoLaunchBehavior() ?? 'default';\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 key += `_videoLaunchBehavior:${videoLaunchBehavior}`;\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\nexport default StoryBlock;\n"]}
@@ -34,14 +34,14 @@ class VideoFeed extends _react.default.Component {
34
34
  constructor() {
35
35
  super(...arguments);
36
36
 
37
- _defineProperty(this, "nativeComponentRef", /*#__PURE__*/_react.default.createRef());
37
+ _defineProperty(this, "_nativeComponentRef", /*#__PURE__*/_react.default.createRef());
38
38
 
39
- _defineProperty(this, "subscriptions", []);
39
+ _defineProperty(this, "_subscriptions", []);
40
40
 
41
41
  _defineProperty(this, "refresh", () => {
42
42
  _FWLoggerUtil.default.log(`VideoFeed refresh ${JSON.stringify(this.props)}`);
43
43
 
44
- const nativeNodeHandle = (0, _reactNative.findNodeHandle)(this.nativeComponentRef.current);
44
+ const nativeNodeHandle = (0, _reactNative.findNodeHandle)(this._nativeComponentRef.current);
45
45
 
46
46
  let commandId = _reactNative.UIManager.getViewManagerConfig(NativeComponentName).Commands.refresh;
47
47
 
@@ -82,6 +82,9 @@ class VideoFeed extends _react.default.Component {
82
82
  });
83
83
  }
84
84
 
85
+ /**
86
+ * @ignore
87
+ */
85
88
  componentDidMount() {
86
89
  _FWLoggerUtil.default.log(`VideoFeed componentDidMount ${JSON.stringify(this.props)}`);
87
90
 
@@ -91,7 +94,7 @@ class VideoFeed extends _react.default.Component {
91
94
  this.setState({});
92
95
  });
93
96
 
94
- this.subscriptions.push(subscriptionOfShareBaseURLUpdated);
97
+ this._subscriptions.push(subscriptionOfShareBaseURLUpdated);
95
98
 
96
99
  const subscriptionOfAdBadgeConfigurationUpdated = _FireworkSDKModule.FireworkSDKModuleEventEmitter.addListener(_FWEventName.FWEventName.AdBadgeConfigurationUpdated, () => {
97
100
  _FWLoggerUtil.default.log('Receive FWEventName.AdBadgeConfigurationUpdated');
@@ -99,7 +102,7 @@ class VideoFeed extends _react.default.Component {
99
102
  this.setState({});
100
103
  });
101
104
 
102
- this.subscriptions.push(subscriptionOfAdBadgeConfigurationUpdated);
105
+ this._subscriptions.push(subscriptionOfAdBadgeConfigurationUpdated);
103
106
 
104
107
  const subscriptionOfVideoLaunchBehaviorUpdated = _FireworkSDKModule.FireworkSDKModuleEventEmitter.addListener(_FWEventName.FWEventName.VideoLaunchBehaviorUpdated, () => {
105
108
  _FWLoggerUtil.default.log('Receive FWEventName.VideoLaunchBehaviorUpdated');
@@ -107,17 +110,26 @@ class VideoFeed extends _react.default.Component {
107
110
  this.setState({});
108
111
  });
109
112
 
110
- this.subscriptions.push(subscriptionOfVideoLaunchBehaviorUpdated);
113
+ this._subscriptions.push(subscriptionOfVideoLaunchBehaviorUpdated);
111
114
  }
115
+ /**
116
+ * @ignore
117
+ */
118
+
112
119
 
113
120
  componentWillUnmount() {
114
121
  _FWLoggerUtil.default.log(`VideoFeed componentWillUnmount ${JSON.stringify(this.props)}`);
115
122
 
116
- this.subscriptions.forEach(value => {
123
+ this._subscriptions.forEach(value => {
117
124
  value.remove();
118
125
  });
119
- this.subscriptions = [];
126
+
127
+ this._subscriptions = [];
120
128
  }
129
+ /**
130
+ * @ignore
131
+ */
132
+
121
133
 
122
134
  render() {
123
135
  var _videoFeedConfigurati, _videoFeedConfigurati2, _videoFeedConfigurati3, _FireworkSDK$getInsta, _FireworkSDK$getInsta2, _adBadgeConfiguration, _adBadgeConfiguration2, _adBadgeConfiguration3, _videoFeedConfigurati4, _videoFeedConfigurati5, _adConfiguration$requ, _adConfiguration$adsF, _videoFeedConfigurati6, _FireworkSDK$getInsta3;
@@ -178,7 +190,7 @@ class VideoFeed extends _react.default.Component {
178
190
  return /*#__PURE__*/_react.default.createElement(_FWVideoFeed.default, _extends({
179
191
  key: key
180
192
  }, this.props, {
181
- ref: this.nativeComponentRef,
193
+ ref: this._nativeComponentRef,
182
194
  onVideoFeedLoadFinished: this._onVideoFeedLoadFinished,
183
195
  mode: mode,
184
196
  style: Object.assign({}, this.props.style, {
@@ -1 +1 @@
1
- {"version":3,"sources":["VideoFeed.tsx"],"names":["NativeComponentName","VideoFeed","React","Component","createRef","FWLoggerUtil","log","JSON","stringify","props","nativeNodeHandle","nativeComponentRef","current","commandId","UIManager","getViewManagerConfig","Commands","refresh","Platform","OS","toString","dispatchViewManagerCommand","event","nativeEvent","onVideoFeedLoadFinished","name","reason","componentDidMount","subscriptionOfShareBaseURLUpdated","FireworkSDKModuleEventEmitter","addListener","FWEventName","ShareBaseURLUpdated","setState","subscriptions","push","subscriptionOfAdBadgeConfigurationUpdated","AdBadgeConfigurationUpdated","subscriptionOfVideoLaunchBehaviorUpdated","VideoLaunchBehaviorUpdated","componentWillUnmount","forEach","value","remove","render","source","channel","playlist","playlistGroup","mode","adConfiguration","enablePictureInPicture","videoFeedConfiguration","_getVideoFeedConfiguration","titleHidden","title","hidden","titlePosition","shareBaseURL","FireworkSDK","getInstance","getShareBaseURL","adBadgeConfiguration","getAdBadgeConfiguration","adBadgeTextType","badgeTextType","backgroundColorOfAdBadge","backgroundColor","textColorOfAdBadge","textColor","dynamicContentParametersString","_generateDynamicContentParametersString","enableAutoplay","gridColumns","requiresAds","adsFetchTimeout","vastAttributesString","_generateVastAttributesString","showAdBadge","videoLaunchBehavior","getVideoLaunchBehavior","key","_onVideoFeedLoadFinished","Object","assign","style","zIndex","dynamicContentParameters","resultString","sortedKeyList","keys","sort","valueString","join","length","vastAttributes","attribute","Math","floor"],"mappings":";;;;;;;AAAA;;AAEA;;AAUA;;AAEA;;AAKA;;AACA;;AACA;;;;;;;;AA0DA,MAAMA,mBAAmB,GAAG,aAA5B;AAEA;AACA;AACA;;AACA,MAAMC,SAAN,SAAwBC,eAAMC,SAA9B,CAAyD;AAAA;AAAA;;AAAA,6DAKlCD,eAAME,SAAN,EALkC;;AA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AK,GAAD,mBAAGQ,SAAS,CAACvE,IAAb,6DAAqB,EAAG,IAAGuE,SAAS,CAACtD,KAAM,EAA3D;AACD;;AAED,WAAO8C,YAAP;AACD;;AAEOnC,EAAAA,0BAA0B,GAAuC;AACvE,UAAM;AAAED,MAAAA;AAAF,QAA6B,KAAK3C,KAAxC;;AACA,QAAI,CAAC2C,sBAAL,EAA6B;AAC3B,aAAOA,sBAAP;AACD;;AAED,QACEA,sBAAsB,CAACqB,WAAvB,IACAwB,IAAI,CAACC,KAAL,CAAW9C,sBAAsB,CAACqB,WAAlC,MACErB,sBAAsB,CAACqB,WAH3B,EAIE;AACA,aAAO,EACL,GAAGrB,sBADE;AAELqB,QAAAA,WAAW,EAAEwB,IAAI,CAACC,KAAL,CAAW9C,sBAAsB,CAACqB,WAAlC;AAFR,OAAP;AAID,KATD,MASO;AACL,aAAOrB,sBAAP;AACD;AACF;;AA9NsD;;gBAAnDnD,S,kBACkB;AACpBgD,EAAAA,IAAI,EAAE;AADc,C;;eAgOThD,S","sourcesContent":["import React from 'react';\n\nimport {\n EmitterSubscription,\n findNodeHandle,\n NativeSyntheticEvent,\n Platform,\n StyleProp,\n UIManager,\n ViewStyle,\n} from 'react-native';\n\nimport FireworkSDK from '../FireworkSDK';\nimport type FWError from '../models/FWError';\nimport { FWEventName } from '../models/FWEventName';\nimport type AdConfiguration from '../models/AdConfiguration';\nimport type VideoFeedConfiguration from '../models/VideoFeedConfiguration';\nimport type { VideoFeedSource } from '../models/VideoFeedSource';\nimport type VideoPlayerConfiguration from '../models/VideoPlayerConfiguration';\nimport { FireworkSDKModuleEventEmitter } from '../modules/FireworkSDKModule';\nimport FWLoggerUtil from '../utils/FWLoggerUtil';\nimport FWVideoFeed from './FWVideoFeed';\n\nexport type VideoFeedMode = 'row' | 'column' | 'grid';\n\n/**\n * The props of VideoFeed component.\n */\nexport interface IVideoFeedProps {\n /**\n * Standard React Native View Style.\n */\n style?: StyleProp<ViewStyle>;\n /**\n * One of five available video feed sources.The playlistGroup is only supported on iOS\n */\n source: VideoFeedSource;\n /**\n * Channel id of the feed. Required when the source is set as channel or playlist or dynamicContent.\n */\n channel?: string;\n /**\n * Playlist id of the feed. Please note channel id is necessary. Required when the source is set as playlist.\n */\n playlist?: string;\n /**\n * PlaylistGroup id of the feed. Required when the source is set as playlistGroup. Only supported on iOS.\n */\n playlistGroup?: string;\n /**\n * The dynamic content parameters of the feed. Required when the source is set as dynamicContent.\n */\n dynamicContentParameters?: { [key: string]: string[] };\n /**\n * One of three available display modes. Defaults to row.\n */\n mode?: VideoFeedMode;\n /**\n * Configuration of the feed.\n */\n videoFeedConfiguration?: VideoFeedConfiguration;\n /**\n * Configuration of the player.\n */\n videoPlayerConfiguration?: VideoPlayerConfiguration;\n /**\n * Ad configuration of the feed. Only supported on iOS.\n */\n adConfiguration?: AdConfiguration;\n /**\n * Specifies if Picture in Picture is enabled.\n */\n enablePictureInPicture?: boolean;\n /**\n * The feed loading result callback. It means loading successfully when error equals to undefined. Only supported on iOS.\n */\n onVideoFeedLoadFinished?: (error?: FWError) => void;\n}\n\nconst NativeComponentName = 'FWVideoFeed';\n\n/**\n * VideoFeed component.\n */\nclass VideoFeed extends React.Component<IVideoFeedProps> {\n static defaultProps = {\n mode: 'row',\n };\n\n nativeComponentRef = React.createRef<any>();\n\n subscriptions: EmitterSubscription[] = [];\n\n /**\n * Force refreshing the video feed.\n */\n public refresh = () => {\n FWLoggerUtil.log(`VideoFeed refresh ${JSON.stringify(this.props)}`);\n\n const nativeNodeHandle = findNodeHandle(this.nativeComponentRef.current);\n\n let commandId: string | number =\n UIManager.getViewManagerConfig(NativeComponentName).Commands.refresh;\n if (Platform.OS === 'android') {\n commandId = commandId.toString();\n }\n\n UIManager.dispatchViewManagerCommand(\n findNodeHandle(nativeNodeHandle),\n commandId,\n []\n );\n };\n\n private _onVideoFeedLoadFinished = (event: NativeSyntheticEvent<any>) => {\n FWLoggerUtil.log(\n `VideoFeed _onVideoFeedLoadFinished ${JSON.stringify(event.nativeEvent)}`\n );\n const { onVideoFeedLoadFinished } = this.props;\n\n const { name, reason } = event.nativeEvent;\n\n if (onVideoFeedLoadFinished) {\n if (name) {\n if (reason) {\n onVideoFeedLoadFinished({ name, reason });\n } else {\n onVideoFeedLoadFinished({ name });\n }\n } else {\n onVideoFeedLoadFinished();\n }\n }\n };\n\n componentDidMount() {\n FWLoggerUtil.log(\n `VideoFeed componentDidMount ${JSON.stringify(this.props)}`\n );\n\n const subscriptionOfShareBaseURLUpdated =\n FireworkSDKModuleEventEmitter.addListener(\n FWEventName.ShareBaseURLUpdated,\n () => {\n FWLoggerUtil.log('Receive FWEventName.ShareBaseURLUpdated');\n this.setState({});\n }\n );\n this.subscriptions.push(subscriptionOfShareBaseURLUpdated);\n\n const subscriptionOfAdBadgeConfigurationUpdated =\n FireworkSDKModuleEventEmitter.addListener(\n FWEventName.AdBadgeConfigurationUpdated,\n () => {\n FWLoggerUtil.log('Receive FWEventName.AdBadgeConfigurationUpdated');\n this.setState({});\n }\n );\n this.subscriptions.push(subscriptionOfAdBadgeConfigurationUpdated);\n\n const subscriptionOfVideoLaunchBehaviorUpdated =\n FireworkSDKModuleEventEmitter.addListener(\n FWEventName.VideoLaunchBehaviorUpdated,\n () => {\n FWLoggerUtil.log('Receive FWEventName.VideoLaunchBehaviorUpdated');\n this.setState({});\n }\n );\n this.subscriptions.push(subscriptionOfVideoLaunchBehaviorUpdated);\n }\n\n componentWillUnmount() {\n FWLoggerUtil.log(\n `VideoFeed componentWillUnmount ${JSON.stringify(this.props)}`\n );\n\n this.subscriptions.forEach((value) => {\n value.remove();\n });\n\n this.subscriptions = [];\n }\n\n render() {\n FWLoggerUtil.log(`VideoFeed render ${JSON.stringify(this.props)}`);\n\n const {\n source,\n channel = '',\n playlist = '',\n playlistGroup = '',\n mode = 'row',\n adConfiguration,\n enablePictureInPicture = false,\n } = this.props;\n const videoFeedConfiguration = this._getVideoFeedConfiguration();\n const titleHidden = videoFeedConfiguration?.title?.hidden ?? false;\n const titlePosition = videoFeedConfiguration?.titlePosition ?? 'nested';\n const shareBaseURL = FireworkSDK.getInstance().getShareBaseURL() ?? '';\n const adBadgeConfiguration =\n FireworkSDK.getInstance().getAdBadgeConfiguration() ?? {};\n const adBadgeTextType = adBadgeConfiguration.badgeTextType ?? '';\n const backgroundColorOfAdBadge = adBadgeConfiguration.backgroundColor ?? '';\n const textColorOfAdBadge = adBadgeConfiguration.textColor ?? '';\n const dynamicContentParametersString =\n this._generateDynamicContentParametersString();\n const enableAutoplay = videoFeedConfiguration?.enableAutoplay ?? false;\n\n const gridColumns = videoFeedConfiguration?.gridColumns ?? 2;\n const requiresAds = adConfiguration?.requiresAds ?? false;\n const adsFetchTimeout = adConfiguration?.adsFetchTimeout ?? 10;\n const vastAttributesString = this._generateVastAttributesString();\n const showAdBadge = videoFeedConfiguration?.showAdBadge ?? false;\n const videoLaunchBehavior =\n FireworkSDK.getInstance().getVideoLaunchBehavior() ?? 'default';\n\n let key = `source:${source}`;\n key += `_channel:${channel}`;\n key += `_playlist:${playlist}`;\n key += `_playlistGroup:${playlistGroup}`;\n key += `_mode:${mode}`;\n key += `_titleHidden:${titleHidden}`;\n key += `_titlePosition:${titlePosition}`;\n key += `_shareBaseURL:${shareBaseURL}`;\n key += `_adBadgeTextType:${adBadgeTextType}`;\n key += `_backgroundColorOfAdBadge:${backgroundColorOfAdBadge}`;\n key += `_textColorOfAdBadge:${textColorOfAdBadge}`;\n key += `_dynamicContentParameters:${dynamicContentParametersString}`;\n key += `_enableAutoplay:${enableAutoplay}`;\n key += `_enablePictureInPicture:${enablePictureInPicture}`;\n key += `_gridColumns:${gridColumns}`;\n key += `_requiresAds:${requiresAds}`;\n key += `_adsFetchTimeout:${adsFetchTimeout}`;\n key += `_vastAttributes:${vastAttributesString}`;\n key += `_showAdBadge:${showAdBadge}`;\n key += `_videoLaunchBehavior:${videoLaunchBehavior}`;\n\n return (\n <FWVideoFeed\n key={key}\n {...this.props}\n ref={this.nativeComponentRef}\n onVideoFeedLoadFinished={this._onVideoFeedLoadFinished}\n mode={mode}\n style={Object.assign({}, this.props.style, { zIndex: -1 })}\n />\n );\n }\n\n private _generateDynamicContentParametersString(): string {\n const { dynamicContentParameters } = this.props;\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 private _generateVastAttributesString(): string {\n const { adConfiguration } = this.props;\n const vastAttributes = adConfiguration?.vastAttributes ?? '';\n if (!vastAttributes) {\n return '';\n }\n\n let resultString = '';\n for (const attribute of vastAttributes) {\n if (resultString.length > 0) {\n resultString += '_';\n }\n resultString += `${attribute.name ?? ''}:${attribute.value}`;\n }\n\n return resultString;\n }\n\n private _getVideoFeedConfiguration(): VideoFeedConfiguration | undefined {\n const { videoFeedConfiguration } = this.props;\n if (!videoFeedConfiguration) {\n return videoFeedConfiguration;\n }\n\n if (\n videoFeedConfiguration.gridColumns &&\n Math.floor(videoFeedConfiguration.gridColumns!) !==\n videoFeedConfiguration.gridColumns\n ) {\n return {\n ...videoFeedConfiguration,\n gridColumns: Math.floor(videoFeedConfiguration.gridColumns!),\n };\n } else {\n return videoFeedConfiguration;\n }\n }\n}\n\nexport default VideoFeed;\n"]}
1
+ {"version":3,"sources":["VideoFeed.tsx"],"names":["NativeComponentName","VideoFeed","React","Component","createRef","FWLoggerUtil","log","JSON","stringify","props","nativeNodeHandle","_nativeComponentRef","current","commandId","UIManager","getViewManagerConfig","Commands","refresh","Platform","OS","toString","dispatchViewManagerCommand","event","nativeEvent","onVideoFeedLoadFinished","name","reason","componentDidMount","subscriptionOfShareBaseURLUpdated","FireworkSDKModuleEventEmitter","addListener","FWEventName","ShareBaseURLUpdated","setState","_subscriptions","push","subscriptionOfAdBadgeConfigurationUpdated","AdBadgeConfigurationUpdated","subscriptionOfVideoLaunchBehaviorUpdated","VideoLaunchBehaviorUpdated","componentWillUnmount","forEach","value","remove","render","source","channel","playlist","playlistGroup","mode","adConfiguration","enablePictureInPicture","videoFeedConfiguration","_getVideoFeedConfiguration","titleHidden","title","hidden","titlePosition","shareBaseURL","FireworkSDK","getInstance","getShareBaseURL","adBadgeConfiguration","getAdBadgeConfiguration","adBadgeTextType","badgeTextType","backgroundColorOfAdBadge","backgroundColor","textColorOfAdBadge","textColor","dynamicContentParametersString","_generateDynamicContentParametersString","enableAutoplay","gridColumns","requiresAds","adsFetchTimeout","vastAttributesString","_generateVastAttributesString","showAdBadge","videoLaunchBehavior","getVideoLaunchBehavior","key","_onVideoFeedLoadFinished","Object","assign","style","zIndex","dynamicContentParameters","resultString","sortedKeyList","keys","sort","valueString","join","length","vastAttributes","attribute","Math","floor"],"mappings":";;;;;;;AAAA;;AAEA;;AAUA;;AAEA;;AAKA;;AACA;;AACA;;;;;;;;AA0DA,MAAMA,mBAAmB,GAAG,aAA5B;AAEA;AACA;AACA;;AACA,MAAMC,SAAN,SAAwBC,eAAMC,SAA9B,CAAyD;AAAA;AAAA;;AAAA,8DAQzBD,eAAME,SAAN,EARyB;;AAAA,4CAUP,EAVO;;AAAA,qCAYtC,MAAM;AACrBC,4BAAaC,GAAb,CAAkB,qBAAoBC,IAAI,CAACC,SAAL,CAAe,KAAKC,KAApB,CAA2B,EAAjE;;AAEA,YAAMC,gBAAgB,GAAG,iCAAe,KAAKC,mBAAL,CAAyBC,OAAxC,CAAzB;;AAEA,UAAIC,SAA0B,GAC5BC,uBAAUC,oBAAV,CAA+Bf,mBAA/B,EAAoDgB,QAApD,CAA6DC,OAD/D;;AAEA,UAAIC,sBAASC,EAAT,KAAgB,SAApB,EAA+B;AAC7BN,QAAAA,SAAS,GAAGA,SAAS,CAACO,QAAV,EAAZ;AACD;;AAEDN,6BAAUO,0BAAV,CACE,iCAAeX,gBAAf,CADF,EAEEG,SAFF,EAGE,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A,WAAW,EAAEwB,IAAI,CAACC,KAAL,CAAW9C,sBAAsB,CAACqB,WAAlC;AAFR,OAAP;AAID,KATD,MASO;AACL,aAAOrB,sBAAP;AACD;AACF;;AAvOsD;;gBAAnDnD,S,kBAIkB;AACpBgD,EAAAA,IAAI,EAAE;AADc,C;;eAsOThD,S","sourcesContent":["import React from 'react';\n\nimport {\n EmitterSubscription,\n findNodeHandle,\n NativeSyntheticEvent,\n Platform,\n StyleProp,\n UIManager,\n ViewStyle,\n} from 'react-native';\n\nimport FireworkSDK from '../FireworkSDK';\nimport type FWError from '../models/FWError';\nimport { FWEventName } from '../models/FWEventName';\nimport type AdConfiguration from '../models/AdConfiguration';\nimport type VideoFeedConfiguration from '../models/VideoFeedConfiguration';\nimport type { VideoFeedSource } from '../models/VideoFeedSource';\nimport type VideoPlayerConfiguration from '../models/VideoPlayerConfiguration';\nimport { FireworkSDKModuleEventEmitter } from '../modules/FireworkSDKModule';\nimport FWLoggerUtil from '../utils/FWLoggerUtil';\nimport FWVideoFeed from './FWVideoFeed';\n\nexport type VideoFeedMode = 'row' | 'column' | 'grid';\n\n/**\n * The props of VideoFeed component.\n */\nexport interface IVideoFeedProps {\n /**\n * Standard React Native View Style.\n */\n style?: StyleProp<ViewStyle>;\n /**\n * One of five available video feed sources.The playlistGroup is only supported on iOS\n */\n source: VideoFeedSource;\n /**\n * Channel id of the feed. Required when the source is set as channel or playlist or dynamicContent.\n */\n channel?: string;\n /**\n * Playlist id of the feed. Please note channel id is necessary. Required when the source is set as playlist.\n */\n playlist?: string;\n /**\n * PlaylistGroup id of the feed. Required when the source is set as playlistGroup. Only supported on iOS.\n */\n playlistGroup?: string;\n /**\n * The dynamic content parameters of the feed. Required when the source is set as dynamicContent.\n */\n dynamicContentParameters?: { [key: string]: string[] };\n /**\n * One of three available display modes. Defaults to row.\n */\n mode?: VideoFeedMode;\n /**\n * Configuration of the feed.\n */\n videoFeedConfiguration?: VideoFeedConfiguration;\n /**\n * Configuration of the player.\n */\n videoPlayerConfiguration?: VideoPlayerConfiguration;\n /**\n * Ad configuration of the feed. Only supported on iOS.\n */\n adConfiguration?: AdConfiguration;\n /**\n * Specifies if Picture in Picture is enabled.\n */\n enablePictureInPicture?: boolean;\n /**\n * The feed loading result callback. It means loading successfully when error equals to undefined. Only supported on iOS.\n */\n onVideoFeedLoadFinished?: (error?: FWError) => void;\n}\n\nconst NativeComponentName = 'FWVideoFeed';\n\n/**\n * VideoFeed component.\n */\nclass VideoFeed extends React.Component<IVideoFeedProps> {\n /**\n * @ignore\n */\n static defaultProps = {\n mode: 'row',\n };\n\n private _nativeComponentRef = React.createRef<any>();\n\n private _subscriptions: EmitterSubscription[] = [];\n\n public refresh = () => {\n FWLoggerUtil.log(`VideoFeed refresh ${JSON.stringify(this.props)}`);\n\n const nativeNodeHandle = findNodeHandle(this._nativeComponentRef.current);\n\n let commandId: string | number =\n UIManager.getViewManagerConfig(NativeComponentName).Commands.refresh;\n if (Platform.OS === 'android') {\n commandId = commandId.toString();\n }\n\n UIManager.dispatchViewManagerCommand(\n findNodeHandle(nativeNodeHandle),\n commandId,\n []\n );\n };\n\n private _onVideoFeedLoadFinished = (event: NativeSyntheticEvent<any>) => {\n FWLoggerUtil.log(\n `VideoFeed _onVideoFeedLoadFinished ${JSON.stringify(event.nativeEvent)}`\n );\n const { onVideoFeedLoadFinished } = this.props;\n\n const { name, reason } = event.nativeEvent;\n\n if (onVideoFeedLoadFinished) {\n if (name) {\n if (reason) {\n onVideoFeedLoadFinished({ name, reason });\n } else {\n onVideoFeedLoadFinished({ name });\n }\n } else {\n onVideoFeedLoadFinished();\n }\n }\n };\n\n /**\n * @ignore\n */\n componentDidMount() {\n FWLoggerUtil.log(\n `VideoFeed componentDidMount ${JSON.stringify(this.props)}`\n );\n\n const subscriptionOfShareBaseURLUpdated =\n FireworkSDKModuleEventEmitter.addListener(\n FWEventName.ShareBaseURLUpdated,\n () => {\n FWLoggerUtil.log('Receive FWEventName.ShareBaseURLUpdated');\n this.setState({});\n }\n );\n this._subscriptions.push(subscriptionOfShareBaseURLUpdated);\n\n const subscriptionOfAdBadgeConfigurationUpdated =\n FireworkSDKModuleEventEmitter.addListener(\n FWEventName.AdBadgeConfigurationUpdated,\n () => {\n FWLoggerUtil.log('Receive FWEventName.AdBadgeConfigurationUpdated');\n this.setState({});\n }\n );\n this._subscriptions.push(subscriptionOfAdBadgeConfigurationUpdated);\n\n const subscriptionOfVideoLaunchBehaviorUpdated =\n FireworkSDKModuleEventEmitter.addListener(\n FWEventName.VideoLaunchBehaviorUpdated,\n () => {\n FWLoggerUtil.log('Receive FWEventName.VideoLaunchBehaviorUpdated');\n this.setState({});\n }\n );\n this._subscriptions.push(subscriptionOfVideoLaunchBehaviorUpdated);\n }\n\n /**\n * @ignore\n */\n componentWillUnmount() {\n FWLoggerUtil.log(\n `VideoFeed componentWillUnmount ${JSON.stringify(this.props)}`\n );\n\n this._subscriptions.forEach((value) => {\n value.remove();\n });\n\n this._subscriptions = [];\n }\n\n /**\n * @ignore\n */\n render() {\n FWLoggerUtil.log(`VideoFeed render ${JSON.stringify(this.props)}`);\n\n const {\n source,\n channel = '',\n playlist = '',\n playlistGroup = '',\n mode = 'row',\n adConfiguration,\n enablePictureInPicture = false,\n } = this.props;\n const videoFeedConfiguration = this._getVideoFeedConfiguration();\n const titleHidden = videoFeedConfiguration?.title?.hidden ?? false;\n const titlePosition = videoFeedConfiguration?.titlePosition ?? 'nested';\n const shareBaseURL = FireworkSDK.getInstance().getShareBaseURL() ?? '';\n const adBadgeConfiguration =\n FireworkSDK.getInstance().getAdBadgeConfiguration() ?? {};\n const adBadgeTextType = adBadgeConfiguration.badgeTextType ?? '';\n const backgroundColorOfAdBadge = adBadgeConfiguration.backgroundColor ?? '';\n const textColorOfAdBadge = adBadgeConfiguration.textColor ?? '';\n const dynamicContentParametersString =\n this._generateDynamicContentParametersString();\n const enableAutoplay = videoFeedConfiguration?.enableAutoplay ?? false;\n\n const gridColumns = videoFeedConfiguration?.gridColumns ?? 2;\n const requiresAds = adConfiguration?.requiresAds ?? false;\n const adsFetchTimeout = adConfiguration?.adsFetchTimeout ?? 10;\n const vastAttributesString = this._generateVastAttributesString();\n const showAdBadge = videoFeedConfiguration?.showAdBadge ?? false;\n const videoLaunchBehavior =\n FireworkSDK.getInstance().getVideoLaunchBehavior() ?? 'default';\n\n let key = `source:${source}`;\n key += `_channel:${channel}`;\n key += `_playlist:${playlist}`;\n key += `_playlistGroup:${playlistGroup}`;\n key += `_mode:${mode}`;\n key += `_titleHidden:${titleHidden}`;\n key += `_titlePosition:${titlePosition}`;\n key += `_shareBaseURL:${shareBaseURL}`;\n key += `_adBadgeTextType:${adBadgeTextType}`;\n key += `_backgroundColorOfAdBadge:${backgroundColorOfAdBadge}`;\n key += `_textColorOfAdBadge:${textColorOfAdBadge}`;\n key += `_dynamicContentParameters:${dynamicContentParametersString}`;\n key += `_enableAutoplay:${enableAutoplay}`;\n key += `_enablePictureInPicture:${enablePictureInPicture}`;\n key += `_gridColumns:${gridColumns}`;\n key += `_requiresAds:${requiresAds}`;\n key += `_adsFetchTimeout:${adsFetchTimeout}`;\n key += `_vastAttributes:${vastAttributesString}`;\n key += `_showAdBadge:${showAdBadge}`;\n key += `_videoLaunchBehavior:${videoLaunchBehavior}`;\n\n return (\n <FWVideoFeed\n key={key}\n {...this.props}\n ref={this._nativeComponentRef}\n onVideoFeedLoadFinished={this._onVideoFeedLoadFinished}\n mode={mode}\n style={Object.assign({}, this.props.style, { zIndex: -1 })}\n />\n );\n }\n\n private _generateDynamicContentParametersString(): string {\n const { dynamicContentParameters } = this.props;\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 private _generateVastAttributesString(): string {\n const { adConfiguration } = this.props;\n const vastAttributes = adConfiguration?.vastAttributes ?? '';\n if (!vastAttributes) {\n return '';\n }\n\n let resultString = '';\n for (const attribute of vastAttributes) {\n if (resultString.length > 0) {\n resultString += '_';\n }\n resultString += `${attribute.name ?? ''}:${attribute.value}`;\n }\n\n return resultString;\n }\n\n private _getVideoFeedConfiguration(): VideoFeedConfiguration | undefined {\n const { videoFeedConfiguration } = this.props;\n if (!videoFeedConfiguration) {\n return videoFeedConfiguration;\n }\n\n if (\n videoFeedConfiguration.gridColumns &&\n Math.floor(videoFeedConfiguration.gridColumns!) !==\n videoFeedConfiguration.gridColumns\n ) {\n return {\n ...videoFeedConfiguration,\n gridColumns: Math.floor(videoFeedConfiguration.gridColumns!),\n };\n } else {\n return videoFeedConfiguration;\n }\n }\n}\n\nexport default VideoFeed;\n"]}
@@ -28,9 +28,9 @@ class StoryBlock extends React.Component {
28
28
  constructor() {
29
29
  super(...arguments);
30
30
 
31
- _defineProperty(this, "nativeComponentRef", /*#__PURE__*/React.createRef());
31
+ _defineProperty(this, "_nativeComponentRef", /*#__PURE__*/React.createRef());
32
32
 
33
- _defineProperty(this, "subscriptions", []);
33
+ _defineProperty(this, "_subscriptions", []);
34
34
 
35
35
  _defineProperty(this, "_onStoryBlockLoadFinished", event => {
36
36
  FWLoggerUtil.log(`StoryBlock _onStoryBlockLoadFinished ${event.nativeEvent.name}`);
@@ -61,41 +61,58 @@ class StoryBlock extends React.Component {
61
61
  });
62
62
  }
63
63
 
64
+ /**
65
+ * @ignore
66
+ */
64
67
  componentDidMount() {
65
68
  const subscriptionOfShareBaseURLUpdated = FireworkSDKModuleEventEmitter.addListener(FWEventName.ShareBaseURLUpdated, () => {
66
69
  this.setState({});
67
70
  });
68
- this.subscriptions.push(subscriptionOfShareBaseURLUpdated);
71
+
72
+ this._subscriptions.push(subscriptionOfShareBaseURLUpdated);
73
+
69
74
  const subscriptionOfAdBadgeConfigurationUpdated = FireworkSDKModuleEventEmitter.addListener(FWEventName.AdBadgeConfigurationUpdated, () => {
70
75
  this.setState({});
71
76
  });
72
- this.subscriptions.push(subscriptionOfAdBadgeConfigurationUpdated);
77
+
78
+ this._subscriptions.push(subscriptionOfAdBadgeConfigurationUpdated);
79
+
73
80
  const subscriptionOfVideoLaunchBehaviorUpdated = FireworkSDKModuleEventEmitter.addListener(FWEventName.VideoLaunchBehaviorUpdated, () => {
74
81
  FWLoggerUtil.log('Receive FWEventName.VideoLaunchBehaviorUpdated');
75
82
  this.setState({});
76
83
  });
77
- this.subscriptions.push(subscriptionOfVideoLaunchBehaviorUpdated);
84
+
85
+ this._subscriptions.push(subscriptionOfVideoLaunchBehaviorUpdated);
78
86
 
79
87
  if (Platform.OS === 'android') {
80
- const viewId = findNodeHandle(this.nativeComponentRef.current);
88
+ const viewId = findNodeHandle(this._nativeComponentRef.current);
81
89
  FWLoggerUtil.log(`StoryBlock componentDidMount createFragment viewId: ${viewId}`);
82
90
  createFragment(viewId);
83
91
  }
84
92
  }
93
+ /**
94
+ * @ignore
95
+ */
96
+
85
97
 
86
98
  componentWillUnmount() {
87
- this.subscriptions.forEach(value => {
99
+ this._subscriptions.forEach(value => {
88
100
  value.remove();
89
101
  });
90
- this.subscriptions = [];
102
+
103
+ this._subscriptions = [];
91
104
  }
105
+ /**
106
+ * @ignore
107
+ */
108
+
92
109
 
93
110
  render() {
94
111
  const {
95
112
  style
96
113
  } = this.props;
97
114
  return /*#__PURE__*/React.createElement(FWStoryBlock, _extends({
98
- ref: this.nativeComponentRef,
115
+ ref: this._nativeComponentRef,
99
116
  key: this._generateKey()
100
117
  }, this.props, {
101
118
  onStoryBlockLoadFinished: this._onStoryBlockLoadFinished,
@@ -1 +1 @@
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","subscriptionOfVideoLaunchBehaviorUpdated","VideoLaunchBehaviorUpdated","nativeComponentRef","current","componentWillUnmount","forEach","value","remove","render","style","_generateKey","_onStoryBlockLoadFinished","Object","assign","zIndex","source","channel","playlist","enablePictureInPicture","shareBaseURL","getInstance","getShareBaseURL","adBadgeConfiguration","getAdBadgeConfiguration","adBadgeTextType","badgeTextType","backgroundColorOfAdBadge","backgroundColor","textColorOfAdBadge","textColor","dynamicContentParametersString","_generateDynamicContentParametersString","videoLaunchBehavior","getVideoLaunchBehavior","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,SAASC,6BAAT,QAA8C,8BAA9C;AACA,OAAOC,YAAP,MAAyB,uBAAzB;AACA,OAAOC,YAAP,MAAyB,gBAAzB;AAEA,MAAMC,mBAAmB,GAAG,cAA5B;;AAEA,MAAMC,cAAc,GAAIC,MAAD,IAAiB;AACtC,MAAIT,QAAQ,CAACU,EAAT,KAAgB,SAApB,EAA+B;AAC7BT,IAAAA,SAAS,CAACU,0BAAV,CACEF,MADF,EAEER,SAAS,CAACW,oBAAV,CACEL,mBADF,EAEEM,QAFF,CAEWC,MAFX,CAEkBC,QAFlB,EAFF,EAKE,CAACN,MAAD,CALF;AAOD;AACF,CAVD;AAYA;AACA;AACA;;;AAgCA;AACA;AACA;AACA,MAAMO,UAAN,SAAyBlB,KAAK,CAACmB,SAA/B,CAA2D;AAAA;AAAA;;AAAA,6DACpCnB,KAAK,C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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;;AA1IwD;;AA6I3D,eAAevD,UAAf","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\n/**\n * The props type of StoryBlock component.\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.\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\n/**\n * StoryBlock component. Only supported on iOS.\n */\nclass 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 const subscriptionOfVideoLaunchBehaviorUpdated =\n FireworkSDKModuleEventEmitter.addListener(\n FWEventName.VideoLaunchBehaviorUpdated,\n () => {\n FWLoggerUtil.log('Receive FWEventName.VideoLaunchBehaviorUpdated');\n this.setState({});\n }\n );\n this.subscriptions.push(subscriptionOfVideoLaunchBehaviorUpdated);\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().getShareBaseURL() ?? '';\n const adBadgeConfiguration =\n FireworkSDK.getInstance().getAdBadgeConfiguration() ?? {};\n const adBadgeTextType = adBadgeConfiguration.badgeTextType ?? '';\n const backgroundColorOfAdBadge = adBadgeConfiguration.backgroundColor ?? '';\n const textColorOfAdBadge = adBadgeConfiguration.textColor ?? '';\n const dynamicContentParametersString =\n this._generateDynamicContentParametersString();\n const videoLaunchBehavior =\n FireworkSDK.getInstance().getVideoLaunchBehavior() ?? 'default';\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 key += `_videoLaunchBehavior:${videoLaunchBehavior}`;\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\nexport default StoryBlock;\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","subscriptionOfVideoLaunchBehaviorUpdated","VideoLaunchBehaviorUpdated","_nativeComponentRef","current","componentWillUnmount","forEach","value","remove","render","style","_generateKey","_onStoryBlockLoadFinished","Object","assign","zIndex","source","channel","playlist","enablePictureInPicture","shareBaseURL","getInstance","getShareBaseURL","adBadgeConfiguration","getAdBadgeConfiguration","adBadgeTextType","badgeTextType","backgroundColorOfAdBadge","backgroundColor","textColorOfAdBadge","textColor","dynamicContentParametersString","_generateDynamicContentParametersString","videoLaunchBehavior","getVideoLaunchBehavior","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,SAASC,6BAAT,QAA8C,8BAA9C;AACA,OAAOC,YAAP,MAAyB,uBAAzB;AACA,OAAOC,YAAP,MAAyB,gBAAzB;AAEA,MAAMC,mBAAmB,GAAG,cAA5B;;AAEA,MAAMC,cAAc,GAAIC,MAAD,IAAiB;AACtC,MAAIT,QAAQ,CAACU,EAAT,KAAgB,SAApB,EAA+B;AAC7BT,IAAAA,SAAS,CAACU,0BAAV,CACEF,MADF,EAEER,SAAS,CAACW,oBAAV,CACEL,mBADF,EAEEM,QAFF,CAEWC,MAFX,CAEkBC,QAFlB,EAFF,EAKE,CAACN,MAAD,CALF;AAOD;AACF,CAVD;AAYA;AACA;AACA;;;AAgCA;AACA;AACA;AACA,MAAMO,UAAN,SAAyBlB,KAAK,CAACmB,SAA/B,CAA2D;AAAA;AAAA;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,CAACD,GAAD,CAAtC;AACA,YAAMM,WAAW,GAAGlC,KAAK,CAACmC,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;;AApJwD;;AAuJ3D,eAAevD,UAAf","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\n/**\n * The props type of StoryBlock component.\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.\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\n/**\n * StoryBlock component. Only supported on iOS.\n */\nclass StoryBlock extends React.Component<IStoryBlockProps> {\n private _nativeComponentRef = React.createRef<any>();\n\n private _subscriptions: EmitterSubscription[] = [];\n\n /**\n * @ignore\n */\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 const subscriptionOfVideoLaunchBehaviorUpdated =\n FireworkSDKModuleEventEmitter.addListener(\n FWEventName.VideoLaunchBehaviorUpdated,\n () => {\n FWLoggerUtil.log('Receive FWEventName.VideoLaunchBehaviorUpdated');\n this.setState({});\n }\n );\n this._subscriptions.push(subscriptionOfVideoLaunchBehaviorUpdated);\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 /**\n * @ignore\n */\n componentWillUnmount() {\n this._subscriptions.forEach((value) => {\n value.remove();\n });\n\n this._subscriptions = [];\n }\n\n /**\n * @ignore\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().getShareBaseURL() ?? '';\n const adBadgeConfiguration =\n FireworkSDK.getInstance().getAdBadgeConfiguration() ?? {};\n const adBadgeTextType = adBadgeConfiguration.badgeTextType ?? '';\n const backgroundColorOfAdBadge = adBadgeConfiguration.backgroundColor ?? '';\n const textColorOfAdBadge = adBadgeConfiguration.textColor ?? '';\n const dynamicContentParametersString =\n this._generateDynamicContentParametersString();\n const videoLaunchBehavior =\n FireworkSDK.getInstance().getVideoLaunchBehavior() ?? 'default';\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 key += `_videoLaunchBehavior:${videoLaunchBehavior}`;\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\nexport default StoryBlock;\n"]}
@@ -18,13 +18,13 @@ class VideoFeed extends React.Component {
18
18
  constructor() {
19
19
  super(...arguments);
20
20
 
21
- _defineProperty(this, "nativeComponentRef", /*#__PURE__*/React.createRef());
21
+ _defineProperty(this, "_nativeComponentRef", /*#__PURE__*/React.createRef());
22
22
 
23
- _defineProperty(this, "subscriptions", []);
23
+ _defineProperty(this, "_subscriptions", []);
24
24
 
25
25
  _defineProperty(this, "refresh", () => {
26
26
  FWLoggerUtil.log(`VideoFeed refresh ${JSON.stringify(this.props)}`);
27
- const nativeNodeHandle = findNodeHandle(this.nativeComponentRef.current);
27
+ const nativeNodeHandle = findNodeHandle(this._nativeComponentRef.current);
28
28
  let commandId = UIManager.getViewManagerConfig(NativeComponentName).Commands.refresh;
29
29
 
30
30
  if (Platform.OS === 'android') {
@@ -63,32 +63,50 @@ class VideoFeed extends React.Component {
63
63
  });
64
64
  }
65
65
 
66
+ /**
67
+ * @ignore
68
+ */
66
69
  componentDidMount() {
67
70
  FWLoggerUtil.log(`VideoFeed componentDidMount ${JSON.stringify(this.props)}`);
68
71
  const subscriptionOfShareBaseURLUpdated = FireworkSDKModuleEventEmitter.addListener(FWEventName.ShareBaseURLUpdated, () => {
69
72
  FWLoggerUtil.log('Receive FWEventName.ShareBaseURLUpdated');
70
73
  this.setState({});
71
74
  });
72
- this.subscriptions.push(subscriptionOfShareBaseURLUpdated);
75
+
76
+ this._subscriptions.push(subscriptionOfShareBaseURLUpdated);
77
+
73
78
  const subscriptionOfAdBadgeConfigurationUpdated = FireworkSDKModuleEventEmitter.addListener(FWEventName.AdBadgeConfigurationUpdated, () => {
74
79
  FWLoggerUtil.log('Receive FWEventName.AdBadgeConfigurationUpdated');
75
80
  this.setState({});
76
81
  });
77
- this.subscriptions.push(subscriptionOfAdBadgeConfigurationUpdated);
82
+
83
+ this._subscriptions.push(subscriptionOfAdBadgeConfigurationUpdated);
84
+
78
85
  const subscriptionOfVideoLaunchBehaviorUpdated = FireworkSDKModuleEventEmitter.addListener(FWEventName.VideoLaunchBehaviorUpdated, () => {
79
86
  FWLoggerUtil.log('Receive FWEventName.VideoLaunchBehaviorUpdated');
80
87
  this.setState({});
81
88
  });
82
- this.subscriptions.push(subscriptionOfVideoLaunchBehaviorUpdated);
89
+
90
+ this._subscriptions.push(subscriptionOfVideoLaunchBehaviorUpdated);
83
91
  }
92
+ /**
93
+ * @ignore
94
+ */
95
+
84
96
 
85
97
  componentWillUnmount() {
86
98
  FWLoggerUtil.log(`VideoFeed componentWillUnmount ${JSON.stringify(this.props)}`);
87
- this.subscriptions.forEach(value => {
99
+
100
+ this._subscriptions.forEach(value => {
88
101
  value.remove();
89
102
  });
90
- this.subscriptions = [];
103
+
104
+ this._subscriptions = [];
91
105
  }
106
+ /**
107
+ * @ignore
108
+ */
109
+
92
110
 
93
111
  render() {
94
112
  var _videoFeedConfigurati, _videoFeedConfigurati2, _videoFeedConfigurati3, _FireworkSDK$getInsta, _FireworkSDK$getInsta2, _adBadgeConfiguration, _adBadgeConfiguration2, _adBadgeConfiguration3, _videoFeedConfigurati4, _videoFeedConfigurati5, _adConfiguration$requ, _adConfiguration$adsF, _videoFeedConfigurati6, _FireworkSDK$getInsta3;
@@ -148,7 +166,7 @@ class VideoFeed extends React.Component {
148
166
  return /*#__PURE__*/React.createElement(FWVideoFeed, _extends({
149
167
  key: key
150
168
  }, this.props, {
151
- ref: this.nativeComponentRef,
169
+ ref: this._nativeComponentRef,
152
170
  onVideoFeedLoadFinished: this._onVideoFeedLoadFinished,
153
171
  mode: mode,
154
172
  style: Object.assign({}, this.props.style, {
@@ -1 +1 @@
1
- {"version":3,"sources":["VideoFeed.tsx"],"names":["React","findNodeHandle","Platform","UIManager","FireworkSDK","FWEventName","FireworkSDKModuleEventEmitter","FWLoggerUtil","FWVideoFeed","NativeComponentName","VideoFeed","Component","createRef","log","JSON","stringify","props","nativeNodeHandle","nativeComponentRef","current","commandId","getViewManagerConfig","Commands","refresh","OS","toString","dispatchViewManagerCommand","event","nativeEvent","onVideoFeedLoadFinished","name","reason","componentDidMount","subscriptionOfShareBaseURLUpdated","addListener","ShareBaseURLUpdated","setState","subscriptions","push","subscriptionOfAdBadgeConfigurationUpdated","AdBadgeConfigurationUpdated","subscriptionOfVideoLaunchBehaviorUpdated","VideoLaunchBehaviorUpdated","componentWillUnmount","forEach","value","remove","render","source","channel","playlist","playlistGroup","mode","adConfiguration","enablePictureInPicture","videoFeedConfiguration","_getVideoFeedConfiguration","titleHidden","title","hidden","titlePosition","shareBaseURL","getInstance","getShareBaseURL","adBadgeConfiguration","getAdBadgeConfiguration","adBadgeTextType","badgeTextType","backgroundColorOfAdBadge","backgroundColor","textColorOfAdBadge","textColor","dynamicContentParametersString","_generateDynamicContentParametersString","enableAutoplay","gridColumns","requiresAds","adsFetchTimeout","vastAttributesString","_generateVastAttributesString","showAdBadge","videoLaunchBehavior","getVideoLaunchBehavior","key","_onVideoFeedLoadFinished","Object","assign","style","zIndex","dynamicContentParameters","resultString","sortedKeyList","keys","sort","valueString","join","length","vastAttributes","attribute","Math","floor"],"mappings":";;;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AAEA,SAEEC,cAFF,EAIEC,QAJF,EAMEC,SANF,QAQO,cARP;AAUA,OAAOC,WAAP,MAAwB,gBAAxB;AAEA,SAASC,WAAT,QAA4B,uBAA5B;AAKA,SAASC,6BAAT,QAA8C,8BAA9C;AACA,OAAOC,YAAP,MAAyB,uBAAzB;AACA,OAAOC,WAAP,MAAwB,eAAxB;AA0DA,MAAMC,mBAAmB,GAAG,aAA5B;AAEA;AACA;AACA;;AACA,MAAMC,SAAN,SAAwBV,KAAK,CAACW,SAA9B,CAAyD;AAAA;AAAA;;AAAA,6DAKlCX,KAAK,CAACY,SAAN,EALkC;;AAAA,2CAOhB,EAPgB;;AAAA,qCAYtC,MAAM;AACrBL,MAAAA,YAAY,CAACM,GAAb,CAAkB,qBAAoBC,IAAI,CAACC,SAAL,CAAe,KAAKC,KAApB,CAA2B,EAAjE;AAEA,YAAMC,gBAAgB,GAAGhB,cAAc,CAAC,KAAKiB,kBAAL,CAAw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pE,IAAb,6DAAqB,EAAG,IAAGoE,SAAS,CAACrD,KAAM,EAA3D;AACD;;AAED,WAAO6C,YAAP;AACD;;AAEOlC,EAAAA,0BAA0B,GAAuC;AACvE,UAAM;AAAED,MAAAA;AAAF,QAA6B,KAAKvC,KAAxC;;AACA,QAAI,CAACuC,sBAAL,EAA6B;AAC3B,aAAOA,sBAAP;AACD;;AAED,QACEA,sBAAsB,CAACoB,WAAvB,IACAwB,IAAI,CAACC,KAAL,CAAW7C,sBAAsB,CAACoB,WAAlC,MACEpB,sBAAsB,CAACoB,WAH3B,EAIE;AACA,aAAO,EACL,GAAGpB,sBADE;AAELoB,QAAAA,WAAW,EAAEwB,IAAI,CAACC,KAAL,CAAW7C,sBAAsB,CAACoB,WAAlC;AAFR,OAAP;AAID,KATD,MASO;AACL,aAAOpB,sBAAP;AACD;AACF;;AA9NsD;;gBAAnD7C,S,kBACkB;AACpB0C,EAAAA,IAAI,EAAE;AADc,C;;AAgOxB,eAAe1C,SAAf","sourcesContent":["import React from 'react';\n\nimport {\n EmitterSubscription,\n findNodeHandle,\n NativeSyntheticEvent,\n Platform,\n StyleProp,\n UIManager,\n ViewStyle,\n} from 'react-native';\n\nimport FireworkSDK from '../FireworkSDK';\nimport type FWError from '../models/FWError';\nimport { FWEventName } from '../models/FWEventName';\nimport type AdConfiguration from '../models/AdConfiguration';\nimport type VideoFeedConfiguration from '../models/VideoFeedConfiguration';\nimport type { VideoFeedSource } from '../models/VideoFeedSource';\nimport type VideoPlayerConfiguration from '../models/VideoPlayerConfiguration';\nimport { FireworkSDKModuleEventEmitter } from '../modules/FireworkSDKModule';\nimport FWLoggerUtil from '../utils/FWLoggerUtil';\nimport FWVideoFeed from './FWVideoFeed';\n\nexport type VideoFeedMode = 'row' | 'column' | 'grid';\n\n/**\n * The props of VideoFeed component.\n */\nexport interface IVideoFeedProps {\n /**\n * Standard React Native View Style.\n */\n style?: StyleProp<ViewStyle>;\n /**\n * One of five available video feed sources.The playlistGroup is only supported on iOS\n */\n source: VideoFeedSource;\n /**\n * Channel id of the feed. Required when the source is set as channel or playlist or dynamicContent.\n */\n channel?: string;\n /**\n * Playlist id of the feed. Please note channel id is necessary. Required when the source is set as playlist.\n */\n playlist?: string;\n /**\n * PlaylistGroup id of the feed. Required when the source is set as playlistGroup. Only supported on iOS.\n */\n playlistGroup?: string;\n /**\n * The dynamic content parameters of the feed. Required when the source is set as dynamicContent.\n */\n dynamicContentParameters?: { [key: string]: string[] };\n /**\n * One of three available display modes. Defaults to row.\n */\n mode?: VideoFeedMode;\n /**\n * Configuration of the feed.\n */\n videoFeedConfiguration?: VideoFeedConfiguration;\n /**\n * Configuration of the player.\n */\n videoPlayerConfiguration?: VideoPlayerConfiguration;\n /**\n * Ad configuration of the feed. Only supported on iOS.\n */\n adConfiguration?: AdConfiguration;\n /**\n * Specifies if Picture in Picture is enabled.\n */\n enablePictureInPicture?: boolean;\n /**\n * The feed loading result callback. It means loading successfully when error equals to undefined. Only supported on iOS.\n */\n onVideoFeedLoadFinished?: (error?: FWError) => void;\n}\n\nconst NativeComponentName = 'FWVideoFeed';\n\n/**\n * VideoFeed component.\n */\nclass VideoFeed extends React.Component<IVideoFeedProps> {\n static defaultProps = {\n mode: 'row',\n };\n\n nativeComponentRef = React.createRef<any>();\n\n subscriptions: EmitterSubscription[] = [];\n\n /**\n * Force refreshing the video feed.\n */\n public refresh = () => {\n FWLoggerUtil.log(`VideoFeed refresh ${JSON.stringify(this.props)}`);\n\n const nativeNodeHandle = findNodeHandle(this.nativeComponentRef.current);\n\n let commandId: string | number =\n UIManager.getViewManagerConfig(NativeComponentName).Commands.refresh;\n if (Platform.OS === 'android') {\n commandId = commandId.toString();\n }\n\n UIManager.dispatchViewManagerCommand(\n findNodeHandle(nativeNodeHandle),\n commandId,\n []\n );\n };\n\n private _onVideoFeedLoadFinished = (event: NativeSyntheticEvent<any>) => {\n FWLoggerUtil.log(\n `VideoFeed _onVideoFeedLoadFinished ${JSON.stringify(event.nativeEvent)}`\n );\n const { onVideoFeedLoadFinished } = this.props;\n\n const { name, reason } = event.nativeEvent;\n\n if (onVideoFeedLoadFinished) {\n if (name) {\n if (reason) {\n onVideoFeedLoadFinished({ name, reason });\n } else {\n onVideoFeedLoadFinished({ name });\n }\n } else {\n onVideoFeedLoadFinished();\n }\n }\n };\n\n componentDidMount() {\n FWLoggerUtil.log(\n `VideoFeed componentDidMount ${JSON.stringify(this.props)}`\n );\n\n const subscriptionOfShareBaseURLUpdated =\n FireworkSDKModuleEventEmitter.addListener(\n FWEventName.ShareBaseURLUpdated,\n () => {\n FWLoggerUtil.log('Receive FWEventName.ShareBaseURLUpdated');\n this.setState({});\n }\n );\n this.subscriptions.push(subscriptionOfShareBaseURLUpdated);\n\n const subscriptionOfAdBadgeConfigurationUpdated =\n FireworkSDKModuleEventEmitter.addListener(\n FWEventName.AdBadgeConfigurationUpdated,\n () => {\n FWLoggerUtil.log('Receive FWEventName.AdBadgeConfigurationUpdated');\n this.setState({});\n }\n );\n this.subscriptions.push(subscriptionOfAdBadgeConfigurationUpdated);\n\n const subscriptionOfVideoLaunchBehaviorUpdated =\n FireworkSDKModuleEventEmitter.addListener(\n FWEventName.VideoLaunchBehaviorUpdated,\n () => {\n FWLoggerUtil.log('Receive FWEventName.VideoLaunchBehaviorUpdated');\n this.setState({});\n }\n );\n this.subscriptions.push(subscriptionOfVideoLaunchBehaviorUpdated);\n }\n\n componentWillUnmount() {\n FWLoggerUtil.log(\n `VideoFeed componentWillUnmount ${JSON.stringify(this.props)}`\n );\n\n this.subscriptions.forEach((value) => {\n value.remove();\n });\n\n this.subscriptions = [];\n }\n\n render() {\n FWLoggerUtil.log(`VideoFeed render ${JSON.stringify(this.props)}`);\n\n const {\n source,\n channel = '',\n playlist = '',\n playlistGroup = '',\n mode = 'row',\n adConfiguration,\n enablePictureInPicture = false,\n } = this.props;\n const videoFeedConfiguration = this._getVideoFeedConfiguration();\n const titleHidden = videoFeedConfiguration?.title?.hidden ?? false;\n const titlePosition = videoFeedConfiguration?.titlePosition ?? 'nested';\n const shareBaseURL = FireworkSDK.getInstance().getShareBaseURL() ?? '';\n const adBadgeConfiguration =\n FireworkSDK.getInstance().getAdBadgeConfiguration() ?? {};\n const adBadgeTextType = adBadgeConfiguration.badgeTextType ?? '';\n const backgroundColorOfAdBadge = adBadgeConfiguration.backgroundColor ?? '';\n const textColorOfAdBadge = adBadgeConfiguration.textColor ?? '';\n const dynamicContentParametersString =\n this._generateDynamicContentParametersString();\n const enableAutoplay = videoFeedConfiguration?.enableAutoplay ?? false;\n\n const gridColumns = videoFeedConfiguration?.gridColumns ?? 2;\n const requiresAds = adConfiguration?.requiresAds ?? false;\n const adsFetchTimeout = adConfiguration?.adsFetchTimeout ?? 10;\n const vastAttributesString = this._generateVastAttributesString();\n const showAdBadge = videoFeedConfiguration?.showAdBadge ?? false;\n const videoLaunchBehavior =\n FireworkSDK.getInstance().getVideoLaunchBehavior() ?? 'default';\n\n let key = `source:${source}`;\n key += `_channel:${channel}`;\n key += `_playlist:${playlist}`;\n key += `_playlistGroup:${playlistGroup}`;\n key += `_mode:${mode}`;\n key += `_titleHidden:${titleHidden}`;\n key += `_titlePosition:${titlePosition}`;\n key += `_shareBaseURL:${shareBaseURL}`;\n key += `_adBadgeTextType:${adBadgeTextType}`;\n key += `_backgroundColorOfAdBadge:${backgroundColorOfAdBadge}`;\n key += `_textColorOfAdBadge:${textColorOfAdBadge}`;\n key += `_dynamicContentParameters:${dynamicContentParametersString}`;\n key += `_enableAutoplay:${enableAutoplay}`;\n key += `_enablePictureInPicture:${enablePictureInPicture}`;\n key += `_gridColumns:${gridColumns}`;\n key += `_requiresAds:${requiresAds}`;\n key += `_adsFetchTimeout:${adsFetchTimeout}`;\n key += `_vastAttributes:${vastAttributesString}`;\n key += `_showAdBadge:${showAdBadge}`;\n key += `_videoLaunchBehavior:${videoLaunchBehavior}`;\n\n return (\n <FWVideoFeed\n key={key}\n {...this.props}\n ref={this.nativeComponentRef}\n onVideoFeedLoadFinished={this._onVideoFeedLoadFinished}\n mode={mode}\n style={Object.assign({}, this.props.style, { zIndex: -1 })}\n />\n );\n }\n\n private _generateDynamicContentParametersString(): string {\n const { dynamicContentParameters } = this.props;\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 private _generateVastAttributesString(): string {\n const { adConfiguration } = this.props;\n const vastAttributes = adConfiguration?.vastAttributes ?? '';\n if (!vastAttributes) {\n return '';\n }\n\n let resultString = '';\n for (const attribute of vastAttributes) {\n if (resultString.length > 0) {\n resultString += '_';\n }\n resultString += `${attribute.name ?? ''}:${attribute.value}`;\n }\n\n return resultString;\n }\n\n private _getVideoFeedConfiguration(): VideoFeedConfiguration | undefined {\n const { videoFeedConfiguration } = this.props;\n if (!videoFeedConfiguration) {\n return videoFeedConfiguration;\n }\n\n if (\n videoFeedConfiguration.gridColumns &&\n Math.floor(videoFeedConfiguration.gridColumns!) !==\n videoFeedConfiguration.gridColumns\n ) {\n return {\n ...videoFeedConfiguration,\n gridColumns: Math.floor(videoFeedConfiguration.gridColumns!),\n };\n } else {\n return videoFeedConfiguration;\n }\n }\n}\n\nexport default VideoFeed;\n"]}
1
+ {"version":3,"sources":["VideoFeed.tsx"],"names":["React","findNodeHandle","Platform","UIManager","FireworkSDK","FWEventName","FireworkSDKModuleEventEmitter","FWLoggerUtil","FWVideoFeed","NativeComponentName","VideoFeed","Component","createRef","log","JSON","stringify","props","nativeNodeHandle","_nativeComponentRef","current","commandId","getViewManagerConfig","Commands","refresh","OS","toString","dispatchViewManagerCommand","event","nativeEvent","onVideoFeedLoadFinished","name","reason","componentDidMount","subscriptionOfShareBaseURLUpdated","addListener","ShareBaseURLUpdated","setState","_subscriptions","push","subscriptionOfAdBadgeConfigurationUpdated","AdBadgeConfigurationUpdated","subscriptionOfVideoLaunchBehaviorUpdated","VideoLaunchBehaviorUpdated","componentWillUnmount","forEach","value","remove","render","source","channel","playlist","playlistGroup","mode","adConfiguration","enablePictureInPicture","videoFeedConfiguration","_getVideoFeedConfiguration","titleHidden","title","hidden","titlePosition","shareBaseURL","getInstance","getShareBaseURL","adBadgeConfiguration","getAdBadgeConfiguration","adBadgeTextType","badgeTextType","backgroundColorOfAdBadge","backgroundColor","textColorOfAdBadge","textColor","dynamicContentParametersString","_generateDynamicContentParametersString","enableAutoplay","gridColumns","requiresAds","adsFetchTimeout","vastAttributesString","_generateVastAttributesString","showAdBadge","videoLaunchBehavior","getVideoLaunchBehavior","key","_onVideoFeedLoadFinished","Object","assign","style","zIndex","dynamicContentParameters","resultString","sortedKeyList","keys","sort","valueString","join","length","vastAttributes","attribute","Math","floor"],"mappings":";;;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AAEA,SAEEC,cAFF,EAIEC,QAJF,EAMEC,SANF,QAQO,cARP;AAUA,OAAOC,WAAP,MAAwB,gBAAxB;AAEA,SAASC,WAAT,QAA4B,uBAA5B;AAKA,SAASC,6BAAT,QAA8C,8BAA9C;AACA,OAAOC,YAAP,MAAyB,uBAAzB;AACA,OAAOC,WAAP,MAAwB,eAAxB;AA0DA,MAAMC,mBAAmB,GAAG,aAA5B;AAEA;AACA;AACA;;AACA,MAAMC,SAAN,SAAwBV,KAAK,CAACW,SAA9B,CAAyD;AAAA;AAAA;;AAAA,8DAQzBX,KAAK,CAACY,SAAN,EARyB;;AAAA,4CAUP,EAVO;;AAAA,qCAYtC,MAAM;AACrBL,MAAAA,YAAY,CAACM,GAAb,CAAkB,qBAAoBC,IAAI,CAACC,SAAL,CAAe,KAAKC,KAApB,CAA2B,EAAjE;AAEA,YAAMC,gBAAgB,GAAGhB,cAAc,CAAC,KAAKiB,mBAAL,CAAyBC,OAA1B,CAAvC;AAEA,UAAIC,SAA0B,GAC5BjB,SAAS,CA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,6DAAqB,EAAG,IAAGoE,SAAS,CAACrD,KAAM,EAA3D;AACD;;AAED,WAAO6C,YAAP;AACD;;AAEOlC,EAAAA,0BAA0B,GAAuC;AACvE,UAAM;AAAED,MAAAA;AAAF,QAA6B,KAAKvC,KAAxC;;AACA,QAAI,CAACuC,sBAAL,EAA6B;AAC3B,aAAOA,sBAAP;AACD;;AAED,QACEA,sBAAsB,CAACoB,WAAvB,IACAwB,IAAI,CAACC,KAAL,CAAW7C,sBAAsB,CAACoB,WAAlC,MACEpB,sBAAsB,CAACoB,WAH3B,EAIE;AACA,aAAO,EACL,GAAGpB,sBADE;AAELoB,QAAAA,WAAW,EAAEwB,IAAI,CAACC,KAAL,CAAW7C,sBAAsB,CAACoB,WAAlC;AAFR,OAAP;AAID,KATD,MASO;AACL,aAAOpB,sBAAP;AACD;AACF;;AAvOsD;;gBAAnD7C,S,kBAIkB;AACpB0C,EAAAA,IAAI,EAAE;AADc,C;;AAsOxB,eAAe1C,SAAf","sourcesContent":["import React from 'react';\n\nimport {\n EmitterSubscription,\n findNodeHandle,\n NativeSyntheticEvent,\n Platform,\n StyleProp,\n UIManager,\n ViewStyle,\n} from 'react-native';\n\nimport FireworkSDK from '../FireworkSDK';\nimport type FWError from '../models/FWError';\nimport { FWEventName } from '../models/FWEventName';\nimport type AdConfiguration from '../models/AdConfiguration';\nimport type VideoFeedConfiguration from '../models/VideoFeedConfiguration';\nimport type { VideoFeedSource } from '../models/VideoFeedSource';\nimport type VideoPlayerConfiguration from '../models/VideoPlayerConfiguration';\nimport { FireworkSDKModuleEventEmitter } from '../modules/FireworkSDKModule';\nimport FWLoggerUtil from '../utils/FWLoggerUtil';\nimport FWVideoFeed from './FWVideoFeed';\n\nexport type VideoFeedMode = 'row' | 'column' | 'grid';\n\n/**\n * The props of VideoFeed component.\n */\nexport interface IVideoFeedProps {\n /**\n * Standard React Native View Style.\n */\n style?: StyleProp<ViewStyle>;\n /**\n * One of five available video feed sources.The playlistGroup is only supported on iOS\n */\n source: VideoFeedSource;\n /**\n * Channel id of the feed. Required when the source is set as channel or playlist or dynamicContent.\n */\n channel?: string;\n /**\n * Playlist id of the feed. Please note channel id is necessary. Required when the source is set as playlist.\n */\n playlist?: string;\n /**\n * PlaylistGroup id of the feed. Required when the source is set as playlistGroup. Only supported on iOS.\n */\n playlistGroup?: string;\n /**\n * The dynamic content parameters of the feed. Required when the source is set as dynamicContent.\n */\n dynamicContentParameters?: { [key: string]: string[] };\n /**\n * One of three available display modes. Defaults to row.\n */\n mode?: VideoFeedMode;\n /**\n * Configuration of the feed.\n */\n videoFeedConfiguration?: VideoFeedConfiguration;\n /**\n * Configuration of the player.\n */\n videoPlayerConfiguration?: VideoPlayerConfiguration;\n /**\n * Ad configuration of the feed. Only supported on iOS.\n */\n adConfiguration?: AdConfiguration;\n /**\n * Specifies if Picture in Picture is enabled.\n */\n enablePictureInPicture?: boolean;\n /**\n * The feed loading result callback. It means loading successfully when error equals to undefined. Only supported on iOS.\n */\n onVideoFeedLoadFinished?: (error?: FWError) => void;\n}\n\nconst NativeComponentName = 'FWVideoFeed';\n\n/**\n * VideoFeed component.\n */\nclass VideoFeed extends React.Component<IVideoFeedProps> {\n /**\n * @ignore\n */\n static defaultProps = {\n mode: 'row',\n };\n\n private _nativeComponentRef = React.createRef<any>();\n\n private _subscriptions: EmitterSubscription[] = [];\n\n public refresh = () => {\n FWLoggerUtil.log(`VideoFeed refresh ${JSON.stringify(this.props)}`);\n\n const nativeNodeHandle = findNodeHandle(this._nativeComponentRef.current);\n\n let commandId: string | number =\n UIManager.getViewManagerConfig(NativeComponentName).Commands.refresh;\n if (Platform.OS === 'android') {\n commandId = commandId.toString();\n }\n\n UIManager.dispatchViewManagerCommand(\n findNodeHandle(nativeNodeHandle),\n commandId,\n []\n );\n };\n\n private _onVideoFeedLoadFinished = (event: NativeSyntheticEvent<any>) => {\n FWLoggerUtil.log(\n `VideoFeed _onVideoFeedLoadFinished ${JSON.stringify(event.nativeEvent)}`\n );\n const { onVideoFeedLoadFinished } = this.props;\n\n const { name, reason } = event.nativeEvent;\n\n if (onVideoFeedLoadFinished) {\n if (name) {\n if (reason) {\n onVideoFeedLoadFinished({ name, reason });\n } else {\n onVideoFeedLoadFinished({ name });\n }\n } else {\n onVideoFeedLoadFinished();\n }\n }\n };\n\n /**\n * @ignore\n */\n componentDidMount() {\n FWLoggerUtil.log(\n `VideoFeed componentDidMount ${JSON.stringify(this.props)}`\n );\n\n const subscriptionOfShareBaseURLUpdated =\n FireworkSDKModuleEventEmitter.addListener(\n FWEventName.ShareBaseURLUpdated,\n () => {\n FWLoggerUtil.log('Receive FWEventName.ShareBaseURLUpdated');\n this.setState({});\n }\n );\n this._subscriptions.push(subscriptionOfShareBaseURLUpdated);\n\n const subscriptionOfAdBadgeConfigurationUpdated =\n FireworkSDKModuleEventEmitter.addListener(\n FWEventName.AdBadgeConfigurationUpdated,\n () => {\n FWLoggerUtil.log('Receive FWEventName.AdBadgeConfigurationUpdated');\n this.setState({});\n }\n );\n this._subscriptions.push(subscriptionOfAdBadgeConfigurationUpdated);\n\n const subscriptionOfVideoLaunchBehaviorUpdated =\n FireworkSDKModuleEventEmitter.addListener(\n FWEventName.VideoLaunchBehaviorUpdated,\n () => {\n FWLoggerUtil.log('Receive FWEventName.VideoLaunchBehaviorUpdated');\n this.setState({});\n }\n );\n this._subscriptions.push(subscriptionOfVideoLaunchBehaviorUpdated);\n }\n\n /**\n * @ignore\n */\n componentWillUnmount() {\n FWLoggerUtil.log(\n `VideoFeed componentWillUnmount ${JSON.stringify(this.props)}`\n );\n\n this._subscriptions.forEach((value) => {\n value.remove();\n });\n\n this._subscriptions = [];\n }\n\n /**\n * @ignore\n */\n render() {\n FWLoggerUtil.log(`VideoFeed render ${JSON.stringify(this.props)}`);\n\n const {\n source,\n channel = '',\n playlist = '',\n playlistGroup = '',\n mode = 'row',\n adConfiguration,\n enablePictureInPicture = false,\n } = this.props;\n const videoFeedConfiguration = this._getVideoFeedConfiguration();\n const titleHidden = videoFeedConfiguration?.title?.hidden ?? false;\n const titlePosition = videoFeedConfiguration?.titlePosition ?? 'nested';\n const shareBaseURL = FireworkSDK.getInstance().getShareBaseURL() ?? '';\n const adBadgeConfiguration =\n FireworkSDK.getInstance().getAdBadgeConfiguration() ?? {};\n const adBadgeTextType = adBadgeConfiguration.badgeTextType ?? '';\n const backgroundColorOfAdBadge = adBadgeConfiguration.backgroundColor ?? '';\n const textColorOfAdBadge = adBadgeConfiguration.textColor ?? '';\n const dynamicContentParametersString =\n this._generateDynamicContentParametersString();\n const enableAutoplay = videoFeedConfiguration?.enableAutoplay ?? false;\n\n const gridColumns = videoFeedConfiguration?.gridColumns ?? 2;\n const requiresAds = adConfiguration?.requiresAds ?? false;\n const adsFetchTimeout = adConfiguration?.adsFetchTimeout ?? 10;\n const vastAttributesString = this._generateVastAttributesString();\n const showAdBadge = videoFeedConfiguration?.showAdBadge ?? false;\n const videoLaunchBehavior =\n FireworkSDK.getInstance().getVideoLaunchBehavior() ?? 'default';\n\n let key = `source:${source}`;\n key += `_channel:${channel}`;\n key += `_playlist:${playlist}`;\n key += `_playlistGroup:${playlistGroup}`;\n key += `_mode:${mode}`;\n key += `_titleHidden:${titleHidden}`;\n key += `_titlePosition:${titlePosition}`;\n key += `_shareBaseURL:${shareBaseURL}`;\n key += `_adBadgeTextType:${adBadgeTextType}`;\n key += `_backgroundColorOfAdBadge:${backgroundColorOfAdBadge}`;\n key += `_textColorOfAdBadge:${textColorOfAdBadge}`;\n key += `_dynamicContentParameters:${dynamicContentParametersString}`;\n key += `_enableAutoplay:${enableAutoplay}`;\n key += `_enablePictureInPicture:${enablePictureInPicture}`;\n key += `_gridColumns:${gridColumns}`;\n key += `_requiresAds:${requiresAds}`;\n key += `_adsFetchTimeout:${adsFetchTimeout}`;\n key += `_vastAttributes:${vastAttributesString}`;\n key += `_showAdBadge:${showAdBadge}`;\n key += `_videoLaunchBehavior:${videoLaunchBehavior}`;\n\n return (\n <FWVideoFeed\n key={key}\n {...this.props}\n ref={this._nativeComponentRef}\n onVideoFeedLoadFinished={this._onVideoFeedLoadFinished}\n mode={mode}\n style={Object.assign({}, this.props.style, { zIndex: -1 })}\n />\n );\n }\n\n private _generateDynamicContentParametersString(): string {\n const { dynamicContentParameters } = this.props;\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 private _generateVastAttributesString(): string {\n const { adConfiguration } = this.props;\n const vastAttributes = adConfiguration?.vastAttributes ?? '';\n if (!vastAttributes) {\n return '';\n }\n\n let resultString = '';\n for (const attribute of vastAttributes) {\n if (resultString.length > 0) {\n resultString += '_';\n }\n resultString += `${attribute.name ?? ''}:${attribute.value}`;\n }\n\n return resultString;\n }\n\n private _getVideoFeedConfiguration(): VideoFeedConfiguration | undefined {\n const { videoFeedConfiguration } = this.props;\n if (!videoFeedConfiguration) {\n return videoFeedConfiguration;\n }\n\n if (\n videoFeedConfiguration.gridColumns &&\n Math.floor(videoFeedConfiguration.gridColumns!) !==\n videoFeedConfiguration.gridColumns\n ) {\n return {\n ...videoFeedConfiguration,\n gridColumns: Math.floor(videoFeedConfiguration.gridColumns!),\n };\n } else {\n return videoFeedConfiguration;\n }\n }\n}\n\nexport default VideoFeed;\n"]}
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import type { EmitterSubscription, StyleProp, ViewStyle } from 'react-native';
2
+ import type { StyleProp, ViewStyle } from 'react-native';
3
3
  import type FWError from '../models/FWError';
4
4
  import type { StoryBlockSource } from '../models/StoryBlockSource';
5
5
  /**
@@ -41,10 +41,19 @@ export interface IStoryBlockProps {
41
41
  * StoryBlock component. Only supported on iOS.
42
42
  */
43
43
  declare class StoryBlock extends React.Component<IStoryBlockProps> {
44
- nativeComponentRef: React.RefObject<any>;
45
- subscriptions: EmitterSubscription[];
44
+ private _nativeComponentRef;
45
+ private _subscriptions;
46
+ /**
47
+ * @ignore
48
+ */
46
49
  componentDidMount(): void;
50
+ /**
51
+ * @ignore
52
+ */
47
53
  componentWillUnmount(): void;
54
+ /**
55
+ * @ignore
56
+ */
48
57
  render(): JSX.Element;
49
58
  private _onStoryBlockLoadFinished;
50
59
  private _generateKey;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { EmitterSubscription, StyleProp, ViewStyle } from 'react-native';
2
+ import { StyleProp, ViewStyle } from 'react-native';
3
3
  import type FWError from '../models/FWError';
4
4
  import type AdConfiguration from '../models/AdConfiguration';
5
5
  import type VideoFeedConfiguration from '../models/VideoFeedConfiguration';
@@ -65,18 +65,27 @@ export interface IVideoFeedProps {
65
65
  * VideoFeed component.
66
66
  */
67
67
  declare class VideoFeed extends React.Component<IVideoFeedProps> {
68
+ /**
69
+ * @ignore
70
+ */
68
71
  static defaultProps: {
69
72
  mode: string;
70
73
  };
71
- nativeComponentRef: React.RefObject<any>;
72
- subscriptions: EmitterSubscription[];
73
- /**
74
- * Force refreshing the video feed.
75
- */
74
+ private _nativeComponentRef;
75
+ private _subscriptions;
76
76
  refresh: () => void;
77
77
  private _onVideoFeedLoadFinished;
78
+ /**
79
+ * @ignore
80
+ */
78
81
  componentDidMount(): void;
82
+ /**
83
+ * @ignore
84
+ */
79
85
  componentWillUnmount(): void;
86
+ /**
87
+ * @ignore
88
+ */
80
89
  render(): JSX.Element;
81
90
  private _generateDynamicContentParametersString;
82
91
  private _generateVastAttributesString;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-firework-sdk",
3
- "version": "2.0.0-beta.5",
3
+ "version": "2.0.0",
4
4
  "description": "Firework React Native SDK",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -60,7 +60,7 @@
60
60
  "react-native": "0.66.4",
61
61
  "react-native-builder-bob": "^0.18.0",
62
62
  "typedoc": "^0.23.27",
63
- "typescript": "^4.6.2"
63
+ "typescript": "^4.9.5"
64
64
  },
65
65
  "peerDependencies": {
66
66
  "react": "*",
@@ -101,7 +101,8 @@
101
101
  },
102
102
  "eslintIgnore": [
103
103
  "node_modules/",
104
- "lib/"
104
+ "lib/",
105
+ "docs/"
105
106
  ],
106
107
  "prettier": {
107
108
  "quoteProps": "consistent",
@@ -68,9 +68,13 @@ export interface IStoryBlockProps {
68
68
  * StoryBlock component. Only supported on iOS.
69
69
  */
70
70
  class StoryBlock extends React.Component<IStoryBlockProps> {
71
- nativeComponentRef = React.createRef<any>();
71
+ private _nativeComponentRef = React.createRef<any>();
72
72
 
73
- subscriptions: EmitterSubscription[] = [];
73
+ private _subscriptions: EmitterSubscription[] = [];
74
+
75
+ /**
76
+ * @ignore
77
+ */
74
78
  componentDidMount() {
75
79
  const subscriptionOfShareBaseURLUpdated =
76
80
  FireworkSDKModuleEventEmitter.addListener(
@@ -79,7 +83,7 @@ class StoryBlock extends React.Component<IStoryBlockProps> {
79
83
  this.setState({});
80
84
  }
81
85
  );
82
- this.subscriptions.push(subscriptionOfShareBaseURLUpdated);
86
+ this._subscriptions.push(subscriptionOfShareBaseURLUpdated);
83
87
 
84
88
  const subscriptionOfAdBadgeConfigurationUpdated =
85
89
  FireworkSDKModuleEventEmitter.addListener(
@@ -88,7 +92,7 @@ class StoryBlock extends React.Component<IStoryBlockProps> {
88
92
  this.setState({});
89
93
  }
90
94
  );
91
- this.subscriptions.push(subscriptionOfAdBadgeConfigurationUpdated);
95
+ this._subscriptions.push(subscriptionOfAdBadgeConfigurationUpdated);
92
96
 
93
97
  const subscriptionOfVideoLaunchBehaviorUpdated =
94
98
  FireworkSDKModuleEventEmitter.addListener(
@@ -98,10 +102,10 @@ class StoryBlock extends React.Component<IStoryBlockProps> {
98
102
  this.setState({});
99
103
  }
100
104
  );
101
- this.subscriptions.push(subscriptionOfVideoLaunchBehaviorUpdated);
105
+ this._subscriptions.push(subscriptionOfVideoLaunchBehaviorUpdated);
102
106
 
103
107
  if (Platform.OS === 'android') {
104
- const viewId = findNodeHandle(this.nativeComponentRef.current);
108
+ const viewId = findNodeHandle(this._nativeComponentRef.current);
105
109
  FWLoggerUtil.log(
106
110
  `StoryBlock componentDidMount createFragment viewId: ${viewId}`
107
111
  );
@@ -109,20 +113,26 @@ class StoryBlock extends React.Component<IStoryBlockProps> {
109
113
  }
110
114
  }
111
115
 
116
+ /**
117
+ * @ignore
118
+ */
112
119
  componentWillUnmount() {
113
- this.subscriptions.forEach((value) => {
120
+ this._subscriptions.forEach((value) => {
114
121
  value.remove();
115
122
  });
116
123
 
117
- this.subscriptions = [];
124
+ this._subscriptions = [];
118
125
  }
119
126
 
127
+ /**
128
+ * @ignore
129
+ */
120
130
  render() {
121
131
  const { style } = this.props;
122
132
 
123
133
  return (
124
134
  <FWStoryBlock
125
- ref={this.nativeComponentRef}
135
+ ref={this._nativeComponentRef}
126
136
  key={this._generateKey()}
127
137
  {...this.props}
128
138
  onStoryBlockLoadFinished={this._onStoryBlockLoadFinished}
@@ -83,21 +83,21 @@ const NativeComponentName = 'FWVideoFeed';
83
83
  * VideoFeed component.
84
84
  */
85
85
  class VideoFeed extends React.Component<IVideoFeedProps> {
86
+ /**
87
+ * @ignore
88
+ */
86
89
  static defaultProps = {
87
90
  mode: 'row',
88
91
  };
89
92
 
90
- nativeComponentRef = React.createRef<any>();
93
+ private _nativeComponentRef = React.createRef<any>();
91
94
 
92
- subscriptions: EmitterSubscription[] = [];
95
+ private _subscriptions: EmitterSubscription[] = [];
93
96
 
94
- /**
95
- * Force refreshing the video feed.
96
- */
97
97
  public refresh = () => {
98
98
  FWLoggerUtil.log(`VideoFeed refresh ${JSON.stringify(this.props)}`);
99
99
 
100
- const nativeNodeHandle = findNodeHandle(this.nativeComponentRef.current);
100
+ const nativeNodeHandle = findNodeHandle(this._nativeComponentRef.current);
101
101
 
102
102
  let commandId: string | number =
103
103
  UIManager.getViewManagerConfig(NativeComponentName).Commands.refresh;
@@ -133,6 +133,9 @@ class VideoFeed extends React.Component<IVideoFeedProps> {
133
133
  }
134
134
  };
135
135
 
136
+ /**
137
+ * @ignore
138
+ */
136
139
  componentDidMount() {
137
140
  FWLoggerUtil.log(
138
141
  `VideoFeed componentDidMount ${JSON.stringify(this.props)}`
@@ -146,7 +149,7 @@ class VideoFeed extends React.Component<IVideoFeedProps> {
146
149
  this.setState({});
147
150
  }
148
151
  );
149
- this.subscriptions.push(subscriptionOfShareBaseURLUpdated);
152
+ this._subscriptions.push(subscriptionOfShareBaseURLUpdated);
150
153
 
151
154
  const subscriptionOfAdBadgeConfigurationUpdated =
152
155
  FireworkSDKModuleEventEmitter.addListener(
@@ -156,7 +159,7 @@ class VideoFeed extends React.Component<IVideoFeedProps> {
156
159
  this.setState({});
157
160
  }
158
161
  );
159
- this.subscriptions.push(subscriptionOfAdBadgeConfigurationUpdated);
162
+ this._subscriptions.push(subscriptionOfAdBadgeConfigurationUpdated);
160
163
 
161
164
  const subscriptionOfVideoLaunchBehaviorUpdated =
162
165
  FireworkSDKModuleEventEmitter.addListener(
@@ -166,21 +169,27 @@ class VideoFeed extends React.Component<IVideoFeedProps> {
166
169
  this.setState({});
167
170
  }
168
171
  );
169
- this.subscriptions.push(subscriptionOfVideoLaunchBehaviorUpdated);
172
+ this._subscriptions.push(subscriptionOfVideoLaunchBehaviorUpdated);
170
173
  }
171
174
 
175
+ /**
176
+ * @ignore
177
+ */
172
178
  componentWillUnmount() {
173
179
  FWLoggerUtil.log(
174
180
  `VideoFeed componentWillUnmount ${JSON.stringify(this.props)}`
175
181
  );
176
182
 
177
- this.subscriptions.forEach((value) => {
183
+ this._subscriptions.forEach((value) => {
178
184
  value.remove();
179
185
  });
180
186
 
181
- this.subscriptions = [];
187
+ this._subscriptions = [];
182
188
  }
183
189
 
190
+ /**
191
+ * @ignore
192
+ */
184
193
  render() {
185
194
  FWLoggerUtil.log(`VideoFeed render ${JSON.stringify(this.props)}`);
186
195
 
@@ -239,7 +248,7 @@ class VideoFeed extends React.Component<IVideoFeedProps> {
239
248
  <FWVideoFeed
240
249
  key={key}
241
250
  {...this.props}
242
- ref={this.nativeComponentRef}
251
+ ref={this._nativeComponentRef}
243
252
  onVideoFeedLoadFinished={this._onVideoFeedLoadFinished}
244
253
  mode={mode}
245
254
  style={Object.assign({}, this.props.style, { zIndex: -1 })}