@pinwheel/react-native-pinwheel 2.3.3 → 2.3.4

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/CHANGELOG.md ADDED
@@ -0,0 +1,25 @@
1
+ # Change Log
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ ## 2.3.x Releases
6
+
7
+ - `2.3.x` Releases - [2.3.4](#234)
8
+
9
+ ---
10
+
11
+ ### 2.3.4
12
+
13
+ #### Added
14
+
15
+ - Export `EventPayload` type.
16
+ - Export `PinwheelError` type.
17
+ - Export `PinwheelErrorType` type.
18
+ - Export `EmptyPayloadObject` type as `Record<string, never>`.
19
+
20
+ ##### Updated
21
+
22
+ - `EventPayload` is no longer a union containing `{}`. It now contains `Record<string, never>` instead due to [this behavior](https://github.com/Microsoft/TypeScript/wiki/FAQ#why-are-all-types-assignable-to-empty-interfaces).
23
+ - Mark exported `Error` type as **@deprecated** because it collides with the built-in javascript `Error` object. Replaced with `PinwheelError`.
24
+ - Mark exported `ErrorType` type as **@deprecated** because the new naming convention is prefixing with "`PinwheelError`". Replaced with `PinwheelErrorType`.
25
+ - Update `onExit` type to be `(error: PinwheelError | Record<string, never>)` to be accurate with current functionality.
package/lib/index.d.ts CHANGED
@@ -17,14 +17,25 @@ export declare type LinkResult = {
17
17
  };
18
18
  };
19
19
  };
20
+ /**
21
+ * @deprecated This type will be removed in version 2.4. Use the renamed type `PinwheelErrorType`
22
+ * instead.
23
+ */
20
24
  export declare type ErrorType = 'clientError' | 'systemError' | 'userActionRequired' | 'platformError' | 'invalidAccountsConfiguration' | 'invalidUserInput' | 'invalidLinkToken';
25
+ export declare type PinwheelErrorType = ErrorType;
26
+ /**
27
+ * @deprecated The type should not be used as it clashes with the native JS `Error` object.
28
+ * You should use `PinwheelError` instead. `Error` will be removed in version 2.4
29
+ */
21
30
  export declare type Error = {
22
- type: ErrorType;
31
+ type: PinwheelErrorType;
23
32
  code: string;
24
33
  message: string;
25
34
  pendingRetry: boolean;
26
35
  };
27
- declare type EventPayload = {
36
+ export declare type PinwheelError = Error;
37
+ export declare type EmptyPayloadObject = Record<string, never>;
38
+ export declare type EventPayload = {
28
39
  selectedEmployerId: string;
29
40
  selectedEmployerName: string;
30
41
  } | {
@@ -36,7 +47,7 @@ declare type EventPayload = {
36
47
  } | LinkResult | {
37
48
  accountId: string;
38
49
  platformId: string;
39
- } | Error | {} | undefined;
50
+ } | PinwheelError | EmptyPayloadObject | undefined;
40
51
  declare type PinwheelProps = {
41
52
  linkToken: string;
42
53
  onLogin?: (result: {
@@ -47,8 +58,8 @@ declare type PinwheelProps = {
47
58
  platformId: string;
48
59
  }) => void;
49
60
  onSuccess?: (result: LinkResult) => void;
50
- onError?: (error: Error) => void;
51
- onExit?: (error?: Error) => void;
61
+ onError?: (error: PinwheelError) => void;
62
+ onExit?: (error: PinwheelError | EmptyPayloadObject) => void;
52
63
  onEvent?: (eventName: string, payload: EventPayload) => void;
53
64
  };
54
65
  declare const _default: ({ linkToken, onLogin, onLoginAttempt, onSuccess, onError, onExit, onEvent }: PinwheelProps) => JSX.Element;
package/lib/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { WebView } from 'react-native-webview';
3
3
  import { Linking, Platform, SafeAreaView, StyleSheet } from 'react-native';
4
- const version = '2.3.3';
4
+ const version = '2.3.4';
5
5
  const styles = StyleSheet.create({
6
6
  container: {
7
7
  flex: 1,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pinwheel/react-native-pinwheel",
3
- "version": "2.3.3",
3
+ "version": "2.3.4",
4
4
  "type": "module",
5
5
  "description": "Pinwheel React Native SDK",
6
6
  "main": "lib/index.js",