@shortkitsdk/react-native 0.2.11 → 0.2.14

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 (57) hide show
  1. package/android/build.gradle.kts +13 -1
  2. package/android/src/main/java/com/shortkit/reactnative/ReactCarouselOverlayHost.kt +157 -54
  3. package/android/src/main/java/com/shortkit/reactnative/ReactOverlayHost.kt +67 -56
  4. package/android/src/main/java/com/shortkit/reactnative/ReactVideoCarouselOverlayHost.kt +431 -0
  5. package/android/src/main/java/com/shortkit/reactnative/ShortKitBridge.kt +154 -26
  6. package/android/src/main/java/com/shortkit/reactnative/ShortKitFeedView.kt +160 -35
  7. package/android/src/main/java/com/shortkit/reactnative/ShortKitFeedViewManager.kt +5 -0
  8. package/android/src/main/java/com/shortkit/reactnative/ShortKitModule.kt +45 -10
  9. package/android/src/main/java/com/shortkit/reactnative/ShortKitPlayerNativeView.kt +9 -0
  10. package/ios/ReactCarouselOverlayHost.swift +37 -17
  11. package/ios/ReactOverlayHost.swift +33 -35
  12. package/ios/ReactVideoCarouselOverlayHost.swift +283 -0
  13. package/ios/ShortKitBridge.swift +78 -2
  14. package/ios/ShortKitFeedView.swift +24 -3
  15. package/ios/ShortKitModule.mm +6 -2
  16. package/ios/ShortKitSDK.xcframework/Info.plist +4 -4
  17. package/ios/ShortKitSDK.xcframework/ios-arm64/ShortKitSDK.framework/Modules/ShortKitSDK.swiftmodule/arm64-apple-ios.abi.json +2597 -389
  18. package/ios/ShortKitSDK.xcframework/ios-arm64/ShortKitSDK.framework/Modules/ShortKitSDK.swiftmodule/arm64-apple-ios.private.swiftinterface +69 -5
  19. package/ios/ShortKitSDK.xcframework/ios-arm64/ShortKitSDK.framework/Modules/ShortKitSDK.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
  20. package/ios/ShortKitSDK.xcframework/ios-arm64/ShortKitSDK.framework/Modules/ShortKitSDK.swiftmodule/arm64-apple-ios.swiftinterface +69 -5
  21. package/ios/ShortKitSDK.xcframework/ios-arm64/ShortKitSDK.framework/ShortKitSDK +0 -0
  22. package/ios/ShortKitSDK.xcframework/ios-arm64/ShortKitSDK.framework/_CodeSignature/CodeResources +168 -0
  23. package/ios/ShortKitSDK.xcframework/ios-arm64-simulator/ShortKitSDK.framework/Modules/ShortKitSDK.swiftmodule/arm64-apple-ios-simulator.abi.json +2597 -389
  24. package/ios/ShortKitSDK.xcframework/ios-arm64-simulator/ShortKitSDK.framework/Modules/ShortKitSDK.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +69 -5
  25. package/ios/ShortKitSDK.xcframework/ios-arm64-simulator/ShortKitSDK.framework/Modules/ShortKitSDK.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
  26. package/ios/ShortKitSDK.xcframework/ios-arm64-simulator/ShortKitSDK.framework/Modules/ShortKitSDK.swiftmodule/arm64-apple-ios-simulator.swiftinterface +69 -5
  27. package/ios/ShortKitSDK.xcframework/ios-arm64-simulator/ShortKitSDK.framework/ShortKitSDK +0 -0
  28. package/ios/ShortKitSDK.xcframework/ios-arm64-simulator/ShortKitSDK.framework/_CodeSignature/CodeResources +168 -0
  29. package/ios/ShortKitSDK.xcframework.bak2/Info.plist +43 -0
  30. package/ios/ShortKitSDK.xcframework.bak2/ios-arm64/ShortKitSDK.framework/Headers/ShortKitSDK-Swift.h +418 -0
  31. package/ios/ShortKitSDK.xcframework.bak2/ios-arm64/ShortKitSDK.framework/Info.plist +16 -0
  32. package/ios/ShortKitSDK.xcframework.bak2/ios-arm64/ShortKitSDK.framework/Modules/ShortKitSDK.swiftmodule/arm64-apple-ios.abi.json +31351 -0
  33. package/ios/ShortKitSDK.xcframework.bak2/ios-arm64/ShortKitSDK.framework/Modules/ShortKitSDK.swiftmodule/arm64-apple-ios.private.swiftinterface +865 -0
  34. package/ios/ShortKitSDK.xcframework.bak2/ios-arm64/ShortKitSDK.framework/Modules/ShortKitSDK.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
  35. package/ios/ShortKitSDK.xcframework.bak2/ios-arm64/ShortKitSDK.framework/Modules/ShortKitSDK.swiftmodule/arm64-apple-ios.swiftinterface +865 -0
  36. package/ios/ShortKitSDK.xcframework.bak2/ios-arm64/ShortKitSDK.framework/Modules/module.modulemap +4 -0
  37. package/ios/ShortKitSDK.xcframework.bak2/ios-arm64/ShortKitSDK.framework/ShortKitSDK +0 -0
  38. package/ios/ShortKitSDK.xcframework.bak2/ios-arm64-simulator/ShortKitSDK.framework/Headers/ShortKitSDK-Swift.h +418 -0
  39. package/ios/ShortKitSDK.xcframework.bak2/ios-arm64-simulator/ShortKitSDK.framework/Info.plist +16 -0
  40. package/ios/ShortKitSDK.xcframework.bak2/ios-arm64-simulator/ShortKitSDK.framework/Modules/ShortKitSDK.swiftmodule/arm64-apple-ios-simulator.abi.json +31351 -0
  41. package/ios/ShortKitSDK.xcframework.bak2/ios-arm64-simulator/ShortKitSDK.framework/Modules/ShortKitSDK.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +865 -0
  42. package/ios/ShortKitSDK.xcframework.bak2/ios-arm64-simulator/ShortKitSDK.framework/Modules/ShortKitSDK.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
  43. package/ios/ShortKitSDK.xcframework.bak2/ios-arm64-simulator/ShortKitSDK.framework/Modules/ShortKitSDK.swiftmodule/arm64-apple-ios-simulator.swiftinterface +865 -0
  44. package/ios/ShortKitSDK.xcframework.bak2/ios-arm64-simulator/ShortKitSDK.framework/Modules/module.modulemap +4 -0
  45. package/ios/ShortKitSDK.xcframework.bak2/ios-arm64-simulator/ShortKitSDK.framework/ShortKitSDK +0 -0
  46. package/package.json +1 -1
  47. package/src/ShortKitCarouselOverlaySurface.tsx +57 -2
  48. package/src/ShortKitContext.ts +2 -1
  49. package/src/ShortKitFeed.tsx +19 -1
  50. package/src/ShortKitOverlaySurface.tsx +148 -41
  51. package/src/ShortKitPlayer.tsx +25 -3
  52. package/src/ShortKitProvider.tsx +4 -2
  53. package/src/ShortKitVideoCarouselOverlaySurface.tsx +156 -0
  54. package/src/index.ts +8 -1
  55. package/src/serialization.ts +8 -0
  56. package/src/specs/NativeShortKitModule.ts +31 -1
  57. package/src/types.ts +45 -1
package/src/index.ts CHANGED
@@ -7,9 +7,11 @@ export { useShortKit } from './useShortKit';
7
7
  export type {
8
8
  FeedConfig,
9
9
  FeedHeight,
10
+ ScrollAxis,
10
11
  FeedSource,
11
12
  OverlayConfig,
12
13
  CarouselOverlayConfig,
14
+ VideoCarouselOverlayConfig,
13
15
  SurveyMode,
14
16
 
15
17
  PlayerConfig,
@@ -19,6 +21,7 @@ export type {
19
21
  ContentItem,
20
22
  CarouselImage,
21
23
  ImageCarouselItem,
24
+ VideoCarouselItem,
22
25
  FeedInput,
23
26
  JSONValue,
24
27
  CaptionTrack,
@@ -42,4 +45,8 @@ export type {
42
45
  StoryboardTile,
43
46
  } from './types';
44
47
  export { ShortKitCommands } from './ShortKitCommands';
45
- export type { OverlayProps, CarouselOverlayProps } from './types';
48
+ export { default as NativeShortKitModule } from './specs/NativeShortKitModule';
49
+ export { registerOverlayComponent } from './ShortKitOverlaySurface';
50
+ export { registerCarouselOverlayComponent } from './ShortKitCarouselOverlaySurface';
51
+ export { registerVideoCarouselOverlayComponent } from './ShortKitVideoCarouselOverlaySurface';
52
+ export type { OverlayProps, CarouselOverlayProps, VideoCarouselOverlayProps } from './types';
@@ -25,10 +25,18 @@ export function serializeFeedConfig(config: FeedConfig): string {
25
25
  return JSON.stringify({ type: 'custom', name: raw.name });
26
26
  })();
27
27
 
28
+ const videoCarouselOverlay = (() => {
29
+ const raw = config.videoCarouselOverlay ?? 'none';
30
+ if (typeof raw === 'string') return JSON.stringify(raw);
31
+ return JSON.stringify({ type: 'custom', name: raw.name });
32
+ })();
33
+
28
34
  return JSON.stringify({
29
35
  feedHeight: JSON.stringify(config.feedHeight ?? { type: 'fullscreen' }),
36
+ scrollAxis: config.scrollAxis ?? 'vertical',
30
37
  overlay,
31
38
  carouselOverlay,
39
+ videoCarouselOverlay,
32
40
  surveyMode: JSON.stringify(config.surveyMode ?? 'none'),
33
41
  muteOnStart: config.muteOnStart ?? true,
34
42
  feedSource: config.feedSource ?? 'algorithmic',
@@ -108,6 +108,10 @@ type ContentTappedEvent = Readonly<{
108
108
  index: Int32;
109
109
  }>;
110
110
 
111
+ type FeedReadyEvent = Readonly<{
112
+ feedId: string;
113
+ }>;
114
+
111
115
  // --- Overlay per-surface event payload types ---
112
116
 
113
117
  type OverlayActiveEvent = Readonly<{
@@ -152,6 +156,28 @@ type OverlayTimeUpdateEvent = Readonly<{
152
156
  buffered: Double;
153
157
  }>;
154
158
 
159
+ type CarouselActiveImageEvent = Readonly<{
160
+ surfaceId: string;
161
+ activeImageIndex: Int32;
162
+ }>;
163
+
164
+ type VideoCarouselActiveVideoEvent = Readonly<{
165
+ surfaceId: string;
166
+ activeVideo: string;
167
+ activeVideoIndex: Int32;
168
+ }>;
169
+
170
+ type OverlayFullStateEvent = Readonly<{
171
+ surfaceId: string;
172
+ isActive: boolean;
173
+ playerState: string;
174
+ isMuted: boolean;
175
+ playbackRate: Double;
176
+ captionsEnabled: boolean;
177
+ activeCue: string;
178
+ feedScrollPhase: string;
179
+ }>;
180
+
155
181
  export interface Spec extends TurboModule {
156
182
  // --- Lifecycle ---
157
183
  initialize(
@@ -186,7 +212,7 @@ export interface Spec extends TurboModule {
186
212
  appendFeedItems(feedId: string, items: string): void;
187
213
  fetchContent(limit: Int32, filterJSON: string | null): Promise<string>;
188
214
  applyFilter(feedId: string, filterJSON: string | null): void;
189
- preloadFeed(configJSON: string): Promise<string>;
215
+ preloadFeed(configJSON: string, itemsJSON: string | null): Promise<string>;
190
216
 
191
217
  // --- Storyboard / seek thumbnails ---
192
218
  prefetchStoryboard(playbackId: string): void;
@@ -212,6 +238,7 @@ export interface Spec extends TurboModule {
212
238
  readonly onDismiss: EventEmitter<DismissEvent>;
213
239
  readonly onRefreshRequested: EventEmitter<RefreshRequestedEvent>;
214
240
  readonly onDidFetchContentItems: EventEmitter<DidFetchContentItemsEvent>;
241
+ readonly onFeedReady: EventEmitter<FeedReadyEvent>;
215
242
 
216
243
  // --- Overlay per-surface events ---
217
244
  readonly onOverlayActiveChanged: EventEmitter<OverlayActiveEvent>;
@@ -222,6 +249,9 @@ export interface Spec extends TurboModule {
222
249
  readonly onOverlayActiveCueChanged: EventEmitter<OverlayActiveCueEvent>;
223
250
  readonly onOverlayFeedScrollPhaseChanged: EventEmitter<OverlayFeedScrollPhaseEvent>;
224
251
  readonly onOverlayTimeUpdate: EventEmitter<OverlayTimeUpdateEvent>;
252
+ readonly onOverlayFullState: EventEmitter<OverlayFullStateEvent>;
253
+ readonly onCarouselActiveImageChanged: EventEmitter<CarouselActiveImageEvent>;
254
+ readonly onVideoCarouselActiveVideoChanged: EventEmitter<VideoCarouselActiveVideoEvent>;
225
255
  }
226
256
 
227
257
  export default TurboModuleRegistry.getEnforcing<Spec>('ShortKitModule');
package/src/types.ts CHANGED
@@ -17,8 +17,10 @@ export type CaptionSource = 'embedded' | 'external' | 'generated';
17
17
 
18
18
  export interface FeedConfig {
19
19
  feedHeight?: FeedHeight;
20
+ scrollAxis?: ScrollAxis;
20
21
  overlay?: OverlayConfig;
21
22
  carouselOverlay?: CarouselOverlayConfig;
23
+ videoCarouselOverlay?: VideoCarouselOverlayConfig;
22
24
  surveyMode?: SurveyMode;
23
25
  muteOnStart?: boolean;
24
26
  feedSource?: FeedSource;
@@ -30,6 +32,8 @@ export type FeedHeight =
30
32
  | { type: 'fullscreen' }
31
33
  | { type: 'percentage'; value: number };
32
34
 
35
+ export type ScrollAxis = 'vertical' | 'horizontal';
36
+
33
37
  export type OverlayConfig =
34
38
  | 'none'
35
39
  | { type: 'custom'; name: string; component: React.ComponentType<OverlayProps> };
@@ -38,6 +42,10 @@ export type CarouselOverlayConfig =
38
42
  | 'none'
39
43
  | { type: 'custom'; name: string; component: React.ComponentType<CarouselOverlayProps> };
40
44
 
45
+ export type VideoCarouselOverlayConfig =
46
+ | 'none'
47
+ | { type: 'custom'; name: string; component: React.ComponentType<VideoCarouselOverlayProps> };
48
+
41
49
  export type SurveyMode =
42
50
  | 'none'
43
51
  | { type: 'template'; name: 'default' };
@@ -78,9 +86,20 @@ export interface ImageCarouselItem {
78
86
  articleUrl?: string;
79
87
  }
80
88
 
89
+ export interface VideoCarouselItem {
90
+ id: string;
91
+ videos: ContentItem[];
92
+ title?: string;
93
+ description?: string;
94
+ author?: string;
95
+ section?: string;
96
+ articleUrl?: string;
97
+ }
98
+
81
99
  export type FeedInput =
82
100
  | { type: 'video'; playbackId: string; fallbackUrl?: string }
83
- | { type: 'imageCarousel'; item: ImageCarouselItem };
101
+ | { type: 'imageCarousel'; item: ImageCarouselItem }
102
+ | { type: 'videoCarousel'; item: VideoCarouselItem };
84
103
 
85
104
  export type JSONValue =
86
105
  | string
@@ -192,6 +211,28 @@ export interface OverlayProps {
192
211
  export interface CarouselOverlayProps {
193
212
  /** The carousel item for this cell. */
194
213
  item: ImageCarouselItem;
214
+ /** Whether this carousel cell is the active (on-screen) cell. */
215
+ isActive: boolean;
216
+ /** Index of the currently visible image within the carousel. */
217
+ activeImageIndex: number;
218
+ }
219
+
220
+ /** Props passed to video carousel overlay components rendered inside feed cells. */
221
+ export interface VideoCarouselOverlayProps {
222
+ /** The video carousel item for this cell. */
223
+ carouselItem: VideoCarouselItem;
224
+ /** The currently active video within the carousel. */
225
+ activeVideo: ContentItem;
226
+ /** Index of the currently active video within the carousel. */
227
+ activeVideoIndex: number;
228
+ /** Whether this carousel cell is the active (on-screen) cell. */
229
+ isActive: boolean;
230
+ /** Current playback time for the active video. */
231
+ time: PlayerTime;
232
+ /** Current player state for the active video. */
233
+ playerState: PlayerState;
234
+ /** Whether audio is muted. */
235
+ isMuted: boolean;
195
236
  }
196
237
 
197
238
  // --- Provider Props ---
@@ -231,6 +272,9 @@ export interface ShortKitFeedProps {
231
272
  onDidFetchContentItems?: (items: ContentItem[]) => void;
232
273
  /** Called when the number of remaining items in this feed changes. */
233
274
  onRemainingContentCountChange?: (count: number) => void;
275
+ /** Called once when this feed has loaded content and assigned a player
276
+ * to the first cell. Use to dismiss a splash screen or loading overlay. */
277
+ onFeedReady?: () => void;
234
278
  }
235
279
 
236
280
  /**