@wscsports/blaze-rtn-sdk 1.20.0 → 1.21.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 (143) hide show
  1. package/android/build.gradle +1 -1
  2. package/android/src/main/java/com/blaze/rtnblazesdk/BlazeSdkModule.kt +132 -14
  3. package/android/src/main/java/com/blaze/rtnblazesdk/BlazeSdkModuleRepo.kt +2 -0
  4. package/android/src/main/java/com/blaze/rtnblazesdk/base/BaseWidgetView.kt +92 -8
  5. package/android/src/main/java/com/blaze/rtnblazesdk/base/BlazeWidgetViewManager.kt +10 -0
  6. package/android/src/main/java/com/blaze/rtnblazesdk/customization/BlazeReactLayoutMerger.kt +128 -0
  7. package/android/src/main/java/com/blaze/rtnblazesdk/customization/BlazeReactMomentPlayerStyleMerger.kt +4 -0
  8. package/android/src/main/java/com/blaze/rtnblazesdk/customization/BlazeReactMomentsPlayerStyle.kt +2 -1
  9. package/android/src/main/java/com/blaze/rtnblazesdk/customization/BlazeReactStoriesPlayerStyleMerger.kt +18 -0
  10. package/android/src/main/java/com/blaze/rtnblazesdk/customization/BlazeReactStoryPlayerStyle.kt +9 -0
  11. package/android/src/main/java/com/blaze/rtnblazesdk/customization/BlazeReactVideosPlayerStyle.kt +49 -2
  12. package/android/src/main/java/com/blaze/rtnblazesdk/customization/BlazeReactVideosPlayerStyleMerger.kt +101 -1
  13. package/android/src/main/java/com/blaze/rtnblazesdk/customization/BlazeReactWidgetLayout.kt +51 -1
  14. package/android/src/main/java/com/blaze/rtnblazesdk/events/MomentsContainerTabsEvent.kt +8 -0
  15. package/android/src/main/java/com/blaze/rtnblazesdk/events/SdkModuleJsEvent.kt +36 -2
  16. package/android/src/main/java/com/blaze/rtnblazesdk/events/WidgetContentRestrictedEvent.kt +38 -0
  17. package/android/src/main/java/com/blaze/rtnblazesdk/events/WidgetOnTriggerInteractionLinkEvent.kt +34 -0
  18. package/android/src/main/java/com/blaze/rtnblazesdk/moments/BlazeMomentsGridView.kt +6 -5
  19. package/android/src/main/java/com/blaze/rtnblazesdk/moments/BlazeMomentsRowView.kt +6 -5
  20. package/android/src/main/java/com/blaze/rtnblazesdk/utils/ArrayExtensions.kt +13 -0
  21. package/android/src/main/java/com/blaze/rtnblazesdk/utils/DataSourceTypeExtractUtils.kt +16 -0
  22. package/android/src/main/java/com/blaze/rtnblazesdk/utils/EventParamsBuilder.kt +43 -3
  23. package/android/src/main/java/com/blaze/rtnblazesdk/utils/FollowEntityExtractUtils.kt +55 -0
  24. package/android/src/main/java/com/blaze/rtnblazesdk/utils/GeneralExtractExtensions.kt +32 -0
  25. package/android/src/main/java/com/blaze/rtnblazesdk/utils/MapExtensions.kt +13 -0
  26. package/android/src/main/java/com/blaze/rtnblazesdk/utils/WidgetViewExtensions.kt +17 -0
  27. package/blaze-rtn-sdk.podspec +1 -1
  28. package/ios/Sources/BlazeNativeSDKModule/BlazeNativeSDKModule.m +35 -3
  29. package/ios/Sources/BlazeNativeSDKModule/BlazeNativeSDKModule.swift +136 -13
  30. package/ios/Sources/BlazeNativeSDKModule/BlazeSdkModuleRepo.swift +5 -0
  31. package/ios/Sources/BlazeNativeSDKModule/RTNBlazeSdkModule+AppEvents.swift +25 -2
  32. package/ios/Sources/LayoutCustomization/MomentsPlayer/BlazeReactMomentsPlayerStyle.swift +2 -0
  33. package/ios/Sources/LayoutCustomization/MomentsPlayer/BlazeReactMomentsPlayerStyleMerger.swift +12 -0
  34. package/ios/Sources/LayoutCustomization/Shared/SharedStyleModels.swift +1 -0
  35. package/ios/Sources/LayoutCustomization/Shared/SharedStyleModelsMerger.swift +17 -1
  36. package/ios/Sources/LayoutCustomization/StoriesPlayer/BlazeReactStoriesPlayerStyle.swift +9 -0
  37. package/ios/Sources/LayoutCustomization/StoriesPlayer/BlazeReactStoriesPlayerStyleMerger.swift +14 -0
  38. package/ios/Sources/LayoutCustomization/TabsStyle/BlazeReactPlayerTabsStyle.swift +2 -0
  39. package/ios/Sources/LayoutCustomization/TabsStyle/BlazeReactPlayerTabsStyleMerger.swift +2 -0
  40. package/ios/Sources/LayoutCustomization/VideoPlayer/BlazeReactVideosPlayerStyle.swift +5 -4
  41. package/ios/Sources/LayoutCustomization/VideoPlayer/BlazeReactVideosPlayerStyleMerger.swift +15 -4
  42. package/ios/Sources/LayoutCustomization/WidgetLayout/BlazeReactWidgetLayout.swift +23 -0
  43. package/ios/Sources/LayoutCustomization/WidgetLayout/BlazeReactWidgetLayoutMerger.swift +44 -0
  44. package/ios/Sources/Utils/BlazeReactParamsParser.swift +49 -0
  45. package/ios/Sources/Utils/EventParamsBuilder.swift +71 -3
  46. package/ios/Sources/Utils/FollowEntityExtractUtils.swift +86 -0
  47. package/ios/Sources/Widgets/Base/BlazeWidgetBase.swift +91 -5
  48. package/ios/Sources/Widgets/Base/BlazeWidgetViewManagerBase.h +6 -0
  49. package/lib/commonjs/NativeBlazeSdk.js +33 -5
  50. package/lib/commonjs/NativeBlazeSdk.js.map +1 -1
  51. package/lib/commonjs/classes/base-player-delegate.js +47 -0
  52. package/lib/commonjs/classes/base-player-delegate.js.map +1 -1
  53. package/lib/commonjs/classes/entry-point-delegate.js +22 -0
  54. package/lib/commonjs/classes/entry-point-delegate.js.map +1 -1
  55. package/lib/commonjs/classes/follow-entities-delegate.js +13 -1
  56. package/lib/commonjs/classes/follow-entities-delegate.js.map +1 -1
  57. package/lib/commonjs/index.js.map +1 -1
  58. package/lib/commonjs/interfaces/content-entitlements.interface.js +25 -0
  59. package/lib/commonjs/interfaces/content-entitlements.interface.js.map +1 -0
  60. package/lib/commonjs/interfaces/index.js +11 -0
  61. package/lib/commonjs/interfaces/index.js.map +1 -1
  62. package/lib/commonjs/widgets/BlazeBaseWidgetComponent.js +34 -8
  63. package/lib/commonjs/widgets/BlazeBaseWidgetComponent.js.map +1 -1
  64. package/lib/commonjs/widgets/BlazeMomentsTabsWidgetView.js +29 -13
  65. package/lib/commonjs/widgets/BlazeMomentsTabsWidgetView.js.map +1 -1
  66. package/lib/module/NativeBlazeSdk.js +32 -4
  67. package/lib/module/NativeBlazeSdk.js.map +1 -1
  68. package/lib/module/classes/base-player-delegate.js +47 -0
  69. package/lib/module/classes/base-player-delegate.js.map +1 -1
  70. package/lib/module/classes/entry-point-delegate.js +22 -0
  71. package/lib/module/classes/entry-point-delegate.js.map +1 -1
  72. package/lib/module/classes/follow-entities-delegate.js +14 -1
  73. package/lib/module/classes/follow-entities-delegate.js.map +1 -1
  74. package/lib/module/index.js.map +1 -1
  75. package/lib/module/interfaces/content-entitlements.interface.js +19 -0
  76. package/lib/module/interfaces/content-entitlements.interface.js.map +1 -0
  77. package/lib/module/interfaces/index.js +1 -0
  78. package/lib/module/interfaces/index.js.map +1 -1
  79. package/lib/module/widgets/BlazeBaseWidgetComponent.js +34 -8
  80. package/lib/module/widgets/BlazeBaseWidgetComponent.js.map +1 -1
  81. package/lib/module/widgets/BlazeMomentsTabsWidgetView.js +30 -14
  82. package/lib/module/widgets/BlazeMomentsTabsWidgetView.js.map +1 -1
  83. package/lib/typescript/NativeBlazeSdk.d.ts +44 -1
  84. package/lib/typescript/NativeBlazeSdk.d.ts.map +1 -1
  85. package/lib/typescript/classes/base-player-delegate.d.ts +34 -1
  86. package/lib/typescript/classes/base-player-delegate.d.ts.map +1 -1
  87. package/lib/typescript/classes/entry-point-delegate.d.ts +2 -0
  88. package/lib/typescript/classes/entry-point-delegate.d.ts.map +1 -1
  89. package/lib/typescript/classes/follow-entities-delegate.d.ts +35 -0
  90. package/lib/typescript/classes/follow-entities-delegate.d.ts.map +1 -1
  91. package/lib/typescript/classes/player-container-tabs-delegate.d.ts +11 -0
  92. package/lib/typescript/classes/player-container-tabs-delegate.d.ts.map +1 -1
  93. package/lib/typescript/index.d.ts +2 -2
  94. package/lib/typescript/index.d.ts.map +1 -1
  95. package/lib/typescript/interfaces/common.interface.d.ts +12 -0
  96. package/lib/typescript/interfaces/common.interface.d.ts.map +1 -1
  97. package/lib/typescript/interfaces/content-entitlements.interface.d.ts +26 -0
  98. package/lib/typescript/interfaces/content-entitlements.interface.d.ts.map +1 -0
  99. package/lib/typescript/interfaces/index.d.ts +1 -0
  100. package/lib/typescript/interfaces/index.d.ts.map +1 -1
  101. package/lib/typescript/interfaces/init-options.interface.d.ts +14 -0
  102. package/lib/typescript/interfaces/init-options.interface.d.ts.map +1 -1
  103. package/lib/typescript/interfaces/moments-player-style.d.ts +13 -0
  104. package/lib/typescript/interfaces/moments-player-style.d.ts.map +1 -1
  105. package/lib/typescript/interfaces/moments-widget-tabs-configuration.d.ts +13 -0
  106. package/lib/typescript/interfaces/moments-widget-tabs-configuration.d.ts.map +1 -1
  107. package/lib/typescript/interfaces/stories-player-style.d.ts +12 -0
  108. package/lib/typescript/interfaces/stories-player-style.d.ts.map +1 -1
  109. package/lib/typescript/interfaces/videos-player-style.d.ts +30 -8
  110. package/lib/typescript/interfaces/videos-player-style.d.ts.map +1 -1
  111. package/lib/typescript/interfaces/widget-layout.interface.d.ts +52 -1
  112. package/lib/typescript/interfaces/widget-layout.interface.d.ts.map +1 -1
  113. package/lib/typescript/interfaces/widget-presets.d.ts +6 -0
  114. package/lib/typescript/interfaces/widget-presets.d.ts.map +1 -1
  115. package/lib/typescript/interfaces/widgets-props.interface.d.ts +18 -0
  116. package/lib/typescript/interfaces/widgets-props.interface.d.ts.map +1 -1
  117. package/lib/typescript/widgets/BlazeBaseWidgetComponent.d.ts +6 -0
  118. package/lib/typescript/widgets/BlazeBaseWidgetComponent.d.ts.map +1 -1
  119. package/lib/typescript/widgets/BlazeBaseWidgetViewProps.d.ts +13 -1
  120. package/lib/typescript/widgets/BlazeBaseWidgetViewProps.d.ts.map +1 -1
  121. package/lib/typescript/widgets/BlazeMomentsTabsWidgetView.d.ts +11 -0
  122. package/lib/typescript/widgets/BlazeMomentsTabsWidgetView.d.ts.map +1 -1
  123. package/package.json +1 -1
  124. package/src/NativeBlazeSdk.tsx +109 -9
  125. package/src/classes/base-player-delegate.tsx +92 -0
  126. package/src/classes/entry-point-delegate.tsx +37 -1
  127. package/src/classes/follow-entities-delegate.tsx +40 -1
  128. package/src/classes/player-container-tabs-delegate.tsx +11 -0
  129. package/src/index.tsx +10 -1
  130. package/src/interfaces/common.interface.tsx +13 -0
  131. package/src/interfaces/content-entitlements.interface.tsx +42 -0
  132. package/src/interfaces/index.tsx +1 -0
  133. package/src/interfaces/init-options.interface.tsx +15 -0
  134. package/src/interfaces/moments-player-style.tsx +15 -0
  135. package/src/interfaces/moments-widget-tabs-configuration.tsx +13 -0
  136. package/src/interfaces/stories-player-style.tsx +13 -0
  137. package/src/interfaces/videos-player-style.tsx +31 -8
  138. package/src/interfaces/widget-layout.interface.tsx +56 -1
  139. package/src/interfaces/widget-presets.tsx +6 -0
  140. package/src/interfaces/widgets-props.interface.tsx +21 -0
  141. package/src/widgets/BlazeBaseWidgetComponent.tsx +60 -8
  142. package/src/widgets/BlazeBaseWidgetViewProps.tsx +16 -0
  143. package/src/widgets/BlazeMomentsTabsWidgetView.tsx +30 -33
@@ -6,7 +6,7 @@ buildscript {
6
6
  blaze_default_compileSdkVersion = 35
7
7
  blaze_default_minSdkVersion = 24
8
8
  blaze_default_kotlin_version = '2.0.21'
9
- blazesdk_version = '1.20.4'
9
+ blazesdk_version = '1.21.4'
10
10
  blaze_gson_version = '2.10.1'
11
11
  }
12
12
 
@@ -11,13 +11,16 @@ import com.blaze.blazesdk.delegates.BlazePlayerEntryPointDelegate
11
11
  import com.blaze.blazesdk.delegates.BlazeSDKDelegate
12
12
  import com.blaze.blazesdk.delegates.models.BlazeCTAActionType
13
13
  import com.blaze.blazesdk.delegates.models.BlazeFollowEntityClickedParams
14
+ import com.blaze.blazesdk.delegates.models.BlazeInteractionLinkHandleType
14
15
  import com.blaze.blazesdk.delegates.models.BlazePlaybackModificationRequest
15
16
  import com.blaze.blazesdk.delegates.models.BlazePlaybackModificationResponse
16
17
  import com.blaze.blazesdk.style.shared.models.BlazePlayerCustomActionButtonParams
17
18
  import com.blaze.blazesdk.delegates.models.BlazePlayerEvent
18
19
  import com.blaze.blazesdk.delegates.models.BlazePlayerType
20
+ import com.blaze.blazesdk.delegates.models.BlazeRestrictedContentParams
19
21
  import com.blaze.blazesdk.delegates.models.BlazeShareParams
20
- import com.blaze.blazesdk.follow.models.BlazeFollowEntity
22
+ import com.blaze.blazesdk.entitlements.models.BlazeContentRestrictionHandleType
23
+ import com.blaze.blazesdk.entitlements.models.BlazeContentRestrictionReason
21
24
  import com.blaze.blazesdk.external_modules.BlazeExternalModulesBinder
22
25
  import com.blaze.blazesdk.features.moments.models.configuration.BlazeMomentsLoopBehavior
23
26
  import com.blaze.blazesdk.features.moments.models.configuration.BlazeMomentsPlaybackConfiguration
@@ -34,7 +37,11 @@ import com.blaze.rtnblazesdk.shared.blazeAsyncBridge
34
37
  import com.blaze.rtnblazesdk.shared.callJSMethod
35
38
  import com.blaze.rtnblazesdk.utils.extractCachingLevel
36
39
  import com.blaze.rtnblazesdk.utils.extractLayoutDirection
40
+ import com.blaze.rtnblazesdk.utils.extractPlayerType
37
41
  import com.blaze.rtnblazesdk.utils.extractDataSource
42
+ import com.blaze.rtnblazesdk.utils.extractFetchedContentPolicy
43
+ import com.blaze.rtnblazesdk.utils.extractFollowEntities
44
+ import com.blaze.rtnblazesdk.utils.extractInteractionLinkHandleType
38
45
  import com.blaze.rtnblazesdk.utils.extractMomentsPlayerStyle
39
46
  import com.blaze.rtnblazesdk.utils.extractStoriesPlayerStyle
40
47
  import com.blaze.rtnblazesdk.utils.extractMomentsPlaybackConfiguration
@@ -43,8 +50,11 @@ import com.blaze.rtnblazesdk.utils.extractVideosFilterParams
43
50
  import com.blaze.rtnblazesdk.utils.extractVideosPlaybackConfiguration
44
51
  import com.blaze.rtnblazesdk.utils.extractVideosPlayerStyle
45
52
  import com.blaze.rtnblazesdk.utils.getBooleanOrNull
53
+ import com.blaze.rtnblazesdk.utils.getStringOrNull
46
54
  import com.blaze.rtnblazesdk.utils.handleResult
47
55
  import com.blaze.rtnblazesdk.utils.rejectWith
56
+ import com.blaze.rtnblazesdk.utils.runOnWidgetView
57
+ import com.blaze.rtnblazesdk.utils.toReactValue
48
58
  import com.facebook.proguard.annotations.DoNotStrip
49
59
  import com.facebook.react.bridge.NoSuchKeyException
50
60
  import com.facebook.react.bridge.Arguments
@@ -140,6 +150,19 @@ class BlazeSdkModule(private val context: ReactApplicationContext): ReactContext
140
150
  return BlazeLinkActionHandleType.DEEPLINK
141
151
  }
142
152
 
153
+ override fun onTriggerInteractionLink(
154
+ playerType: BlazePlayerType,
155
+ sourceId: String?,
156
+ interactionId: String,
157
+ interactionType: String,
158
+ url: String
159
+ ): BlazeInteractionLinkHandleType {
160
+ val event = SdkModuleJsEvent.TriggerInteractionLink(playerType, sourceId, interactionId, interactionType, url)
161
+ sendJsEvent(event)
162
+ return BlazeSdkModuleRepo.interactionLinkHandling
163
+ ?: super.onTriggerInteractionLink(playerType, sourceId, interactionId, interactionType, url)
164
+ }
165
+
143
166
  override fun onPlayerEventTriggered(
144
167
  playerType: BlazePlayerType,
145
168
  sourceId: String?,
@@ -178,6 +201,17 @@ class BlazeSdkModule(private val context: ReactApplicationContext): ReactContext
178
201
  return null
179
202
  }
180
203
 
204
+ override fun onContentRestricted(
205
+ playerType: BlazePlayerType,
206
+ sourceId: String?,
207
+ reason: BlazeContentRestrictionReason,
208
+ contentParams: BlazeRestrictedContentParams
209
+ ): BlazeContentRestrictionHandleType {
210
+ val event = SdkModuleJsEvent.ContentRestricted(playerType, sourceId, reason, contentParams)
211
+ sendJsEvent(event)
212
+ return super.onContentRestricted(playerType, sourceId, reason, contentParams)
213
+ }
214
+
181
215
  override fun onReadStatusChanged(
182
216
  playerType: BlazePlayerType,
183
217
  sourceId: String?,
@@ -196,7 +230,7 @@ class BlazeSdkModule(private val context: ReactApplicationContext): ReactContext
196
230
  playerType = followEntityParams.playerType,
197
231
  sourceId = followEntityParams.sourceId,
198
232
  newFollowingState = followEntityParams.newFollowingState,
199
- followEntityId = followEntityParams.followEntity.entityId
233
+ followEntity = followEntityParams.followEntity
200
234
  )
201
235
  sendJsEvent(event)
202
236
  }
@@ -237,6 +271,7 @@ class BlazeSdkModule(private val context: ReactApplicationContext): ReactContext
237
271
 
238
272
  val cachingLevel = options.extractCachingLevel() ?: BlazeCachingLevel.DEFAULT
239
273
  BlazeSdkModuleRepo.cachingLevel = cachingLevel
274
+ BlazeSdkModuleRepo.interactionLinkHandling = options.extractInteractionLinkHandleType()
240
275
 
241
276
  val forceLayoutDirection = options.extractLayoutDirection()
242
277
 
@@ -247,6 +282,7 @@ class BlazeSdkModule(private val context: ReactApplicationContext): ReactContext
247
282
  cachingSize = options.getInt(KEY_INIT_CACHING_SIZE),
248
283
  cachingLevel = cachingLevel,
249
284
  forceLayoutDirection = forceLayoutDirection,
285
+ externalUserToken = options.getString(KEY_INIT_EXTERNAL_USER_TOKEN),
250
286
  completionBlock = {
251
287
  promise.resolve(BlazeResult.Success(true).toString())
252
288
  },
@@ -288,6 +324,10 @@ class BlazeSdkModule(private val context: ReactApplicationContext): ReactContext
288
324
  return getString(KEY_INIT_FORCE_LAYOUT_DIRECTION)?.extractLayoutDirection()
289
325
  }
290
326
 
327
+ private fun ReadableMap.extractInteractionLinkHandleType(): BlazeInteractionLinkHandleType? {
328
+ return getStringOrNull(KEY_INIT_INTERACTION_LINK_HANDLING)?.extractInteractionLinkHandleType()
329
+ }
330
+
291
331
  private fun setAppOverrideCtaHandling(options: ReadableMap) {
292
332
  // getBoolean can throw exception while getString will return null if no such key
293
333
  try {
@@ -712,6 +752,20 @@ class BlazeSdkModule(private val context: ReactApplicationContext): ReactContext
712
752
  }
713
753
  }
714
754
 
755
+ @ReactMethod
756
+ @DoNotStrip
757
+ fun isInColdStart(playerType: String?, promise: Promise) {
758
+ try {
759
+ val nativePlayerType = playerType?.extractPlayerType() ?: run {
760
+ promise.rejectWith("Invalid BlazePlayerType '$playerType'. Expected 'Moments', 'Stories' or 'Videos'.")
761
+ return
762
+ }
763
+ promise.resolve(BlazeSDK.isInColdStart(nativePlayerType))
764
+ } catch (e: Exception) {
765
+ promise.rejectWith(e.toString())
766
+ }
767
+ }
768
+
715
769
  @ReactMethod
716
770
  @DoNotStrip
717
771
  fun dismissPlayer(promise: Promise) {
@@ -733,6 +787,22 @@ class BlazeSdkModule(private val context: ReactApplicationContext): ReactContext
733
787
  }
734
788
  }
735
789
 
790
+ @ReactMethod
791
+ @DoNotStrip
792
+ fun setExternalUserToken(externalUserToken: String?, cachedContentPolicy: String?, promise: Promise) {
793
+ val policy = cachedContentPolicy?.extractFetchedContentPolicy() ?: run {
794
+ promise.rejectWith("Invalid cachedContentPolicy for setExternalUserToken. Expected 'Keep' or 'Evict'.")
795
+ return
796
+ }
797
+ try {
798
+ BlazeSDK.setExternalUserToken(externalUserToken, policy) { result ->
799
+ promise.handleResult(result)
800
+ }
801
+ } catch (e: Exception) {
802
+ promise.rejectWith("setExternalUserToken failed: ${e.javaClass.simpleName}")
803
+ }
804
+ }
805
+
736
806
  @ReactMethod
737
807
  @DoNotStrip
738
808
  fun setDoNotTrack(doNotTrack: Boolean, promise: Promise) {
@@ -747,6 +817,18 @@ class BlazeSdkModule(private val context: ReactApplicationContext): ReactContext
747
817
  promise.resolve(disableAnalytics)
748
818
  }
749
819
 
820
+ @ReactMethod
821
+ @DoNotStrip
822
+ fun setLiquidGlassEnabled(enabled: Boolean, promise: Promise) {
823
+ promise.resolve(null)
824
+ }
825
+
826
+ @ReactMethod
827
+ @DoNotStrip
828
+ fun isLiquidGlassEnabled(promise: Promise) {
829
+ promise.resolve(false)
830
+ }
831
+
750
832
  @ReactMethod
751
833
  @DoNotStrip
752
834
  fun handleUniversalLink(link: String, promise: Promise) {
@@ -812,10 +894,13 @@ class BlazeSdkModule(private val context: ReactApplicationContext): ReactContext
812
894
 
813
895
  @ReactMethod
814
896
  @DoNotStrip
815
- fun setFollowedEntities(entityIds: ReadableArray, promise: Promise) {
897
+ fun setFollowedEntities(entities: ReadableArray, promise: Promise) {
816
898
  try {
817
- val entities = (0 until entityIds.size()).mapNotNull { entityIds.getString(it)?.let { id -> BlazeFollowEntity(id) } }.toSet()
818
- BlazeSDK.followEntitiesManager.setFollowedEntities(entities)
899
+ val followEntities = entities.extractFollowEntities() ?: run {
900
+ promise.rejectWith("setFollowedEntities: every entry must be a string id or an object with a string id")
901
+ return
902
+ }
903
+ BlazeSDK.followEntitiesManager.setFollowedEntities(followEntities)
819
904
  promise.resolve(null)
820
905
  } catch (e: Exception) {
821
906
  promise.rejectWith(e.toString())
@@ -824,10 +909,13 @@ class BlazeSdkModule(private val context: ReactApplicationContext): ReactContext
824
909
 
825
910
  @ReactMethod
826
911
  @DoNotStrip
827
- fun insertFollowedEntities(entityIds: ReadableArray, promise: Promise) {
912
+ fun insertFollowedEntities(entities: ReadableArray, promise: Promise) {
828
913
  try {
829
- val entities = (0 until entityIds.size()).mapNotNull { entityIds.getString(it)?.let { id -> BlazeFollowEntity(id) } }.toSet()
830
- BlazeSDK.followEntitiesManager.insertFollowedEntities(entities)
914
+ val followEntities = entities.extractFollowEntities() ?: run {
915
+ promise.rejectWith("insertFollowedEntities: every entry must be a string id or an object with a string id")
916
+ return
917
+ }
918
+ BlazeSDK.followEntitiesManager.insertFollowedEntities(followEntities)
831
919
  promise.resolve(null)
832
920
  } catch (e: Exception) {
833
921
  promise.rejectWith(e.toString())
@@ -836,10 +924,13 @@ class BlazeSdkModule(private val context: ReactApplicationContext): ReactContext
836
924
 
837
925
  @ReactMethod
838
926
  @DoNotStrip
839
- fun removeFollowedEntities(entityIds: ReadableArray, promise: Promise) {
927
+ fun removeFollowedEntities(entities: ReadableArray, promise: Promise) {
840
928
  try {
841
- val entities = (0 until entityIds.size()).mapNotNull { entityIds.getString(it)?.let { id -> BlazeFollowEntity(id) } }.toSet()
842
- BlazeSDK.followEntitiesManager.removeFollowedEntities(entities)
929
+ val followEntities = entities.extractFollowEntities() ?: run {
930
+ promise.rejectWith("removeFollowedEntities: every entry must be a string id or an object with a string id")
931
+ return
932
+ }
933
+ BlazeSDK.followEntitiesManager.removeFollowedEntities(followEntities)
843
934
  promise.resolve(null)
844
935
  } catch (e: Exception) {
845
936
  promise.rejectWith(e.toString())
@@ -851,10 +942,10 @@ class BlazeSdkModule(private val context: ReactApplicationContext): ReactContext
851
942
  fun getFollowedEntities(promise: Promise) {
852
943
  try {
853
944
  val entities = BlazeSDK.followEntitiesManager.getFollowedEntities()
854
- val ids = Arguments.createArray().apply {
855
- entities.forEach { pushString(it.entityId) }
945
+ val result = Arguments.createArray().apply {
946
+ entities.forEach { pushMap(it.toReactValue()) }
856
947
  }
857
- promise.resolve(ids)
948
+ promise.resolve(result)
858
949
  } catch (e: Exception) {
859
950
  promise.rejectWith(e.toString())
860
951
  }
@@ -901,6 +992,31 @@ class BlazeSdkModule(private val context: ReactApplicationContext): ReactContext
901
992
  promise.resolve(BlazeSDK.pipManager.isActive)
902
993
  }
903
994
 
995
+ @ReactMethod
996
+ @DoNotStrip
997
+ fun reloadAllMomentsTabs(viewTag: Int) {
998
+ context.runOnWidgetView(viewTag) { it.reloadAllTabs() }
999
+ }
1000
+
1001
+ @ReactMethod
1002
+ @DoNotStrip
1003
+ fun reloadNonActiveMomentsTabs(viewTag: Int) {
1004
+ context.runOnWidgetView(viewTag) { it.reloadNonActiveTabs() }
1005
+ }
1006
+
1007
+ @ReactMethod
1008
+ @DoNotStrip
1009
+ fun reloadMomentsTab(viewTag: Int, at: Int) {
1010
+ context.runOnWidgetView(viewTag) { it.reloadTab(at = at) }
1011
+ }
1012
+
1013
+ @ReactMethod
1014
+ @DoNotStrip
1015
+ fun reloadMomentsTabByContainerId(viewTag: Int, containerId: String?) {
1016
+ val id = containerId ?: return
1017
+ context.runOnWidgetView(viewTag) { it.reloadTabByContainerId(id) }
1018
+ }
1019
+
904
1020
  companion object {
905
1021
  const val NAME = "RTNBlazeSdk"
906
1022
 
@@ -908,11 +1024,13 @@ class BlazeSdkModule(private val context: ReactApplicationContext): ReactContext
908
1024
 
909
1025
  const val KEY_INIT_API_KEY = "apiKey"
910
1026
  const val KEY_INIT_EXTERNAL_USER_ID = "externalUserId"
1027
+ const val KEY_INIT_EXTERNAL_USER_TOKEN = "externalUserToken"
911
1028
  const val KEY_INIT_GEO_LOCATION = "geoLocation"
912
1029
  const val KEY_INIT_CACHING_SIZE = "cachingSize"
913
1030
  const val KEY_INIT_CACHING_LEVEL = "cachingLevel"
914
1031
  const val KEY_INIT_FORCE_LAYOUT_DIRECTION = "forceLayoutDirection"
915
1032
  const val KEY_INIT_APP_OVERRIDES_CTA_HANDLING = "appOverridesCTAHandling"
1033
+ const val KEY_INIT_INTERACTION_LINK_HANDLING = "interactionLinkHandling"
916
1034
  const val KEY_INIT_DEFAULT_STORY_PLAYER_STYLE = "defaultStoryPlayerStyle"
917
1035
  const val KEY_INIT_DEFAULT_MOMENT_PLAYER_STYLE = "defaultMomentsPlayerStyle"
918
1036
  const val KEY_INIT_DEFAULT_VIDEO_PLAYER_STYLE = "defaultVideosPlayerStyle"
@@ -1,7 +1,9 @@
1
1
  package com.blaze.rtnblazesdk
2
2
 
3
+ import com.blaze.blazesdk.delegates.models.BlazeInteractionLinkHandleType
3
4
  import com.blaze.blazesdk.prefetch.models.BlazeCachingLevel
4
5
 
5
6
  object BlazeSdkModuleRepo {
6
7
  var cachingLevel: BlazeCachingLevel? = null
8
+ var interactionLinkHandling: BlazeInteractionLinkHandleType? = null
7
9
  }
@@ -9,9 +9,13 @@ import com.blaze.blazesdk.data_source.BlazeDataSourceType
9
9
  import com.blaze.blazesdk.delegates.BlazePlayerContainerTabsDelegate
10
10
  import com.blaze.blazesdk.delegates.BlazeWidgetDelegate
11
11
  import com.blaze.blazesdk.delegates.models.BlazeCTAActionType
12
+ import com.blaze.blazesdk.delegates.models.BlazeInteractionLinkHandleType
12
13
  import com.blaze.blazesdk.delegates.models.BlazePlayerEvent
13
14
  import com.blaze.blazesdk.delegates.models.BlazePlayerType
15
+ import com.blaze.blazesdk.delegates.models.BlazeRestrictedContentParams
14
16
  import com.blaze.blazesdk.delegates.models.BlazeShareParams
17
+ import com.blaze.blazesdk.entitlements.models.BlazeContentRestrictionHandleType
18
+ import com.blaze.blazesdk.entitlements.models.BlazeContentRestrictionReason
15
19
  import com.blaze.blazesdk.extentions.blazeDeepCopy
16
20
  import com.blaze.blazesdk.features.shared.models.ui_shared.BlazeLinkActionHandleType
17
21
  import com.blaze.blazesdk.prefetch.models.BlazeCachingLevel
@@ -26,12 +30,14 @@ import com.blaze.rtnblazesdk.customization.mergedWith
26
30
  import com.blaze.rtnblazesdk.events.MomentsContainerTabsEvent
27
31
  import com.blaze.rtnblazesdk.events.MomentsContainerTabsEventNames
28
32
  import com.blaze.rtnblazesdk.events.WidgetCTAClickEvent
33
+ import com.blaze.rtnblazesdk.events.WidgetContentRestrictedEvent
29
34
  import com.blaze.rtnblazesdk.events.WidgetDataLoadCompletedEvent
30
35
  import com.blaze.rtnblazesdk.events.WidgetDataLoadStartedEvent
31
36
  import com.blaze.rtnblazesdk.events.WidgetHeightChangedEvent
32
37
  import com.blaze.rtnblazesdk.events.WidgetItemClickedEvent
33
38
  import com.blaze.rtnblazesdk.events.WidgetCustomActionButtonEvent
34
39
  import com.blaze.rtnblazesdk.events.WidgetOnPlayerEventTriggered
40
+ import com.blaze.rtnblazesdk.events.WidgetOnTriggerInteractionLinkEvent
35
41
  import com.blaze.rtnblazesdk.events.WidgetOnTriggerPlayerBodyTextLinkEvent
36
42
  import com.blaze.rtnblazesdk.events.WidgetPlayerDidAppearEvent
37
43
  import com.blaze.rtnblazesdk.events.WidgetPlayerDismissedEvent
@@ -40,6 +46,7 @@ import com.blaze.blazesdk.style.shared.models.BlazePlayerCustomActionButtonParam
40
46
  import com.blaze.rtnblazesdk.utils.EventParamsBuilder
41
47
  import com.blaze.rtnblazesdk.utils.extractCachingLevel
42
48
  import com.blaze.rtnblazesdk.utils.extractDataSource
49
+ import com.blaze.rtnblazesdk.utils.extractInteractionLinkHandleType
43
50
  import com.blaze.rtnblazesdk.utils.getBooleanOrNull
44
51
  import com.blaze.rtnblazesdk.utils.isNotEmpty
45
52
  import com.blaze.rtnblazesdk.utils.parsing.fromJsonString
@@ -80,6 +87,7 @@ abstract class BaseWidgetView @JvmOverloads constructor(
80
87
  var perItemStyleOverridesReadableMap: ReadableMap? = null
81
88
  var presetWidgetLayoutString: String? = null
82
89
  var appOverridesCTAHandling: Boolean = false
90
+ var reactInteractionLinkHandling: String? = null
83
91
  var shouldOrderWidgetByReadStatus: Boolean = true
84
92
  var reactWidgetLayoutStyleMap: ReadableMap? = null
85
93
  var reactWidgetPlayerStyleMap: ReadableMap? = null
@@ -101,6 +109,9 @@ abstract class BaseWidgetView @JvmOverloads constructor(
101
109
  val cachingLevel: BlazeCachingLevel
102
110
  get() = reactCachingLevel?.extractCachingLevel() ?: BlazeSdkModuleRepo.cachingLevel ?: BlazeCachingLevel.DEFAULT
103
111
 
112
+ private val declaredInteractionLinkHandling: BlazeInteractionLinkHandleType?
113
+ get() = reactInteractionLinkHandling?.extractInteractionLinkHandleType() ?: BlazeSdkModuleRepo.interactionLinkHandling
114
+
104
115
  protected val widgetDelegate =
105
116
  object : BlazeWidgetDelegate {
106
117
  override fun onDataLoadStarted(playerType: BlazePlayerType, sourceId: String?) {
@@ -191,6 +202,28 @@ abstract class BaseWidgetView @JvmOverloads constructor(
191
202
  return BlazeLinkActionHandleType.DEEPLINK
192
203
  }
193
204
 
205
+ override fun onTriggerInteractionLink(
206
+ playerType: BlazePlayerType,
207
+ sourceId: String?,
208
+ interactionId: String,
209
+ interactionType: String,
210
+ url: String
211
+ ): BlazeInteractionLinkHandleType {
212
+ dispatchEvent(
213
+ WidgetOnTriggerInteractionLinkEvent(
214
+ UIManagerHelper.getSurfaceId(context),
215
+ id,
216
+ playerType = playerType,
217
+ sourceId = sourceId,
218
+ interactionId = interactionId,
219
+ interactionType = interactionType,
220
+ url = url
221
+ )
222
+ )
223
+ return declaredInteractionLinkHandling
224
+ ?: super.onTriggerInteractionLink(playerType, sourceId, interactionId, interactionType, url)
225
+ }
226
+
194
227
  override fun onPlayerEventTriggered(
195
228
  playerType: BlazePlayerType,
196
229
  sourceId: String?,
@@ -252,6 +285,25 @@ abstract class BaseWidgetView @JvmOverloads constructor(
252
285
  // Observer-only: not currently supported for bridging out to React side (see plan.md ## Decisions).
253
286
  return null
254
287
  }
288
+
289
+ override fun onContentRestricted(
290
+ playerType: BlazePlayerType,
291
+ sourceId: String?,
292
+ reason: BlazeContentRestrictionReason,
293
+ contentParams: BlazeRestrictedContentParams
294
+ ): BlazeContentRestrictionHandleType {
295
+ dispatchEvent(
296
+ WidgetContentRestrictedEvent(
297
+ UIManagerHelper.getSurfaceId(context),
298
+ id,
299
+ playerType = playerType,
300
+ sourceId = sourceId,
301
+ reason = reason,
302
+ contentParams = contentParams
303
+ )
304
+ )
305
+ return super.onContentRestricted(playerType, sourceId, reason, contentParams)
306
+ }
255
307
  }
256
308
 
257
309
  /**
@@ -320,6 +372,21 @@ abstract class BaseWidgetView @JvmOverloads constructor(
320
372
  return BlazeLinkActionHandleType.DEEPLINK
321
373
  }
322
374
 
375
+ override fun onTriggerInteractionLink(
376
+ playerType: BlazePlayerType,
377
+ sourceId: String?,
378
+ interactionId: String,
379
+ interactionType: String,
380
+ url: String
381
+ ): BlazeInteractionLinkHandleType {
382
+ dispatchTabsEvent(
383
+ MomentsContainerTabsEventNames.TRIGGER_INTERACTION_LINK,
384
+ EventParamsBuilder.buildTriggerInteractionLinkParams(playerType, sourceId, interactionId, interactionType, url)
385
+ )
386
+ return declaredInteractionLinkHandling
387
+ ?: super.onTriggerInteractionLink(playerType, sourceId, interactionId, interactionType, url)
388
+ }
389
+
323
390
  override fun onPlayerEventTriggered(
324
391
  playerType: BlazePlayerType,
325
392
  sourceId: String?,
@@ -353,6 +420,17 @@ abstract class BaseWidgetView @JvmOverloads constructor(
353
420
  )
354
421
  }
355
422
 
423
+ override fun onTabReselected(
424
+ playerType: BlazePlayerType,
425
+ sourceId: String?,
426
+ tabIndex: Int
427
+ ) {
428
+ dispatchTabsEvent(
429
+ MomentsContainerTabsEventNames.TAB_RESELECTED,
430
+ EventParamsBuilder.buildTabSelectedParams(playerType, sourceId, tabIndex)
431
+ )
432
+ }
433
+
356
434
  override fun onShareClicked(
357
435
  playerType: BlazePlayerType,
358
436
  sourceId: String?,
@@ -366,6 +444,19 @@ abstract class BaseWidgetView @JvmOverloads constructor(
366
444
  return null
367
445
  }
368
446
 
447
+ override fun onContentRestricted(
448
+ playerType: BlazePlayerType,
449
+ sourceId: String?,
450
+ reason: BlazeContentRestrictionReason,
451
+ contentParams: BlazeRestrictedContentParams
452
+ ): BlazeContentRestrictionHandleType {
453
+ dispatchTabsEvent(
454
+ MomentsContainerTabsEventNames.CONTENT_RESTRICTED,
455
+ EventParamsBuilder.buildContentRestrictedParams(playerType, sourceId, reason, contentParams)
456
+ )
457
+ return super.onContentRestricted(playerType, sourceId, reason, contentParams)
458
+ }
459
+
369
460
  // `onSearchButtonClicked` (sync return) is intentionally left at its native default.
370
461
  }
371
462
 
@@ -391,14 +482,7 @@ abstract class BaseWidgetView @JvmOverloads constructor(
391
482
  abstract fun updateWidgetsUi()
392
483
  abstract fun play()
393
484
 
394
- /**
395
- * Moments "widget to tabs" programmatic reload. No-op by default (Stories/Videos, and Moments
396
- * widgets not in tabs mode); overridden by [com.blaze.rtnblazesdk.moments.BlazeMomentsRowView] /
397
- * [com.blaze.rtnblazesdk.moments.BlazeMomentsGridView] to forward to their retained
398
- * `BlazeMomentsWidgetTabsController`. Kept here (rather than as an interface Stories/Videos also
399
- * implement) so the shared [BlazeWidgetViewManager.receiveCommand] dispatch has one call shape,
400
- * while the Moments-only view managers are the only ones that actually register these commands.
401
- */
485
+ /** Moments tabs reload, called by the SDK module and the legacy view commands; no-op unless a Moments row/grid overrides it. */
402
486
  open fun reloadAllTabs() {}
403
487
  open fun reloadNonActiveTabs() {}
404
488
  open fun reloadTab(at: Int) {}
@@ -2,12 +2,14 @@ package com.blaze.rtnblazesdk.base
2
2
 
3
3
  import androidx.annotation.Keep
4
4
  import com.blaze.rtnblazesdk.events.WidgetCTAClickEvent
5
+ import com.blaze.rtnblazesdk.events.WidgetContentRestrictedEvent
5
6
  import com.blaze.rtnblazesdk.events.WidgetCustomActionButtonEvent
6
7
  import com.blaze.rtnblazesdk.events.WidgetDataLoadCompletedEvent
7
8
  import com.blaze.rtnblazesdk.events.WidgetDataLoadStartedEvent
8
9
  import com.blaze.rtnblazesdk.events.WidgetHeightChangedEvent
9
10
  import com.blaze.rtnblazesdk.events.WidgetItemClickedEvent
10
11
  import com.blaze.rtnblazesdk.events.WidgetOnPlayerEventTriggered
12
+ import com.blaze.rtnblazesdk.events.WidgetOnTriggerInteractionLinkEvent
11
13
  import com.blaze.rtnblazesdk.events.WidgetOnTriggerPlayerBodyTextLinkEvent
12
14
  import com.blaze.rtnblazesdk.events.WidgetPlayerDidAppearEvent
13
15
  import com.blaze.rtnblazesdk.events.WidgetPlayerDismissedEvent
@@ -43,9 +45,11 @@ abstract class BlazeWidgetViewManager<TWidget : BaseWidgetView>(
43
45
  WidgetItemClickedEvent.EVENT_NAME to mapOf(Pair(KEY_EVENT_REGISTRATION_NAME, "onItemClickedInternal")),
44
46
  WidgetCTAClickEvent.EVENT_NAME to mapOf(Pair(KEY_EVENT_REGISTRATION_NAME, "onTriggerCTAInternal")),
45
47
  WidgetOnTriggerPlayerBodyTextLinkEvent.EVENT_NAME to mapOf(Pair(KEY_EVENT_REGISTRATION_NAME, "onTriggerPlayerBodyTextLinkInternal")),
48
+ WidgetOnTriggerInteractionLinkEvent.EVENT_NAME to mapOf(Pair(KEY_EVENT_REGISTRATION_NAME, "onTriggerInteractionLinkInternal")),
46
49
  WidgetOnPlayerEventTriggered.EVENT_NAME to mapOf(Pair(KEY_EVENT_REGISTRATION_NAME, "onPlayerEventTriggeredInternal")),
47
50
  WidgetCustomActionButtonEvent.EVENT_NAME to mapOf(Pair(KEY_EVENT_REGISTRATION_NAME, "onTriggerCustomActionButtonInternal")),
48
51
  WidgetShareClickedEvent.EVENT_NAME to mapOf(Pair(KEY_EVENT_REGISTRATION_NAME, "onShareClickedInternal")),
52
+ WidgetContentRestrictedEvent.EVENT_NAME to mapOf(Pair(KEY_EVENT_REGISTRATION_NAME, "onContentRestrictedInternal")),
49
53
  WidgetHeightChangedEvent.EVENT_NAME to mapOf(Pair(KEY_EVENT_REGISTRATION_NAME, "onHeightChangedInternal")),
50
54
  )
51
55
  return map
@@ -102,6 +106,12 @@ abstract class BlazeWidgetViewManager<TWidget : BaseWidgetView>(
102
106
  view.appOverridesCTAHandling = value
103
107
  }
104
108
 
109
+ @Keep
110
+ @ReactProp(name = "interactionLinkHandling")
111
+ fun setInteractionLinkHandling(view: TWidget, value: String?) {
112
+ view.reactInteractionLinkHandling = value
113
+ }
114
+
105
115
  @Keep
106
116
  @ReactProp(name = "blazeWidgetLayout")
107
117
  fun setBlazeWidgetLayout(view: TWidget, value: ReadableMap?) {