@shortkitsdk/react-native 0.2.30 → 0.2.31

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 (28) hide show
  1. package/android/libs/shortkit-release.aar +0 -0
  2. package/ios/ShortKitFeedView.swift +1 -12
  3. package/ios/ShortKitSDK.xcframework/ios-arm64/ShortKitSDK.framework/Info.plist +2 -2
  4. package/ios/ShortKitSDK.xcframework/ios-arm64/ShortKitSDK.framework/Modules/ShortKitSDK.swiftmodule/arm64-apple-ios.abi.json +4646 -954
  5. package/ios/ShortKitSDK.xcframework/ios-arm64/ShortKitSDK.framework/Modules/ShortKitSDK.swiftmodule/arm64-apple-ios.private.swiftinterface +76 -7
  6. package/ios/ShortKitSDK.xcframework/ios-arm64/ShortKitSDK.framework/Modules/ShortKitSDK.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
  7. package/ios/ShortKitSDK.xcframework/ios-arm64/ShortKitSDK.framework/Modules/ShortKitSDK.swiftmodule/arm64-apple-ios.swiftinterface +76 -7
  8. package/ios/ShortKitSDK.xcframework/ios-arm64/ShortKitSDK.framework/ShortKitSDK +0 -0
  9. package/ios/ShortKitSDK.xcframework/ios-arm64/ShortKitSDK.framework/_CodeSignature/CodeResources +9 -9
  10. package/ios/ShortKitSDK.xcframework/ios-arm64_x86_64-simulator/ShortKitSDK.framework/Info.plist +2 -2
  11. package/ios/ShortKitSDK.xcframework/ios-arm64_x86_64-simulator/ShortKitSDK.framework/Modules/ShortKitSDK.swiftmodule/arm64-apple-ios-simulator.abi.json +4646 -954
  12. package/ios/ShortKitSDK.xcframework/ios-arm64_x86_64-simulator/ShortKitSDK.framework/Modules/ShortKitSDK.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +76 -7
  13. package/ios/ShortKitSDK.xcframework/ios-arm64_x86_64-simulator/ShortKitSDK.framework/Modules/ShortKitSDK.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
  14. package/ios/ShortKitSDK.xcframework/ios-arm64_x86_64-simulator/ShortKitSDK.framework/Modules/ShortKitSDK.swiftmodule/arm64-apple-ios-simulator.swiftinterface +76 -7
  15. package/ios/ShortKitSDK.xcframework/ios-arm64_x86_64-simulator/ShortKitSDK.framework/Modules/ShortKitSDK.swiftmodule/x86_64-apple-ios-simulator.abi.json +4646 -954
  16. package/ios/ShortKitSDK.xcframework/ios-arm64_x86_64-simulator/ShortKitSDK.framework/Modules/ShortKitSDK.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +76 -7
  17. package/ios/ShortKitSDK.xcframework/ios-arm64_x86_64-simulator/ShortKitSDK.framework/Modules/ShortKitSDK.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
  18. package/ios/ShortKitSDK.xcframework/ios-arm64_x86_64-simulator/ShortKitSDK.framework/Modules/ShortKitSDK.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +76 -7
  19. package/ios/ShortKitSDK.xcframework/ios-arm64_x86_64-simulator/ShortKitSDK.framework/ShortKitSDK +0 -0
  20. package/ios/ShortKitSDK.xcframework/ios-arm64_x86_64-simulator/ShortKitSDK.framework/_CodeSignature/CodeResources +17 -17
  21. package/ios/ShortKitWidgetNativeView.swift +23 -0
  22. package/ios/ShortKitWidgetNativeViewManager.mm +1 -0
  23. package/package.json +1 -1
  24. package/src/ShortKitWidget.tsx +47 -2
  25. package/src/specs/NativeShortKitModule.ts +7 -0
  26. package/src/specs/ShortKitWidgetViewNativeComponent.ts +6 -0
  27. package/src/types.ts +11 -0
  28. package/ios/DebugPanelView.swift +0 -302
@@ -59,6 +59,7 @@ final public class BandwidthMonitor : ShortKitSDK.BandwidthMonitorProtocol {
59
59
  final public let segmentCache: any ShortKitSDK.SegmentCacheProtocol
60
60
  final public var segmentServer: ShortKitSDK.SegmentHTTPServer?
61
61
  public init(segmentCache: any ShortKitSDK.SegmentCacheProtocol, session: Foundation.URLSession = .shared)
62
+ @objc deinit
62
63
  final public var urlMapping: [Foundation.URL : Foundation.URL] {
63
64
  get
64
65
  }
@@ -73,7 +74,6 @@ final public class BandwidthMonitor : ShortKitSDK.BandwidthMonitorProtocol {
73
74
  final public func cachedRendition(for videoID: Swift.String) -> Swift.String?
74
75
  @objc final public func resourceLoader(_ resourceLoader: AVFoundation.AVAssetResourceLoader, shouldWaitForLoadingOfRequestedResource loadingRequest: AVFoundation.AVAssetResourceLoadingRequest) -> Swift.Bool
75
76
  @objc final public func resourceLoader(_ resourceLoader: AVFoundation.AVAssetResourceLoader, didCancel loadingRequest: AVFoundation.AVAssetResourceLoadingRequest)
76
- @objc deinit
77
77
  }
78
78
  public protocol ColdStartManagerProtocol : Swift.Sendable {
79
79
  func cachedFeedItems() -> [ShortKitSDK.FeedItem]
@@ -152,15 +152,11 @@ final public class SegmentHTTPServer {
152
152
  }
153
153
  public protocol SegmentPrefetcherProtocol : AnyObject {
154
154
  func updateCurrentIndex(_ index: Swift.Int, feedItems: [ShortKitSDK.FeedItem])
155
- func pause()
156
- func resume()
157
155
  }
158
- final public class SegmentPrefetcher : ShortKitSDK.SegmentPrefetcherProtocol {
156
+ @_hasMissingDesignatedInitializers final public class SegmentPrefetcher : ShortKitSDK.SegmentPrefetcherProtocol {
159
157
  public init(cache: any ShortKitSDK.SegmentCacheProtocol, monitor: any ShortKitSDK.BandwidthMonitorProtocol, session: Foundation.URLSession? = nil, targetRenditionHeight: Swift.Int = 720, maxCachedVideos: Swift.Int = 7)
160
- final public func updateCurrentIndex(_ index: Swift.Int, feedItems: [ShortKitSDK.FeedItem])
161
- final public func pause()
162
- final public func resume()
163
158
  @objc deinit
159
+ final public func updateCurrentIndex(_ index: Swift.Int, feedItems: [ShortKitSDK.FeedItem])
164
160
  }
165
161
  public struct CarouselCompletionEvent : Swift.Equatable, Swift.Sendable {
166
162
  public let contentItem: ShortKitSDK.ContentItem
@@ -343,8 +339,46 @@ extension ShortKitSDK.LiveOverlayMode : Swift.Codable {
343
339
  public init(from decoder: any Swift.Decoder) throws
344
340
  public func encode(to encoder: any Swift.Encoder) throws
345
341
  }
342
+ public struct DebugAlert {
343
+ public enum Level {
344
+ case warning
345
+ public static func == (a: ShortKitSDK.DebugAlert.Level, b: ShortKitSDK.DebugAlert.Level) -> Swift.Bool
346
+ public func hash(into hasher: inout Swift.Hasher)
347
+ public var hashValue: Swift.Int {
348
+ get
349
+ }
350
+ }
351
+ public let level: ShortKitSDK.DebugAlert.Level
352
+ public let compactLabel: Swift.String
353
+ public let priority: Swift.Int
354
+ public init(level: ShortKitSDK.DebugAlert.Level, compactLabel: Swift.String, priority: Swift.Int)
355
+ }
356
+ public enum DebugAlerts {
357
+ public static func compute(_ m: ShortKitSDK.DebugMetrics) -> [ShortKitSDK.DebugAlert]
358
+ }
359
+ public enum DebugItemStatus {
360
+ case unknown
361
+ case readyToPlay
362
+ case failed
363
+ public static func == (a: ShortKitSDK.DebugItemStatus, b: ShortKitSDK.DebugItemStatus) -> Swift.Bool
364
+ public func hash(into hasher: inout Swift.Hasher)
365
+ public var hashValue: Swift.Int {
366
+ get
367
+ }
368
+ }
369
+ public enum DebugTimeControl {
370
+ case paused
371
+ case waitingToPlayAtSpecifiedRate
372
+ case playing
373
+ public static func == (a: ShortKitSDK.DebugTimeControl, b: ShortKitSDK.DebugTimeControl) -> Swift.Bool
374
+ public func hash(into hasher: inout Swift.Hasher)
375
+ public var hashValue: Swift.Int {
376
+ get
377
+ }
378
+ }
346
379
  public struct DebugMetrics {
347
380
  public var contentId: Swift.String?
381
+ public var playbackId: Swift.String?
348
382
  public var feedIndex: Swift.Int
349
383
  public var playerState: ShortKitSDK.PlayerState
350
384
  public var intentToFrameMs: Swift.Int?
@@ -366,8 +400,35 @@ public struct DebugMetrics {
366
400
  public var thumbnailVisible: Swift.Bool
367
401
  public var thumbsCachedAhead: Swift.Int
368
402
  public var metadataAhead: Swift.Int
403
+ public var itemStatus: ShortKitSDK.DebugItemStatus
404
+ public var playerErrorDescription: Swift.String?
405
+ public var failedItemUrl: Swift.String?
406
+ public var timeControlStatus: ShortKitSDK.DebugTimeControl
407
+ public var waitingReason: Swift.String?
408
+ public var hasCurrentItem: Swift.Bool
409
+ public var hasPlayerLayer: Swift.Bool?
410
+ public var isPlaybackBufferEmpty: Swift.Bool
411
+ public var isPlaybackLikelyToKeepUp: Swift.Bool
412
+ public var isPlaybackBufferFull: Swift.Bool
413
+ public var loadedTimeRangesCount: Swift.Int
414
+ public var loadedTimeRangesEnd: Swift.Double
415
+ public var poolSlotName: Swift.String?
416
+ public var poolReservedIndex: Swift.Int?
417
+ public var segmentServerPort: Swift.UInt16?
369
418
  public init(contentId: Swift.String? = nil)
370
419
  }
420
+ @objc @_inheritsConvenienceInitializers @_Concurrency.MainActor @preconcurrency final public class DebugPanelView : UIKit.UIView {
421
+ @_Concurrency.MainActor @preconcurrency public static let panelWidth: CoreFoundation.CGFloat
422
+ @_Concurrency.MainActor @preconcurrency public static let panelHeight: CoreFoundation.CGFloat
423
+ @_Concurrency.MainActor @preconcurrency public static let adjacentExpandedHeight: CoreFoundation.CGFloat
424
+ @_Concurrency.MainActor @preconcurrency public static let diagnosticsExpandedHeight: CoreFoundation.CGFloat
425
+ @_Concurrency.MainActor @preconcurrency public static let expandedExtraHeight: CoreFoundation.CGFloat
426
+ @_Concurrency.MainActor @preconcurrency @objc override dynamic public init(frame: CoreFoundation.CGRect)
427
+ @_Concurrency.MainActor @preconcurrency @objc required dynamic public init?(coder: Foundation.NSCoder)
428
+ @_Concurrency.MainActor @preconcurrency final public func subscribe(to subject: Combine.CurrentValueSubject<ShortKitSDK.DebugMetrics, Swift.Never>)
429
+ @_Concurrency.MainActor @preconcurrency final public func subscribeAdjacent(prev: Combine.CurrentValueSubject<ShortKitSDK.DebugMetrics, Swift.Never>, next: Combine.CurrentValueSubject<ShortKitSDK.DebugMetrics, Swift.Never>)
430
+ @objc deinit
431
+ }
371
432
  public enum SwipeCurve : Swift.Int, Swift.CaseIterable {
372
433
  case quarticOut
373
434
  case quinticOut
@@ -1098,6 +1159,7 @@ final public class ShortKit {
1098
1159
  final public let player: ShortKitSDK.ShortKitPlayer
1099
1160
  final public let carousel: ShortKitSDK.ShortKitCarousel
1100
1161
  final public let debugPanelEnabled: Swift.Bool
1162
+ public static let defaultDebugPanelFactory: (_ active: Combine.CurrentValueSubject<ShortKitSDK.DebugMetrics, Swift.Never>, _ prev: Combine.CurrentValueSubject<ShortKitSDK.DebugMetrics, Swift.Never>, _ next: Combine.CurrentValueSubject<ShortKitSDK.DebugMetrics, Swift.Never>) -> UIKit.UIView
1101
1163
  weak final public var delegate: (any ShortKitSDK.ShortKitDelegate)?
1102
1164
  weak final public var downloadDelegate: (any ShortKitSDK.ShortKitDownloadDelegate)?
1103
1165
  final public var loadingViewProvider: (() -> UIKit.UIView)?
@@ -1159,6 +1221,7 @@ extension ShortKitSDK.ShortKitPlayerViewController : UIKit.UIViewControllerTrans
1159
1221
  }
1160
1222
  @objc @_hasMissingDesignatedInitializers @_Concurrency.MainActor @preconcurrency final public class ShortKitWidgetViewController : UIKit.UIViewController {
1161
1223
  @_Concurrency.MainActor @preconcurrency final public var feedMask: ShortKitSDK.FeedMaskMode
1224
+ @_Concurrency.MainActor @preconcurrency final public var onCardTap: ((Swift.String, Swift.Int) -> Swift.Void)?
1162
1225
  @_Concurrency.MainActor @preconcurrency public init(shortKit: ShortKitSDK.ShortKit, config: ShortKitSDK.WidgetConfig, items: [ShortKitSDK.WidgetInput] = [])
1163
1226
  @_Concurrency.MainActor @preconcurrency final public func configure(with inputs: [ShortKitSDK.WidgetInput])
1164
1227
  @_Concurrency.MainActor @preconcurrency @objc override final public func viewDidLoad()
@@ -1202,6 +1265,12 @@ extension ShortKitSDK.ScrollAxis : Swift.Hashable {}
1202
1265
  extension ShortKitSDK.ScrollAxis : Swift.RawRepresentable {}
1203
1266
  extension ShortKitSDK.FeedSource : Swift.Hashable {}
1204
1267
  extension ShortKitSDK.FeedSource : Swift.RawRepresentable {}
1268
+ extension ShortKitSDK.DebugAlert.Level : Swift.Equatable {}
1269
+ extension ShortKitSDK.DebugAlert.Level : Swift.Hashable {}
1270
+ extension ShortKitSDK.DebugItemStatus : Swift.Equatable {}
1271
+ extension ShortKitSDK.DebugItemStatus : Swift.Hashable {}
1272
+ extension ShortKitSDK.DebugTimeControl : Swift.Equatable {}
1273
+ extension ShortKitSDK.DebugTimeControl : Swift.Hashable {}
1205
1274
  extension ShortKitSDK.SwipeCurve : Swift.Equatable {}
1206
1275
  extension ShortKitSDK.SwipeCurve : Swift.Hashable {}
1207
1276
  extension ShortKitSDK.SwipeCurve : Swift.RawRepresentable {}
@@ -59,6 +59,7 @@ final public class BandwidthMonitor : ShortKitSDK.BandwidthMonitorProtocol {
59
59
  final public let segmentCache: any ShortKitSDK.SegmentCacheProtocol
60
60
  final public var segmentServer: ShortKitSDK.SegmentHTTPServer?
61
61
  public init(segmentCache: any ShortKitSDK.SegmentCacheProtocol, session: Foundation.URLSession = .shared)
62
+ @objc deinit
62
63
  final public var urlMapping: [Foundation.URL : Foundation.URL] {
63
64
  get
64
65
  }
@@ -73,7 +74,6 @@ final public class BandwidthMonitor : ShortKitSDK.BandwidthMonitorProtocol {
73
74
  final public func cachedRendition(for videoID: Swift.String) -> Swift.String?
74
75
  @objc final public func resourceLoader(_ resourceLoader: AVFoundation.AVAssetResourceLoader, shouldWaitForLoadingOfRequestedResource loadingRequest: AVFoundation.AVAssetResourceLoadingRequest) -> Swift.Bool
75
76
  @objc final public func resourceLoader(_ resourceLoader: AVFoundation.AVAssetResourceLoader, didCancel loadingRequest: AVFoundation.AVAssetResourceLoadingRequest)
76
- @objc deinit
77
77
  }
78
78
  public protocol ColdStartManagerProtocol : Swift.Sendable {
79
79
  func cachedFeedItems() -> [ShortKitSDK.FeedItem]
@@ -152,15 +152,11 @@ final public class SegmentHTTPServer {
152
152
  }
153
153
  public protocol SegmentPrefetcherProtocol : AnyObject {
154
154
  func updateCurrentIndex(_ index: Swift.Int, feedItems: [ShortKitSDK.FeedItem])
155
- func pause()
156
- func resume()
157
155
  }
158
- final public class SegmentPrefetcher : ShortKitSDK.SegmentPrefetcherProtocol {
156
+ @_hasMissingDesignatedInitializers final public class SegmentPrefetcher : ShortKitSDK.SegmentPrefetcherProtocol {
159
157
  public init(cache: any ShortKitSDK.SegmentCacheProtocol, monitor: any ShortKitSDK.BandwidthMonitorProtocol, session: Foundation.URLSession? = nil, targetRenditionHeight: Swift.Int = 720, maxCachedVideos: Swift.Int = 7)
160
- final public func updateCurrentIndex(_ index: Swift.Int, feedItems: [ShortKitSDK.FeedItem])
161
- final public func pause()
162
- final public func resume()
163
158
  @objc deinit
159
+ final public func updateCurrentIndex(_ index: Swift.Int, feedItems: [ShortKitSDK.FeedItem])
164
160
  }
165
161
  public struct CarouselCompletionEvent : Swift.Equatable, Swift.Sendable {
166
162
  public let contentItem: ShortKitSDK.ContentItem
@@ -343,8 +339,46 @@ extension ShortKitSDK.LiveOverlayMode : Swift.Codable {
343
339
  public init(from decoder: any Swift.Decoder) throws
344
340
  public func encode(to encoder: any Swift.Encoder) throws
345
341
  }
342
+ public struct DebugAlert {
343
+ public enum Level {
344
+ case warning
345
+ public static func == (a: ShortKitSDK.DebugAlert.Level, b: ShortKitSDK.DebugAlert.Level) -> Swift.Bool
346
+ public func hash(into hasher: inout Swift.Hasher)
347
+ public var hashValue: Swift.Int {
348
+ get
349
+ }
350
+ }
351
+ public let level: ShortKitSDK.DebugAlert.Level
352
+ public let compactLabel: Swift.String
353
+ public let priority: Swift.Int
354
+ public init(level: ShortKitSDK.DebugAlert.Level, compactLabel: Swift.String, priority: Swift.Int)
355
+ }
356
+ public enum DebugAlerts {
357
+ public static func compute(_ m: ShortKitSDK.DebugMetrics) -> [ShortKitSDK.DebugAlert]
358
+ }
359
+ public enum DebugItemStatus {
360
+ case unknown
361
+ case readyToPlay
362
+ case failed
363
+ public static func == (a: ShortKitSDK.DebugItemStatus, b: ShortKitSDK.DebugItemStatus) -> Swift.Bool
364
+ public func hash(into hasher: inout Swift.Hasher)
365
+ public var hashValue: Swift.Int {
366
+ get
367
+ }
368
+ }
369
+ public enum DebugTimeControl {
370
+ case paused
371
+ case waitingToPlayAtSpecifiedRate
372
+ case playing
373
+ public static func == (a: ShortKitSDK.DebugTimeControl, b: ShortKitSDK.DebugTimeControl) -> Swift.Bool
374
+ public func hash(into hasher: inout Swift.Hasher)
375
+ public var hashValue: Swift.Int {
376
+ get
377
+ }
378
+ }
346
379
  public struct DebugMetrics {
347
380
  public var contentId: Swift.String?
381
+ public var playbackId: Swift.String?
348
382
  public var feedIndex: Swift.Int
349
383
  public var playerState: ShortKitSDK.PlayerState
350
384
  public var intentToFrameMs: Swift.Int?
@@ -366,8 +400,35 @@ public struct DebugMetrics {
366
400
  public var thumbnailVisible: Swift.Bool
367
401
  public var thumbsCachedAhead: Swift.Int
368
402
  public var metadataAhead: Swift.Int
403
+ public var itemStatus: ShortKitSDK.DebugItemStatus
404
+ public var playerErrorDescription: Swift.String?
405
+ public var failedItemUrl: Swift.String?
406
+ public var timeControlStatus: ShortKitSDK.DebugTimeControl
407
+ public var waitingReason: Swift.String?
408
+ public var hasCurrentItem: Swift.Bool
409
+ public var hasPlayerLayer: Swift.Bool?
410
+ public var isPlaybackBufferEmpty: Swift.Bool
411
+ public var isPlaybackLikelyToKeepUp: Swift.Bool
412
+ public var isPlaybackBufferFull: Swift.Bool
413
+ public var loadedTimeRangesCount: Swift.Int
414
+ public var loadedTimeRangesEnd: Swift.Double
415
+ public var poolSlotName: Swift.String?
416
+ public var poolReservedIndex: Swift.Int?
417
+ public var segmentServerPort: Swift.UInt16?
369
418
  public init(contentId: Swift.String? = nil)
370
419
  }
420
+ @objc @_inheritsConvenienceInitializers @_Concurrency.MainActor @preconcurrency final public class DebugPanelView : UIKit.UIView {
421
+ @_Concurrency.MainActor @preconcurrency public static let panelWidth: CoreFoundation.CGFloat
422
+ @_Concurrency.MainActor @preconcurrency public static let panelHeight: CoreFoundation.CGFloat
423
+ @_Concurrency.MainActor @preconcurrency public static let adjacentExpandedHeight: CoreFoundation.CGFloat
424
+ @_Concurrency.MainActor @preconcurrency public static let diagnosticsExpandedHeight: CoreFoundation.CGFloat
425
+ @_Concurrency.MainActor @preconcurrency public static let expandedExtraHeight: CoreFoundation.CGFloat
426
+ @_Concurrency.MainActor @preconcurrency @objc override dynamic public init(frame: CoreFoundation.CGRect)
427
+ @_Concurrency.MainActor @preconcurrency @objc required dynamic public init?(coder: Foundation.NSCoder)
428
+ @_Concurrency.MainActor @preconcurrency final public func subscribe(to subject: Combine.CurrentValueSubject<ShortKitSDK.DebugMetrics, Swift.Never>)
429
+ @_Concurrency.MainActor @preconcurrency final public func subscribeAdjacent(prev: Combine.CurrentValueSubject<ShortKitSDK.DebugMetrics, Swift.Never>, next: Combine.CurrentValueSubject<ShortKitSDK.DebugMetrics, Swift.Never>)
430
+ @objc deinit
431
+ }
371
432
  public enum SwipeCurve : Swift.Int, Swift.CaseIterable {
372
433
  case quarticOut
373
434
  case quinticOut
@@ -1098,6 +1159,7 @@ final public class ShortKit {
1098
1159
  final public let player: ShortKitSDK.ShortKitPlayer
1099
1160
  final public let carousel: ShortKitSDK.ShortKitCarousel
1100
1161
  final public let debugPanelEnabled: Swift.Bool
1162
+ public static let defaultDebugPanelFactory: (_ active: Combine.CurrentValueSubject<ShortKitSDK.DebugMetrics, Swift.Never>, _ prev: Combine.CurrentValueSubject<ShortKitSDK.DebugMetrics, Swift.Never>, _ next: Combine.CurrentValueSubject<ShortKitSDK.DebugMetrics, Swift.Never>) -> UIKit.UIView
1101
1163
  weak final public var delegate: (any ShortKitSDK.ShortKitDelegate)?
1102
1164
  weak final public var downloadDelegate: (any ShortKitSDK.ShortKitDownloadDelegate)?
1103
1165
  final public var loadingViewProvider: (() -> UIKit.UIView)?
@@ -1159,6 +1221,7 @@ extension ShortKitSDK.ShortKitPlayerViewController : UIKit.UIViewControllerTrans
1159
1221
  }
1160
1222
  @objc @_hasMissingDesignatedInitializers @_Concurrency.MainActor @preconcurrency final public class ShortKitWidgetViewController : UIKit.UIViewController {
1161
1223
  @_Concurrency.MainActor @preconcurrency final public var feedMask: ShortKitSDK.FeedMaskMode
1224
+ @_Concurrency.MainActor @preconcurrency final public var onCardTap: ((Swift.String, Swift.Int) -> Swift.Void)?
1162
1225
  @_Concurrency.MainActor @preconcurrency public init(shortKit: ShortKitSDK.ShortKit, config: ShortKitSDK.WidgetConfig, items: [ShortKitSDK.WidgetInput] = [])
1163
1226
  @_Concurrency.MainActor @preconcurrency final public func configure(with inputs: [ShortKitSDK.WidgetInput])
1164
1227
  @_Concurrency.MainActor @preconcurrency @objc override final public func viewDidLoad()
@@ -1202,6 +1265,12 @@ extension ShortKitSDK.ScrollAxis : Swift.Hashable {}
1202
1265
  extension ShortKitSDK.ScrollAxis : Swift.RawRepresentable {}
1203
1266
  extension ShortKitSDK.FeedSource : Swift.Hashable {}
1204
1267
  extension ShortKitSDK.FeedSource : Swift.RawRepresentable {}
1268
+ extension ShortKitSDK.DebugAlert.Level : Swift.Equatable {}
1269
+ extension ShortKitSDK.DebugAlert.Level : Swift.Hashable {}
1270
+ extension ShortKitSDK.DebugItemStatus : Swift.Equatable {}
1271
+ extension ShortKitSDK.DebugItemStatus : Swift.Hashable {}
1272
+ extension ShortKitSDK.DebugTimeControl : Swift.Equatable {}
1273
+ extension ShortKitSDK.DebugTimeControl : Swift.Hashable {}
1205
1274
  extension ShortKitSDK.SwipeCurve : Swift.Equatable {}
1206
1275
  extension ShortKitSDK.SwipeCurve : Swift.Hashable {}
1207
1276
  extension ShortKitSDK.SwipeCurve : Swift.RawRepresentable {}
@@ -10,39 +10,39 @@
10
10
  </data>
11
11
  <key>Info.plist</key>
12
12
  <data>
13
- TqCi7bLe/rBk0vusKYg3QCnChjw=
13
+ PYkIcNDUEgyhTyEpFbDaCBPo+UE=
14
14
  </data>
15
15
  <key>Modules/ShortKitSDK.swiftmodule/arm64-apple-ios-simulator.abi.json</key>
16
16
  <data>
17
- T24MZRAcHfhIQj9rhCKZ74+fGDk=
17
+ UaBdqrMhIeApH2d1RUSHIj0Zhu8=
18
18
  </data>
19
19
  <key>Modules/ShortKitSDK.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface</key>
20
20
  <data>
21
- /tzpn54Ir12p9mlqhhATlo1kMxk=
21
+ 8YGTcgWDbl8y4dDSIpll5eJ4obE=
22
22
  </data>
23
23
  <key>Modules/ShortKitSDK.swiftmodule/arm64-apple-ios-simulator.swiftdoc</key>
24
24
  <data>
25
- jfLbEEzmKUw8NgxsDqMv/TI2UHA=
25
+ lzX6ESVjVhhWPe6DxnX73NDmZxw=
26
26
  </data>
27
27
  <key>Modules/ShortKitSDK.swiftmodule/arm64-apple-ios-simulator.swiftinterface</key>
28
28
  <data>
29
- /tzpn54Ir12p9mlqhhATlo1kMxk=
29
+ 8YGTcgWDbl8y4dDSIpll5eJ4obE=
30
30
  </data>
31
31
  <key>Modules/ShortKitSDK.swiftmodule/x86_64-apple-ios-simulator.abi.json</key>
32
32
  <data>
33
- T24MZRAcHfhIQj9rhCKZ74+fGDk=
33
+ UaBdqrMhIeApH2d1RUSHIj0Zhu8=
34
34
  </data>
35
35
  <key>Modules/ShortKitSDK.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface</key>
36
36
  <data>
37
- gMhrjSn1Z4igYb3yHfulqLRscLs=
37
+ H7HRD+aObjI7xoUhzCeaCSiqjmk=
38
38
  </data>
39
39
  <key>Modules/ShortKitSDK.swiftmodule/x86_64-apple-ios-simulator.swiftdoc</key>
40
40
  <data>
41
- feB3WtzjYFsaMexcqDUc4JGDFrg=
41
+ ggGgO2zWeWv56r6SC+RCZNJLMTE=
42
42
  </data>
43
43
  <key>Modules/ShortKitSDK.swiftmodule/x86_64-apple-ios-simulator.swiftinterface</key>
44
44
  <data>
45
- gMhrjSn1Z4igYb3yHfulqLRscLs=
45
+ H7HRD+aObjI7xoUhzCeaCSiqjmk=
46
46
  </data>
47
47
  <key>Modules/module.modulemap</key>
48
48
  <data>
@@ -66,56 +66,56 @@
66
66
  <dict>
67
67
  <key>hash2</key>
68
68
  <data>
69
- uLq+hg2h3SAN1deJqLUnULXrfFwB26PttLnWxmx/cGo=
69
+ 1d0XBLVpugO7SBVSLPAAz9em40Jjg3uSJDz2K7kZLt4=
70
70
  </data>
71
71
  </dict>
72
72
  <key>Modules/ShortKitSDK.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface</key>
73
73
  <dict>
74
74
  <key>hash2</key>
75
75
  <data>
76
- qlEsU4N2hUtQ04us8hP20iPW8Tx3msprPs+sZvdIxQ8=
76
+ 3D6bnZQIYaJD/ZJLQcVC4KUbwNgvDl/iiBHyIFmY1u8=
77
77
  </data>
78
78
  </dict>
79
79
  <key>Modules/ShortKitSDK.swiftmodule/arm64-apple-ios-simulator.swiftdoc</key>
80
80
  <dict>
81
81
  <key>hash2</key>
82
82
  <data>
83
- joqbkrgKjhuksU/+u2V6/QkIEKWcA9LxrnASAJZTWsg=
83
+ CFHa4/rm1ZPInefpRBxbmuzlobIbnb847Q0i2xy1q9A=
84
84
  </data>
85
85
  </dict>
86
86
  <key>Modules/ShortKitSDK.swiftmodule/arm64-apple-ios-simulator.swiftinterface</key>
87
87
  <dict>
88
88
  <key>hash2</key>
89
89
  <data>
90
- qlEsU4N2hUtQ04us8hP20iPW8Tx3msprPs+sZvdIxQ8=
90
+ 3D6bnZQIYaJD/ZJLQcVC4KUbwNgvDl/iiBHyIFmY1u8=
91
91
  </data>
92
92
  </dict>
93
93
  <key>Modules/ShortKitSDK.swiftmodule/x86_64-apple-ios-simulator.abi.json</key>
94
94
  <dict>
95
95
  <key>hash2</key>
96
96
  <data>
97
- uLq+hg2h3SAN1deJqLUnULXrfFwB26PttLnWxmx/cGo=
97
+ 1d0XBLVpugO7SBVSLPAAz9em40Jjg3uSJDz2K7kZLt4=
98
98
  </data>
99
99
  </dict>
100
100
  <key>Modules/ShortKitSDK.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface</key>
101
101
  <dict>
102
102
  <key>hash2</key>
103
103
  <data>
104
- zJA0JThfoDRwFu0/9WzU1O+cmdnkZ3kcOlW0aju3B+k=
104
+ +RR1yKVxk7eM89sQaZV/Ks3KftiCvYiEXqvAWayvf/s=
105
105
  </data>
106
106
  </dict>
107
107
  <key>Modules/ShortKitSDK.swiftmodule/x86_64-apple-ios-simulator.swiftdoc</key>
108
108
  <dict>
109
109
  <key>hash2</key>
110
110
  <data>
111
- ct73W591fp7iumAnIzZPaew7KMArg2zicdfZ4PMWPr8=
111
+ ppdE9CD5J+SnQP9npRDKhbCFuonZyTCN1TcUzRTdPfg=
112
112
  </data>
113
113
  </dict>
114
114
  <key>Modules/ShortKitSDK.swiftmodule/x86_64-apple-ios-simulator.swiftinterface</key>
115
115
  <dict>
116
116
  <key>hash2</key>
117
117
  <data>
118
- zJA0JThfoDRwFu0/9WzU1O+cmdnkZ3kcOlW0aju3B+k=
118
+ +RR1yKVxk7eM89sQaZV/Ks3KftiCvYiEXqvAWayvf/s=
119
119
  </data>
120
120
  </dict>
121
121
  <key>Modules/module.modulemap</key>
@@ -25,6 +25,12 @@ import ShortKitSDK
25
25
  }
26
26
  }
27
27
 
28
+ /// Stable per-instance widget identifier set by the JS wrapper. Echoed
29
+ /// back on `onWidgetCardTap` events so the JS wrapper can route the
30
+ /// global emit to the correct `<ShortKitWidget>` instance when more than
31
+ /// one is mounted simultaneously.
32
+ @objc public var widgetId: String?
33
+
28
34
  // MARK: - Child VC
29
35
 
30
36
  private var widgetVC: ShortKitWidgetViewController?
@@ -66,6 +72,23 @@ import ShortKitSDK
66
72
  let vc = ShortKitWidgetViewController(shortKit: sdk, config: widgetConfig, items: parsedItems)
67
73
  self.widgetVC = vc
68
74
 
75
+ // Wire host-handleable card-tap callback. When the JS wrapper has
76
+ // an `onCardTap` prop set, it'll have given us a widgetId; we forward
77
+ // each tap through the bridge with that widgetId so the JS wrapper
78
+ // can filter to its own instance. The SDK's widget VC, when it sees
79
+ // a non-nil onCardTap, automatically skips the built-in
80
+ // `clickAction: .feed` modal-presentation path (see
81
+ // ShortKitWidgetViewController docs) — host code is fully in charge.
82
+ if let id = widgetId {
83
+ vc.onCardTap = { playbackId, index in
84
+ ShortKitBridge.shared?.emitOnMain("onWidgetCardTap", body: [
85
+ "widgetId": id,
86
+ "playbackId": playbackId,
87
+ "index": index,
88
+ ])
89
+ }
90
+ }
91
+
69
92
  parentVC.addChild(vc)
70
93
  vc.view.frame = bounds
71
94
  vc.view.autoresizingMask = [.flexibleWidth, .flexibleHeight]
@@ -23,5 +23,6 @@ RCT_EXPORT_MODULE(ShortKitWidgetView)
23
23
 
24
24
  RCT_EXPORT_VIEW_PROPERTY(config, NSString)
25
25
  RCT_EXPORT_VIEW_PROPERTY(items, NSString)
26
+ RCT_EXPORT_VIEW_PROPERTY(widgetId, NSString)
26
27
 
27
28
  @end
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shortkitsdk/react-native",
3
- "version": "0.2.30",
3
+ "version": "0.2.31",
4
4
  "description": "ShortKit React Native SDK — short-form video feed",
5
5
  "react-native": "src/index",
6
6
  "source": "src/index",
@@ -1,13 +1,21 @@
1
- import React, { useContext, useLayoutEffect, useMemo } from 'react';
1
+ import React, { useContext, useEffect, useLayoutEffect, useMemo, useRef } from 'react';
2
2
  import { View, StyleSheet } from 'react-native';
3
3
  import type { ShortKitWidgetProps } from './types';
4
4
  import ShortKitWidgetView from './specs/ShortKitWidgetViewNativeComponent';
5
+ import NativeShortKitModule from './specs/NativeShortKitModule';
5
6
  import { ShortKitInitContext } from './ShortKitContext';
6
7
  import { serializeWidgetConfig } from './serialization';
7
8
  import { registerOverlayComponent } from './ShortKitOverlaySurface';
8
9
  import { registerCarouselOverlayComponent } from './ShortKitCarouselOverlaySurface';
9
10
  import { registerVideoCarouselOverlayComponent } from './ShortKitVideoCarouselOverlaySurface';
10
11
 
12
+ // Local UUID generator. We don't pull in a runtime dep just for this; a
13
+ // timestamp + random suffix is more than unique enough to disambiguate
14
+ // concurrently-mounted widgets within a single app session.
15
+ function generateWidgetId(): string {
16
+ return `widget-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`;
17
+ }
18
+
11
19
  /**
12
20
  * Horizontal carousel widget component. Displays a row of video cards
13
21
  * with automatic rotation. Wraps a native Fabric view.
@@ -15,13 +23,36 @@ import { registerVideoCarouselOverlayComponent } from './ShortKitVideoCarouselOv
15
23
  * Must be rendered inside a `<ShortKitProvider>`.
16
24
  */
17
25
  export function ShortKitWidget(props: ShortKitWidgetProps) {
18
- const { config, items, style } = props;
26
+ const { config, items, onCardTap, style } = props;
19
27
 
20
28
  const isInitialized = useContext(ShortKitInitContext);
21
29
  if (!isInitialized) {
22
30
  throw new Error('ShortKitWidget must be used within a ShortKitProvider');
23
31
  }
24
32
 
33
+ // Stable widget ID for the lifetime of this component, ONLY when the host
34
+ // wires `onCardTap`. Skipping it when unset means the native side leaves
35
+ // `widgetVC.onCardTap` nil, which means the SDK's existing
36
+ // `clickAction: 'feed'` modal-presentation path stays intact for hosts
37
+ // that don't opt in. Backwards compatible.
38
+ const widgetId = useMemo(
39
+ () => (onCardTap ? generateWidgetId() : undefined),
40
+ // We deliberately compute this once per "host wired callback" lifetime,
41
+ // not per render. The boolean test on first render is what matters; if
42
+ // the host swaps onCardTap from set → unset later we keep the same
43
+ // widgetId (harmless — no events will fire because the JS subscription
44
+ // below tears down). Going the other way (unset → set), we generate a
45
+ // fresh id then.
46
+ // eslint-disable-next-line react-hooks/exhaustive-deps
47
+ [Boolean(onCardTap)],
48
+ );
49
+
50
+ // Keep a stable ref to the latest onCardTap so the subscription doesn't
51
+ // need to tear down + rebuild every time the host re-renders with a new
52
+ // closure identity.
53
+ const onCardTapRef = useRef(onCardTap);
54
+ onCardTapRef.current = onCardTap;
55
+
25
56
  useLayoutEffect(() => {
26
57
  if (config?.overlay && config.overlay !== 'none') {
27
58
  registerOverlayComponent(config.overlay.name, config.overlay.component);
@@ -40,6 +71,19 @@ export function ShortKitWidget(props: ShortKitWidgetProps) {
40
71
  }
41
72
  }, [config?.overlay, config?.feedConfig]);
42
73
 
74
+ // Subscribe to the global widget-card-tap event, filtered to this
75
+ // instance's widgetId.
76
+ useEffect(() => {
77
+ if (!NativeShortKitModule || !onCardTap) return;
78
+
79
+ const subscription = NativeShortKitModule.onWidgetCardTap((event) => {
80
+ if (event.widgetId !== widgetId) return;
81
+ onCardTapRef.current?.(event.playbackId, event.index);
82
+ });
83
+
84
+ return () => subscription.remove();
85
+ }, [widgetId, onCardTap]);
86
+
43
87
  const serializedConfig = useMemo(() => {
44
88
  return serializeWidgetConfig(config ?? {});
45
89
  }, [config]);
@@ -55,6 +99,7 @@ export function ShortKitWidget(props: ShortKitWidgetProps) {
55
99
  style={styles.widget}
56
100
  config={serializedConfig}
57
101
  items={serializedItems}
102
+ widgetId={widgetId}
58
103
  />
59
104
  </View>
60
105
  );
@@ -127,6 +127,12 @@ type VideoCarouselCellTapEvent = Readonly<{
127
127
  pageIndex: Int32;
128
128
  }>;
129
129
 
130
+ type WidgetCardTapEvent = Readonly<{
131
+ widgetId: string;
132
+ playbackId: string;
133
+ index: Int32;
134
+ }>;
135
+
130
136
  type DownloadStartedEvent = Readonly<{
131
137
  itemId: string;
132
138
  }>;
@@ -329,6 +335,7 @@ export interface Spec extends TurboModule {
329
335
  readonly onDidFetchContentItems: EventEmitter<DidFetchContentItemsEvent>;
330
336
  readonly onFeedReady: EventEmitter<FeedReadyEvent>;
331
337
  readonly onVideoCarouselCellTap: EventEmitter<VideoCarouselCellTapEvent>;
338
+ readonly onWidgetCardTap: EventEmitter<WidgetCardTapEvent>;
332
339
 
333
340
  // --- Overlay per-surface events ---
334
341
  readonly onOverlayActiveChanged: EventEmitter<OverlayActiveEvent>;
@@ -4,6 +4,12 @@ import { codegenNativeComponent } from 'react-native';
4
4
  export interface NativeProps extends ViewProps {
5
5
  config: string;
6
6
  items?: string;
7
+ /**
8
+ * Stable per-instance widget identifier. Used to route the global
9
+ * `NativeShortKitModule.onWidgetCardTap` event back to the originating
10
+ * `<ShortKitWidget>` when multiple widgets are mounted.
11
+ */
12
+ widgetId?: string;
7
13
  }
8
14
 
9
15
  export default codegenNativeComponent<NativeProps>(
package/src/types.ts CHANGED
@@ -484,6 +484,17 @@ export interface ShortKitWidgetProps {
484
484
  * how `<ShortKitFeed feedItems={...} />` works.
485
485
  */
486
486
  items?: WidgetInput[];
487
+ /**
488
+ * Per-card tap callback. When set, the SDK skips the built-in
489
+ * `clickAction: 'feed'` modal-presentation path and hands the tap to the
490
+ * host — typically used to push a feed screen via the host's navigator
491
+ * instead of letting the SDK present a UIKit modal that escapes the host's
492
+ * navigation hierarchy.
493
+ *
494
+ * Mirrors `ShortKitPlayer.onTap`. `clickAction: 'mute'` continues to work
495
+ * regardless (per-cell mute toggle runs alongside `onCardTap`).
496
+ */
497
+ onCardTap?: (playbackId: string, index: number) => void;
487
498
  style?: ViewStyle;
488
499
  }
489
500