@pinwheel/react-native-pinwheel 2.3.16 → 2.4.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.
- package/README.md +19 -4
- package/lib/constants.d.ts +1 -1
- package/lib/constants.js +1 -1
- package/lib/index.d.ts +18 -11
- package/lib/index.js +15 -15
- package/package.json +4 -12
package/README.md
CHANGED
|
@@ -12,11 +12,26 @@ You may want to run the example app locally to get started.
|
|
|
12
12
|
- iPhone 14 simulator (open your Simulator app and check the available versions)
|
|
13
13
|
- iOS 16 running on the simulator (open your Simulator app and check the available versions)
|
|
14
14
|
- `pod` version 1.11.3 (check with `pod --version`)
|
|
15
|
+
- Add your pinwheel secret to `example/env.js` (create this file) with `export default "<YOUR PINWHEEL SECRET>"`.
|
|
15
16
|
|
|
16
17
|
#### Directions
|
|
17
18
|
|
|
18
19
|
- `npm run dev`
|
|
19
20
|
|
|
21
|
+
#### Troubleshooting
|
|
22
|
+
|
|
23
|
+
###### An error was encountered processing the command (domain=com.apple.CoreSimulator.SimError, code=405)
|
|
24
|
+
- Click Apple > About This Mac > Storage > Manage > Developer
|
|
25
|
+
- Delete Xcode cache
|
|
26
|
+
- Delete Project Build and indexes
|
|
27
|
+
|
|
28
|
+
###### Failed to build iOS project. We ran "xcodebuild" command but it exited with error code 65
|
|
29
|
+
- Try downloading Xcode 14.2 from https://developer.apple.com/download/all/?q=xcode
|
|
30
|
+
|
|
31
|
+
###### Failed to locate 'git', requesting installation of command line developer tools
|
|
32
|
+
For this or other errors related to command line developer tools:
|
|
33
|
+
- Make sure you have Command Line Tools for Xcode 14.2 installed
|
|
34
|
+
- Open Xcode > Click Xcode in the app menu > Settings > Locations > Command Line Tools dropdown and set the correct location
|
|
20
35
|
|
|
21
36
|
## Installation
|
|
22
37
|
|
|
@@ -64,7 +79,7 @@ With the PinwheelLink component, end-users can select their employer, authentica
|
|
|
64
79
|
|
|
65
80
|
### `linkToken`
|
|
66
81
|
|
|
67
|
-
The link token retrieved using the [create link token endpoint](https://docs.
|
|
82
|
+
The link token retrieved using the [create link token endpoint](https://docs.pinwheelapi.com/reference/post_v1_link_tokens___post).
|
|
68
83
|
|
|
69
84
|
| Type | Required |
|
|
70
85
|
| ------ | -------- |
|
|
@@ -80,7 +95,7 @@ Callback when a user successfully signs in to their payroll account.
|
|
|
80
95
|
|
|
81
96
|
### `onError`
|
|
82
97
|
|
|
83
|
-
Callback whenever an error occurs during the modal flow. This does not necessarily mean that the flow cannot still complete successfully. These include such retryable events as the user inputting an incorrect password or MFA code and needs to reattempt it. Error codes can be seen [here](https://docs.
|
|
98
|
+
Callback whenever an error occurs during the modal flow. This does not necessarily mean that the flow cannot still complete successfully. These include such retryable events as the user inputting an incorrect password or MFA code and needs to reattempt it. Error codes can be seen [here](https://docs.pinwheelapi.com/docs/link-sdk-errors).
|
|
84
99
|
|
|
85
100
|
| Type | Required |
|
|
86
101
|
| -------- | -------- |
|
|
@@ -96,7 +111,7 @@ Callback whenever a user completes a modal flow successfully. Note: This is simp
|
|
|
96
111
|
|
|
97
112
|
### `onExit`
|
|
98
113
|
|
|
99
|
-
Callback whenever a user exits the modal either explicitly or if an error occurred that crashed the modal. Error codes can be seen [here](https://docs.
|
|
114
|
+
Callback whenever a user exits the modal either explicitly or if an error occurred that crashed the modal. Error codes can be seen [here](https://docs.pinwheelapi.com/docs/link-sdk-errors). Will pass back an error result if the modal either crashed due to an error or if the user exited while in an error state (e.g. invalid credentials).
|
|
100
115
|
|
|
101
116
|
| Type | Required |
|
|
102
117
|
| -------- | -------- |
|
|
@@ -104,7 +119,7 @@ Callback whenever a user exits the modal either explicitly or if an error occurr
|
|
|
104
119
|
|
|
105
120
|
### `onEvent`
|
|
106
121
|
|
|
107
|
-
Callback for all significant events that happen during the modal flow. See all possible [event types](https://docs.
|
|
122
|
+
Callback for all significant events that happen during the modal flow. See all possible [event types](https://docs.pinwheelapi.com/docs/link-1#link-events).
|
|
108
123
|
|
|
109
124
|
| Type | Required |
|
|
110
125
|
| -------- | -------- |
|
package/lib/constants.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Importing package.json here causes a problem with the folder structure when we npm pack and publish.
|
|
3
3
|
*/
|
|
4
|
-
export declare const VERSION = "2.3.
|
|
4
|
+
export declare const VERSION = "2.3.18";
|
|
5
5
|
export declare const LINK_PAGE_URL = "https://cdn.getpinwheel.com/link-v2.3.0.html";
|
|
6
6
|
export declare const PINWHEEL_DOMAIN = "getpinwheel.com";
|
package/lib/constants.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Importing package.json here causes a problem with the folder structure when we npm pack and publish.
|
|
3
3
|
*/
|
|
4
|
-
export const VERSION = '2.3.
|
|
4
|
+
export const VERSION = '2.3.18';
|
|
5
5
|
export const LINK_PAGE_URL = 'https://cdn.getpinwheel.com/link-v2.3.0.html';
|
|
6
6
|
export const PINWHEEL_DOMAIN = 'getpinwheel.com';
|
package/lib/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
2
|
export declare const PINWHEEL_MESSAGE_TYPES: {
|
|
3
3
|
PINWHEEL_EXIT: string;
|
|
4
4
|
PINWHEEL_MODAL_CLOSE: string;
|
|
@@ -6,7 +6,7 @@ export declare const PINWHEEL_MESSAGE_TYPES: {
|
|
|
6
6
|
PINWHEEL_SUCCESS: string;
|
|
7
7
|
PINWHEEL_EVENT: string;
|
|
8
8
|
};
|
|
9
|
-
export
|
|
9
|
+
export type LinkResult = {
|
|
10
10
|
accountId: string;
|
|
11
11
|
platformId: string;
|
|
12
12
|
job: string;
|
|
@@ -17,25 +17,32 @@ export declare type LinkResult = {
|
|
|
17
17
|
};
|
|
18
18
|
};
|
|
19
19
|
};
|
|
20
|
+
export type ScreenTransition = {
|
|
21
|
+
screenName: string;
|
|
22
|
+
selectedEmployerId?: string;
|
|
23
|
+
selectedEmployerName?: string;
|
|
24
|
+
selectedPlatformId?: string;
|
|
25
|
+
selectedPlatformName?: string;
|
|
26
|
+
};
|
|
20
27
|
/**
|
|
21
28
|
* @deprecated This type will be removed in version 2.4. Use the renamed type `PinwheelErrorType`
|
|
22
29
|
* instead.
|
|
23
30
|
*/
|
|
24
|
-
export
|
|
25
|
-
export
|
|
31
|
+
export type ErrorType = 'clientError' | 'systemError' | 'userActionRequired' | 'platformError' | 'invalidAccountsConfiguration' | 'invalidUserInput' | 'invalidLinkToken';
|
|
32
|
+
export type PinwheelErrorType = ErrorType;
|
|
26
33
|
/**
|
|
27
34
|
* @deprecated The type should not be used as it clashes with the native JS `Error` object.
|
|
28
35
|
* You should use `PinwheelError` instead. `Error` will be removed in version 2.4
|
|
29
36
|
*/
|
|
30
|
-
export
|
|
37
|
+
export type Error = {
|
|
31
38
|
type: PinwheelErrorType;
|
|
32
39
|
code: string;
|
|
33
40
|
message: string;
|
|
34
41
|
pendingRetry: boolean;
|
|
35
42
|
};
|
|
36
|
-
export
|
|
37
|
-
export
|
|
38
|
-
export
|
|
43
|
+
export type PinwheelError = Error;
|
|
44
|
+
export type EmptyPayloadObject = Record<string, never>;
|
|
45
|
+
export type EventPayload = {
|
|
39
46
|
selectedEmployerId: string;
|
|
40
47
|
selectedEmployerName: string;
|
|
41
48
|
} | {
|
|
@@ -47,8 +54,8 @@ export declare type EventPayload = {
|
|
|
47
54
|
} | LinkResult | {
|
|
48
55
|
accountId: string;
|
|
49
56
|
platformId: string;
|
|
50
|
-
} | PinwheelError | EmptyPayloadObject | undefined;
|
|
51
|
-
|
|
57
|
+
} | ScreenTransition | PinwheelError | EmptyPayloadObject | undefined;
|
|
58
|
+
type PinwheelProps = {
|
|
52
59
|
linkToken: string;
|
|
53
60
|
onLogin?: (result: {
|
|
54
61
|
accountId: string;
|
|
@@ -62,5 +69,5 @@ declare type PinwheelProps = {
|
|
|
62
69
|
onExit?: (error: PinwheelError | EmptyPayloadObject) => void;
|
|
63
70
|
onEvent?: (eventName: string, payload: EventPayload) => void;
|
|
64
71
|
};
|
|
65
|
-
declare const _default: ({ linkToken, onLogin, onLoginAttempt, onSuccess, onError, onExit, onEvent }: PinwheelProps) => JSX.Element;
|
|
72
|
+
declare const _default: ({ linkToken, onLogin, onLoginAttempt, onSuccess, onError, onExit, onEvent }: PinwheelProps) => React.JSX.Element;
|
|
66
73
|
export default _default;
|
package/lib/index.js
CHANGED
|
@@ -103,20 +103,20 @@ export default ({ linkToken, onLogin, onLoginAttempt, onSuccess, onError, onExit
|
|
|
103
103
|
`;
|
|
104
104
|
return (<SafeAreaView style={styles.container}>
|
|
105
105
|
<WebView source={{ uri: LINK_PAGE_URL }} onMessage={handleEvent} injectedJavaScript={runFirst} onShouldStartLoadWithRequest={(request) => {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
106
|
+
const targetURL = request.url;
|
|
107
|
+
const isLinkPage = targetURL.includes(PINWHEEL_DOMAIN);
|
|
108
|
+
if (!isLinkPage) {
|
|
109
|
+
Linking.canOpenURL(targetURL).then(supported => {
|
|
110
|
+
if (supported) {
|
|
111
|
+
Linking.openURL(targetURL).then(() => { });
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
console.warn('Don\'t know how to open URL: ' + targetURL);
|
|
115
|
+
}
|
|
116
|
+
return false;
|
|
117
|
+
}).catch(err => console.error('An error occurred ', err));
|
|
118
|
+
}
|
|
119
|
+
return isLinkPage;
|
|
120
|
+
}}/>
|
|
121
121
|
</SafeAreaView>);
|
|
122
122
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pinwheel/react-native-pinwheel",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Pinwheel React Native SDK",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -18,19 +18,11 @@
|
|
|
18
18
|
"peerDependencies": {
|
|
19
19
|
"react": "^16.13.1 || ^17 || ^18",
|
|
20
20
|
"react-native": "*",
|
|
21
|
-
"react-native-webview": "
|
|
21
|
+
"react-native-webview": "*"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"@types/react-native": "^0.
|
|
25
|
-
"react-native-webview": "^
|
|
24
|
+
"@types/react-native": "^0.72.2",
|
|
25
|
+
"react-native-webview": "^13.3.1",
|
|
26
26
|
"typescript": "^4.0.3"
|
|
27
|
-
},
|
|
28
|
-
"overrides": {
|
|
29
|
-
"react-native": {
|
|
30
|
-
"hermes-engine": "0.11.0"
|
|
31
|
-
},
|
|
32
|
-
"@react-native-community/cli-tools": {
|
|
33
|
-
"shell-quote": "^1.7.4"
|
|
34
|
-
}
|
|
35
27
|
}
|
|
36
28
|
}
|