react-native-firework-sdk 1.3.1-beta.4 → 1.3.1-beta.7

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.
Files changed (34) hide show
  1. package/ios/Components/VideoFeed.swift +2 -0
  2. package/ios/Modules/FireworkSDKModule/FireworkSDKModule.swift +14 -2
  3. package/ios/Modules/Shopping/ShoppingModule.swift +30 -5
  4. package/lib/commonjs/FWNavigator.js +2 -0
  5. package/lib/commonjs/FWNavigator.js.map +1 -1
  6. package/lib/commonjs/FireworkSDK.js +24 -11
  7. package/lib/commonjs/FireworkSDK.js.map +1 -1
  8. package/lib/commonjs/LiveStream.js +6 -0
  9. package/lib/commonjs/LiveStream.js.map +1 -1
  10. package/lib/commonjs/VideoShopping.js +11 -0
  11. package/lib/commonjs/VideoShopping.js.map +1 -1
  12. package/lib/commonjs/components/VideoFeed.js +16 -0
  13. package/lib/commonjs/components/VideoFeed.js.map +1 -1
  14. package/lib/commonjs/modules/ShoppingModule.js.map +1 -1
  15. package/lib/module/FWNavigator.js +1 -0
  16. package/lib/module/FWNavigator.js.map +1 -1
  17. package/lib/module/FireworkSDK.js +23 -11
  18. package/lib/module/FireworkSDK.js.map +1 -1
  19. package/lib/module/LiveStream.js +2 -0
  20. package/lib/module/LiveStream.js.map +1 -1
  21. package/lib/module/VideoShopping.js +8 -0
  22. package/lib/module/VideoShopping.js.map +1 -1
  23. package/lib/module/components/VideoFeed.js +8 -0
  24. package/lib/module/components/VideoFeed.js.map +1 -1
  25. package/lib/module/modules/ShoppingModule.js.map +1 -1
  26. package/lib/typescript/FireworkSDK.d.ts +3 -0
  27. package/lib/typescript/modules/ShoppingModule.d.ts +1 -1
  28. package/package.json +1 -1
  29. package/src/FWNavigator.tsx +1 -0
  30. package/src/FireworkSDK.ts +18 -5
  31. package/src/LiveStream.ts +2 -0
  32. package/src/VideoShopping.ts +10 -0
  33. package/src/components/VideoFeed.tsx +20 -0
  34. package/src/modules/ShoppingModule.ts +3 -2
@@ -66,9 +66,12 @@ class FireworkSDK {
66
66
  }
67
67
 
68
68
  set shareBaseURL(value) {
69
+ const valueHasChanged = this._shareBaseURL !== value;
69
70
  this._shareBaseURL = value;
70
71
  FireworkSDKModule.setShareBaseURL(value !== null && value !== void 0 ? value : '').then(() => {
71
- this.eventEmitter.emit(FWEventName.ShareBaseURLUpdated);
72
+ if (valueHasChanged) {
73
+ this.eventEmitter.emit(FWEventName.ShareBaseURLUpdated);
74
+ }
72
75
  });
73
76
  }
74
77
 
@@ -80,9 +83,14 @@ class FireworkSDK {
80
83
  }
81
84
 
82
85
  set adBadgeConfiguration(value) {
86
+ var _this$_adBadgeConfigu, _this$_adBadgeConfigu2, _this$_adBadgeConfigu3;
87
+
88
+ 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);
83
89
  this._adBadgeConfiguration = value;
84
90
  FireworkSDKModule.setAdBadgeConfiguration(value !== null && value !== void 0 ? value : {}).then(() => {
85
- this.eventEmitter.emit(FWEventName.AdBadgeConfigurationUpdated);
91
+ if (valueHasChanged) {
92
+ this.eventEmitter.emit(FWEventName.AdBadgeConfigurationUpdated);
93
+ }
86
94
  });
87
95
  }
88
96
 
@@ -118,30 +126,27 @@ class FireworkSDK {
118
126
 
119
127
 
120
128
  get shopping() {
121
- return VideoShopping.getInstance();
129
+ return this._shopping;
122
130
  }
131
+
123
132
  /**
124
133
  * Get LiveStream object.
125
134
  */
126
-
127
-
128
135
  get liveStream() {
129
- return LiveStream.getInstance();
136
+ return this._liveStream;
130
137
  }
138
+
131
139
  /**
132
140
  * Get FWNavigator object.
133
141
  */
134
-
135
-
136
142
  get navigator() {
137
- return FWNavigator.getInstance();
143
+ return this._navigator;
138
144
  }
145
+
139
146
  /**
140
147
  * Get global single instance of FireworkSDK class.
141
148
  * @returns FireworkSDK
142
149
  */
143
-
144
-
145
150
  static getInstance() {
146
151
  if (!FireworkSDK._instance) {
147
152
  FireworkSDK._instance = new FireworkSDK();
@@ -167,6 +172,13 @@ class FireworkSDK {
167
172
 
168
173
  _defineProperty(this, "_appComponentName", void 0);
169
174
 
175
+ _defineProperty(this, "_shopping", VideoShopping.getInstance());
176
+
177
+ _defineProperty(this, "_liveStream", LiveStream.getInstance());
178
+
179
+ _defineProperty(this, "_navigator", FWNavigator.getInstance());
180
+
181
+ FWLoggerUtil.log('FireworkSDK constructor');
170
182
  this.eventEmitter.addListener(FWEventName.SDKInit, event => {
171
183
  FWLoggerUtil.log(`Receive SDKInit event ${event === null || event === void 0 ? void 0 : event.error}`);
172
184
 
@@ -1 +1 @@
1
- {"version":3,"sources":["FireworkSDK.ts"],"names":["LiveStream","FWEventName","FireworkSDKModule","FireworkSDKModuleEventEmitter","LiveStreamModule","ShoppingModule","VideoShopping","FWNavigator","FWLoggerUtil","FireworkSDK","onCustomCTAClick","_onCustomCTAClick","value","log","setCustomCTAClickEnabled","customCTALinkContentPageRouteName","_customCTALinkContentPageRouteName","setCustomCTALinkContentPageRouteName","onVideoPlayback","_onVideoPlayback","setVideoPlaybackEventEnabled","shareBaseURL","_shareBaseURL","setShareBaseURL","then","eventEmitter","emit","ShareBaseURLUpdated","adBadgeConfiguration","_adBadgeConfiguration","setAdBadgeConfiguration","AdBadgeConfigurationUpdated","appComponentName","_appComponentName","setAppComponentName","debugLogsEnabled","enabled","shopping","getInstance","liveStream","navigator","_instance","constructor","addListener","SDKInit","event","error","onSDKInit","LogMessage","logNativeMessage","message","CustomCTAClick","url","VideoPlayback","eventName","VideoFeedClick","info","id","onVideoFeedClick","init","userId","openVideoPlayer","config"],"mappings":";;AACA,OAAOA,UAAP,MAAuB,cAAvB;AAGA,SAASC,WAAT,QAA4B,sBAA5B;AAQA,OAAOC,iBAAP,IACEC,6BADF,QAEO,6BAFP;AAGA,OAAOC,gBAAP,MAA6B,4BAA7B;AACA,OAAOC,cAAP,MAA2B,0BAA3B;AACA,OAAOC,aAAP,MAA0B,iBAA1B;AACA,OAAOC,WAAP,MAAwB,eAAxB;AACA,OAAOC,YAAP,MAAyB,sBAAzB;;AAUA;AACA;AACA;AACA,MAAMC,WAAN,CAAkB;AAGhB;AACF;AACA;;AAGE;AACF;AACA;;AAGE;AACF;AACA;AAC6B,MAAhBC,gBAAgB,GAAuC;AAChE,WAAO,KAAKC,iBAAZ;AACD;;AAC0B,MAAhBD,gBAAgB,CAACE,KAAD,EAA4C;AACrEJ,IAAAA,YAAY,CAACK,GAAb,CAAkB,iCAAgC,CAAC,CAACD,KAAM,EAA1D;AACA,SAAKD,iBAAL,GAAyBC,KAAzB;AACAV,IAAAA,iBAAiB,CAACY,wBAAlB,CAA2CF,KAAK,GAAG,IAAH,GAAU,KAA1D;AACD;;AAGD;AACF;AACA;AAC8C,MAAjCG,iCAAiC,GAAuB;AACjE,WAAO,KAAKC,kCAAZ;AACD;;AAC2C,MAAjCD,iCAAiC,CAACH,KAAD,EAA4B;AACtE,SAAKI,kCAAL,GAA0CJ,KAA1C;AACAV,IAAAA,iBAAiB,CAACe,oCAAlB,CAAuDL,KAAvD,aAAuDA,KAAvD,cAAuDA,KAAvD,GAAgE,EAAhE;AACD;;AAGD;AACF;AACA;AAC4B,MAAfM,eAAe,GAAsC;AAC9D,WAAO,KAAKC,gBAAZ;AACD;;AACyB,MAAfD,eAAe,CAACN,KAAD,EAA2C;AACnE,SAAKO,gBAAL,GAAwBP,KAAxB;AACAV,IAAAA,iBAAiB,CAACkB,4BAAlB,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,CAAkCT,GAAlC,EAAuCU,MAAvC,aAAuCA,MAAvC,cAAuCA,MAAvC,GAAiD,EAAjD;AACD;;AApMe;;gBAAZrD,W;;AAuMN,eAAeA,WAAf","sourcesContent":["import type { NativeEventEmitter } from 'react-native';\nimport LiveStream from './LiveStream';\n\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 VideoPlayerConfiguration from './models/VideoPlayerConfiguration';\nimport FireworkSDKModule, {\n FireworkSDKModuleEventEmitter,\n} from './modules/FireworkSDKModule';\nimport LiveStreamModule from './modules/LiveStreamModule';\nimport ShoppingModule from './modules/ShoppingModule';\nimport VideoShopping from './VideoShopping';\nimport FWNavigator from './FWNavigator';\nimport FWLoggerUtil from './utils/FWLoggerUtil';\n\nexport type SDKInitCallback = (event: SDKInitEvent) => void;\nexport type CustomCTAClickCallback = (event: CustomCTAClickEvent) => void;\nexport type CustomCTALinkContentRender = (\n event: CustomCTAClickEvent\n) => React.ReactNode | null;\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 this._shareBaseURL = value;\n FireworkSDKModule.setShareBaseURL(value ?? '').then(() => {\n this.eventEmitter.emit(FWEventName.ShareBaseURLUpdated);\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 this._adBadgeConfiguration = value;\n FireworkSDKModule.setAdBadgeConfiguration(value ?? {}).then(() => {\n this.eventEmitter.emit(FWEventName.AdBadgeConfigurationUpdated);\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 VideoShopping.getInstance();\n }\n\n /**\n * Get LiveStream object.\n */\n public get liveStream(): LiveStream {\n return LiveStream.getInstance();\n }\n\n /**\n * Get FWNavigator object.\n */\n public get navigator(): FWNavigator {\n return FWNavigator.getInstance();\n }\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 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\nexport default FireworkSDK;\n"]}
1
+ {"version":3,"sources":["FireworkSDK.ts"],"names":["LiveStream","FWEventName","FireworkSDKModule","FireworkSDKModuleEventEmitter","LiveStreamModule","ShoppingModule","VideoShopping","FWNavigator","FWLoggerUtil","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"],"mappings":";;AACA,OAAOA,UAAP,MAAuB,cAAvB;AAGA,SAASC,WAAT,QAA4B,sBAA5B;AAQA,OAAOC,iBAAP,IACEC,6BADF,QAEO,6BAFP;AAGA,OAAOC,gBAAP,MAA6B,4BAA7B;AACA,OAAOC,cAAP,MAA2B,0BAA3B;AACA,OAAOC,aAAP,MAA0B,iBAA1B;AACA,OAAOC,WAAP,MAAwB,eAAxB;AACA,OAAOC,YAAP,MAAyB,sBAAzB;;AAUA;AACA;AACA;AACA,MAAMC,WAAN,CAAkB;AAGhB;AACF;AACA;;AAGE;AACF;AACA;;AAGE;AACF;AACA;AAC6B,MAAhBC,gBAAgB,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;AACA;AACA;;;AACSE,EAAAA,eAAe,CAACT,GAAD,EAAcU,MAAd,EAAiD;AACrEnE,IAAAA,iBAAiB,CAACkE,eAAlB,CAAkCT,GAAlC,EAAuCU,MAAvC,aAAuCA,MAAvC,cAAuCA,MAAvC,GAAiD,EAAjD;AACD;;AAjNe;;gBAAZ5D,W;;AAoNN,eAAeA,WAAf","sourcesContent":["import type { NativeEventEmitter } from 'react-native';\nimport LiveStream from './LiveStream';\n\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 VideoPlayerConfiguration from './models/VideoPlayerConfiguration';\nimport FireworkSDKModule, {\n FireworkSDKModuleEventEmitter,\n} from './modules/FireworkSDKModule';\nimport LiveStreamModule from './modules/LiveStreamModule';\nimport ShoppingModule from './modules/ShoppingModule';\nimport VideoShopping from './VideoShopping';\nimport FWNavigator from './FWNavigator';\nimport FWLoggerUtil from './utils/FWLoggerUtil';\n\nexport type SDKInitCallback = (event: SDKInitEvent) => void;\nexport type CustomCTAClickCallback = (event: CustomCTAClickEvent) => void;\nexport type CustomCTALinkContentRender = (\n event: CustomCTAClickEvent\n) => React.ReactNode | null;\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\nexport default FireworkSDK;\n"]}
@@ -2,6 +2,7 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
2
2
 
3
3
  import { FWEventName } from './models/FWEventName';
4
4
  import { LiveStreamModuleEventEmitter } from './modules/LiveStreamModule';
5
+ import FWLoggerUtil from './utils/FWLoggerUtil';
5
6
 
6
7
  /**
7
8
  * The entry class of live stream.
@@ -31,6 +32,7 @@ class LiveStream {
31
32
 
32
33
  _defineProperty(this, "onLiveStreamChatEvent", void 0);
33
34
 
35
+ FWLoggerUtil.log('LiveStream constructor');
34
36
  this.eventEmitter.addListener(FWEventName.LiveStream, event => {
35
37
  if (this.onLiveStreamEvent) {
36
38
  this.onLiveStreamEvent(event !== null && event !== void 0 ? event : {});
@@ -1 +1 @@
1
- {"version":3,"sources":["LiveStream.ts"],"names":["FWEventName","LiveStreamModuleEventEmitter","LiveStream","eventEmitter","getInstance","_instance","constructor","addListener","event","onLiveStreamEvent","LiveStreamChat","onLiveStreamChatEvent"],"mappings":";;AACA,SAASA,WAAT,QAA4B,sBAA5B;AAEA,SAASC,4BAAT,QAA6C,4BAA7C;;AAOA;AACA;AACA;AACA,MAAMC,UAAN,CAAiB;AAGf;AACF;AACA;;AAEE;AACF;AACA;AAG0B,MAAZC,YAAY,GAAuB;AAC7C,WAAOF,4BAAP;AACD;;AAEwB,SAAXG,WAAW,GAAG;AAC1B,QAAI,CAACF,UAAU,CAACG,SAAhB,EAA2B;AACzBH,MAAAA,UAAU,CAACG,SAAX,GAAuB,IAAIH,UAAJ,EAAvB;AACD;;AAED,WAAOA,UAAU,CAACG,SAAlB;AACD;;AAEOC,EAAAA,WAAW,GAAG;AAAA;;AAAA;;AACpB,SAAKH,YAAL,CAAkBI,WAAlB,CAA8BP,WAAW,CAACE,UAA1C,EAAuDM,KAAD,IAAW;AAC/D,UAAI,KAAKC,iBAAT,EAA4B;AAC1B,aAAKA,iBAAL,CAAuBD,KAAvB,aAAuBA,KAAvB,cAAuBA,KAAvB,GAAgC,EAAhC;AACD;AACF,KAJD;AAMA,SAAKL,YAAL,CAAkBI,WAAlB,CAA8BP,WAAW,CAACU,cAA1C,EAA2DF,KAAD,IAAW;AACnE,UAAI,KAAKG,qBAAT,EAAgC;AAC9B,aAAKA,qBAAL,CAA2BH,KAA3B,aAA2BA,KAA3B,cAA2BA,KAA3B,GAAoC,EAApC;AACD;AACF,KAJD;AAKD;;AApCc;;gBAAXN,U;;AAuCN,eAAeA,UAAf","sourcesContent":["import type { NativeEventEmitter } from 'react-native';\nimport { FWEventName } from './models/FWEventName';\nimport type { LiveStreamChatEvent, LiveStreamEvent } from './models/FWEvents';\nimport { LiveStreamModuleEventEmitter } from './modules/LiveStreamModule';\n\nexport type onLiveStreamEventCallback = (event: LiveStreamEvent) => void;\nexport type onLiveStreamChatEventCallback = (\n event: LiveStreamChatEvent\n) => void;\n\n/**\n * The entry class of live stream.\n */\nclass LiveStream {\n private static _instance?: LiveStream;\n\n /**\n * The callback of live stream event.\n */\n public onLiveStreamEvent?: onLiveStreamEventCallback;\n /**\n * The callback of live stream chat event.\n */\n public onLiveStreamChatEvent?: onLiveStreamChatEventCallback;\n\n private get eventEmitter(): NativeEventEmitter {\n return LiveStreamModuleEventEmitter;\n }\n\n public static getInstance() {\n if (!LiveStream._instance) {\n LiveStream._instance = new LiveStream();\n }\n\n return LiveStream._instance!;\n }\n\n private constructor() {\n this.eventEmitter.addListener(FWEventName.LiveStream, (event) => {\n if (this.onLiveStreamEvent) {\n this.onLiveStreamEvent(event ?? {});\n }\n });\n\n this.eventEmitter.addListener(FWEventName.LiveStreamChat, (event) => {\n if (this.onLiveStreamChatEvent) {\n this.onLiveStreamChatEvent(event ?? {});\n }\n });\n }\n}\n\nexport default LiveStream;\n"]}
1
+ {"version":3,"sources":["LiveStream.ts"],"names":["FWEventName","LiveStreamModuleEventEmitter","FWLoggerUtil","LiveStream","eventEmitter","getInstance","_instance","constructor","log","addListener","event","onLiveStreamEvent","LiveStreamChat","onLiveStreamChatEvent"],"mappings":";;AACA,SAASA,WAAT,QAA4B,sBAA5B;AAEA,SAASC,4BAAT,QAA6C,4BAA7C;AACA,OAAOC,YAAP,MAAyB,sBAAzB;;AAOA;AACA;AACA;AACA,MAAMC,UAAN,CAAiB;AAGf;AACF;AACA;;AAEE;AACF;AACA;AAG0B,MAAZC,YAAY,GAAuB;AAC7C,WAAOH,4BAAP;AACD;;AAEwB,SAAXI,WAAW,GAAG;AAC1B,QAAI,CAACF,UAAU,CAACG,SAAhB,EAA2B;AACzBH,MAAAA,UAAU,CAACG,SAAX,GAAuB,IAAIH,UAAJ,EAAvB;AACD;;AAED,WAAOA,UAAU,CAACG,SAAlB;AACD;;AAEOC,EAAAA,WAAW,GAAG;AAAA;;AAAA;;AACpBL,IAAAA,YAAY,CAACM,GAAb,CAAiB,wBAAjB;AACA,SAAKJ,YAAL,CAAkBK,WAAlB,CAA8BT,WAAW,CAACG,UAA1C,EAAuDO,KAAD,IAAW;AAC/D,UAAI,KAAKC,iBAAT,EAA4B;AAC1B,aAAKA,iBAAL,CAAuBD,KAAvB,aAAuBA,KAAvB,cAAuBA,KAAvB,GAAgC,EAAhC;AACD;AACF,KAJD;AAMA,SAAKN,YAAL,CAAkBK,WAAlB,CAA8BT,WAAW,CAACY,cAA1C,EAA2DF,KAAD,IAAW;AACnE,UAAI,KAAKG,qBAAT,EAAgC;AAC9B,aAAKA,qBAAL,CAA2BH,KAA3B,aAA2BA,KAA3B,cAA2BA,KAA3B,GAAoC,EAApC;AACD;AACF,KAJD;AAKD;;AArCc;;gBAAXP,U;;AAwCN,eAAeA,UAAf","sourcesContent":["import type { NativeEventEmitter } from 'react-native';\nimport { FWEventName } from './models/FWEventName';\nimport type { LiveStreamChatEvent, LiveStreamEvent } from './models/FWEvents';\nimport { LiveStreamModuleEventEmitter } from './modules/LiveStreamModule';\nimport FWLoggerUtil from './utils/FWLoggerUtil';\n\nexport type onLiveStreamEventCallback = (event: LiveStreamEvent) => void;\nexport type onLiveStreamChatEventCallback = (\n event: LiveStreamChatEvent\n) => void;\n\n/**\n * The entry class of live stream.\n */\nclass LiveStream {\n private static _instance?: LiveStream;\n\n /**\n * The callback of live stream event.\n */\n public onLiveStreamEvent?: onLiveStreamEventCallback;\n /**\n * The callback of live stream chat event.\n */\n public onLiveStreamChatEvent?: onLiveStreamChatEventCallback;\n\n private get eventEmitter(): NativeEventEmitter {\n return LiveStreamModuleEventEmitter;\n }\n\n public static getInstance() {\n if (!LiveStream._instance) {\n LiveStream._instance = new LiveStream();\n }\n\n return LiveStream._instance!;\n }\n\n private constructor() {\n FWLoggerUtil.log('LiveStream constructor');\n this.eventEmitter.addListener(FWEventName.LiveStream, (event) => {\n if (this.onLiveStreamEvent) {\n this.onLiveStreamEvent(event ?? {});\n }\n });\n\n this.eventEmitter.addListener(FWEventName.LiveStreamChat, (event) => {\n if (this.onLiveStreamChatEvent) {\n this.onLiveStreamChatEvent(event ?? {});\n }\n });\n }\n}\n\nexport default LiveStream;\n"]}
@@ -60,6 +60,8 @@ class VideoShopping {
60
60
  }
61
61
 
62
62
  static getInstance() {
63
+ FWLoggerUtil.log('VideoShopping constructor');
64
+
63
65
  if (!VideoShopping._instance) {
64
66
  VideoShopping._instance = new VideoShopping();
65
67
  }
@@ -81,9 +83,11 @@ class VideoShopping {
81
83
  _defineProperty(this, "_cartIconVisible", true);
82
84
 
83
85
  this.eventEmitter.addListener(FWEventName.AddToCart, event => {
86
+ FWLoggerUtil.log(`Receive AddToCart event productId: ${event.productId} unitId: ${event.unitId}`);
84
87
  this.handleAddToCartEvent(event);
85
88
  });
86
89
  this.eventEmitter.addListener(FWEventName.ClickCartIcon, event => {
90
+ FWLoggerUtil.log('Receive ClickCartIcon event');
87
91
  this.handleClickCartIconEvent(event);
88
92
  });
89
93
  this.eventEmitter.addListener(FWEventName.UpdateProductDetails, event => {
@@ -91,8 +95,10 @@ class VideoShopping {
91
95
  this.handleUpdateProductDetailsEvent(event);
92
96
  });
93
97
  this.eventEmitter.addListener(FWEventName.WillDisplayProduct, event => {
98
+ FWLoggerUtil.log(`Receive WillDisplayProduct event videoId: ${event.videoId}`);
94
99
  this.handleWillDisplayProductEvent(event);
95
100
  });
101
+ this.eventEmitter.addListener(FWEventName.LogMessage, () => {});
96
102
  }
97
103
  /**
98
104
  *
@@ -171,6 +177,8 @@ class VideoShopping {
171
177
  }
172
178
  }
173
179
  } else {
180
+ FWLoggerUtil.log('onUpdateProductDetails callback is not set.');
181
+
174
182
  if (callbackId) {
175
183
  if (Platform.OS === 'ios') {
176
184
  ShoppingModule.clearCallbackId(callbackId, FWEventName.UpdateProductDetails);
@@ -1 +1 @@
1
- {"version":3,"sources":["VideoShopping.ts"],"names":["Platform","FWEventName","ShoppingModule","ShoppingModuleEventEmitter","FWLoggerUtil","VideoShopping","onCustomClickCartIcon","_onCustomClickCartIcon","value","OS","setCustomClickCartIconEnabled","cartIconVisible","_cartIconVisible","setCartIconVisible","eventEmitter","getInstance","_instance","constructor","addListener","AddToCart","event","handleAddToCartEvent","ClickCartIcon","handleClickCartIconEvent","UpdateProductDetails","log","productIds","handleUpdateProductDetailsEvent","WillDisplayProduct","handleWillDisplayProductEvent","setCartItemCount","count","callbackId","onAddToCart","result","updateAddToCartStatus","res","tips","clearCallbackId","onClickCartIcon","props","jumpToCartPage","onUpdateProductDetails","productList","map","product","productId","length","updateVideoProducts","onWillDisplayProduct","config","updateProductViewConfig"],"mappings":";;AAAA,SAA6BA,QAA7B,QAA6C,cAA7C;AAQA,SAASC,WAAT,QAA4B,sBAA5B;AAGA,OAAOC,cAAP,IACEC,0BADF,QAEO,0BAFP;AAIA,OAAOC,YAAP,MAAyB,sBAAzB;;AAsBA;AACA;AACA;AACA,MAAMC,aAAN,CAAoB;AAGlB;AACF;AACA;AACA;AACA;;AAGE;AACF;AACA;AACA;AACA;;AAGE;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACkC,MAArBC,qBAAqB,GAA4C;AAC1E,WAAO,KAAKC,sBAAZ;AACD;;AAC+B,MAArBD,qBAAqB,CAC9BE,KAD8B,EAE9B;AACA,SAAKD,sBAAL,GAA8BC,KAA9B;;AACA,QAAIR,QAAQ,CAACS,EAAT,KAAgB,KAApB,EAA2B;AACzBP,MAAAA,cAAc,CAACQ,6BAAf,CAA6C,CAAC,CAACF,KAA/C;AACD;AACF;;AAiBD;AACF;AACA;AAC4B,MAAfG,eAAe,GAAY;AACpC,WAAO,KAAKC,gBAAZ;AACD;;AACyB,MAAfD,eAAe,CAACH,KAAD,EAAiB;AACzC,SAAKI,gBAAL,GAAwBJ,KAAxB;AACAN,IAAAA,cAAc,CAACW,kBAAf,CAAkCL,KAAlC;AACD;;AAGuB,MAAZM,YAAY,GAAuB;AAC7C,WAAOX,0BAAP;AACD;;AAEwB,SAAXY,WAAW,GAAG;AAC1B,QAAI,CAACV,aAAa,CAACW,SAAnB,EAA8B;AAC5BX,MAAAA,aAAa,CAACW,SAAd,GAA0B,IAAIX,aAAJ,EAA1B;AACD;;AAED,WAAOA,aAAa,CAACW,SAArB;AACD;;AAEOC,EAAAA,WAAW,GAAG;AAAA;;AAAA;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,GAAb,CACG,+DAA8DC,UAAW,uBACxE,CAACiB,WAAW,IAAI,EAAhB,EAAoBI,MACrB,EAHH;;AAMA,UAAIJ,WAAJ,EAAiB;AACf,YAAIX,UAAJ,EAAgB;AACd9B,UAAAA,cAAc,CAAC8C,mBAAf,CAAmCL,WAAnC,EAAgDX,UAAhD;AACD;AACF,OAJD,MAIO;AACL,YAAIA,UAAJ,EAAgB;AACd,cAAIhC,QAAQ,CAACS,EAAT,KAAgB,KAApB,EAA2B;AACzBP,YAAAA,cAAc,CAACoC,eAAf,CACEN,UADF,EAEE/B,WAAW,CAACuB,oBAFd;AAID;AACF;AACF;AACF,KAhCD,MAgCO;AACL,UAAIQ,UAAJ,EAAgB;AACd,YAAIhC,QAAQ,CAACS,EAAT,KAAgB,KAApB,EAA2B;AACzBP,UAAAA,cAAc,CAACoC,eAAf,CACEN,UADF,EAEE/B,WAAW,CAACuB,oBAFd;AAID;AACF;AACF;AACF;;AAE0C,QAA7BK,6BAA6B,CACzCT,KADyC,EAEzC;AACA,QAAI,KAAK6B,oBAAT,EAA+B;AAC7B,YAAMjB,UAAU,GAAGZ,KAAK,CAACY,UAAzB;AACA,aAAOZ,KAAK,CAACY,UAAb;AACA,YAAMkB,MAAM,GAAG,MAAM,KAAKD,oBAAL,CACnB7B,KADmB,CAArB;;AAGA,UAAI8B,MAAM,IAAIlB,UAAd,EAA0B;AACxB9B,QAAAA,cAAc,CAACiD,uBAAf,CAAuCD,MAAvC,EAA+ClB,UAA/C;AACD;AACF;AACF;;AAnNiB;;gBAAd3B,a;;AAsNN,eAAeA,aAAf","sourcesContent":["import { NativeEventEmitter, Platform } from 'react-native';\n\nimport type AddToCartResult from './models/AddToCartResult';\nimport type {\n AddToCartEvent,\n UpdateProductDetailsEvent,\n WillDisplayProductEvent,\n} from './models/FWEvents';\nimport { FWEventName } from './models/FWEventName';\nimport type Product from './models/Product';\nimport type ProductInfoViewConfiguration from './models/ProductInfoViewConfiguration';\nimport ShoppingModule, {\n ShoppingModuleEventEmitter,\n} from './modules/ShoppingModule';\nimport type { NewNativeContainerProps } from './models/NewNativeContainerProps';\nimport FWLoggerUtil from './utils/FWLoggerUtil';\n\nexport type AddToCartCallback = (\n event: AddToCartEvent\n) => Promise<AddToCartResult | undefined | null>;\n\nexport type ClickCartIconCallback = () => Promise<\n NewNativeContainerProps | undefined | null\n>;\n\nexport type CustomClickCartIconCallback = () => Promise<void>;\n\nexport type UpdateProductDetailsCallback = (\n event: UpdateProductDetailsEvent\n) => Promise<Product[] | undefined | null>;\n\nexport type WillDisplayProductCallback = (\n event: WillDisplayProductEvent\n) => Promise<ProductInfoViewConfiguration | undefined | null>;\n\ntype CallbackInfo = { callbackId?: number | string };\n\n/**\n * The entry class of video shopping.\n */\nclass VideoShopping {\n private static _instance?: VideoShopping;\n\n /**\n * This callback is triggered when the user clicks the \"Add to cart\" button.\n *\n * The host app can return an AddToCartResult object to tell FireworkSDK the result of adding to cart.\n */\n public onAddToCart?: AddToCartCallback;\n\n /**\n * This callback is triggered when the user clicks the shopping cart icon.\n *\n * The host app can return NewNativeContainerProps object and we will push a new native container with the props.\n */\n public onClickCartIcon?: ClickCartIconCallback;\n\n /**\n * This callback is triggered when the user clicks the shopping cart icon.\n *\n * The host app can customize the processing logic of clicking the shopping cart icon by setting the callback.\n * In the callack, you could call FireworkSDK.getInstance().navigator.popNativeContainer to close the player\n * and call navigation.navigate to push the RN cart page.\n * Currently, there is a limitation on the iOS side when you set the callback.\n * That is, if you set the callback, you need to call FireworkSDK.getInstance().navigator.popNativeContainer in the callback.\n * Otherwise there will be bugs on the iOS side.\n */\n public get onCustomClickCartIcon(): CustomClickCartIconCallback | undefined {\n return this._onCustomClickCartIcon;\n }\n public set onCustomClickCartIcon(\n value: CustomClickCartIconCallback | undefined\n ) {\n this._onCustomClickCartIcon = value;\n if (Platform.OS === 'ios') {\n ShoppingModule.setCustomClickCartIconEnabled(!!value);\n }\n }\n private _onCustomClickCartIcon?: CustomClickCartIconCallback | undefined;\n\n /**\n * This callback is triggered when the video will be shown.\n *\n * The host app can return a Product list to update the latest product information.\n */\n public onUpdateProductDetails?: UpdateProductDetailsCallback;\n\n /**\n * This callback is triggered when the product will be shown.\n *\n * The host app can return a ProductInfoViewConfiguration object to configure \"Add to cart\" button style and cart icon style.\n */\n public onWillDisplayProduct?: WillDisplayProductCallback;\n\n /**\n * Defaults to true. You can hide the cart icon by setting this property to false.\n */\n public get cartIconVisible(): boolean {\n return this._cartIconVisible;\n }\n public set cartIconVisible(value: boolean) {\n this._cartIconVisible = value;\n ShoppingModule.setCartIconVisible(value);\n }\n private _cartIconVisible: boolean = true;\n\n private get eventEmitter(): NativeEventEmitter {\n return ShoppingModuleEventEmitter;\n }\n\n public static getInstance() {\n if (!VideoShopping._instance) {\n VideoShopping._instance = new VideoShopping();\n }\n\n return VideoShopping._instance!;\n }\n\n private constructor() {\n this.eventEmitter.addListener(FWEventName.AddToCart, (event) => {\n this.handleAddToCartEvent(event);\n });\n\n this.eventEmitter.addListener(FWEventName.ClickCartIcon, (event) => {\n this.handleClickCartIconEvent(event);\n });\n\n this.eventEmitter.addListener(FWEventName.UpdateProductDetails, (event) => {\n FWLoggerUtil.log(\n `Receive UpdateProductDetails event productIds: ${event.productIds}`\n );\n this.handleUpdateProductDetailsEvent(event);\n });\n\n this.eventEmitter.addListener(FWEventName.WillDisplayProduct, (event) => {\n this.handleWillDisplayProductEvent(event);\n });\n }\n\n /**\n *\n * @param {number} count The number of items in the host app cart\n */\n public setCartItemCount(count: number) {\n ShoppingModule.setCartItemCount(count);\n }\n\n private async handleAddToCartEvent(event: AddToCartEvent & CallbackInfo) {\n const callbackId = event.callbackId;\n delete event.callbackId;\n if (this.onAddToCart) {\n const result = await this.onAddToCart(event as AddToCartEvent);\n if (result) {\n if (callbackId) {\n ShoppingModule.updateAddToCartStatus(\n result.res,\n result.tips,\n callbackId\n );\n }\n } else {\n if (callbackId) {\n if (Platform.OS === 'ios') {\n ShoppingModule.clearCallbackId(callbackId, FWEventName.AddToCart);\n }\n }\n }\n } else {\n if (callbackId) {\n if (Platform.OS === 'ios') {\n ShoppingModule.clearCallbackId(callbackId, FWEventName.AddToCart);\n }\n }\n }\n }\n\n private async handleClickCartIconEvent(event: CallbackInfo) {\n if (this.onCustomClickCartIcon) {\n this.onCustomClickCartIcon();\n } else if (this.onClickCartIcon) {\n const callbackId = event.callbackId;\n delete event.callbackId;\n const props = await this.onClickCartIcon();\n if (callbackId) {\n ShoppingModule.jumpToCartPage(callbackId, props ?? {});\n }\n }\n }\n\n private async handleUpdateProductDetailsEvent(\n event: UpdateProductDetailsEvent & CallbackInfo\n ) {\n const callbackId = event.callbackId;\n delete event.callbackId;\n if (this.onUpdateProductDetails) {\n FWLoggerUtil.log(\n `Call onUpdateProductDetails callback productIds: ${event.productIds} callbackId: ${callbackId}`\n );\n const productList = await this.onUpdateProductDetails(\n event as UpdateProductDetailsEvent\n );\n\n const productIds = (productList || []).map(\n (product) => product.productId ?? ''\n );\n\n FWLoggerUtil.log(\n `Get result from onUpdateProductDetails callback productIds: ${productIds} productListLength: ${\n (productList || []).length\n }`\n );\n\n if (productList) {\n if (callbackId) {\n ShoppingModule.updateVideoProducts(productList, callbackId);\n }\n } else {\n if (callbackId) {\n if (Platform.OS === 'ios') {\n ShoppingModule.clearCallbackId(\n callbackId,\n FWEventName.UpdateProductDetails\n );\n }\n }\n }\n } else {\n if (callbackId) {\n if (Platform.OS === 'ios') {\n ShoppingModule.clearCallbackId(\n callbackId,\n FWEventName.UpdateProductDetails\n );\n }\n }\n }\n }\n\n private async handleWillDisplayProductEvent(\n event: WillDisplayProductEvent & CallbackInfo\n ) {\n if (this.onWillDisplayProduct) {\n const callbackId = event.callbackId;\n delete event.callbackId;\n const config = await this.onWillDisplayProduct(\n event as WillDisplayProductEvent\n );\n if (config && callbackId) {\n ShoppingModule.updateProductViewConfig(config, callbackId);\n }\n }\n }\n}\n\nexport default VideoShopping;\n"]}
1
+ {"version":3,"sources":["VideoShopping.ts"],"names":["Platform","FWEventName","ShoppingModule","ShoppingModuleEventEmitter","FWLoggerUtil","VideoShopping","onCustomClickCartIcon","_onCustomClickCartIcon","value","OS","setCustomClickCartIconEnabled","cartIconVisible","_cartIconVisible","setCartIconVisible","eventEmitter","getInstance","log","_instance","constructor","addListener","AddToCart","event","productId","unitId","handleAddToCartEvent","ClickCartIcon","handleClickCartIconEvent","UpdateProductDetails","productIds","handleUpdateProductDetailsEvent","WillDisplayProduct","videoId","handleWillDisplayProductEvent","LogMessage","setCartItemCount","count","callbackId","onAddToCart","result","updateAddToCartStatus","res","tips","clearCallbackId","onClickCartIcon","props","jumpToCartPage","onUpdateProductDetails","productList","map","product","length","updateVideoProducts","onWillDisplayProduct","config","updateProductViewConfig"],"mappings":";;AAAA,SAA6BA,QAA7B,QAA6C,cAA7C;AAQA,SAASC,WAAT,QAA4B,sBAA5B;AAGA,OAAOC,cAAP,IACEC,0BADF,QAEO,0BAFP;AAIA,OAAOC,YAAP,MAAyB,sBAAzB;;AAsBA;AACA;AACA;AACA,MAAMC,aAAN,CAAoB;AAGlB;AACF;AACA;AACA;AACA;;AAGE;AACF;AACA;AACA;AACA;;AAGE;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACkC,MAArBC,qBAAqB,GAA4C;AAC1E,WAAO,KAAKC,sBAAZ;AACD;;AAC+B,MAArBD,qBAAqB,CAC9BE,KAD8B,EAE9B;AACA,SAAKD,sBAAL,GAA8BC,KAA9B;;AACA,QAAIR,QAAQ,CAACS,EAAT,KAAgB,KAApB,EAA2B;AACzBP,MAAAA,cAAc,CAACQ,6BAAf,CAA6C,CAAC,CAACF,KAA/C;AACD;AACF;;AAiBD;AACF;AACA;AAC4B,MAAfG,eAAe,GAAY;AACpC,WAAO,KAAKC,gBAAZ;AACD;;AACyB,MAAfD,eAAe,CAACH,KAAD,EAAiB;AACzC,SAAKI,gBAAL,GAAwBJ,KAAxB;AACAN,IAAAA,cAAc,CAACW,kBAAf,CAAkCL,KAAlC;A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AW,CAAC0B,oBAFd;AAID;AACF;AACF;AACF;;AAE0C,QAA7BK,6BAA6B,CACzCX,KADyC,EAEzC;AACA,QAAI,KAAK+B,oBAAT,EAA+B;AAC7B,YAAMhB,UAAU,GAAGf,KAAK,CAACe,UAAzB;AACA,aAAOf,KAAK,CAACe,UAAb;AACA,YAAMiB,MAAM,GAAG,MAAM,KAAKD,oBAAL,CACnB/B,KADmB,CAArB;;AAGA,UAAIgC,MAAM,IAAIjB,UAAd,EAA0B;AACxBlC,QAAAA,cAAc,CAACoD,uBAAf,CAAuCD,MAAvC,EAA+CjB,UAA/C;AACD;AACF;AACF;;AA7NiB;;gBAAd/B,a;;AAgON,eAAeA,aAAf","sourcesContent":["import { NativeEventEmitter, Platform } from 'react-native';\n\nimport type AddToCartResult from './models/AddToCartResult';\nimport type {\n AddToCartEvent,\n UpdateProductDetailsEvent,\n WillDisplayProductEvent,\n} from './models/FWEvents';\nimport { FWEventName } from './models/FWEventName';\nimport type Product from './models/Product';\nimport type ProductInfoViewConfiguration from './models/ProductInfoViewConfiguration';\nimport ShoppingModule, {\n ShoppingModuleEventEmitter,\n} from './modules/ShoppingModule';\nimport type { NewNativeContainerProps } from './models/NewNativeContainerProps';\nimport FWLoggerUtil from './utils/FWLoggerUtil';\n\nexport type AddToCartCallback = (\n event: AddToCartEvent\n) => Promise<AddToCartResult | undefined | null>;\n\nexport type ClickCartIconCallback = () => Promise<\n NewNativeContainerProps | undefined | null\n>;\n\nexport type CustomClickCartIconCallback = () => Promise<void>;\n\nexport type UpdateProductDetailsCallback = (\n event: UpdateProductDetailsEvent\n) => Promise<Product[] | undefined | null>;\n\nexport type WillDisplayProductCallback = (\n event: WillDisplayProductEvent\n) => Promise<ProductInfoViewConfiguration | undefined | null>;\n\ntype CallbackInfo = { callbackId?: number | string };\n\n/**\n * The entry class of video shopping.\n */\nclass VideoShopping {\n private static _instance?: VideoShopping;\n\n /**\n * This callback is triggered when the user clicks the \"Add to cart\" button.\n *\n * The host app can return an AddToCartResult object to tell FireworkSDK the result of adding to cart.\n */\n public onAddToCart?: AddToCartCallback;\n\n /**\n * This callback is triggered when the user clicks the shopping cart icon.\n *\n * The host app can return NewNativeContainerProps object and we will push a new native container with the props.\n */\n public onClickCartIcon?: ClickCartIconCallback;\n\n /**\n * This callback is triggered when the user clicks the shopping cart icon.\n *\n * The host app can customize the processing logic of clicking the shopping cart icon by setting the callback.\n * In the callack, you could call FireworkSDK.getInstance().navigator.popNativeContainer to close the player\n * and call navigation.navigate to push the RN cart page.\n * Currently, there is a limitation on the iOS side when you set the callback.\n * That is, if you set the callback, you need to call FireworkSDK.getInstance().navigator.popNativeContainer in the callback.\n * Otherwise there will be bugs on the iOS side.\n */\n public get onCustomClickCartIcon(): CustomClickCartIconCallback | undefined {\n return this._onCustomClickCartIcon;\n }\n public set onCustomClickCartIcon(\n value: CustomClickCartIconCallback | undefined\n ) {\n this._onCustomClickCartIcon = value;\n if (Platform.OS === 'ios') {\n ShoppingModule.setCustomClickCartIconEnabled(!!value);\n }\n }\n private _onCustomClickCartIcon?: CustomClickCartIconCallback | undefined;\n\n /**\n * This callback is triggered when the video will be shown.\n *\n * The host app can return a Product list to update the latest product information.\n */\n public onUpdateProductDetails?: UpdateProductDetailsCallback;\n\n /**\n * This callback is triggered when the product will be shown.\n *\n * The host app can return a ProductInfoViewConfiguration object to configure \"Add to cart\" button style and cart icon style.\n */\n public onWillDisplayProduct?: WillDisplayProductCallback;\n\n /**\n * Defaults to true. You can hide the cart icon by setting this property to false.\n */\n public get cartIconVisible(): boolean {\n return this._cartIconVisible;\n }\n public set cartIconVisible(value: boolean) {\n this._cartIconVisible = value;\n ShoppingModule.setCartIconVisible(value);\n }\n private _cartIconVisible: boolean = true;\n\n private get eventEmitter(): NativeEventEmitter {\n return ShoppingModuleEventEmitter;\n }\n\n public static getInstance() {\n FWLoggerUtil.log('VideoShopping constructor');\n if (!VideoShopping._instance) {\n VideoShopping._instance = new VideoShopping();\n }\n\n return VideoShopping._instance!;\n }\n\n private constructor() {\n this.eventEmitter.addListener(FWEventName.AddToCart, (event) => {\n FWLoggerUtil.log(\n `Receive AddToCart event productId: ${event.productId} unitId: ${event.unitId}`\n );\n this.handleAddToCartEvent(event);\n });\n\n this.eventEmitter.addListener(FWEventName.ClickCartIcon, (event) => {\n FWLoggerUtil.log('Receive ClickCartIcon event');\n this.handleClickCartIconEvent(event);\n });\n\n this.eventEmitter.addListener(FWEventName.UpdateProductDetails, (event) => {\n FWLoggerUtil.log(\n `Receive UpdateProductDetails event productIds: ${event.productIds}`\n );\n this.handleUpdateProductDetailsEvent(event);\n });\n\n this.eventEmitter.addListener(FWEventName.WillDisplayProduct, (event) => {\n FWLoggerUtil.log(\n `Receive WillDisplayProduct event videoId: ${event.videoId}`\n );\n this.handleWillDisplayProductEvent(event);\n });\n this.eventEmitter.addListener(FWEventName.LogMessage, () => {});\n }\n\n /**\n *\n * @param {number} count The number of items in the host app cart\n */\n public setCartItemCount(count: number) {\n ShoppingModule.setCartItemCount(count);\n }\n\n private async handleAddToCartEvent(event: AddToCartEvent & CallbackInfo) {\n const callbackId = event.callbackId;\n delete event.callbackId;\n if (this.onAddToCart) {\n const result = await this.onAddToCart(event as AddToCartEvent);\n if (result) {\n if (callbackId) {\n ShoppingModule.updateAddToCartStatus(\n result.res,\n result.tips,\n callbackId\n );\n }\n } else {\n if (callbackId) {\n if (Platform.OS === 'ios') {\n ShoppingModule.clearCallbackId(callbackId, FWEventName.AddToCart);\n }\n }\n }\n } else {\n if (callbackId) {\n if (Platform.OS === 'ios') {\n ShoppingModule.clearCallbackId(callbackId, FWEventName.AddToCart);\n }\n }\n }\n }\n\n private async handleClickCartIconEvent(event: CallbackInfo) {\n if (this.onCustomClickCartIcon) {\n this.onCustomClickCartIcon();\n } else if (this.onClickCartIcon) {\n const callbackId = event.callbackId;\n delete event.callbackId;\n const props = await this.onClickCartIcon();\n if (callbackId) {\n ShoppingModule.jumpToCartPage(callbackId, props ?? {});\n }\n }\n }\n\n private async handleUpdateProductDetailsEvent(\n event: UpdateProductDetailsEvent & CallbackInfo\n ) {\n const callbackId = event.callbackId;\n delete event.callbackId;\n if (this.onUpdateProductDetails) {\n FWLoggerUtil.log(\n `Call onUpdateProductDetails callback productIds: ${event.productIds} callbackId: ${callbackId}`\n );\n const productList = await this.onUpdateProductDetails(\n event as UpdateProductDetailsEvent\n );\n\n const productIds = (productList || []).map(\n (product) => product.productId ?? ''\n );\n\n FWLoggerUtil.log(\n `Get result from onUpdateProductDetails callback productIds: ${productIds} productListLength: ${\n (productList || []).length\n }`\n );\n\n if (productList) {\n if (callbackId) {\n ShoppingModule.updateVideoProducts(productList, callbackId);\n }\n } else {\n if (callbackId) {\n if (Platform.OS === 'ios') {\n ShoppingModule.clearCallbackId(\n callbackId,\n FWEventName.UpdateProductDetails\n );\n }\n }\n }\n } else {\n FWLoggerUtil.log('onUpdateProductDetails callback is not set.');\n if (callbackId) {\n if (Platform.OS === 'ios') {\n ShoppingModule.clearCallbackId(\n callbackId,\n FWEventName.UpdateProductDetails\n );\n }\n }\n }\n }\n\n private async handleWillDisplayProductEvent(\n event: WillDisplayProductEvent & CallbackInfo\n ) {\n if (this.onWillDisplayProduct) {\n const callbackId = event.callbackId;\n delete event.callbackId;\n const config = await this.onWillDisplayProduct(\n event as WillDisplayProductEvent\n );\n if (config && callbackId) {\n ShoppingModule.updateProductViewConfig(config, callbackId);\n }\n }\n }\n}\n\nexport default VideoShopping;\n"]}
@@ -4,6 +4,7 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
4
4
 
5
5
  import React from 'react';
6
6
  import { findNodeHandle, UIManager } from 'react-native';
7
+ import FWLoggerUtil from '../utils/FWLoggerUtil';
7
8
  import FireworkSDK from '../FireworkSDK';
8
9
  import { FWEventName } from '../models/FWEventName';
9
10
  import { FireworkSDKModuleEventEmitter } from '../modules/FireworkSDKModule';
@@ -18,11 +19,13 @@ export default class VideoFeed extends React.Component {
18
19
  _defineProperty(this, "subscriptions", []);
19
20
 
20
21
  _defineProperty(this, "refresh", () => {
22
+ FWLoggerUtil.log(`VideoFeed refresh ${JSON.stringify(this.props)}`);
21
23
  const nativeNodeHandle = findNodeHandle(this.nativeComponentRef.current);
22
24
  UIManager.dispatchViewManagerCommand(findNodeHandle(nativeNodeHandle), UIManager.getViewManagerConfig(NativeComponentName).Commands.refresh, []);
23
25
  });
24
26
 
25
27
  _defineProperty(this, "_onVideoFeedLoadFinished", event => {
28
+ FWLoggerUtil.log(`VideoFeed _onVideoFeedLoadFinished ${JSON.stringify(event.nativeEvent)}`);
26
29
  const {
27
30
  name,
28
31
  reason
@@ -42,17 +45,21 @@ export default class VideoFeed extends React.Component {
42
45
  }
43
46
 
44
47
  componentDidMount() {
48
+ FWLoggerUtil.log(`VideoFeed componentDidMount ${JSON.stringify(this.props)}`);
45
49
  const subscriptionOfShareBaseURLUpdated = FireworkSDKModuleEventEmitter.addListener(FWEventName.ShareBaseURLUpdated, () => {
50
+ FWLoggerUtil.log('Receive FWEventName.ShareBaseURLUpdated');
46
51
  this.setState({});
47
52
  });
48
53
  this.subscriptions.push(subscriptionOfShareBaseURLUpdated);
49
54
  const subscriptionOfAdBadgeConfigurationUpdated = FireworkSDKModuleEventEmitter.addListener(FWEventName.AdBadgeConfigurationUpdated, () => {
55
+ FWLoggerUtil.log('Receive FWEventName.AdBadgeConfigurationUpdated');
50
56
  this.setState({});
51
57
  });
52
58
  this.subscriptions.push(subscriptionOfAdBadgeConfigurationUpdated);
53
59
  }
54
60
 
55
61
  componentWillUnmount() {
62
+ FWLoggerUtil.log(`VideoFeed componentWillUnmount ${JSON.stringify(this.props)}`);
56
63
  this.subscriptions.forEach(value => {
57
64
  value.remove();
58
65
  });
@@ -62,6 +69,7 @@ export default class VideoFeed extends React.Component {
62
69
  render() {
63
70
  var _videoFeedConfigurati, _videoFeedConfigurati2, _videoFeedConfigurati3, _videoFeedConfigurati4, _FireworkSDK$getInsta, _FireworkSDK$getInsta2, _adBadgeConfiguration, _adBadgeConfiguration2, _adBadgeConfiguration3, _videoFeedConfigurati5, _videoFeedConfigurati6;
64
71
 
72
+ FWLoggerUtil.log(`VideoFeed render ${JSON.stringify(this.props)}`);
65
73
  const {
66
74
  source,
67
75
  channel = '',
@@ -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","_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,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,2CA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CAAYH,wBAAZ,EAAsCI,IAAtC,EAAtB;;AACA,SAAK,MAAMV,GAAX,IAAkBQ,aAAlB,EAAiC;AAC/B,YAAMpC,KAAK,GAAGkC,wBAAwB,CAACN,GAAD,CAAtC;AACA,YAAMW,WAAW,GAAGvC,KAAK,CAACwC,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;;AAEO1B,EAAAA,0BAA0B,GAAuC;AACvE,UAAM;AAAED,MAAAA;AAAF,QAA6B,KAAKrB,KAAxC;;AACA,QAAI,CAACqB,sBAAL,EAA6B;AAC3B,aAAOkC,SAAP;AACD;;AAED,QAAIC,uBAA+C,GAAG,EACpD,GAAGnC;AADiD,KAAtD;;AAGA,QAAImC,uBAAuB,CAAChB,WAA5B,EAAyC;AACvCgB,MAAAA,uBAAuB,CAAChB,WAAxB,GAAsCiB,IAAI,CAACC,KAAL,CACpCF,uBAAuB,CAAChB,WADY,CAAtC;AAGD;;AACD,WAAOgB,uBAAP;AACD;;AAtJqE;;gBAAnDtE,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 } = 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"]}
1
+ {"version":3,"sources":["VideoFeed.tsx"],"names":["React","findNodeHandle","UIManager","FWLoggerUtil","FireworkSDK","FWEventName","FireworkSDKModuleEventEmitter","FWVideoFeed","NativeComponentName","VideoFeed","Component","createRef","log","JSON","stringify","props","nativeNodeHandle","nativeComponentRef","current","dispatchViewManagerCommand","getViewManagerConfig","Commands","refresh","event","nativeEvent","name","reason","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,KAAP,MAAkB,OAAlB;AAGA,SAEEC,cAFF,EAIEC,SAJF,QAMO,cANP;AAOA,OAAOC,YAAP,MAAyB,uBAAzB;AAEA,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,SAAwBT,KAAK,CAACU,SAA9B,CAAyD;AAAA;AAAA;;AAAA,6DAKjDV,KAAK,CAACW,SAAN,EALiD;;AAAA,2CAO/B,EAP+B;;AAAA,qCAYrD,MAAM;AACrBR,MAAAA,YAAY,CAACS,GAAb,CAAkB,qBAAoBC,IAAI,CAACC,SAAL,CAAe,KAAKC,KAApB,CAA2B,EAAjE;AAEA,YAAMC,gBAAgB,GAAGf,cAAc,CAAC,KAAKgB,kBAAL,CAAwBC,OAAzB,CAAvC;AAEAhB,MAAAA,SAAS,CAACiB,0BAAV,CACElB,cAAc,CAACe,gBAAD,CADhB,EAEEd,SAAS,CAACkB,oBAAV,CAA+BZ,mBAA/B,EAAoDa,QAApD,CAA6DC,OAF/D,EAGE,EAHF;AAKD,KAtBqE;;AAAA,sDAyBpEC,KADiC,IAE9B;AACHpB,MAAAA,YAAY,CAACS,GAAb,CACG,sCAAqCC,IAAI,CAACC,SAAL,CAAeS,KAAK,CAACC,WAArB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L,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,YAAMpC,KAAK,GAAGkC,wBAAwB,CAACN,GAAD,CAAtC;AACA,YAAMW,WAAW,GAAGvC,KAAK,CAACwC,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;;AAEO1B,EAAAA,0BAA0B,GAAuC;AACvE,UAAM;AAAED,MAAAA;AAAF,QAA6B,KAAKhC,KAAxC;;AACA,QAAI,CAACgC,sBAAL,EAA6B;AAC3B,aAAOkC,SAAP;AACD;;AAED,QAAIC,uBAA+C,GAAG,EACpD,GAAGnC;AADiD,KAAtD;;AAGA,QAAImC,uBAAuB,CAAChB,WAA5B,EAAyC;AACvCgB,MAAAA,uBAAuB,CAAChB,WAAxB,GAAsCiB,IAAI,CAACC,KAAL,CACpCF,uBAAuB,CAAChB,WADY,CAAtC;AAGD;;AACD,WAAOgB,uBAAP;AACD;;AAzKqE;;gBAAnDzE,S,kBACG;AACpBqC,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';\nimport FWLoggerUtil from '../utils/FWLoggerUtil';\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 FWLoggerUtil.log(`VideoFeed refresh ${JSON.stringify(this.props)}`);\n\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 FWLoggerUtil.log(\n `VideoFeed _onVideoFeedLoadFinished ${JSON.stringify(event.nativeEvent)}`\n );\n\n const { name, reason } = event.nativeEvent;\n\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 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 } = 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"]}
@@ -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;AAiCA,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 clearCallbackId(callbackId: number | string, eventName: string): void; // Only supported on iOS\n}\n\nconst ShoppingModuleEventEmitter = new NativeEventEmitter(ShoppingModule);\nexport { ShoppingModuleEventEmitter };\n\nexport default ShoppingModule as IShoppingModule;\n"]}
1
+ {"version":3,"sources":["ShoppingModule.ts"],"names":["NativeEventEmitter","NativeModules","LINKING_ERROR","ShoppingModule","Proxy","get","Error","ShoppingModuleEventEmitter"],"mappings":"AAAA,SAASA,kBAAT,EAA2CC,aAA3C,QAAgE,cAAhE;AAEA,SAASC,aAAT,QAA8B,6BAA9B;AAKA,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;AAiCA,MAAMK,0BAA0B,GAAG,IAAIP,kBAAJ,CAAuBG,cAAvB,CAAnC;AACA,SAASI,0BAAT;AAEA,eAAeJ,cAAf","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 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 clearCallbackId(callbackId: number | string, eventName: string): void; // Only supported on iOS\n}\n\nconst ShoppingModuleEventEmitter = new NativeEventEmitter(ShoppingModule);\nexport { ShoppingModuleEventEmitter };\n\nexport default ShoppingModule as IShoppingModule;\n"]}
@@ -69,14 +69,17 @@ declare class FireworkSDK {
69
69
  * Get VideoShopping object.
70
70
  */
71
71
  get shopping(): VideoShopping;
72
+ private _shopping;
72
73
  /**
73
74
  * Get LiveStream object.
74
75
  */
75
76
  get liveStream(): LiveStream;
77
+ private _liveStream;
76
78
  /**
77
79
  * Get FWNavigator object.
78
80
  */
79
81
  get navigator(): FWNavigator;
82
+ private _navigator;
80
83
  /**
81
84
  * Get global single instance of FireworkSDK class.
82
85
  * @returns FireworkSDK
@@ -1,7 +1,7 @@
1
1
  import { NativeEventEmitter, NativeModule } from 'react-native';
2
+ import type { NewNativeContainerProps } from '../models/NewNativeContainerProps';
2
3
  import type Product from '../models/Product';
3
4
  import type ProductInfoViewConfiguration from '../models/ProductInfoViewConfiguration';
4
- import type { NewNativeContainerProps } from 'src/models/NewNativeContainerProps';
5
5
  interface IShoppingModule extends NativeModule {
6
6
  init(): void;
7
7
  updateVideoProducts(products: Product[], callbackId: number | string): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-firework-sdk",
3
- "version": "1.3.1-beta.4",
3
+ "version": "1.3.1-beta.7",
4
4
  "description": "Firework React Native SDK",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -22,6 +22,7 @@ class FWNavigator {
22
22
  }
23
23
 
24
24
  private constructor() {
25
+ FWLoggerUtil.log('FWNavigator constructor');
25
26
  FWNavigatorModuleEventEmitter.addListener(FWEventName.LogMessage, () => {});
26
27
  }
27
28
 
@@ -87,9 +87,12 @@ class FireworkSDK {
87
87
  return this._shareBaseURL;
88
88
  }
89
89
  public set shareBaseURL(value: string | undefined) {
90
+ const valueHasChanged = this._shareBaseURL !== value;
90
91
  this._shareBaseURL = value;
91
92
  FireworkSDKModule.setShareBaseURL(value ?? '').then(() => {
92
- this.eventEmitter.emit(FWEventName.ShareBaseURLUpdated);
93
+ if (valueHasChanged) {
94
+ this.eventEmitter.emit(FWEventName.ShareBaseURLUpdated);
95
+ }
93
96
  });
94
97
  }
95
98
  private _shareBaseURL: string | undefined;
@@ -101,9 +104,15 @@ class FireworkSDK {
101
104
  return this._adBadgeConfiguration;
102
105
  }
103
106
  public set adBadgeConfiguration(value: AdBadgeConfiguration | undefined) {
107
+ const valueHasChanged =
108
+ this._adBadgeConfiguration?.badgeTextType !== value?.badgeTextType ||
109
+ this._adBadgeConfiguration?.backgroundColor !== value?.backgroundColor ||
110
+ this._adBadgeConfiguration?.textColor !== value?.textColor;
104
111
  this._adBadgeConfiguration = value;
105
112
  FireworkSDKModule.setAdBadgeConfiguration(value ?? {}).then(() => {
106
- this.eventEmitter.emit(FWEventName.AdBadgeConfigurationUpdated);
113
+ if (valueHasChanged) {
114
+ this.eventEmitter.emit(FWEventName.AdBadgeConfigurationUpdated);
115
+ }
107
116
  });
108
117
  }
109
118
  private _adBadgeConfiguration: AdBadgeConfiguration | undefined;
@@ -138,22 +147,25 @@ class FireworkSDK {
138
147
  * Get VideoShopping object.
139
148
  */
140
149
  public get shopping(): VideoShopping {
141
- return VideoShopping.getInstance();
150
+ return this._shopping;
142
151
  }
152
+ private _shopping: VideoShopping = VideoShopping.getInstance();
143
153
 
144
154
  /**
145
155
  * Get LiveStream object.
146
156
  */
147
157
  public get liveStream(): LiveStream {
148
- return LiveStream.getInstance();
158
+ return this._liveStream;
149
159
  }
160
+ private _liveStream: LiveStream = LiveStream.getInstance();
150
161
 
151
162
  /**
152
163
  * Get FWNavigator object.
153
164
  */
154
165
  public get navigator(): FWNavigator {
155
- return FWNavigator.getInstance();
166
+ return this._navigator;
156
167
  }
168
+ private _navigator: FWNavigator = FWNavigator.getInstance();
157
169
 
158
170
  /**
159
171
  * Get global single instance of FireworkSDK class.
@@ -168,6 +180,7 @@ class FireworkSDK {
168
180
  }
169
181
 
170
182
  private constructor() {
183
+ FWLoggerUtil.log('FireworkSDK constructor');
171
184
  this.eventEmitter.addListener(FWEventName.SDKInit, (event) => {
172
185
  FWLoggerUtil.log(`Receive SDKInit event ${event?.error}`);
173
186
 
package/src/LiveStream.ts CHANGED
@@ -2,6 +2,7 @@ import type { NativeEventEmitter } from 'react-native';
2
2
  import { FWEventName } from './models/FWEventName';
3
3
  import type { LiveStreamChatEvent, LiveStreamEvent } from './models/FWEvents';
4
4
  import { LiveStreamModuleEventEmitter } from './modules/LiveStreamModule';
5
+ import FWLoggerUtil from './utils/FWLoggerUtil';
5
6
 
6
7
  export type onLiveStreamEventCallback = (event: LiveStreamEvent) => void;
7
8
  export type onLiveStreamChatEventCallback = (
@@ -36,6 +37,7 @@ class LiveStream {
36
37
  }
37
38
 
38
39
  private constructor() {
40
+ FWLoggerUtil.log('LiveStream constructor');
39
41
  this.eventEmitter.addListener(FWEventName.LiveStream, (event) => {
40
42
  if (this.onLiveStreamEvent) {
41
43
  this.onLiveStreamEvent(event ?? {});
@@ -109,6 +109,7 @@ class VideoShopping {
109
109
  }
110
110
 
111
111
  public static getInstance() {
112
+ FWLoggerUtil.log('VideoShopping constructor');
112
113
  if (!VideoShopping._instance) {
113
114
  VideoShopping._instance = new VideoShopping();
114
115
  }
@@ -118,10 +119,14 @@ class VideoShopping {
118
119
 
119
120
  private constructor() {
120
121
  this.eventEmitter.addListener(FWEventName.AddToCart, (event) => {
122
+ FWLoggerUtil.log(
123
+ `Receive AddToCart event productId: ${event.productId} unitId: ${event.unitId}`
124
+ );
121
125
  this.handleAddToCartEvent(event);
122
126
  });
123
127
 
124
128
  this.eventEmitter.addListener(FWEventName.ClickCartIcon, (event) => {
129
+ FWLoggerUtil.log('Receive ClickCartIcon event');
125
130
  this.handleClickCartIconEvent(event);
126
131
  });
127
132
 
@@ -133,8 +138,12 @@ class VideoShopping {
133
138
  });
134
139
 
135
140
  this.eventEmitter.addListener(FWEventName.WillDisplayProduct, (event) => {
141
+ FWLoggerUtil.log(
142
+ `Receive WillDisplayProduct event videoId: ${event.videoId}`
143
+ );
136
144
  this.handleWillDisplayProductEvent(event);
137
145
  });
146
+ this.eventEmitter.addListener(FWEventName.LogMessage, () => {});
138
147
  }
139
148
 
140
149
  /**
@@ -225,6 +234,7 @@ class VideoShopping {
225
234
  }
226
235
  }
227
236
  } else {
237
+ FWLoggerUtil.log('onUpdateProductDetails callback is not set.');
228
238
  if (callbackId) {
229
239
  if (Platform.OS === 'ios') {
230
240
  ShoppingModule.clearCallbackId(