@angular-helpers/browser-web-apis 21.5.0 → 21.6.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.
- package/fesm2022/angular-helpers-browser-web-apis-experimental.mjs +478 -0
- package/fesm2022/angular-helpers-browser-web-apis.mjs +398 -628
- package/package.json +5 -1
- package/types/angular-helpers-browser-web-apis-experimental.d.ts +325 -0
- package/types/angular-helpers-browser-web-apis.d.ts +146 -322
|
@@ -417,19 +417,112 @@ declare class WebStorageService extends BrowserApiBaseService {
|
|
|
417
417
|
static ɵprov: i0.ɵɵInjectableDeclaration<WebStorageService>;
|
|
418
418
|
}
|
|
419
419
|
|
|
420
|
-
interface
|
|
420
|
+
interface BrowserApiLogger {
|
|
421
|
+
info(message: string): void;
|
|
422
|
+
warn(message: string): void;
|
|
423
|
+
error(message: string, error?: unknown): void;
|
|
424
|
+
}
|
|
425
|
+
declare const BROWSER_API_LOGGER: InjectionToken<BrowserApiLogger>;
|
|
426
|
+
|
|
427
|
+
/**
|
|
428
|
+
* Configuration for a single WebSocket connection.
|
|
429
|
+
*/
|
|
430
|
+
interface WebSocketClientConfig {
|
|
421
431
|
url: string;
|
|
422
432
|
protocols?: string | string[];
|
|
433
|
+
/**
|
|
434
|
+
* Initial reconnect delay in milliseconds. Used as the base for exponential backoff.
|
|
435
|
+
* Set to `0` or omit to disable automatic reconnection.
|
|
436
|
+
*/
|
|
423
437
|
reconnectInterval?: number;
|
|
438
|
+
/** Maximum number of automatic reconnect attempts. Defaults to `0` (disabled). */
|
|
424
439
|
maxReconnectAttempts?: number;
|
|
440
|
+
/** Hard cap for reconnect delay in milliseconds. Defaults to `30_000`. */
|
|
441
|
+
maxReconnectDelay?: number;
|
|
442
|
+
/** Heartbeat interval in milliseconds. */
|
|
425
443
|
heartbeatInterval?: number;
|
|
444
|
+
/** Payload sent on every heartbeat tick when `heartbeatInterval` is set. */
|
|
426
445
|
heartbeatMessage?: unknown;
|
|
427
446
|
}
|
|
428
447
|
interface WebSocketMessage<T = unknown> {
|
|
448
|
+
/** Message identifier. Auto-generated when omitted. */
|
|
449
|
+
id?: string;
|
|
429
450
|
type: string;
|
|
430
451
|
data: T;
|
|
452
|
+
/** Server-assigned correlation id (used by `request()` to match responses). */
|
|
453
|
+
correlationId?: string;
|
|
431
454
|
timestamp?: number;
|
|
432
455
|
}
|
|
456
|
+
type WebSocketState = 'idle' | 'connecting' | 'open' | 'closing' | 'closed' | 'reconnecting';
|
|
457
|
+
interface WebSocketStatusV2 {
|
|
458
|
+
readonly state: WebSocketState;
|
|
459
|
+
readonly reconnectAttempts: number;
|
|
460
|
+
readonly error: string | null;
|
|
461
|
+
}
|
|
462
|
+
interface WebSocketRequestOptions {
|
|
463
|
+
/** Timeout in milliseconds. Defaults to `30_000`. */
|
|
464
|
+
timeout?: number;
|
|
465
|
+
}
|
|
466
|
+
/**
|
|
467
|
+
* Stateful WebSocket client wrapping a single connection. One instance per logical
|
|
468
|
+
* connection (do NOT share between `connect()` calls).
|
|
469
|
+
*
|
|
470
|
+
* Surfaces:
|
|
471
|
+
* - `status`: signal of the current connection state.
|
|
472
|
+
* - `messages$`: stream of every received message (parsed JSON).
|
|
473
|
+
* - `send` / `sendRaw`: outbound traffic.
|
|
474
|
+
* - `request<T>(type, data)`: round-trip with id correlation and timeout.
|
|
475
|
+
* - `close`: idempotent disposal.
|
|
476
|
+
*
|
|
477
|
+
* Reconnect uses exponential backoff with jitter, capped by `maxReconnectDelay`.
|
|
478
|
+
*/
|
|
479
|
+
declare class WebSocketClient {
|
|
480
|
+
private readonly config;
|
|
481
|
+
private readonly logger;
|
|
482
|
+
private socket;
|
|
483
|
+
private reconnectTimer;
|
|
484
|
+
private heartbeatTimer;
|
|
485
|
+
private readonly _status;
|
|
486
|
+
private readonly _messages$;
|
|
487
|
+
private readonly pendingRequests;
|
|
488
|
+
private disposed;
|
|
489
|
+
private reconnectAttempts;
|
|
490
|
+
constructor(config: WebSocketClientConfig, logger: BrowserApiLogger, destroyRef?: DestroyRef);
|
|
491
|
+
get status(): Signal<WebSocketStatusV2>;
|
|
492
|
+
get messages$(): Observable<WebSocketMessage>;
|
|
493
|
+
messagesByType<T = unknown>(type: string): Observable<WebSocketMessage<T>>;
|
|
494
|
+
send<T>(message: WebSocketMessage<T>): void;
|
|
495
|
+
sendRaw(data: string): void;
|
|
496
|
+
/**
|
|
497
|
+
* Send a message and await a correlated response. The server MUST echo back the
|
|
498
|
+
* `correlationId` from the request as `correlationId` on the response message.
|
|
499
|
+
*/
|
|
500
|
+
request<TRes = unknown, TReq = unknown>(type: string, data: TReq, opts?: WebSocketRequestOptions): Promise<TRes>;
|
|
501
|
+
close(): void;
|
|
502
|
+
/** Internal handle for tests and advanced usage. */
|
|
503
|
+
getNativeSocket(): WebSocket | null;
|
|
504
|
+
private openSocket;
|
|
505
|
+
private attachHandlers;
|
|
506
|
+
private handleIncoming;
|
|
507
|
+
private scheduleReconnect;
|
|
508
|
+
/**
|
|
509
|
+
* Exponential backoff with full jitter:
|
|
510
|
+
* baseDelay = min(maxDelay, interval * 2^(attempt - 1))
|
|
511
|
+
* delay = random(0, baseDelay)
|
|
512
|
+
*/
|
|
513
|
+
static computeBackoffDelay(attempt: number, interval: number, maxDelay: number): number;
|
|
514
|
+
private startHeartbeat;
|
|
515
|
+
private stopHeartbeat;
|
|
516
|
+
private clearTimers;
|
|
517
|
+
private rejectAllPending;
|
|
518
|
+
private updateStatus;
|
|
519
|
+
private generateId;
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
/**
|
|
523
|
+
* @deprecated Use `WebSocketStatusV2` (via `WebSocketClient.status`).
|
|
524
|
+
* Kept for backward compatibility — will be removed in v22.
|
|
525
|
+
*/
|
|
433
526
|
interface WebSocketStatus {
|
|
434
527
|
connected: boolean;
|
|
435
528
|
connecting: boolean;
|
|
@@ -437,30 +530,70 @@ interface WebSocketStatus {
|
|
|
437
530
|
error?: string;
|
|
438
531
|
reconnectAttempts: number;
|
|
439
532
|
}
|
|
533
|
+
/**
|
|
534
|
+
* @deprecated Use `WebSocketClientConfig`. Kept as alias for backward compatibility.
|
|
535
|
+
*/
|
|
536
|
+
type WebSocketConfig = WebSocketClientConfig & {
|
|
537
|
+
/** @deprecated Use `heartbeatMessage` directly. */
|
|
538
|
+
heartbeatMessage?: unknown;
|
|
539
|
+
};
|
|
540
|
+
|
|
541
|
+
/**
|
|
542
|
+
* Service that creates and tracks `WebSocketClient` instances.
|
|
543
|
+
*
|
|
544
|
+
* Preferred usage:
|
|
545
|
+
* ```ts
|
|
546
|
+
* const ws = inject(WebSocketService);
|
|
547
|
+
* const client = ws.createClient({ url: 'wss://...' });
|
|
548
|
+
* effect(() => console.log(client.status()));
|
|
549
|
+
* await client.request('ping', {});
|
|
550
|
+
* ```
|
|
551
|
+
*
|
|
552
|
+
* Legacy usage (`connect()` returning Observable) is preserved for one minor cycle
|
|
553
|
+
* and will be removed in v22.
|
|
554
|
+
*/
|
|
440
555
|
declare class WebSocketService extends BrowserApiBaseService {
|
|
441
|
-
private
|
|
442
|
-
private
|
|
443
|
-
private messageSubject;
|
|
444
|
-
private reconnectAttempts;
|
|
445
|
-
private reconnectTimer;
|
|
446
|
-
private heartbeatTimer;
|
|
556
|
+
private readonly wsLogger;
|
|
557
|
+
private readonly clients;
|
|
447
558
|
private readonly _cleanup;
|
|
559
|
+
/** Legacy single-connection holder used by deprecated `connect()`/`send()` API. */
|
|
560
|
+
private legacyClient;
|
|
448
561
|
protected getApiName(): string;
|
|
449
562
|
protected ensureSupported(): void;
|
|
563
|
+
/**
|
|
564
|
+
* Create a new WebSocket client. The client owns one connection and is the recommended
|
|
565
|
+
* surface for all interactions (status signal, request/response, reconnect, etc.).
|
|
566
|
+
*
|
|
567
|
+
* The returned client is automatically disposed when the host injector is destroyed.
|
|
568
|
+
*/
|
|
569
|
+
createClient(config: WebSocketClientConfig): WebSocketClient;
|
|
570
|
+
/** Dispose every client created via `createClient()` (also called automatically on destroy). */
|
|
571
|
+
disposeAll(): void;
|
|
572
|
+
/**
|
|
573
|
+
* @deprecated Use {@link createClient} which returns a `WebSocketClient` exposing a
|
|
574
|
+
* status signal, request/response, and proper reconnect. This wrapper will be removed
|
|
575
|
+
* in v22.
|
|
576
|
+
*/
|
|
450
577
|
connect(config: WebSocketConfig): Observable<WebSocketStatus>;
|
|
578
|
+
/** @deprecated Use {@link createClient} and call `client.close()`. */
|
|
451
579
|
disconnect(): void;
|
|
580
|
+
/** @deprecated Use the client returned by {@link createClient}. */
|
|
452
581
|
send<T>(message: WebSocketMessage<T>): void;
|
|
582
|
+
/** @deprecated Use the client returned by {@link createClient}. */
|
|
453
583
|
sendRaw(data: string): void;
|
|
584
|
+
/** @deprecated Use `client.status` from {@link createClient}. */
|
|
454
585
|
getStatus(): Observable<WebSocketStatus>;
|
|
586
|
+
/** @deprecated Use `client.messages$` from {@link createClient}. */
|
|
455
587
|
getMessages<T = unknown>(): Observable<WebSocketMessage<T>>;
|
|
588
|
+
/** @deprecated Use `client.messagesByType()` from {@link createClient}. */
|
|
456
589
|
getMessagesByType<T = unknown>(type: string): Observable<WebSocketMessage<T>>;
|
|
457
|
-
|
|
458
|
-
private startHeartbeat;
|
|
459
|
-
private attemptReconnect;
|
|
460
|
-
private updateStatus;
|
|
590
|
+
/** @deprecated Use the client returned by {@link createClient}. */
|
|
461
591
|
getNativeWebSocket(): WebSocket | null;
|
|
592
|
+
/** @deprecated Use `client.status()` from {@link createClient}. */
|
|
462
593
|
isConnected(): boolean;
|
|
594
|
+
/** @deprecated Use the native socket via `client.getNativeSocket()`. */
|
|
463
595
|
getReadyState(): number;
|
|
596
|
+
private warnLegacyOnce;
|
|
464
597
|
static ɵfac: i0.ɵɵFactoryDeclaration<WebSocketService, never>;
|
|
465
598
|
static ɵprov: i0.ɵɵInjectableDeclaration<WebSocketService>;
|
|
466
599
|
}
|
|
@@ -846,54 +979,6 @@ declare class PerformanceObserverService extends BrowserApiBaseService {
|
|
|
846
979
|
static ɵprov: i0.ɵɵInjectableDeclaration<PerformanceObserverService>;
|
|
847
980
|
}
|
|
848
981
|
|
|
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
982
|
type AudioContextState = 'suspended' | 'running' | 'closed';
|
|
898
983
|
interface AudioAnalyserData {
|
|
899
984
|
frequencyData: Uint8Array;
|
|
@@ -943,234 +1028,6 @@ declare class GamepadService extends BrowserApiBaseService {
|
|
|
943
1028
|
static ɵprov: i0.ɵɵInjectableDeclaration<GamepadService>;
|
|
944
1029
|
}
|
|
945
1030
|
|
|
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
1031
|
interface MediaDevice {
|
|
1175
1032
|
deviceId: string;
|
|
1176
1033
|
groupId: string;
|
|
@@ -1317,15 +1174,6 @@ interface PerformanceObserverRef {
|
|
|
1317
1174
|
}
|
|
1318
1175
|
declare function injectPerformanceObserver(config: PerformanceObserverConfig): PerformanceObserverRef;
|
|
1319
1176
|
|
|
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
1177
|
interface GamepadRef {
|
|
1330
1178
|
readonly state: Signal<GamepadState | null>;
|
|
1331
1179
|
readonly connected: Signal<boolean>;
|
|
@@ -1380,8 +1228,6 @@ declare function provideFileSystemAccess(): EnvironmentProviders;
|
|
|
1380
1228
|
|
|
1381
1229
|
declare function provideMediaRecorder(): EnvironmentProviders;
|
|
1382
1230
|
|
|
1383
|
-
declare function provideIdleDetector(): EnvironmentProviders;
|
|
1384
|
-
|
|
1385
1231
|
declare function provideBattery(): EnvironmentProviders;
|
|
1386
1232
|
|
|
1387
1233
|
declare function provideWebShare(): EnvironmentProviders;
|
|
@@ -1416,24 +1262,10 @@ declare function provideMutationObserver(): EnvironmentProviders;
|
|
|
1416
1262
|
|
|
1417
1263
|
declare function providePerformanceObserver(): EnvironmentProviders;
|
|
1418
1264
|
|
|
1419
|
-
declare function provideEyeDropper(): EnvironmentProviders;
|
|
1420
|
-
|
|
1421
|
-
declare function provideBarcodeDetector(): EnvironmentProviders;
|
|
1422
|
-
|
|
1423
1265
|
declare function provideWebAudio(): EnvironmentProviders;
|
|
1424
1266
|
|
|
1425
1267
|
declare function provideGamepad(): EnvironmentProviders;
|
|
1426
1268
|
|
|
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
1269
|
declare function provideMediaApis(): EnvironmentProviders;
|
|
1438
1270
|
declare function provideLocationApis(): EnvironmentProviders;
|
|
1439
1271
|
declare function provideStorageApis(): EnvironmentProviders;
|
|
@@ -1465,21 +1297,13 @@ interface BrowserWebApisConfig {
|
|
|
1465
1297
|
enableSpeechSynthesis?: boolean;
|
|
1466
1298
|
enableMutationObserver?: boolean;
|
|
1467
1299
|
enablePerformanceObserver?: boolean;
|
|
1468
|
-
enableIdleDetector?: boolean;
|
|
1469
|
-
enableEyeDropper?: boolean;
|
|
1470
|
-
enableBarcodeDetector?: boolean;
|
|
1471
1300
|
enableWebAudio?: boolean;
|
|
1472
1301
|
enableGamepad?: boolean;
|
|
1473
|
-
enableWebBluetooth?: boolean;
|
|
1474
|
-
enableWebUsb?: boolean;
|
|
1475
|
-
enableWebNfc?: boolean;
|
|
1476
|
-
enablePaymentRequest?: boolean;
|
|
1477
|
-
enableCredentialManagement?: boolean;
|
|
1478
1302
|
}
|
|
1479
1303
|
declare const defaultBrowserWebApisConfig: BrowserWebApisConfig;
|
|
1480
1304
|
declare function provideBrowserWebApis(config?: BrowserWebApisConfig): EnvironmentProviders;
|
|
1481
1305
|
|
|
1482
1306
|
declare const version = "0.1.0";
|
|
1483
1307
|
|
|
1484
|
-
export { BROWSER_API_LOGGER,
|
|
1485
|
-
export type { AudioAnalyserData, AudioContextState,
|
|
1308
|
+
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 };
|
|
1309
|
+
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, StorageOptions, StorageValue, VibrationPattern, VibrationPreset, VisibilityState, WakeLockStatus, WakeLockType, WebSocketClientConfig, WebSocketConfig, WebSocketMessage, WebSocketRequestOptions, WebSocketState, WebSocketStatus, WebSocketStatusV2, WorkerMessage, WorkerStatus, WorkerTask };
|