@dialtribe/react-sdk 0.1.0-alpha.11 → 0.1.0-alpha.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.
package/README.md CHANGED
@@ -97,13 +97,13 @@ Current bundle sizes (alpha.5, December 2025 - A+ Quality):
97
97
  | Import Method | Minified | Gzipped | Notes |
98
98
  |--------------|----------|---------|-------|
99
99
  | `@dialtribe/react-sdk/hello-world` | 756 B | ~448 B | Simple test component |
100
- | `@dialtribe/react-sdk/broadcast-player` | 91.16 KB | ~17 KB | Full A+ player + accessibility |
100
+ | `@dialtribe/react-sdk/dialtribe-player` | 91.16 KB | ~17 KB | Full A+ player + accessibility |
101
101
  | `@dialtribe/react-sdk` (barrel) | 91.70 KB | ~17.5 KB | All components |
102
102
  | `@dialtribe/react-sdk/styles.css` | 17 KB | 3.8 KB | Required styles (if no Tailwind) |
103
103
 
104
104
  **Total for BroadcastPlayer:** ~20.8 KB gzipped (17 KB JS + 3.8 KB CSS) ✅
105
105
 
106
- **What's included in broadcast-player:**
106
+ **What's included in dialtribe-player:**
107
107
  - BroadcastPlayer (inline player)
108
108
  - BroadcastPlayerModal (modal wrapper)
109
109
  - DialTribeProvider (context)
@@ -114,7 +114,7 @@ Current bundle sizes (alpha.5, December 2025 - A+ Quality):
114
114
  - **Production safety** (debug logging, secure endpoints)
115
115
  - All utilities (formatTime, buildBroadcastCdnUrl, etc.)
116
116
 
117
- **Why subpath imports matter:** The barrel import (`@dialtribe/react-sdk`) includes all components. Using subpath imports like `/broadcast-player` ensures you only bundle what you need.
117
+ **Why subpath imports matter:** The barrel import (`@dialtribe/react-sdk`) includes all components. Using subpath imports like `/dialtribe-player` ensures you only bundle what you need.
118
118
 
119
119
  ## Components
120
120
 
@@ -175,7 +175,7 @@ app.post('/api/dialtribe/session', async (req, res) => {
175
175
  #### Step 2: Wrap Your App with DialTribeProvider
176
176
 
177
177
  ```tsx
178
- import { DialTribeProvider } from '@dialtribe/react-sdk/broadcast-player';
178
+ import { DialTribeProvider } from '@dialtribe/react-sdk/dialtribe-player';
179
179
  import '@dialtribe/react-sdk/styles.css';
180
180
  import { useState, useEffect } from 'react';
181
181
 
@@ -213,7 +213,7 @@ function Root() {
213
213
  #### Step 3: Fetch Broadcasts from DialTribe API
214
214
 
215
215
  ```tsx
216
- import { useDialTribe } from '@dialtribe/react-sdk/broadcast-player';
216
+ import { useDialTribe } from '@dialtribe/react-sdk/dialtribe-player';
217
217
  import { useState, useEffect } from 'react';
218
218
 
219
219
  function App() {
@@ -246,7 +246,7 @@ function App() {
246
246
  **Option A: Built-in Modal (Recommended for Quick Setup)**
247
247
 
248
248
  ```tsx
249
- import { BroadcastPlayerModal } from '@dialtribe/react-sdk/broadcast-player';
249
+ import { BroadcastPlayerModal } from '@dialtribe/react-sdk/dialtribe-player';
250
250
  import { useState } from 'react';
251
251
 
252
252
  function BroadcastCard({ broadcast }) {
@@ -273,7 +273,7 @@ function BroadcastCard({ broadcast }) {
273
273
  **Option B: Inline Player (Custom Layout)**
274
274
 
275
275
  ```tsx
276
- import { BroadcastPlayer } from '@dialtribe/react-sdk/broadcast-player';
276
+ import { BroadcastPlayer } from '@dialtribe/react-sdk/dialtribe-player';
277
277
 
278
278
  function CustomVideoPage({ broadcast }) {
279
279
  return (
@@ -395,7 +395,7 @@ The player supports keyboard shortcuts when `enableKeyboardShortcuts={true}` is
395
395
 
396
396
  #### Utilities
397
397
 
398
- The broadcast-player module also exports useful utilities:
398
+ The dialtribe-player module also exports useful utilities:
399
399
 
400
400
  ```tsx
401
401
  import {
@@ -417,7 +417,7 @@ import {
417
417
  type Broadcast,
418
418
  type DialTribeContextValue,
419
419
  type ApiClientConfig,
420
- } from '@dialtribe/react-sdk/broadcast-player';
420
+ } from '@dialtribe/react-sdk/dialtribe-player';
421
421
 
422
422
  // Format seconds to HH:MM:SS or MM:SS
423
423
  const timeString = formatTime(3665); // "1:01:05"
@@ -454,7 +454,7 @@ const broadcast = await client.getBroadcast(123);
454
454
 
455
455
  **Before (alpha.4):**
456
456
  ```tsx
457
- import { BroadcastPlayerModal } from '@dialtribe/react-sdk/broadcast-player';
457
+ import { BroadcastPlayerModal } from '@dialtribe/react-sdk/dialtribe-player';
458
458
 
459
459
  <BroadcastPlayerModal
460
460
  broadcast={broadcast}
@@ -472,7 +472,7 @@ import { BroadcastPlayerModal } from '@dialtribe/react-sdk/broadcast-player';
472
472
  import {
473
473
  DialTribeProvider,
474
474
  BroadcastPlayerModal,
475
- } from '@dialtribe/react-sdk/broadcast-player';
475
+ } from '@dialtribe/react-sdk/dialtribe-player';
476
476
 
477
477
  // 1. Wrap app with provider (once, at root)
478
478
  <DialTribeProvider
@@ -2,10 +2,10 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import React$1, { Component, ReactNode, ErrorInfo } from 'react';
3
3
 
4
4
  /**
5
- * DialTribe SDK Context
5
+ * Dialtribe SDK Context
6
6
  * Manages session token and auto-refresh across all SDK components
7
7
  */
8
- interface DialTribeContextValue {
8
+ interface DialtribeContextValue {
9
9
  /** Current session token */
10
10
  sessionToken: string | null;
11
11
  /** Update the session token (called automatically on refresh) */
@@ -17,7 +17,7 @@ interface DialTribeContextValue {
17
17
  /** Optional API base URL override */
18
18
  apiBaseUrl?: string;
19
19
  }
20
- interface DialTribeProviderProps {
20
+ interface DialtribeProviderProps {
21
21
  /** Session token from your backend (required) */
22
22
  sessionToken: string;
23
23
  /** Called when the API returns a refreshed token via X-Session-Token header */
@@ -34,70 +34,70 @@ interface DialTribeProviderProps {
34
34
  children: React$1.ReactNode;
35
35
  }
36
36
  /**
37
- * DialTribe Provider
37
+ * Dialtribe Provider
38
38
  *
39
39
  * Wraps your app to provide session token authentication to all SDK components.
40
40
  *
41
41
  * @example
42
42
  * ```tsx
43
43
  * // Production (default)
44
- * <DialTribeProvider
44
+ * <DialtribeProvider
45
45
  * sessionToken="sess_xxx..."
46
46
  * onTokenRefresh={(newToken) => setToken(newToken)}
47
47
  * onTokenExpired={() => router.push('/login')}
48
48
  * >
49
49
  * <App />
50
- * </DialTribeProvider>
50
+ * </DialtribeProvider>
51
51
  *
52
52
  * // Local development (explicit)
53
- * <DialTribeProvider
53
+ * <DialtribeProvider
54
54
  * sessionToken="sess_xxx..."
55
55
  * apiBaseUrl="http://localhost:3001/api/public/v1"
56
56
  * onTokenRefresh={(newToken) => setToken(newToken)}
57
57
  * >
58
58
  * <App />
59
- * </DialTribeProvider>
59
+ * </DialtribeProvider>
60
60
  *
61
61
  * // Local development (via env var - recommended)
62
62
  * // Set NEXT_PUBLIC_DIALTRIBE_API_URL=http://localhost:3001/api/public/v1 in .env
63
- * <DialTribeProvider sessionToken="sess_xxx...">
63
+ * <DialtribeProvider sessionToken="sess_xxx...">
64
64
  * <App />
65
- * </DialTribeProvider>
65
+ * </DialtribeProvider>
66
66
  * ```
67
67
  */
68
- declare function DialTribeProvider({ sessionToken: initialToken, onTokenRefresh, onTokenExpired, apiBaseUrl, children, }: DialTribeProviderProps): react_jsx_runtime.JSX.Element;
68
+ declare function DialtribeProvider({ sessionToken: initialToken, onTokenRefresh, onTokenExpired, apiBaseUrl, children, }: DialtribeProviderProps): react_jsx_runtime.JSX.Element;
69
69
  /**
70
- * Hook to access DialTribe context
70
+ * Hook to access Dialtribe context
71
71
  *
72
- * @throws Error if used outside DialTribeProvider
72
+ * @throws Error if used outside DialtribeProvider
73
73
  *
74
74
  * @example
75
75
  * ```tsx
76
- * const { sessionToken, setSessionToken } = useDialTribe();
76
+ * const { sessionToken, setSessionToken } = useDialtribe();
77
77
  * ```
78
78
  */
79
- declare function useDialTribe(): DialTribeContextValue;
79
+ declare function useDialtribe(): DialtribeContextValue;
80
80
  /**
81
- * Hook to optionally access DialTribe context
82
- * Returns null if not within a DialTribeProvider (doesn't throw)
81
+ * Hook to optionally access Dialtribe context
82
+ * Returns null if not within a DialtribeProvider (doesn't throw)
83
83
  *
84
84
  * @example
85
85
  * ```tsx
86
- * const context = useDialTribeOptional();
86
+ * const context = useDialtribeOptional();
87
87
  * const sessionToken = context?.sessionToken ?? propSessionToken;
88
88
  * ```
89
89
  */
90
- declare function useDialTribeOptional(): DialTribeContextValue | null;
90
+ declare function useDialtribeOptional(): DialtribeContextValue | null;
91
91
 
92
92
  /**
93
- * DialTribe API Client
93
+ * Dialtribe API Client
94
94
  *
95
- * Handles all API communication with DialTribe endpoints.
95
+ * Handles all API communication with Dialtribe endpoints.
96
96
  * Automatically manages session token refresh via X-Session-Token headers.
97
97
  *
98
98
  * Supports configurable API base URL for development:
99
99
  * 1. Via environment variable: NEXT_PUBLIC_DIALTRIBE_API_URL
100
- * 2. Via apiBaseUrl prop on DialTribeProvider (takes precedence)
100
+ * 2. Via apiBaseUrl prop on DialtribeProvider (takes precedence)
101
101
  *
102
102
  * Defaults to production URL if neither is specified.
103
103
  */
@@ -128,17 +128,17 @@ interface ApiClientConfig {
128
128
  apiBaseUrl?: string;
129
129
  }
130
130
  /**
131
- * DialTribe API Client
131
+ * Dialtribe API Client
132
132
  *
133
- * Low-level client for making authenticated requests to DialTribe API.
133
+ * Low-level client for making authenticated requests to Dialtribe API.
134
134
  * Handles session token auto-refresh automatically.
135
135
  */
136
- declare class DialTribeClient {
136
+ declare class DialtribeClient {
137
137
  private config;
138
138
  private endpoints;
139
139
  constructor(config: ApiClientConfig);
140
140
  /**
141
- * Make an authenticated request to DialTribe API
141
+ * Make an authenticated request to Dialtribe API
142
142
  *
143
143
  * Automatically:
144
144
  * - Adds Authorization header with session token
@@ -304,8 +304,8 @@ interface TranscriptData {
304
304
  words?: TranscriptWord[];
305
305
  }
306
306
 
307
- interface BroadcastPlayerProps {
308
- /** Broadcast data from DialTribe API */
307
+ interface DialtribePlayerProps {
308
+ /** Broadcast data from Dialtribe API */
309
309
  broadcast: Broadcast;
310
310
  /** Optional: App ID for tracking */
311
311
  appId?: string;
@@ -335,72 +335,28 @@ interface BroadcastPlayerProps {
335
335
  enableKeyboardShortcuts?: boolean;
336
336
  }
337
337
  /**
338
- * BroadcastPlayer - Core media player component (no modal wrapper)
338
+ * DialtribePlayer - Media player component for Dialtribe broadcasts
339
339
  *
340
340
  * Plays video/audio broadcasts with transcript, waveform visualization, and clip creation.
341
- * Uses DialTribeClient for authenticated API calls.
341
+ * For modal or fullscreen display, wrap with the Overlay component.
342
342
  *
343
343
  * @example
344
344
  * ```tsx
345
- * <BroadcastPlayer
346
- * broadcast={broadcast}
347
- * appId="app_123"
348
- * contentId={456}
349
- * />
350
- * ```
351
- */
352
- declare function BroadcastPlayer({ broadcast, appId, contentId, foreignId, foreignTier, renderClipCreator, onError, className, enableKeyboardShortcuts, }: BroadcastPlayerProps): react_jsx_runtime.JSX.Element;
353
-
354
- interface BroadcastPlayerModalProps {
355
- /** Broadcast data from DialTribe API */
356
- broadcast: Broadcast;
357
- /** Whether modal is open */
358
- isOpen: boolean;
359
- /** Called when modal should close */
360
- onClose: () => void;
361
- /** Optional: App ID for tracking */
362
- appId?: string;
363
- /** Optional: Content ID for tracking */
364
- contentId?: number;
365
- /** Foreign user ID from partner system (any tier) */
366
- foreignId?: string;
367
- /** Tier name from partner system (e.g., 'guest', 'member', 'subscriber_gold') */
368
- foreignTier?: string;
369
- /**
370
- * Optional render prop for clip creator
371
- * If provided, the "Create Clip" button will be shown and this will be called when clicked
372
- */
373
- renderClipCreator?: (props: {
374
- isOpen: boolean;
375
- onClose: () => void;
376
- sourceVideoUrl?: string;
377
- sourceAudioUrl?: string;
378
- sourceDuration: number;
379
- onPauseParent: () => void;
380
- }) => React.ReactNode;
381
- /** Optional: Custom CSS classes for the player */
382
- className?: string;
383
- /** Optional: Enable keyboard shortcuts (Space, arrows, M, F, etc.). Default: false */
384
- enableKeyboardShortcuts?: boolean;
385
- }
386
- /**
387
- * BroadcastPlayerModal - Modal wrapper for BroadcastPlayer
345
+ * // Inline (embedded in page)
346
+ * <DialtribePlayer broadcast={broadcast} />
388
347
  *
389
- * Provides a modal overlay with ESC key handling and backdrop click to close.
390
- * Uses the new BroadcastPlayer component for all player functionality.
348
+ * // Modal (wrap with Overlay)
349
+ * <DialtribeOverlay mode="modal" isOpen={show} onClose={() => setShow(false)}>
350
+ * <DialtribePlayer broadcast={broadcast} />
351
+ * </DialtribeOverlay>
391
352
  *
392
- * @example
393
- * ```tsx
394
- * <BroadcastPlayerModal
395
- * broadcast={broadcast}
396
- * isOpen={showModal}
397
- * onClose={() => setShowModal(false)}
398
- * appId="app_123"
399
- * contentId={456}
400
- * />
353
+ * // Fullscreen (wrap with Overlay)
354
+ * <DialtribeOverlay mode="fullscreen" isOpen={show} onClose={() => setShow(false)}>
355
+ * <DialtribePlayer broadcast={broadcast} />
356
+ * </DialtribeOverlay>
401
357
  * ```
402
358
  */
403
- declare function BroadcastPlayerModal({ broadcast, isOpen, onClose, appId, contentId, foreignId, foreignTier, renderClipCreator, className, enableKeyboardShortcuts, }: BroadcastPlayerModalProps): react_jsx_runtime.JSX.Element | null;
359
+ declare function DialtribePlayer({ broadcast, appId, contentId, foreignId, foreignTier, renderClipCreator, onError, className, enableKeyboardShortcuts, }: DialtribePlayerProps): react_jsx_runtime.JSX.Element;
404
360
 
405
361
  interface Props {
406
362
  children: ReactNode;
@@ -434,7 +390,7 @@ interface State {
434
390
  * - Logs errors for debugging
435
391
  * - Allows graceful recovery
436
392
  */
437
- declare class BroadcastPlayerErrorBoundary extends Component<Props, State> {
393
+ declare class DialtribePlayerErrorBoundary extends Component<Props, State> {
438
394
  constructor(props: Props);
439
395
  static getDerivedStateFromError(error: Error): Partial<State>;
440
396
  componentDidCatch(error: Error, errorInfo: ErrorInfo): void;
@@ -488,6 +444,50 @@ interface LoadingSpinnerProps {
488
444
  */
489
445
  declare function LoadingSpinner({ text, size, variant, }: LoadingSpinnerProps): react_jsx_runtime.JSX.Element;
490
446
 
447
+ /** Display mode for the overlay */
448
+ type DialtribeOverlayMode = "modal" | "fullscreen";
449
+ interface DialtribeOverlayProps {
450
+ /** Whether the overlay is open */
451
+ isOpen: boolean;
452
+ /** Called when the overlay should close */
453
+ onClose: () => void;
454
+ /** Display mode: "modal" (centered with backdrop) or "fullscreen" (fills viewport) */
455
+ mode?: DialtribeOverlayMode;
456
+ /** Content to display inside the overlay */
457
+ children: React.ReactNode;
458
+ /** Optional: aria-label for accessibility */
459
+ ariaLabel?: string;
460
+ /** Optional: Show close button. Default: true */
461
+ showCloseButton?: boolean;
462
+ /** Optional: Close on backdrop click. Default: true */
463
+ closeOnBackdropClick?: boolean;
464
+ /** Optional: Close on ESC key. Default: true */
465
+ closeOnEsc?: boolean;
466
+ }
467
+ /**
468
+ * DialtribeOverlay - Reusable modal/fullscreen overlay component
469
+ *
470
+ * Provides a consistent overlay experience with:
471
+ * - Focus management (traps focus, restores on close)
472
+ * - ESC key to close
473
+ * - Backdrop click to close
474
+ * - Accessible with proper ARIA attributes
475
+ *
476
+ * @example
477
+ * ```tsx
478
+ * // Modal mode (centered with backdrop blur)
479
+ * <DialtribeOverlay isOpen={show} onClose={() => setShow(false)} mode="modal">
480
+ * <MyContent />
481
+ * </DialtribeOverlay>
482
+ *
483
+ * // Fullscreen mode (fills entire viewport)
484
+ * <DialtribeOverlay isOpen={show} onClose={() => setShow(false)} mode="fullscreen">
485
+ * <MyContent />
486
+ * </DialtribeOverlay>
487
+ * ```
488
+ */
489
+ declare function DialtribeOverlay({ isOpen, onClose, mode, children, ariaLabel, showCloseButton, closeOnBackdropClick, closeOnEsc, }: DialtribeOverlayProps): react_jsx_runtime.JSX.Element | null;
490
+
491
491
  /**
492
492
  * Format seconds to time string (HH:MM:SS or MM:SS)
493
493
  *
@@ -557,4 +557,4 @@ declare const HTTP_STATUS: {
557
557
  };
558
558
  type HttpStatusCode = typeof HTTP_STATUS[keyof typeof HTTP_STATUS];
559
559
 
560
- export { type ApiClientConfig as A, BroadcastPlayer as B, CDN_DOMAIN as C, DialTribeProvider as D, ENDPOINTS as E, HTTP_STATUS as H, LoadingSpinner as L, type TranscriptWord as T, type DialTribeContextValue as a, type DialTribeProviderProps as b, DialTribeClient as c, DIALTRIBE_API_BASE as d, type BroadcastPlayerProps as e, BroadcastPlayerModal as f, type BroadcastPlayerModalProps as g, BroadcastPlayerErrorBoundary as h, AudioWaveform as i, type Broadcast as j, type TranscriptSegment as k, type TranscriptData as l, formatTime as m, buildBroadcastCdnUrl as n, buildBroadcastS3KeyPrefix as o, type HttpStatusCode as p, useDialTribeOptional as q, useDialTribe as u };
560
+ export { type ApiClientConfig as A, type Broadcast as B, CDN_DOMAIN as C, DialtribeProvider as D, ENDPOINTS as E, HTTP_STATUS as H, LoadingSpinner as L, type TranscriptWord as T, type DialtribeContextValue as a, type DialtribeProviderProps as b, DialtribeClient as c, DIALTRIBE_API_BASE as d, DialtribePlayer as e, type DialtribePlayerProps as f, DialtribePlayerErrorBoundary as g, AudioWaveform as h, DialtribeOverlay as i, type DialtribeOverlayProps as j, type DialtribeOverlayMode as k, type TranscriptSegment as l, type TranscriptData as m, formatTime as n, buildBroadcastCdnUrl as o, buildBroadcastS3KeyPrefix as p, type HttpStatusCode as q, useDialtribeOptional as r, useDialtribe as u };