@plyaz/types 1.19.5 → 1.20.0

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.
@@ -10,6 +10,8 @@ import type { UnknownRecord } from 'type-fest';
10
10
  import type { NETWORK_QUALITY, NetworkInfo } from '../network';
11
11
  import type { ConfigConflict, DebugInfo } from '../debugger';
12
12
  import type { PackageErrorLike } from '../../errors';
13
+ import type { ReactNode } from 'react';
14
+ import type { QueryClient } from '@tanstack/react-query';
13
15
  /**
14
16
  * Options for creating an API client
15
17
  * Endpoints are automatically included from src/api/endpoints
@@ -406,3 +408,60 @@ export interface SetupUnifiedHandlersParams {
406
408
  clientOptions?: ApiClientOptions;
407
409
  clearTemporaryOverrides?: () => void;
408
410
  }
411
+ /**
412
+ * Props for API initialization loading component.
413
+ * Used by ApiProvider to display loading state during client initialization.
414
+ */
415
+ export interface ApiInitializationLoadingProps {
416
+ /** Custom loading component override */
417
+ loading?: ReactNode;
418
+ }
419
+ /**
420
+ * Props for API initialization error component.
421
+ * Used by ApiProvider to display error state when initialization fails.
422
+ */
423
+ export interface ApiInitializationErrorProps {
424
+ /** The error that occurred during initialization */
425
+ error: PackageErrorLike;
426
+ /** Custom error component override */
427
+ errorComponent?: (error: PackageErrorLike) => ReactNode;
428
+ }
429
+ /**
430
+ * Props for ApiProvider component.
431
+ * Provides React Query context and optionally initializes the default API client.
432
+ */
433
+ export interface ApiProviderProps {
434
+ /** Child components that will have access to React Query */
435
+ children: ReactNode;
436
+ /** Optional custom QueryClient instance (defaults to shared singleton) */
437
+ queryClient?: QueryClient;
438
+ /**
439
+ * Optional global API configuration.
440
+ * Applied via setGlobalConfig() before client initialization.
441
+ * These settings apply to ALL API clients as defaults.
442
+ */
443
+ globalConfig?: ApiConfig;
444
+ /**
445
+ * Optional API client configuration.
446
+ * If provided, creates and sets the default API client automatically.
447
+ */
448
+ apiConfig?: ApiClientOptions;
449
+ /**
450
+ * Custom loading component to show while API client is initializing.
451
+ * Overrides the default ApiInitializationLoading component.
452
+ */
453
+ loading?: ReactNode;
454
+ /**
455
+ * Custom error renderer function.
456
+ * Overrides the default ApiInitializationError component.
457
+ */
458
+ error?: (error: PackageErrorLike) => ReactNode;
459
+ /**
460
+ * Callback when API client is ready.
461
+ */
462
+ onReady?: () => void;
463
+ /**
464
+ * Callback when API client initialization fails.
465
+ */
466
+ onError?: (error: PackageErrorLike) => void;
467
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plyaz/types",
3
- "version": "1.19.5",
3
+ "version": "1.20.0",
4
4
  "author": "Redeemer Pace",
5
5
  "license": "ISC",
6
6
  "description": "Provides shared TypeScript types and schema utilities for validation and parsing in the @playz ecosystem.",