react-native-firework-sdk 1.7.0 → 1.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/src/main/java/com/fireworksdk/bridge/components/videofeed/FWVideoFeed.kt +0 -1
- package/android/src/main/java/com/fireworksdk/bridge/models/FWEventName.kt +1 -0
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/models/FWVideoShoppingInterface.kt +1 -0
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FWVideoShoppingModule.kt +11 -1
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FireworkSDKModule.kt +3 -3
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/utils/FWEventUtils.kt +9 -0
- package/android/src/main/java/com/fireworksdk/bridge/utils/FWLanguageUtil.kt +20 -2
- package/android/src/main/java/com/fireworksdk/bridge/utils/FWVideoPlayerUtils.kt +1 -0
- package/ios/Components/StoryBlock.swift +1 -8
- package/ios/Components/StoryBlockManager.swift +4 -0
- package/ios/Components/VideoFeed.swift +9 -14
- package/ios/Components/VideoFeedConfiguration.swift +2 -0
- package/ios/Components/VideoFeedManager.m +2 -0
- package/ios/Components/VideoFeedManager.swift +4 -0
- package/ios/Components/VideoPlayerConfiguration.swift +1 -0
- package/ios/FireworkSdk.xcodeproj/project.pbxproj +12 -8
- package/ios/Models/Common/FontInfo.swift +57 -0
- package/ios/Modules/FWNavigatorModule/FWNavigatorModule.m +2 -0
- package/ios/Modules/FWNavigatorModule/FWNavigatorModule.swift +249 -103
- package/ios/Modules/FireworkSDKModule/FireworkSDKModule+EventTracking.swift +0 -2
- package/ios/Modules/FireworkSDKModule/FireworkSDKModule.swift +12 -12
- package/ios/Modules/LiveStream/LiveStreamModule.swift +5 -3
- package/ios/Modules/Shopping/ProductInfoViewConfiguration.swift +7 -2
- package/ios/Modules/Shopping/ShoppingModule.m +1 -1
- package/ios/Modules/Shopping/ShoppingModule.swift +72 -63
- package/ios/Utils/FWSwizzleLoader.m +0 -1
- package/lib/commonjs/FWNavigator.js +32 -1
- package/lib/commonjs/FWNavigator.js.map +1 -1
- package/lib/commonjs/FireworkSDK.js +9 -12
- package/lib/commonjs/FireworkSDK.js.map +1 -1
- package/lib/commonjs/VideoShopping.js +64 -9
- package/lib/commonjs/VideoShopping.js.map +1 -1
- package/lib/commonjs/components/VideoFeed.js +14 -5
- package/lib/commonjs/components/VideoFeed.js.map +1 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/models/FWEventName.js +1 -0
- package/lib/commonjs/models/FWEventName.js.map +1 -1
- package/lib/commonjs/models/IOSFontInfo.js +2 -0
- package/lib/commonjs/models/IOSFontInfo.js.map +1 -0
- package/lib/commonjs/modules/FWNavigatorModule.js.map +1 -1
- package/lib/commonjs/modules/ShoppingModule.js.map +1 -1
- package/lib/module/FWNavigator.js +31 -1
- package/lib/module/FWNavigator.js.map +1 -1
- package/lib/module/FireworkSDK.js +10 -11
- package/lib/module/FireworkSDK.js.map +1 -1
- package/lib/module/VideoShopping.js +63 -9
- package/lib/module/VideoShopping.js.map +1 -1
- package/lib/module/components/VideoFeed.js +14 -5
- package/lib/module/components/VideoFeed.js.map +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/models/FWEventName.js +1 -0
- package/lib/module/models/FWEventName.js.map +1 -1
- package/lib/module/models/IOSFontInfo.js +2 -0
- package/lib/module/models/IOSFontInfo.js.map +1 -0
- package/lib/module/modules/FWNavigatorModule.js.map +1 -1
- package/lib/module/modules/ShoppingModule.js.map +1 -1
- package/lib/typescript/FWNavigator.d.ts +16 -1
- package/lib/typescript/FireworkSDK.d.ts +2 -0
- package/lib/typescript/VideoShopping.d.ts +28 -6
- package/lib/typescript/components/VideoFeed.d.ts +4 -0
- package/lib/typescript/index.d.ts +6 -4
- package/lib/typescript/models/FWEventName.d.ts +2 -1
- package/lib/typescript/models/FWEvents.d.ts +5 -0
- package/lib/typescript/models/IOSFontInfo.d.ts +19 -0
- package/lib/typescript/models/ProductInfoViewConfiguration.d.ts +23 -0
- package/lib/typescript/models/VideoFeedConfiguration.d.ts +19 -1
- package/lib/typescript/models/VideoPlayerConfiguration.d.ts +16 -0
- package/lib/typescript/modules/FWNavigatorModule.d.ts +2 -0
- package/lib/typescript/modules/ShoppingModule.d.ts +2 -1
- package/package.json +1 -1
- package/react-native-firework-sdk.podspec +1 -1
- package/src/{FWNavigator.tsx → FWNavigator.ts} +29 -1
- package/src/FireworkSDK.ts +10 -10
- package/src/VideoShopping.ts +83 -11
- package/src/components/VideoFeed.tsx +12 -2
- package/src/{index.tsx → index.ts} +17 -1
- package/src/models/FWEventName.ts +1 -0
- package/src/models/FWEvents.ts +6 -0
- package/src/models/IOSFontInfo.ts +29 -0
- package/src/models/ProductInfoViewConfiguration.ts +25 -0
- package/src/models/VideoFeedConfiguration.ts +20 -1
- package/src/models/VideoPlayerConfiguration.ts +17 -0
- package/src/modules/FWNavigatorModule.ts +2 -0
- package/src/modules/ShoppingModule.ts +2 -4
- package/ios/Utils/FWPiPManager.swift +0 -24
- package/ios/Utils/UIButton+FWSwizzle.swift +0 -33
|
@@ -109,7 +109,7 @@ class VideoFeed extends _react.default.Component {
|
|
|
109
109
|
}
|
|
110
110
|
|
|
111
111
|
render() {
|
|
112
|
-
var _videoFeedConfigurati, _videoFeedConfigurati2, _videoFeedConfigurati3, _videoFeedConfigurati4, _FireworkSDK$getInsta, _FireworkSDK$getInsta2, _adBadgeConfiguration, _adBadgeConfiguration2, _adBadgeConfiguration3, _videoFeedConfigurati5, _videoFeedConfigurati6,
|
|
112
|
+
var _videoFeedConfigurati, _videoFeedConfigurati2, _videoFeedConfigurati3, _videoFeedConfigurati4, _FireworkSDK$getInsta, _FireworkSDK$getInsta2, _adBadgeConfiguration, _adBadgeConfiguration2, _adBadgeConfiguration3, _videoFeedConfigurati5, _videoFeedConfigurati6, _adConfiguration$requ, _adConfiguration$adsF, _videoFeedConfigurati7;
|
|
113
113
|
|
|
114
114
|
_FWLoggerUtil.default.log(`VideoFeed render ${JSON.stringify(this.props)}`);
|
|
115
115
|
|
|
@@ -119,7 +119,8 @@ class VideoFeed extends _react.default.Component {
|
|
|
119
119
|
playlist = '',
|
|
120
120
|
playlistGroup = '',
|
|
121
121
|
mode = 'row',
|
|
122
|
-
adConfiguration
|
|
122
|
+
adConfiguration,
|
|
123
|
+
enablePictureInPicture = false
|
|
123
124
|
} = this.props;
|
|
124
125
|
|
|
125
126
|
const videoFeedConfiguration = this._getVideoFeedConfiguration();
|
|
@@ -136,14 +137,21 @@ class VideoFeed extends _react.default.Component {
|
|
|
136
137
|
const dynamicContentParametersString = this._generateDynamicContentParametersString();
|
|
137
138
|
|
|
138
139
|
const enableAutoplay = (_videoFeedConfigurati5 = videoFeedConfiguration === null || videoFeedConfiguration === void 0 ? void 0 : videoFeedConfiguration.enableAutoplay) !== null && _videoFeedConfigurati5 !== void 0 ? _videoFeedConfigurati5 : false;
|
|
139
|
-
|
|
140
|
-
|
|
140
|
+
let enablePictureInPictureLegacy = false;
|
|
141
|
+
|
|
142
|
+
if (videoFeedConfiguration) {
|
|
143
|
+
var _enablePictureInPictu;
|
|
144
|
+
|
|
145
|
+
enablePictureInPictureLegacy = (_enablePictureInPictu = videoFeedConfiguration.enablePictureInPicture) !== null && _enablePictureInPictu !== void 0 ? _enablePictureInPictu : false;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
const gridColumns = (_videoFeedConfigurati6 = videoFeedConfiguration === null || videoFeedConfiguration === void 0 ? void 0 : videoFeedConfiguration.gridColumns) !== null && _videoFeedConfigurati6 !== void 0 ? _videoFeedConfigurati6 : 2;
|
|
141
149
|
const requiresAds = (_adConfiguration$requ = adConfiguration === null || adConfiguration === void 0 ? void 0 : adConfiguration.requiresAds) !== null && _adConfiguration$requ !== void 0 ? _adConfiguration$requ : false;
|
|
142
150
|
const adsFetchTimeout = (_adConfiguration$adsF = adConfiguration === null || adConfiguration === void 0 ? void 0 : adConfiguration.adsFetchTimeout) !== null && _adConfiguration$adsF !== void 0 ? _adConfiguration$adsF : 10;
|
|
143
151
|
|
|
144
152
|
const vastAttributesString = this._generateVastAttributesString();
|
|
145
153
|
|
|
146
|
-
const showAdBadge = (
|
|
154
|
+
const showAdBadge = (_videoFeedConfigurati7 = videoFeedConfiguration === null || videoFeedConfiguration === void 0 ? void 0 : videoFeedConfiguration.showAdBadge) !== null && _videoFeedConfigurati7 !== void 0 ? _videoFeedConfigurati7 : false;
|
|
147
155
|
let key = `source:${source}`;
|
|
148
156
|
key += `_channel:${channel}`;
|
|
149
157
|
key += `_playlist:${playlist}`;
|
|
@@ -159,6 +167,7 @@ class VideoFeed extends _react.default.Component {
|
|
|
159
167
|
key += `_dynamicContentParameters:${dynamicContentParametersString}`;
|
|
160
168
|
key += `_enableAutoplay:${enableAutoplay}`;
|
|
161
169
|
key += `_enablePictureInPicture:${enablePictureInPicture}`;
|
|
170
|
+
key += `_enablePictureInPictureLegacy:${enablePictureInPictureLegacy}`;
|
|
162
171
|
key += `_gridColumns:${gridColumns}`;
|
|
163
172
|
key += `_requiresAds:${requiresAds}`;
|
|
164
173
|
key += `_adsFetchTimeout:${adsFetchTimeout}`;
|
|
@@ -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","componentWillUnmount","forEach","value","remove","render","source","channel","playlist","playlistGroup","mode","adConfiguration","videoFeedConfiguration","_getVideoFeedConfiguration","titleHidden","title","hidden","titlePosition","customLayoutName","shareBaseURL","FireworkSDK","getInstance","adBadgeConfiguration","adBadgeTextType","badgeTextType","backgroundColorOfAdBadge","backgroundColor","textColorOfAdBadge","textColor","dynamicContentParametersString","_generateDynamicContentParametersString","enableAutoplay","enablePictureInPicture","gridColumns","requiresAds","adsFetchTimeout","vastAttributesString","_generateVastAttributesString","showAdBadge","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;;;;;;;;AAmDA,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;AACrBC,4BAAaC,GAAb,CAAkB,qBAAoBC,IAAI,CAACC,SAAL,CAAe,KAAKC,KAApB,CAA2B,EAAjE;;AAEA,YAAMC,gBAAgB,GAAG,iCAAe,KAAKC,kBAAL,CAAwBC,OAAvC,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,EAHF;AAKD,KA5BqE;;AAAA,sDA8BlCS,KAAD,IAAsC;AACvEjB,4BAAaC,GAAb,CACG,sCAAqCC,IAAI,CAACC,SAAL,CAAec,KAAK,CAACC,WAArB,CAAkC,EAD1E;;AAGA,YAAM;AAAEC,QAAAA;AAAF,UAA8B,KAAKf,KAAzC;AAEA,YAAM;AAAEgB,QAAAA,IAAF;AAAQC,QAAAA;AAAR,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C;AACA,UAAMiF,cAAc,4BAAG1C,eAAH,aAAGA,eAAH,uBAAGA,eAAe,CAAE0C,cAApB,yEAAsC,EAA1D;;AACA,QAAI,CAACA,cAAL,EAAqB;AACnB,aAAO,EAAP;AACD;;AAED,QAAIP,YAAY,GAAG,EAAnB;;AACA,SAAK,MAAMQ,SAAX,IAAwBD,cAAxB,EAAwC;AAAA;;AACtC,UAAIP,YAAY,CAACM,MAAb,GAAsB,CAA1B,EAA6B;AAC3BN,QAAAA,YAAY,IAAI,GAAhB;AACD;;AACDA,MAAAA,YAAY,IAAK,GAAD,mBAAGQ,SAAS,CAAClE,IAAb,6DAAqB,EAAG,IAAGkE,SAAS,CAACnD,KAAM,EAA3D;AACD;;AAED,WAAO2C,YAAP;AACD;;AAEOjC,EAAAA,0BAA0B,GAAuC;AACvE,UAAM;AAAED,MAAAA;AAAF,QAA6B,KAAKxC,KAAxC;;AACA,QAAI,CAACwC,sBAAL,EAA6B;AAC3B,aAAOA,sBAAP;AACD;;AAED,QACEA,sBAAsB,CAACqB,WAAvB,IACAsB,IAAI,CAACC,KAAL,CAAW5C,sBAAsB,CAACqB,WAAlC,MACErB,sBAAsB,CAACqB,WAH3B,EAIE;AACA,aAAO,EACL,GAAGrB,sBADE;AAELqB,QAAAA,WAAW,EAAEsB,IAAI,CAACC,KAAL,CAAW5C,sBAAsB,CAACqB,WAAlC;AAFR,OAAP;AAID,KATD,MASO;AACL,aAAOrB,sBAAP;AACD;AACF;;AAnNqE;;;;gBAAnDhD,S,kBACG;AACpB8C,EAAAA,IAAI,EAAE;AADc,C","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\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 * Ad configuration of the feed. Only supported on iOS.\n */\n adConfiguration?: AdConfiguration;\n /**\n * The feed loading result callback. It means loading successfully when error equals to undefined.\n */\n onVideoFeedLoadFinished?: (error?: FWError) => void;\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 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\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 } = this.props;\n const videoFeedConfiguration = this._getVideoFeedConfiguration();\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 const enableAutoplay = videoFeedConfiguration?.enableAutoplay ?? false;\n const enablePictureInPicture =\n videoFeedConfiguration?.enablePictureInPicture ?? false;\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\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 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\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"]}
|
|
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","componentWillUnmount","forEach","value","remove","render","source","channel","playlist","playlistGroup","mode","adConfiguration","enablePictureInPicture","videoFeedConfiguration","_getVideoFeedConfiguration","titleHidden","title","hidden","titlePosition","customLayoutName","shareBaseURL","FireworkSDK","getInstance","adBadgeConfiguration","adBadgeTextType","badgeTextType","backgroundColorOfAdBadge","backgroundColor","textColorOfAdBadge","textColor","dynamicContentParametersString","_generateDynamicContentParametersString","enableAutoplay","enablePictureInPictureLegacy","gridColumns","requiresAds","adsFetchTimeout","vastAttributesString","_generateVastAttributesString","showAdBadge","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;;;;;;;;AAuDA,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;AACrBC,4BAAaC,GAAb,CAAkB,qBAAoBC,IAAI,CAACC,SAAL,CAAe,KAAKC,KAApB,CAA2B,EAAjE;;AAEA,YAAMC,gBAAgB,GAAG,iCAAe,KAAKC,kBAAL,CAAwBC,OAAvC,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,EAHF;AAKD,KA5BqE;;AAAA,sDA8BlCS,KAAD,IAAsC;AACvEjB,4BAAaC,GAAb,CACG,sCAAqCC,IAAI,CAACC,SAAL,CAA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A,IAAI,EAAE;AADc,C","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\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 * Ad configuration of the feed. Only supported on iOS.\n */\n adConfiguration?: AdConfiguration;\n /**\n * Specifies if Picture in Picture is enabled. Only supported on iOS.\n */\n enablePictureInPicture?: boolean;\n /**\n * The feed loading result callback. It means loading successfully when error equals to undefined.\n */\n onVideoFeedLoadFinished?: (error?: FWError) => void;\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 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\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 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 const enableAutoplay = videoFeedConfiguration?.enableAutoplay ?? false;\n\n let enablePictureInPictureLegacy = false;\n if (videoFeedConfiguration) {\n enablePictureInPictureLegacy =\n (videoFeedConfiguration as any).enablePictureInPicture ?? 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\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 key += `_enableAutoplay:${enableAutoplay}`;\n key += `_enablePictureInPicture:${enablePictureInPicture}`;\n key += `_enablePictureInPictureLegacy:${enablePictureInPictureLegacy}`;\n key += `_gridColumns:${gridColumns}`;\n key += `_requiresAds:${requiresAds}`;\n key += `_adsFetchTimeout:${adsFetchTimeout}`;\n key += `_vastAttributes:${vastAttributesString}`;\n key += `_showAdBadge:${showAdBadge}`;\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"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index.
|
|
1
|
+
{"version":3,"sources":["index.ts"],"names":["FireworkSDK"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AAEA;;AAOA;;AACA;;AAKA;;AAwBA;;AAEA;;AAuBA;;AAkBA;;;;eAEeA,oB","sourcesContent":["import StoryBlock from './components/StoryBlock';\nimport type { IVideoFeedProps, VideoFeedMode } from './components/VideoFeed';\nimport VideoFeed from './components/VideoFeed';\nimport type {\n CustomCTAClickCallback,\n SDKInitCallback,\n VideoFeedClickCallback,\n VideoPlaybackCallback,\n} from './FireworkSDK';\nimport FireworkSDK from './FireworkSDK';\nimport FWNavigator from './FWNavigator';\nimport type {\n onLiveStreamChatEventCallback,\n onLiveStreamEventCallback,\n} from './LiveStream';\nimport LiveStream from './LiveStream';\nimport type AdBadgeConfiguration from './models/AdBadgeConfiguration';\nimport type { AdBadgeTextType } from './models/AdBadgeConfiguration';\nimport type AdConfiguration from './models/AdConfiguration';\nimport type { VastAttribute } from './models/AdConfiguration';\nimport type AddToCartResult from './models/AddToCartResult';\nimport type FeedItemDetails from './models/FeedItemDetails';\nimport type FWError from './models/FWError';\nimport type {\n AddToCartEvent,\n CustomClickLinkButtonEvent,\n CustomCTAClickEvent,\n LiveStreamChatEvent,\n LiveStreamEvent,\n SDKInitEvent,\n UpdateProductDetailsEvent,\n VideoPlaybackEvent,\n WillDisplayProductEvent,\n} from './models/FWEvents';\nimport type IOSFontInfo from './models/IOSFontInfo';\nimport type {\n IOSSystemFontStyle,\n IOSSystemFontWeight,\n} from './models/IOSFontInfo';\nimport LiveStreamChatEventName from './models/LiveStreamChatEventName';\nimport type LiveStreamEventDetails from './models/LiveStreamEventDetails';\nimport LiveStreamEventName from './models/LiveStreamEventName';\nimport type LiveStreamMessageDetails from './models/LiveStreamMessageDetails';\nimport type { NewNativeContainerProps } from './models/NewNativeContainerProps';\nimport type Product from './models/Product';\nimport type ProductInfoViewConfiguration from './models/ProductInfoViewConfiguration';\nimport type {\n AddToCartButtonConfiguration,\n LinkButtonConfiguration,\n} from './models/ProductInfoViewConfiguration';\nimport type ProductUnit from './models/ProductUnit';\nimport type { ProductPrice, ProductUnitOption } from './models/ProductUnit';\nimport type { StoryBlockSource } from './models/StoryBlockSource';\nimport type TrackPurchaseParameters from './models/TrackPurchaseParameters';\nimport type VideoFeedConfiguration from './models/VideoFeedConfiguration';\nimport type {\n VideoFeedContentPadding,\n VideoFeedPlayIconConfiguration,\n VideoFeedTitleConfiguration,\n VideoFeedTitlePosition,\n} from './models/VideoFeedConfiguration';\nimport type { VideoFeedSource } from './models/VideoFeedSource';\nimport type VideoPlaybackDetails from './models/VideoPlaybackDetails';\nimport type { VideoPlayerSize } from './models/VideoPlaybackDetails';\nimport VideoPlaybackEventName from './models/VideoPlaybackEventName';\nimport type VideoPlayerConfiguration from './models/VideoPlayerConfiguration';\nimport type {\n VideoLaunchBehavior,\n VideoPlayerCompleteAction,\n VideoPlayerCTADelay,\n VideoPlayerCTADelayType,\n VideoPlayerCTAStyle,\n VideoPlayerStyle,\n} from './models/VideoPlayerConfiguration';\nimport type {\n AddToCartCallback,\n ClickCartIconCallback,\n CustomClickCartIconCallback,\n CustomClickLinkButtonCallback,\n UpdateProductDetailsCallback,\n WillDisplayProductCallback,\n} from './VideoShopping';\nimport VideoShopping from './VideoShopping';\n\nexport default FireworkSDK;\n\nexport {\n AdBadgeConfiguration,\n AdBadgeTextType,\n AdConfiguration,\n AddToCartButtonConfiguration,\n AddToCartCallback,\n AddToCartEvent,\n AddToCartResult,\n ClickCartIconCallback,\n CustomClickCartIconCallback,\n CustomClickLinkButtonCallback,\n CustomClickLinkButtonEvent,\n CustomCTAClickCallback,\n CustomCTAClickEvent,\n FeedItemDetails,\n FWError,\n FWNavigator,\n IOSFontInfo,\n IOSSystemFontStyle,\n IOSSystemFontWeight,\n IVideoFeedProps,\n LinkButtonConfiguration,\n LiveStream,\n LiveStreamChatEvent,\n LiveStreamChatEventName,\n LiveStreamEvent,\n LiveStreamEventDetails,\n LiveStreamEventName,\n LiveStreamMessageDetails,\n NewNativeContainerProps,\n onLiveStreamChatEventCallback,\n onLiveStreamEventCallback,\n Product,\n ProductInfoViewConfiguration,\n ProductPrice,\n ProductUnit,\n ProductUnitOption,\n SDKInitCallback,\n SDKInitEvent,\n StoryBlock,\n StoryBlockSource,\n TrackPurchaseParameters,\n UpdateProductDetailsCallback,\n UpdateProductDetailsEvent,\n VastAttribute,\n VideoFeed,\n VideoFeedClickCallback,\n VideoFeedConfiguration,\n VideoFeedContentPadding,\n VideoFeedMode,\n VideoFeedPlayIconConfiguration,\n VideoFeedSource,\n VideoFeedTitleConfiguration,\n VideoFeedTitlePosition,\n VideoLaunchBehavior,\n VideoPlaybackCallback,\n VideoPlaybackDetails,\n VideoPlaybackEvent,\n VideoPlaybackEventName,\n VideoPlayerCompleteAction,\n VideoPlayerConfiguration,\n VideoPlayerCTADelay,\n VideoPlayerCTADelayType,\n VideoPlayerCTAStyle,\n VideoPlayerSize,\n VideoPlayerStyle,\n VideoShopping,\n WillDisplayProductCallback,\n WillDisplayProductEvent,\n};\n"]}
|
|
@@ -21,5 +21,6 @@ exports.FWEventName = FWEventName;
|
|
|
21
21
|
FWEventName["ShareBaseURLUpdated"] = "fw:share-base-url-updated";
|
|
22
22
|
FWEventName["AdBadgeConfigurationUpdated"] = "fw:ad-badge-configuration-updated";
|
|
23
23
|
FWEventName["LogMessage"] = "fw:log-message";
|
|
24
|
+
FWEventName["CustomLinkButtonClick"] = "fw:shopping:custom-link-button-click";
|
|
24
25
|
})(FWEventName || (exports.FWEventName = FWEventName = {}));
|
|
25
26
|
//# sourceMappingURL=FWEventName.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["FWEventName.ts"],"names":["FWEventName"],"mappings":";;;;;;IAAYA,W;;;WAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;GAAAA,W,2BAAAA,W","sourcesContent":["export enum FWEventName {\n SDKInit = 'fw:sdk-init',\n CustomCTAClick = 'fw:custom-cta-click',\n VideoPlayback = 'fw:video-playback',\n VideoFeedClick = 'fw:video-feed-click',\n AddToCart = 'fw:shopping:add-to-cart',\n ClickCartIcon = 'fw:shopping:click-cart-icon',\n UpdateProductDetails = 'fw:shopping:update-product-details',\n WillDisplayProduct = 'fw:shopping:will-display-product',\n LiveStream = 'fw:livestream',\n LiveStreamChat = 'fw:livestream-chat',\n ShareBaseURLUpdated = 'fw:share-base-url-updated',\n AdBadgeConfigurationUpdated = 'fw:ad-badge-configuration-updated',\n LogMessage = 'fw:log-message',\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["FWEventName.ts"],"names":["FWEventName"],"mappings":";;;;;;IAAYA,W;;;WAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;GAAAA,W,2BAAAA,W","sourcesContent":["export enum FWEventName {\n SDKInit = 'fw:sdk-init',\n CustomCTAClick = 'fw:custom-cta-click',\n VideoPlayback = 'fw:video-playback',\n VideoFeedClick = 'fw:video-feed-click',\n AddToCart = 'fw:shopping:add-to-cart',\n ClickCartIcon = 'fw:shopping:click-cart-icon',\n UpdateProductDetails = 'fw:shopping:update-product-details',\n WillDisplayProduct = 'fw:shopping:will-display-product',\n LiveStream = 'fw:livestream',\n LiveStreamChat = 'fw:livestream-chat',\n ShareBaseURLUpdated = 'fw:share-base-url-updated',\n AdBadgeConfigurationUpdated = 'fw:ad-badge-configuration-updated',\n LogMessage = 'fw:log-message',\n CustomLinkButtonClick = 'fw:shopping:custom-link-button-click',\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["FWNavigatorModule.ts"],"names":["FWNavigatorModule","NativeModules","Proxy","get","Error","LINKING_ERROR","FWNavigatorModuleEventEmitter","NativeEventEmitter"],"mappings":";;;;;;;AAAA;;AAEA;;AAEA,MAAMA,iBAAiB,GAAGC,2BAAcD,iBAAd,GACtBC,2BAAcD,iBADQ,GAEtB,IAAIE,KAAJ,CACE,EADF,EAEE;AACEC,EAAAA,GAAG,GAAG;AACJ,UAAM,IAAIC,KAAJ,CAAUC,6BAAV,CAAN;AACD;;AAHH,CAFF,CAFJ;
|
|
1
|
+
{"version":3,"sources":["FWNavigatorModule.ts"],"names":["FWNavigatorModule","NativeModules","Proxy","get","Error","LINKING_ERROR","FWNavigatorModuleEventEmitter","NativeEventEmitter"],"mappings":";;;;;;;AAAA;;AAEA;;AAEA,MAAMA,iBAAiB,GAAGC,2BAAcD,iBAAd,GACtBC,2BAAcD,iBADQ,GAEtB,IAAIE,KAAJ,CACE,EADF,EAEE;AACEC,EAAAA,GAAG,GAAG;AACJ,UAAM,IAAIC,KAAJ,CAAUC,6BAAV,CAAN;AACD;;AAHH,CAFF,CAFJ;AAkBA,MAAMC,6BAA6B,GAAG,IAAIC,+BAAJ,CAAuBP,iBAAvB,CAAtC;;eAEeA,iB","sourcesContent":["import { NativeEventEmitter, NativeModule } from 'react-native';\nimport { NativeModules } from 'react-native';\nimport { LINKING_ERROR } from '../constants/FWErrorMessage';\n\nconst FWNavigatorModule = NativeModules.FWNavigatorModule\n ? NativeModules.FWNavigatorModule\n : new Proxy(\n {},\n {\n get() {\n throw new Error(LINKING_ERROR);\n },\n }\n );\ninterface IFWNavigatorModule extends NativeModule {\n pushNativeContainer(props: { [key: string]: any }): Promise<boolean>;\n popNativeContainer(): Promise<boolean>;\n canPopNativeContainer(): Promise<boolean>;\n startFloatingPlayer(): Promise<boolean>;\n stopFloatingPlayer(): Promise<boolean>;\n}\n\nconst FWNavigatorModuleEventEmitter = new NativeEventEmitter(FWNavigatorModule);\nexport { FWNavigatorModuleEventEmitter };\nexport default FWNavigatorModule as IFWNavigatorModule;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["ShoppingModule.ts"],"names":["ShoppingModule","NativeModules","Proxy","get","Error","LINKING_ERROR","ShoppingModuleEventEmitter","NativeEventEmitter"],"mappings":";;;;;;;AAAA;;AAEA;;AAKA,MAAMA,cAAc,GAAGC,2BAAcD,cAAd,GACnBC,2BAAcD,cADK,GAEnB,IAAIE,KAAJ,CACE,EADF,EAEE;AACEC,EAAAA,GAAG,GAAG;AACJ,UAAM,IAAIC,KAAJ,CAAUC,6BAAV,CAAN;AACD;;AAHH,CAFF,CAFJ;
|
|
1
|
+
{"version":3,"sources":["ShoppingModule.ts"],"names":["ShoppingModule","NativeModules","Proxy","get","Error","LINKING_ERROR","ShoppingModuleEventEmitter","NativeEventEmitter"],"mappings":";;;;;;;AAAA;;AAEA;;AAKA,MAAMA,cAAc,GAAGC,2BAAcD,cAAd,GACnBC,2BAAcD,cADK,GAEnB,IAAIE,KAAJ,CACE,EADF,EAEE;AACEC,EAAAA,GAAG,GAAG;AACJ,UAAM,IAAIC,KAAJ,CAAUC,6BAAV,CAAN;AACD;;AAHH,CAFF,CAFJ;AA+BA,MAAMC,0BAA0B,GAAG,IAAIC,+BAAJ,CAAuBP,cAAvB,CAAnC;;eAGeA,c","sourcesContent":["import { NativeEventEmitter, NativeModule, NativeModules } from 'react-native';\n\nimport { LINKING_ERROR } from '../constants/FWErrorMessage';\nimport type { NewNativeContainerProps } from '../models/NewNativeContainerProps';\nimport type Product from '../models/Product';\nimport type ProductInfoViewConfiguration from '../models/ProductInfoViewConfiguration';\n\nconst ShoppingModule = NativeModules.ShoppingModule\n ? NativeModules.ShoppingModule\n : new Proxy(\n {},\n {\n get() {\n throw new Error(LINKING_ERROR);\n },\n }\n );\n\ninterface IShoppingModule extends NativeModule {\n init(): void;\n updateVideoProducts(products: Product[], callbackId: number | string): void;\n updateAddToCartStatus(\n res: string,\n tips: string,\n callbackId: number | string\n ): void;\n jumpToCartPage(\n callbackId: number | string,\n props: NewNativeContainerProps\n ): void;\n setCartIconVisible(visible: boolean): void;\n setCartItemCount(count: number): void;\n setCustomClickCartIconEnabled(enabled: boolean): Promise<void>; // Only supported on iOS\n clearCallbackId(callbackId: number | string, eventName: string): void; // Only supported on iOS\n setProductInfoViewConfiguration(config: ProductInfoViewConfiguration): void; // Only supported on iOS\n setCustomClickLinkButtonEnabled(enabled: boolean): Promise<void>; // Only supported on Android\n}\n\nconst ShoppingModuleEventEmitter = new NativeEventEmitter(ShoppingModule);\nexport { ShoppingModuleEventEmitter };\n\nexport default ShoppingModule as IShoppingModule;\n"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
2
|
|
|
3
|
+
import { Platform } from 'react-native';
|
|
3
4
|
import { FWEventName } from './models/FWEventName';
|
|
4
5
|
import FWNavigatorModule, { FWNavigatorModuleEventEmitter } from './modules/FWNavigatorModule';
|
|
5
6
|
import FWLoggerUtil from './utils/FWLoggerUtil';
|
|
@@ -25,6 +26,8 @@ class FWNavigator {
|
|
|
25
26
|
* Please set your app component name through FireworkSDK.getInstance().appComponentName before calling this method
|
|
26
27
|
* @param {FWNativeContainerProps} props We will pass the props to your app component.
|
|
27
28
|
* @returns {Promise<boolean>} The result of pushing RN page from native page.
|
|
29
|
+
*
|
|
30
|
+
* @deprecated The property will be deprecated since RN SDK V2.
|
|
28
31
|
*/
|
|
29
32
|
|
|
30
33
|
|
|
@@ -43,13 +46,40 @@ class FWNavigator {
|
|
|
43
46
|
}
|
|
44
47
|
/**
|
|
45
48
|
* Indicate if we can pop top-most native container.
|
|
46
|
-
* @returns {Promise<boolean>} If the result is true,
|
|
49
|
+
* @returns {Promise<boolean>} If the result is true,
|
|
50
|
+
* we could call popNativeContainer to pop top-most native container.
|
|
51
|
+
*
|
|
52
|
+
* @deprecated The property will be deprecated since RN SDK V2.
|
|
47
53
|
*/
|
|
48
54
|
|
|
49
55
|
|
|
50
56
|
canPopNativeContainer() {
|
|
51
57
|
return FWNavigatorModule.canPopNativeContainer();
|
|
52
58
|
}
|
|
59
|
+
/**
|
|
60
|
+
* Change current fullscreen player to floating player.
|
|
61
|
+
* @returns {Promise<boolean>} If the result is true, it means that the fullscreen
|
|
62
|
+
* player is changed to floating player. Only supported on iOS.
|
|
63
|
+
*/
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
async startFloatingPlayer() {
|
|
67
|
+
if (Platform.OS === 'ios') {
|
|
68
|
+
return FWNavigatorModule.startFloatingPlayer();
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return true;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Stop current floating player. Only supported on iOS.
|
|
75
|
+
*/
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
async stopFloatingPlayer() {
|
|
79
|
+
if (Platform.OS === 'ios') {
|
|
80
|
+
await FWNavigatorModule.stopFloatingPlayer();
|
|
81
|
+
}
|
|
82
|
+
}
|
|
53
83
|
|
|
54
84
|
}
|
|
55
85
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["FWNavigator.
|
|
1
|
+
{"version":3,"sources":["FWNavigator.ts"],"names":["Platform","FWEventName","FWNavigatorModule","FWNavigatorModuleEventEmitter","FWLoggerUtil","FWNavigator","getInstance","_instance","constructor","log","addListener","LogMessage","pushNativeContainer","props","popNativeContainer","canPopNativeContainer","startFloatingPlayer","OS","stopFloatingPlayer"],"mappings":";;AAAA,SAASA,QAAT,QAAyB,cAAzB;AACA,SAASC,WAAT,QAA4B,sBAA5B;AACA,OAAOC,iBAAP,IACEC,6BADF,QAEO,6BAFP;AAGA,OAAOC,YAAP,MAAyB,sBAAzB;;AAMA;AACA;AACA;AACA,MAAMC,WAAN,CAAkB;AAGS,SAAXC,WAAW,GAAgB;AACvC,QAAI,CAACD,WAAW,CAACE,SAAjB,EAA4B;AAC1BF,MAAAA,WAAW,CAACE,SAAZ,GAAwB,IAAIF,WAAJ,EAAxB;AACD;;AACD,WAAOA,WAAW,CAACE,SAAnB;AACD;;AAEOC,EAAAA,WAAW,GAAG;AACpBJ,IAAAA,YAAY,CAACK,GAAb,CAAiB,yBAAjB;AACAN,IAAAA,6BAA6B,CAACO,WAA9B,CAA0CT,WAAW,CAACU,UAAtD,EAAkE,MAAM,CAAE,CAA1E;AACD;AAED;AACF;AACA;AACA;AACA;AACA;AACA;AACA;;;AACSC,EAAAA,mBAAmB,CAACC,KAAD,EAAkD;AAC1ET,IAAAA,YAAY,CAACK,GAAb,CAAkB,8BAAlB;AAEA,WAAOP,iBAAiB,CAACU,mBAAlB,CAAsCC,KAAtC,CAAP;AACD;AAED;AACF;AACA;AACA;;;AACSC,EAAAA,kBAAkB,GAAqB;AAC5C,WAAOZ,iBAAiB,CAACY,kBAAlB,EAAP;AACD;AAED;AACF;AACA;AACA;AACA;AACA;AACA;;;AACSC,EAAAA,qBAAqB,GAAqB;AAC/C,WAAOb,iBAAiB,CAACa,qBAAlB,EAAP;AACD;AAED;AACF;AACA;AACA;AACA;;;AACkC,QAAnBC,mBAAmB,GAAqB;AACnD,QAAIhB,QAAQ,CAACiB,EAAT,KAAgB,KAApB,EAA2B;AACzB,aAAOf,iBAAiB,CAACc,mBAAlB,EAAP;AACD;;AAED,WAAO,IAAP;AACD;AAED;AACF;AACA;;;AACiC,QAAlBE,kBAAkB,GAAkB;AAC/C,QAAIlB,QAAQ,CAACiB,EAAT,KAAgB,KAApB,EAA2B;AACzB,YAAMf,iBAAiB,CAACgB,kBAAlB,EAAN;AACD;AACF;;AApEe;;gBAAZb,W;;AAuEN,eAAeA,WAAf","sourcesContent":["import { Platform } from 'react-native';\nimport { FWEventName } from './models/FWEventName';\nimport FWNavigatorModule, {\n FWNavigatorModuleEventEmitter,\n} from './modules/FWNavigatorModule';\nimport FWLoggerUtil from './utils/FWLoggerUtil';\n\ntype FWNativeContainerProps = {\n [key: string]: any;\n};\n\n/**\n * You can use this class for pushing RN page from the native page.\n */\nclass FWNavigator {\n private static _instance?: FWNavigator;\n\n public static getInstance(): FWNavigator {\n if (!FWNavigator._instance) {\n FWNavigator._instance = new FWNavigator();\n }\n return FWNavigator._instance!;\n }\n\n private constructor() {\n FWLoggerUtil.log('FWNavigator constructor');\n FWNavigatorModuleEventEmitter.addListener(FWEventName.LogMessage, () => {});\n }\n\n /**\n * Push a new native container. We will render your app component in new native container.\n * Please set your app component name through FireworkSDK.getInstance().appComponentName before calling this method\n * @param {FWNativeContainerProps} props We will pass the props to your app component.\n * @returns {Promise<boolean>} The result of pushing RN page from native page.\n *\n * @deprecated The property will be deprecated since RN SDK V2.\n */\n public pushNativeContainer(props: FWNativeContainerProps): Promise<boolean> {\n FWLoggerUtil.log(`Enter pushNewNativeContainer`);\n\n return FWNavigatorModule.pushNativeContainer(props);\n }\n\n /**\n * Pop top-most native container.\n * @returns {Promise<boolean>} The result of poping top-most native container.\n */\n public popNativeContainer(): Promise<boolean> {\n return FWNavigatorModule.popNativeContainer();\n }\n\n /**\n * Indicate if we can pop top-most native container.\n * @returns {Promise<boolean>} If the result is true,\n * we could call popNativeContainer to pop top-most native container.\n *\n * @deprecated The property will be deprecated since RN SDK V2.\n */\n public canPopNativeContainer(): Promise<boolean> {\n return FWNavigatorModule.canPopNativeContainer();\n }\n\n /**\n * Change current fullscreen player to floating player.\n * @returns {Promise<boolean>} If the result is true, it means that the fullscreen\n * player is changed to floating player. Only supported on iOS.\n */\n public async startFloatingPlayer(): Promise<boolean> {\n if (Platform.OS === 'ios') {\n return FWNavigatorModule.startFloatingPlayer();\n }\n\n return true;\n }\n\n /**\n * Stop current floating player. Only supported on iOS.\n */\n public async stopFloatingPlayer(): Promise<void> {\n if (Platform.OS === 'ios') {\n await FWNavigatorModule.stopFloatingPlayer();\n }\n }\n}\n\nexport default FWNavigator;\n"]}
|
|
@@ -61,15 +61,17 @@ class FireworkSDK {
|
|
|
61
61
|
|
|
62
62
|
/**
|
|
63
63
|
* The share base URL of videos.
|
|
64
|
+
* The set accessor is async.
|
|
64
65
|
*/
|
|
65
66
|
get shareBaseURL() {
|
|
66
67
|
return this._shareBaseURL;
|
|
67
68
|
}
|
|
68
69
|
|
|
69
70
|
set shareBaseURL(value) {
|
|
70
|
-
const valueHasChanged = this._shareBaseURL !== value;
|
|
71
|
-
this._shareBaseURL = value;
|
|
72
71
|
FireworkSDKModule.setShareBaseURL(value !== null && value !== void 0 ? value : '').then(() => {
|
|
72
|
+
const valueHasChanged = this._shareBaseURL !== value;
|
|
73
|
+
this._shareBaseURL = value;
|
|
74
|
+
|
|
73
75
|
if (valueHasChanged) {
|
|
74
76
|
this.eventEmitter.emit(FWEventName.ShareBaseURLUpdated);
|
|
75
77
|
}
|
|
@@ -78,17 +80,19 @@ class FireworkSDK {
|
|
|
78
80
|
|
|
79
81
|
/**
|
|
80
82
|
* The configuration for ad badges.
|
|
83
|
+
* The set accessor is async.
|
|
81
84
|
*/
|
|
82
85
|
get adBadgeConfiguration() {
|
|
83
86
|
return this._adBadgeConfiguration;
|
|
84
87
|
}
|
|
85
88
|
|
|
86
89
|
set adBadgeConfiguration(value) {
|
|
87
|
-
var _this$_adBadgeConfigu, _this$_adBadgeConfigu2, _this$_adBadgeConfigu3;
|
|
88
|
-
|
|
89
|
-
const valueHasChanged = ((_this$_adBadgeConfigu = this._adBadgeConfiguration) === null || _this$_adBadgeConfigu === void 0 ? void 0 : _this$_adBadgeConfigu.badgeTextType) !== (value === null || value === void 0 ? void 0 : value.badgeTextType) || ((_this$_adBadgeConfigu2 = this._adBadgeConfiguration) === null || _this$_adBadgeConfigu2 === void 0 ? void 0 : _this$_adBadgeConfigu2.backgroundColor) !== (value === null || value === void 0 ? void 0 : value.backgroundColor) || ((_this$_adBadgeConfigu3 = this._adBadgeConfiguration) === null || _this$_adBadgeConfigu3 === void 0 ? void 0 : _this$_adBadgeConfigu3.textColor) !== (value === null || value === void 0 ? void 0 : value.textColor);
|
|
90
|
-
this._adBadgeConfiguration = value;
|
|
91
90
|
FireworkSDKModule.setAdBadgeConfiguration(value !== null && value !== void 0 ? value : {}).then(() => {
|
|
91
|
+
var _this$_adBadgeConfigu, _this$_adBadgeConfigu2, _this$_adBadgeConfigu3;
|
|
92
|
+
|
|
93
|
+
const valueHasChanged = ((_this$_adBadgeConfigu = this._adBadgeConfiguration) === null || _this$_adBadgeConfigu === void 0 ? void 0 : _this$_adBadgeConfigu.badgeTextType) !== (value === null || value === void 0 ? void 0 : value.badgeTextType) || ((_this$_adBadgeConfigu2 = this._adBadgeConfiguration) === null || _this$_adBadgeConfigu2 === void 0 ? void 0 : _this$_adBadgeConfigu2.backgroundColor) !== (value === null || value === void 0 ? void 0 : value.backgroundColor) || ((_this$_adBadgeConfigu3 = this._adBadgeConfiguration) === null || _this$_adBadgeConfigu3 === void 0 ? void 0 : _this$_adBadgeConfigu3.textColor) !== (value === null || value === void 0 ? void 0 : value.textColor);
|
|
94
|
+
this._adBadgeConfiguration = value;
|
|
95
|
+
|
|
92
96
|
if (valueHasChanged) {
|
|
93
97
|
this.eventEmitter.emit(FWEventName.AdBadgeConfigurationUpdated);
|
|
94
98
|
}
|
|
@@ -255,11 +259,6 @@ class FireworkSDK {
|
|
|
255
259
|
async changeAppLanguage(language) {
|
|
256
260
|
if (Platform.OS === 'android') {
|
|
257
261
|
const result = await FireworkSDKModule.changeAppLanguage(language);
|
|
258
|
-
|
|
259
|
-
if (result) {
|
|
260
|
-
await FireworkSDKModule.restart();
|
|
261
|
-
}
|
|
262
|
-
|
|
263
262
|
return result;
|
|
264
263
|
}
|
|
265
264
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["FireworkSDK.ts"],"names":["Platform","FWNavigator","LiveStream","FWEventName","FireworkSDKModule","FireworkSDKModuleEventEmitter","LiveStreamModule","ShoppingModule","FWLoggerUtil","VideoShopping","FireworkSDK","onCustomCTAClick","_onCustomCTAClick","value","log","setCustomCTAClickEnabled","customCTALinkContentPageRouteName","_customCTALinkContentPageRouteName","setCustomCTALinkContentPageRouteName","onVideoPlayback","_onVideoPlayback","setVideoPlaybackEventEnabled","shareBaseURL","_shareBaseURL","valueHasChanged","setShareBaseURL","then","eventEmitter","emit","ShareBaseURLUpdated","adBadgeConfiguration","_adBadgeConfiguration","badgeTextType","backgroundColor","textColor","setAdBadgeConfiguration","AdBadgeConfigurationUpdated","appComponentName","_appComponentName","setAppComponentName","debugLogsEnabled","enabled","shopping","_shopping","liveStream","_liveStream","navigator","_navigator","getInstance","_instance","constructor","addListener","SDKInit","event","error","onSDKInit","LogMessage","logNativeMessage","message","CustomCTAClick","url","VideoPlayback","eventName","VideoFeedClick","info","id","onVideoFeedClick","init","userId","openVideoPlayer","config","trackPurchase","parameters","OS","changeAppLanguage","language","result","restart"],"mappings":";;AAAA,SAA6BA,QAA7B,QAA6C,cAA7C;AAEA,OAAOC,WAAP,MAAwB,eAAxB;AACA,OAAOC,UAAP,MAAuB,cAAvB;AAEA,SAASC,WAAT,QAA4B,sBAA5B;AASA,OAAOC,iBAAP,IACEC,6BADF,QAEO,6BAFP;AAGA,OAAOC,gBAAP,MAA6B,4BAA7B;AACA,OAAOC,cAAP,MAA2B,0BAA3B;AACA,OAAOC,YAAP,MAAyB,sBAAzB;A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B;AAEAV,IAAAA,iBAAiB,CAAC+D,IAAlB,CAAuBC,MAAvB;AACA7D,IAAAA,cAAc,CAAC4D,IAAf;AACA7D,IAAAA,gBAAgB,CAAC6D,IAAjB;AACD;AAED;AACF;AACA;AACA;AACA;;;AACSE,EAAAA,eAAe,CAACT,GAAD,EAAcU,MAAd,EAAiD;AACrElE,IAAAA,iBAAiB,CAACiE,eAAlB,CAAkCT,GAAlC,EAAuCU,MAAvC,aAAuCA,MAAvC,cAAuCA,MAAvC,GAAiD,EAAjD;AACD;AAED;AACF;AACA;AACA;;;AACSC,EAAAA,aAAa,CAACC,UAAD,EAAsC;AACxD,QAAIxE,QAAQ,CAACyE,EAAT,KAAgB,KAApB,EAA2B;AACzBrE,MAAAA,iBAAiB,CAACmE,aAAlB,CAAgCC,UAAhC;AACD;AACF;AAED;AACF;AACA;AACA;AACA;;;AACgC,QAAjBE,iBAAiB,CAACC,QAAD,EAAqC;AACjE,QAAI3E,QAAQ,CAACyE,EAAT,KAAgB,SAApB,EAA+B;AAC7B,YAAMG,MAAM,GAAG,MAAMxE,iBAAiB,CAACsE,iBAAlB,CAAoCC,QAApC,CAArB;;AACA,UAAIC,MAAJ,EAAY;AACV,cAAMxE,iBAAiB,CAACyE,OAAlB,EAAN;AACD;;AACD,aAAOD,MAAP;AACD;;AAED,WAAO,KAAP;AACD;;AA5Oe;;gBAAZlE,W;;AA+ON,eAAeA,WAAf","sourcesContent":["import { NativeEventEmitter, Platform } from 'react-native';\n\nimport FWNavigator from './FWNavigator';\nimport LiveStream from './LiveStream';\nimport type AdBadgeConfiguration from './models/AdBadgeConfiguration';\nimport { FWEventName } from './models/FWEventName';\nimport type {\n CustomCTAClickEvent,\n SDKInitEvent,\n VideoFeedClickEvent,\n VideoPlaybackEvent,\n} from './models/FWEvents';\nimport type TrackPurchaseParameters from './models/TrackPurchaseParameters';\nimport type VideoPlayerConfiguration from './models/VideoPlayerConfiguration';\nimport FireworkSDKModule, {\n FireworkSDKModuleEventEmitter,\n} from './modules/FireworkSDKModule';\nimport LiveStreamModule from './modules/LiveStreamModule';\nimport ShoppingModule from './modules/ShoppingModule';\nimport FWLoggerUtil from './utils/FWLoggerUtil';\nimport VideoShopping from './VideoShopping';\n\nexport type SDKInitCallback = (event: SDKInitEvent) => void;\nexport type CustomCTAClickCallback = (event: CustomCTAClickEvent) => void;\nexport type VideoPlaybackCallback = (event: VideoPlaybackEvent) => void;\nexport type VideoFeedClickCallback = (event: VideoFeedClickEvent) => void;\n\n/**\n * Entry class of Firework SDK, which supports the sdk initialization and global configuration.\n */\nclass FireworkSDK {\n private static _instance?: FireworkSDK;\n\n /**\n * The callback of SDK initialization.\n */\n public onSDKInit?: SDKInitCallback;\n\n /**\n * the callback of clicking Video Feed.\n */\n public onVideoFeedClick?: VideoFeedClickCallback;\n\n /**\n * The callback of clicking custom CTA.\n */\n public get onCustomCTAClick(): CustomCTAClickCallback | undefined {\n return this._onCustomCTAClick;\n }\n public set onCustomCTAClick(value: CustomCTAClickCallback | undefined) {\n FWLoggerUtil.log(`Set onCustomCTAClick callback ${!!value}`);\n this._onCustomCTAClick = value;\n FireworkSDKModule.setCustomCTAClickEnabled(value ? true : false);\n }\n private _onCustomCTAClick: CustomCTAClickCallback | undefined;\n\n /**\n * The custom CTA link content page route name.\n */\n public get customCTALinkContentPageRouteName(): string | undefined {\n return this._customCTALinkContentPageRouteName;\n }\n public set customCTALinkContentPageRouteName(value: string | undefined) {\n this._customCTALinkContentPageRouteName = value;\n FireworkSDKModule.setCustomCTALinkContentPageRouteName(value ?? '');\n }\n private _customCTALinkContentPageRouteName: string | undefined;\n\n /**\n * The callback of video playback.\n */\n public get onVideoPlayback(): VideoPlaybackCallback | undefined {\n return this._onVideoPlayback;\n }\n public set onVideoPlayback(value: VideoPlaybackCallback | undefined) {\n this._onVideoPlayback = value;\n FireworkSDKModule.setVideoPlaybackEventEnabled(value ? true : false);\n }\n private _onVideoPlayback?: VideoPlaybackCallback | undefined;\n\n /**\n * The share base URL of videos.\n */\n public get shareBaseURL(): string | undefined {\n return this._shareBaseURL;\n }\n public set shareBaseURL(value: string | undefined) {\n const valueHasChanged = this._shareBaseURL !== value;\n this._shareBaseURL = value;\n FireworkSDKModule.setShareBaseURL(value ?? '').then(() => {\n if (valueHasChanged) {\n this.eventEmitter.emit(FWEventName.ShareBaseURLUpdated);\n }\n });\n }\n private _shareBaseURL: string | undefined;\n\n /**\n * The configuration for ad badges.\n */\n public get adBadgeConfiguration(): AdBadgeConfiguration | undefined {\n return this._adBadgeConfiguration;\n }\n public set adBadgeConfiguration(value: AdBadgeConfiguration | undefined) {\n const valueHasChanged =\n this._adBadgeConfiguration?.badgeTextType !== value?.badgeTextType ||\n this._adBadgeConfiguration?.backgroundColor !== value?.backgroundColor ||\n this._adBadgeConfiguration?.textColor !== value?.textColor;\n this._adBadgeConfiguration = value;\n FireworkSDKModule.setAdBadgeConfiguration(value ?? {}).then(() => {\n if (valueHasChanged) {\n this.eventEmitter.emit(FWEventName.AdBadgeConfigurationUpdated);\n }\n });\n }\n private _adBadgeConfiguration: AdBadgeConfiguration | undefined;\n\n /**\n * The app component name.\n */\n public get appComponentName(): string | undefined {\n return this._appComponentName;\n }\n public set appComponentName(value: string | undefined) {\n this._appComponentName = value;\n FireworkSDKModule.setAppComponentName(value ?? '');\n }\n private _appComponentName: string | undefined;\n\n /**\n * Defaults to false. You can enable debug logs by setting this property to true.\n */\n public get debugLogsEnabled(): boolean {\n return FWLoggerUtil.enabled;\n }\n public set debugLogsEnabled(value: boolean) {\n FWLoggerUtil.enabled = value;\n }\n\n private get eventEmitter(): NativeEventEmitter {\n return FireworkSDKModuleEventEmitter;\n }\n\n /**\n * Get VideoShopping object.\n */\n public get shopping(): VideoShopping {\n return this._shopping;\n }\n private _shopping: VideoShopping = VideoShopping.getInstance();\n\n /**\n * Get LiveStream object.\n */\n public get liveStream(): LiveStream {\n return this._liveStream;\n }\n private _liveStream: LiveStream = LiveStream.getInstance();\n\n /**\n * Get FWNavigator object.\n */\n public get navigator(): FWNavigator {\n return this._navigator;\n }\n private _navigator: FWNavigator = FWNavigator.getInstance();\n\n /**\n * Get global single instance of FireworkSDK class.\n * @returns FireworkSDK\n */\n public static getInstance() {\n if (!FireworkSDK._instance) {\n FireworkSDK._instance = new FireworkSDK();\n }\n\n return FireworkSDK._instance!;\n }\n\n private constructor() {\n FWLoggerUtil.log('FireworkSDK constructor');\n this.eventEmitter.addListener(FWEventName.SDKInit, (event) => {\n FWLoggerUtil.log(`Receive SDKInit event ${event?.error}`);\n\n if (this.onSDKInit) {\n this.onSDKInit(event ?? {});\n }\n });\n\n this.eventEmitter.addListener(FWEventName.LogMessage, (event) => {\n FWLoggerUtil.logNativeMessage(event.message);\n });\n\n this.eventEmitter.addListener(FWEventName.CustomCTAClick, (event) => {\n FWLoggerUtil.log(`Receive CustomCTAClick url: ${event?.url}`);\n\n if (this.onCustomCTAClick) {\n this.onCustomCTAClick(event ?? {});\n }\n });\n\n this.eventEmitter.addListener(FWEventName.VideoPlayback, (event) => {\n FWLoggerUtil.log(\n `Receive VideoPlayback event eventName: ${event?.eventName}`\n );\n\n if (this.onVideoPlayback) {\n this.onVideoPlayback(event ?? {});\n }\n });\n\n this.eventEmitter.addListener(FWEventName.VideoFeedClick, (event) => {\n FWLoggerUtil.log(`Receive VideoFeedClick event id: ${event?.info.id}`);\n\n if (this.onVideoFeedClick) {\n this.onVideoFeedClick(event ?? {});\n }\n });\n }\n\n /**\n * Initializes Firework SDK.\n * @param {string?} userId An id to uniquely identify device or user.\n */\n public init(userId?: string) {\n FWLoggerUtil.log('Call FireworkSDK init method');\n\n FireworkSDKModule.init(userId);\n ShoppingModule.init();\n LiveStreamModule.init();\n }\n\n /**\n * Open Video URL.\n * @param {string} url\n * @param {VideoPlayerConfiguration} config\n */\n public openVideoPlayer(url: string, config?: VideoPlayerConfiguration) {\n FireworkSDKModule.openVideoPlayer(url, config ?? {});\n }\n\n /**\n * Records the user purchase. Only supported on iOS.\n * @param {TrackPurchaseParameters} parameters\n */\n public trackPurchase(parameters: TrackPurchaseParameters) {\n if (Platform.OS === 'ios') {\n FireworkSDKModule.trackPurchase(parameters);\n }\n }\n\n /**\n * Change App level language. Only supported on Android.\n * @param {string} language Such as en, ar and en-US\n * @returns\n */\n public async changeAppLanguage(language: string): Promise<boolean> {\n if (Platform.OS === 'android') {\n const result = await FireworkSDKModule.changeAppLanguage(language);\n if (result) {\n await FireworkSDKModule.restart();\n }\n return result;\n }\n\n return false;\n }\n}\n\nexport default FireworkSDK;\n"]}
|
|
1
|
+
{"version":3,"sources":["FireworkSDK.ts"],"names":["Platform","FWNavigator","LiveStream","FWEventName","FireworkSDKModule","FireworkSDKModuleEventEmitter","LiveStreamModule","ShoppingModule","FWLoggerUtil","VideoShopping","FireworkSDK","onCustomCTAClick","_onCustomCTAClick","value","log","setCustomCTAClickEnabled","customCTALinkContentPageRouteName","_customCTALinkContentPageRouteName","setCustomCTALinkContentPageRouteName","onVideoPlayback","_onVideoPlayback","setVideoPlaybackEventEnabled","shareBaseURL","_shareBaseURL","setShareBaseURL","then","valueHasChanged","eventEmitter","emit","ShareBaseURLUpdated","adBadgeConfiguration","_adBadgeConfiguration","setAdBadgeConfiguration","badgeTextType","backgroundColor","textColor","AdBadgeConfigurationUpdated","appComponentName","_appComponentName","setAppComponentName","debugLogsEnabled","enabled","shopping","_shopping","liveStream","_liveStream","navigator","_navigator","getInstance","_instance","constructor","addListener","SDKInit","event","error","onSDKInit","LogMessage","logNativeMessage","message","CustomCTAClick","url","VideoPlayback","eventName","VideoFeedClick","info","id","onVideoFeedClick","init","userId","openVideoPlayer","config","trackPurchase","parameters","OS","changeAppLanguage","language","result"],"mappings":";;AAAA,SAA6BA,QAA7B,QAA6C,cAA7C;AAEA,OAAOC,WAAP,MAAwB,eAAxB;AACA,OAAOC,UAAP,MAAuB,cAAvB;AAEA,SAASC,WAAT,QAA4B,sBAA5B;AASA,OAAOC,iBAAP,IACEC,6BADF,QAEO,6BAFP;AAGA,OAAOC,g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c,EAAAA,IAAI,CAACC,MAAD,EAAkB;AAC3B5D,IAAAA,YAAY,CAACM,GAAb,CAAiB,8BAAjB;AAEAV,IAAAA,iBAAiB,CAAC+D,IAAlB,CAAuBC,MAAvB;AACA7D,IAAAA,cAAc,CAAC4D,IAAf;AACA7D,IAAAA,gBAAgB,CAAC6D,IAAjB;AACD;AAED;AACF;AACA;AACA;AACA;;;AACSE,EAAAA,eAAe,CAACT,GAAD,EAAcU,MAAd,EAAiD;AACrElE,IAAAA,iBAAiB,CAACiE,eAAlB,CAAkCT,GAAlC,EAAuCU,MAAvC,aAAuCA,MAAvC,cAAuCA,MAAvC,GAAiD,EAAjD;AACD;AAED;AACF;AACA;AACA;;;AACSC,EAAAA,aAAa,CAACC,UAAD,EAAsC;AACxD,QAAIxE,QAAQ,CAACyE,EAAT,KAAgB,KAApB,EAA2B;AACzBrE,MAAAA,iBAAiB,CAACmE,aAAlB,CAAgCC,UAAhC;AACD;AACF;AAED;AACF;AACA;AACA;AACA;;;AACgC,QAAjBE,iBAAiB,CAACC,QAAD,EAAqC;AACjE,QAAI3E,QAAQ,CAACyE,EAAT,KAAgB,SAApB,EAA+B;AAC7B,YAAMG,MAAM,GAAG,MAAMxE,iBAAiB,CAACsE,iBAAlB,CAAoCC,QAApC,CAArB;AACA,aAAOC,MAAP;AACD;;AAED,WAAO,KAAP;AACD;;AA5Oe;;gBAAZlE,W;;AA+ON,eAAeA,WAAf","sourcesContent":["import { NativeEventEmitter, Platform } from 'react-native';\n\nimport FWNavigator from './FWNavigator';\nimport LiveStream from './LiveStream';\nimport type AdBadgeConfiguration from './models/AdBadgeConfiguration';\nimport { FWEventName } from './models/FWEventName';\nimport type {\n CustomCTAClickEvent,\n SDKInitEvent,\n VideoFeedClickEvent,\n VideoPlaybackEvent,\n} from './models/FWEvents';\nimport type TrackPurchaseParameters from './models/TrackPurchaseParameters';\nimport type VideoPlayerConfiguration from './models/VideoPlayerConfiguration';\nimport FireworkSDKModule, {\n FireworkSDKModuleEventEmitter,\n} from './modules/FireworkSDKModule';\nimport LiveStreamModule from './modules/LiveStreamModule';\nimport ShoppingModule from './modules/ShoppingModule';\nimport FWLoggerUtil from './utils/FWLoggerUtil';\nimport VideoShopping from './VideoShopping';\n\nexport type SDKInitCallback = (event: SDKInitEvent) => void;\nexport type CustomCTAClickCallback = (event: CustomCTAClickEvent) => void;\nexport type VideoPlaybackCallback = (event: VideoPlaybackEvent) => void;\nexport type VideoFeedClickCallback = (event: VideoFeedClickEvent) => void;\n\n/**\n * Entry class of Firework SDK, which supports the sdk initialization and global configuration.\n */\nclass FireworkSDK {\n private static _instance?: FireworkSDK;\n\n /**\n * The callback of SDK initialization.\n */\n public onSDKInit?: SDKInitCallback;\n\n /**\n * the callback of clicking Video Feed.\n */\n public onVideoFeedClick?: VideoFeedClickCallback;\n\n /**\n * The callback of clicking custom CTA.\n */\n public get onCustomCTAClick(): CustomCTAClickCallback | undefined {\n return this._onCustomCTAClick;\n }\n public set onCustomCTAClick(value: CustomCTAClickCallback | undefined) {\n FWLoggerUtil.log(`Set onCustomCTAClick callback ${!!value}`);\n this._onCustomCTAClick = value;\n FireworkSDKModule.setCustomCTAClickEnabled(value ? true : false);\n }\n private _onCustomCTAClick: CustomCTAClickCallback | undefined;\n\n /**\n * The custom CTA link content page route name.\n */\n public get customCTALinkContentPageRouteName(): string | undefined {\n return this._customCTALinkContentPageRouteName;\n }\n public set customCTALinkContentPageRouteName(value: string | undefined) {\n this._customCTALinkContentPageRouteName = value;\n FireworkSDKModule.setCustomCTALinkContentPageRouteName(value ?? '');\n }\n private _customCTALinkContentPageRouteName: string | undefined;\n\n /**\n * The callback of video playback.\n */\n public get onVideoPlayback(): VideoPlaybackCallback | undefined {\n return this._onVideoPlayback;\n }\n public set onVideoPlayback(value: VideoPlaybackCallback | undefined) {\n this._onVideoPlayback = value;\n FireworkSDKModule.setVideoPlaybackEventEnabled(value ? true : false);\n }\n private _onVideoPlayback?: VideoPlaybackCallback | undefined;\n\n /**\n * The share base URL of videos.\n * The set accessor is async.\n */\n public get shareBaseURL(): string | undefined {\n return this._shareBaseURL;\n }\n public set shareBaseURL(value: string | undefined) {\n FireworkSDKModule.setShareBaseURL(value ?? '').then(() => {\n const valueHasChanged = this._shareBaseURL !== value;\n this._shareBaseURL = value;\n if (valueHasChanged) {\n this.eventEmitter.emit(FWEventName.ShareBaseURLUpdated);\n }\n });\n }\n private _shareBaseURL: string | undefined;\n\n /**\n * The configuration for ad badges.\n * The set accessor is async.\n */\n public get adBadgeConfiguration(): AdBadgeConfiguration | undefined {\n return this._adBadgeConfiguration;\n }\n public set adBadgeConfiguration(value: AdBadgeConfiguration | undefined) {\n FireworkSDKModule.setAdBadgeConfiguration(value ?? {}).then(() => {\n const valueHasChanged =\n this._adBadgeConfiguration?.badgeTextType !== value?.badgeTextType ||\n this._adBadgeConfiguration?.backgroundColor !==\n value?.backgroundColor ||\n this._adBadgeConfiguration?.textColor !== value?.textColor;\n this._adBadgeConfiguration = value;\n if (valueHasChanged) {\n this.eventEmitter.emit(FWEventName.AdBadgeConfigurationUpdated);\n }\n });\n }\n private _adBadgeConfiguration: AdBadgeConfiguration | undefined;\n\n /**\n * The app component name.\n */\n public get appComponentName(): string | undefined {\n return this._appComponentName;\n }\n public set appComponentName(value: string | undefined) {\n this._appComponentName = value;\n FireworkSDKModule.setAppComponentName(value ?? '');\n }\n private _appComponentName: string | undefined;\n\n /**\n * Defaults to false. You can enable debug logs by setting this property to true.\n */\n public get debugLogsEnabled(): boolean {\n return FWLoggerUtil.enabled;\n }\n public set debugLogsEnabled(value: boolean) {\n FWLoggerUtil.enabled = value;\n }\n\n private get eventEmitter(): NativeEventEmitter {\n return FireworkSDKModuleEventEmitter;\n }\n\n /**\n * Get VideoShopping object.\n */\n public get shopping(): VideoShopping {\n return this._shopping;\n }\n private _shopping: VideoShopping = VideoShopping.getInstance();\n\n /**\n * Get LiveStream object.\n */\n public get liveStream(): LiveStream {\n return this._liveStream;\n }\n private _liveStream: LiveStream = LiveStream.getInstance();\n\n /**\n * Get FWNavigator object.\n */\n public get navigator(): FWNavigator {\n return this._navigator;\n }\n private _navigator: FWNavigator = FWNavigator.getInstance();\n\n /**\n * Get global single instance of FireworkSDK class.\n * @returns FireworkSDK\n */\n public static getInstance() {\n if (!FireworkSDK._instance) {\n FireworkSDK._instance = new FireworkSDK();\n }\n\n return FireworkSDK._instance!;\n }\n\n private constructor() {\n FWLoggerUtil.log('FireworkSDK constructor');\n this.eventEmitter.addListener(FWEventName.SDKInit, (event) => {\n FWLoggerUtil.log(`Receive SDKInit event ${event?.error}`);\n\n if (this.onSDKInit) {\n this.onSDKInit(event ?? {});\n }\n });\n\n this.eventEmitter.addListener(FWEventName.LogMessage, (event) => {\n FWLoggerUtil.logNativeMessage(event.message);\n });\n\n this.eventEmitter.addListener(FWEventName.CustomCTAClick, (event) => {\n FWLoggerUtil.log(`Receive CustomCTAClick url: ${event?.url}`);\n\n if (this.onCustomCTAClick) {\n this.onCustomCTAClick(event ?? {});\n }\n });\n\n this.eventEmitter.addListener(FWEventName.VideoPlayback, (event) => {\n FWLoggerUtil.log(\n `Receive VideoPlayback event eventName: ${event?.eventName}`\n );\n\n if (this.onVideoPlayback) {\n this.onVideoPlayback(event ?? {});\n }\n });\n\n this.eventEmitter.addListener(FWEventName.VideoFeedClick, (event) => {\n FWLoggerUtil.log(`Receive VideoFeedClick event id: ${event?.info.id}`);\n\n if (this.onVideoFeedClick) {\n this.onVideoFeedClick(event ?? {});\n }\n });\n }\n\n /**\n * Initializes Firework SDK.\n * @param {string?} userId An id to uniquely identify device or user.\n */\n public init(userId?: string) {\n FWLoggerUtil.log('Call FireworkSDK init method');\n\n FireworkSDKModule.init(userId);\n ShoppingModule.init();\n LiveStreamModule.init();\n }\n\n /**\n * Open Video URL.\n * @param {string} url\n * @param {VideoPlayerConfiguration} config\n */\n public openVideoPlayer(url: string, config?: VideoPlayerConfiguration) {\n FireworkSDKModule.openVideoPlayer(url, config ?? {});\n }\n\n /**\n * Records the user purchase. Only supported on iOS.\n * @param {TrackPurchaseParameters} parameters\n */\n public trackPurchase(parameters: TrackPurchaseParameters) {\n if (Platform.OS === 'ios') {\n FireworkSDKModule.trackPurchase(parameters);\n }\n }\n\n /**\n * Change App level language. Only supported on Android.\n * @param {string} language Such as en, ar and en-US\n * @returns\n */\n public async changeAppLanguage(language: string): Promise<boolean> {\n if (Platform.OS === 'android') {\n const result = await FireworkSDKModule.changeAppLanguage(language);\n return result;\n }\n\n return false;\n }\n}\n\nexport default FireworkSDK;\n"]}
|
|
@@ -19,13 +19,15 @@ class VideoShopping {
|
|
|
19
19
|
/**
|
|
20
20
|
* This callback is triggered when the user clicks the shopping cart icon.
|
|
21
21
|
*
|
|
22
|
-
* The host app can return NewNativeContainerProps object
|
|
22
|
+
* The host app can return NewNativeContainerProps object
|
|
23
|
+
* and we will push a new native container with the props.
|
|
23
24
|
*/
|
|
24
25
|
|
|
25
26
|
/**
|
|
26
27
|
* This callback is triggered when the user clicks the shopping cart icon.
|
|
27
28
|
*
|
|
28
|
-
* The host app can customize the processing logic of
|
|
29
|
+
* The host app can customize the click event processing logic of
|
|
30
|
+
* the shopping cart icon by setting the callback.
|
|
29
31
|
*/
|
|
30
32
|
get onCustomClickCartIcon() {
|
|
31
33
|
return this._onCustomClickCartIcon;
|
|
@@ -40,7 +42,8 @@ class VideoShopping {
|
|
|
40
42
|
}
|
|
41
43
|
|
|
42
44
|
/**
|
|
43
|
-
* Defaults to true.
|
|
45
|
+
* Defaults to true.
|
|
46
|
+
* You can hide the cart icon by setting this property to false.
|
|
44
47
|
*/
|
|
45
48
|
get cartIconVisible() {
|
|
46
49
|
return this._cartIconVisible;
|
|
@@ -51,6 +54,41 @@ class VideoShopping {
|
|
|
51
54
|
ShoppingModule.setCartIconVisible(value);
|
|
52
55
|
}
|
|
53
56
|
|
|
57
|
+
/**
|
|
58
|
+
* The host app can use this property to configure "Add to cart" button style
|
|
59
|
+
* and hide the link button next to "Add to cart" button. Only supported on iOS.
|
|
60
|
+
*/
|
|
61
|
+
get productInfoViewConfiguration() {
|
|
62
|
+
return this._productInfoViewConfiguration;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
set productInfoViewConfiguration(value) {
|
|
66
|
+
this._productInfoViewConfiguration = value;
|
|
67
|
+
|
|
68
|
+
if (Platform.OS === 'ios') {
|
|
69
|
+
ShoppingModule.setProductInfoViewConfiguration(value !== null && value !== void 0 ? value : {});
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* This callback is triggered when the user clicks
|
|
75
|
+
* the link button next to Add to cart button. Only supported on Android.
|
|
76
|
+
*
|
|
77
|
+
* The host app can customize the click event processing logic of
|
|
78
|
+
* the link button by setting the callback.
|
|
79
|
+
*/
|
|
80
|
+
get onCustomClickLinkButton() {
|
|
81
|
+
return this._onCustomClickLinkButton;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
set onCustomClickLinkButton(value) {
|
|
85
|
+
this._onCustomClickLinkButton = value;
|
|
86
|
+
|
|
87
|
+
if (Platform.OS === 'android') {
|
|
88
|
+
ShoppingModule.setCustomClickLinkButtonEnabled(!!value);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
54
92
|
get eventEmitter() {
|
|
55
93
|
return ShoppingModuleEventEmitter;
|
|
56
94
|
}
|
|
@@ -78,8 +116,12 @@ class VideoShopping {
|
|
|
78
116
|
|
|
79
117
|
_defineProperty(this, "_cartIconVisible", true);
|
|
80
118
|
|
|
119
|
+
_defineProperty(this, "_productInfoViewConfiguration", void 0);
|
|
120
|
+
|
|
121
|
+
_defineProperty(this, "_onCustomClickLinkButton", void 0);
|
|
122
|
+
|
|
81
123
|
this.eventEmitter.addListener(FWEventName.AddToCart, event => {
|
|
82
|
-
FWLoggerUtil.log(`Receive AddToCart event productId: ${event.productId} unitId: ${event.unitId}`);
|
|
124
|
+
FWLoggerUtil.log(`Receive AddToCart event productId: ${event === null || event === void 0 ? void 0 : event.productId} unitId: ${event === null || event === void 0 ? void 0 : event.unitId}`);
|
|
83
125
|
this.handleAddToCartEvent(event);
|
|
84
126
|
});
|
|
85
127
|
this.eventEmitter.addListener(FWEventName.ClickCartIcon, event => {
|
|
@@ -87,14 +129,21 @@ class VideoShopping {
|
|
|
87
129
|
this.handleClickCartIconEvent(event);
|
|
88
130
|
});
|
|
89
131
|
this.eventEmitter.addListener(FWEventName.UpdateProductDetails, event => {
|
|
90
|
-
FWLoggerUtil.log(`Receive UpdateProductDetails event productIds: ${event.productIds}`);
|
|
132
|
+
FWLoggerUtil.log(`Receive UpdateProductDetails event productIds: ${event === null || event === void 0 ? void 0 : event.productIds}`);
|
|
91
133
|
this.handleUpdateProductDetailsEvent(event);
|
|
92
134
|
});
|
|
93
135
|
this.eventEmitter.addListener(FWEventName.WillDisplayProduct, event => {
|
|
94
|
-
FWLoggerUtil.log(`Receive WillDisplayProduct event videoId: ${event.videoId}`);
|
|
136
|
+
FWLoggerUtil.log(`Receive WillDisplayProduct event videoId: ${event === null || event === void 0 ? void 0 : event.videoId}`);
|
|
95
137
|
this.handleWillDisplayProductEvent(event);
|
|
96
138
|
});
|
|
97
139
|
this.eventEmitter.addListener(FWEventName.LogMessage, () => {});
|
|
140
|
+
|
|
141
|
+
if (Platform.OS === 'android') {
|
|
142
|
+
this.eventEmitter.addListener(FWEventName.CustomLinkButtonClick, event => {
|
|
143
|
+
FWLoggerUtil.log(`Receive CustomLinkButtonClick event url: ${event === null || event === void 0 ? void 0 : event.url}`);
|
|
144
|
+
this.handleCustomLinkButtonClickEvent(event);
|
|
145
|
+
});
|
|
146
|
+
}
|
|
98
147
|
}
|
|
99
148
|
/**
|
|
100
149
|
*
|
|
@@ -189,16 +238,21 @@ class VideoShopping {
|
|
|
189
238
|
|
|
190
239
|
async handleWillDisplayProductEvent(event) {
|
|
191
240
|
if (this.onWillDisplayProduct) {
|
|
192
|
-
const callbackId = event.callbackId;
|
|
193
241
|
delete event.callbackId;
|
|
194
242
|
const config = await this.onWillDisplayProduct(event);
|
|
195
243
|
|
|
196
|
-
if (config
|
|
197
|
-
ShoppingModule.
|
|
244
|
+
if (config) {
|
|
245
|
+
ShoppingModule.setProductInfoViewConfiguration(config);
|
|
198
246
|
}
|
|
199
247
|
}
|
|
200
248
|
}
|
|
201
249
|
|
|
250
|
+
async handleCustomLinkButtonClickEvent(event) {
|
|
251
|
+
if (this.onCustomClickLinkButton) {
|
|
252
|
+
this.onCustomClickLinkButton(event);
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
|
|
202
256
|
}
|
|
203
257
|
|
|
204
258
|
_defineProperty(VideoShopping, "_instance", void 0);
|