@icanbwell/types 0.39.0 → 0.40.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,3 +1,4 @@
1
1
  const OnAuthSuccessEventKey = 'onauthsuccess';
2
+ const OnErrorEventKey = 'onerror';
2
3
 
3
- export { OnAuthSuccessEventKey };
4
+ export { OnAuthSuccessEventKey, OnErrorEventKey };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@icanbwell/types",
3
- "version": "0.39.0",
3
+ "version": "0.40.0",
4
4
  "typedoc": {
5
5
  "entryPoint": "./src/index.ts",
6
6
  "tsconfig": "./tsconfig.lib.json"
@@ -1,14 +1,15 @@
1
1
  import type rnBiometrics from 'react-native-biometrics';
2
2
  import type TypedEmitter from 'typed-emitter';
3
+ import { OnAuthSuccessEventKey, type OnAuthSuccessEventData, OnErrorEventKey, type OnErrorEventData } from './native-components';
3
4
  import { PermissionStatus } from 'react-native-permissions';
4
- import { OnAuthSuccessEventKey, type OnAuthSuccessEventData } from './native-components';
5
5
  export type NativeEvents<T = any> = {
6
6
  openwebview: (url: string) => void;
7
7
  closewebview: (data: T) => void;
8
8
  reloadwebview: () => void;
9
9
  [OnAuthSuccessEventKey]: (data: OnAuthSuccessEventData) => void;
10
+ [OnErrorEventKey]: (data: OnErrorEventData) => void;
10
11
  };
11
- export type NativeBridgeEmittableEvents = Pick<NativeEvents, 'onauthsuccess'>;
12
+ export type NativeBridgeEmittableEvents = Pick<NativeEvents, 'onauthsuccess' | 'onerror'>;
12
13
  export type NativeEventEmitter = TypedEmitter<NativeEvents>;
13
14
  export type NativeEmittableEventEmitter = TypedEmitter<NativeBridgeEmittableEvents>;
14
15
  type InvokedReturnType<T> = Promise<Awaited<T>>;
@@ -3,9 +3,16 @@ export type OnAuthSuccessEventData = {
3
3
  id: string;
4
4
  };
5
5
  };
6
+ export type OnErrorEventData = {
7
+ name: string;
8
+ message: string;
9
+ errorCode: string;
10
+ };
6
11
  export declare const OnAuthSuccessEventKey = "onauthsuccess";
12
+ export declare const OnErrorEventKey = "onerror";
7
13
  export type EventKeyToDataMap = {
8
14
  [OnAuthSuccessEventKey]: OnAuthSuccessEventData;
15
+ [OnErrorEventKey]: OnErrorEventData;
9
16
  };
10
17
  type OnEventData<T extends keyof EventKeyToDataMap> = {
11
18
  key: T;
@@ -14,7 +21,8 @@ type OnEventData<T extends keyof EventKeyToDataMap> = {
14
21
  export type ComponentViewBaseProps = {
15
22
  clientKey: string;
16
23
  initialPath?: string;
17
- onEvent?: <T extends keyof EventKeyToDataMap>(data: OnEventData<T>) => void;
24
+ onEvent?: <T extends keyof Omit<EventKeyToDataMap, 'onerror'>>(data: OnEventData<T>) => void;
25
+ onError?: (error: OnErrorEventData) => void;
18
26
  debug?: boolean;
19
27
  } & ({
20
28
  /** Supply the auth strategy. Defaults to `jwe` which will require a `userToken` prop.