react-native-firework-sdk 1.4.2 → 1.5.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 +0 -1
- package/ios/Components/AdConfiguration.swift +20 -0
- package/ios/Components/StoryBlock.swift +7 -6
- package/ios/Components/StoryBlockManager.swift +2 -2
- package/ios/Components/VideoFeed.swift +128 -75
- package/ios/Components/VideoFeedConfiguration.swift +4 -3
- package/ios/Components/VideoFeedManager.m +5 -0
- package/ios/Components/VideoFeedManager.swift +9 -10
- package/ios/Components/VideoPlayerConfiguration.swift +1 -1
- package/ios/FireworkSdk.xcodeproj/project.pbxproj +11 -3
- package/ios/Models/NativeToRN/FireworkEventName.swift +25 -25
- package/ios/Models/NativeToRN/FireworkSDK+Json.swift +39 -21
- package/ios/Models/RNToNative/RCTConvert+FireworkSDKModule.swift +42 -16
- package/ios/Models/RNToNative/RCTConvert+Shopping.swift +13 -11
- package/ios/Models/RNToNative/RCTConvert+StoryBlock.swift +8 -6
- package/ios/Models/RNToNative/RCTConvert+VideoFeed.swift +41 -22
- package/ios/Modules/FWNavigatorModule/FWNavigatorContainerViewController.swift +4 -3
- package/ios/Modules/FWNavigatorModule/FWNavigatorModule.swift +55 -19
- package/ios/Modules/FWNavigatorModule/FWNavigatorProtocol.swift +7 -3
- package/ios/Modules/FireworkSDKModule/AdBadgeConfiguration.swift +2 -1
- package/ios/Modules/FireworkSDKModule/FireworkSDKModule+CTA.swift +15 -9
- package/ios/Modules/FireworkSDKModule/FireworkSDKModule+EventTracking.swift +79 -28
- package/ios/Modules/FireworkSDKModule/FireworkSDKModule.m +1 -0
- package/ios/Modules/FireworkSDKModule/FireworkSDKModule.swift +94 -45
- package/ios/Modules/FireworkSDKModule/TrackPurchaseParameters.swift +16 -0
- package/ios/Modules/LiveStream/LiveStreamModule.swift +32 -10
- package/ios/Modules/Shopping/FWCartViewController.swift +14 -12
- package/ios/Modules/Shopping/Product.swift +3 -3
- package/ios/Modules/Shopping/ProductInfoViewConfiguration.swift +2 -2
- package/ios/Modules/Shopping/ShoppingModule.swift +147 -100
- package/ios/Utils/String+Color.swift +13 -5
- package/ios/Utils/UIView+Constraints.swift +34 -21
- package/ios/Utils/UIViewController+AttachChild.swift +13 -11
- package/lib/commonjs/FireworkSDK.js +9 -0
- package/lib/commonjs/FireworkSDK.js.map +1 -1
- package/lib/commonjs/components/VideoFeed.js +41 -3
- package/lib/commonjs/components/VideoFeed.js.map +1 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/models/AdConfiguration.js +2 -0
- package/lib/commonjs/models/AdConfiguration.js.map +1 -0
- package/lib/commonjs/models/TrackPurchaseParameters.js +2 -0
- package/lib/commonjs/models/TrackPurchaseParameters.js.map +1 -0
- package/lib/commonjs/modules/FireworkSDKModule.js.map +1 -1
- package/lib/module/FireworkSDK.js +9 -0
- package/lib/module/FireworkSDK.js.map +1 -1
- package/lib/module/components/VideoFeed.js +42 -5
- package/lib/module/components/VideoFeed.js.map +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/models/AdConfiguration.js +2 -0
- package/lib/module/models/AdConfiguration.js.map +1 -0
- package/lib/module/models/TrackPurchaseParameters.js +2 -0
- package/lib/module/models/TrackPurchaseParameters.js.map +1 -0
- package/lib/module/modules/FireworkSDKModule.js.map +1 -1
- package/lib/typescript/FireworkSDK.d.ts +6 -0
- package/lib/typescript/components/VideoFeed.d.ts +6 -0
- package/lib/typescript/index.d.ts +4 -1
- package/lib/typescript/models/AdConfiguration.d.ts +22 -0
- package/lib/typescript/models/TrackPurchaseParameters.d.ts +26 -0
- package/lib/typescript/models/VideoFeedConfiguration.d.ts +4 -0
- package/lib/typescript/modules/FireworkSDKModule.d.ts +2 -0
- package/package.json +1 -1
- package/react-native-firework-sdk.podspec +1 -1
- package/src/FireworkSDK.ts +9 -0
- package/src/components/VideoFeed.tsx +35 -1
- package/src/index.tsx +6 -0
- package/src/models/AdConfiguration.ts +23 -0
- package/src/models/TrackPurchaseParameters.ts +24 -0
- package/src/models/VideoFeedConfiguration.ts +4 -0
- package/src/modules/FireworkSDKModule.ts +2 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["FireworkSDKModule.ts"],"names":["NativeEventEmitter","NativeModules","LINKING_ERROR","FireworkSDKModule","FireworkSDK","Proxy","get","Error","FireworkSDKModuleEventEmitter"],"mappings":"AAAA,SAASA,kBAAT,QAAiD,cAAjD;AACA,SAASC,aAAT,QAA8B,cAA9B;AAGA,SAASC,aAAT,QAA8B,6BAA9B;
|
|
1
|
+
{"version":3,"sources":["FireworkSDKModule.ts"],"names":["NativeEventEmitter","NativeModules","LINKING_ERROR","FireworkSDKModule","FireworkSDK","Proxy","get","Error","FireworkSDKModuleEventEmitter"],"mappings":"AAAA,SAASA,kBAAT,QAAiD,cAAjD;AACA,SAASC,aAAT,QAA8B,cAA9B;AAGA,SAASC,aAAT,QAA8B,6BAA9B;AAIA,MAAMC,iBAAiB,GAAGF,aAAa,CAACG,WAAd,GACtBH,aAAa,CAACG,WADQ,GAEtB,IAAIC,KAAJ,CACE,EADF,EAEE;AACEC,EAAAA,GAAG,GAAG;AACJ,UAAM,IAAIC,KAAJ,CAAUL,aAAV,CAAN;AACD;;AAHH,CAFF,CAFJ;AAuBA,MAAMM,6BAA6B,GAAG,IAAIR,kBAAJ,CAAuBG,iBAAvB,CAAtC;AACA,SAASK,6BAAT;AACA,eAAeL,iBAAf","sourcesContent":["import { NativeEventEmitter, NativeModule } from 'react-native';\nimport { NativeModules } from 'react-native';\nimport type AdBadgeConfiguration from '../models/AdBadgeConfiguration';\n\nimport { LINKING_ERROR } from '../constants/FWErrorMessage';\nimport type VideoPlayerConfiguration from '../models/VideoPlayerConfiguration';\nimport type TrackPurchaseParameters from '../models/TrackPurchaseParameters';\n\nconst FireworkSDKModule = NativeModules.FireworkSDK\n ? NativeModules.FireworkSDK\n : new Proxy(\n {},\n {\n get() {\n throw new Error(LINKING_ERROR);\n },\n }\n );\n\ninterface IFireworkSDKModule extends NativeModule {\n init(userId?: string): void;\n openVideoPlayer(url: string, config?: VideoPlayerConfiguration): void;\n setCustomCTAClickEnabled(enabled: boolean): void;\n setCustomCTALinkContentPageRouteName(name?: string): Promise<any>;\n setShareBaseURL(url?: string): Promise<any>;\n setVideoPlaybackEventEnabled(enabled: boolean): void;\n setAdBadgeConfiguration(config?: AdBadgeConfiguration): Promise<any>;\n setAppComponentName(name?: string): Promise<any>;\n trackPurchase(parameters: TrackPurchaseParameters): void;\n}\n\nconst FireworkSDKModuleEventEmitter = new NativeEventEmitter(FireworkSDKModule);\nexport { FireworkSDKModuleEventEmitter };\nexport default FireworkSDKModule as IFireworkSDKModule;\n"]}
|
|
@@ -5,6 +5,7 @@ import type { CustomCTAClickEvent, SDKInitEvent, VideoFeedClickEvent, VideoPlayb
|
|
|
5
5
|
import type VideoPlayerConfiguration from './models/VideoPlayerConfiguration';
|
|
6
6
|
import VideoShopping from './VideoShopping';
|
|
7
7
|
import FWNavigator from './FWNavigator';
|
|
8
|
+
import type TrackPurchaseParameters from './models/TrackPurchaseParameters';
|
|
8
9
|
export declare type SDKInitCallback = (event: SDKInitEvent) => void;
|
|
9
10
|
export declare type CustomCTAClickCallback = (event: CustomCTAClickEvent) => void;
|
|
10
11
|
export declare type CustomCTALinkContentRender = (event: CustomCTAClickEvent) => React.ReactNode | null;
|
|
@@ -97,5 +98,10 @@ declare class FireworkSDK {
|
|
|
97
98
|
* @param {VideoPlayerConfiguration} config
|
|
98
99
|
*/
|
|
99
100
|
openVideoPlayer(url: string, config?: VideoPlayerConfiguration): void;
|
|
101
|
+
/**
|
|
102
|
+
* Records the user purchase.
|
|
103
|
+
* @param {TrackPurchaseParameters} parameters
|
|
104
|
+
*/
|
|
105
|
+
trackPurchase(parameters: TrackPurchaseParameters): void;
|
|
100
106
|
}
|
|
101
107
|
export default FireworkSDK;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { EmitterSubscription, StyleProp, ViewStyle } from 'react-native';
|
|
3
3
|
import type FWError from '../models/FWError';
|
|
4
|
+
import type AdConfiguration from '../models/AdConfiguration';
|
|
4
5
|
import type VideoFeedConfiguration from '../models/VideoFeedConfiguration';
|
|
5
6
|
import type { VideoFeedSource } from '../models/VideoFeedSource';
|
|
6
7
|
import type VideoPlayerConfiguration from '../models/VideoPlayerConfiguration';
|
|
@@ -44,6 +45,10 @@ export interface IVideoFeedProps {
|
|
|
44
45
|
* Configuration of the player.
|
|
45
46
|
*/
|
|
46
47
|
videoPlayerConfiguration?: VideoPlayerConfiguration;
|
|
48
|
+
/**
|
|
49
|
+
* Ad configuration of the feed. Only supported on iOS.
|
|
50
|
+
*/
|
|
51
|
+
adConfiguration?: AdConfiguration;
|
|
47
52
|
/**
|
|
48
53
|
* The feed loading result callback. It means loading successfully when error equals to undefined.
|
|
49
54
|
*/
|
|
@@ -64,5 +69,6 @@ export default class VideoFeed extends React.Component<IVideoFeedProps> {
|
|
|
64
69
|
componentWillUnmount(): void;
|
|
65
70
|
render(): JSX.Element;
|
|
66
71
|
private _generateDynamicContentParametersString;
|
|
72
|
+
private _generateVastAttributesString;
|
|
67
73
|
private _getVideoFeedConfiguration;
|
|
68
74
|
}
|
|
@@ -8,6 +8,8 @@ import type { onLiveStreamChatEventCallback, onLiveStreamEventCallback } from '.
|
|
|
8
8
|
import LiveStream from './LiveStream';
|
|
9
9
|
import type AdBadgeConfiguration from './models/AdBadgeConfiguration';
|
|
10
10
|
import type { AdBadgeTextType } from './models/AdBadgeConfiguration';
|
|
11
|
+
import type AdConfiguration from './models/AdConfiguration';
|
|
12
|
+
import type { VastAttribute } from './models/AdConfiguration';
|
|
11
13
|
import type AddToCartResult from './models/AddToCartResult';
|
|
12
14
|
import type FeedItemDetails from './models/FeedItemDetails';
|
|
13
15
|
import type FWError from './models/FWError';
|
|
@@ -23,6 +25,7 @@ import type { AddToCartButtonConfiguration } from './models/ProductInfoViewConfi
|
|
|
23
25
|
import type ProductUnit from './models/ProductUnit';
|
|
24
26
|
import type { ProductPrice, ProductUnitOption } from './models/ProductUnit';
|
|
25
27
|
import type { StoryBlockSource } from './models/StoryBlockSource';
|
|
28
|
+
import type TrackPurchaseParameters from './models/TrackPurchaseParameters';
|
|
26
29
|
import type VideoFeedConfiguration from './models/VideoFeedConfiguration';
|
|
27
30
|
import type { VideoFeedContentPadding, VideoFeedPlayIconConfiguration, VideoFeedTitleConfiguration, VideoFeedTitlePosition } from './models/VideoFeedConfiguration';
|
|
28
31
|
import type { VideoFeedSource } from './models/VideoFeedSource';
|
|
@@ -34,4 +37,4 @@ import type { VideoLaunchBehavior, VideoPlayerCompleteAction, VideoPlayerCTAStyl
|
|
|
34
37
|
import type { AddToCartCallback, ClickCartIconCallback, CustomClickCartIconCallback, UpdateProductDetailsCallback, WillDisplayProductCallback } from './VideoShopping';
|
|
35
38
|
import VideoShopping from './VideoShopping';
|
|
36
39
|
export default FireworkSDK;
|
|
37
|
-
export { AdBadgeConfiguration, AdBadgeTextType, AddToCartButtonConfiguration, AddToCartCallback, AddToCartEvent, AddToCartResult, ClickCartIconCallback, CustomClickCartIconCallback, CustomCTAClickCallback, CustomCTAClickEvent, CustomCTALinkContentRender, FeedItemDetails, FWError, FWNavigator, IVideoFeedProps, LiveStream, LiveStreamChatEvent, LiveStreamChatEventName, LiveStreamEvent, LiveStreamEventDetails, LiveStreamEventName, LiveStreamMessageDetails, NewNativeContainerProps, onLiveStreamChatEventCallback, onLiveStreamEventCallback, Product, ProductInfoViewConfiguration, ProductPrice, ProductUnit, ProductUnitOption, SDKInitCallback, SDKInitEvent, StoryBlock, StoryBlockSource, UpdateProductDetailsCallback, UpdateProductDetailsEvent, VideoFeed, VideoFeedClickCallback, VideoFeedConfiguration, VideoFeedContentPadding, VideoFeedMode, VideoFeedPlayIconConfiguration, VideoFeedSource, VideoFeedTitleConfiguration, VideoFeedTitlePosition, VideoLaunchBehavior, VideoPlaybackCallback, VideoPlaybackDetails, VideoPlaybackEvent, VideoPlaybackEventName, VideoPlayerCompleteAction, VideoPlayerConfiguration, VideoPlayerCTAStyle, VideoPlayerSize, VideoPlayerStyle, VideoShopping, WillDisplayProductCallback, WillDisplayProductEvent, };
|
|
40
|
+
export { AdBadgeConfiguration, AdBadgeTextType, AdConfiguration, AddToCartButtonConfiguration, AddToCartCallback, AddToCartEvent, AddToCartResult, ClickCartIconCallback, CustomClickCartIconCallback, CustomCTAClickCallback, CustomCTAClickEvent, CustomCTALinkContentRender, FeedItemDetails, FWError, FWNavigator, IVideoFeedProps, LiveStream, LiveStreamChatEvent, LiveStreamChatEventName, LiveStreamEvent, LiveStreamEventDetails, LiveStreamEventName, LiveStreamMessageDetails, NewNativeContainerProps, onLiveStreamChatEventCallback, onLiveStreamEventCallback, Product, ProductInfoViewConfiguration, ProductPrice, ProductUnit, ProductUnitOption, SDKInitCallback, SDKInitEvent, StoryBlock, StoryBlockSource, TrackPurchaseParameters, UpdateProductDetailsCallback, UpdateProductDetailsEvent, VastAttribute, VideoFeed, VideoFeedClickCallback, VideoFeedConfiguration, VideoFeedContentPadding, VideoFeedMode, VideoFeedPlayIconConfiguration, VideoFeedSource, VideoFeedTitleConfiguration, VideoFeedTitlePosition, VideoLaunchBehavior, VideoPlaybackCallback, VideoPlaybackDetails, VideoPlaybackEvent, VideoPlaybackEventName, VideoPlayerCompleteAction, VideoPlayerConfiguration, VideoPlayerCTAStyle, VideoPlayerSize, VideoPlayerStyle, VideoShopping, WillDisplayProductCallback, WillDisplayProductEvent, };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export interface VastAttribute {
|
|
2
|
+
name: string;
|
|
3
|
+
value: string;
|
|
4
|
+
}
|
|
5
|
+
export default interface AdConfiguration {
|
|
6
|
+
/**
|
|
7
|
+
* Custom VAST attributes to be used when fetching ads.
|
|
8
|
+
*/
|
|
9
|
+
vastAttributes?: VastAttribute[];
|
|
10
|
+
/**
|
|
11
|
+
* Indicates that the feed is dependent on ads being fetched before displaying any feed content.
|
|
12
|
+
* Default value is false.
|
|
13
|
+
* Warning: This will cause a delay in feed rendering. Use only when necessary.
|
|
14
|
+
*/
|
|
15
|
+
requiresAds?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Specifies the timeout(The unit of time is seconds) to be applied when ads are required.
|
|
18
|
+
* Default value is 10.
|
|
19
|
+
* This property is ignored when requiresAd is false
|
|
20
|
+
*/
|
|
21
|
+
adsFetchTimeout?: number;
|
|
22
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export default interface TrackPurchaseParameters {
|
|
2
|
+
/**
|
|
3
|
+
* A unique identifier for the user's order.
|
|
4
|
+
*/
|
|
5
|
+
orderId: string;
|
|
6
|
+
/**
|
|
7
|
+
* The value of the order.
|
|
8
|
+
*/
|
|
9
|
+
value?: number;
|
|
10
|
+
/**
|
|
11
|
+
* The currency code of the purchase value.
|
|
12
|
+
*/
|
|
13
|
+
currencyCode?: string;
|
|
14
|
+
/**
|
|
15
|
+
* The country code of the purchase.
|
|
16
|
+
*/
|
|
17
|
+
countryCode?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Any additional information associated to the purchase.
|
|
20
|
+
* Reserved keys: order_id, value, currency, country.
|
|
21
|
+
* Any values passed in the additionalInfo that use a reserved key will be ignored.
|
|
22
|
+
*/
|
|
23
|
+
additionalInfo?: {
|
|
24
|
+
[key: string]: string;
|
|
25
|
+
};
|
|
26
|
+
}
|
|
@@ -65,4 +65,8 @@ export default interface VideoFeedConfiguration {
|
|
|
65
65
|
* The property value needs to be an integer and greater than 0.
|
|
66
66
|
*/
|
|
67
67
|
gridColumns?: number;
|
|
68
|
+
/**
|
|
69
|
+
* Specifies if Picture in Picture is enabled. Only supported on iOS.
|
|
70
|
+
*/
|
|
71
|
+
enablePictureInPicture?: boolean;
|
|
68
72
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { NativeEventEmitter, NativeModule } from 'react-native';
|
|
2
2
|
import type AdBadgeConfiguration from '../models/AdBadgeConfiguration';
|
|
3
3
|
import type VideoPlayerConfiguration from '../models/VideoPlayerConfiguration';
|
|
4
|
+
import type TrackPurchaseParameters from '../models/TrackPurchaseParameters';
|
|
4
5
|
interface IFireworkSDKModule extends NativeModule {
|
|
5
6
|
init(userId?: string): void;
|
|
6
7
|
openVideoPlayer(url: string, config?: VideoPlayerConfiguration): void;
|
|
@@ -10,6 +11,7 @@ interface IFireworkSDKModule extends NativeModule {
|
|
|
10
11
|
setVideoPlaybackEventEnabled(enabled: boolean): void;
|
|
11
12
|
setAdBadgeConfiguration(config?: AdBadgeConfiguration): Promise<any>;
|
|
12
13
|
setAppComponentName(name?: string): Promise<any>;
|
|
14
|
+
trackPurchase(parameters: TrackPurchaseParameters): void;
|
|
13
15
|
}
|
|
14
16
|
declare const FireworkSDKModuleEventEmitter: NativeEventEmitter;
|
|
15
17
|
export { FireworkSDKModuleEventEmitter };
|
package/package.json
CHANGED
package/src/FireworkSDK.ts
CHANGED
|
@@ -18,6 +18,7 @@ import ShoppingModule from './modules/ShoppingModule';
|
|
|
18
18
|
import VideoShopping from './VideoShopping';
|
|
19
19
|
import FWNavigator from './FWNavigator';
|
|
20
20
|
import FWLoggerUtil from './utils/FWLoggerUtil';
|
|
21
|
+
import type TrackPurchaseParameters from './models/TrackPurchaseParameters';
|
|
21
22
|
|
|
22
23
|
export type SDKInitCallback = (event: SDKInitEvent) => void;
|
|
23
24
|
export type CustomCTAClickCallback = (event: CustomCTAClickEvent) => void;
|
|
@@ -240,6 +241,14 @@ class FireworkSDK {
|
|
|
240
241
|
public openVideoPlayer(url: string, config?: VideoPlayerConfiguration) {
|
|
241
242
|
FireworkSDKModule.openVideoPlayer(url, config ?? {});
|
|
242
243
|
}
|
|
244
|
+
|
|
245
|
+
/**
|
|
246
|
+
* Records the user purchase.
|
|
247
|
+
* @param {TrackPurchaseParameters} parameters
|
|
248
|
+
*/
|
|
249
|
+
public trackPurchase(parameters: TrackPurchaseParameters) {
|
|
250
|
+
FireworkSDKModule.trackPurchase(parameters);
|
|
251
|
+
}
|
|
243
252
|
}
|
|
244
253
|
|
|
245
254
|
export default FireworkSDK;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
-
import { NativeSyntheticEvent, Platform } from 'react-native';
|
|
4
3
|
import {
|
|
5
4
|
EmitterSubscription,
|
|
6
5
|
findNodeHandle,
|
|
6
|
+
NativeSyntheticEvent,
|
|
7
|
+
Platform,
|
|
7
8
|
StyleProp,
|
|
8
9
|
UIManager,
|
|
9
10
|
ViewStyle,
|
|
@@ -12,6 +13,7 @@ import {
|
|
|
12
13
|
import FireworkSDK from '../FireworkSDK';
|
|
13
14
|
import type FWError from '../models/FWError';
|
|
14
15
|
import { FWEventName } from '../models/FWEventName';
|
|
16
|
+
import type AdConfiguration from '../models/AdConfiguration';
|
|
15
17
|
import type VideoFeedConfiguration from '../models/VideoFeedConfiguration';
|
|
16
18
|
import type { VideoFeedSource } from '../models/VideoFeedSource';
|
|
17
19
|
import type VideoPlayerConfiguration from '../models/VideoPlayerConfiguration';
|
|
@@ -58,6 +60,10 @@ export interface IVideoFeedProps {
|
|
|
58
60
|
* Configuration of the player.
|
|
59
61
|
*/
|
|
60
62
|
videoPlayerConfiguration?: VideoPlayerConfiguration;
|
|
63
|
+
/**
|
|
64
|
+
* Ad configuration of the feed. Only supported on iOS.
|
|
65
|
+
*/
|
|
66
|
+
adConfiguration?: AdConfiguration;
|
|
61
67
|
/**
|
|
62
68
|
* The feed loading result callback. It means loading successfully when error equals to undefined.
|
|
63
69
|
*/
|
|
@@ -164,6 +170,7 @@ export default class VideoFeed extends React.Component<IVideoFeedProps> {
|
|
|
164
170
|
playlist = '',
|
|
165
171
|
playlistGroup = '',
|
|
166
172
|
mode = 'row',
|
|
173
|
+
adConfiguration,
|
|
167
174
|
} = this.props;
|
|
168
175
|
const videoFeedConfiguration = this._getVideoFeedConfiguration();
|
|
169
176
|
const titleHidden = videoFeedConfiguration?.title?.hidden ?? false;
|
|
@@ -178,7 +185,12 @@ export default class VideoFeed extends React.Component<IVideoFeedProps> {
|
|
|
178
185
|
const dynamicContentParametersString =
|
|
179
186
|
this._generateDynamicContentParametersString();
|
|
180
187
|
const enableAutoplay = videoFeedConfiguration?.enableAutoplay ?? false;
|
|
188
|
+
const enablePictureInPicture =
|
|
189
|
+
videoFeedConfiguration?.enablePictureInPicture ?? false;
|
|
181
190
|
const gridColumns = videoFeedConfiguration?.gridColumns ?? 2;
|
|
191
|
+
const requiresAds = adConfiguration?.requiresAds ?? false;
|
|
192
|
+
const adsFetchTimeout = adConfiguration?.adsFetchTimeout ?? 10;
|
|
193
|
+
const vastAttributesString = this._generateVastAttributesString();
|
|
182
194
|
|
|
183
195
|
let key = `source:${source}`;
|
|
184
196
|
key += `_channel:${channel}`;
|
|
@@ -194,7 +206,11 @@ export default class VideoFeed extends React.Component<IVideoFeedProps> {
|
|
|
194
206
|
key += `_textColorOfAdBadge:${textColorOfAdBadge}`;
|
|
195
207
|
key += `_dynamicContentParameters:${dynamicContentParametersString}`;
|
|
196
208
|
key += `_enableAutoplay:${enableAutoplay}`;
|
|
209
|
+
key += `_enablePictureInPicture:${enablePictureInPicture}`;
|
|
197
210
|
key += `_gridColumns:${gridColumns}`;
|
|
211
|
+
key += `_requiresAds:${requiresAds}`;
|
|
212
|
+
key += `_adsFetchTimeout:${adsFetchTimeout}`;
|
|
213
|
+
key += `_vastAttributes:${vastAttributesString}`;
|
|
198
214
|
|
|
199
215
|
return (
|
|
200
216
|
<FWVideoFeed
|
|
@@ -229,6 +245,24 @@ export default class VideoFeed extends React.Component<IVideoFeedProps> {
|
|
|
229
245
|
return resultString;
|
|
230
246
|
}
|
|
231
247
|
|
|
248
|
+
private _generateVastAttributesString(): string {
|
|
249
|
+
const { adConfiguration } = this.props;
|
|
250
|
+
const vastAttributes = adConfiguration?.vastAttributes ?? '';
|
|
251
|
+
if (!vastAttributes) {
|
|
252
|
+
return '';
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
let resultString = '';
|
|
256
|
+
for (const attribute of vastAttributes) {
|
|
257
|
+
if (resultString.length > 0) {
|
|
258
|
+
resultString += '_';
|
|
259
|
+
}
|
|
260
|
+
resultString += `${attribute.name ?? ''}:${attribute.value}`;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
return resultString;
|
|
264
|
+
}
|
|
265
|
+
|
|
232
266
|
private _getVideoFeedConfiguration(): VideoFeedConfiguration | undefined {
|
|
233
267
|
const { videoFeedConfiguration } = this.props;
|
|
234
268
|
if (!videoFeedConfiguration) {
|
package/src/index.tsx
CHANGED
|
@@ -17,6 +17,8 @@ import type {
|
|
|
17
17
|
import LiveStream from './LiveStream';
|
|
18
18
|
import type AdBadgeConfiguration from './models/AdBadgeConfiguration';
|
|
19
19
|
import type { AdBadgeTextType } from './models/AdBadgeConfiguration';
|
|
20
|
+
import type AdConfiguration from './models/AdConfiguration';
|
|
21
|
+
import type { VastAttribute } from './models/AdConfiguration';
|
|
20
22
|
import type AddToCartResult from './models/AddToCartResult';
|
|
21
23
|
import type FeedItemDetails from './models/FeedItemDetails';
|
|
22
24
|
import type FWError from './models/FWError';
|
|
@@ -41,6 +43,7 @@ import type { AddToCartButtonConfiguration } from './models/ProductInfoViewConfi
|
|
|
41
43
|
import type ProductUnit from './models/ProductUnit';
|
|
42
44
|
import type { ProductPrice, ProductUnitOption } from './models/ProductUnit';
|
|
43
45
|
import type { StoryBlockSource } from './models/StoryBlockSource';
|
|
46
|
+
import type TrackPurchaseParameters from './models/TrackPurchaseParameters';
|
|
44
47
|
import type VideoFeedConfiguration from './models/VideoFeedConfiguration';
|
|
45
48
|
import type {
|
|
46
49
|
VideoFeedContentPadding,
|
|
@@ -73,6 +76,7 @@ export default FireworkSDK;
|
|
|
73
76
|
export {
|
|
74
77
|
AdBadgeConfiguration,
|
|
75
78
|
AdBadgeTextType,
|
|
79
|
+
AdConfiguration,
|
|
76
80
|
AddToCartButtonConfiguration,
|
|
77
81
|
AddToCartCallback,
|
|
78
82
|
AddToCartEvent,
|
|
@@ -105,8 +109,10 @@ export {
|
|
|
105
109
|
SDKInitEvent,
|
|
106
110
|
StoryBlock,
|
|
107
111
|
StoryBlockSource,
|
|
112
|
+
TrackPurchaseParameters,
|
|
108
113
|
UpdateProductDetailsCallback,
|
|
109
114
|
UpdateProductDetailsEvent,
|
|
115
|
+
VastAttribute,
|
|
110
116
|
VideoFeed,
|
|
111
117
|
VideoFeedClickCallback,
|
|
112
118
|
VideoFeedConfiguration,
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export interface VastAttribute {
|
|
2
|
+
name: string;
|
|
3
|
+
value: string;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export default interface AdConfiguration {
|
|
7
|
+
/**
|
|
8
|
+
* Custom VAST attributes to be used when fetching ads.
|
|
9
|
+
*/
|
|
10
|
+
vastAttributes?: VastAttribute[];
|
|
11
|
+
/**
|
|
12
|
+
* Indicates that the feed is dependent on ads being fetched before displaying any feed content.
|
|
13
|
+
* Default value is false.
|
|
14
|
+
* Warning: This will cause a delay in feed rendering. Use only when necessary.
|
|
15
|
+
*/
|
|
16
|
+
requiresAds?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Specifies the timeout(The unit of time is seconds) to be applied when ads are required.
|
|
19
|
+
* Default value is 10.
|
|
20
|
+
* This property is ignored when requiresAd is false
|
|
21
|
+
*/
|
|
22
|
+
adsFetchTimeout?: number;
|
|
23
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export default interface TrackPurchaseParameters {
|
|
2
|
+
/**
|
|
3
|
+
* A unique identifier for the user's order.
|
|
4
|
+
*/
|
|
5
|
+
orderId: string;
|
|
6
|
+
/**
|
|
7
|
+
* The value of the order.
|
|
8
|
+
*/
|
|
9
|
+
value?: number;
|
|
10
|
+
/**
|
|
11
|
+
* The currency code of the purchase value.
|
|
12
|
+
*/
|
|
13
|
+
currencyCode?: string;
|
|
14
|
+
/**
|
|
15
|
+
* The country code of the purchase.
|
|
16
|
+
*/
|
|
17
|
+
countryCode?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Any additional information associated to the purchase.
|
|
20
|
+
* Reserved keys: order_id, value, currency, country.
|
|
21
|
+
* Any values passed in the additionalInfo that use a reserved key will be ignored.
|
|
22
|
+
*/
|
|
23
|
+
additionalInfo?: { [key: string]: string };
|
|
24
|
+
}
|
|
@@ -69,4 +69,8 @@ export default interface VideoFeedConfiguration {
|
|
|
69
69
|
* The property value needs to be an integer and greater than 0.
|
|
70
70
|
*/
|
|
71
71
|
gridColumns?: number;
|
|
72
|
+
/**
|
|
73
|
+
* Specifies if Picture in Picture is enabled. Only supported on iOS.
|
|
74
|
+
*/
|
|
75
|
+
enablePictureInPicture?: boolean;
|
|
72
76
|
}
|
|
@@ -4,6 +4,7 @@ import type AdBadgeConfiguration from '../models/AdBadgeConfiguration';
|
|
|
4
4
|
|
|
5
5
|
import { LINKING_ERROR } from '../constants/FWErrorMessage';
|
|
6
6
|
import type VideoPlayerConfiguration from '../models/VideoPlayerConfiguration';
|
|
7
|
+
import type TrackPurchaseParameters from '../models/TrackPurchaseParameters';
|
|
7
8
|
|
|
8
9
|
const FireworkSDKModule = NativeModules.FireworkSDK
|
|
9
10
|
? NativeModules.FireworkSDK
|
|
@@ -25,6 +26,7 @@ interface IFireworkSDKModule extends NativeModule {
|
|
|
25
26
|
setVideoPlaybackEventEnabled(enabled: boolean): void;
|
|
26
27
|
setAdBadgeConfiguration(config?: AdBadgeConfiguration): Promise<any>;
|
|
27
28
|
setAppComponentName(name?: string): Promise<any>;
|
|
29
|
+
trackPurchase(parameters: TrackPurchaseParameters): void;
|
|
28
30
|
}
|
|
29
31
|
|
|
30
32
|
const FireworkSDKModuleEventEmitter = new NativeEventEmitter(FireworkSDKModule);
|