@angular-helpers/browser-web-apis 21.5.0 → 21.7.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.
@@ -377,59 +377,204 @@ type ErrorCallback = (error: BrowserError) => void;
377
377
  */
378
378
  type ElementInput = Element | ElementRef<Element> | Signal<Element | ElementRef<Element> | undefined>;
379
379
 
380
+ interface BrowserApiLogger {
381
+ info(message: string): void;
382
+ warn(message: string): void;
383
+ error(message: string, error?: unknown): void;
384
+ }
385
+ declare const BROWSER_API_LOGGER: InjectionToken<BrowserApiLogger>;
386
+
380
387
  interface StorageOptions {
388
+ /** Optional prefix used to namespace keys (e.g. `app:` -> `app:userId`). */
381
389
  prefix?: string;
382
390
  serialize?: (value: StorageValue) => string;
383
391
  deserialize?: (value: string) => StorageValue;
384
392
  }
393
+ type StorageArea = 'localStorage' | 'sessionStorage';
385
394
  interface StorageEvent {
386
395
  key: string | null;
387
396
  newValue: StorageValue | null;
388
397
  oldValue: StorageValue | null;
389
- storageArea: 'localStorage' | 'sessionStorage';
398
+ storageArea: StorageArea;
390
399
  }
400
+ interface StorageNamespace {
401
+ readonly area: StorageArea;
402
+ isSupported(): boolean;
403
+ set<T extends StorageValue>(key: string, value: T, opts?: StorageOptions): boolean;
404
+ get<T extends StorageValue>(key: string, defaultValue?: T | null, opts?: StorageOptions): T | null;
405
+ remove(key: string, opts?: StorageOptions): boolean;
406
+ clear(opts?: StorageOptions): boolean;
407
+ size(opts?: StorageOptions): number;
408
+ watch<T extends StorageValue>(key: string, opts?: StorageOptions): Observable<T | null>;
409
+ /** Direct access to the native Storage object. Throws if unsupported. */
410
+ native(): Storage;
411
+ }
412
+
413
+ /**
414
+ * Web Storage service with two namespaces (`local`, `session`) sharing one method
415
+ * surface. SecurityError-safe (Safari private mode, sandboxed iframes return defaults
416
+ * instead of throwing).
417
+ *
418
+ * Preferred usage:
419
+ * ```ts
420
+ * const storage = inject(WebStorageService);
421
+ * storage.local.set('user', { id: 1 });
422
+ * const user = storage.local.get<{ id: number }>('user');
423
+ * storage.local.watch<{ id: number }>('user').subscribe(console.log);
424
+ * ```
425
+ *
426
+ * Legacy methods (`setLocalStorage`, `getLocalStorage`, etc.) remain as deprecated
427
+ * wrappers for one minor cycle; removal slated for v22.
428
+ */
391
429
  declare class WebStorageService extends BrowserApiBaseService {
430
+ private readonly storageLogger;
392
431
  private storageEvents;
432
+ private readonly eventBus;
433
+ /** Local storage namespace. */
434
+ readonly local: StorageNamespace;
435
+ /** Session storage namespace. */
436
+ readonly session: StorageNamespace;
393
437
  constructor();
394
438
  protected getApiName(): string;
395
439
  protected ensureSupported(): void;
396
- private setupEventListeners;
397
- private serializeValue;
398
- private deserializeValue;
399
- private getKey;
400
- private emitStorageChange;
440
+ /** Returns true if either local or session storage is usable. */
441
+ isSupported(): boolean;
442
+ /** Stream of every storage mutation observed in this tab or other tabs. */
443
+ getStorageEvents(): Observable<StorageEvent>;
444
+ private setupCrossTabListener;
445
+ private safeParse;
446
+ /** @deprecated Use `storage.local.set(key, value, opts)`. Removed in v22. */
401
447
  setLocalStorage<T extends StorageValue>(key: string, value: T, options?: StorageOptions): boolean;
448
+ /** @deprecated Use `storage.local.get(key, defaultValue, opts)`. Removed in v22. */
402
449
  getLocalStorage<T extends StorageValue>(key: string, defaultValue?: T | null, options?: StorageOptions): T | null;
450
+ /** @deprecated Use `storage.local.remove(key, opts)`. Removed in v22. */
403
451
  removeLocalStorage(key: string, options?: StorageOptions): boolean;
452
+ /** @deprecated Use `storage.local.clear(opts)`. Removed in v22. */
404
453
  clearLocalStorage(options?: StorageOptions): boolean;
454
+ /** @deprecated Use `storage.session.set(key, value, opts)`. Removed in v22. */
405
455
  setSessionStorage<T extends StorageValue>(key: string, value: T, options?: StorageOptions): boolean;
456
+ /** @deprecated Use `storage.session.get(key, defaultValue, opts)`. Removed in v22. */
406
457
  getSessionStorage<T extends StorageValue>(key: string, defaultValue?: T | null, options?: StorageOptions): T | null;
458
+ /** @deprecated Use `storage.session.remove(key, opts)`. Removed in v22. */
407
459
  removeSessionStorage(key: string, options?: StorageOptions): boolean;
460
+ /** @deprecated Use `storage.session.clear(opts)`. Removed in v22. */
408
461
  clearSessionStorage(options?: StorageOptions): boolean;
462
+ /** @deprecated Use `storage.local.size(opts)`. Removed in v22. */
409
463
  getLocalStorageSize(options?: StorageOptions): number;
464
+ /** @deprecated Use `storage.session.size(opts)`. Removed in v22. */
410
465
  getSessionStorageSize(options?: StorageOptions): number;
411
- getStorageEvents(): Observable<StorageEvent>;
466
+ /** @deprecated Use `storage.local.watch<T>(key, opts)`. Removed in v22. */
412
467
  watchLocalStorage<T extends StorageValue>(key: string, options?: StorageOptions): Observable<T | null>;
468
+ /** @deprecated Use `storage.session.watch<T>(key, opts)`. Removed in v22. */
413
469
  watchSessionStorage<T extends StorageValue>(key: string, options?: StorageOptions): Observable<T | null>;
470
+ /** @deprecated Use `storage.local.native()`. Removed in v22. */
414
471
  getNativeLocalStorage(): Storage;
472
+ /** @deprecated Use `storage.session.native()`. Removed in v22. */
415
473
  getNativeSessionStorage(): Storage;
474
+ private warnLegacyOnce;
416
475
  static ɵfac: i0.ɵɵFactoryDeclaration<WebStorageService, never>;
417
476
  static ɵprov: i0.ɵɵInjectableDeclaration<WebStorageService>;
418
477
  }
419
478
 
420
- interface WebSocketConfig {
479
+ /**
480
+ * Configuration for a single WebSocket connection.
481
+ */
482
+ interface WebSocketClientConfig {
421
483
  url: string;
422
484
  protocols?: string | string[];
485
+ /**
486
+ * Initial reconnect delay in milliseconds. Used as the base for exponential backoff.
487
+ * Set to `0` or omit to disable automatic reconnection.
488
+ */
423
489
  reconnectInterval?: number;
490
+ /** Maximum number of automatic reconnect attempts. Defaults to `0` (disabled). */
424
491
  maxReconnectAttempts?: number;
492
+ /** Hard cap for reconnect delay in milliseconds. Defaults to `30_000`. */
493
+ maxReconnectDelay?: number;
494
+ /** Heartbeat interval in milliseconds. */
425
495
  heartbeatInterval?: number;
496
+ /** Payload sent on every heartbeat tick when `heartbeatInterval` is set. */
426
497
  heartbeatMessage?: unknown;
427
498
  }
428
499
  interface WebSocketMessage<T = unknown> {
500
+ /** Message identifier. Auto-generated when omitted. */
501
+ id?: string;
429
502
  type: string;
430
503
  data: T;
504
+ /** Server-assigned correlation id (used by `request()` to match responses). */
505
+ correlationId?: string;
431
506
  timestamp?: number;
432
507
  }
508
+ type WebSocketState = 'idle' | 'connecting' | 'open' | 'closing' | 'closed' | 'reconnecting';
509
+ interface WebSocketStatusV2 {
510
+ readonly state: WebSocketState;
511
+ readonly reconnectAttempts: number;
512
+ readonly error: string | null;
513
+ }
514
+ interface WebSocketRequestOptions {
515
+ /** Timeout in milliseconds. Defaults to `30_000`. */
516
+ timeout?: number;
517
+ }
518
+ /**
519
+ * Stateful WebSocket client wrapping a single connection. One instance per logical
520
+ * connection (do NOT share between `connect()` calls).
521
+ *
522
+ * Surfaces:
523
+ * - `status`: signal of the current connection state.
524
+ * - `messages$`: stream of every received message (parsed JSON).
525
+ * - `send` / `sendRaw`: outbound traffic.
526
+ * - `request<T>(type, data)`: round-trip with id correlation and timeout.
527
+ * - `close`: idempotent disposal.
528
+ *
529
+ * Reconnect uses exponential backoff with jitter, capped by `maxReconnectDelay`.
530
+ */
531
+ declare class WebSocketClient {
532
+ private readonly config;
533
+ private readonly logger;
534
+ private socket;
535
+ private reconnectTimer;
536
+ private heartbeatTimer;
537
+ private readonly _status;
538
+ private readonly _messages$;
539
+ private readonly pendingRequests;
540
+ private disposed;
541
+ private reconnectAttempts;
542
+ constructor(config: WebSocketClientConfig, logger: BrowserApiLogger, destroyRef?: DestroyRef);
543
+ get status(): Signal<WebSocketStatusV2>;
544
+ get messages$(): Observable<WebSocketMessage>;
545
+ messagesByType<T = unknown>(type: string): Observable<WebSocketMessage<T>>;
546
+ send<T>(message: WebSocketMessage<T>): void;
547
+ sendRaw(data: string): void;
548
+ /**
549
+ * Send a message and await a correlated response. The server MUST echo back the
550
+ * `correlationId` from the request as `correlationId` on the response message.
551
+ */
552
+ request<TRes = unknown, TReq = unknown>(type: string, data: TReq, opts?: WebSocketRequestOptions): Promise<TRes>;
553
+ close(): void;
554
+ /** Internal handle for tests and advanced usage. */
555
+ getNativeSocket(): WebSocket | null;
556
+ private openSocket;
557
+ private attachHandlers;
558
+ private handleIncoming;
559
+ private scheduleReconnect;
560
+ /**
561
+ * Exponential backoff with full jitter:
562
+ * baseDelay = min(maxDelay, interval * 2^(attempt - 1))
563
+ * delay = random(0, baseDelay)
564
+ */
565
+ static computeBackoffDelay(attempt: number, interval: number, maxDelay: number): number;
566
+ private startHeartbeat;
567
+ private stopHeartbeat;
568
+ private clearTimers;
569
+ private rejectAllPending;
570
+ private updateStatus;
571
+ private generateId;
572
+ }
573
+
574
+ /**
575
+ * @deprecated Use `WebSocketStatusV2` (via `WebSocketClient.status`).
576
+ * Kept for backward compatibility — will be removed in v22.
577
+ */
433
578
  interface WebSocketStatus {
434
579
  connected: boolean;
435
580
  connecting: boolean;
@@ -437,30 +582,70 @@ interface WebSocketStatus {
437
582
  error?: string;
438
583
  reconnectAttempts: number;
439
584
  }
585
+ /**
586
+ * @deprecated Use `WebSocketClientConfig`. Kept as alias for backward compatibility.
587
+ */
588
+ type WebSocketConfig = WebSocketClientConfig & {
589
+ /** @deprecated Use `heartbeatMessage` directly. */
590
+ heartbeatMessage?: unknown;
591
+ };
592
+
593
+ /**
594
+ * Service that creates and tracks `WebSocketClient` instances.
595
+ *
596
+ * Preferred usage:
597
+ * ```ts
598
+ * const ws = inject(WebSocketService);
599
+ * const client = ws.createClient({ url: 'wss://...' });
600
+ * effect(() => console.log(client.status()));
601
+ * await client.request('ping', {});
602
+ * ```
603
+ *
604
+ * Legacy usage (`connect()` returning Observable) is preserved for one minor cycle
605
+ * and will be removed in v22.
606
+ */
440
607
  declare class WebSocketService extends BrowserApiBaseService {
441
- private webSocket;
442
- private statusSubject;
443
- private messageSubject;
444
- private reconnectAttempts;
445
- private reconnectTimer;
446
- private heartbeatTimer;
608
+ private readonly wsLogger;
609
+ private readonly clients;
447
610
  private readonly _cleanup;
611
+ /** Legacy single-connection holder used by deprecated `connect()`/`send()` API. */
612
+ private legacyClient;
448
613
  protected getApiName(): string;
449
614
  protected ensureSupported(): void;
615
+ /**
616
+ * Create a new WebSocket client. The client owns one connection and is the recommended
617
+ * surface for all interactions (status signal, request/response, reconnect, etc.).
618
+ *
619
+ * The returned client is automatically disposed when the host injector is destroyed.
620
+ */
621
+ createClient(config: WebSocketClientConfig): WebSocketClient;
622
+ /** Dispose every client created via `createClient()` (also called automatically on destroy). */
623
+ disposeAll(): void;
624
+ /**
625
+ * @deprecated Use {@link createClient} which returns a `WebSocketClient` exposing a
626
+ * status signal, request/response, and proper reconnect. This wrapper will be removed
627
+ * in v22.
628
+ */
450
629
  connect(config: WebSocketConfig): Observable<WebSocketStatus>;
630
+ /** @deprecated Use {@link createClient} and call `client.close()`. */
451
631
  disconnect(): void;
632
+ /** @deprecated Use the client returned by {@link createClient}. */
452
633
  send<T>(message: WebSocketMessage<T>): void;
634
+ /** @deprecated Use the client returned by {@link createClient}. */
453
635
  sendRaw(data: string): void;
636
+ /** @deprecated Use `client.status` from {@link createClient}. */
454
637
  getStatus(): Observable<WebSocketStatus>;
638
+ /** @deprecated Use `client.messages$` from {@link createClient}. */
455
639
  getMessages<T = unknown>(): Observable<WebSocketMessage<T>>;
640
+ /** @deprecated Use `client.messagesByType()` from {@link createClient}. */
456
641
  getMessagesByType<T = unknown>(type: string): Observable<WebSocketMessage<T>>;
457
- private setupWebSocketHandlers;
458
- private startHeartbeat;
459
- private attemptReconnect;
460
- private updateStatus;
642
+ /** @deprecated Use the client returned by {@link createClient}. */
461
643
  getNativeWebSocket(): WebSocket | null;
644
+ /** @deprecated Use `client.status()` from {@link createClient}. */
462
645
  isConnected(): boolean;
646
+ /** @deprecated Use the native socket via `client.getNativeSocket()`. */
463
647
  getReadyState(): number;
648
+ private warnLegacyOnce;
464
649
  static ɵfac: i0.ɵɵFactoryDeclaration<WebSocketService, never>;
465
650
  static ɵprov: i0.ɵɵInjectableDeclaration<WebSocketService>;
466
651
  }
@@ -846,54 +1031,6 @@ declare class PerformanceObserverService extends BrowserApiBaseService {
846
1031
  static ɵprov: i0.ɵɵInjectableDeclaration<PerformanceObserverService>;
847
1032
  }
848
1033
 
849
- type UserIdleState = 'active' | 'idle';
850
- type ScreenIdleState = 'locked' | 'unlocked';
851
- interface IdleState {
852
- user: UserIdleState;
853
- screen: ScreenIdleState;
854
- }
855
- interface IdleDetectorOptions {
856
- threshold?: number;
857
- }
858
- declare class IdleDetectorService extends BrowserApiBaseService {
859
- protected getApiName(): string;
860
- isSupported(): boolean;
861
- requestPermission(): Promise<PermissionState>;
862
- watch(options?: IdleDetectorOptions): Observable<IdleState>;
863
- static ɵfac: i0.ɵɵFactoryDeclaration<IdleDetectorService, never>;
864
- static ɵprov: i0.ɵɵInjectableDeclaration<IdleDetectorService>;
865
- }
866
-
867
- interface ColorSelectionResult {
868
- sRGBHex: string;
869
- }
870
- declare class EyeDropperService extends BrowserApiBaseService {
871
- protected getApiName(): string;
872
- isSupported(): boolean;
873
- open(signal?: AbortSignal): Promise<ColorSelectionResult>;
874
- static ɵfac: i0.ɵɵFactoryDeclaration<EyeDropperService, never>;
875
- static ɵprov: i0.ɵɵInjectableDeclaration<EyeDropperService>;
876
- }
877
-
878
- type BarcodeFormat = 'aztec' | 'code_128' | 'code_39' | 'code_93' | 'codabar' | 'data_matrix' | 'ean_13' | 'ean_8' | 'itf' | 'pdf417' | 'qr_code' | 'upc_a' | 'upc_e' | 'unknown';
879
- interface DetectedBarcode {
880
- boundingBox: DOMRectReadOnly;
881
- cornerPoints: ReadonlyArray<{
882
- x: number;
883
- y: number;
884
- }>;
885
- format: BarcodeFormat;
886
- rawValue: string;
887
- }
888
- declare class BarcodeDetectorService extends BrowserApiBaseService {
889
- protected getApiName(): string;
890
- isSupported(): boolean;
891
- getSupportedFormats(): Promise<BarcodeFormat[]>;
892
- detect(image: ImageBitmapSource, formats?: BarcodeFormat[]): Promise<DetectedBarcode[]>;
893
- static ɵfac: i0.ɵɵFactoryDeclaration<BarcodeDetectorService, never>;
894
- static ɵprov: i0.ɵɵInjectableDeclaration<BarcodeDetectorService>;
895
- }
896
-
897
1034
  type AudioContextState = 'suspended' | 'running' | 'closed';
898
1035
  interface AudioAnalyserData {
899
1036
  frequencyData: Uint8Array;
@@ -943,234 +1080,6 @@ declare class GamepadService extends BrowserApiBaseService {
943
1080
  static ɵprov: i0.ɵɵInjectableDeclaration<GamepadService>;
944
1081
  }
945
1082
 
946
- interface BluetoothRequestDeviceOptions {
947
- filters?: Array<{
948
- services?: string[];
949
- name?: string;
950
- namePrefix?: string;
951
- }>;
952
- optionalServices?: string[];
953
- acceptAllDevices?: boolean;
954
- }
955
- interface BluetoothRemoteGATTServer {
956
- readonly connected: boolean;
957
- readonly device: BluetoothDeviceRef;
958
- connect(): Promise<BluetoothRemoteGATTServer>;
959
- disconnect(): void;
960
- getPrimaryService(service: string): Promise<BluetoothRemoteGATTService>;
961
- }
962
- interface BluetoothRemoteGATTService {
963
- getCharacteristic(characteristic: string): Promise<BluetoothRemoteGATTCharacteristic>;
964
- }
965
- interface BluetoothRemoteGATTCharacteristic extends EventTarget {
966
- readonly value: DataView | null;
967
- readValue(): Promise<DataView>;
968
- writeValue(value: BufferSource): Promise<void>;
969
- startNotifications(): Promise<BluetoothRemoteGATTCharacteristic>;
970
- stopNotifications(): Promise<BluetoothRemoteGATTCharacteristic>;
971
- }
972
- interface BluetoothDeviceRef extends EventTarget {
973
- readonly id: string;
974
- readonly name: string | undefined;
975
- readonly gatt: BluetoothRemoteGATTServer | undefined;
976
- }
977
- interface UsbDeviceRef {
978
- readonly vendorId: number;
979
- readonly productId: number;
980
- readonly productName: string | undefined;
981
- readonly manufacturerName: string | undefined;
982
- readonly serialNumber: string | undefined;
983
- readonly opened: boolean;
984
- open(): Promise<void>;
985
- close(): Promise<void>;
986
- selectConfiguration(configurationValue: number): Promise<void>;
987
- claimInterface(interfaceNumber: number): Promise<void>;
988
- releaseInterface(interfaceNumber: number): Promise<void>;
989
- transferIn(endpointNumber: number, length: number): Promise<UsbTransferResult>;
990
- transferOut(endpointNumber: number, data: BufferSource): Promise<UsbTransferResult>;
991
- }
992
- interface UsbTransferResult {
993
- readonly data: DataView | undefined;
994
- readonly status: 'ok' | 'stall' | 'babble';
995
- }
996
- interface UsbDeviceFilterDef {
997
- vendorId?: number;
998
- productId?: number;
999
- classCode?: number;
1000
- subclassCode?: number;
1001
- protocolCode?: number;
1002
- serialNumber?: string;
1003
- }
1004
- interface NdefMessage {
1005
- records: NdefRecord[];
1006
- }
1007
- interface NdefRecord {
1008
- recordType: string;
1009
- mediaType?: string;
1010
- id?: string;
1011
- data?: DataView;
1012
- encoding?: string;
1013
- lang?: string;
1014
- }
1015
- interface NdefReadingEvent {
1016
- serialNumber: string;
1017
- message: NdefMessage;
1018
- }
1019
- interface NdefWriteOptions {
1020
- overwrite?: boolean;
1021
- signal?: AbortSignal;
1022
- }
1023
-
1024
- interface BluetoothDeviceInfo {
1025
- id: string;
1026
- name: string | undefined;
1027
- connected: boolean;
1028
- }
1029
- declare class WebBluetoothService extends BrowserApiBaseService {
1030
- protected getApiName(): string;
1031
- isSupported(): boolean;
1032
- requestDevice(options?: BluetoothRequestDeviceOptions): Promise<BluetoothDeviceRef>;
1033
- connect(device: BluetoothDeviceRef): Promise<BluetoothRemoteGATTServer>;
1034
- disconnect(device: BluetoothDeviceRef): void;
1035
- watchDisconnection(device: BluetoothDeviceRef): Observable<void>;
1036
- readCharacteristic(server: BluetoothRemoteGATTServer, serviceUuid: string, characteristicUuid: string): Promise<DataView>;
1037
- writeCharacteristic(server: BluetoothRemoteGATTServer, serviceUuid: string, characteristicUuid: string, value: BufferSource): Promise<void>;
1038
- watchCharacteristic(server: BluetoothRemoteGATTServer, serviceUuid: string, characteristicUuid: string): Observable<DataView>;
1039
- static ɵfac: i0.ɵɵFactoryDeclaration<WebBluetoothService, never>;
1040
- static ɵprov: i0.ɵɵInjectableDeclaration<WebBluetoothService>;
1041
- }
1042
-
1043
- interface UsbDeviceInfo {
1044
- vendorId: number;
1045
- productId: number;
1046
- productName: string | undefined;
1047
- manufacturerName: string | undefined;
1048
- serialNumber: string | undefined;
1049
- opened: boolean;
1050
- }
1051
- declare class WebUsbService extends BrowserApiBaseService {
1052
- protected getApiName(): string;
1053
- isSupported(): boolean;
1054
- requestDevice(filters?: UsbDeviceFilterDef[]): Promise<UsbDeviceRef>;
1055
- getDevices(): Promise<UsbDeviceRef[]>;
1056
- open(device: UsbDeviceRef): Promise<void>;
1057
- close(device: UsbDeviceRef): Promise<void>;
1058
- selectConfiguration(device: UsbDeviceRef, configurationValue: number): Promise<void>;
1059
- claimInterface(device: UsbDeviceRef, interfaceNumber: number): Promise<void>;
1060
- releaseInterface(device: UsbDeviceRef, interfaceNumber: number): Promise<void>;
1061
- transferIn(device: UsbDeviceRef, endpointNumber: number, length: number): Promise<UsbTransferResult>;
1062
- transferOut(device: UsbDeviceRef, endpointNumber: number, data: BufferSource): Promise<UsbTransferResult>;
1063
- watchConnection(): Observable<{
1064
- device: UsbDeviceRef;
1065
- type: 'connect' | 'disconnect';
1066
- }>;
1067
- getDeviceInfo(device: UsbDeviceRef): UsbDeviceInfo;
1068
- static ɵfac: i0.ɵɵFactoryDeclaration<WebUsbService, never>;
1069
- static ɵprov: i0.ɵɵInjectableDeclaration<WebUsbService>;
1070
- }
1071
-
1072
- declare class WebNfcService extends BrowserApiBaseService {
1073
- protected getApiName(): string;
1074
- isSupported(): boolean;
1075
- scan(): Observable<NdefReadingEvent>;
1076
- write(message: NdefMessage | string, options?: NdefWriteOptions): Promise<void>;
1077
- static ɵfac: i0.ɵɵFactoryDeclaration<WebNfcService, never>;
1078
- static ɵprov: i0.ɵɵInjectableDeclaration<WebNfcService>;
1079
- }
1080
-
1081
- interface PaymentMethodConfig {
1082
- supportedMethods: string;
1083
- data?: Record<string, unknown>;
1084
- }
1085
- interface PaymentDetailsInit {
1086
- total: {
1087
- label: string;
1088
- amount: {
1089
- currency: string;
1090
- value: string;
1091
- };
1092
- };
1093
- displayItems?: Array<{
1094
- label: string;
1095
- amount: {
1096
- currency: string;
1097
- value: string;
1098
- };
1099
- }>;
1100
- }
1101
- interface PaymentOptionsConfig {
1102
- requestPayerName?: boolean;
1103
- requestPayerEmail?: boolean;
1104
- requestPayerPhone?: boolean;
1105
- requestShipping?: boolean;
1106
- }
1107
- interface PaymentResult {
1108
- methodName: string;
1109
- details: Record<string, unknown>;
1110
- payerName: string | null;
1111
- payerEmail: string | null;
1112
- payerPhone: string | null;
1113
- }
1114
- declare class PaymentRequestService extends BrowserApiBaseService {
1115
- protected getApiName(): string;
1116
- isSupported(): boolean;
1117
- canMakePayment(methods: PaymentMethodConfig[], details: PaymentDetailsInit): Promise<boolean>;
1118
- show(methods: PaymentMethodConfig[], details: PaymentDetailsInit, options?: PaymentOptionsConfig): Promise<PaymentResult>;
1119
- abort(methods: PaymentMethodConfig[], details: PaymentDetailsInit): Promise<void>;
1120
- static ɵfac: i0.ɵɵFactoryDeclaration<PaymentRequestService, never>;
1121
- static ɵprov: i0.ɵɵInjectableDeclaration<PaymentRequestService>;
1122
- }
1123
-
1124
- interface PasswordCredentialData {
1125
- id: string;
1126
- password: string;
1127
- name?: string;
1128
- iconURL?: string;
1129
- }
1130
- interface PublicKeyCredentialOptions {
1131
- challenge: BufferSource;
1132
- rp: {
1133
- name: string;
1134
- id?: string;
1135
- };
1136
- user: {
1137
- id: BufferSource;
1138
- name: string;
1139
- displayName: string;
1140
- };
1141
- pubKeyCredParams: Array<{
1142
- type: 'public-key';
1143
- alg: number;
1144
- }>;
1145
- timeout?: number;
1146
- attestation?: AttestationConveyancePreference;
1147
- authenticatorSelection?: AuthenticatorSelectionCriteria;
1148
- }
1149
- interface CredentialResult {
1150
- id: string;
1151
- type: string;
1152
- }
1153
- declare class CredentialManagementService extends BrowserApiBaseService {
1154
- protected getApiName(): string;
1155
- isSupported(): boolean;
1156
- isPublicKeySupported(): boolean;
1157
- get(options?: CredentialRequestOptions): Promise<Credential | null>;
1158
- store(credential: Credential): Promise<void>;
1159
- createPasswordCredential(data: PasswordCredentialData): Promise<Credential>;
1160
- createPublicKeyCredential(options: PublicKeyCredentialOptions): Promise<Credential | null>;
1161
- preventSilentAccess(): Promise<void>;
1162
- isConditionalMediationAvailable(): Promise<boolean>;
1163
- static ɵfac: i0.ɵɵFactoryDeclaration<CredentialManagementService, never>;
1164
- static ɵprov: i0.ɵɵInjectableDeclaration<CredentialManagementService>;
1165
- }
1166
-
1167
- interface BrowserApiLogger {
1168
- info(message: string): void;
1169
- warn(message: string): void;
1170
- error(message: string, error?: unknown): void;
1171
- }
1172
- declare const BROWSER_API_LOGGER: InjectionToken<BrowserApiLogger>;
1173
-
1174
1083
  interface MediaDevice {
1175
1084
  deviceId: string;
1176
1085
  groupId: string;
@@ -1317,15 +1226,6 @@ interface PerformanceObserverRef {
1317
1226
  }
1318
1227
  declare function injectPerformanceObserver(config: PerformanceObserverConfig): PerformanceObserverRef;
1319
1228
 
1320
- interface IdleDetectorRef {
1321
- readonly state: Signal<IdleState>;
1322
- readonly userState: Signal<UserIdleState>;
1323
- readonly screenState: Signal<ScreenIdleState>;
1324
- readonly isUserIdle: Signal<boolean>;
1325
- readonly isScreenLocked: Signal<boolean>;
1326
- }
1327
- declare function injectIdleDetector(options?: IdleDetectorOptions): IdleDetectorRef;
1328
-
1329
1229
  interface GamepadRef {
1330
1230
  readonly state: Signal<GamepadState | null>;
1331
1231
  readonly connected: Signal<boolean>;
@@ -1380,8 +1280,6 @@ declare function provideFileSystemAccess(): EnvironmentProviders;
1380
1280
 
1381
1281
  declare function provideMediaRecorder(): EnvironmentProviders;
1382
1282
 
1383
- declare function provideIdleDetector(): EnvironmentProviders;
1384
-
1385
1283
  declare function provideBattery(): EnvironmentProviders;
1386
1284
 
1387
1285
  declare function provideWebShare(): EnvironmentProviders;
@@ -1416,24 +1314,10 @@ declare function provideMutationObserver(): EnvironmentProviders;
1416
1314
 
1417
1315
  declare function providePerformanceObserver(): EnvironmentProviders;
1418
1316
 
1419
- declare function provideEyeDropper(): EnvironmentProviders;
1420
-
1421
- declare function provideBarcodeDetector(): EnvironmentProviders;
1422
-
1423
1317
  declare function provideWebAudio(): EnvironmentProviders;
1424
1318
 
1425
1319
  declare function provideGamepad(): EnvironmentProviders;
1426
1320
 
1427
- declare function provideWebBluetooth(): EnvironmentProviders;
1428
-
1429
- declare function provideWebUsb(): EnvironmentProviders;
1430
-
1431
- declare function provideWebNfc(): EnvironmentProviders;
1432
-
1433
- declare function providePaymentRequest(): EnvironmentProviders;
1434
-
1435
- declare function provideCredentialManagement(): EnvironmentProviders;
1436
-
1437
1321
  declare function provideMediaApis(): EnvironmentProviders;
1438
1322
  declare function provideLocationApis(): EnvironmentProviders;
1439
1323
  declare function provideStorageApis(): EnvironmentProviders;
@@ -1465,21 +1349,13 @@ interface BrowserWebApisConfig {
1465
1349
  enableSpeechSynthesis?: boolean;
1466
1350
  enableMutationObserver?: boolean;
1467
1351
  enablePerformanceObserver?: boolean;
1468
- enableIdleDetector?: boolean;
1469
- enableEyeDropper?: boolean;
1470
- enableBarcodeDetector?: boolean;
1471
1352
  enableWebAudio?: boolean;
1472
1353
  enableGamepad?: boolean;
1473
- enableWebBluetooth?: boolean;
1474
- enableWebUsb?: boolean;
1475
- enableWebNfc?: boolean;
1476
- enablePaymentRequest?: boolean;
1477
- enableCredentialManagement?: boolean;
1478
1354
  }
1479
1355
  declare const defaultBrowserWebApisConfig: BrowserWebApisConfig;
1480
1356
  declare function provideBrowserWebApis(config?: BrowserWebApisConfig): EnvironmentProviders;
1481
1357
 
1482
1358
  declare const version = "0.1.0";
1483
1359
 
1484
- export { BROWSER_API_LOGGER, BarcodeDetectorService, BatteryService, BroadcastChannelService, BrowserApiBaseService, BrowserCapabilityService, BrowserSupportUtil, CameraService, ClipboardService, ConnectionRegistryBaseService, CredentialManagementService, EyeDropperService, FileSystemAccessService, FullscreenService, GamepadService, GeolocationService, IdleDetectorService, IntersectionObserverService, MediaDevicesService, MediaRecorderService, MutationObserverService, NetworkInformationService, NotificationService, PageVisibilityService, PaymentRequestService, PerformanceObserverService, PermissionsService, ResizeObserverService, ScreenOrientationService, ScreenWakeLockService, ServerSentEventsService, SpeechSynthesisService, VibrationService, WebAudioService, WebBluetoothService, WebNfcService, WebShareService, WebSocketService, WebStorageService, WebUsbService, WebWorkerService, permissionGuard as createPermissionGuard, defaultBrowserWebApisConfig, injectGamepad, injectIdleDetector, injectIntersectionObserver, injectMutationObserver, injectNetworkInformation, injectPageVisibility, injectPerformanceObserver, injectResizeObserver, injectScreenOrientation, permissionGuard, provideBarcodeDetector, provideBattery, provideBroadcastChannel, provideBrowserWebApis, provideCamera, provideClipboard, provideCommunicationApis, provideCredentialManagement, provideEyeDropper, provideFileSystemAccess, provideFullscreen, provideGamepad, provideGeolocation, provideIdleDetector, provideIntersectionObserver, provideLocationApis, provideMediaApis, provideMediaDevices, provideMediaRecorder, provideMutationObserver, provideNetworkInformation, provideNotifications, providePageVisibility, providePaymentRequest, providePerformanceObserver, providePermissions, provideResizeObserver, provideScreenOrientation, provideScreenWakeLock, provideServerSentEvents, provideSpeechSynthesis, provideStorageApis, provideVibration, provideWebAudio, provideWebBluetooth, provideWebNfc, provideWebShare, provideWebSocket, provideWebStorage, provideWebUsb, provideWebWorker, version };
1485
- export type { AudioAnalyserData, AudioContextState, BarcodeFormat, BatteryInfo, BatteryManager, BluetoothDeviceInfo, BluetoothDeviceRef, BluetoothRequestDeviceOptions, BrowserApiLogger, BrowserCapabilityId, BrowserError, BrowserPermissions, BrowserWebApisConfig, CameraCapabilities, CameraInfo, ColorSelectionResult, ConnectionType, CredentialResult, DetectedBarcode, EffectiveConnectionType, ElementInput, ElementSize, ErrorCallback, EventHandler, FileOpenOptions, FileSaveOptions, GamepadRef, GamepadState, GeolocationCoordinates, GeolocationError, GeolocationOptions, GeolocationPosition$1 as GeolocationPosition, GeolocationWatchOptions, IdleDetectorOptions, IdleDetectorRef, IdleState, IntersectionObserverOptions, IntersectionRef, MediaDevice, MediaDeviceKind, MediaDevicesInfo, MediaStreamConstraints$1 as MediaStreamConstraints, MediaTrackConstraints$1 as MediaTrackConstraints, MutationObserverOptions, MutationRef, NdefMessage, NdefReadingEvent, NdefWriteOptions, NetworkInformation, NetworkInformationRef, OrientationInfo, OrientationLockType, OrientationType, PageVisibilityRef, PasswordCredentialData, PaymentDetailsInit, PaymentMethodConfig, PaymentOptionsConfig, PaymentResult, PerformanceEntryType, PerformanceObserverConfig, PerformanceObserverRef, PermissionNameExt, PermissionRequest, PublicKeyCredentialOptions, RecordingOptions, RecordingResult, RecordingState, ResizeObserverOptions, ResizeRef, SSEConfig, SSEConnectionState, SSEMessage, ScreenIdleState, ScreenOrientationRef, SpeechOptions, SpeechState, StorageEvent, StorageOptions, StorageValue, UsbDeviceFilterDef, UsbDeviceInfo, UsbDeviceRef, UserIdleState, VibrationPattern, VibrationPreset, VisibilityState, WakeLockStatus, WakeLockType, WebSocketConfig, WebSocketMessage, WebSocketStatus, WorkerMessage, WorkerStatus, WorkerTask };
1360
+ export { BROWSER_API_LOGGER, BatteryService, BroadcastChannelService, BrowserApiBaseService, BrowserCapabilityService, BrowserSupportUtil, CameraService, ClipboardService, ConnectionRegistryBaseService, FileSystemAccessService, FullscreenService, GamepadService, GeolocationService, IntersectionObserverService, MediaDevicesService, MediaRecorderService, MutationObserverService, NetworkInformationService, NotificationService, PageVisibilityService, PerformanceObserverService, PermissionsService, ResizeObserverService, ScreenOrientationService, ScreenWakeLockService, ServerSentEventsService, SpeechSynthesisService, VibrationService, WebAudioService, WebShareService, WebSocketClient, WebSocketService, WebStorageService, WebWorkerService, permissionGuard as createPermissionGuard, defaultBrowserWebApisConfig, injectGamepad, injectIntersectionObserver, injectMutationObserver, injectNetworkInformation, injectPageVisibility, injectPerformanceObserver, injectResizeObserver, injectScreenOrientation, permissionGuard, provideBattery, provideBroadcastChannel, provideBrowserWebApis, provideCamera, provideClipboard, provideCommunicationApis, provideFileSystemAccess, provideFullscreen, provideGamepad, provideGeolocation, provideIntersectionObserver, provideLocationApis, provideMediaApis, provideMediaDevices, provideMediaRecorder, provideMutationObserver, provideNetworkInformation, provideNotifications, providePageVisibility, providePerformanceObserver, providePermissions, provideResizeObserver, provideScreenOrientation, provideScreenWakeLock, provideServerSentEvents, provideSpeechSynthesis, provideStorageApis, provideVibration, provideWebAudio, provideWebShare, provideWebSocket, provideWebStorage, provideWebWorker, version };
1361
+ export type { AudioAnalyserData, AudioContextState, BatteryInfo, BatteryManager, BrowserApiLogger, BrowserCapabilityId, BrowserError, BrowserPermissions, BrowserWebApisConfig, CameraCapabilities, CameraInfo, ConnectionType, EffectiveConnectionType, ElementInput, ElementSize, ErrorCallback, EventHandler, FileOpenOptions, FileSaveOptions, GamepadRef, GamepadState, GeolocationCoordinates, GeolocationError, GeolocationOptions, GeolocationPosition$1 as GeolocationPosition, GeolocationWatchOptions, IntersectionObserverOptions, IntersectionRef, MediaDevice, MediaDeviceKind, MediaDevicesInfo, MediaStreamConstraints$1 as MediaStreamConstraints, MediaTrackConstraints$1 as MediaTrackConstraints, MutationObserverOptions, MutationRef, NetworkInformation, NetworkInformationRef, OrientationInfo, OrientationLockType, OrientationType, PageVisibilityRef, PerformanceEntryType, PerformanceObserverConfig, PerformanceObserverRef, PermissionNameExt, PermissionRequest, RecordingOptions, RecordingResult, RecordingState, ResizeObserverOptions, ResizeRef, SSEConfig, SSEConnectionState, SSEMessage, ScreenOrientationRef, SpeechOptions, SpeechState, StorageEvent, StorageNamespace, StorageOptions, StorageValue, VibrationPattern, VibrationPreset, VisibilityState, WakeLockStatus, WakeLockType, WebSocketClientConfig, WebSocketConfig, WebSocketMessage, WebSocketRequestOptions, WebSocketState, WebSocketStatus, WebSocketStatusV2, WorkerMessage, WorkerStatus, WorkerTask };