@icanbwell/types 7.17.0 → 8.0.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.
@@ -1,6 +1,6 @@
1
- /**
2
- * Error Codes should be used in combination with the BwellError
3
- * They categorize known error conditions and provide a mechanism for customized error handling.
1
+ /**
2
+ * Error Codes should be used in combination with the BwellError
3
+ * They categorize known error conditions and provide a mechanism for customized error handling.
4
4
  */
5
5
  var ErrorCode;
6
6
  (function (ErrorCode) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@icanbwell/types",
3
- "version": "7.17.0",
3
+ "version": "8.0.0",
4
4
  "typedoc": {
5
5
  "entryPoint": "./src/index.ts",
6
6
  "tsconfig": "./tsconfig.lib.json"
@@ -36,8 +36,8 @@
36
36
  "import": "./frontend-telemetry.js"
37
37
  }
38
38
  },
39
- "repoVersion": "17.49.0",
40
- "description": "@icanbwell/types. repo version: 17.49.0",
39
+ "repoVersion": "18.0.0",
40
+ "description": "@icanbwell/types. repo version: 18.0.0",
41
41
  "peerDependencies": {
42
42
  "react-native": "0.x",
43
43
  "react-native-biometrics": "3.x",
@@ -1 +1 @@
1
- export type EmbeddableLoaderAttribute = 'error' | 'loading';
1
+ export type EmbeddableLoaderAttribute = 'error' | 'loading';
@@ -1,44 +1,44 @@
1
- /**
2
- * Error Codes should be used in combination with the BwellError
3
- * They categorize known error conditions and provide a mechanism for customized error handling.
4
- */
5
- export declare enum ErrorCode {
6
- /** Client or client key is unknown */
7
- CLIENT_UNKNOWN = "CLIENT_UNKNOWN",
8
- /** Insufficient feature services defined by embeddable */
9
- INSUFFICIENT_SERVICES = "INSUFFICIENT_SERVICES",
10
- /** Method called before initialization */
11
- METHOD_CALLED_BEFORE_INITIALIZATION = "METHOD_CALLED_BEFORE_INITIALIZATION",
12
- /** General initialization failure of Bwell object */
13
- BWELL_INITIALIZATION = "BWELL_INITIALIZATION",
14
- /** Error durring token exchange */
15
- TOKEN_EXCHANGE = "TOKEN_EXCHANGE",
16
- /** Required user claims (clientFhirPersonId, clientFhirPatientId) missing from ID token */
17
- MISSING_REQUIRED_USER_CLAIMS = "MISSING_REQUIRED_USER_CLAIMS",
18
- /** Defines an error while executing a route */
19
- ROUTE_ACTION = "ROUTE_ACTION",
20
- /** Defines an error while initializing the navigation service delegate */
21
- ROUTE_NAVIGATION_DELEGATE = "ROUTE_NAVIGATION_DELEGATE",
22
- /** Specifies the the route is unknown */
23
- ROUTE_UNKNOWN = "ROUTE_UNKNOWN",
24
- /** An elementId in the route definition does not have a matching element in the registry */
25
- ROUTE_ELEMENT_UNKNOWN = "ROUTE_ELEMENT_UNKNOWN",
26
- /** Hook or Consumer used outside of a React Provider */
27
- PROVIDER_UNDEFINED = "PROVIDER_UNDEFINED",
28
- /** Permission is not granted by the user */
29
- INSUFFICIENT_PERMISSIONS = "INSUFFICIENT_PERMISSIONS",
30
- /** Configuration Error */
31
- CONFIGURATION_ERROR = "CONFIGURATION_ERROR",
32
- /** Network Error */
33
- NETWORK = "NETWORK",
34
- /** Unknown error */
35
- UNKNOWN = "UNKNOWN"
36
- }
37
- export type ErrorDetails = {
38
- message: string;
39
- errorCode: ErrorCode;
40
- };
41
- export type ErrorContext = {
42
- errorDetails: ErrorDetails;
43
- resetError: () => void;
44
- };
1
+ /**
2
+ * Error Codes should be used in combination with the BwellError
3
+ * They categorize known error conditions and provide a mechanism for customized error handling.
4
+ */
5
+ export declare enum ErrorCode {
6
+ /** Client or client key is unknown */
7
+ CLIENT_UNKNOWN = "CLIENT_UNKNOWN",
8
+ /** Insufficient feature services defined by embeddable */
9
+ INSUFFICIENT_SERVICES = "INSUFFICIENT_SERVICES",
10
+ /** Method called before initialization */
11
+ METHOD_CALLED_BEFORE_INITIALIZATION = "METHOD_CALLED_BEFORE_INITIALIZATION",
12
+ /** General initialization failure of Bwell object */
13
+ BWELL_INITIALIZATION = "BWELL_INITIALIZATION",
14
+ /** Error durring token exchange */
15
+ TOKEN_EXCHANGE = "TOKEN_EXCHANGE",
16
+ /** Required user claims (clientFhirPersonId, clientFhirPatientId) missing from ID token */
17
+ MISSING_REQUIRED_USER_CLAIMS = "MISSING_REQUIRED_USER_CLAIMS",
18
+ /** Defines an error while executing a route */
19
+ ROUTE_ACTION = "ROUTE_ACTION",
20
+ /** Defines an error while initializing the navigation service delegate */
21
+ ROUTE_NAVIGATION_DELEGATE = "ROUTE_NAVIGATION_DELEGATE",
22
+ /** Specifies the the route is unknown */
23
+ ROUTE_UNKNOWN = "ROUTE_UNKNOWN",
24
+ /** An elementId in the route definition does not have a matching element in the registry */
25
+ ROUTE_ELEMENT_UNKNOWN = "ROUTE_ELEMENT_UNKNOWN",
26
+ /** Hook or Consumer used outside of a React Provider */
27
+ PROVIDER_UNDEFINED = "PROVIDER_UNDEFINED",
28
+ /** Permission is not granted by the user */
29
+ INSUFFICIENT_PERMISSIONS = "INSUFFICIENT_PERMISSIONS",
30
+ /** Configuration Error */
31
+ CONFIGURATION_ERROR = "CONFIGURATION_ERROR",
32
+ /** Network Error */
33
+ NETWORK = "NETWORK",
34
+ /** Unknown error */
35
+ UNKNOWN = "UNKNOWN"
36
+ }
37
+ export type ErrorDetails = {
38
+ message: string;
39
+ errorCode: ErrorCode;
40
+ };
41
+ export type ErrorContext = {
42
+ errorDetails: ErrorDetails;
43
+ resetError: () => void;
44
+ };
package/src/index.d.ts CHANGED
@@ -1,54 +1,54 @@
1
- export * from './lib';
2
- export * from './frontend-telemetry';
3
- export * from './native-plugins';
4
- export * from './embeddable-core';
5
- export type { PluginKeys, INativeBridge } from './native-bridge';
6
- export declare const PageTransitionEventKey = "pagetransition";
7
- export type PageTransitionEventPayload = {
8
- id?: string;
9
- path: string;
10
- pageTitle?: string;
11
- };
12
- /**
13
- * Configuration returned by the bootstrap endpoint for RUM.
14
- * The `configurations` field is a JSON-encoded string containing
15
- * vendor-specific RUM SDK init parameters.
16
- */
17
- export type RumConfiguration = {
18
- enabled: boolean;
19
- configurations: string;
20
- };
21
- /**
22
- * The `Telemetry` type represents the configuration for telemetry settings.
23
- * It can be either a boolean value or an object containing boolean flags for individual telemetry features.
24
- *
25
- * If the `Telemetry` variable is a boolean, all three telemetry features will be set to that boolean value.
26
- *
27
- * If the `Telemetry` variable is an object, you can individually enable/disable specific telemetry features
28
- * using boolean flags:
29
- *
30
- * - `logging`: Set to `true` to enable logging, `false` to disable. When logging is disabled, logs (such as logs, errors, infos, debugs) will be output to the development console instead of Sentry.
31
- *
32
- * - `tracing`: Set to `true` to enable tracing, `false` to disable. When tracing is disabled, Otel traces will be logged to the development console.
33
- *
34
- * - `rum`: Set to `true` to enable Real User Monitoring (RUM), `false` to disable. The behavior of disabling RUM is to be determined (TBD).
35
- *
36
- * Examples:
37
- *
38
- * ```typescript
39
- * // Example 1: Set all telemetry features to true
40
- * const telemetry1: Telemetry = true;
41
- *
42
- * // Example 2: Set individual telemetry features using an object
43
- * const telemetry2: Telemetry = {
44
- * logging: true, // Enable logging
45
- * tracing: false, // Disable tracing
46
- * rum: true // Enable RUM
47
- * };
48
- * ```
49
- */
50
- export type Telemetry = boolean | {
51
- logging?: boolean;
52
- tracing?: boolean;
53
- rum?: boolean;
54
- };
1
+ export * from './lib';
2
+ export * from './frontend-telemetry';
3
+ export * from './native-plugins';
4
+ export * from './embeddable-core';
5
+ export type { PluginKeys, INativeBridge } from './native-bridge';
6
+ export declare const PageTransitionEventKey = "pagetransition";
7
+ export type PageTransitionEventPayload = {
8
+ id?: string;
9
+ path: string;
10
+ pageTitle?: string;
11
+ };
12
+ /**
13
+ * Configuration returned by the bootstrap endpoint for RUM.
14
+ * The `configurations` field is a JSON-encoded string containing
15
+ * vendor-specific RUM SDK init parameters.
16
+ */
17
+ export type RumConfiguration = {
18
+ enabled: boolean;
19
+ configurations: string;
20
+ };
21
+ /**
22
+ * The `Telemetry` type represents the configuration for telemetry settings.
23
+ * It can be either a boolean value or an object containing boolean flags for individual telemetry features.
24
+ *
25
+ * If the `Telemetry` variable is a boolean, all three telemetry features will be set to that boolean value.
26
+ *
27
+ * If the `Telemetry` variable is an object, you can individually enable/disable specific telemetry features
28
+ * using boolean flags:
29
+ *
30
+ * - `logging`: Set to `true` to enable logging, `false` to disable. When logging is disabled, logs (such as logs, errors, infos, debugs) will be output to the development console instead of Sentry.
31
+ *
32
+ * - `tracing`: Set to `true` to enable tracing, `false` to disable. When tracing is disabled, Otel traces will be logged to the development console.
33
+ *
34
+ * - `rum`: Set to `true` to enable Real User Monitoring (RUM), `false` to disable. The behavior of disabling RUM is to be determined (TBD).
35
+ *
36
+ * Examples:
37
+ *
38
+ * ```typescript
39
+ * // Example 1: Set all telemetry features to true
40
+ * const telemetry1: Telemetry = true;
41
+ *
42
+ * // Example 2: Set individual telemetry features using an object
43
+ * const telemetry2: Telemetry = {
44
+ * logging: true, // Enable logging
45
+ * tracing: false, // Disable tracing
46
+ * rum: true // Enable RUM
47
+ * };
48
+ * ```
49
+ */
50
+ export type Telemetry = boolean | {
51
+ logging?: boolean;
52
+ tracing?: boolean;
53
+ rum?: boolean;
54
+ };
@@ -1,9 +1,9 @@
1
- import type { RestLink } from 'apollo-link-rest';
2
- export type QueryResponse<T> = {
3
- __typename: string;
4
- } & T;
5
- export type ApiMap = {
6
- default?: string;
7
- rest?: RestLink.Options;
8
- [apiName: string]: string | any;
9
- };
1
+ import type { RestLink } from 'apollo-link-rest';
2
+ export type QueryResponse<T> = {
3
+ __typename: string;
4
+ } & T;
5
+ export type ApiMap = {
6
+ default?: string;
7
+ rest?: RestLink.Options;
8
+ [apiName: string]: string | any;
9
+ };
@@ -1,15 +1,15 @@
1
- export type IdentityProviderName = 'cognito' | 'descope';
2
- export declare const DESCOPE_IDENTITY_PROVIDER: IdentityProviderName;
3
- export type IdentityProvider = {
4
- name: IdentityProviderName;
5
- projectId: string;
6
- issuer?: string;
7
- providerConfig?: {
8
- tenantId?: string;
9
- flows?: {
10
- name: string;
11
- id: string;
12
- }[];
13
- authDomain?: string;
14
- };
15
- };
1
+ export type IdentityProviderName = 'cognito' | 'descope';
2
+ export declare const DESCOPE_IDENTITY_PROVIDER: IdentityProviderName;
3
+ export type IdentityProvider = {
4
+ name: IdentityProviderName;
5
+ projectId: string;
6
+ issuer?: string;
7
+ providerConfig?: {
8
+ tenantId?: string;
9
+ flows?: {
10
+ name: string;
11
+ id: string;
12
+ }[];
13
+ authDomain?: string;
14
+ };
15
+ };
@@ -1,3 +1,3 @@
1
- export * from './apiClient';
2
- export * from './identityProvider';
3
- export * from './utils';
1
+ export * from './apiClient';
2
+ export * from './identityProvider';
3
+ export * from './utils';
@@ -1 +1 @@
1
- export type PublicInterface<T> = Pick<T, keyof T>;
1
+ export type PublicInterface<T> = Pick<T, keyof T>;
@@ -1,257 +1,257 @@
1
- import type rnBiometrics from 'react-native-biometrics';
2
- import { BiometryTypes } from 'react-native-biometrics';
3
- import type TypedEmitter from 'typed-emitter';
4
- import type { OnAuthSuccessEventKey, OnAuthSuccessEventData, ErrorEventKey, ErrorEventData } from './native-components';
5
- import { openSettings, PermissionStatus } from 'react-native-permissions';
6
- import { PageTransitionEventKey, PageTransitionEventPayload } from '.';
7
- import { Platform } from 'react-native';
8
- export type NativeEvents<T = any> = {
9
- openwebview: (url: string) => void;
10
- closewebview: (data: T) => void;
11
- reloadwebview: (preserveSession?: boolean) => void;
12
- nativebridgedependencies: (nativeBridgeDependencies: PluginKeys[]) => void;
13
- [OnAuthSuccessEventKey]: (data: OnAuthSuccessEventData) => void;
14
- [ErrorEventKey]: (data: ErrorEventData) => void;
15
- [PageTransitionEventKey]: (data: PageTransitionEventPayload) => void;
16
- };
17
- export type NativeBridgeEmittableEvents = Pick<NativeEvents, 'onauthsuccess' | 'error' | 'nativebridgedependencies'>;
18
- export type NativeEventEmitter = TypedEmitter<NativeEvents>;
19
- export type NativeEmittableEventEmitter = TypedEmitter<NativeBridgeEmittableEvents>;
20
- export interface IWebview {
21
- open(url: string): void;
22
- close<T>(data: T): void;
23
- reload(preserveSession?: boolean): void;
24
- isWithin: boolean;
25
- }
26
- type IBiometryInformation = {
27
- biometryType: keyof typeof BiometryTypes | undefined;
28
- error: string | undefined;
29
- };
30
- export interface IBiometrics {
31
- isAvailable(): Promise<boolean>;
32
- getBiometryInformation(): Promise<IBiometryInformation>;
33
- biometricKeysExist(): ReturnType<Awaited<rnBiometrics['biometricKeysExist']>>;
34
- createKeys(): ReturnType<Awaited<rnBiometrics['createKeys']>>;
35
- createSignature(createSignatureOptions: Parameters<rnBiometrics['createSignature']>[0]): ReturnType<Awaited<rnBiometrics['createSignature']>>;
36
- deleteKeys(): ReturnType<Awaited<rnBiometrics['deleteKeys']>>;
37
- requestPermission(): Promise<PermissionStatus>;
38
- checkPermission(): Promise<PermissionStatus>;
39
- }
40
- export type IEvents = Pick<NativeEventEmitter, 'emit'>;
41
- export interface IStorage {
42
- /**
43
- * Set a key value pair in storage.
44
- * @param {string} key - Key to be used for storage persistance.
45
- * @param {string} value - Value to be persisted.
46
- * @return {void}
47
- */
48
- setItem(key: string, value: string): Promise<void>;
49
- /**
50
- * Extract data from storage based on supplied key.
51
- * @param {string} key - Key to determine data to be extracted from storage.
52
- * @return {string} Keyed data from storage.
53
- */
54
- getItem(key: string): Promise<string | null>;
55
- /**
56
- * Remove data from storage based on supplied key.
57
- * @param {string} key - Key to determine what key/value to remove from storage.
58
- * @return {void}
59
- */
60
- removeItem(key: string): Promise<void>;
61
- }
62
- export interface ICamera {
63
- isAvailable(): Promise<boolean>;
64
- requestPermission(): Promise<PermissionStatus>;
65
- checkPermission(): Promise<PermissionStatus>;
66
- requestRollPermission(): Promise<PermissionStatus>;
67
- checkRollPermission(): Promise<PermissionStatus>;
68
- }
69
- export type AllowedDocumentType = 'image/png' | 'image/jpeg' | 'image/svg+xml' | 'application/pdf';
70
- export type DownloadLocation = 'Files' | 'Photos';
71
- export interface IDocumentDownload {
72
- isAvailable(fileType: string): Promise<boolean>;
73
- writeFile(filename: string, dataURL: string): Promise<DownloadLocation>;
74
- requestPermission(fileType: string): Promise<GlobalPermissionStatus>;
75
- checkPermission(fileType: string): Promise<GlobalPermissionStatus>;
76
- }
77
- export interface GeoOptions {
78
- timeout?: number;
79
- maximumAge?: number;
80
- enableHighAccuracy?: boolean;
81
- }
82
- export interface GeoError {
83
- code: number;
84
- message: string;
85
- PERMISSION_DENIED: number;
86
- POSITION_UNAVAILABLE: number;
87
- TIMEOUT: number;
88
- }
89
- export interface GeoCoordinates {
90
- latitude: number;
91
- longitude: number;
92
- altitude: number | null;
93
- accuracy: number;
94
- altitudeAccuracy: number | null;
95
- heading: number | null;
96
- speed: number | null;
97
- }
98
- export interface GeoPosition {
99
- coords: GeoCoordinates;
100
- timestamp: number;
101
- }
102
- export interface IGeolocation {
103
- isAvailable(): Promise<boolean>;
104
- getCurrentPosition(options?: GeoOptions): Promise<GeoPosition>;
105
- requestPermission(): Promise<GlobalPermissionStatus>;
106
- checkPermission(): Promise<GlobalPermissionStatus>;
107
- }
108
- export type PrintOptions = {
109
- html: string;
110
- filePath?: never;
111
- } | {
112
- html?: never;
113
- filePath: string;
114
- };
115
- export interface IPrint {
116
- print(options: PrintOptions): Promise<boolean | undefined>;
117
- }
118
- export type DocumentPickerResult = {
119
- type: string | null;
120
- name: string | null;
121
- size: number | null;
122
- base64: string;
123
- };
124
- export interface IDocumentPicker {
125
- pickMultiple(): Promise<DocumentPickerResult[]>;
126
- pickSingle(): Promise<DocumentPickerResult>;
127
- requestPermission(): Promise<PermissionStatus>;
128
- checkPermission(): Promise<PermissionStatus>;
129
- }
130
- export interface IPushNotifications {
131
- isAvailable(): Promise<boolean>;
132
- getDeviceToken(): Promise<string>;
133
- requestPermission(): Promise<GlobalPermissionStatus>;
134
- checkPermission(): Promise<GlobalPermissionStatus>;
135
- }
136
- export interface IUtils {
137
- getPlatform(): Promise<typeof Platform.OS>;
138
- getBundleId(): Promise<string | undefined>;
139
- }
140
- export interface ISystem {
141
- openSettings: typeof openSettings;
142
- }
143
- export type DeepLinkType = {
144
- scheme: string;
145
- webUrl: string;
146
- };
147
- export interface IDeepLink {
148
- openLink(deepLink: DeepLinkType, target?: string): Promise<void>;
149
- }
150
- export interface IConnectDevicesSessionUser {
151
- userID: string;
152
- organizationID: string;
153
- accessToken: string;
154
- }
155
- export interface SyncRecord {
156
- date: string;
157
- metric: string;
158
- value: number;
159
- unit: string;
160
- }
161
- export interface IConnectDevices {
162
- startSession(user: IConnectDevicesSessionUser): Promise<void>;
163
- syncData(daysToFetch?: number): Promise<SyncRecord[]>;
164
- refreshData(daysToFetch?: number): Promise<SyncRecord[]>;
165
- endSession(): Promise<void>;
166
- getCurrentUser(): Promise<IConnectDevicesSessionUser | null>;
167
- checkPermissions(): Promise<boolean>;
168
- }
169
- export interface PasskeyCredentialDescriptor {
170
- type: string;
171
- id: string;
172
- transports?: string[];
173
- }
174
- export interface PasskeyCreateRequest {
175
- challenge: string;
176
- rp: {
177
- id: string;
178
- name: string;
179
- };
180
- user: {
181
- id: string;
182
- name: string;
183
- displayName: string;
184
- };
185
- pubKeyCredParams: Array<{
186
- type: string;
187
- alg: number;
188
- }>;
189
- timeout?: number;
190
- excludeCredentials?: PasskeyCredentialDescriptor[];
191
- authenticatorSelection?: {
192
- authenticatorAttachment?: string;
193
- requireResidentKey?: boolean;
194
- residentKey?: string;
195
- userVerification?: string;
196
- };
197
- attestation?: string;
198
- }
199
- export interface PasskeyCreateResult {
200
- id: string;
201
- rawId: string;
202
- type?: string;
203
- authenticatorAttachment?: string;
204
- response: {
205
- clientDataJSON: string;
206
- attestationObject: string;
207
- };
208
- }
209
- export interface PasskeyGetRequest {
210
- challenge: string;
211
- rpId: string;
212
- timeout?: number;
213
- allowCredentials?: PasskeyCredentialDescriptor[];
214
- userVerification?: string;
215
- }
216
- export interface PasskeyGetResult {
217
- id: string;
218
- rawId: string;
219
- type?: string;
220
- authenticatorAttachment?: string;
221
- response: {
222
- authenticatorData: string;
223
- clientDataJSON: string;
224
- signature: string;
225
- userHandle: string;
226
- };
227
- }
228
- export interface IPasskey {
229
- /** Whether the device supports passkeys (Android 28+ / iOS 15+). */
230
- isSupported(): Promise<boolean>;
231
- /** Perform a FIDO2 credential registration (navigator.credentials.create). */
232
- create(request: PasskeyCreateRequest): Promise<PasskeyCreateResult>;
233
- /** Perform a FIDO2 credential assertion (navigator.credentials.get). */
234
- get(request: PasskeyGetRequest): Promise<PasskeyGetResult>;
235
- }
236
- export interface INativeBridge {
237
- connectDevices: IConnectDevices;
238
- webview: IWebview;
239
- biometrics: IBiometrics;
240
- events: IEvents;
241
- storage: IStorage;
242
- camera: ICamera;
243
- geolocation: IGeolocation;
244
- print: IPrint;
245
- documentDownload: IDocumentDownload;
246
- documentPicker: IDocumentPicker;
247
- pushNotifications: IPushNotifications;
248
- system: ISystem;
249
- deepLink: IDeepLink;
250
- utils: IUtils;
251
- passkey: IPasskey;
252
- reloadView(preserveSession?: boolean): void;
253
- }
254
- export type GlobalPermissionStatus = PermissionStatus | PermissionState;
255
- export type PluginKeys = Exclude<keyof INativeBridge, 'webview' | 'reloadView'>;
256
- export type MethodKeys<T extends PluginKeys> = keyof INativeBridge[T];
257
- export {};
1
+ import type rnBiometrics from 'react-native-biometrics';
2
+ import { BiometryTypes } from 'react-native-biometrics';
3
+ import type TypedEmitter from 'typed-emitter';
4
+ import type { OnAuthSuccessEventKey, OnAuthSuccessEventData, ErrorEventKey, ErrorEventData } from './native-components';
5
+ import { openSettings, PermissionStatus } from 'react-native-permissions';
6
+ import { PageTransitionEventKey, PageTransitionEventPayload } from '.';
7
+ import { Platform } from 'react-native';
8
+ export type NativeEvents<T = any> = {
9
+ openwebview: (url: string) => void;
10
+ closewebview: (data: T) => void;
11
+ reloadwebview: (preserveSession?: boolean) => void;
12
+ nativebridgedependencies: (nativeBridgeDependencies: PluginKeys[]) => void;
13
+ [OnAuthSuccessEventKey]: (data: OnAuthSuccessEventData) => void;
14
+ [ErrorEventKey]: (data: ErrorEventData) => void;
15
+ [PageTransitionEventKey]: (data: PageTransitionEventPayload) => void;
16
+ };
17
+ export type NativeBridgeEmittableEvents = Pick<NativeEvents, 'onauthsuccess' | 'error' | 'nativebridgedependencies'>;
18
+ export type NativeEventEmitter = TypedEmitter<NativeEvents>;
19
+ export type NativeEmittableEventEmitter = TypedEmitter<NativeBridgeEmittableEvents>;
20
+ export interface IWebview {
21
+ open(url: string): void;
22
+ close<T>(data: T): void;
23
+ reload(preserveSession?: boolean): void;
24
+ isWithin: boolean;
25
+ }
26
+ type IBiometryInformation = {
27
+ biometryType: keyof typeof BiometryTypes | undefined;
28
+ error: string | undefined;
29
+ };
30
+ export interface IBiometrics {
31
+ isAvailable(): Promise<boolean>;
32
+ getBiometryInformation(): Promise<IBiometryInformation>;
33
+ biometricKeysExist(): ReturnType<Awaited<rnBiometrics['biometricKeysExist']>>;
34
+ createKeys(): ReturnType<Awaited<rnBiometrics['createKeys']>>;
35
+ createSignature(createSignatureOptions: Parameters<rnBiometrics['createSignature']>[0]): ReturnType<Awaited<rnBiometrics['createSignature']>>;
36
+ deleteKeys(): ReturnType<Awaited<rnBiometrics['deleteKeys']>>;
37
+ requestPermission(): Promise<PermissionStatus>;
38
+ checkPermission(): Promise<PermissionStatus>;
39
+ }
40
+ export type IEvents = Pick<NativeEventEmitter, 'emit'>;
41
+ export interface IStorage {
42
+ /**
43
+ * Set a key value pair in storage.
44
+ * @param {string} key - Key to be used for storage persistance.
45
+ * @param {string} value - Value to be persisted.
46
+ * @return {void}
47
+ */
48
+ setItem(key: string, value: string): Promise<void>;
49
+ /**
50
+ * Extract data from storage based on supplied key.
51
+ * @param {string} key - Key to determine data to be extracted from storage.
52
+ * @return {string} Keyed data from storage.
53
+ */
54
+ getItem(key: string): Promise<string | null>;
55
+ /**
56
+ * Remove data from storage based on supplied key.
57
+ * @param {string} key - Key to determine what key/value to remove from storage.
58
+ * @return {void}
59
+ */
60
+ removeItem(key: string): Promise<void>;
61
+ }
62
+ export interface ICamera {
63
+ isAvailable(): Promise<boolean>;
64
+ requestPermission(): Promise<PermissionStatus>;
65
+ checkPermission(): Promise<PermissionStatus>;
66
+ requestRollPermission(): Promise<PermissionStatus>;
67
+ checkRollPermission(): Promise<PermissionStatus>;
68
+ }
69
+ export type AllowedDocumentType = 'image/png' | 'image/jpeg' | 'image/svg+xml' | 'application/pdf';
70
+ export type DownloadLocation = 'Files' | 'Photos';
71
+ export interface IDocumentDownload {
72
+ isAvailable(fileType: string): Promise<boolean>;
73
+ writeFile(filename: string, dataURL: string): Promise<DownloadLocation>;
74
+ requestPermission(fileType: string): Promise<GlobalPermissionStatus>;
75
+ checkPermission(fileType: string): Promise<GlobalPermissionStatus>;
76
+ }
77
+ export interface GeoOptions {
78
+ timeout?: number;
79
+ maximumAge?: number;
80
+ enableHighAccuracy?: boolean;
81
+ }
82
+ export interface GeoError {
83
+ code: number;
84
+ message: string;
85
+ PERMISSION_DENIED: number;
86
+ POSITION_UNAVAILABLE: number;
87
+ TIMEOUT: number;
88
+ }
89
+ export interface GeoCoordinates {
90
+ latitude: number;
91
+ longitude: number;
92
+ altitude: number | null;
93
+ accuracy: number;
94
+ altitudeAccuracy: number | null;
95
+ heading: number | null;
96
+ speed: number | null;
97
+ }
98
+ export interface GeoPosition {
99
+ coords: GeoCoordinates;
100
+ timestamp: number;
101
+ }
102
+ export interface IGeolocation {
103
+ isAvailable(): Promise<boolean>;
104
+ getCurrentPosition(options?: GeoOptions): Promise<GeoPosition>;
105
+ requestPermission(): Promise<GlobalPermissionStatus>;
106
+ checkPermission(): Promise<GlobalPermissionStatus>;
107
+ }
108
+ export type PrintOptions = {
109
+ html: string;
110
+ filePath?: never;
111
+ } | {
112
+ html?: never;
113
+ filePath: string;
114
+ };
115
+ export interface IPrint {
116
+ print(options: PrintOptions): Promise<boolean | undefined>;
117
+ }
118
+ export type DocumentPickerResult = {
119
+ type: string | null;
120
+ name: string | null;
121
+ size: number | null;
122
+ base64: string;
123
+ };
124
+ export interface IDocumentPicker {
125
+ pickMultiple(): Promise<DocumentPickerResult[]>;
126
+ pickSingle(): Promise<DocumentPickerResult>;
127
+ requestPermission(): Promise<PermissionStatus>;
128
+ checkPermission(): Promise<PermissionStatus>;
129
+ }
130
+ export interface IPushNotifications {
131
+ isAvailable(): Promise<boolean>;
132
+ getDeviceToken(): Promise<string>;
133
+ requestPermission(): Promise<GlobalPermissionStatus>;
134
+ checkPermission(): Promise<GlobalPermissionStatus>;
135
+ }
136
+ export interface IUtils {
137
+ getPlatform(): Promise<typeof Platform.OS>;
138
+ getBundleId(): Promise<string | undefined>;
139
+ }
140
+ export interface ISystem {
141
+ openSettings: typeof openSettings;
142
+ }
143
+ export type DeepLinkType = {
144
+ scheme: string;
145
+ webUrl: string;
146
+ };
147
+ export interface IDeepLink {
148
+ openLink(deepLink: DeepLinkType, target?: string): Promise<void>;
149
+ }
150
+ export interface IConnectDevicesSessionUser {
151
+ userID: string;
152
+ organizationID: string;
153
+ accessToken: string;
154
+ }
155
+ export interface SyncRecord {
156
+ date: string;
157
+ metric: string;
158
+ value: number;
159
+ unit: string;
160
+ }
161
+ export interface IConnectDevices {
162
+ startSession(user: IConnectDevicesSessionUser): Promise<void>;
163
+ syncData(daysToFetch?: number): Promise<SyncRecord[]>;
164
+ refreshData(daysToFetch?: number): Promise<SyncRecord[]>;
165
+ endSession(): Promise<void>;
166
+ getCurrentUser(): Promise<IConnectDevicesSessionUser | null>;
167
+ checkPermissions(): Promise<boolean>;
168
+ }
169
+ export interface PasskeyCredentialDescriptor {
170
+ type: string;
171
+ id: string;
172
+ transports?: string[];
173
+ }
174
+ export interface PasskeyCreateRequest {
175
+ challenge: string;
176
+ rp: {
177
+ id: string;
178
+ name: string;
179
+ };
180
+ user: {
181
+ id: string;
182
+ name: string;
183
+ displayName: string;
184
+ };
185
+ pubKeyCredParams: Array<{
186
+ type: string;
187
+ alg: number;
188
+ }>;
189
+ timeout?: number;
190
+ excludeCredentials?: PasskeyCredentialDescriptor[];
191
+ authenticatorSelection?: {
192
+ authenticatorAttachment?: string;
193
+ requireResidentKey?: boolean;
194
+ residentKey?: string;
195
+ userVerification?: string;
196
+ };
197
+ attestation?: string;
198
+ }
199
+ export interface PasskeyCreateResult {
200
+ id: string;
201
+ rawId: string;
202
+ type?: string;
203
+ authenticatorAttachment?: string;
204
+ response: {
205
+ clientDataJSON: string;
206
+ attestationObject: string;
207
+ };
208
+ }
209
+ export interface PasskeyGetRequest {
210
+ challenge: string;
211
+ rpId: string;
212
+ timeout?: number;
213
+ allowCredentials?: PasskeyCredentialDescriptor[];
214
+ userVerification?: string;
215
+ }
216
+ export interface PasskeyGetResult {
217
+ id: string;
218
+ rawId: string;
219
+ type?: string;
220
+ authenticatorAttachment?: string;
221
+ response: {
222
+ authenticatorData: string;
223
+ clientDataJSON: string;
224
+ signature: string;
225
+ userHandle: string;
226
+ };
227
+ }
228
+ export interface IPasskey {
229
+ /** Whether the device supports passkeys (Android 28+ / iOS 15+). */
230
+ isSupported(): Promise<boolean>;
231
+ /** Perform a FIDO2 credential registration (navigator.credentials.create). */
232
+ create(request: PasskeyCreateRequest): Promise<PasskeyCreateResult>;
233
+ /** Perform a FIDO2 credential assertion (navigator.credentials.get). */
234
+ get(request: PasskeyGetRequest): Promise<PasskeyGetResult>;
235
+ }
236
+ export interface INativeBridge {
237
+ connectDevices: IConnectDevices;
238
+ webview: IWebview;
239
+ biometrics: IBiometrics;
240
+ events: IEvents;
241
+ storage: IStorage;
242
+ camera: ICamera;
243
+ geolocation: IGeolocation;
244
+ print: IPrint;
245
+ documentDownload: IDocumentDownload;
246
+ documentPicker: IDocumentPicker;
247
+ pushNotifications: IPushNotifications;
248
+ system: ISystem;
249
+ deepLink: IDeepLink;
250
+ utils: IUtils;
251
+ passkey: IPasskey;
252
+ reloadView(preserveSession?: boolean): void;
253
+ }
254
+ export type GlobalPermissionStatus = PermissionStatus | PermissionState;
255
+ export type PluginKeys = Exclude<keyof INativeBridge, 'webview' | 'reloadView'>;
256
+ export type MethodKeys<T extends PluginKeys> = keyof INativeBridge[T];
257
+ export {};
@@ -1,51 +1,51 @@
1
- import { NativeModuleMap } from './native-plugins';
2
- import { PageTransitionEventKey, PageTransitionEventPayload, Telemetry } from '.';
3
- export type OnAuthSuccessEventData = {
4
- user: {
5
- id: string;
6
- };
7
- };
8
- export type ErrorEventData = {
9
- name: string;
10
- message: string;
11
- errorCode?: string;
12
- };
13
- export declare const OnAuthSuccessEventKey = "onauthsuccess";
14
- export declare const ErrorEventKey = "error";
15
- export type EventKeyToDataMap = {
16
- [OnAuthSuccessEventKey]: OnAuthSuccessEventData;
17
- [ErrorEventKey]: ErrorEventData;
18
- [PageTransitionEventKey]: PageTransitionEventPayload;
19
- };
20
- type OnEventData<T extends keyof EventKeyToDataMap> = {
21
- key: T;
22
- data: EventKeyToDataMap[T];
23
- };
24
- type Path = {
25
- value: string;
26
- onResetValue: () => void;
27
- };
28
- export type ComponentViewBaseProps = {
29
- clientKey: string;
30
- initialPath?: string;
31
- path?: Path;
32
- onEvent?: <T extends keyof EventKeyToDataMap>(data: OnEventData<T>) => void;
33
- debug?: boolean;
34
- nativeModules?: NativeModuleMap;
35
- telemetry?: Telemetry;
36
- } & ({
37
- /** Supply the auth strategy. Defaults to `jwe` which will require a `userToken` prop.
38
- *
39
- * _NOTE_: TS can say `authStrategy` missing. Can be resolved by supplying `userToken`. */
40
- authStrategy?: 'jwe';
41
- userToken: string;
42
- webOrigin?: never;
43
- } | {
44
- authStrategy: 'credential';
45
- userToken?: never;
46
- /** Optional override for the WebView origin. When set, `window.origin` inside the WebView
47
- * will be `https://<webOrigin>`. Used to align the WebView origin with passkey RP ID domains.
48
- * Example: `sub.domain.com` */
49
- webOrigin?: string;
50
- });
51
- export {};
1
+ import { NativeModuleMap } from './native-plugins';
2
+ import { PageTransitionEventKey, PageTransitionEventPayload, Telemetry } from '.';
3
+ export type OnAuthSuccessEventData = {
4
+ user: {
5
+ id: string;
6
+ };
7
+ };
8
+ export type ErrorEventData = {
9
+ name: string;
10
+ message: string;
11
+ errorCode?: string;
12
+ };
13
+ export declare const OnAuthSuccessEventKey = "onauthsuccess";
14
+ export declare const ErrorEventKey = "error";
15
+ export type EventKeyToDataMap = {
16
+ [OnAuthSuccessEventKey]: OnAuthSuccessEventData;
17
+ [ErrorEventKey]: ErrorEventData;
18
+ [PageTransitionEventKey]: PageTransitionEventPayload;
19
+ };
20
+ type OnEventData<T extends keyof EventKeyToDataMap> = {
21
+ key: T;
22
+ data: EventKeyToDataMap[T];
23
+ };
24
+ type Path = {
25
+ value: string;
26
+ onResetValue: () => void;
27
+ };
28
+ export type ComponentViewBaseProps = {
29
+ clientKey: string;
30
+ initialPath?: string;
31
+ path?: Path;
32
+ onEvent?: <T extends keyof EventKeyToDataMap>(data: OnEventData<T>) => void;
33
+ debug?: boolean;
34
+ nativeModules?: NativeModuleMap;
35
+ telemetry?: Telemetry;
36
+ } & ({
37
+ /** Supply the auth strategy. Defaults to `jwe` which will require a `userToken` prop.
38
+ *
39
+ * _NOTE_: TS can say `authStrategy` missing. Can be resolved by supplying `userToken`. */
40
+ authStrategy?: 'jwe';
41
+ userToken: string;
42
+ webOrigin?: never;
43
+ } | {
44
+ authStrategy: 'credential';
45
+ userToken?: never;
46
+ /** Optional override for the WebView origin. When set, `window.origin` inside the WebView
47
+ * will be `https://<webOrigin>`. Used to align the WebView origin with passkey RP ID domains.
48
+ * Example: `sub.domain.com` */
49
+ webOrigin?: string;
50
+ });
51
+ export {};
@@ -1,39 +1,39 @@
1
- import type * as androidLocationEnabler from 'react-native-android-location-enabler';
2
- import type biometrics from 'react-native-biometrics';
3
- import type documentPicker from '@react-native-documents/picker';
4
- import type fileSystem from 'react-native-fs';
5
- import type * as pushNotifications from 'react-native-notifications';
6
- import type permissions from 'react-native-permissions';
7
- import type print from 'react-native-print';
8
- import type storage from '@react-native-async-storage/async-storage';
9
- import type * as cameraRoll from '@react-native-camera-roll/camera-roll';
10
- import type geolocation from '@react-native-community/geolocation';
11
- import type deviceInfo from 'react-native-device-info';
12
- import type * as connectDevicesCore from '@validic-mobile/react-native-inform-core';
13
- import type * as connectDevicesHealthConnect from '@validic-mobile/react-native-inform-healthconnect';
14
- import type * as connectDevicesHealthKit from '@validic-mobile/react-native-inform-healthkit';
15
- export interface PasskeyModule {
16
- isSupported(): boolean;
17
- create(request: import('./native-bridge').PasskeyCreateRequest): Promise<import('./native-bridge').PasskeyCreateResult>;
18
- get(request: import('./native-bridge').PasskeyGetRequest): Promise<import('./native-bridge').PasskeyGetResult>;
19
- }
20
- export type NativePackage = '@react-native-async-storage/async-storage' | '@react-native-community/geolocation' | '@react-native-camera-roll/camera-roll' | 'react-native-biometrics' | 'react-native-permissions' | 'react-native-print' | 'react-native-webview' | 'react-native-fs' | '@react-native-documents/picker' | 'react-native-notifications' | 'react-native-device-info' | 'react-native-android-location-enabler' | '@validic-mobile/react-native-inform-core' | '@validic-mobile/react-native-inform-healthconnect' | '@validic-mobile/react-native-inform-healthkit' | 'react-native-passkey';
21
- export type NativePackages = Array<NativePackage>;
22
- export type NativeModuleMap = {
23
- androidLocationEnabler?: typeof androidLocationEnabler;
24
- biometrics?: typeof biometrics;
25
- permissions?: typeof permissions;
26
- cameraRoll?: typeof cameraRoll;
27
- fileSystem?: typeof fileSystem;
28
- documentPicker?: typeof documentPicker;
29
- geolocation?: typeof geolocation;
30
- print?: typeof print;
31
- storage?: typeof storage;
32
- pushNotifications?: typeof pushNotifications;
33
- deviceInfo?: typeof deviceInfo;
34
- connectDevicesCore?: typeof connectDevicesCore;
35
- connectDevicesHealthConnect?: typeof connectDevicesHealthConnect;
36
- connectDevicesHealthKit?: typeof connectDevicesHealthKit;
37
- passkey?: PasskeyModule;
38
- };
39
- export type NativeModules = (keyof NativeModuleMap)[];
1
+ import type * as androidLocationEnabler from 'react-native-android-location-enabler';
2
+ import type biometrics from 'react-native-biometrics';
3
+ import type documentPicker from '@react-native-documents/picker';
4
+ import type fileSystem from 'react-native-fs';
5
+ import type * as pushNotifications from 'react-native-notifications';
6
+ import type permissions from 'react-native-permissions';
7
+ import type print from 'react-native-print';
8
+ import type storage from '@react-native-async-storage/async-storage';
9
+ import type * as cameraRoll from '@react-native-camera-roll/camera-roll';
10
+ import type geolocation from '@react-native-community/geolocation';
11
+ import type deviceInfo from 'react-native-device-info';
12
+ import type * as connectDevicesCore from '@validic-mobile/react-native-inform-core';
13
+ import type * as connectDevicesHealthConnect from '@validic-mobile/react-native-inform-healthconnect';
14
+ import type * as connectDevicesHealthKit from '@validic-mobile/react-native-inform-healthkit';
15
+ export interface PasskeyModule {
16
+ isSupported(): boolean;
17
+ create(request: import('./native-bridge').PasskeyCreateRequest): Promise<import('./native-bridge').PasskeyCreateResult>;
18
+ get(request: import('./native-bridge').PasskeyGetRequest): Promise<import('./native-bridge').PasskeyGetResult>;
19
+ }
20
+ export type NativePackage = '@react-native-async-storage/async-storage' | '@react-native-community/geolocation' | '@react-native-camera-roll/camera-roll' | 'react-native-biometrics' | 'react-native-permissions' | 'react-native-print' | 'react-native-webview' | 'react-native-fs' | '@react-native-documents/picker' | 'react-native-notifications' | 'react-native-device-info' | 'react-native-android-location-enabler' | '@validic-mobile/react-native-inform-core' | '@validic-mobile/react-native-inform-healthconnect' | '@validic-mobile/react-native-inform-healthkit' | 'react-native-passkey';
21
+ export type NativePackages = Array<NativePackage>;
22
+ export type NativeModuleMap = {
23
+ androidLocationEnabler?: typeof androidLocationEnabler;
24
+ biometrics?: typeof biometrics;
25
+ permissions?: typeof permissions;
26
+ cameraRoll?: typeof cameraRoll;
27
+ fileSystem?: typeof fileSystem;
28
+ documentPicker?: typeof documentPicker;
29
+ geolocation?: typeof geolocation;
30
+ print?: typeof print;
31
+ storage?: typeof storage;
32
+ pushNotifications?: typeof pushNotifications;
33
+ deviceInfo?: typeof deviceInfo;
34
+ connectDevicesCore?: typeof connectDevicesCore;
35
+ connectDevicesHealthConnect?: typeof connectDevicesHealthConnect;
36
+ connectDevicesHealthKit?: typeof connectDevicesHealthKit;
37
+ passkey?: PasskeyModule;
38
+ };
39
+ export type NativeModules = (keyof NativeModuleMap)[];