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