@icanbwell/types 0.38.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.38.0",
3
+ "version": "0.40.0",
4
4
  "typedoc": {
5
5
  "entryPoint": "./src/index.ts",
6
6
  "tsconfig": "./tsconfig.lib.json"
@@ -36,7 +36,7 @@
36
36
  "dependencies": {
37
37
  "apollo-link-rest": "0.9.0",
38
38
  "react-native-biometrics": "3.0.1",
39
- "react-native-vision-camera": "2.15.4"
39
+ "react-native-permissions": "3.8.0"
40
40
  },
41
41
  "peerDependencies": {}
42
42
  }
@@ -1,14 +1,15 @@
1
1
  import type rnBiometrics from 'react-native-biometrics';
2
2
  import type TypedEmitter from 'typed-emitter';
3
- import type { Camera } from 'react-native-vision-camera';
4
- import { OnAuthSuccessEventKey, type OnAuthSuccessEventData } from './native-components';
3
+ import { OnAuthSuccessEventKey, type OnAuthSuccessEventData, OnErrorEventKey, type OnErrorEventData } from './native-components';
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
+ [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>>;
@@ -34,9 +35,8 @@ export interface IStorage {
34
35
  }
35
36
  export interface ICamera {
36
37
  isAvailable(): Promise<boolean>;
37
- getCameraPermissionStatus: InvokedWrappedMethod<typeof Camera.getCameraPermissionStatus>;
38
- requestCameraPermission: InvokedWrappedMethod<typeof Camera.requestCameraPermission>;
39
- takePhoto: InvokedWrappedMethod<Camera['takePhoto']>;
38
+ requestPermission(): Promise<PermissionStatus>;
39
+ checkPermission(): Promise<PermissionStatus>;
40
40
  }
41
41
  export interface INativeBridge {
42
42
  webview: IWebview;
@@ -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.