react-native-firework-sdk 1.3.0-beta.2 → 1.3.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/build.gradle +2 -2
- package/android/src/main/AndroidManifest.xml +2 -2
- package/android/src/main/java/com/fireworksdk/bridge/{reactnative/FWInitializationProvider.kt → FWInitializationProvider.kt} +1 -1
- package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoFeedConfigModel.kt +3 -1
- package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoPlayerConfigModel.kt +1 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoShoppingProduct.kt +1 -0
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/manager/FWVideoFeedManager.kt +5 -2
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FWNavigatorModule.kt +1 -1
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FWVideoShoppingModule.kt +44 -30
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FireworkSDKModule.kt +1 -1
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/utils/FWEventUtils.kt +5 -5
- package/android/src/main/java/com/fireworksdk/bridge/utils/FWVideoPlayerUtils.kt +18 -0
- package/ios/Components/VideoFeed.swift +95 -35
- package/ios/Components/VideoFeedConfiguration.swift +15 -3
- package/ios/Components/VideoPlayerConfiguration.swift +3 -2
- package/ios/Models/RNToNative/RCTConvert+FireworkSDKModule.swift +24 -4
- package/ios/Models/RNToNative/RCTConvert+VideoFeed.swift +1 -1
- package/ios/Modules/Shopping/CartViewController.swift +22 -39
- package/ios/Modules/Shopping/Product.swift +1 -0
- package/ios/Modules/Shopping/ProductInfoViewConfiguration.swift +1 -6
- package/ios/Modules/Shopping/ShoppingModule.m +1 -0
- package/ios/Modules/Shopping/ShoppingModule.swift +28 -16
- package/lib/commonjs/VideoShopping.js +25 -9
- package/lib/commonjs/VideoShopping.js.map +1 -1
- package/lib/commonjs/components/VideoFeed.js +28 -3
- package/lib/commonjs/components/VideoFeed.js.map +1 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/modules/ShoppingModule.js.map +1 -1
- package/lib/module/VideoShopping.js +24 -9
- package/lib/module/VideoShopping.js.map +1 -1
- package/lib/module/components/VideoFeed.js +28 -3
- package/lib/module/components/VideoFeed.js.map +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/modules/ShoppingModule.js.map +1 -1
- package/lib/typescript/VideoShopping.d.ts +15 -1
- package/lib/typescript/components/VideoFeed.d.ts +1 -0
- package/lib/typescript/index.d.ts +3 -3
- package/lib/typescript/models/ProductUnit.d.ts +12 -0
- package/lib/typescript/models/VideoFeedConfiguration.d.ts +33 -5
- package/lib/typescript/models/VideoPlayerConfiguration.d.ts +5 -1
- package/lib/typescript/modules/ShoppingModule.d.ts +1 -0
- package/package.json +2 -6
- package/react-native-firework-sdk.podspec +1 -1
- package/src/VideoShopping.ts +30 -3
- package/src/components/VideoFeed.tsx +22 -1
- package/src/index.tsx +4 -1
- package/src/models/ProductUnit.ts +13 -0
- package/src/models/VideoFeedConfiguration.ts +34 -5
- package/src/models/VideoPlayerConfiguration.ts +5 -1
- package/src/modules/ShoppingModule.ts +1 -0
|
@@ -60,16 +60,18 @@ export default class VideoFeed extends React.Component {
|
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
render() {
|
|
63
|
-
var _videoFeedConfigurati, _videoFeedConfigurati2, _videoFeedConfigurati3, _videoFeedConfigurati4, _FireworkSDK$getInsta, _FireworkSDK$getInsta2, _adBadgeConfiguration, _adBadgeConfiguration2, _adBadgeConfiguration3;
|
|
63
|
+
var _videoFeedConfigurati, _videoFeedConfigurati2, _videoFeedConfigurati3, _videoFeedConfigurati4, _FireworkSDK$getInsta, _FireworkSDK$getInsta2, _adBadgeConfiguration, _adBadgeConfiguration2, _adBadgeConfiguration3, _videoFeedConfigurati5, _videoFeedConfigurati6;
|
|
64
64
|
|
|
65
65
|
const {
|
|
66
66
|
source,
|
|
67
67
|
channel = '',
|
|
68
68
|
playlist = '',
|
|
69
69
|
playlistGroup = '',
|
|
70
|
-
mode = 'row'
|
|
71
|
-
videoFeedConfiguration
|
|
70
|
+
mode = 'row'
|
|
72
71
|
} = this.props;
|
|
72
|
+
|
|
73
|
+
const videoFeedConfiguration = this._getVideoFeedConfiguration();
|
|
74
|
+
|
|
73
75
|
const titleHidden = (_videoFeedConfigurati = videoFeedConfiguration === null || videoFeedConfiguration === void 0 ? void 0 : (_videoFeedConfigurati2 = videoFeedConfiguration.title) === null || _videoFeedConfigurati2 === void 0 ? void 0 : _videoFeedConfigurati2.hidden) !== null && _videoFeedConfigurati !== void 0 ? _videoFeedConfigurati : false;
|
|
74
76
|
const titlePosition = (_videoFeedConfigurati3 = videoFeedConfiguration === null || videoFeedConfiguration === void 0 ? void 0 : videoFeedConfiguration.titlePosition) !== null && _videoFeedConfigurati3 !== void 0 ? _videoFeedConfigurati3 : 'nested';
|
|
75
77
|
const customLayoutName = (_videoFeedConfigurati4 = videoFeedConfiguration === null || videoFeedConfiguration === void 0 ? void 0 : videoFeedConfiguration.customLayoutName) !== null && _videoFeedConfigurati4 !== void 0 ? _videoFeedConfigurati4 : '';
|
|
@@ -81,6 +83,8 @@ export default class VideoFeed extends React.Component {
|
|
|
81
83
|
|
|
82
84
|
const dynamicContentParametersString = this._generateDynamicContentParametersString();
|
|
83
85
|
|
|
86
|
+
const enableAutoplay = (_videoFeedConfigurati5 = videoFeedConfiguration === null || videoFeedConfiguration === void 0 ? void 0 : videoFeedConfiguration.enableAutoplay) !== null && _videoFeedConfigurati5 !== void 0 ? _videoFeedConfigurati5 : false;
|
|
87
|
+
const gridColumns = (_videoFeedConfigurati6 = videoFeedConfiguration === null || videoFeedConfiguration === void 0 ? void 0 : videoFeedConfiguration.gridColumns) !== null && _videoFeedConfigurati6 !== void 0 ? _videoFeedConfigurati6 : 2;
|
|
84
88
|
let key = `source:${source}`;
|
|
85
89
|
key += `_channel:${channel}`;
|
|
86
90
|
key += `_playlist:${playlist}`;
|
|
@@ -94,6 +98,8 @@ export default class VideoFeed extends React.Component {
|
|
|
94
98
|
key += `_backgroundColorOfAdBadge:${backgroundColorOfAdBadge}`;
|
|
95
99
|
key += `_textColorOfAdBadge:${textColorOfAdBadge}`;
|
|
96
100
|
key += `_dynamicContentParameters:${dynamicContentParametersString}`;
|
|
101
|
+
key += `_enableAutoplay:${enableAutoplay}`;
|
|
102
|
+
key += `_gridColumns:${gridColumns}`;
|
|
97
103
|
return /*#__PURE__*/React.createElement(FWVideoFeed, _extends({
|
|
98
104
|
key: key
|
|
99
105
|
}, this.props, {
|
|
@@ -132,6 +138,25 @@ export default class VideoFeed extends React.Component {
|
|
|
132
138
|
return resultString;
|
|
133
139
|
}
|
|
134
140
|
|
|
141
|
+
_getVideoFeedConfiguration() {
|
|
142
|
+
const {
|
|
143
|
+
videoFeedConfiguration
|
|
144
|
+
} = this.props;
|
|
145
|
+
|
|
146
|
+
if (!videoFeedConfiguration) {
|
|
147
|
+
return undefined;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
let resultFeedConfiguration = { ...videoFeedConfiguration
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
if (resultFeedConfiguration.gridColumns) {
|
|
154
|
+
resultFeedConfiguration.gridColumns = Math.floor(resultFeedConfiguration.gridColumns);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
return resultFeedConfiguration;
|
|
158
|
+
}
|
|
159
|
+
|
|
135
160
|
}
|
|
136
161
|
|
|
137
162
|
_defineProperty(VideoFeed, "defaultProps", {
|
|
@@ -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;;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;A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,GAAG,EAAE,KAAKV,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"]}
|
|
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","_getVideoFeedConfiguration","titleHidden","title","hidden","titlePosition","customLayoutName","shareBaseURL","getInstance","adBadgeConfiguration","adBadgeTextType","badgeTextType","backgroundColorOfAdBadge","backgroundColor","textColorOfAdBadge","textColor","dynamicContentParametersString","_generateDynamicContentParametersString","enableAutoplay","gridColumns","key","_onVideoFeedLoadFinished","Object","assign","style","zIndex","dynamicContentParameters","resultString","sortedKeyList","keys","sort","valueString","join","length","undefined","resultFeedConfiguration","Math","floor"],"mappings":";;;;AAAA,OAAOA,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ntheticEvent, 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 } = 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 gridColumns = videoFeedConfiguration?.gridColumns ?? 2;\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 += `_gridColumns:${gridColumns}`;\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 _getVideoFeedConfiguration(): VideoFeedConfiguration | undefined {\n const { videoFeedConfiguration } = this.props;\n if (!videoFeedConfiguration) {\n return undefined;\n }\n\n let resultFeedConfiguration: VideoFeedConfiguration = {\n ...videoFeedConfiguration,\n };\n if (resultFeedConfiguration.gridColumns) {\n resultFeedConfiguration.gridColumns = Math.floor(\n resultFeedConfiguration.gridColumns!\n );\n }\n return resultFeedConfiguration;\n }\n}\n"]}
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index.tsx"],"names":["VideoFeed","FireworkSDK","FWNavigator","LiveStream","LiveStreamChatEventName","LiveStreamEventName","VideoPlaybackEventName","VideoShopping"],"mappings":"AACA,OAAOA,SAAP,MAAsB,wBAAtB;AAQA,OAAOC,WAAP,MAAwB,eAAxB;AACA,OAAOC,WAAP,MAAwB,eAAxB;AAKA,OAAOC,UAAP,MAAuB,cAAvB;AAgBA,OAAOC,uBAAP,MAAoC,kCAApC;AAEA,OAAOC,mBAAP,MAAgC,8BAAhC;
|
|
1
|
+
{"version":3,"sources":["index.tsx"],"names":["VideoFeed","FireworkSDK","FWNavigator","LiveStream","LiveStreamChatEventName","LiveStreamEventName","VideoPlaybackEventName","VideoShopping"],"mappings":"AACA,OAAOA,SAAP,MAAsB,wBAAtB;AAQA,OAAOC,WAAP,MAAwB,eAAxB;AACA,OAAOC,WAAP,MAAwB,eAAxB;AAKA,OAAOC,UAAP,MAAuB,cAAvB;AAgBA,OAAOC,uBAAP,MAAoC,kCAApC;AAEA,OAAOC,mBAAP,MAAgC,8BAAhC;AAkBA,OAAOC,sBAAP,MAAmC,iCAAnC;AAcA,OAAOC,aAAP,MAA0B,iBAA1B;AAEA,eAAeN,WAAf;AAEA,SAaEC,WAbF,EAeEC,UAfF,EAiBEC,uBAjBF,EAoBEC,mBApBF,EAkCEL,SAlCF,EA+CEM,sBA/CF,EAqDEC,aArDF","sourcesContent":["import type { IVideoFeedProps, VideoFeedMode } from './components/VideoFeed';\nimport VideoFeed from './components/VideoFeed';\nimport type {\n CustomCTAClickCallback,\n CustomCTALinkContentRender,\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 AddToCartResult from './models/AddToCartResult';\nimport type FeedItemDetails from './models/FeedItemDetails';\nimport type FWError from './models/FWError';\nimport type {\n AddToCartEvent,\n CustomCTAClickEvent,\n LiveStreamChatEvent,\n LiveStreamEvent,\n SDKInitEvent,\n UpdateProductDetailsEvent,\n VideoPlaybackEvent,\n WillDisplayProductEvent,\n} from './models/FWEvents';\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 { AddToCartButtonConfiguration } from './models/ProductInfoViewConfiguration';\nimport type ProductUnit from './models/ProductUnit';\nimport type { ProductPrice, ProductUnitOption } from './models/ProductUnit';\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 VideoPlayerCTAStyle,\n VideoPlayerStyle,\n} from './models/VideoPlayerConfiguration';\nimport type {\n AddToCartCallback,\n ClickCartIconCallback,\n UpdateProductDetailsCallback,\n WillDisplayProductCallback,\n} from './VideoShopping';\nimport VideoShopping from './VideoShopping';\n\nexport default FireworkSDK;\n\nexport {\n AdBadgeConfiguration,\n AdBadgeTextType,\n AddToCartButtonConfiguration,\n AddToCartCallback,\n AddToCartEvent,\n AddToCartResult,\n ClickCartIconCallback,\n CustomCTAClickCallback,\n CustomCTAClickEvent,\n CustomCTALinkContentRender,\n FeedItemDetails,\n FWError,\n FWNavigator,\n IVideoFeedProps,\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 UpdateProductDetailsCallback,\n UpdateProductDetailsEvent,\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 VideoPlayerCTAStyle,\n VideoPlayerSize,\n VideoPlayerStyle,\n VideoShopping,\n WillDisplayProductCallback,\n WillDisplayProductEvent,\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["ShoppingModule.ts"],"names":["NativeEventEmitter","NativeModules","LINKING_ERROR","ShoppingModule","Proxy","get","Error","ShoppingModuleEventEmitter"],"mappings":"AAAA,SAASA,kBAAT,EAA2CC,aAA3C,QAAgE,cAAhE;AAGA,SAASC,aAAT,QAA8B,6BAA9B;AAGA,MAAMC,cAAc,GAAGF,aAAa,CAACE,cAAd,GACnBF,aAAa,CAACE,cADK,GAEnB,IAAIC,KAAJ,CACE,EADF,EAEE;AACEC,EAAAA,GAAG,GAAG;AACJ,UAAM,IAAIC,KAAJ,CAAUJ,aAAV,CAAN;AACD;;AAHH,CAFF,CAFJ;
|
|
1
|
+
{"version":3,"sources":["ShoppingModule.ts"],"names":["NativeEventEmitter","NativeModules","LINKING_ERROR","ShoppingModule","Proxy","get","Error","ShoppingModuleEventEmitter"],"mappings":"AAAA,SAASA,kBAAT,EAA2CC,aAA3C,QAAgE,cAAhE;AAGA,SAASC,aAAT,QAA8B,6BAA9B;AAGA,MAAMC,cAAc,GAAGF,aAAa,CAACE,cAAd,GACnBF,aAAa,CAACE,cADK,GAEnB,IAAIC,KAAJ,CACE,EADF,EAEE;AACEC,EAAAA,GAAG,GAAG;AACJ,UAAM,IAAIC,KAAJ,CAAUJ,aAAV,CAAN;AACD;;AAHH,CAFF,CAFJ;AAgCA,MAAMK,0BAA0B,GAAG,IAAIP,kBAAJ,CAAuBG,cAAvB,CAAnC;AACA,SAASI,0BAAT;AAEA,eAAeJ,cAAf","sourcesContent":["import { NativeEventEmitter, NativeModule, NativeModules } from 'react-native';\nimport type Product from '../models/Product';\nimport type ProductInfoViewConfiguration from '../models/ProductInfoViewConfiguration';\nimport { LINKING_ERROR } from '../constants/FWErrorMessage';\nimport type { NewNativeContainerProps } from 'src/models/NewNativeContainerProps';\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 updateProductViewConfig(\n config: ProductInfoViewConfiguration,\n callbackId: number | string\n ): 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}\n\nconst ShoppingModuleEventEmitter = new NativeEventEmitter(ShoppingModule);\nexport { ShoppingModuleEventEmitter };\n\nexport default ShoppingModule as IShoppingModule;\n"]}
|
|
@@ -5,6 +5,7 @@ import type ProductInfoViewConfiguration from './models/ProductInfoViewConfigura
|
|
|
5
5
|
import type { NewNativeContainerProps } from './models/NewNativeContainerProps';
|
|
6
6
|
export declare type AddToCartCallback = (event: AddToCartEvent) => Promise<AddToCartResult | undefined | null>;
|
|
7
7
|
export declare type ClickCartIconCallback = () => Promise<NewNativeContainerProps | undefined | null>;
|
|
8
|
+
export declare type CustomClickCartIconCallback = () => Promise<void>;
|
|
8
9
|
export declare type UpdateProductDetailsCallback = (event: UpdateProductDetailsEvent) => Promise<Product[] | undefined | null>;
|
|
9
10
|
export declare type WillDisplayProductCallback = (event: WillDisplayProductEvent) => Promise<ProductInfoViewConfiguration | undefined | null>;
|
|
10
11
|
/**
|
|
@@ -21,9 +22,22 @@ declare class VideoShopping {
|
|
|
21
22
|
/**
|
|
22
23
|
* This callback is triggered when the user clicks the shopping cart icon.
|
|
23
24
|
*
|
|
24
|
-
* The host app can return
|
|
25
|
+
* The host app can return NewNativeContainerProps object and we will push a new native container with the props.
|
|
25
26
|
*/
|
|
26
27
|
onClickCartIcon?: ClickCartIconCallback;
|
|
28
|
+
/**
|
|
29
|
+
* This callback is triggered when the user clicks the shopping cart icon.
|
|
30
|
+
*
|
|
31
|
+
* The host app can customize the processing logic of clicking the shopping cart icon by setting the callback.
|
|
32
|
+
* In the callack, you could call FireworkSDK.getInstance().navigator.popNativeContainer to close the player
|
|
33
|
+
* and call navigation.navigate to push the RN cart page.
|
|
34
|
+
* Currently, there is a limitation on the iOS side when you set the callback.
|
|
35
|
+
* That is, if you set the callback, you need to call FireworkSDK.getInstance().navigator.popNativeContainer in the callback.
|
|
36
|
+
* Otherwise there will be bugs on the iOS side.
|
|
37
|
+
*/
|
|
38
|
+
get onCustomClickCartIcon(): CustomClickCartIconCallback | undefined;
|
|
39
|
+
set onCustomClickCartIcon(value: CustomClickCartIconCallback | undefined);
|
|
40
|
+
private _onCustomClickCartIcon?;
|
|
27
41
|
/**
|
|
28
42
|
* This callback is triggered when the video will be shown.
|
|
29
43
|
*
|
|
@@ -20,9 +20,9 @@ import type Product from './models/Product';
|
|
|
20
20
|
import type ProductInfoViewConfiguration from './models/ProductInfoViewConfiguration';
|
|
21
21
|
import type { AddToCartButtonConfiguration } from './models/ProductInfoViewConfiguration';
|
|
22
22
|
import type ProductUnit from './models/ProductUnit';
|
|
23
|
-
import type { ProductPrice } from './models/ProductUnit';
|
|
23
|
+
import type { ProductPrice, ProductUnitOption } from './models/ProductUnit';
|
|
24
24
|
import type VideoFeedConfiguration from './models/VideoFeedConfiguration';
|
|
25
|
-
import type { VideoFeedPlayIconConfiguration, VideoFeedTitleConfiguration, VideoFeedTitlePosition } from './models/VideoFeedConfiguration';
|
|
25
|
+
import type { VideoFeedContentPadding, VideoFeedPlayIconConfiguration, VideoFeedTitleConfiguration, VideoFeedTitlePosition } from './models/VideoFeedConfiguration';
|
|
26
26
|
import type { VideoFeedSource } from './models/VideoFeedSource';
|
|
27
27
|
import type VideoPlaybackDetails from './models/VideoPlaybackDetails';
|
|
28
28
|
import type { VideoPlayerSize } from './models/VideoPlaybackDetails';
|
|
@@ -32,4 +32,4 @@ import type { VideoLaunchBehavior, VideoPlayerCompleteAction, VideoPlayerCTAStyl
|
|
|
32
32
|
import type { AddToCartCallback, ClickCartIconCallback, UpdateProductDetailsCallback, WillDisplayProductCallback } from './VideoShopping';
|
|
33
33
|
import VideoShopping from './VideoShopping';
|
|
34
34
|
export default FireworkSDK;
|
|
35
|
-
export { AdBadgeConfiguration, AdBadgeTextType, AddToCartButtonConfiguration, AddToCartCallback, AddToCartEvent, AddToCartResult, ClickCartIconCallback, CustomCTAClickCallback, CustomCTAClickEvent, CustomCTALinkContentRender, FeedItemDetails, FWError, FWNavigator, IVideoFeedProps, LiveStream, LiveStreamChatEvent, LiveStreamChatEventName, LiveStreamEvent, LiveStreamEventDetails, LiveStreamEventName, LiveStreamMessageDetails, NewNativeContainerProps, onLiveStreamChatEventCallback, onLiveStreamEventCallback, Product, ProductInfoViewConfiguration, ProductPrice, ProductUnit, SDKInitCallback, SDKInitEvent, UpdateProductDetailsCallback, UpdateProductDetailsEvent, VideoFeed, VideoFeedClickCallback, VideoFeedConfiguration, VideoFeedMode, VideoFeedPlayIconConfiguration, VideoFeedSource, VideoFeedTitleConfiguration, VideoFeedTitlePosition, VideoLaunchBehavior, VideoPlaybackCallback, VideoPlaybackDetails, VideoPlaybackEvent, VideoPlaybackEventName, VideoPlayerCompleteAction, VideoPlayerConfiguration, VideoPlayerCTAStyle, VideoPlayerSize, VideoPlayerStyle, VideoShopping, WillDisplayProductCallback, WillDisplayProductEvent, };
|
|
35
|
+
export { AdBadgeConfiguration, AdBadgeTextType, AddToCartButtonConfiguration, AddToCartCallback, AddToCartEvent, AddToCartResult, ClickCartIconCallback, CustomCTAClickCallback, CustomCTAClickEvent, CustomCTALinkContentRender, FeedItemDetails, FWError, FWNavigator, IVideoFeedProps, LiveStream, LiveStreamChatEvent, LiveStreamChatEventName, LiveStreamEvent, LiveStreamEventDetails, LiveStreamEventName, LiveStreamMessageDetails, NewNativeContainerProps, onLiveStreamChatEventCallback, onLiveStreamEventCallback, Product, ProductInfoViewConfiguration, ProductPrice, ProductUnit, ProductUnitOption, SDKInitCallback, SDKInitEvent, UpdateProductDetailsCallback, UpdateProductDetailsEvent, VideoFeed, VideoFeedClickCallback, VideoFeedConfiguration, VideoFeedContentPadding, VideoFeedMode, VideoFeedPlayIconConfiguration, VideoFeedSource, VideoFeedTitleConfiguration, VideoFeedTitlePosition, VideoLaunchBehavior, VideoPlaybackCallback, VideoPlaybackDetails, VideoPlaybackEvent, VideoPlaybackEventName, VideoPlayerCompleteAction, VideoPlayerConfiguration, VideoPlayerCTAStyle, VideoPlayerSize, VideoPlayerStyle, VideoShopping, WillDisplayProductCallback, WillDisplayProductEvent, };
|
|
@@ -2,6 +2,10 @@ export interface ProductPrice {
|
|
|
2
2
|
amount: number;
|
|
3
3
|
currencyCode: string;
|
|
4
4
|
}
|
|
5
|
+
export interface ProductUnitOption {
|
|
6
|
+
name: string;
|
|
7
|
+
value: string;
|
|
8
|
+
}
|
|
5
9
|
export default interface ProductUnit {
|
|
6
10
|
/**
|
|
7
11
|
* The unique identifier of the product unit.
|
|
@@ -15,8 +19,16 @@ export default interface ProductUnit {
|
|
|
15
19
|
* The url of the product unit.
|
|
16
20
|
*/
|
|
17
21
|
url?: string;
|
|
22
|
+
/**
|
|
23
|
+
* The image url of the product unit.
|
|
24
|
+
*/
|
|
25
|
+
imageUrl?: string;
|
|
18
26
|
/**
|
|
19
27
|
* The price of the product unit.
|
|
20
28
|
*/
|
|
21
29
|
price?: ProductPrice;
|
|
30
|
+
/**
|
|
31
|
+
* The options of the product unit.
|
|
32
|
+
*/
|
|
33
|
+
options?: ProductUnitOption[];
|
|
22
34
|
}
|
|
@@ -8,33 +8,61 @@ export interface VideoFeedPlayIconConfiguration {
|
|
|
8
8
|
iconWidth?: number;
|
|
9
9
|
}
|
|
10
10
|
export declare type VideoFeedTitlePosition = 'stacked' | 'nested';
|
|
11
|
+
export interface VideoFeedContentPadding {
|
|
12
|
+
top?: number;
|
|
13
|
+
right?: number;
|
|
14
|
+
bottom?: number;
|
|
15
|
+
left?: number;
|
|
16
|
+
}
|
|
11
17
|
export default interface VideoFeedConfiguration {
|
|
12
18
|
/**
|
|
13
19
|
* Background color of video feed.
|
|
14
20
|
*/
|
|
15
21
|
backgroundColor?: string;
|
|
16
22
|
/**
|
|
17
|
-
* Corner radius of video feed. Only supported on iOS.
|
|
23
|
+
* Corner radius of video feed item. Only supported on iOS.
|
|
18
24
|
*/
|
|
19
25
|
cornerRadius?: number;
|
|
20
26
|
/**
|
|
21
|
-
* Configuration of video feed title.
|
|
27
|
+
* Configuration of video feed item title.
|
|
22
28
|
*/
|
|
23
29
|
title?: VideoFeedTitleConfiguration;
|
|
24
30
|
/**
|
|
25
|
-
* Title position of video feed.
|
|
31
|
+
* Title position of video feed item.
|
|
26
32
|
*/
|
|
27
33
|
titlePosition?: VideoFeedTitlePosition;
|
|
28
34
|
/**
|
|
29
|
-
* Configuration of video feed play icon. Only supported on iOS.
|
|
35
|
+
* Configuration of video feed item play icon. Only supported on iOS.
|
|
30
36
|
*/
|
|
31
37
|
playIcon?: VideoFeedPlayIconConfiguration;
|
|
32
38
|
/**
|
|
33
|
-
* Indicates if the video feed shows ad badge.
|
|
39
|
+
* Indicates if the video feed item shows ad badge.
|
|
34
40
|
*/
|
|
35
41
|
showAdBadge?: boolean;
|
|
36
42
|
/**
|
|
37
43
|
* Custom layout name for video feed item. Only supported on Android.
|
|
38
44
|
*/
|
|
39
45
|
customLayoutName?: string;
|
|
46
|
+
/**
|
|
47
|
+
* The aspect ratio(width / height) for video feed item. Only supported on iOS.
|
|
48
|
+
*/
|
|
49
|
+
aspectRatio?: number;
|
|
50
|
+
/**
|
|
51
|
+
* The content padding for video feed. Only supported on iOS.
|
|
52
|
+
*/
|
|
53
|
+
contentPadding?: VideoFeedContentPadding;
|
|
54
|
+
/**
|
|
55
|
+
* The item spacing for video feed. Only supported on iOS.
|
|
56
|
+
*/
|
|
57
|
+
itemSpacing?: number;
|
|
58
|
+
/**
|
|
59
|
+
* Specifies if autoplay is enabled.
|
|
60
|
+
*/
|
|
61
|
+
enableAutoplay?: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* The number of feed items to be displayed per row.
|
|
64
|
+
* The property only takes effect when video feed mode is grid.
|
|
65
|
+
* The property value needs to be an integer and greater than 0.
|
|
66
|
+
*/
|
|
67
|
+
gridColumns?: number;
|
|
40
68
|
}
|
|
@@ -32,7 +32,11 @@ export default interface VideoPlayerConfiguration {
|
|
|
32
32
|
*/
|
|
33
33
|
showMuteButton?: boolean;
|
|
34
34
|
/**
|
|
35
|
-
*
|
|
35
|
+
* Specifies the video player launch behavior.
|
|
36
36
|
*/
|
|
37
37
|
launchBehavior?: VideoLaunchBehavior;
|
|
38
|
+
/**
|
|
39
|
+
* Indicates if Firework branding should be showed or not.
|
|
40
|
+
*/
|
|
41
|
+
showBranding?: boolean;
|
|
38
42
|
}
|
|
@@ -10,6 +10,7 @@ interface IShoppingModule extends NativeModule {
|
|
|
10
10
|
jumpToCartPage(callbackId: number | string, props: NewNativeContainerProps): void;
|
|
11
11
|
setCartIconVisible(visible: boolean): void;
|
|
12
12
|
setCartItemCount(count: number): void;
|
|
13
|
+
setCustomClickCartIconEnabled(enabled: boolean): Promise<void>;
|
|
13
14
|
}
|
|
14
15
|
declare const ShoppingModuleEventEmitter: NativeEventEmitter;
|
|
15
16
|
export { ShoppingModuleEventEmitter };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-firework-sdk",
|
|
3
|
-
"version": "1.3.0
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "Firework React Native SDK",
|
|
5
5
|
"main": "lib/commonjs/index",
|
|
6
6
|
"module": "lib/module/index",
|
|
@@ -24,10 +24,7 @@
|
|
|
24
24
|
"test": "jest",
|
|
25
25
|
"typescript": "tsc --noEmit",
|
|
26
26
|
"lint": "eslint \"**/*.{js,ts,tsx}\"",
|
|
27
|
-
"prepare": "bob build"
|
|
28
|
-
"install_js_depencies": "npm i && cd example && npm i",
|
|
29
|
-
"setup_ios": "npm run install_js_depencies && cd example && pod-install",
|
|
30
|
-
"setup_android": "npm run install_js_depencies"
|
|
27
|
+
"prepare": "bob build"
|
|
31
28
|
},
|
|
32
29
|
"keywords": [
|
|
33
30
|
"react-native",
|
|
@@ -56,7 +53,6 @@
|
|
|
56
53
|
"eslint-plugin-prettier": "^3.1.3",
|
|
57
54
|
"husky": "^6.0.0",
|
|
58
55
|
"jest": "^26.6.3",
|
|
59
|
-
"pod-install": "^0.1.0",
|
|
60
56
|
"prettier": "^2.0.5",
|
|
61
57
|
"react": "17.0.2",
|
|
62
58
|
"react-native": "0.66.4",
|
package/src/VideoShopping.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { NativeEventEmitter, Platform } from 'react-native';
|
|
2
2
|
|
|
3
3
|
import type AddToCartResult from './models/AddToCartResult';
|
|
4
4
|
import type {
|
|
@@ -22,6 +22,8 @@ export type ClickCartIconCallback = () => Promise<
|
|
|
22
22
|
NewNativeContainerProps | undefined | null
|
|
23
23
|
>;
|
|
24
24
|
|
|
25
|
+
export type CustomClickCartIconCallback = () => Promise<void>;
|
|
26
|
+
|
|
25
27
|
export type UpdateProductDetailsCallback = (
|
|
26
28
|
event: UpdateProductDetailsEvent
|
|
27
29
|
) => Promise<Product[] | undefined | null>;
|
|
@@ -48,10 +50,33 @@ class VideoShopping {
|
|
|
48
50
|
/**
|
|
49
51
|
* This callback is triggered when the user clicks the shopping cart icon.
|
|
50
52
|
*
|
|
51
|
-
* The host app can return
|
|
53
|
+
* The host app can return NewNativeContainerProps object and we will push a new native container with the props.
|
|
52
54
|
*/
|
|
53
55
|
public onClickCartIcon?: ClickCartIconCallback;
|
|
54
56
|
|
|
57
|
+
/**
|
|
58
|
+
* This callback is triggered when the user clicks the shopping cart icon.
|
|
59
|
+
*
|
|
60
|
+
* The host app can customize the processing logic of clicking the shopping cart icon by setting the callback.
|
|
61
|
+
* In the callack, you could call FireworkSDK.getInstance().navigator.popNativeContainer to close the player
|
|
62
|
+
* and call navigation.navigate to push the RN cart page.
|
|
63
|
+
* Currently, there is a limitation on the iOS side when you set the callback.
|
|
64
|
+
* That is, if you set the callback, you need to call FireworkSDK.getInstance().navigator.popNativeContainer in the callback.
|
|
65
|
+
* Otherwise there will be bugs on the iOS side.
|
|
66
|
+
*/
|
|
67
|
+
public get onCustomClickCartIcon(): CustomClickCartIconCallback | undefined {
|
|
68
|
+
return this._onCustomClickCartIcon;
|
|
69
|
+
}
|
|
70
|
+
public set onCustomClickCartIcon(
|
|
71
|
+
value: CustomClickCartIconCallback | undefined
|
|
72
|
+
) {
|
|
73
|
+
this._onCustomClickCartIcon = value;
|
|
74
|
+
if (Platform.OS === 'ios') {
|
|
75
|
+
ShoppingModule.setCustomClickCartIconEnabled(!!value);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
private _onCustomClickCartIcon?: CustomClickCartIconCallback | undefined;
|
|
79
|
+
|
|
55
80
|
/**
|
|
56
81
|
* This callback is triggered when the video will be shown.
|
|
57
82
|
*
|
|
@@ -132,7 +157,9 @@ class VideoShopping {
|
|
|
132
157
|
}
|
|
133
158
|
|
|
134
159
|
private async handleClickCartIconEvent(event: CallbackInfo) {
|
|
135
|
-
if (this.
|
|
160
|
+
if (this.onCustomClickCartIcon) {
|
|
161
|
+
this.onCustomClickCartIcon();
|
|
162
|
+
} else if (this.onClickCartIcon) {
|
|
136
163
|
const callbackId = event.callbackId;
|
|
137
164
|
delete event.callbackId;
|
|
138
165
|
const props = await this.onClickCartIcon();
|
|
@@ -140,8 +140,8 @@ export default class VideoFeed extends React.Component<IVideoFeedProps> {
|
|
|
140
140
|
playlist = '',
|
|
141
141
|
playlistGroup = '',
|
|
142
142
|
mode = 'row',
|
|
143
|
-
videoFeedConfiguration,
|
|
144
143
|
} = this.props;
|
|
144
|
+
const videoFeedConfiguration = this._getVideoFeedConfiguration();
|
|
145
145
|
const titleHidden = videoFeedConfiguration?.title?.hidden ?? false;
|
|
146
146
|
const titlePosition = videoFeedConfiguration?.titlePosition ?? 'nested';
|
|
147
147
|
const customLayoutName = videoFeedConfiguration?.customLayoutName ?? '';
|
|
@@ -153,6 +153,8 @@ export default class VideoFeed extends React.Component<IVideoFeedProps> {
|
|
|
153
153
|
const textColorOfAdBadge = adBadgeConfiguration.textColor ?? '';
|
|
154
154
|
const dynamicContentParametersString =
|
|
155
155
|
this._generateDynamicContentParametersString();
|
|
156
|
+
const enableAutoplay = videoFeedConfiguration?.enableAutoplay ?? false;
|
|
157
|
+
const gridColumns = videoFeedConfiguration?.gridColumns ?? 2;
|
|
156
158
|
|
|
157
159
|
let key = `source:${source}`;
|
|
158
160
|
key += `_channel:${channel}`;
|
|
@@ -167,6 +169,8 @@ export default class VideoFeed extends React.Component<IVideoFeedProps> {
|
|
|
167
169
|
key += `_backgroundColorOfAdBadge:${backgroundColorOfAdBadge}`;
|
|
168
170
|
key += `_textColorOfAdBadge:${textColorOfAdBadge}`;
|
|
169
171
|
key += `_dynamicContentParameters:${dynamicContentParametersString}`;
|
|
172
|
+
key += `_enableAutoplay:${enableAutoplay}`;
|
|
173
|
+
key += `_gridColumns:${gridColumns}`;
|
|
170
174
|
|
|
171
175
|
return (
|
|
172
176
|
<FWVideoFeed
|
|
@@ -200,4 +204,21 @@ export default class VideoFeed extends React.Component<IVideoFeedProps> {
|
|
|
200
204
|
|
|
201
205
|
return resultString;
|
|
202
206
|
}
|
|
207
|
+
|
|
208
|
+
private _getVideoFeedConfiguration(): VideoFeedConfiguration | undefined {
|
|
209
|
+
const { videoFeedConfiguration } = this.props;
|
|
210
|
+
if (!videoFeedConfiguration) {
|
|
211
|
+
return undefined;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
let resultFeedConfiguration: VideoFeedConfiguration = {
|
|
215
|
+
...videoFeedConfiguration,
|
|
216
|
+
};
|
|
217
|
+
if (resultFeedConfiguration.gridColumns) {
|
|
218
|
+
resultFeedConfiguration.gridColumns = Math.floor(
|
|
219
|
+
resultFeedConfiguration.gridColumns!
|
|
220
|
+
);
|
|
221
|
+
}
|
|
222
|
+
return resultFeedConfiguration;
|
|
223
|
+
}
|
|
203
224
|
}
|
package/src/index.tsx
CHANGED
|
@@ -38,9 +38,10 @@ import type Product from './models/Product';
|
|
|
38
38
|
import type ProductInfoViewConfiguration from './models/ProductInfoViewConfiguration';
|
|
39
39
|
import type { AddToCartButtonConfiguration } from './models/ProductInfoViewConfiguration';
|
|
40
40
|
import type ProductUnit from './models/ProductUnit';
|
|
41
|
-
import type { ProductPrice } from './models/ProductUnit';
|
|
41
|
+
import type { ProductPrice, ProductUnitOption } from './models/ProductUnit';
|
|
42
42
|
import type VideoFeedConfiguration from './models/VideoFeedConfiguration';
|
|
43
43
|
import type {
|
|
44
|
+
VideoFeedContentPadding,
|
|
44
45
|
VideoFeedPlayIconConfiguration,
|
|
45
46
|
VideoFeedTitleConfiguration,
|
|
46
47
|
VideoFeedTitlePosition,
|
|
@@ -95,6 +96,7 @@ export {
|
|
|
95
96
|
ProductInfoViewConfiguration,
|
|
96
97
|
ProductPrice,
|
|
97
98
|
ProductUnit,
|
|
99
|
+
ProductUnitOption,
|
|
98
100
|
SDKInitCallback,
|
|
99
101
|
SDKInitEvent,
|
|
100
102
|
UpdateProductDetailsCallback,
|
|
@@ -102,6 +104,7 @@ export {
|
|
|
102
104
|
VideoFeed,
|
|
103
105
|
VideoFeedClickCallback,
|
|
104
106
|
VideoFeedConfiguration,
|
|
107
|
+
VideoFeedContentPadding,
|
|
105
108
|
VideoFeedMode,
|
|
106
109
|
VideoFeedPlayIconConfiguration,
|
|
107
110
|
VideoFeedSource,
|
|
@@ -3,6 +3,11 @@ export interface ProductPrice {
|
|
|
3
3
|
currencyCode: string;
|
|
4
4
|
}
|
|
5
5
|
|
|
6
|
+
export interface ProductUnitOption {
|
|
7
|
+
name: string;
|
|
8
|
+
value: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
6
11
|
export default interface ProductUnit {
|
|
7
12
|
/**
|
|
8
13
|
* The unique identifier of the product unit.
|
|
@@ -16,8 +21,16 @@ export default interface ProductUnit {
|
|
|
16
21
|
* The url of the product unit.
|
|
17
22
|
*/
|
|
18
23
|
url?: string;
|
|
24
|
+
/**
|
|
25
|
+
* The image url of the product unit.
|
|
26
|
+
*/
|
|
27
|
+
imageUrl?: string;
|
|
19
28
|
/**
|
|
20
29
|
* The price of the product unit.
|
|
21
30
|
*/
|
|
22
31
|
price?: ProductPrice;
|
|
32
|
+
/**
|
|
33
|
+
* The options of the product unit.
|
|
34
|
+
*/
|
|
35
|
+
options?: ProductUnitOption[];
|
|
23
36
|
}
|
|
@@ -11,33 +11,62 @@ export interface VideoFeedPlayIconConfiguration {
|
|
|
11
11
|
|
|
12
12
|
export type VideoFeedTitlePosition = 'stacked' | 'nested';
|
|
13
13
|
|
|
14
|
+
export interface VideoFeedContentPadding {
|
|
15
|
+
top?: number;
|
|
16
|
+
right?: number;
|
|
17
|
+
bottom?: number;
|
|
18
|
+
left?: number;
|
|
19
|
+
}
|
|
20
|
+
|
|
14
21
|
export default interface VideoFeedConfiguration {
|
|
15
22
|
/**
|
|
16
23
|
* Background color of video feed.
|
|
17
24
|
*/
|
|
18
25
|
backgroundColor?: string;
|
|
19
26
|
/**
|
|
20
|
-
* Corner radius of video feed. Only supported on iOS.
|
|
27
|
+
* Corner radius of video feed item. Only supported on iOS.
|
|
21
28
|
*/
|
|
22
29
|
cornerRadius?: number;
|
|
23
30
|
/**
|
|
24
|
-
* Configuration of video feed title.
|
|
31
|
+
* Configuration of video feed item title.
|
|
25
32
|
*/
|
|
26
33
|
title?: VideoFeedTitleConfiguration;
|
|
27
34
|
/**
|
|
28
|
-
* Title position of video feed.
|
|
35
|
+
* Title position of video feed item.
|
|
29
36
|
*/
|
|
30
37
|
titlePosition?: VideoFeedTitlePosition;
|
|
31
38
|
/**
|
|
32
|
-
* Configuration of video feed play icon. Only supported on iOS.
|
|
39
|
+
* Configuration of video feed item play icon. Only supported on iOS.
|
|
33
40
|
*/
|
|
34
41
|
playIcon?: VideoFeedPlayIconConfiguration;
|
|
35
42
|
/**
|
|
36
|
-
* Indicates if the video feed shows ad badge.
|
|
43
|
+
* Indicates if the video feed item shows ad badge.
|
|
37
44
|
*/
|
|
38
45
|
showAdBadge?: boolean;
|
|
39
46
|
/**
|
|
40
47
|
* Custom layout name for video feed item. Only supported on Android.
|
|
41
48
|
*/
|
|
42
49
|
customLayoutName?: string;
|
|
50
|
+
/**
|
|
51
|
+
* The aspect ratio(width / height) for video feed item. Only supported on iOS.
|
|
52
|
+
*/
|
|
53
|
+
aspectRatio?: number;
|
|
54
|
+
/**
|
|
55
|
+
* The content padding for video feed. Only supported on iOS.
|
|
56
|
+
*/
|
|
57
|
+
contentPadding?: VideoFeedContentPadding;
|
|
58
|
+
/**
|
|
59
|
+
* The item spacing for video feed. Only supported on iOS.
|
|
60
|
+
*/
|
|
61
|
+
itemSpacing?: number;
|
|
62
|
+
/**
|
|
63
|
+
* Specifies if autoplay is enabled.
|
|
64
|
+
*/
|
|
65
|
+
enableAutoplay?: boolean;
|
|
66
|
+
/**
|
|
67
|
+
* The number of feed items to be displayed per row.
|
|
68
|
+
* The property only takes effect when video feed mode is grid.
|
|
69
|
+
* The property value needs to be an integer and greater than 0.
|
|
70
|
+
*/
|
|
71
|
+
gridColumns?: number;
|
|
43
72
|
}
|
|
@@ -34,7 +34,11 @@ export default interface VideoPlayerConfiguration {
|
|
|
34
34
|
*/
|
|
35
35
|
showMuteButton?: boolean;
|
|
36
36
|
/**
|
|
37
|
-
*
|
|
37
|
+
* Specifies the video player launch behavior.
|
|
38
38
|
*/
|
|
39
39
|
launchBehavior?: VideoLaunchBehavior;
|
|
40
|
+
/**
|
|
41
|
+
* Indicates if Firework branding should be showed or not.
|
|
42
|
+
*/
|
|
43
|
+
showBranding?: boolean;
|
|
40
44
|
}
|
|
@@ -33,6 +33,7 @@ interface IShoppingModule extends NativeModule {
|
|
|
33
33
|
): void;
|
|
34
34
|
setCartIconVisible(visible: boolean): void;
|
|
35
35
|
setCartItemCount(count: number): void;
|
|
36
|
+
setCustomClickCartIconEnabled(enabled: boolean): Promise<void>; // Only supported on iOS
|
|
36
37
|
}
|
|
37
38
|
|
|
38
39
|
const ShoppingModuleEventEmitter = new NativeEventEmitter(ShoppingModule);
|