react-native-firework-sdk 2.0.0 → 2.2.0-beta.1

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 (202) hide show
  1. package/FireworkVideoUI.xcframework/Info.plist +40 -0
  2. package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/FireworkVideoUI +0 -0
  3. package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Headers/FireworkVideoUI-Swift.h +280 -0
  4. package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Headers/FireworkVideoUI.h +18 -0
  5. package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Info.plist +0 -0
  6. package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios.abi.json +1327 -0
  7. package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios.private.swiftinterface +41 -0
  8. package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
  9. package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios.swiftinterface +41 -0
  10. package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Modules/module.modulemap +11 -0
  11. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/FireworkVideoUI +0 -0
  12. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Headers/FireworkVideoUI-Swift.h +556 -0
  13. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Headers/FireworkVideoUI.h +18 -0
  14. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Info.plist +0 -0
  15. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios-simulator.abi.json +1327 -0
  16. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +41 -0
  17. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
  18. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios-simulator.swiftinterface +41 -0
  19. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/x86_64-apple-ios-simulator.abi.json +1327 -0
  20. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +41 -0
  21. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
  22. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +41 -0
  23. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/module.modulemap +11 -0
  24. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/_CodeSignature/CodeResources +245 -0
  25. package/README.md +1 -1
  26. package/android/build.gradle +5 -4
  27. package/android/src/main/java/com/fireworksdk/bridge/components/videofeed/FWVideoFeed.kt +6 -0
  28. package/android/src/main/java/com/fireworksdk/bridge/components/videofeed/StoryBlockFragment.kt +129 -0
  29. package/android/src/main/java/com/fireworksdk/bridge/components/videofeed/StoryBlockFrameLayout.kt +90 -0
  30. package/android/src/main/java/com/fireworksdk/bridge/models/FWAdBadgeConfigModelDeserializer.kt +3 -3
  31. package/android/src/main/java/com/fireworksdk/bridge/models/FWEventName.kt +5 -1
  32. package/android/src/main/java/com/fireworksdk/bridge/models/FWFontInfoModelDeserializer.kt +1 -1
  33. package/android/src/main/java/com/fireworksdk/bridge/models/FWProductInfoViewConfiguration.kt +18 -5
  34. package/android/src/main/java/com/fireworksdk/bridge/models/FWProductInfoViewConfigurationDeserializer.kt +36 -8
  35. package/android/src/main/java/com/fireworksdk/bridge/models/FWSDKInitOptionsModelDeserializer.kt +3 -3
  36. package/android/src/main/java/com/fireworksdk/bridge/models/FWShoppingCtaResult.kt +17 -0
  37. package/android/src/main/java/com/fireworksdk/bridge/models/FWShoppingCtaResultDeserializer.kt +33 -0
  38. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoFeedConfigModelDeserializer.kt +14 -12
  39. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoFeedPropsModel.kt +1 -0
  40. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoFeedPropsModelDeserializer.kt +11 -7
  41. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoFeedSource.kt +1 -0
  42. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoPlaybackDetails.kt +8 -8
  43. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoPlayerConfigModel.kt +1 -0
  44. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoPlayerConfigModelDeserializer.kt +19 -12
  45. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoShoppingProductDeserializer.kt +11 -11
  46. package/android/src/main/java/com/fireworksdk/bridge/reactnative/manager/FWStoryBlockManager.kt +131 -45
  47. package/android/src/main/java/com/fireworksdk/bridge/reactnative/manager/FWVideoFeedManager.kt +11 -3
  48. package/android/src/main/java/com/fireworksdk/bridge/reactnative/models/FWVideoShoppingInterface.kt +2 -2
  49. package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FWLiveStreamModule.kt +45 -4
  50. package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FWNavigatorModule.kt +9 -1
  51. package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FWVideoShoppingModule.kt +83 -50
  52. package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FireworkSDKModule.kt +112 -36
  53. package/android/src/main/java/com/fireworksdk/bridge/reactnative/utils/FWEventUtils.kt +16 -6
  54. package/android/src/main/java/com/fireworksdk/bridge/utils/FWConfigUtil.kt +26 -32
  55. package/android/src/main/java/com/fireworksdk/bridge/utils/FWGlobalDataUtil.kt +10 -0
  56. package/android/src/main/java/com/fireworksdk/bridge/utils/FWLanguageUtil.kt +48 -16
  57. package/android/src/main/res/layout/fw_bridge_story_block.xml +24 -0
  58. package/ios/Components/StoryBlock.swift +32 -2
  59. package/ios/Components/StoryBlockManager.m +33 -0
  60. package/ios/Components/StoryBlockManager.swift +4 -0
  61. package/ios/Components/VideoFeed.swift +16 -32
  62. package/ios/Components/VideoFeedManager.m +12 -6
  63. package/ios/Components/VideoFeedManager.swift +4 -0
  64. package/ios/Components/VideoPlayerConfiguration.swift +1 -0
  65. package/ios/FireworkSdk.xcodeproj/project.pbxproj +276 -212
  66. package/ios/FireworkVideoUI/FireworkVideoUI/FireworkVideoUI.docc/FireworkVideoUI.md +13 -0
  67. package/ios/FireworkVideoUI/FireworkVideoUI/FireworkVideoUI.h +18 -0
  68. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/AppLanguageManager.swift +147 -0
  69. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/Foundation/Bundle+AppLanguage.swift +58 -0
  70. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/Foundation/NumberFormatter+AppLanguage.swift +25 -0
  71. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/Foundation/URLSession+AppLanguage.swift +69 -0
  72. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/UIKit/UIImageView+AppLanguage.swift +91 -0
  73. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/UIKit/UILabel+AppLanguage.swift +98 -0
  74. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/UIKit/UITextField+AppLanguage.swift +97 -0
  75. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/UIKit/UITextView+AppLanguage.swift +97 -0
  76. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/UIKit/UIView+AppLanguage.swift +38 -0
  77. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/UIKit/UIViewController+AppLanguage.swift +46 -0
  78. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/UIKit/UIWindow+AppLanguage.swift +26 -0
  79. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/LanguageUtil.swift +43 -0
  80. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/LayoutFlip/Extensions/Foundation/NSObject+LayoutFlip.swift +42 -0
  81. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/LayoutFlip/Extensions/UIKit/CALayer+LayoutFlip.swift +160 -0
  82. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/LayoutFlip/Extensions/UIKit/UILabel+LayoutFlip.swift +35 -0
  83. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/LayoutFlip/Extensions/UIKit/UIView+LayoutFlip.swift +199 -0
  84. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/LayoutFlip/LayoutFlipManager.swift +59 -0
  85. package/ios/{Utils/DispatchQueue+FWOnce.swift → FireworkVideoUI/FireworkVideoUI/Sources/Utils/Extensions/Foundation/DispatchQueue+Once.swift} +5 -5
  86. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/Utils/Extensions/Foundation/String+Base64.swift +18 -0
  87. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/Utils/Extensions/UIKit/UIView+UIHierarchy.swift +46 -0
  88. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/Utils/Swizzle.swift +37 -0
  89. package/ios/FireworkVideoUI/FireworkVideoUI.xcodeproj/project.pbxproj +766 -0
  90. package/ios/FireworkVideoUI/FireworkVideoUI.xcworkspace/contents.xcworkspacedata +10 -0
  91. package/ios/FireworkVideoUI/FireworkVideoUI.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  92. package/ios/FireworkVideoUI/FireworkVideoUITests/FireworkVideoUITests.swift +37 -0
  93. package/ios/FireworkVideoUI/Podfile +15 -0
  94. package/ios/FireworkVideoUI/Podfile.lock +16 -0
  95. package/ios/Models/NativeToRN/FireworkEventName.swift +7 -1
  96. package/ios/Models/NativeToRN/FireworkSDK+Json.swift +5 -1
  97. package/ios/Models/RNToNative/RCTConvert+Shopping.swift +21 -0
  98. package/ios/Models/RNToNative/RCTConvert+StoryBlock.swift +2 -1
  99. package/ios/Models/RNToNative/RCTConvert+VideoFeed.swift +29 -1
  100. package/ios/Modules/FWNavigatorModule/FWNavigatorModule.swift +13 -101
  101. package/ios/Modules/FireworkSDKModule/FireworkSDKModule+EventTracking.swift +34 -16
  102. package/ios/Modules/FireworkSDKModule/FireworkSDKModule.m +1 -0
  103. package/ios/Modules/FireworkSDKModule/FireworkSDKModule.swift +48 -2
  104. package/ios/Modules/FireworkSDKModule/SDKInitOptions.swift +0 -1
  105. package/ios/Modules/LiveStream/LiveStreamModule.swift +1 -0
  106. package/ios/Modules/Shopping/ProductInfoViewConfiguration.swift +7 -2
  107. package/ios/Modules/Shopping/ShoppingCTAResult.swift +16 -0
  108. package/ios/Modules/Shopping/ShoppingModule.m +2 -1
  109. package/ios/Modules/Shopping/ShoppingModule.swift +92 -34
  110. package/ios/Support/MultiHostStreaming/FWMultiHostStreaming.podspec +22 -0
  111. package/ios/Support/MultiHostStreaming/Sources/MultiHostStreamingSDK.swift +17 -0
  112. package/ios/Utils/{UINavigationController+FWSwizzle.swift → Extensions/Swizzle/UINavigationController+FWSwizzle.swift} +9 -8
  113. package/ios/Utils/FWSwizzleLoader.m +6 -1
  114. package/ios/Utils/FWSwizzleLoader.swift +13 -0
  115. package/ios/react_native_firework_sdk.h +1 -0
  116. package/ios/scripts/react_native_firework_sdk_pods.rb +27 -0
  117. package/lib/commonjs/FireworkSDK.js +55 -15
  118. package/lib/commonjs/FireworkSDK.js.map +1 -1
  119. package/lib/commonjs/LiveStream.js +2 -2
  120. package/lib/commonjs/LiveStream.js.map +1 -1
  121. package/lib/commonjs/VideoShopping.js +21 -38
  122. package/lib/commonjs/VideoShopping.js.map +1 -1
  123. package/lib/commonjs/components/StoryBlock.js +193 -128
  124. package/lib/commonjs/components/StoryBlock.js.map +1 -1
  125. package/lib/commonjs/components/VideoFeed.js +17 -5
  126. package/lib/commonjs/components/VideoFeed.js.map +1 -1
  127. package/lib/commonjs/index.js.map +1 -1
  128. package/lib/commonjs/models/FWEventName.js +3 -0
  129. package/lib/commonjs/models/FWEventName.js.map +1 -1
  130. package/lib/commonjs/models/ShoppingCTAResult.js +2 -0
  131. package/lib/commonjs/models/VideoPlaybackEventName.js +3 -0
  132. package/lib/commonjs/models/VideoPlaybackEventName.js.map +1 -1
  133. package/lib/commonjs/modules/FireworkSDKModule.js.map +1 -1
  134. package/lib/commonjs/modules/ShoppingModule.js.map +1 -1
  135. package/lib/module/FireworkSDK.js +54 -15
  136. package/lib/module/FireworkSDK.js.map +1 -1
  137. package/lib/module/LiveStream.js +2 -2
  138. package/lib/module/LiveStream.js.map +1 -1
  139. package/lib/module/VideoShopping.js +21 -40
  140. package/lib/module/VideoShopping.js.map +1 -1
  141. package/lib/module/components/StoryBlock.js +183 -133
  142. package/lib/module/components/StoryBlock.js.map +1 -1
  143. package/lib/module/components/VideoFeed.js +16 -5
  144. package/lib/module/components/VideoFeed.js.map +1 -1
  145. package/lib/module/index.js.map +1 -1
  146. package/lib/module/models/FWEventName.js +3 -0
  147. package/lib/module/models/FWEventName.js.map +1 -1
  148. package/lib/module/models/ShoppingCTAResult.js +2 -0
  149. package/lib/module/models/VideoPlaybackEventName.js +3 -0
  150. package/lib/module/models/VideoPlaybackEventName.js.map +1 -1
  151. package/lib/module/modules/FireworkSDKModule.js.map +1 -1
  152. package/lib/module/modules/ShoppingModule.js.map +1 -1
  153. package/lib/typescript/FireworkSDK.d.ts +15 -8
  154. package/lib/typescript/LiveStream.d.ts +2 -2
  155. package/lib/typescript/VideoShopping.d.ts +10 -12
  156. package/lib/typescript/components/StoryBlock.d.ts +25 -24
  157. package/lib/typescript/components/VideoFeed.d.ts +7 -0
  158. package/lib/typescript/index.d.ts +6 -6
  159. package/lib/typescript/models/FWEventName.d.ts +3 -0
  160. package/lib/typescript/models/FWEvents.d.ts +14 -1
  161. package/lib/typescript/models/ProductInfoViewConfiguration.d.ts +12 -8
  162. package/lib/typescript/models/SDKInitOptions.d.ts +6 -1
  163. package/lib/typescript/models/ShoppingCTAResult.d.ts +11 -0
  164. package/lib/typescript/models/StoryBlockSource.d.ts +1 -1
  165. package/lib/typescript/models/VideoFeedSource.d.ts +1 -1
  166. package/lib/typescript/models/VideoPlaybackDetails.d.ts +16 -0
  167. package/lib/typescript/models/VideoPlaybackEventName.d.ts +13 -1
  168. package/lib/typescript/models/VideoPlayerConfiguration.d.ts +4 -0
  169. package/lib/typescript/modules/FireworkSDKModule.d.ts +1 -2
  170. package/lib/typescript/modules/ShoppingModule.d.ts +2 -1
  171. package/package.json +8 -3
  172. package/react-native-firework-sdk.podspec +31 -24
  173. package/src/FireworkSDK.ts +54 -15
  174. package/src/LiveStream.ts +2 -2
  175. package/src/VideoShopping.ts +41 -54
  176. package/src/components/StoryBlock.tsx +210 -98
  177. package/src/components/VideoFeed.tsx +23 -4
  178. package/src/index.ts +15 -9
  179. package/src/models/FWEventName.ts +3 -0
  180. package/src/models/FWEvents.ts +14 -1
  181. package/src/models/ProductInfoViewConfiguration.ts +13 -8
  182. package/src/models/SDKInitOptions.ts +6 -1
  183. package/src/models/ShoppingCTAResult.ts +11 -0
  184. package/src/models/StoryBlockSource.ts +2 -1
  185. package/src/models/VideoFeedSource.ts +2 -1
  186. package/src/models/VideoPlaybackDetails.ts +16 -0
  187. package/src/models/VideoPlaybackEventName.ts +13 -1
  188. package/src/models/VideoPlayerConfiguration.ts +4 -0
  189. package/src/modules/FireworkSDKModule.ts +1 -2
  190. package/src/modules/ShoppingModule.ts +5 -5
  191. package/android/src/main/java/com/fireworksdk/bridge/constants/FWCommandConstant.kt +0 -6
  192. package/ios/Utils/FWSwizzleUtil.swift +0 -29
  193. package/ios/Utils/UIView+ParentViewController.swift +0 -21
  194. package/lib/commonjs/models/AddToCartResult.js +0 -2
  195. package/lib/module/models/AddToCartResult.js +0 -2
  196. package/lib/typescript/models/AddToCartResult.d.ts +0 -10
  197. package/src/models/AddToCartResult.ts +0 -10
  198. /package/ios/Utils/{String+Color.swift → Extensions/String+Color.swift} +0 -0
  199. /package/ios/Utils/{UIView+Constraints.swift → Extensions/UIView+Constraints.swift} +0 -0
  200. /package/ios/Utils/{UIViewController+AttachChild.swift → Extensions/UIViewController+AttachChild.swift} +0 -0
  201. /package/lib/commonjs/models/{AddToCartResult.js.map → ShoppingCTAResult.js.map} +0 -0
  202. /package/lib/module/models/{AddToCartResult.js.map → ShoppingCTAResult.js.map} +0 -0
@@ -1,21 +1,25 @@
1
1
  import type IOSFontInfo from './IOSFontInfo';
2
- export interface AddToCartButtonConfiguration {
2
+ export type ShoppingCTAButtonText = 'addToCart' | 'shopNow';
3
+ export interface ShoppingCTAButtonConfiguration {
3
4
  /**
4
- * The background color of "Add to cart" button.
5
+ * The text of shopping CTA button.
6
+ */
7
+ text?: ShoppingCTAButtonText;
8
+ /**
9
+ * The background color of CTA button.
5
10
  */
6
11
  backgroundColor?: string;
7
12
  /**
8
- * The text color of "Add to cart" button.
13
+ * The text color of CTA button.
9
14
  */
10
15
  textColor?: string;
11
16
  /**
12
- * The font size of "Add to cart" button.
17
+ * The font size of CTA button.
13
18
  */
14
19
  fontSize?: number;
15
20
  /**
16
21
  * The iOS font info of "Add to cart" button.
17
22
  * The property is ignored when fontSize is not set.
18
- * Only supported on iOS.
19
23
  */
20
24
  iOSFontInfo?: IOSFontInfo;
21
25
  }
@@ -24,11 +28,11 @@ export interface LinkButtonConfiguration {
24
28
  }
25
29
  export default interface ProductInfoViewConfiguration {
26
30
  /**
27
- * Configuration of "Add to cart" button. Only supported on iOS.
31
+ * Configuration of shopping CTA button. Only supported on iOS.
28
32
  */
29
- addToCartButton?: AddToCartButtonConfiguration;
33
+ ctaButton?: ShoppingCTAButtonConfiguration;
30
34
  /**
31
- * Configuration of link button next to "Add to cart" button. Only supported on iOS.
35
+ * Configuration of link button next to "Add to cart" button.
32
36
  */
33
37
  linkButton?: LinkButtonConfiguration;
34
38
  }
@@ -1,6 +1,11 @@
1
1
  export type VideoLaunchBehavior = 'default' | 'muteOnFirstLaunch';
2
2
  export default interface SDKInitOptions {
3
+ /**
4
+ * Custom value to identify the current user.
5
+ */
3
6
  userId?: string;
4
- shareBaseURL?: string;
7
+ /**
8
+ * Behavior occurring after video is launched.
9
+ */
5
10
  videoLaunchBehavior?: VideoLaunchBehavior;
6
11
  }
@@ -0,0 +1,11 @@
1
+ export default interface ShoppingCTAResult {
2
+ /**
3
+ * The result of shopping CTA button.
4
+ */
5
+ res: 'success' | 'fail';
6
+ /**
7
+ * We will show a toast to display the tips.
8
+ * If the property is undefined or empty string, we don't show a toast.
9
+ */
10
+ tips?: string;
11
+ }
@@ -1 +1 @@
1
- export type StoryBlockSource = 'discover' | 'channel' | 'playlist' | 'dynamicContent';
1
+ export type StoryBlockSource = 'discover' | 'channel' | 'playlist' | 'dynamicContent' | 'hashtagPlaylist';
@@ -1 +1 @@
1
- export type VideoFeedSource = 'discover' | 'channel' | 'playlist' | 'playlistGroup' | 'dynamicContent';
1
+ export type VideoFeedSource = 'discover' | 'channel' | 'playlist' | 'playlistGroup' | 'dynamicContent' | 'hashtagPlaylist';
@@ -27,4 +27,20 @@ export default interface VideoPlaybackDetails {
27
27
  * Indicates if the video is associated with a call-to-action (CTA).
28
28
  */
29
29
  hasCTA?: boolean | null;
30
+ /**
31
+ * The amount of time the video was playing at the time of the event.
32
+ */
33
+ progress?: number | null;
34
+ /**
35
+ * The type of the CTA button clicked: "buy" "download" "view" "book".
36
+ */
37
+ ctaActionType?: string | null;
38
+ /**
39
+ * The url of the CTA button clicked.
40
+ */
41
+ ctaActionURL?: string | null;
42
+ /**
43
+ * The associated feed ID
44
+ */
45
+ feedId?: string | null;
30
46
  }
@@ -7,6 +7,14 @@ declare enum VideoPlaybackEventName {
7
7
  * Video started.
8
8
  */
9
9
  Start = "fw:video:start",
10
+ /**
11
+ * Video paused.
12
+ */
13
+ Pause = "fw:video:pause",
14
+ /**
15
+ * Video resume.
16
+ */
17
+ Resume = "fw:video:resume",
10
18
  /**
11
19
  * Video reached 25%.
12
20
  */
@@ -24,7 +32,11 @@ declare enum VideoPlaybackEventName {
24
32
  */
25
33
  Complete = "fw:video:complete",
26
34
  /**
27
- * When ad video finishes playing.
35
+ * Ad video started playing.
36
+ */
37
+ AdStart = "fw:video:ad-start",
38
+ /**
39
+ * Ad video completed playing.
28
40
  */
29
41
  AdEnd = "fw:video:ad-end",
30
42
  /**
@@ -69,4 +69,8 @@ export default interface VideoPlayerConfiguration {
69
69
  * Specifies the delay before the highlight animation occurs. Only supported on iOS.
70
70
  */
71
71
  ctaHighlightDelay?: VideoPlayerCTADelay;
72
+ /**
73
+ * The share base URL of the video.
74
+ */
75
+ shareBaseURL?: string;
72
76
  }
@@ -11,8 +11,7 @@ interface IFireworkSDKModule extends NativeModule {
11
11
  setVideoPlaybackEventEnabled(enabled: boolean): void;
12
12
  setAdBadgeConfiguration(config?: AdBadgeConfiguration): Promise<any>;
13
13
  trackPurchase(parameters: TrackPurchaseParameters): void;
14
- changeAppLanguage(language: string): Promise<boolean>;
15
- restart(): Promise<any>;
14
+ changeAppLanguage(language?: string | null): Promise<boolean>;
16
15
  }
17
16
  declare const FireworkSDKModuleEventEmitter: NativeEventEmitter;
18
17
  export { FireworkSDKModuleEventEmitter };
@@ -1,10 +1,11 @@
1
1
  import { NativeEventEmitter, NativeModule } from 'react-native';
2
2
  import type Product from '../models/Product';
3
3
  import type ProductInfoViewConfiguration from '../models/ProductInfoViewConfiguration';
4
+ import type ShoppingCTAResult from '../models/ShoppingCTAResult';
4
5
  interface IShoppingModule extends NativeModule {
5
6
  init(): void;
6
7
  updateVideoProducts(products: Product[], callbackId: number | string): void;
7
- updateAddToCartStatus(res: string, tips: string, callbackId: number | string): void;
8
+ updateShoppingCTAResult(result: ShoppingCTAResult, callbackId: number | string): void;
8
9
  setCartIconVisible(visible: boolean): void;
9
10
  setCartItemCount(count: number): void;
10
11
  setCustomClickCartIconEnabled(enabled: boolean): Promise<void>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-firework-sdk",
3
- "version": "2.0.0",
3
+ "version": "2.2.0-beta.1",
4
4
  "description": "Firework React Native SDK",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -13,13 +13,18 @@
13
13
  "ios",
14
14
  "cpp",
15
15
  "react-native-firework-sdk.podspec",
16
+ "FireworkVideoUI.xcframework",
16
17
  "!lib/typescript/example",
17
18
  "!android/build",
18
19
  "!ios/build",
20
+ "!ios/FireworkVideoUI/build",
21
+ "!ios/FireworkVideoUI/Pods",
22
+ "!ios/FireworkVideoUI/scripts",
19
23
  "!**/__tests__",
20
24
  "!**/__fixtures__",
21
25
  "!**/__mocks__",
22
- "!docs/"
26
+ "!docs/",
27
+ "!README_PUBLIC_REPO.md"
23
28
  ],
24
29
  "scripts": {
25
30
  "test": "jest",
@@ -34,7 +39,7 @@
34
39
  "android"
35
40
  ],
36
41
  "repository": "",
37
- "author": "",
42
+ "author": "Loop Now Technologies, Inc.",
38
43
  "license": "Apache-2.0",
39
44
  "bugs": {
40
45
  "url": "https://github.com/loopsocial/react-native-firework-sdk/issues"
@@ -1,31 +1,38 @@
1
- require "json"
1
+ require 'json'
2
2
 
3
- package = JSON.parse(File.read(File.join(__dir__, "package.json")))
3
+ package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
4
4
 
5
5
  Pod::Spec.new do |s|
6
- s.name = "react-native-firework-sdk"
7
- s.version = package["version"]
8
- s.summary = package["description"]
9
- s.homepage = package["homepage"]
10
- s.license = "Apache License, Version 2.0"
11
- s.authors = package["author"]
6
+ s.name = 'react-native-firework-sdk'
7
+ s.version = package['version']
8
+ s.summary = package['description']
9
+ s.homepage = package['homepage']
10
+ s.license = 'Apache License, Version 2.0'
11
+ s.authors = package['author']
12
12
 
13
- s.platforms = { :ios => "12.0" }
14
- s.source = { :git => "https://github.com/loopsocial/bogano.git", :tag => "#{s.version}" }
13
+ s.platforms = { ios: '12.0' }
14
+ s.source = { git: 'https://github.com/loopsocial/bogano.git', tag: "#{s.version}" }
15
15
 
16
16
  s.swift_version = '5.0'
17
- # s.header_dir = "ios"
18
- # s.public_header_files = "ios/*.h"
19
- s.source_files = "ios/**/*.{h,m,mm,swift}"
20
-
21
- s.script_phase = { :name => 'Copy module header files', :script => 'echo "react-native-firework-sdk module_header_path path is"
22
- module_header_path=${PODS_TARGET_SRCROOT}"/ios/react_native_firework_sdk.h"
23
- echo $module_header_path
24
- cp $module_header_path "${PODS_ROOT}/Headers/Public/react_native_firework_sdk/"', :execution_position => :before_compile }
25
-
26
-
27
- s.dependency "React-Core"
28
-
29
- s.dependency "FireworkVideo", "1.7.0"
30
-
17
+ s.script_phase = { name: 'Copy module header files', script: '
18
+ module_header_path="${PODS_TARGET_SRCROOT}/ios/react_native_firework_sdk.h"
19
+ target_header_directory="${PODS_ROOT}/Headers/Public/react_native_firework_sdk/"
20
+ echo "module_header_path $module_header_path"
21
+ echo "target_header_directory $target_header_directory"
22
+ if [ -d $target_header_directory ]
23
+ then
24
+ cp -f $module_header_path $target_header_directory
25
+ fi
26
+ ', execution_position: :before_compile }
27
+
28
+ s.source_files = 'ios/**/*.{h,m,mm,swift}'
29
+ s.exclude_files = [
30
+ 'ios/Support/**/*',
31
+ 'ios/FireworkVideoUI/**/*'
32
+ ]
33
+ s.preserve_paths = "FireworkVideoUI.xcframework"
34
+ s.vendored_frameworks = "FireworkVideoUI.xcframework"
35
+
36
+ s.dependency 'React-Core'
37
+ s.dependency 'FireworkVideo', '1.9.0'
31
38
  end
@@ -57,7 +57,7 @@ class FireworkSDK {
57
57
  private _onCustomCTAClick: CustomCTAClickCallback | undefined;
58
58
 
59
59
  /**
60
- * The callback of video playback. Only supported on iOS.
60
+ * The callback of video playback.
61
61
  */
62
62
  public get onVideoPlayback(): VideoPlaybackCallback | undefined {
63
63
  return this._onVideoPlayback;
@@ -69,11 +69,17 @@ class FireworkSDK {
69
69
  private _onVideoPlayback?: VideoPlaybackCallback | undefined;
70
70
 
71
71
  /**
72
- * Get share base URL.
72
+ * The global share base URL of the video.
73
+ * The {@link VideoPlayerConfiguration.shareBaseURL} in {@link VideoPlayerConfiguration} will override this.
73
74
  */
74
- public getShareBaseURL(): string | undefined {
75
+ public get shareBaseURL(): string | undefined {
75
76
  return this._shareBaseURL;
76
77
  }
78
+ public set shareBaseURL(value: string | undefined) {
79
+ FireworkSDKModule.setShareBaseURL(value ?? '').then(() => {
80
+ this.updateInternalShareBaseURL(value);
81
+ });
82
+ }
77
83
  private _shareBaseURL: string | undefined;
78
84
 
79
85
  /**
@@ -100,6 +106,11 @@ class FireworkSDK {
100
106
  }
101
107
  private _adBadgeConfiguration: AdBadgeConfiguration | undefined;
102
108
 
109
+ public get appLanguage(): string | undefined | null {
110
+ return this._appLanguage;
111
+ }
112
+ private _appLanguage: string | undefined | null;
113
+
103
114
  /**
104
115
  * Defaults to false.
105
116
  * You can enable debug logs by setting this property to true.
@@ -114,7 +125,7 @@ class FireworkSDK {
114
125
  /**
115
126
  * Get video launch behavior.
116
127
  */
117
- public getVideoLaunchBehavior(): VideoLaunchBehavior | undefined {
128
+ public get videoLaunchBehavior(): VideoLaunchBehavior | undefined {
118
129
  return this._videoLaunchBehavior;
119
130
  }
120
131
  private _videoLaunchBehavior: VideoLaunchBehavior | undefined;
@@ -198,6 +209,19 @@ class FireworkSDK {
198
209
  this.onVideoFeedClick(event ?? {});
199
210
  }
200
211
  });
212
+
213
+ if (Platform.OS === 'ios') {
214
+ this.eventEmitter.addListener(
215
+ FWEventName.NativeAppLanguageUpdated,
216
+ (event) => {
217
+ FWLoggerUtil.log(
218
+ `Receive NativeAppLanguageUpdated event appLanguage: ${event.appLanguage}`
219
+ );
220
+ const language = event.appLanguage;
221
+ this.updateInternalAppLanguage(language);
222
+ }
223
+ );
224
+ }
201
225
  }
202
226
 
203
227
  /**
@@ -208,12 +232,6 @@ class FireworkSDK {
208
232
  FWLoggerUtil.log('Call FireworkSDK init method');
209
233
 
210
234
  FireworkSDKModule.init(options).then(() => {
211
- const shareBaseURLChanged = this._shareBaseURL !== options?.shareBaseURL;
212
- this._shareBaseURL = options?.shareBaseURL;
213
- if (shareBaseURLChanged) {
214
- this.eventEmitter.emit(FWEventName.ShareBaseURLUpdated);
215
- }
216
-
217
235
  const videoLaunchBehaviorUpdated =
218
236
  this._videoLaunchBehavior !== options?.videoLaunchBehavior;
219
237
  this._videoLaunchBehavior = options?.videoLaunchBehavior;
@@ -245,18 +263,39 @@ class FireworkSDK {
245
263
  }
246
264
 
247
265
  /**
248
- * Change App level language. Only supported on Android.
249
- * @param {string} language Such as en, ar and en-US
250
- * @returns {Promise<boolean>}
266
+ * Change App level language. Only supported on iOS.
267
+ * @param {string | undefined | null} language Such as en, ar and en-US
268
+ * If language is null or undefined or empty string, SDK will use system language.
269
+ * @returns {Promise<boolean>} The result of changing app language.
251
270
  */
252
- public async changeAppLanguage(language: string): Promise<boolean> {
253
- if (Platform.OS === 'android') {
271
+ public async changeAppLanguage(language?: string | null): Promise<boolean> {
272
+ if (Platform.OS === 'ios') {
254
273
  const result = await FireworkSDKModule.changeAppLanguage(language);
274
+ if (result) {
275
+ this.updateInternalAppLanguage(language);
276
+ }
255
277
  return result;
256
278
  }
257
279
 
258
280
  return false;
259
281
  }
282
+
283
+ private updateInternalAppLanguage(language?: string | null) {
284
+ const valueHasChanged = this._appLanguage !== language;
285
+ this._appLanguage = language;
286
+ if (valueHasChanged) {
287
+ this.eventEmitter.emit(FWEventName.AppLanguageUpdated);
288
+ }
289
+ }
290
+
291
+ private updateInternalShareBaseURL(shareBaseURL?: string) {
292
+ const shareBaseURLChanged = this._shareBaseURL !== shareBaseURL;
293
+ console.log('updateInternalShareBaseURL shareBaseURL', shareBaseURL);
294
+ this._shareBaseURL = shareBaseURL;
295
+ if (shareBaseURLChanged) {
296
+ this.eventEmitter.emit(FWEventName.ShareBaseURLUpdated);
297
+ }
298
+ }
260
299
  }
261
300
 
262
301
  export default FireworkSDK;
package/src/LiveStream.ts CHANGED
@@ -16,11 +16,11 @@ class LiveStream {
16
16
  private static _instance?: LiveStream;
17
17
 
18
18
  /**
19
- * The callback of live stream event. Only supported on iOS.
19
+ * The callback of live stream event.
20
20
  */
21
21
  public onLiveStreamEvent?: onLiveStreamEventCallback;
22
22
  /**
23
- * The callback of live stream chat event. Only supported on iOS.
23
+ * The callback of live stream chat event.
24
24
  */
25
25
  public onLiveStreamChatEvent?: onLiveStreamChatEventCallback;
26
26
 
@@ -1,10 +1,9 @@
1
1
  import { NativeEventEmitter, Platform } from 'react-native';
2
2
 
3
- import type AddToCartResult from './models/AddToCartResult';
4
3
  import { FWEventName } from './models/FWEventName';
5
4
  import type {
6
- AddToCartEvent,
7
5
  CustomClickLinkButtonEvent,
6
+ ShoppingCTAEvent,
8
7
  UpdateProductDetailsEvent,
9
8
  } from './models/FWEvents';
10
9
  import type Product from './models/Product';
@@ -13,10 +12,11 @@ import ShoppingModule, {
13
12
  ShoppingModuleEventEmitter,
14
13
  } from './modules/ShoppingModule';
15
14
  import FWLoggerUtil from './utils/FWLoggerUtil';
15
+ import type ShoppingCTAResult from './models/ShoppingCTAResult';
16
16
 
17
- export type AddToCartCallback = (
18
- event: AddToCartEvent
19
- ) => Promise<AddToCartResult | undefined | null>;
17
+ export type ShoppingCTACallback = (
18
+ event: ShoppingCTAEvent
19
+ ) => Promise<ShoppingCTAResult>;
20
20
 
21
21
  export type CustomClickCartIconCallback = () => Promise<void>;
22
22
 
@@ -35,12 +35,10 @@ class VideoShopping {
35
35
  private static _instance?: VideoShopping;
36
36
 
37
37
  /**
38
- * This callback is triggered when the user clicks the "Add to cart" button.
39
- *
40
- * The host apps can return an AddToCartResult object to tell FireworkSDK the result of adding to cart.
41
- * If the host apps want to customize the processing logic of clicking "Add to cart" button, they could return null or undefined in the callback.
38
+ * This callback is triggered when the user clicks the "Add to cart" or "Shop now" button.
39
+ * The host app can return a ShoppingCTAResult object to tell SDK how to handle the result.
42
40
  */
43
- public onAddToCart?: AddToCartCallback;
41
+ public onShoppingCTA?: ShoppingCTACallback;
44
42
 
45
43
  /**
46
44
  * This callback is triggered when the user clicks the shopping cart icon.
@@ -82,8 +80,8 @@ class VideoShopping {
82
80
  private _cartIconVisible: boolean = true;
83
81
 
84
82
  /**
85
- * The host app can use this property to configure "Add to cart" button style
86
- * and hide the link button next to "Add to cart" button. Only supported on iOS.
83
+ * The configuration of product info view.
84
+ * Please refer to {@link ProductInfoViewConfiguration} for more details.
87
85
  */
88
86
  public get productInfoViewConfiguration():
89
87
  | ProductInfoViewConfiguration
@@ -95,9 +93,7 @@ class VideoShopping {
95
93
  value: ProductInfoViewConfiguration | undefined
96
94
  ) {
97
95
  this._productInfoViewConfiguration = value;
98
- if (Platform.OS === 'ios') {
99
- ShoppingModule.setProductInfoViewConfiguration(value ?? {});
100
- }
96
+ ShoppingModule.setProductInfoViewConfiguration(value ?? {});
101
97
  }
102
98
 
103
99
  private _productInfoViewConfiguration?:
@@ -106,7 +102,7 @@ class VideoShopping {
106
102
 
107
103
  /**
108
104
  * This callback is triggered when the user clicks
109
- * the link button next to Add to cart button. Only supported on Android.
105
+ * the link button next to Add to cart button.
110
106
  *
111
107
  * The host app can customize the click event processing logic of
112
108
  * the link button by setting the callback.
@@ -120,9 +116,7 @@ class VideoShopping {
120
116
  value: CustomClickLinkButtonCallback | undefined
121
117
  ) {
122
118
  this._onCustomClickLinkButton = value;
123
- if (Platform.OS === 'android') {
124
- ShoppingModule.setCustomClickLinkButtonEnabled(!!value);
125
- }
119
+ ShoppingModule.setCustomClickLinkButtonEnabled(!!value);
126
120
  }
127
121
  private _onCustomClickLinkButton?: CustomClickLinkButtonCallback | undefined;
128
122
 
@@ -140,12 +134,15 @@ class VideoShopping {
140
134
  }
141
135
 
142
136
  private constructor() {
143
- this.eventEmitter.addListener(FWEventName.AddToCart, (event) => {
144
- FWLoggerUtil.log(
145
- `Receive AddToCart event productId: ${event?.productId} unitId: ${event?.unitId}`
146
- );
147
- this.handleAddToCartEvent(event);
148
- });
137
+ this.eventEmitter.addListener(
138
+ FWEventName.ShoppingCTAButtonClick,
139
+ (event) => {
140
+ FWLoggerUtil.log(
141
+ `Receive ShoppingCTA event productId: ${event?.productId} unitId: ${event?.unitId} url: ${event?.url}`
142
+ );
143
+ this.handleShoppingCTAEvent(event);
144
+ }
145
+ );
149
146
 
150
147
  this.eventEmitter.addListener(FWEventName.ClickCartIcon, () => {
151
148
  FWLoggerUtil.log('Receive ClickCartIcon event');
@@ -161,17 +158,15 @@ class VideoShopping {
161
158
 
162
159
  this.eventEmitter.addListener(FWEventName.LogMessage, () => {});
163
160
 
164
- if (Platform.OS === 'android') {
165
- this.eventEmitter.addListener(
166
- FWEventName.CustomLinkButtonClick,
167
- (event) => {
168
- FWLoggerUtil.log(
169
- `Receive CustomLinkButtonClick event url: ${event?.url}`
170
- );
171
- this.handleCustomLinkButtonClickEvent(event);
172
- }
173
- );
174
- }
161
+ this.eventEmitter.addListener(
162
+ FWEventName.CustomLinkButtonClick,
163
+ (event) => {
164
+ FWLoggerUtil.log(
165
+ `Receive CustomLinkButtonClick event url: ${event?.url}`
166
+ );
167
+ this.handleCustomLinkButtonClickEvent(event);
168
+ }
169
+ );
175
170
  }
176
171
 
177
172
  /**
@@ -186,30 +181,22 @@ class VideoShopping {
186
181
  ShoppingModule.setCartItemCount(count);
187
182
  }
188
183
 
189
- private async handleAddToCartEvent(event: any) {
184
+ private async handleShoppingCTAEvent(event: any) {
190
185
  const callbackId = event.callbackId;
191
186
  delete event.callbackId;
192
- if (this.onAddToCart) {
193
- const result = await this.onAddToCart(event as AddToCartEvent);
194
- if (result) {
195
- if (callbackId) {
196
- ShoppingModule.updateAddToCartStatus(
197
- result.res,
198
- result.tips,
199
- callbackId
200
- );
201
- }
202
- } else {
203
- if (callbackId) {
204
- if (Platform.OS === 'ios') {
205
- ShoppingModule.clearCallbackId(callbackId, FWEventName.AddToCart);
206
- }
207
- }
187
+
188
+ if (this.onShoppingCTA) {
189
+ const result = await this.onShoppingCTA(event as ShoppingCTAEvent);
190
+ if (callbackId) {
191
+ ShoppingModule.updateShoppingCTAResult(result, callbackId);
208
192
  }
209
193
  } else {
210
194
  if (callbackId) {
211
195
  if (Platform.OS === 'ios') {
212
- ShoppingModule.clearCallbackId(callbackId, FWEventName.AddToCart);
196
+ ShoppingModule.clearCallbackId(
197
+ callbackId,
198
+ FWEventName.ShoppingCTAButtonClick
199
+ );
213
200
  }
214
201
  }
215
202
  }