react-native-firework-sdk 1.0.4 → 1.1.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/LICENSE +202 -0
- package/README.md +2 -40
- package/android/build.gradle +6 -3
- package/android/gradle.properties +2 -1
- package/android/proguard-rules.pro +22 -0
- package/android/publish.gradle +4 -3
- package/android/settings.gradle +1 -0
- package/android/src/main/AndroidManifest.xml +5 -2
- package/android/src/main/java/com/fireworksdk/bridge/components/videofeed/FWVideoFeed.kt +226 -0
- package/android/src/main/java/com/{reactnativefireworksdk → fireworksdk/bridge}/constants/FWCommandConstant.kt +1 -1
- package/android/src/main/java/com/{reactnativefireworksdk → fireworksdk/bridge}/constants/FWVideoPlayerConstant.kt +13 -1
- package/android/src/main/java/com/fireworksdk/bridge/models/FWAdBadgeConfigModel.kt +9 -0
- package/android/src/main/java/com/{reactnativefireworksdk → fireworksdk/bridge}/models/FWEventName.kt +10 -1
- package/android/src/main/java/com/fireworksdk/bridge/models/FWLiveStreamEventDetailsModel.kt +9 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/FWLiveStreamMessageDetailsModel.kt +11 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoFeedConfigModel.kt +28 -0
- package/android/src/main/java/com/{reactnativefireworksdk → fireworksdk/bridge}/models/FWVideoFeedItemDetailsModel.kt +2 -1
- package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoFeedModel.kt +7 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoFeedPropsModel.kt +18 -0
- package/android/src/main/java/com/{reactnativefireworksdk → fireworksdk/bridge}/models/FWVideoFeedSource.kt +2 -1
- package/android/src/main/java/com/{reactnativefireworksdk → fireworksdk/bridge}/models/FWVideoFeedTitlePosition.kt +1 -1
- package/android/src/main/java/com/{reactnativefireworksdk → fireworksdk/bridge}/models/FWVideoPlaybackDetails.kt +1 -1
- package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoPlayerConfigModel.kt +23 -0
- package/android/src/main/java/com/{reactnativefireworksdk → fireworksdk/bridge}/models/FWVideoShoppingProduct.kt +1 -1
- package/android/src/main/java/com/fireworksdk/bridge/models/WeakProperty.kt +19 -0
- package/android/src/main/java/com/{reactnativefireworksdk → fireworksdk/bridge/reactnative}/FireworkSDKPackage.kt +10 -5
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/manager/FWVideoFeedManager.kt +175 -0
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/models/FWLiveStreamInterface.kt +5 -0
- package/android/src/main/java/com/{reactnativefireworksdk → fireworksdk/bridge/reactnative}/models/FWVideoShoppingInterface.kt +3 -2
- package/android/src/main/java/com/{reactnativefireworksdk → fireworksdk/bridge/reactnative}/models/FireworkSDKInterface.kt +4 -2
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FWLiveStreamModule.kt +88 -0
- package/android/src/main/java/com/{reactnativefireworksdk → fireworksdk/bridge/reactnative}/module/FWVideoShoppingModule.kt +53 -39
- package/android/src/main/java/com/{reactnativefireworksdk → fireworksdk/bridge/reactnative}/module/FireworkSDKModule.kt +23 -22
- package/android/src/main/java/com/{reactnativefireworksdk → fireworksdk/bridge/reactnative}/pages/FWVideoShoppingCartActivity.kt +4 -4
- package/android/src/main/java/com/{reactnativefireworksdk → fireworksdk/bridge/reactnative}/utils/FWEventUtils.kt +61 -7
- package/android/src/main/java/com/{reactnativefireworksdk → fireworksdk/bridge}/utils/FWJsonUtils.kt +29 -1
- package/android/src/main/java/com/{reactnativefireworksdk → fireworksdk/bridge}/utils/FWLogUtils.kt +2 -2
- package/android/src/main/java/com/{reactnativefireworksdk → fireworksdk/bridge}/utils/FWUrlUtils.kt +1 -1
- package/android/src/main/java/com/fireworksdk/bridge/utils/FWVideoPlayerUtils.kt +94 -0
- package/android/src/main/res/layout/fw_bridge_fragment_playlistfeed.xml +18 -0
- package/android/src/main/res/layout/{fwrn_fragment_shoppingcart.xml → fw_bridge_fragment_shoppingcart.xml} +1 -1
- package/android/src/main/res/layout/{fwrn_fragment_videofeed.xml → fw_bridge_fragment_videofeed.xml} +2 -1
- package/android/src/main/res/values/colors.xml +4 -0
- package/ios/{Component → Components}/VideoFeed.swift +60 -3
- package/ios/{Component → Components}/VideoFeedConfiguration.swift +2 -0
- package/ios/{Component → Components}/VideoFeedManager.m +2 -0
- package/ios/{Component → Components}/VideoFeedManager.swift +0 -0
- package/ios/{Component → Components}/VideoPlayerConfiguration.swift +7 -0
- package/ios/Models/{FireworkJsEvent.swift → NativeToRN/FireworkEventName.swift} +20 -0
- package/ios/Models/{FireworkSDK+JsModel.swift → NativeToRN/FireworkSDK+Json.swift} +33 -3
- package/ios/Models/{RCTConvert+FireworkSDKModule.swift → RNToNative/RCTConvert+FireworkSDKModule.swift} +20 -0
- package/ios/Models/{RCTConvert+Shopping.swift → RNToNative/RCTConvert+Shopping.swift} +15 -0
- package/ios/Models/{RCTConvert+VideoFeed.swift → RNToNative/RCTConvert+VideoFeed.swift} +2 -1
- package/ios/Modules/FireworkSDKModule/AdBadgeConfiguration.swift +18 -0
- package/ios/Modules/FireworkSDKModule/FireworkSDKModule+CTA.swift +1 -1
- package/ios/Modules/FireworkSDKModule/FireworkSDKModule+EventTracking.swift +10 -14
- package/ios/Modules/FireworkSDKModule/FireworkSDKModule.m +2 -1
- package/ios/Modules/FireworkSDKModule/FireworkSDKModule.swift +16 -4
- package/ios/Modules/LiveStream/LiveStreamModule.m +14 -0
- package/ios/Modules/LiveStream/LiveStreamModule.swift +43 -0
- package/ios/Modules/Shopping/ShoppingModule.m +1 -1
- package/ios/Modules/Shopping/ShoppingModule.swift +10 -9
- package/lib/commonjs/FireworkSDK.js +61 -38
- package/lib/commonjs/FireworkSDK.js.map +1 -1
- package/lib/commonjs/LiveStream.js +60 -0
- package/lib/commonjs/LiveStream.js.map +1 -0
- package/lib/commonjs/VideoShopping.js +20 -18
- package/lib/commonjs/VideoShopping.js.map +1 -1
- package/lib/commonjs/components/VideoFeed.js +47 -2
- package/lib/commonjs/components/VideoFeed.js.map +1 -1
- package/lib/commonjs/index.js +24 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/models/AdBadgeConfiguration.js +2 -0
- package/lib/commonjs/models/{ADConfig.js.map → AdBadgeConfiguration.js.map} +0 -0
- package/lib/commonjs/models/AdConfig.js +2 -0
- package/lib/{module/models/ADConfig.js.map → commonjs/models/AdConfig.js.map} +0 -0
- package/lib/commonjs/models/FWEventName.js +24 -0
- package/lib/commonjs/models/FWEventName.js.map +1 -0
- package/lib/commonjs/models/FWEvents.js +0 -14
- package/lib/commonjs/models/FWEvents.js.map +1 -1
- package/lib/commonjs/models/LiveStreamChatEventName.js +15 -0
- package/lib/commonjs/models/LiveStreamChatEventName.js.map +1 -0
- package/lib/commonjs/models/LiveStreamEventDetails.js +2 -0
- package/lib/commonjs/models/LiveStreamEventDetails.js.map +1 -0
- package/lib/commonjs/models/LiveStreamEventName.js +17 -0
- package/lib/commonjs/models/LiveStreamEventName.js.map +1 -0
- package/lib/commonjs/models/LiveStreamMessageDetails.js +2 -0
- package/lib/commonjs/models/LiveStreamMessageDetails.js.map +1 -0
- package/lib/commonjs/models/VideoFeedSource.js +6 -0
- package/lib/commonjs/models/VideoFeedSource.js.map +1 -0
- package/lib/commonjs/models/VideoPlaybackEventName.js.map +1 -1
- package/lib/commonjs/modules/FireworkSDKModule.js +3 -1
- package/lib/commonjs/modules/FireworkSDKModule.js.map +1 -1
- package/lib/commonjs/modules/LiveStreamModule.js +22 -0
- package/lib/commonjs/modules/LiveStreamModule.js.map +1 -0
- package/lib/commonjs/modules/ShoppingModule.js +3 -1
- package/lib/commonjs/modules/ShoppingModule.js.map +1 -1
- package/lib/module/FireworkSDK.js +50 -34
- package/lib/module/FireworkSDK.js.map +1 -1
- package/lib/module/LiveStream.js +51 -0
- package/lib/module/LiveStream.js.map +1 -0
- package/lib/module/VideoShopping.js +14 -13
- package/lib/module/VideoShopping.js.map +1 -1
- package/lib/module/components/VideoFeed.js +42 -3
- package/lib/module/components/VideoFeed.js.map +1 -1
- package/lib/module/index.js +4 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/models/AdBadgeConfiguration.js +2 -0
- package/lib/module/models/AdBadgeConfiguration.js.map +1 -0
- package/lib/module/models/AdConfig.js +2 -0
- package/lib/module/models/AdConfig.js.map +1 -0
- package/lib/module/models/FWEventName.js +17 -0
- package/lib/module/models/FWEventName.js.map +1 -0
- package/lib/module/models/FWEvents.js +1 -12
- package/lib/module/models/FWEvents.js.map +1 -1
- package/lib/module/models/LiveStreamChatEventName.js +8 -0
- package/lib/module/models/LiveStreamChatEventName.js.map +1 -0
- package/lib/module/models/LiveStreamEventDetails.js +2 -0
- package/lib/module/models/LiveStreamEventDetails.js.map +1 -0
- package/lib/module/models/LiveStreamEventName.js +10 -0
- package/lib/module/models/LiveStreamEventName.js.map +1 -0
- package/lib/module/models/LiveStreamMessageDetails.js +2 -0
- package/lib/module/models/LiveStreamMessageDetails.js.map +1 -0
- package/lib/module/models/VideoFeedSource.js +2 -0
- package/lib/module/models/VideoFeedSource.js.map +1 -0
- package/lib/module/models/VideoPlaybackEventName.js.map +1 -1
- package/lib/module/modules/FireworkSDKModule.js +3 -0
- package/lib/module/modules/FireworkSDKModule.js.map +1 -1
- package/lib/module/modules/LiveStreamModule.js +12 -0
- package/lib/module/modules/LiveStreamModule.js.map +1 -0
- package/lib/module/modules/ShoppingModule.js +3 -1
- package/lib/module/modules/ShoppingModule.js.map +1 -1
- package/lib/typescript/FireworkSDK.d.ts +26 -24
- package/lib/typescript/LiveStream.d.ts +21 -0
- package/lib/typescript/VideoShopping.d.ts +6 -6
- package/lib/typescript/components/VideoFeed.d.ts +11 -4
- package/lib/typescript/index.d.ts +15 -6
- package/lib/typescript/models/AdBadgeConfiguration.d.ts +15 -0
- package/lib/typescript/models/{ADConfig.d.ts → AdConfig.d.ts} +1 -1
- package/lib/typescript/models/FWEventName.d.ts +14 -0
- package/lib/typescript/models/FWEvents.d.ts +15 -12
- package/lib/typescript/models/FeedItemDetails.d.ts +11 -4
- package/lib/typescript/models/LiveStreamChatEventName.d.ts +7 -0
- package/lib/typescript/models/LiveStreamEventDetails.d.ts +3 -0
- package/lib/typescript/models/LiveStreamEventName.d.ts +15 -0
- package/lib/typescript/models/LiveStreamMessageDetails.d.ts +14 -0
- package/lib/typescript/models/VideoFeedConfiguration.d.ts +7 -3
- package/lib/typescript/models/VideoFeedSource.d.ts +2 -0
- package/lib/typescript/models/VideoPlaybackDetails.d.ts +1 -2
- package/lib/typescript/models/VideoPlaybackEventName.d.ts +1 -1
- package/lib/typescript/models/VideoPlayerConfiguration.d.ts +13 -0
- package/lib/typescript/modules/FireworkSDKModule.d.ts +8 -4
- package/lib/typescript/modules/LiveStreamModule.d.ts +8 -0
- package/lib/typescript/modules/ShoppingModule.d.ts +4 -2
- package/package.json +3 -4
- package/react-native-firework-sdk.podspec +3 -1
- package/src/FireworkSDK.ts +49 -33
- package/src/LiveStream.ts +51 -0
- package/src/VideoShopping.ts +15 -13
- package/src/components/VideoFeed.tsx +69 -7
- package/src/index.tsx +32 -15
- package/src/models/AdBadgeConfiguration.ts +16 -0
- package/src/models/{ADConfig.ts → AdConfig.ts} +1 -1
- package/src/models/FWEventName.ts +14 -0
- package/src/models/FWEvents.ts +17 -13
- package/src/models/FeedItemDetails.ts +12 -4
- package/src/models/LiveStreamChatEventName.ts +8 -0
- package/src/models/LiveStreamEventDetails.ts +4 -0
- package/src/models/LiveStreamEventName.ts +16 -0
- package/src/models/LiveStreamMessageDetails.ts +14 -0
- package/src/models/VideoFeedConfiguration.ts +7 -3
- package/src/models/VideoFeedSource.ts +2 -0
- package/src/models/VideoPlaybackDetails.ts +1 -3
- package/src/models/VideoPlaybackEventName.ts +1 -1
- package/src/models/VideoPlayerConfiguration.ts +14 -0
- package/src/modules/FireworkSDKModule.ts +10 -4
- package/src/modules/LiveStreamModule.ts +26 -0
- package/src/modules/ShoppingModule.ts +14 -7
- package/android/src/main/java/com/reactnativefireworksdk/components/videofeed/FWVideoFeed.kt +0 -124
- package/android/src/main/java/com/reactnativefireworksdk/manager/FWVideoFeedManager.kt +0 -88
- package/android/src/main/java/com/reactnativefireworksdk/models/FWVideoFeedConfigModel.kt +0 -27
- package/android/src/main/java/com/reactnativefireworksdk/models/FWVideoFeedMode.kt +0 -7
- package/android/src/main/java/com/reactnativefireworksdk/models/FWVideoPlayerConfigModel.kt +0 -20
- package/android/src/main/java/com/reactnativefireworksdk/utils/FWVideoPlayerUtils.kt +0 -18
- package/lib/commonjs/models/ADConfig.js +0 -2
- package/lib/module/models/ADConfig.js +0 -2
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export enum FWEventName {
|
|
2
|
+
SDKInit = 'fw:sdk-init',
|
|
3
|
+
CustomCTAClick = 'fw:custom-cta-click',
|
|
4
|
+
VideoPlayback = 'fw:video-playback',
|
|
5
|
+
VideoFeedClick = 'fw:video-feed-click',
|
|
6
|
+
AddToCart = 'fw:shopping:add-to-cart',
|
|
7
|
+
ClickCartIcon = 'fw:shopping:click-cart-icon',
|
|
8
|
+
UpdateProductDetails = 'fw:shopping:update-product-details',
|
|
9
|
+
WillDisplayProduct = 'fw:shopping:will-display-product',
|
|
10
|
+
onLiveStreamEvent = 'fw:livestream',
|
|
11
|
+
onLiveStreamChatEvent = 'fw:livestream-chat',
|
|
12
|
+
ShareBaseURLUpdated = 'fw:share-base-url-updated',
|
|
13
|
+
AdBadgeConfigurationUpdated = 'fw:ad-badge-configuration-updated',
|
|
14
|
+
}
|
package/src/models/FWEvents.ts
CHANGED
|
@@ -2,17 +2,10 @@ import type VideoPlaybackDetails from './VideoPlaybackDetails';
|
|
|
2
2
|
import type FWError from './FWError';
|
|
3
3
|
import type VideoPlaybackEventName from './VideoPlaybackEventName';
|
|
4
4
|
import type FeedItemDetails from './FeedItemDetails';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
VideoPlayback = 'fw:video-playback',
|
|
10
|
-
VideoFeedClick = 'fw:video-feed-click',
|
|
11
|
-
AddToCart = 'fw:shopping:add-to-cart',
|
|
12
|
-
ClickCartIcon = 'fw:shopping:click-cart-icon',
|
|
13
|
-
UpdateProductDetails = 'fw:shopping:update-product-details',
|
|
14
|
-
WillDisplayProduct = 'fw:shopping:will-display-product',
|
|
15
|
-
}
|
|
5
|
+
import type LiveStreamMessageDetails from './LiveStreamMessageDetails';
|
|
6
|
+
import type LiveStreamChatEventName from './LiveStreamChatEventName';
|
|
7
|
+
import type LiveStreamEventDetails from './LiveStreamEventDetails';
|
|
8
|
+
import type LiveStreamEventName from './LiveStreamEventName';
|
|
16
9
|
|
|
17
10
|
export interface SDKInitEvent {
|
|
18
11
|
/**
|
|
@@ -50,9 +43,9 @@ export interface AddToCartEvent {
|
|
|
50
43
|
|
|
51
44
|
export interface UpdateProductDetailsEvent {
|
|
52
45
|
/**
|
|
53
|
-
* A unique identifier of the
|
|
46
|
+
* A unique identifier list of the products.
|
|
54
47
|
*/
|
|
55
|
-
|
|
48
|
+
productIds: string[];
|
|
56
49
|
}
|
|
57
50
|
|
|
58
51
|
export interface WillDisplayProductEvent {
|
|
@@ -60,4 +53,15 @@ export interface WillDisplayProductEvent {
|
|
|
60
53
|
* A unique identifier of the video.
|
|
61
54
|
*/
|
|
62
55
|
videoId: string;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export interface LiveStreamEvent {
|
|
59
|
+
eventName: LiveStreamEventName;
|
|
60
|
+
info: LiveStreamEventDetails;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export interface LiveStreamChatEvent {
|
|
64
|
+
eventName: LiveStreamChatEventName;
|
|
65
|
+
message: LiveStreamMessageDetails;
|
|
66
|
+
liveStream: LiveStreamEventDetails;
|
|
63
67
|
}
|
|
@@ -1,14 +1,22 @@
|
|
|
1
|
+
import type VideoFeedSource from '../models/VideoFeedSource';
|
|
2
|
+
|
|
1
3
|
export default interface FeedItemDetails {
|
|
2
4
|
/**
|
|
3
|
-
* The index of the thumbnail tapped in the
|
|
5
|
+
* The index of the thumbnail tapped in the feed.
|
|
4
6
|
*/
|
|
5
7
|
index: number;
|
|
6
8
|
/**
|
|
7
|
-
*
|
|
9
|
+
* The unique id of the thumbnail.
|
|
10
|
+
* If the source is `playlistGroup` this value will represent the playlist's id; otherwise this value is the id of the selected video.
|
|
8
11
|
*/
|
|
9
|
-
|
|
12
|
+
id: string;
|
|
10
13
|
/**
|
|
11
|
-
* The total duration of the video
|
|
14
|
+
* The total duration of the video.
|
|
15
|
+
* If the source is `playlistGroup` this value will always be 0; otherwise this value is the duration of the selected video.
|
|
12
16
|
*/
|
|
13
17
|
duration: number;
|
|
18
|
+
/**
|
|
19
|
+
* The content source of the feed.
|
|
20
|
+
*/
|
|
21
|
+
source: VideoFeedSource;
|
|
14
22
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
enum LiveStreamEventName {
|
|
2
|
+
/**
|
|
3
|
+
* Called when a user joins an active live stream.
|
|
4
|
+
*/
|
|
5
|
+
userDidjoin = 'fw:livestream:user-join',
|
|
6
|
+
/**
|
|
7
|
+
* Called when the user leaves an active live stream.
|
|
8
|
+
*/
|
|
9
|
+
userDidLeave = 'fw:livestream:user-leave',
|
|
10
|
+
/**
|
|
11
|
+
* Called when a user sends a like to an active live stream.
|
|
12
|
+
*/
|
|
13
|
+
userSendLike = 'fw:livestream:user-send-like',
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export default LiveStreamEventName;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export default interface LiveStreamMessageDetails {
|
|
2
|
+
/**
|
|
3
|
+
* A unique identifier of the message.
|
|
4
|
+
*/
|
|
5
|
+
messageId: string;
|
|
6
|
+
/**
|
|
7
|
+
* The username of the user.
|
|
8
|
+
*/
|
|
9
|
+
username?: string | null;
|
|
10
|
+
/**
|
|
11
|
+
* The text of the message.
|
|
12
|
+
*/
|
|
13
|
+
text?: string | null;
|
|
14
|
+
}
|
|
@@ -13,11 +13,11 @@ export type VideoFeedTitlePosition = 'stacked' | 'nested';
|
|
|
13
13
|
|
|
14
14
|
export default interface VideoFeedConfiguration {
|
|
15
15
|
/**
|
|
16
|
-
*
|
|
16
|
+
* Background color of video feed.
|
|
17
17
|
*/
|
|
18
18
|
backgroundColor?: string;
|
|
19
19
|
/**
|
|
20
|
-
*
|
|
20
|
+
* Corner radius of video feed. Only supported on iOS.
|
|
21
21
|
*/
|
|
22
22
|
cornerRadius?: number;
|
|
23
23
|
/**
|
|
@@ -25,11 +25,15 @@ export default interface VideoFeedConfiguration {
|
|
|
25
25
|
*/
|
|
26
26
|
title?: VideoFeedTitleConfiguration;
|
|
27
27
|
/**
|
|
28
|
-
*
|
|
28
|
+
* Title position of video feed.
|
|
29
29
|
*/
|
|
30
30
|
titlePosition?: VideoFeedTitlePosition;
|
|
31
31
|
/**
|
|
32
32
|
* Configuration of video feed play icon. Only supported on iOS.
|
|
33
33
|
*/
|
|
34
34
|
playIcon?: VideoFeedPlayIconConfiguration;
|
|
35
|
+
/**
|
|
36
|
+
* Indicates if the video feed shows ad badge.
|
|
37
|
+
*/
|
|
38
|
+
showAdBadge?: boolean;
|
|
35
39
|
}
|
|
@@ -3,8 +3,6 @@ export interface VideoPlayerSize {
|
|
|
3
3
|
height: number;
|
|
4
4
|
}
|
|
5
5
|
|
|
6
|
-
export type VideoBadge = 'ad' | 'demo' | 'featured';
|
|
7
|
-
|
|
8
6
|
export default interface VideoPlaybackDetails {
|
|
9
7
|
/**
|
|
10
8
|
* A unique identifier of the video.
|
|
@@ -21,7 +19,7 @@ export default interface VideoPlaybackDetails {
|
|
|
21
19
|
/**
|
|
22
20
|
* Video badge type.
|
|
23
21
|
*/
|
|
24
|
-
badge?:
|
|
22
|
+
badge?: string | null;
|
|
25
23
|
/**
|
|
26
24
|
* The size of the player.
|
|
27
25
|
*/
|
|
@@ -6,6 +6,8 @@ export interface VideoPlayerCTAStyle {
|
|
|
6
6
|
fontSize?: number;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
+
export type VideoLaunchBehavior = 'default' | 'muteOnFirstLaunch';
|
|
10
|
+
|
|
9
11
|
export default interface VideoPlayerConfiguration {
|
|
10
12
|
/**
|
|
11
13
|
* Sets the proportion of the video player to its container.
|
|
@@ -23,4 +25,16 @@ export default interface VideoPlayerConfiguration {
|
|
|
23
25
|
* The style of CTA button style. Only supported on iOS.
|
|
24
26
|
*/
|
|
25
27
|
ctaButtonStyle?: VideoPlayerCTAStyle;
|
|
28
|
+
/**
|
|
29
|
+
* Indicates if the video player shows playback button.
|
|
30
|
+
*/
|
|
31
|
+
showPlaybackButton?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Indicates if the video player shows mute button.
|
|
34
|
+
*/
|
|
35
|
+
showMuteButton?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* The property is valid only if showMuteButton is true.
|
|
38
|
+
*/
|
|
39
|
+
launchBehavior?: VideoLaunchBehavior;
|
|
26
40
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { NativeEventEmitter, NativeModule } from 'react-native';
|
|
2
2
|
import { NativeModules } from 'react-native';
|
|
3
|
+
import type AdBadgeConfiguration from 'src/models/AdBadgeConfiguration';
|
|
3
4
|
|
|
4
5
|
import { LINKING_ERROR } from '../constants/FWErrorMessage';
|
|
5
|
-
import type
|
|
6
|
+
import type AdConfig from '../models/AdConfig';
|
|
6
7
|
import type VideoPlayerConfiguration from '../models/VideoPlayerConfiguration';
|
|
7
8
|
|
|
8
9
|
const FireworkSDKModule = NativeModules.FireworkSDK
|
|
@@ -17,11 +18,16 @@ const FireworkSDKModule = NativeModules.FireworkSDK
|
|
|
17
18
|
);
|
|
18
19
|
|
|
19
20
|
interface IFireworkSDKModule extends NativeModule {
|
|
20
|
-
init(userId?: string, adConfig?:
|
|
21
|
+
init(userId?: string, adConfig?: AdConfig): void;
|
|
21
22
|
openVideoPlayer(url: string, config?: VideoPlayerConfiguration): void;
|
|
22
23
|
setCustomCTAClickEnabled(enabled: boolean): void;
|
|
23
|
-
setShareBaseURL(url?: string):
|
|
24
|
+
setShareBaseURL(url?: string): Promise<any>;
|
|
24
25
|
setVideoPlaybackEventEnabled(enabled: boolean): void;
|
|
26
|
+
setAdBadgeConfiguration(config?: AdBadgeConfiguration): Promise<any>;
|
|
25
27
|
}
|
|
26
28
|
|
|
29
|
+
const FireworkSDKModuleEventEmitter = new NativeEventEmitter(FireworkSDKModule);
|
|
30
|
+
export {
|
|
31
|
+
FireworkSDKModuleEventEmitter,
|
|
32
|
+
}
|
|
27
33
|
export default FireworkSDKModule as IFireworkSDKModule;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import {
|
|
2
|
+
NativeEventEmitter,
|
|
3
|
+
NativeModule,
|
|
4
|
+
NativeModules,
|
|
5
|
+
} from 'react-native';
|
|
6
|
+
|
|
7
|
+
import { LINKING_ERROR } from '../constants/FWErrorMessage';
|
|
8
|
+
|
|
9
|
+
const LiveStreamModule = NativeModules.LiveStreamModule
|
|
10
|
+
? NativeModules.LiveStreamModule
|
|
11
|
+
: new Proxy(
|
|
12
|
+
{},
|
|
13
|
+
{
|
|
14
|
+
get() {
|
|
15
|
+
throw new Error(LINKING_ERROR);
|
|
16
|
+
},
|
|
17
|
+
}
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
interface ILiveStreamModule extends NativeModule {
|
|
21
|
+
init(): void;
|
|
22
|
+
}
|
|
23
|
+
const LiveStreamModuleEventEmitter = new NativeEventEmitter(LiveStreamModule);
|
|
24
|
+
export { LiveStreamModuleEventEmitter };
|
|
25
|
+
|
|
26
|
+
export default LiveStreamModule as ILiveStreamModule;
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
NativeModule,
|
|
3
|
-
NativeModules,
|
|
4
|
-
} from 'react-native';
|
|
1
|
+
import { NativeEventEmitter, NativeModule, NativeModules } from 'react-native';
|
|
5
2
|
import type Product from '../models/Product';
|
|
6
3
|
import type ProductInfoViewConfiguration from '../models/ProductInfoViewConfiguration';
|
|
7
4
|
import { LINKING_ERROR } from '../constants/FWErrorMessage';
|
|
@@ -19,13 +16,23 @@ const ShoppingModule = NativeModules.ShoppingModule
|
|
|
19
16
|
|
|
20
17
|
interface IShoppingModule extends NativeModule {
|
|
21
18
|
init(): void;
|
|
22
|
-
|
|
23
|
-
updateProductViewConfig(
|
|
24
|
-
|
|
19
|
+
updateVideoProducts(products: Product[], callbackId: number | string): void;
|
|
20
|
+
updateProductViewConfig(
|
|
21
|
+
config: ProductInfoViewConfiguration,
|
|
22
|
+
callbackId: number | string
|
|
23
|
+
): void;
|
|
24
|
+
updateAddToCartStatus(
|
|
25
|
+
res: string,
|
|
26
|
+
tips: string,
|
|
27
|
+
callbackId: number | string
|
|
28
|
+
): void;
|
|
25
29
|
jumpToCartPage(callbackId: number | string): void;
|
|
26
30
|
exitCartPage(): void;
|
|
27
31
|
setCartIconVisible(visible: boolean): void;
|
|
28
32
|
setCartItemCount(count: number): void;
|
|
29
33
|
}
|
|
30
34
|
|
|
35
|
+
const ShoppingModuleEventEmitter = new NativeEventEmitter(ShoppingModule);
|
|
36
|
+
export { ShoppingModuleEventEmitter };
|
|
37
|
+
|
|
31
38
|
export default ShoppingModule as IShoppingModule;
|
package/android/src/main/java/com/reactnativefireworksdk/components/videofeed/FWVideoFeed.kt
DELETED
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
package com.reactnativefireworksdk.components.videofeed
|
|
2
|
-
|
|
3
|
-
import android.app.Activity
|
|
4
|
-
import android.graphics.Color
|
|
5
|
-
import android.util.AttributeSet
|
|
6
|
-
import android.view.LayoutInflater
|
|
7
|
-
import android.widget.RelativeLayout
|
|
8
|
-
import com.facebook.react.uimanager.ThemedReactContext
|
|
9
|
-
import com.loopnow.fireworklibrary.FeedType
|
|
10
|
-
import com.loopnow.fireworklibrary.models.FeedLayout
|
|
11
|
-
import com.loopnow.fireworklibrary.models.FeedTitlePosition
|
|
12
|
-
import com.loopnow.fireworklibrary.views.OnItemClickedListener
|
|
13
|
-
import com.loopnow.fireworklibrary.views.VideoFeedView
|
|
14
|
-
import com.reactnativefireworksdk.R
|
|
15
|
-
import com.reactnativefireworksdk.models.*
|
|
16
|
-
import com.reactnativefireworksdk.utils.FWEventUtils
|
|
17
|
-
import com.reactnativefireworksdk.utils.FWVideoPlayerUtils
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
class FWVideoFeed(
|
|
21
|
-
context: ThemedReactContext,
|
|
22
|
-
attrs: AttributeSet?
|
|
23
|
-
) : RelativeLayout(context, attrs) {
|
|
24
|
-
|
|
25
|
-
// private val reactContext: ReactContext = context.reactApplicationContext
|
|
26
|
-
private val activity: Activity = context.currentActivity as Activity
|
|
27
|
-
|
|
28
|
-
private val videoFeedView: VideoFeedView
|
|
29
|
-
private var channelId: String? = null
|
|
30
|
-
private var playlistId: String? = null
|
|
31
|
-
private var feedType: FeedType? = null
|
|
32
|
-
private var feedLayout: FeedLayout? = null
|
|
33
|
-
private var titlePosition: FeedTitlePosition? = null
|
|
34
|
-
|
|
35
|
-
constructor(context: ThemedReactContext) : this(context, null)
|
|
36
|
-
|
|
37
|
-
init {
|
|
38
|
-
val view = LayoutInflater.from(activity).inflate(R.layout.fwrn_fragment_videofeed, this, true)
|
|
39
|
-
videoFeedView = view.findViewById(R.id.fwrn_integrated_videofeed)
|
|
40
|
-
videoFeedView.addOnItemClickedListener(object: OnItemClickedListener {
|
|
41
|
-
override fun onItemClicked(index: Int, title: String, id: String, videoDuration: Long) {
|
|
42
|
-
val fwVideoFeedItemDetailsModel = FWVideoFeedItemDetailsModel(index, id, videoDuration.toInt())
|
|
43
|
-
FWEventUtils.sendVideoFeedClickEvent(context, fwVideoFeedItemDetailsModel)
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
override fun onItemClicked(index: Int) {
|
|
47
|
-
super.onItemClicked(index)
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
override fun onItemClicked(index: Int, feedId: Int): Boolean {
|
|
51
|
-
return super.onItemClicked(index, feedId)
|
|
52
|
-
}
|
|
53
|
-
})
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
fun setSource(source: String?) {
|
|
57
|
-
feedType = when {
|
|
58
|
-
source.equals(FWVideoFeedSource.Channel.rawValue) -> {
|
|
59
|
-
FeedType.CHANNEL
|
|
60
|
-
}
|
|
61
|
-
source.equals(FWVideoFeedSource.Playlist.rawValue) -> {
|
|
62
|
-
FeedType.PLAYLIST
|
|
63
|
-
}
|
|
64
|
-
else -> {
|
|
65
|
-
FeedType.DISCOVER
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
setFeed(channelId, playlistId, feedType)
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
fun setChannel(channel: String?) {
|
|
72
|
-
channelId = channel
|
|
73
|
-
setFeed(channelId, playlistId, feedType)
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
fun setPlaylist(playlist: String?) {
|
|
77
|
-
playlistId = playlist
|
|
78
|
-
setFeed(channelId, playlistId, feedType)
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
fun setMode(mode: String?) {
|
|
82
|
-
feedLayout = when {
|
|
83
|
-
mode.equals(FWVideoFeedMode.Column.rawValue) -> FeedLayout.VERTICAL
|
|
84
|
-
mode.equals(FWVideoFeedMode.Grid.rawValue) -> FeedLayout.GRID
|
|
85
|
-
else -> FeedLayout.HORIZONTAL
|
|
86
|
-
}
|
|
87
|
-
videoFeedView.setLayout(feedLayout)
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
fun setVideoFeedConfig(config: FWVideoFeedConfigModel?) {
|
|
91
|
-
val backgroundColor = config?.backgroundColor
|
|
92
|
-
if (!backgroundColor.isNullOrBlank()) {
|
|
93
|
-
videoFeedView.setBackgroundColor(Color.parseColor(backgroundColor))
|
|
94
|
-
} else {
|
|
95
|
-
videoFeedView.setBackgroundColor(Color.TRANSPARENT)
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
videoFeedView.setTitleVisible(config?.title?.hidden != true)
|
|
99
|
-
|
|
100
|
-
titlePosition = when {
|
|
101
|
-
config?.titlePosition.equals(FWVideoFeedTitlePosition.Stacked.rawValue) -> FeedTitlePosition.BELOW
|
|
102
|
-
else -> FeedTitlePosition.ALIGN_BOTTOM
|
|
103
|
-
}
|
|
104
|
-
videoFeedView.setTitlePosition(titlePosition)
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
fun setVideoPlayerConfig(config: FWVideoPlayerConfigModel?) {
|
|
108
|
-
FWVideoPlayerUtils.setVideoPlayerConfig(config)
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
fun refresh() {
|
|
112
|
-
videoFeedView.refreshFeed()
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
private fun setFeed(channelId: String?, playlistId: String?, feedType: FeedType?) {
|
|
116
|
-
if (feedType == FeedType.CHANNEL && !channelId.isNullOrBlank()) {
|
|
117
|
-
videoFeedView.setFeed(channelId, null, FeedType.CHANNEL)
|
|
118
|
-
} else if (feedType == FeedType.PLAYLIST && !channelId.isNullOrBlank() && !playlistId.isNullOrBlank()) {
|
|
119
|
-
videoFeedView.setFeed(channelId, playlistId, FeedType.PLAYLIST)
|
|
120
|
-
} else {
|
|
121
|
-
videoFeedView.setFeed(null, null, FeedType.DISCOVER)
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
}
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
package com.reactnativefireworksdk.manager
|
|
2
|
-
|
|
3
|
-
import com.facebook.react.bridge.ReadableArray
|
|
4
|
-
import com.facebook.react.bridge.ReadableMap
|
|
5
|
-
import com.facebook.react.uimanager.SimpleViewManager
|
|
6
|
-
import com.facebook.react.uimanager.ThemedReactContext
|
|
7
|
-
|
|
8
|
-
import com.facebook.react.uimanager.annotations.ReactProp
|
|
9
|
-
import com.reactnativefireworksdk.constants.FWCommandConstant
|
|
10
|
-
import com.reactnativefireworksdk.models.FWVideoFeedConfigModel
|
|
11
|
-
import com.reactnativefireworksdk.models.FWVideoPlayerConfigModel
|
|
12
|
-
import com.reactnativefireworksdk.utils.FWJsonUtils
|
|
13
|
-
import com.facebook.react.common.MapBuilder
|
|
14
|
-
import com.reactnativefireworksdk.components.videofeed.FWVideoFeed
|
|
15
|
-
import com.reactnativefireworksdk.models.FWFeedViewEventName
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
class FWVideoFeedManager : SimpleViewManager<FWVideoFeed>() {
|
|
19
|
-
|
|
20
|
-
override fun getName(): String {
|
|
21
|
-
return "FWVideoFeed"
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
override fun createViewInstance(reactContext: ThemedReactContext): FWVideoFeed {
|
|
25
|
-
// currentActivity cannot be null
|
|
26
|
-
return FWVideoFeed(reactContext)
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
@ReactProp(name = "source")
|
|
30
|
-
fun setSource(view: FWVideoFeed, source: String?) {
|
|
31
|
-
view.setSource(source)
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
@ReactProp(name = "channel")
|
|
35
|
-
fun setChannel(view: FWVideoFeed, channel: String?) {
|
|
36
|
-
view.setChannel(channel)
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
@ReactProp(name = "playlist")
|
|
40
|
-
fun setPlaylist(view: FWVideoFeed, playlist: String?) {
|
|
41
|
-
view.setPlaylist(playlist)
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
@ReactProp(name = "mode")
|
|
45
|
-
fun setMode(view: FWVideoFeed, mode: String?) {
|
|
46
|
-
view.setMode(mode)
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
@ReactProp(name = "videoFeedConfiguration")
|
|
50
|
-
fun setVideoFeedConfig(view: FWVideoFeed, config: ReadableMap?) {
|
|
51
|
-
val configMap = config?.toHashMap()
|
|
52
|
-
val videoFeedConfigModel = FWJsonUtils.fromMap(configMap, FWVideoFeedConfigModel::class.java)
|
|
53
|
-
view.setVideoFeedConfig(videoFeedConfigModel)
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
@ReactProp(name = "videoPlayerConfiguration")
|
|
57
|
-
fun setVideoPlayerConfig(view: FWVideoFeed, config: ReadableMap?) {
|
|
58
|
-
val configMap = config?.toHashMap()
|
|
59
|
-
val videoPlayerConfigModel = FWJsonUtils.fromMap(configMap, FWVideoPlayerConfigModel::class.java)
|
|
60
|
-
view.setVideoPlayerConfig(videoPlayerConfigModel)
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
override fun getCommandsMap(): MutableMap<String, Int> {
|
|
64
|
-
val map: MutableMap<String, Int> = HashMap()
|
|
65
|
-
map["refresh"] = FWCommandConstant.FW_COMMAND_VIDEO_FEED_REFRESH
|
|
66
|
-
return map
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
override fun receiveCommand(root: FWVideoFeed, commandId: Int, args: ReadableArray?) {
|
|
70
|
-
when (commandId) {
|
|
71
|
-
FWCommandConstant.FW_COMMAND_VIDEO_FEED_REFRESH -> {
|
|
72
|
-
root.refresh()
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* To map the "onVideoFeedLoadFinished" event name to the "onVideoFeedLoadFinished" callback prop in JavaScript
|
|
79
|
-
* first onVideoFeedLoadFinished is event name
|
|
80
|
-
* second onVideoFeedLoadFinished is callback prop in JavaScript
|
|
81
|
-
*/
|
|
82
|
-
override fun getExportedCustomBubblingEventTypeConstants(): MutableMap<String, Any>? {
|
|
83
|
-
return MapBuilder.builder<String, Any>()
|
|
84
|
-
.put(FWFeedViewEventName.VideoFeedLoadFinished.rawValue, MapBuilder.of("phasedRegistrationNames", MapBuilder.of("bubbled", FWFeedViewEventName.VideoFeedLoadFinished.rawValue)))
|
|
85
|
-
.build()
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
package com.reactnativefireworksdk.models
|
|
2
|
-
|
|
3
|
-
import android.os.Parcelable
|
|
4
|
-
import kotlinx.android.parcel.Parcelize
|
|
5
|
-
|
|
6
|
-
@Parcelize
|
|
7
|
-
data class FWVideoFeedConfigModel(
|
|
8
|
-
val backgroundColor: String?,
|
|
9
|
-
val cornerRadius: Int?,
|
|
10
|
-
val title: FWTitleModel?,
|
|
11
|
-
val titlePosition: String?,
|
|
12
|
-
val playIcon: FWPlayIconModel?
|
|
13
|
-
) : Parcelable {
|
|
14
|
-
|
|
15
|
-
@Parcelize
|
|
16
|
-
data class FWTitleModel(
|
|
17
|
-
val hidden: Boolean?,
|
|
18
|
-
val textColor: String?,
|
|
19
|
-
val fontSize: Int?,
|
|
20
|
-
) : Parcelable
|
|
21
|
-
|
|
22
|
-
@Parcelize
|
|
23
|
-
data class FWPlayIconModel(
|
|
24
|
-
val hidden: Boolean?,
|
|
25
|
-
val iconWidth: Int?,
|
|
26
|
-
) : Parcelable
|
|
27
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
package com.reactnativefireworksdk.models
|
|
2
|
-
|
|
3
|
-
import android.os.Parcelable
|
|
4
|
-
import kotlinx.android.parcel.Parcelize
|
|
5
|
-
|
|
6
|
-
@Parcelize
|
|
7
|
-
data class FWVideoPlayerConfigModel(
|
|
8
|
-
val playerStyle: String?,
|
|
9
|
-
val videoCompleteAction: String?,
|
|
10
|
-
val showShareButton: Boolean?,
|
|
11
|
-
val ctaButtonStyle: FWCtaButtonStyleModel?
|
|
12
|
-
) : Parcelable {
|
|
13
|
-
|
|
14
|
-
@Parcelize
|
|
15
|
-
data class FWCtaButtonStyleModel(
|
|
16
|
-
val backgroundColor: String?,
|
|
17
|
-
val fontSize: String?,
|
|
18
|
-
val textColor: String?,
|
|
19
|
-
) : Parcelable
|
|
20
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
package com.reactnativefireworksdk.utils
|
|
2
|
-
|
|
3
|
-
import com.loopnow.fireworklibrary.VideoPlayerProperties
|
|
4
|
-
import com.reactnativefireworksdk.constants.FWVideoPlayerConstant
|
|
5
|
-
import com.reactnativefireworksdk.models.FWVideoPlayerConfigModel
|
|
6
|
-
|
|
7
|
-
object FWVideoPlayerUtils {
|
|
8
|
-
|
|
9
|
-
var customCTAClickEnabled: Boolean = false
|
|
10
|
-
var videoPlaybackEventEnabled: Boolean = false
|
|
11
|
-
|
|
12
|
-
fun setVideoPlayerConfig(config: FWVideoPlayerConfigModel?) {
|
|
13
|
-
VideoPlayerProperties.share = config?.showShareButton != false
|
|
14
|
-
VideoPlayerProperties.loop = config?.videoCompleteAction != FWVideoPlayerConstant.FW_VIDEO_COMPLETE_ACTION_ADVANCE_TO_NEXT
|
|
15
|
-
// VideoPlayerProperties.autoPlayOnComplete = config?.videoCompleteAction != FWVideoPlayerConstant.FW_VIDEO_COMPLETE_ACTION_LOOP
|
|
16
|
-
VideoPlayerProperties.fullScreenPlayer = config?.playerStyle == FWVideoPlayerConstant.FW_PLAYER_STYLE_FULL
|
|
17
|
-
}
|
|
18
|
-
}
|