react-native-firework-sdk 1.3.1-beta.8 → 1.4.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 +3 -8
- package/android/devsupport.pro +2 -0
- package/android/src/main/java/com/fireworksdk/bridge/FireworkSDKPackage.kt +6 -2
- package/android/src/main/java/com/fireworksdk/bridge/models/FWEventName.kt +4 -0
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/manager/FWStoryBlockManager.kt +274 -0
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/manager/FWVideoFeedManager.kt +16 -9
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FireworkSDKModule.kt +13 -0
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/utils/FWEventUtils.kt +11 -0
- package/android/src/main/res/layout/fw_bridge_fragment_videofeed.xml +0 -4
- package/ios/Components/StoryBlock.swift +105 -0
- package/ios/Components/StoryBlockManager.m +29 -0
- package/ios/Components/StoryBlockManager.swift +31 -0
- package/ios/Components/VideoFeed.swift +8 -16
- package/ios/FireworkSdk.xcodeproj/project.pbxproj +26 -4
- package/ios/Models/NativeToRN/FireworkSDK+Json.swift +23 -5
- package/ios/Models/RNToNative/RCTConvert+StoryBlock.swift +28 -0
- package/ios/Models/RNToNative/RCTConvert+VideoFeed.swift +2 -2
- package/ios/Modules/FWNavigatorModule/FWNavigatorModule.swift +1 -1
- package/ios/Modules/FireworkSDKModule/FireworkSDKModule+CTA.swift +2 -0
- package/ios/Modules/Shopping/{CartViewController.swift → FWCartViewController.swift} +8 -7
- package/ios/Modules/Shopping/ShoppingModule.swift +3 -3
- package/ios/Utils/UINavigationController+FWSwizzle.h +16 -0
- package/ios/Utils/UINavigationController+FWSwizzle.m +49 -0
- package/ios/Utils/UIViewController+AttachChild.swift +8 -11
- package/lib/commonjs/components/FWStoryBlock.js +18 -0
- package/lib/commonjs/components/FWStoryBlock.js.map +1 -0
- package/lib/commonjs/components/StoryBlock.js +174 -0
- package/lib/commonjs/components/StoryBlock.js.map +1 -0
- package/lib/commonjs/components/VideoFeed.js +31 -17
- package/lib/commonjs/components/VideoFeed.js.map +1 -1
- package/lib/commonjs/index.js +8 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/models/StoryBlockSource.js +2 -0
- package/lib/commonjs/models/StoryBlockSource.js.map +1 -0
- package/lib/module/components/FWStoryBlock.js +8 -0
- package/lib/module/components/FWStoryBlock.js.map +1 -0
- package/lib/module/components/StoryBlock.js +150 -0
- package/lib/module/components/StoryBlock.js.map +1 -0
- package/lib/module/components/VideoFeed.js +31 -16
- package/lib/module/components/VideoFeed.js.map +1 -1
- package/lib/module/index.js +2 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/models/StoryBlockSource.js +2 -0
- package/lib/module/models/StoryBlockSource.js.map +1 -0
- package/lib/typescript/components/FWStoryBlock.d.ts +2 -0
- package/lib/typescript/components/StoryBlock.d.ts +42 -0
- package/lib/typescript/index.d.ts +3 -1
- package/lib/typescript/models/StoryBlockSource.d.ts +1 -0
- package/package.json +1 -1
- package/react-native-firework-sdk.podspec +1 -1
- package/src/components/FWStoryBlock.tsx +10 -0
- package/src/components/StoryBlock.tsx +180 -0
- package/src/components/VideoFeed.tsx +30 -23
- package/src/index.tsx +4 -0
- package/src/models/StoryBlockSource.ts +5 -0
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index.tsx"],"names":["VideoFeed","FireworkSDK","FWNavigator","LiveStream","LiveStreamChatEventName","LiveStreamEventName","VideoPlaybackEventName","VideoShopping"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["index.tsx"],"names":["StoryBlock","VideoFeed","FireworkSDK","FWNavigator","LiveStream","LiveStreamChatEventName","LiveStreamEventName","VideoPlaybackEventName","VideoShopping"],"mappings":"AAAA,OAAOA,UAAP,MAAuB,yBAAvB;AAEA,OAAOC,SAAP,MAAsB,wBAAtB;AAQA,OAAOC,WAAP,MAAwB,eAAxB;AACA,OAAOC,WAAP,MAAwB,eAAxB;AAKA,OAAOC,UAAP,MAAuB,cAAvB;AAgBA,OAAOC,uBAAP,MAAoC,kCAApC;AAEA,OAAOC,mBAAP,MAAgC,8BAAhC;AAmBA,OAAOC,sBAAP,MAAmC,iCAAnC;AAeA,OAAOC,aAAP,MAA0B,iBAA1B;AAEA,eAAeN,WAAf;AAEA,SAcEC,WAdF,EAgBEC,UAhBF,EAkBEC,uBAlBF,EAqBEC,mBArBF,EAiCEN,UAjCF,EAqCEC,SArCF,EAkDEM,sBAlDF,EAwDEC,aAxDF","sourcesContent":["import StoryBlock from './components/StoryBlock';\nimport type { IVideoFeedProps, VideoFeedMode } from './components/VideoFeed';\nimport VideoFeed from './components/VideoFeed';\nimport type {\n CustomCTAClickCallback,\n CustomCTALinkContentRender,\n SDKInitCallback,\n VideoFeedClickCallback,\n VideoPlaybackCallback,\n} from './FireworkSDK';\nimport FireworkSDK from './FireworkSDK';\nimport FWNavigator from './FWNavigator';\nimport type {\n onLiveStreamChatEventCallback,\n onLiveStreamEventCallback,\n} from './LiveStream';\nimport LiveStream from './LiveStream';\nimport type AdBadgeConfiguration from './models/AdBadgeConfiguration';\nimport type { AdBadgeTextType } from './models/AdBadgeConfiguration';\nimport type AddToCartResult from './models/AddToCartResult';\nimport type FeedItemDetails from './models/FeedItemDetails';\nimport type FWError from './models/FWError';\nimport type {\n AddToCartEvent,\n CustomCTAClickEvent,\n LiveStreamChatEvent,\n LiveStreamEvent,\n SDKInitEvent,\n UpdateProductDetailsEvent,\n VideoPlaybackEvent,\n WillDisplayProductEvent,\n} from './models/FWEvents';\nimport LiveStreamChatEventName from './models/LiveStreamChatEventName';\nimport type LiveStreamEventDetails from './models/LiveStreamEventDetails';\nimport LiveStreamEventName from './models/LiveStreamEventName';\nimport type LiveStreamMessageDetails from './models/LiveStreamMessageDetails';\nimport type { NewNativeContainerProps } from './models/NewNativeContainerProps';\nimport type Product from './models/Product';\nimport type ProductInfoViewConfiguration from './models/ProductInfoViewConfiguration';\nimport type { AddToCartButtonConfiguration } from './models/ProductInfoViewConfiguration';\nimport type ProductUnit from './models/ProductUnit';\nimport type { ProductPrice, ProductUnitOption } from './models/ProductUnit';\nimport type { StoryBlockSource } from './models/StoryBlockSource';\nimport type VideoFeedConfiguration from './models/VideoFeedConfiguration';\nimport type {\n VideoFeedContentPadding,\n VideoFeedPlayIconConfiguration,\n VideoFeedTitleConfiguration,\n VideoFeedTitlePosition,\n} from './models/VideoFeedConfiguration';\nimport type { VideoFeedSource } from './models/VideoFeedSource';\nimport type VideoPlaybackDetails from './models/VideoPlaybackDetails';\nimport type { VideoPlayerSize } from './models/VideoPlaybackDetails';\nimport VideoPlaybackEventName from './models/VideoPlaybackEventName';\nimport type VideoPlayerConfiguration from './models/VideoPlayerConfiguration';\nimport type {\n VideoLaunchBehavior,\n VideoPlayerCompleteAction,\n VideoPlayerCTAStyle,\n VideoPlayerStyle,\n} from './models/VideoPlayerConfiguration';\nimport type {\n AddToCartCallback,\n ClickCartIconCallback,\n CustomClickCartIconCallback,\n UpdateProductDetailsCallback,\n WillDisplayProductCallback,\n} from './VideoShopping';\nimport VideoShopping from './VideoShopping';\n\nexport default FireworkSDK;\n\nexport {\n AdBadgeConfiguration,\n AdBadgeTextType,\n AddToCartButtonConfiguration,\n AddToCartCallback,\n AddToCartEvent,\n AddToCartResult,\n ClickCartIconCallback,\n CustomClickCartIconCallback,\n CustomCTAClickCallback,\n CustomCTAClickEvent,\n CustomCTALinkContentRender,\n FeedItemDetails,\n FWError,\n FWNavigator,\n IVideoFeedProps,\n LiveStream,\n LiveStreamChatEvent,\n LiveStreamChatEventName,\n LiveStreamEvent,\n LiveStreamEventDetails,\n LiveStreamEventName,\n LiveStreamMessageDetails,\n NewNativeContainerProps,\n onLiveStreamChatEventCallback,\n onLiveStreamEventCallback,\n Product,\n ProductInfoViewConfiguration,\n ProductPrice,\n ProductUnit,\n ProductUnitOption,\n SDKInitCallback,\n SDKInitEvent,\n StoryBlock,\n StoryBlockSource,\n UpdateProductDetailsCallback,\n UpdateProductDetailsEvent,\n VideoFeed,\n VideoFeedClickCallback,\n VideoFeedConfiguration,\n VideoFeedContentPadding,\n VideoFeedMode,\n VideoFeedPlayIconConfiguration,\n VideoFeedSource,\n VideoFeedTitleConfiguration,\n VideoFeedTitlePosition,\n VideoLaunchBehavior,\n VideoPlaybackCallback,\n VideoPlaybackDetails,\n VideoPlaybackEvent,\n VideoPlaybackEventName,\n VideoPlayerCompleteAction,\n VideoPlayerConfiguration,\n VideoPlayerCTAStyle,\n VideoPlayerSize,\n VideoPlayerStyle,\n VideoShopping,\n WillDisplayProductCallback,\n WillDisplayProductEvent,\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { EmitterSubscription, StyleProp, ViewStyle } from 'react-native';
|
|
3
|
+
import type FWError from '../models/FWError';
|
|
4
|
+
import type { StoryBlockSource } from '../models/StoryBlockSource';
|
|
5
|
+
export interface IStoryBlockProps {
|
|
6
|
+
/**
|
|
7
|
+
* Standard React Native View Style.
|
|
8
|
+
*/
|
|
9
|
+
style?: StyleProp<ViewStyle>;
|
|
10
|
+
/**
|
|
11
|
+
* One of four available story block sources.
|
|
12
|
+
*/
|
|
13
|
+
source: StoryBlockSource;
|
|
14
|
+
/**
|
|
15
|
+
* Channel id of the story block. Required when the source is set as channel or playlist or dynamicContent.
|
|
16
|
+
*/
|
|
17
|
+
channel?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Playlist id of the story block. Please note channel id is necessary. Required when the source is set as playlist.
|
|
20
|
+
*/
|
|
21
|
+
playlist?: string;
|
|
22
|
+
/**
|
|
23
|
+
* The dynamic content parameters of the story block. Required when the source is set as dynamicContent.
|
|
24
|
+
*/
|
|
25
|
+
dynamicContentParameters?: {
|
|
26
|
+
[key: string]: string[];
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* The feed loading result callback. It means loading successfully when error equals to undefined.
|
|
30
|
+
*/
|
|
31
|
+
onStoryBlockLoadFinished?: (error?: FWError) => void;
|
|
32
|
+
}
|
|
33
|
+
export default class StoryBlock extends React.Component<IStoryBlockProps> {
|
|
34
|
+
nativeComponentRef: React.RefObject<any>;
|
|
35
|
+
subscriptions: EmitterSubscription[];
|
|
36
|
+
componentDidMount(): void;
|
|
37
|
+
componentWillUnmount(): void;
|
|
38
|
+
render(): JSX.Element;
|
|
39
|
+
private _onStoryBlockLoadFinished;
|
|
40
|
+
private _generateKey;
|
|
41
|
+
private _generateDynamicContentParametersString;
|
|
42
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import StoryBlock from './components/StoryBlock';
|
|
1
2
|
import type { IVideoFeedProps, VideoFeedMode } from './components/VideoFeed';
|
|
2
3
|
import VideoFeed from './components/VideoFeed';
|
|
3
4
|
import type { CustomCTAClickCallback, CustomCTALinkContentRender, SDKInitCallback, VideoFeedClickCallback, VideoPlaybackCallback } from './FireworkSDK';
|
|
@@ -21,6 +22,7 @@ import type ProductInfoViewConfiguration from './models/ProductInfoViewConfigura
|
|
|
21
22
|
import type { AddToCartButtonConfiguration } from './models/ProductInfoViewConfiguration';
|
|
22
23
|
import type ProductUnit from './models/ProductUnit';
|
|
23
24
|
import type { ProductPrice, ProductUnitOption } from './models/ProductUnit';
|
|
25
|
+
import type { StoryBlockSource } from './models/StoryBlockSource';
|
|
24
26
|
import type VideoFeedConfiguration from './models/VideoFeedConfiguration';
|
|
25
27
|
import type { VideoFeedContentPadding, VideoFeedPlayIconConfiguration, VideoFeedTitleConfiguration, VideoFeedTitlePosition } from './models/VideoFeedConfiguration';
|
|
26
28
|
import type { VideoFeedSource } from './models/VideoFeedSource';
|
|
@@ -32,4 +34,4 @@ import type { VideoLaunchBehavior, VideoPlayerCompleteAction, VideoPlayerCTAStyl
|
|
|
32
34
|
import type { AddToCartCallback, ClickCartIconCallback, CustomClickCartIconCallback, UpdateProductDetailsCallback, WillDisplayProductCallback } from './VideoShopping';
|
|
33
35
|
import VideoShopping from './VideoShopping';
|
|
34
36
|
export default FireworkSDK;
|
|
35
|
-
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, UpdateProductDetailsCallback, UpdateProductDetailsEvent, VideoFeed, VideoFeedClickCallback, VideoFeedConfiguration, VideoFeedContentPadding, VideoFeedMode, VideoFeedPlayIconConfiguration, VideoFeedSource, VideoFeedTitleConfiguration, VideoFeedTitlePosition, VideoLaunchBehavior, VideoPlaybackCallback, VideoPlaybackDetails, VideoPlaybackEvent, VideoPlaybackEventName, VideoPlayerCompleteAction, VideoPlayerConfiguration, VideoPlayerCTAStyle, VideoPlayerSize, VideoPlayerStyle, VideoShopping, WillDisplayProductCallback, WillDisplayProductEvent, };
|
|
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, };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare type StoryBlockSource = 'discover' | 'channel' | 'playlist' | 'dynamicContent';
|
package/package.json
CHANGED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { requireNativeComponent, UIManager } from 'react-native';
|
|
2
|
+
import { LINKING_ERROR } from '../constants/FWErrorMessage';
|
|
3
|
+
const NativeComponentName = 'FWStoryBlock';
|
|
4
|
+
const FWStoryBlock =
|
|
5
|
+
UIManager.getViewManagerConfig(NativeComponentName) != null
|
|
6
|
+
? requireNativeComponent<any>(NativeComponentName)
|
|
7
|
+
: () => {
|
|
8
|
+
throw new Error(LINKING_ERROR);
|
|
9
|
+
};
|
|
10
|
+
export default FWStoryBlock;
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import type {
|
|
4
|
+
EmitterSubscription,
|
|
5
|
+
NativeSyntheticEvent,
|
|
6
|
+
StyleProp,
|
|
7
|
+
ViewStyle,
|
|
8
|
+
} from 'react-native';
|
|
9
|
+
|
|
10
|
+
import FireworkSDK from '../FireworkSDK';
|
|
11
|
+
import type FWError from '../models/FWError';
|
|
12
|
+
import { FWEventName } from '../models/FWEventName';
|
|
13
|
+
import type { StoryBlockSource } from '../models/StoryBlockSource';
|
|
14
|
+
import { FireworkSDKModuleEventEmitter } from '../modules/FireworkSDKModule';
|
|
15
|
+
import FWLoggerUtil from '../utils/FWLoggerUtil';
|
|
16
|
+
import FWStoryBlock from './FWStoryBlock';
|
|
17
|
+
import { findNodeHandle, UIManager, Platform } from 'react-native';
|
|
18
|
+
|
|
19
|
+
const NativeComponentName = 'FWStoryBlock';
|
|
20
|
+
|
|
21
|
+
const createFragment = (viewId: any) => {
|
|
22
|
+
if (Platform.OS === 'android') {
|
|
23
|
+
UIManager.dispatchViewManagerCommand(
|
|
24
|
+
viewId,
|
|
25
|
+
UIManager.getViewManagerConfig(
|
|
26
|
+
NativeComponentName
|
|
27
|
+
).Commands.create.toString(),
|
|
28
|
+
[viewId]
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export interface IStoryBlockProps {
|
|
34
|
+
/**
|
|
35
|
+
* Standard React Native View Style.
|
|
36
|
+
*/
|
|
37
|
+
style?: StyleProp<ViewStyle>;
|
|
38
|
+
/**
|
|
39
|
+
* One of four available story block sources.
|
|
40
|
+
*/
|
|
41
|
+
source: StoryBlockSource;
|
|
42
|
+
/**
|
|
43
|
+
* Channel id of the story block. Required when the source is set as channel or playlist or dynamicContent.
|
|
44
|
+
*/
|
|
45
|
+
channel?: string;
|
|
46
|
+
/**
|
|
47
|
+
* Playlist id of the story block. Please note channel id is necessary. Required when the source is set as playlist.
|
|
48
|
+
*/
|
|
49
|
+
playlist?: string;
|
|
50
|
+
/**
|
|
51
|
+
* The dynamic content parameters of the story block. Required when the source is set as dynamicContent.
|
|
52
|
+
*/
|
|
53
|
+
dynamicContentParameters?: { [key: string]: string[] };
|
|
54
|
+
/**
|
|
55
|
+
* The feed loading result callback. It means loading successfully when error equals to undefined.
|
|
56
|
+
*/
|
|
57
|
+
onStoryBlockLoadFinished?: (error?: FWError) => void;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export default class StoryBlock extends React.Component<IStoryBlockProps> {
|
|
61
|
+
nativeComponentRef = React.createRef<any>();
|
|
62
|
+
|
|
63
|
+
subscriptions: EmitterSubscription[] = [];
|
|
64
|
+
componentDidMount() {
|
|
65
|
+
const subscriptionOfShareBaseURLUpdated =
|
|
66
|
+
FireworkSDKModuleEventEmitter.addListener(
|
|
67
|
+
FWEventName.ShareBaseURLUpdated,
|
|
68
|
+
() => {
|
|
69
|
+
this.setState({});
|
|
70
|
+
}
|
|
71
|
+
);
|
|
72
|
+
this.subscriptions.push(subscriptionOfShareBaseURLUpdated);
|
|
73
|
+
|
|
74
|
+
const subscriptionOfAdBadgeConfigurationUpdated =
|
|
75
|
+
FireworkSDKModuleEventEmitter.addListener(
|
|
76
|
+
FWEventName.AdBadgeConfigurationUpdated,
|
|
77
|
+
() => {
|
|
78
|
+
this.setState({});
|
|
79
|
+
}
|
|
80
|
+
);
|
|
81
|
+
this.subscriptions.push(subscriptionOfAdBadgeConfigurationUpdated);
|
|
82
|
+
|
|
83
|
+
if (Platform.OS === 'android') {
|
|
84
|
+
const viewId = findNodeHandle(this.nativeComponentRef.current);
|
|
85
|
+
FWLoggerUtil.log(
|
|
86
|
+
`StoryBlock componentDidMount createFragment viewId: ${viewId}`
|
|
87
|
+
);
|
|
88
|
+
createFragment(viewId);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
componentWillUnmount() {
|
|
93
|
+
this.subscriptions.forEach((value) => {
|
|
94
|
+
value.remove();
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
this.subscriptions = [];
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
render() {
|
|
101
|
+
const { style } = this.props;
|
|
102
|
+
|
|
103
|
+
return (
|
|
104
|
+
<FWStoryBlock
|
|
105
|
+
ref={this.nativeComponentRef}
|
|
106
|
+
key={this._generateKey()}
|
|
107
|
+
{...this.props}
|
|
108
|
+
onStoryBlockLoadFinished={this._onStoryBlockLoadFinished}
|
|
109
|
+
style={Object.assign({}, style, { zIndex: -1 })}
|
|
110
|
+
/>
|
|
111
|
+
);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
private _onStoryBlockLoadFinished = (event: NativeSyntheticEvent<any>) => {
|
|
115
|
+
FWLoggerUtil.log(
|
|
116
|
+
`StoryBlock _onStoryBlockLoadFinished ${event.nativeEvent.name}`
|
|
117
|
+
);
|
|
118
|
+
|
|
119
|
+
const { onStoryBlockLoadFinished } = this.props;
|
|
120
|
+
const { name, reason } = event.nativeEvent;
|
|
121
|
+
|
|
122
|
+
if (onStoryBlockLoadFinished) {
|
|
123
|
+
if (name) {
|
|
124
|
+
if (reason) {
|
|
125
|
+
onStoryBlockLoadFinished({ name, reason });
|
|
126
|
+
} else {
|
|
127
|
+
onStoryBlockLoadFinished({ name });
|
|
128
|
+
}
|
|
129
|
+
} else {
|
|
130
|
+
onStoryBlockLoadFinished();
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
private _generateKey(): string {
|
|
136
|
+
const { source, channel = '', playlist = '' } = this.props;
|
|
137
|
+
|
|
138
|
+
const shareBaseURL = FireworkSDK.getInstance().shareBaseURL ?? '';
|
|
139
|
+
const adBadgeConfiguration =
|
|
140
|
+
FireworkSDK.getInstance().adBadgeConfiguration ?? {};
|
|
141
|
+
const adBadgeTextType = adBadgeConfiguration.badgeTextType ?? '';
|
|
142
|
+
const backgroundColorOfAdBadge = adBadgeConfiguration.backgroundColor ?? '';
|
|
143
|
+
const textColorOfAdBadge = adBadgeConfiguration.textColor ?? '';
|
|
144
|
+
const dynamicContentParametersString =
|
|
145
|
+
this._generateDynamicContentParametersString();
|
|
146
|
+
|
|
147
|
+
let key = `source:${source}`;
|
|
148
|
+
key += `_channel:${channel}`;
|
|
149
|
+
key += `_playlist:${playlist}`;
|
|
150
|
+
key += `_shareBaseURL:${shareBaseURL}`;
|
|
151
|
+
key += `_adBadgeTextType:${adBadgeTextType}`;
|
|
152
|
+
key += `_backgroundColorOfAdBadge:${backgroundColorOfAdBadge}`;
|
|
153
|
+
key += `_textColorOfAdBadge:${textColorOfAdBadge}`;
|
|
154
|
+
key += `_dynamicContentParameters:${dynamicContentParametersString}`;
|
|
155
|
+
|
|
156
|
+
return key;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
private _generateDynamicContentParametersString(): string {
|
|
160
|
+
const { dynamicContentParameters } = this.props;
|
|
161
|
+
|
|
162
|
+
if (!dynamicContentParameters) {
|
|
163
|
+
return '';
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
let resultString = '';
|
|
167
|
+
const sortedKeyList = Object.keys(dynamicContentParameters).sort();
|
|
168
|
+
for (const key of sortedKeyList) {
|
|
169
|
+
const value = dynamicContentParameters[key];
|
|
170
|
+
const valueString = value.join(',');
|
|
171
|
+
if (resultString.length > 0) {
|
|
172
|
+
resultString += '_';
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
resultString += `${key}:${valueString}`;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
return resultString;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import { NativeSyntheticEvent, Platform } from 'react-native';
|
|
4
4
|
import {
|
|
5
5
|
EmitterSubscription,
|
|
6
6
|
findNodeHandle,
|
|
@@ -8,7 +8,6 @@ import {
|
|
|
8
8
|
UIManager,
|
|
9
9
|
ViewStyle,
|
|
10
10
|
} from 'react-native';
|
|
11
|
-
import FWLoggerUtil from '../utils/FWLoggerUtil';
|
|
12
11
|
|
|
13
12
|
import FireworkSDK from '../FireworkSDK';
|
|
14
13
|
import type FWError from '../models/FWError';
|
|
@@ -17,6 +16,7 @@ import type VideoFeedConfiguration from '../models/VideoFeedConfiguration';
|
|
|
17
16
|
import type { VideoFeedSource } from '../models/VideoFeedSource';
|
|
18
17
|
import type VideoPlayerConfiguration from '../models/VideoPlayerConfiguration';
|
|
19
18
|
import { FireworkSDKModuleEventEmitter } from '../modules/FireworkSDKModule';
|
|
19
|
+
import FWLoggerUtil from '../utils/FWLoggerUtil';
|
|
20
20
|
import FWVideoFeed from './FWVideoFeed';
|
|
21
21
|
|
|
22
22
|
export type VideoFeedMode = 'row' | 'column' | 'grid';
|
|
@@ -64,11 +64,6 @@ export interface IVideoFeedProps {
|
|
|
64
64
|
onVideoFeedLoadFinished?: (error?: FWError) => void;
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
-
interface VideoFeedLoadFinishedEvent extends TargetedEvent {
|
|
68
|
-
name: string;
|
|
69
|
-
reason?: string | null;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
67
|
const NativeComponentName = 'FWVideoFeed';
|
|
73
68
|
|
|
74
69
|
export default class VideoFeed extends React.Component<IVideoFeedProps> {
|
|
@@ -88,27 +83,36 @@ export default class VideoFeed extends React.Component<IVideoFeedProps> {
|
|
|
88
83
|
|
|
89
84
|
const nativeNodeHandle = findNodeHandle(this.nativeComponentRef.current);
|
|
90
85
|
|
|
86
|
+
let commandId: string | number =
|
|
87
|
+
UIManager.getViewManagerConfig(NativeComponentName).Commands.refresh;
|
|
88
|
+
if (Platform.OS === 'android') {
|
|
89
|
+
commandId = commandId.toString();
|
|
90
|
+
}
|
|
91
|
+
|
|
91
92
|
UIManager.dispatchViewManagerCommand(
|
|
92
93
|
findNodeHandle(nativeNodeHandle),
|
|
93
|
-
|
|
94
|
+
commandId,
|
|
94
95
|
[]
|
|
95
96
|
);
|
|
96
97
|
};
|
|
97
98
|
|
|
98
|
-
private _onVideoFeedLoadFinished = (
|
|
99
|
-
event: NativeSyntheticEvent<VideoFeedLoadFinishedEvent>
|
|
100
|
-
) => {
|
|
99
|
+
private _onVideoFeedLoadFinished = (event: NativeSyntheticEvent<any>) => {
|
|
101
100
|
FWLoggerUtil.log(
|
|
102
101
|
`VideoFeed _onVideoFeedLoadFinished ${JSON.stringify(event.nativeEvent)}`
|
|
103
102
|
);
|
|
103
|
+
const { onVideoFeedLoadFinished } = this.props;
|
|
104
104
|
|
|
105
105
|
const { name, reason } = event.nativeEvent;
|
|
106
106
|
|
|
107
|
-
if (
|
|
107
|
+
if (onVideoFeedLoadFinished) {
|
|
108
108
|
if (name) {
|
|
109
|
-
|
|
109
|
+
if (reason) {
|
|
110
|
+
onVideoFeedLoadFinished({ name, reason });
|
|
111
|
+
} else {
|
|
112
|
+
onVideoFeedLoadFinished({ name });
|
|
113
|
+
}
|
|
110
114
|
} else {
|
|
111
|
-
|
|
115
|
+
onVideoFeedLoadFinished();
|
|
112
116
|
}
|
|
113
117
|
}
|
|
114
118
|
};
|
|
@@ -228,17 +232,20 @@ export default class VideoFeed extends React.Component<IVideoFeedProps> {
|
|
|
228
232
|
private _getVideoFeedConfiguration(): VideoFeedConfiguration | undefined {
|
|
229
233
|
const { videoFeedConfiguration } = this.props;
|
|
230
234
|
if (!videoFeedConfiguration) {
|
|
231
|
-
return
|
|
235
|
+
return videoFeedConfiguration;
|
|
232
236
|
}
|
|
233
237
|
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
238
|
+
if (
|
|
239
|
+
videoFeedConfiguration.gridColumns &&
|
|
240
|
+
Math.floor(videoFeedConfiguration.gridColumns!) !==
|
|
241
|
+
videoFeedConfiguration.gridColumns
|
|
242
|
+
) {
|
|
243
|
+
return {
|
|
244
|
+
...videoFeedConfiguration,
|
|
245
|
+
gridColumns: Math.floor(videoFeedConfiguration.gridColumns!),
|
|
246
|
+
};
|
|
247
|
+
} else {
|
|
248
|
+
return videoFeedConfiguration;
|
|
241
249
|
}
|
|
242
|
-
return resultFeedConfiguration;
|
|
243
250
|
}
|
|
244
251
|
}
|
package/src/index.tsx
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import StoryBlock from './components/StoryBlock';
|
|
1
2
|
import type { IVideoFeedProps, VideoFeedMode } from './components/VideoFeed';
|
|
2
3
|
import VideoFeed from './components/VideoFeed';
|
|
3
4
|
import type {
|
|
@@ -39,6 +40,7 @@ import type ProductInfoViewConfiguration from './models/ProductInfoViewConfigura
|
|
|
39
40
|
import type { AddToCartButtonConfiguration } from './models/ProductInfoViewConfiguration';
|
|
40
41
|
import type ProductUnit from './models/ProductUnit';
|
|
41
42
|
import type { ProductPrice, ProductUnitOption } from './models/ProductUnit';
|
|
43
|
+
import type { StoryBlockSource } from './models/StoryBlockSource';
|
|
42
44
|
import type VideoFeedConfiguration from './models/VideoFeedConfiguration';
|
|
43
45
|
import type {
|
|
44
46
|
VideoFeedContentPadding,
|
|
@@ -101,6 +103,8 @@ export {
|
|
|
101
103
|
ProductUnitOption,
|
|
102
104
|
SDKInitCallback,
|
|
103
105
|
SDKInitEvent,
|
|
106
|
+
StoryBlock,
|
|
107
|
+
StoryBlockSource,
|
|
104
108
|
UpdateProductDetailsCallback,
|
|
105
109
|
UpdateProductDetailsEvent,
|
|
106
110
|
VideoFeed,
|