react-native-firework-sdk 1.2.3 → 1.2.4

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.
@@ -1,10 +1,12 @@
1
1
  package com.fireworksdk.bridge.reactnative.utils
2
+
2
3
  import com.facebook.react.bridge.*
3
4
  import com.fireworksdk.bridge.utils.FWJsonUtils
4
5
  import org.json.JSONArray
5
6
  import org.json.JSONException
6
7
  import org.json.JSONObject
7
8
 
9
+
8
10
  inline fun <reified T : Any> T.asMap(): WritableMap {
9
11
  val jsonString = FWJsonUtils.toJson(this)
10
12
  val jsonObject = JSONObject(jsonString)
@@ -9,6 +9,7 @@ import com.fireworksdk.bridge.reactnative.FWInitializationProvider
9
9
  import com.fireworksdk.bridge.reactnative.module.FireworkSDKModule
10
10
  import com.fireworksdk.bridge.reactnative.pages.FWContainerActivity
11
11
  import com.fireworksdk.bridge.utils.FWDateUtils
12
+ import com.fireworksdk.bridge.utils.FWJsonUtils
12
13
  import com.fireworksdk.bridge.utils.FWLogUtils
13
14
  import com.loopnow.fireworklibrary.data.Product
14
15
  import java.util.*
@@ -61,7 +62,39 @@ object FWEventUtils {
61
62
 
62
63
  fun sendVideoFeedClickEvent(reactContext: ReactContext, info: FWVideoFeedItemDetailsModel) {
63
64
  val eventMap = Arguments.createMap()
64
- eventMap.putMap("info", info.asMap())
65
+
66
+ val contentMap = Arguments.createMap()
67
+ contentMap.putInt("index", info.index?:0)
68
+ contentMap.putString("id", info.id)
69
+ contentMap.putInt("duration", info.duration?:0)
70
+ contentMap.putString("source", info.source)
71
+ contentMap.putString("title", info.title)
72
+ contentMap.putString("playlistGroup", info.playlistGroup)
73
+ contentMap.putString("playlist", info.playlist)
74
+ contentMap.putString("channel", info.channel)
75
+
76
+ val dynamicContentParametersMap = Arguments.createMap()
77
+ if (!info.dynamicContentParameters.isNullOrEmpty()) {
78
+ for (key in info.dynamicContentParameters.keys) {
79
+ val value = info.dynamicContentParameters[key]
80
+ val array = Arguments.createArray()
81
+ if (!value.isNullOrEmpty()) {
82
+ for(item in value) {
83
+ array.pushString(item)
84
+ }
85
+ }
86
+ dynamicContentParametersMap.putArray(key, array)
87
+ }
88
+ }
89
+ contentMap.putMap("dynamicContentParameters", dynamicContentParametersMap)
90
+
91
+ eventMap.putMap("info", contentMap)
92
+ // sendLogMessageEvent(reactContext, "[Android] Receive sendVideoFeedClickEvent event before: $info")
93
+ // val jsonString = FWJsonUtils.toJson(info)
94
+ // sendLogMessageEvent(reactContext, "[Android] Receive sendVideoFeedClickEvent event before2: $jsonString")
95
+ // eventMap.putMap("info", info.asMap())
96
+ // sendLogMessageEvent(reactContext, "[Android] Receive sendVideoFeedClickEvent event after: $eventMap")
97
+
65
98
  sendEvent(reactContext, FWEventName.VideoFeedClick.rawValue, eventMap)
66
99
  }
67
100
 
@@ -1 +1 @@
1
- {"version":3,"sources":["VideoFeed.tsx"],"names":["NativeComponentName","VideoFeed","React","Component","createRef","nativeNodeHandle","nativeComponentRef","current","UIManager","dispatchViewManagerCommand","getViewManagerConfig","Commands","refresh","event","name","reason","nativeEvent","props","onVideoFeedLoadFinished","componentDidMount","subscriptionOfShareBaseURLUpdated","FireworkSDKModuleEventEmitter","addListener","FWEventName","ShareBaseURLUpdated","setState","subscriptions","push","subscriptionOfAdBadgeConfigurationUpdated","AdBadgeConfigurationUpdated","componentWillUnmount","forEach","value","remove","render","source","channel","playlist","playlistGroup","mode","videoFeedConfiguration","titleHidden","title","hidden","titlePosition","customLayoutName","shareBaseURL","FireworkSDK","getInstance","adBadgeConfiguration","adBadgeTextType","badgeTextType","backgroundColorOfAdBadge","backgroundColor","textColorOfAdBadge","textColor","dynamicContentParametersString","_generateDynamicContentParametersString","key","_onVideoFeedLoadFinished","Object","assign","style","zIndex","dynamicContentParameters","resultString","sortedKeyList","keys","sort","valueString","join","length"],"mappings":";;;;;;;AAAA;;AAGA;;AAQA;;AAEA;;AAIA;;AACA;;;;;;;;AAoDA,MAAMA,mBAAmB,GAAG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A6B;AAC3BN,QAAAA,YAAY,IAAI,GAAhB;AACD;;AAEDA,MAAAA,YAAY,IAAK,GAAEP,GAAI,IAAGW,WAAY,EAAtC;AACD;;AAED,WAAOJ,YAAP;AACD;;AAjIqE;;;;gBAAnDhE,S,kBACG;AACpBsC,EAAAA,IAAI,EAAE;AADc,C","sourcesContent":["import React from 'react';\n\nimport type { NativeSyntheticEvent, TargetedEvent } from 'react-native';\nimport {\n EmitterSubscription,\n findNodeHandle,\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 VideoFeedConfiguration from '../models/VideoFeedConfiguration';\nimport type { VideoFeedSource } from '../models/VideoFeedSource';\nimport type VideoPlayerConfiguration from '../models/VideoPlayerConfiguration';\nimport { FireworkSDKModuleEventEmitter } from '../modules/FireworkSDKModule';\nimport FWVideoFeed from './FWVideoFeed';\n\nexport type VideoFeedMode = 'row' | 'column' | 'grid';\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.\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.\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 Video Feed.\n */\n videoFeedConfiguration?: VideoFeedConfiguration;\n /**\n * Configuration of Video Player.\n */\n videoPlayerConfiguration?: VideoPlayerConfiguration;\n /**\n * Video feed loading result callback. It means loading successfully when error equals to undefined.\n */\n onVideoFeedLoadFinished?: (error?: FWError) => void;\n}\n\ninterface VideoFeedLoadFinishedEvent extends TargetedEvent {\n name: string;\n reason?: string | null;\n}\n\nconst NativeComponentName = 'FWVideoFeed';\n\nexport default class 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 const nativeNodeHandle = findNodeHandle(this.nativeComponentRef.current);\n\n UIManager.dispatchViewManagerCommand(\n findNodeHandle(nativeNodeHandle),\n UIManager.getViewManagerConfig(NativeComponentName).Commands.refresh,\n []\n );\n };\n\n private _onVideoFeedLoadFinished = (\n event: NativeSyntheticEvent<VideoFeedLoadFinishedEvent>\n ) => {\n const { name, reason } = event.nativeEvent;\n if (this.props.onVideoFeedLoadFinished) {\n if (name) {\n this.props.onVideoFeedLoadFinished({ name, reason });\n } else {\n this.props.onVideoFeedLoadFinished();\n }\n }\n };\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\n componentWillUnmount() {\n this.subscriptions.forEach((value) => {\n value.remove();\n });\n\n this.subscriptions = [];\n }\n\n render() {\n const {\n source,\n channel = '',\n playlist = '',\n playlistGroup = '',\n mode = 'row',\n videoFeedConfiguration,\n } = this.props;\n const titleHidden = videoFeedConfiguration?.title?.hidden ?? false;\n const titlePosition = videoFeedConfiguration?.titlePosition ?? 'nested';\n const customLayoutName = videoFeedConfiguration?.customLayoutName ?? '';\n const shareBaseURL = FireworkSDK.getInstance().shareBaseURL ?? '';\n const adBadgeConfiguration =\n FireworkSDK.getInstance().adBadgeConfiguration ?? {};\n const adBadgeTextType = adBadgeConfiguration.badgeTextType ?? '';\n const backgroundColorOfAdBadge = adBadgeConfiguration.backgroundColor ?? '';\n const textColorOfAdBadge = adBadgeConfiguration.textColor ?? '';\n const dynamicContentParametersString =\n this._generateDynamicContentParametersString();\n\n let key = `source:${source}`;\n key += `_channel:${channel}`;\n key += `_playlist:${playlist}`;\n key += `_playlistGroup:${playlistGroup}`;\n key += `_mode:${mode}`;\n key += `_titleHidden:${titleHidden}`;\n key += `_titlePosition:${titlePosition}`;\n key += `_customLayoutName:${customLayoutName}`;\n key += `_shareBaseURL:${shareBaseURL}`;\n key += `_adBadgeTextType:${adBadgeTextType}`;\n key += `_backgroundColorOfAdBadge:${backgroundColorOfAdBadge}`;\n key += `_textColorOfAdBadge:${textColorOfAdBadge}`;\n key += `_dynamicContentParameters:${dynamicContentParametersString}`;\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"]}
1
+ {"version":3,"sources":["VideoFeed.tsx"],"names":["NativeComponentName","VideoFeed","React","Component","createRef","nativeNodeHandle","nativeComponentRef","current","UIManager","dispatchViewManagerCommand","getViewManagerConfig","Commands","refresh","event","name","reason","nativeEvent","props","onVideoFeedLoadFinished","componentDidMount","subscriptionOfShareBaseURLUpdated","FireworkSDKModuleEventEmitter","addListener","FWEventName","ShareBaseURLUpdated","setState","subscriptions","push","subscriptionOfAdBadgeConfigurationUpdated","AdBadgeConfigurationUpdated","componentWillUnmount","forEach","value","remove","render","source","channel","playlist","playlistGroup","mode","videoFeedConfiguration","titleHidden","title","hidden","titlePosition","customLayoutName","shareBaseURL","FireworkSDK","getInstance","adBadgeConfiguration","adBadgeTextType","badgeTextType","backgroundColorOfAdBadge","backgroundColor","textColorOfAdBadge","textColor","dynamicContentParametersString","_generateDynamicContentParametersString","key","_onVideoFeedLoadFinished","Object","assign","style","zIndex","dynamicContentParameters","resultString","sortedKeyList","keys","sort","valueString","join","length"],"mappings":";;;;;;;AAAA;;AAGA;;AAQA;;AAEA;;AAIA;;AACA;;;;;;;;AAoDA,MAAMA,mBAAmB,GAAG,aAA5B;;AAEe,MAAMC,SAAN,SAAwBC,eAAMC,SAA9B,CAAyD;AAAA;AAAA;;AAAA,6DAKjDD,eAAME,SAAN,EALiD;;AAAA,2CAO/B,EAP+B;;AAAA,qCAYrD,MAAM;AACrB,YAAMC,gBAAgB,GAAG,iCAAe,KAAKC,kBAAL,CAAwBC,OAAvC,CAAzB;;AAEAC,6BAAUC,0BAAV,CACE,iCAAeJ,gBAAf,CADF,EAEEG,uBAAUE,oBAAV,CAA+BV,mBAA/B,EAAoDW,QAApD,CAA6DC,OAF/D,EAGE,EAHF;AAKD,KApBqE;;AAAA,sDAuBpEC,KADiC,IAE9B;AACH,YAAM;AAAEC,QAAAA,IAAF;AAAQC,QAAAA;AAAR,UAAmBF,KAAK,CAACG,WAA/B;;AACA,UAAI,KAAKC,KAAL,CAAWC,uBAAf,EAAwC;AACtC,YAAIJ,IAAJ,EAAU;AACR,eAAKG,KAAL,CAAWC,uBAAX,CAAmC;AAAEJ,YAAAA,IAAF;AAAQC,YAAAA;AAAR,WAAnC;AACD,SAFD,MAEO;AACL,eAAKE,KAAL,CAAWC,uBAAX;AACD;AACF;AACF,KAjCqE;AAAA;;AAmCtEC,EAAAA,iBAAiB,GAA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AUD;;AAEON,EAAAA,uCAAuC,GAAW;AACxD,UAAM;AAAEO,MAAAA;AAAF,QAA+B,KAAK/C,KAA1C;;AACA,QAAI,CAAC+C,wBAAL,EAA+B;AAC7B,aAAO,EAAP;AACD;;AAED,QAAIC,YAAY,GAAG,EAAnB;AACA,UAAMC,aAAa,GAAGN,MAAM,CAACO,IAAP,CAAYH,wBAAZ,EAAsCI,IAAtC,EAAtB;;AACA,SAAK,MAAMV,GAAX,IAAkBQ,aAAlB,EAAiC;AAC/B,YAAMlC,KAAK,GAAGgC,wBAAwB,CAACN,GAAD,CAAtC;AACA,YAAMW,WAAW,GAAGrC,KAAK,CAACsC,IAAN,CAAW,GAAX,CAApB;;AACA,UAAIL,YAAY,CAACM,MAAb,GAAsB,CAA1B,EAA6B;AAC3BN,QAAAA,YAAY,IAAI,GAAhB;AACD;;AAEDA,MAAAA,YAAY,IAAK,GAAEP,GAAI,IAAGW,WAAY,EAAtC;AACD;;AAED,WAAOJ,YAAP;AACD;;AAjIqE;;;;gBAAnDhE,S,kBACG;AACpBsC,EAAAA,IAAI,EAAE;AADc,C","sourcesContent":["import React from 'react';\n\nimport type { NativeSyntheticEvent, TargetedEvent } from 'react-native';\nimport {\n EmitterSubscription,\n findNodeHandle,\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 VideoFeedConfiguration from '../models/VideoFeedConfiguration';\nimport type { VideoFeedSource } from '../models/VideoFeedSource';\nimport type VideoPlayerConfiguration from '../models/VideoPlayerConfiguration';\nimport { FireworkSDKModuleEventEmitter } from '../modules/FireworkSDKModule';\nimport FWVideoFeed from './FWVideoFeed';\n\nexport type VideoFeedMode = 'row' | 'column' | 'grid';\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.\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.\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 * The feed loading result callback. It means loading successfully when error equals to undefined.\n */\n onVideoFeedLoadFinished?: (error?: FWError) => void;\n}\n\ninterface VideoFeedLoadFinishedEvent extends TargetedEvent {\n name: string;\n reason?: string | null;\n}\n\nconst NativeComponentName = 'FWVideoFeed';\n\nexport default class 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 const nativeNodeHandle = findNodeHandle(this.nativeComponentRef.current);\n\n UIManager.dispatchViewManagerCommand(\n findNodeHandle(nativeNodeHandle),\n UIManager.getViewManagerConfig(NativeComponentName).Commands.refresh,\n []\n );\n };\n\n private _onVideoFeedLoadFinished = (\n event: NativeSyntheticEvent<VideoFeedLoadFinishedEvent>\n ) => {\n const { name, reason } = event.nativeEvent;\n if (this.props.onVideoFeedLoadFinished) {\n if (name) {\n this.props.onVideoFeedLoadFinished({ name, reason });\n } else {\n this.props.onVideoFeedLoadFinished();\n }\n }\n };\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\n componentWillUnmount() {\n this.subscriptions.forEach((value) => {\n value.remove();\n });\n\n this.subscriptions = [];\n }\n\n render() {\n const {\n source,\n channel = '',\n playlist = '',\n playlistGroup = '',\n mode = 'row',\n videoFeedConfiguration,\n } = this.props;\n const titleHidden = videoFeedConfiguration?.title?.hidden ?? false;\n const titlePosition = videoFeedConfiguration?.titlePosition ?? 'nested';\n const customLayoutName = videoFeedConfiguration?.customLayoutName ?? '';\n const shareBaseURL = FireworkSDK.getInstance().shareBaseURL ?? '';\n const adBadgeConfiguration =\n FireworkSDK.getInstance().adBadgeConfiguration ?? {};\n const adBadgeTextType = adBadgeConfiguration.badgeTextType ?? '';\n const backgroundColorOfAdBadge = adBadgeConfiguration.backgroundColor ?? '';\n const textColorOfAdBadge = adBadgeConfiguration.textColor ?? '';\n const dynamicContentParametersString =\n this._generateDynamicContentParametersString();\n\n let key = `source:${source}`;\n key += `_channel:${channel}`;\n key += `_playlist:${playlist}`;\n key += `_playlistGroup:${playlistGroup}`;\n key += `_mode:${mode}`;\n key += `_titleHidden:${titleHidden}`;\n key += `_titlePosition:${titlePosition}`;\n key += `_customLayoutName:${customLayoutName}`;\n key += `_shareBaseURL:${shareBaseURL}`;\n key += `_adBadgeTextType:${adBadgeTextType}`;\n key += `_backgroundColorOfAdBadge:${backgroundColorOfAdBadge}`;\n key += `_textColorOfAdBadge:${textColorOfAdBadge}`;\n key += `_dynamicContentParameters:${dynamicContentParametersString}`;\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"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["VideoFeed.tsx"],"names":["React","findNodeHandle","UIManager","FireworkSDK","FWEventName","FireworkSDKModuleEventEmitter","FWVideoFeed","NativeComponentName","VideoFeed","Component","createRef","nativeNodeHandle","nativeComponentRef","current","dispatchViewManagerCommand","getViewManagerConfig","Commands","refresh","event","name","reason","nativeEvent","props","onVideoFeedLoadFinished","componentDidMount","subscriptionOfShareBaseURLUpdated","addListener","ShareBaseURLUpdated","setState","subscriptions","push","subscriptionOfAdBadgeConfigurationUpdated","AdBadgeConfigurationUpdated","componentWillUnmount","forEach","value","remove","render","source","channel","playlist","playlistGroup","mode","videoFeedConfiguration","titleHidden","title","hidden","titlePosition","customLayoutName","shareBaseURL","getInstance","adBadgeConfiguration","adBadgeTextType","badgeTextType","backgroundColorOfAdBadge","backgroundColor","textColorOfAdBadge","textColor","dynamicContentParametersString","_generateDynamicContentParametersString","key","_onVideoFeedLoadFinished","Object","assign","style","zIndex","dynamicContentParameters","resultString","sortedKeyList","keys","sort","valueString","join","length"],"mappings":";;;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AAGA,SAEEC,cAFF,EAIEC,SAJF,QAMO,cANP;AAQA,OAAOC,WAAP,MAAwB,gBAAxB;AAEA,SAASC,WAAT,QAA4B,uBAA5B;AAIA,SAASC,6BAAT,QAA8C,8BAA9C;AACA,OAAOC,WAAP,MAAwB,eAAxB;AAoDA,MAAMC,mBAAmB,GAAG,aAA5B;AAEA,eAAe,MAAMC,SAAN,SAAwBR,KAAK,CAACS,SAA9B,CAAyD;AAAA;AAAA;;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3BN,QAAAA,YAAY,IAAI,GAAhB;AACD;;AAEDA,MAAAA,YAAY,IAAK,GAAEP,GAAI,IAAGW,WAAY,EAAtC;AACD;;AAED,WAAOJ,YAAP;AACD;;AAjIqE;;gBAAnD3D,S,kBACG;AACpBkC,EAAAA,IAAI,EAAE;AADc,C","sourcesContent":["import React from 'react';\n\nimport type { NativeSyntheticEvent, TargetedEvent } from 'react-native';\nimport {\n EmitterSubscription,\n findNodeHandle,\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 VideoFeedConfiguration from '../models/VideoFeedConfiguration';\nimport type { VideoFeedSource } from '../models/VideoFeedSource';\nimport type VideoPlayerConfiguration from '../models/VideoPlayerConfiguration';\nimport { FireworkSDKModuleEventEmitter } from '../modules/FireworkSDKModule';\nimport FWVideoFeed from './FWVideoFeed';\n\nexport type VideoFeedMode = 'row' | 'column' | 'grid';\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.\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.\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 Video Feed.\n */\n videoFeedConfiguration?: VideoFeedConfiguration;\n /**\n * Configuration of Video Player.\n */\n videoPlayerConfiguration?: VideoPlayerConfiguration;\n /**\n * Video feed loading result callback. It means loading successfully when error equals to undefined.\n */\n onVideoFeedLoadFinished?: (error?: FWError) => void;\n}\n\ninterface VideoFeedLoadFinishedEvent extends TargetedEvent {\n name: string;\n reason?: string | null;\n}\n\nconst NativeComponentName = 'FWVideoFeed';\n\nexport default class 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 const nativeNodeHandle = findNodeHandle(this.nativeComponentRef.current);\n\n UIManager.dispatchViewManagerCommand(\n findNodeHandle(nativeNodeHandle),\n UIManager.getViewManagerConfig(NativeComponentName).Commands.refresh,\n []\n );\n };\n\n private _onVideoFeedLoadFinished = (\n event: NativeSyntheticEvent<VideoFeedLoadFinishedEvent>\n ) => {\n const { name, reason } = event.nativeEvent;\n if (this.props.onVideoFeedLoadFinished) {\n if (name) {\n this.props.onVideoFeedLoadFinished({ name, reason });\n } else {\n this.props.onVideoFeedLoadFinished();\n }\n }\n };\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\n componentWillUnmount() {\n this.subscriptions.forEach((value) => {\n value.remove();\n });\n\n this.subscriptions = [];\n }\n\n render() {\n const {\n source,\n channel = '',\n playlist = '',\n playlistGroup = '',\n mode = 'row',\n videoFeedConfiguration,\n } = this.props;\n const titleHidden = videoFeedConfiguration?.title?.hidden ?? false;\n const titlePosition = videoFeedConfiguration?.titlePosition ?? 'nested';\n const customLayoutName = videoFeedConfiguration?.customLayoutName ?? '';\n const shareBaseURL = FireworkSDK.getInstance().shareBaseURL ?? '';\n const adBadgeConfiguration =\n FireworkSDK.getInstance().adBadgeConfiguration ?? {};\n const adBadgeTextType = adBadgeConfiguration.badgeTextType ?? '';\n const backgroundColorOfAdBadge = adBadgeConfiguration.backgroundColor ?? '';\n const textColorOfAdBadge = adBadgeConfiguration.textColor ?? '';\n const dynamicContentParametersString =\n this._generateDynamicContentParametersString();\n\n let key = `source:${source}`;\n key += `_channel:${channel}`;\n key += `_playlist:${playlist}`;\n key += `_playlistGroup:${playlistGroup}`;\n key += `_mode:${mode}`;\n key += `_titleHidden:${titleHidden}`;\n key += `_titlePosition:${titlePosition}`;\n key += `_customLayoutName:${customLayoutName}`;\n key += `_shareBaseURL:${shareBaseURL}`;\n key += `_adBadgeTextType:${adBadgeTextType}`;\n key += `_backgroundColorOfAdBadge:${backgroundColorOfAdBadge}`;\n key += `_textColorOfAdBadge:${textColorOfAdBadge}`;\n key += `_dynamicContentParameters:${dynamicContentParametersString}`;\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"]}
1
+ {"version":3,"sources":["VideoFeed.tsx"],"names":["React","findNodeHandle","UIManager","FireworkSDK","FWEventName","FireworkSDKModuleEventEmitter","FWVideoFeed","NativeComponentName","VideoFeed","Component","createRef","nativeNodeHandle","nativeComponentRef","current","dispatchViewManagerCommand","getViewManagerConfig","Commands","refresh","event","name","reason","nativeEvent","props","onVideoFeedLoadFinished","componentDidMount","subscriptionOfShareBaseURLUpdated","addListener","ShareBaseURLUpdated","setState","subscriptions","push","subscriptionOfAdBadgeConfigurationUpdated","AdBadgeConfigurationUpdated","componentWillUnmount","forEach","value","remove","render","source","channel","playlist","playlistGroup","mode","videoFeedConfiguration","titleHidden","title","hidden","titlePosition","customLayoutName","shareBaseURL","getInstance","adBadgeConfiguration","adBadgeTextType","badgeTextType","backgroundColorOfAdBadge","backgroundColor","textColorOfAdBadge","textColor","dynamicContentParametersString","_generateDynamicContentParametersString","key","_onVideoFeedLoadFinished","Object","assign","style","zIndex","dynamicContentParameters","resultString","sortedKeyList","keys","sort","valueString","join","length"],"mappings":";;;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AAGA,SAEEC,cAFF,EAIEC,SAJF,QAMO,cANP;AAQA,OAAOC,WAAP,MAAwB,gBAAxB;AAEA,SAASC,WAAT,QAA4B,uBAA5B;AAIA,SAASC,6BAAT,QAA8C,8BAA9C;AACA,OAAOC,WAAP,MAAwB,eAAxB;AAoDA,MAAMC,mBAAmB,GAAG,aAA5B;AAEA,eAAe,MAAMC,SAAN,SAAwBR,KAAK,CAACS,SAA9B,CAAyD;AAAA;AAAA;;AAAA,6DAKjDT,KAAK,CAACU,SAAN,EALiD;;AAAA,2CAO/B,EAP+B;;AAAA,qCAYrD,MAAM;AACrB,YAAMC,gBAAgB,GAAGV,cAAc,CAAC,KAAKW,kBAAL,CAAwBC,OAAzB,CAAvC;AAEAX,MAAAA,SAAS,CAACY,0BAAV,CACEb,cAAc,CAACU,gBAAD,CADhB,EAEET,SAAS,CAACa,oBAAV,CAA+BR,mBAA/B,EAAoDS,QAApD,CAA6DC,OAF/D,EAGE,EAHF;AAKD,KApBqE;;AAAA,sDAuBpEC,KADiC,IAE9B;AACH,YAAM;AAAEC,QAAAA,IAAF;AAAQC,QAAAA;AAAR,UAAmBF,KAAK,CAACG,WAA/B;;AACA,UAAI,KAAKC,KAAL,CAAWC,uBAAf,EAAwC;AACtC,YAAIJ,IA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AKV,kBAHZ;AAIE,MAAA,uBAAuB,EAAE,KAAKiD,wBAJhC;AAKE,MAAA,IAAI,EAAEnB,IALR;AAME,MAAA,KAAK,EAAEoB,MAAM,CAACC,MAAP,CAAc,EAAd,EAAkB,KAAKzC,KAAL,CAAW0C,KAA7B,EAAoC;AAAEC,QAAAA,MAAM,EAAE,CAAC;AAAX,OAApC;AANT,OADF;AAUD;;AAEON,EAAAA,uCAAuC,GAAW;AACxD,UAAM;AAAEO,MAAAA;AAAF,QAA+B,KAAK5C,KAA1C;;AACA,QAAI,CAAC4C,wBAAL,EAA+B;AAC7B,aAAO,EAAP;AACD;;AAED,QAAIC,YAAY,GAAG,EAAnB;AACA,UAAMC,aAAa,GAAGN,MAAM,CAACO,IAAP,CAAYH,wBAAZ,EAAsCI,IAAtC,EAAtB;;AACA,SAAK,MAAMV,GAAX,IAAkBQ,aAAlB,EAAiC;AAC/B,YAAMjC,KAAK,GAAG+B,wBAAwB,CAACN,GAAD,CAAtC;AACA,YAAMW,WAAW,GAAGpC,KAAK,CAACqC,IAAN,CAAW,GAAX,CAApB;;AACA,UAAIL,YAAY,CAACM,MAAb,GAAsB,CAA1B,EAA6B;AAC3BN,QAAAA,YAAY,IAAI,GAAhB;AACD;;AAEDA,MAAAA,YAAY,IAAK,GAAEP,GAAI,IAAGW,WAAY,EAAtC;AACD;;AAED,WAAOJ,YAAP;AACD;;AAjIqE;;gBAAnD3D,S,kBACG;AACpBkC,EAAAA,IAAI,EAAE;AADc,C","sourcesContent":["import React from 'react';\n\nimport type { NativeSyntheticEvent, TargetedEvent } from 'react-native';\nimport {\n EmitterSubscription,\n findNodeHandle,\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 VideoFeedConfiguration from '../models/VideoFeedConfiguration';\nimport type { VideoFeedSource } from '../models/VideoFeedSource';\nimport type VideoPlayerConfiguration from '../models/VideoPlayerConfiguration';\nimport { FireworkSDKModuleEventEmitter } from '../modules/FireworkSDKModule';\nimport FWVideoFeed from './FWVideoFeed';\n\nexport type VideoFeedMode = 'row' | 'column' | 'grid';\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.\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.\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 * The feed loading result callback. It means loading successfully when error equals to undefined.\n */\n onVideoFeedLoadFinished?: (error?: FWError) => void;\n}\n\ninterface VideoFeedLoadFinishedEvent extends TargetedEvent {\n name: string;\n reason?: string | null;\n}\n\nconst NativeComponentName = 'FWVideoFeed';\n\nexport default class 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 const nativeNodeHandle = findNodeHandle(this.nativeComponentRef.current);\n\n UIManager.dispatchViewManagerCommand(\n findNodeHandle(nativeNodeHandle),\n UIManager.getViewManagerConfig(NativeComponentName).Commands.refresh,\n []\n );\n };\n\n private _onVideoFeedLoadFinished = (\n event: NativeSyntheticEvent<VideoFeedLoadFinishedEvent>\n ) => {\n const { name, reason } = event.nativeEvent;\n if (this.props.onVideoFeedLoadFinished) {\n if (name) {\n this.props.onVideoFeedLoadFinished({ name, reason });\n } else {\n this.props.onVideoFeedLoadFinished();\n }\n }\n };\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\n componentWillUnmount() {\n this.subscriptions.forEach((value) => {\n value.remove();\n });\n\n this.subscriptions = [];\n }\n\n render() {\n const {\n source,\n channel = '',\n playlist = '',\n playlistGroup = '',\n mode = 'row',\n videoFeedConfiguration,\n } = this.props;\n const titleHidden = videoFeedConfiguration?.title?.hidden ?? false;\n const titlePosition = videoFeedConfiguration?.titlePosition ?? 'nested';\n const customLayoutName = videoFeedConfiguration?.customLayoutName ?? '';\n const shareBaseURL = FireworkSDK.getInstance().shareBaseURL ?? '';\n const adBadgeConfiguration =\n FireworkSDK.getInstance().adBadgeConfiguration ?? {};\n const adBadgeTextType = adBadgeConfiguration.badgeTextType ?? '';\n const backgroundColorOfAdBadge = adBadgeConfiguration.backgroundColor ?? '';\n const textColorOfAdBadge = adBadgeConfiguration.textColor ?? '';\n const dynamicContentParametersString =\n this._generateDynamicContentParametersString();\n\n let key = `source:${source}`;\n key += `_channel:${channel}`;\n key += `_playlist:${playlist}`;\n key += `_playlistGroup:${playlistGroup}`;\n key += `_mode:${mode}`;\n key += `_titleHidden:${titleHidden}`;\n key += `_titlePosition:${titlePosition}`;\n key += `_customLayoutName:${customLayoutName}`;\n key += `_shareBaseURL:${shareBaseURL}`;\n key += `_adBadgeTextType:${adBadgeTextType}`;\n key += `_backgroundColorOfAdBadge:${backgroundColorOfAdBadge}`;\n key += `_textColorOfAdBadge:${textColorOfAdBadge}`;\n key += `_dynamicContentParameters:${dynamicContentParametersString}`;\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"]}
@@ -37,15 +37,15 @@ export interface IVideoFeedProps {
37
37
  */
38
38
  mode?: VideoFeedMode;
39
39
  /**
40
- * Configuration of Video Feed.
40
+ * Configuration of the feed.
41
41
  */
42
42
  videoFeedConfiguration?: VideoFeedConfiguration;
43
43
  /**
44
- * Configuration of Video Player.
44
+ * Configuration of the player.
45
45
  */
46
46
  videoPlayerConfiguration?: VideoPlayerConfiguration;
47
47
  /**
48
- * Video feed loading result callback. It means loading successfully when error equals to undefined.
48
+ * The feed loading result callback. It means loading successfully when error equals to undefined.
49
49
  */
50
50
  onVideoFeedLoadFinished?: (error?: FWError) => void;
51
51
  }
@@ -11,11 +11,14 @@ export default interface FeedItemDetails {
11
11
  id: string;
12
12
  /**
13
13
  * The total duration of the video.
14
- * If the source is playlistGroup this value will always be 0; otherwise this value is the duration of the selected video.
14
+ * If the source is playlistGroup this value will always be 0.
15
+ * Otherwise this value is the duration of the selected video.
15
16
  */
16
17
  duration: number;
17
18
  /**
18
- * The title of the feed item. Currently, the title doesn't have value on the Android side when the source is playlistGroup.
19
+ * The title of the feed item.
20
+ * Currently, the property doesn't have value on the Android side when the source is playlistGroup.
21
+ * But the property has value for other feed sources.
19
22
  */
20
23
  title?: string | null;
21
24
  /**
@@ -23,7 +26,8 @@ export default interface FeedItemDetails {
23
26
  */
24
27
  source: VideoFeedSource;
25
28
  /**
26
- * The channel id of the feed. The property has value when the source is channel or playlist or dynamicContent.
29
+ * The channel id of the feed.
30
+ * The property has value when the source is channel or playlist or dynamicContent.
27
31
  */
28
32
  channel?: string | null;
29
33
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-firework-sdk",
3
- "version": "1.2.3",
3
+ "version": "1.2.4",
4
4
  "description": "Firework React Native SDK",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -50,15 +50,15 @@ export interface IVideoFeedProps {
50
50
  */
51
51
  mode?: VideoFeedMode;
52
52
  /**
53
- * Configuration of Video Feed.
53
+ * Configuration of the feed.
54
54
  */
55
55
  videoFeedConfiguration?: VideoFeedConfiguration;
56
56
  /**
57
- * Configuration of Video Player.
57
+ * Configuration of the player.
58
58
  */
59
59
  videoPlayerConfiguration?: VideoPlayerConfiguration;
60
60
  /**
61
- * Video feed loading result callback. It means loading successfully when error equals to undefined.
61
+ * The feed loading result callback. It means loading successfully when error equals to undefined.
62
62
  */
63
63
  onVideoFeedLoadFinished?: (error?: FWError) => void;
64
64
  }
@@ -12,11 +12,14 @@ export default interface FeedItemDetails {
12
12
  id: string;
13
13
  /**
14
14
  * The total duration of the video.
15
- * If the source is playlistGroup this value will always be 0; otherwise this value is the duration of the selected video.
15
+ * If the source is playlistGroup this value will always be 0.
16
+ * Otherwise this value is the duration of the selected video.
16
17
  */
17
18
  duration: number;
18
19
  /**
19
- * The title of the feed item. Currently, the title doesn't have value on the Android side when the source is playlistGroup.
20
+ * The title of the feed item.
21
+ * Currently, the property doesn't have value on the Android side when the source is playlistGroup.
22
+ * But the property has value for other feed sources.
20
23
  */
21
24
  title?: string | null;
22
25
  /**
@@ -24,7 +27,8 @@ export default interface FeedItemDetails {
24
27
  */
25
28
  source: VideoFeedSource;
26
29
  /**
27
- * The channel id of the feed. The property has value when the source is channel or playlist or dynamicContent.
30
+ * The channel id of the feed.
31
+ * The property has value when the source is channel or playlist or dynamicContent.
28
32
  */
29
33
  channel?: string | null;
30
34
  /**