@pinwheel/react-native-pinwheel 3.2.0-rc.1 → 3.2.0-rc.3
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/ios/RTNPinwheelView.mm +1 -1
- package/package.json +6 -3
- package/src/NativePinwheelEvents.d.ts +13 -0
- package/src/Pinwheel.d.ts +4 -0
- package/src/PinwheelEvents.d.ts +12 -0
- package/src/PinwheelEvents.ts +1 -1
- package/src/RTNPinwheelNativeComponent.d.ts +7 -0
- package/src/client-events/client.d.ts +10 -0
- package/src/client-events/registry/v2.3.d.ts +125 -0
- package/src/client-events/registry/v3.d.ts +25 -0
- package/src/client-events/utils.d.ts +9 -0
package/ios/RTNPinwheelView.mm
CHANGED
|
@@ -36,7 +36,7 @@ using namespace facebook::react;
|
|
|
36
36
|
|
|
37
37
|
- (void)initPinwheelWrapperVC {
|
|
38
38
|
if (self.token != nil && self.pinwheelWrapperVC == nil) {
|
|
39
|
-
self.pinwheelWrapperVC = [[PinwheelVCWrapper alloc] initWithToken:self.token delegate:self sdk:@"react native" version: @"3.2.0
|
|
39
|
+
self.pinwheelWrapperVC = [[PinwheelVCWrapper alloc] initWithToken:self.token delegate:self sdk:@"react native" version: @"3.2.0"];
|
|
40
40
|
[self addSubview:self.pinwheelWrapperVC.view];
|
|
41
41
|
}
|
|
42
42
|
}
|
package/package.json
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pinwheel/react-native-pinwheel",
|
|
3
|
-
"version": "3.2.0-rc.
|
|
3
|
+
"version": "3.2.0-rc.3",
|
|
4
4
|
"type": "module",
|
|
5
|
+
"main": "src/index.ts",
|
|
6
|
+
"types": "src/index.ts",
|
|
5
7
|
"description": "Pinwheel React Native SDK",
|
|
6
|
-
"homepage": "https://github.com/underdog-tech/react-native-pinwheel",
|
|
7
8
|
"react-native": "src/index",
|
|
8
9
|
"source": "src/index",
|
|
10
|
+
"homepage": "https://github.com/underdog-tech/react-native-pinwheel",
|
|
9
11
|
"files": [
|
|
10
12
|
"src",
|
|
11
13
|
"android",
|
|
@@ -19,6 +21,7 @@
|
|
|
19
21
|
"!**/__mocks__"
|
|
20
22
|
],
|
|
21
23
|
"scripts": {
|
|
24
|
+
"build": "tsc",
|
|
22
25
|
"dev": "./scripts/dev_expo.sh"
|
|
23
26
|
},
|
|
24
27
|
"author": "Pinwheel",
|
|
@@ -30,7 +33,7 @@
|
|
|
30
33
|
"devDependencies": {
|
|
31
34
|
"@types/react-native": "^0.72.2",
|
|
32
35
|
"prettier": "^3.3.3",
|
|
33
|
-
"typescript": "^4.
|
|
36
|
+
"typescript": "^4.9.5"
|
|
34
37
|
},
|
|
35
38
|
"codegenConfig": {
|
|
36
39
|
"name": "RTNPinwheelSpec",
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { TurboModule, EmitterSubscription } from "react-native";
|
|
2
|
+
import type { Int32 } from 'react-native/Libraries/Types/CodegenTypes';
|
|
3
|
+
export interface Spec extends TurboModule {
|
|
4
|
+
setListener(): void;
|
|
5
|
+
removeListener(): void;
|
|
6
|
+
addListener(eventName: string): void;
|
|
7
|
+
removeListeners(count: Int32): void;
|
|
8
|
+
}
|
|
9
|
+
declare const PinwheelEventsTurboModule: Spec;
|
|
10
|
+
export default PinwheelEventsTurboModule;
|
|
11
|
+
declare const addListener: (callback: (event: any) => void) => EmitterSubscription;
|
|
12
|
+
declare const removeAllListeners: () => void;
|
|
13
|
+
export { addListener, removeAllListeners };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { EmitterSubscription } from 'react-native';
|
|
2
|
+
export declare const PinwheelEvents: {
|
|
3
|
+
addListener(callback: (events: any) => void): EmitterSubscription;
|
|
4
|
+
/**
|
|
5
|
+
* (iOS and Android Only)
|
|
6
|
+
* Removes all previously registered listeners and turns off notifications on the native side.
|
|
7
|
+
* ```javascript
|
|
8
|
+
* Clipboard.removeAllListeners();
|
|
9
|
+
* ```
|
|
10
|
+
*/
|
|
11
|
+
removeAllListeners(): void;
|
|
12
|
+
};
|
package/src/PinwheelEvents.ts
CHANGED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { LoginEventPayload, SuccessEventPayload, EventHandler, ErrorEventPayload, LoginAttemptEventPayload } from './registry/v3';
|
|
2
|
+
export type LinkOptions = {
|
|
3
|
+
linkToken: string;
|
|
4
|
+
onLogin?: (payload: LoginEventPayload) => void;
|
|
5
|
+
onLoginAttempt?: (payload: LoginAttemptEventPayload) => void;
|
|
6
|
+
onSuccess?: (payload: SuccessEventPayload) => void;
|
|
7
|
+
onError?: (error: ErrorEventPayload) => void;
|
|
8
|
+
onExit?: (error?: ErrorEventPayload) => void;
|
|
9
|
+
onEvent?: EventHandler;
|
|
10
|
+
};
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import type { AdditionsType, ModificationsType, RemovalsType } from '../utils';
|
|
2
|
+
export type PinwheelErrorType = 'sandboxError' | 'clientError' | 'systemError' | 'userActionRequired' | 'platformError' | 'invalidAccountsConfiguration' | 'invalidUserInput' | 'invalidLinkToken' | 'networkError';
|
|
3
|
+
export type LinkApiJob = 'login' | 'direct_deposit_switch' | 'card_switch';
|
|
4
|
+
export type OpenEventPayload = {};
|
|
5
|
+
export type SelectEmployerEventPayload = {
|
|
6
|
+
selectedEmployerId: string;
|
|
7
|
+
selectedEmployerName: string;
|
|
8
|
+
};
|
|
9
|
+
export type SelectPlatformEventPayload = {
|
|
10
|
+
selectedPlatformId: string;
|
|
11
|
+
selectedPlatformName: string;
|
|
12
|
+
};
|
|
13
|
+
export type IncorrectPlatformGivenEventPayload = {};
|
|
14
|
+
export type LoginAttemptEventPayload = {
|
|
15
|
+
platformId: string;
|
|
16
|
+
};
|
|
17
|
+
export type LoginEventPayload = {
|
|
18
|
+
accountId: string;
|
|
19
|
+
platformId: string;
|
|
20
|
+
};
|
|
21
|
+
export type InputAmountEventPayload = {
|
|
22
|
+
value: number;
|
|
23
|
+
unit: '$' | '%';
|
|
24
|
+
};
|
|
25
|
+
type _PartialSwitch<T> = {
|
|
26
|
+
action: 'partial_switch';
|
|
27
|
+
allocation: T;
|
|
28
|
+
};
|
|
29
|
+
type InputAllocationPercentage = _PartialSwitch<{
|
|
30
|
+
type: 'percentage';
|
|
31
|
+
value: number;
|
|
32
|
+
}>;
|
|
33
|
+
type InputAllocationAmount = _PartialSwitch<{
|
|
34
|
+
type: 'amount';
|
|
35
|
+
value: number;
|
|
36
|
+
}>;
|
|
37
|
+
type InputAllocationRemainder = _PartialSwitch<{
|
|
38
|
+
type: 'remainder';
|
|
39
|
+
}>;
|
|
40
|
+
export type InputAllocationEventPayload = {
|
|
41
|
+
action: 'full_switch';
|
|
42
|
+
} | InputAllocationRemainder | InputAllocationAmount | InputAllocationPercentage;
|
|
43
|
+
/**
|
|
44
|
+
* @deprecated - Use `InputAllocationEventPayload` instead.
|
|
45
|
+
*/
|
|
46
|
+
export type InputAllocation = InputAllocationEventPayload;
|
|
47
|
+
export type CardSwitchBeginEventPayload = {};
|
|
48
|
+
export type DocUploadsBeginEventPayload = {
|
|
49
|
+
uploadedDocumentsSubmittedCount?: number;
|
|
50
|
+
};
|
|
51
|
+
export type DocUploadsSubmittedEventPayload = {
|
|
52
|
+
uploadedDocumentSubmittedCount: number;
|
|
53
|
+
};
|
|
54
|
+
export type DdFormBeginEventPayload = {};
|
|
55
|
+
export type DdFormCreateEventPayload = {
|
|
56
|
+
url: string;
|
|
57
|
+
};
|
|
58
|
+
export type DdFormDownloadEventPayload = {};
|
|
59
|
+
export type ScreenTransitionEventPayload = {
|
|
60
|
+
screenName: string;
|
|
61
|
+
selectedEmployerId?: string;
|
|
62
|
+
selectedEmployerName?: string;
|
|
63
|
+
selectedPlatformId?: string;
|
|
64
|
+
selectedPlatformName?: string;
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* @deprecated - Use `ScreenTransitionEventPayload` instead.
|
|
68
|
+
*/
|
|
69
|
+
export type ScreenTransition = ScreenTransitionEventPayload;
|
|
70
|
+
export type ExitEventPayload = Record<string, never>;
|
|
71
|
+
export type SuccessEventPayload = {
|
|
72
|
+
accountId: string;
|
|
73
|
+
platformId: string;
|
|
74
|
+
job: LinkApiJob;
|
|
75
|
+
params?: {
|
|
76
|
+
amount?: {
|
|
77
|
+
value: number;
|
|
78
|
+
unit: '%' | '$';
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
export type ErrorEventPayload = {
|
|
83
|
+
type: PinwheelErrorType;
|
|
84
|
+
code: string;
|
|
85
|
+
message: string;
|
|
86
|
+
pendingRetry: boolean;
|
|
87
|
+
};
|
|
88
|
+
export type OtherEventPayload = {
|
|
89
|
+
name: string;
|
|
90
|
+
payload: {
|
|
91
|
+
key: string;
|
|
92
|
+
value: string;
|
|
93
|
+
type: 'string' | 'boolean' | 'number';
|
|
94
|
+
}[];
|
|
95
|
+
};
|
|
96
|
+
/**
|
|
97
|
+
* @deprecated - Use `ErrorEventPayload` instead.
|
|
98
|
+
*/
|
|
99
|
+
export type PinwheelError = ErrorEventPayload;
|
|
100
|
+
type EventPayloadAdditions = {
|
|
101
|
+
open: OpenEventPayload;
|
|
102
|
+
select_employer: SelectEmployerEventPayload;
|
|
103
|
+
select_platform: SelectPlatformEventPayload;
|
|
104
|
+
incorrect_platform_given: IncorrectPlatformGivenEventPayload;
|
|
105
|
+
login_attempt: LoginAttemptEventPayload;
|
|
106
|
+
login: LoginEventPayload;
|
|
107
|
+
input_amount: InputAmountEventPayload;
|
|
108
|
+
input_allocation: InputAllocationEventPayload;
|
|
109
|
+
card_switch_begin: CardSwitchBeginEventPayload;
|
|
110
|
+
doc_uploads_begin: DocUploadsBeginEventPayload;
|
|
111
|
+
doc_uploads_submitted: DocUploadsSubmittedEventPayload;
|
|
112
|
+
dd_form_begin: DdFormBeginEventPayload;
|
|
113
|
+
dd_form_create: DdFormCreateEventPayload;
|
|
114
|
+
dd_form_download: DdFormDownloadEventPayload;
|
|
115
|
+
screen_transition: ScreenTransitionEventPayload;
|
|
116
|
+
exit: ErrorEventPayload | ExitEventPayload;
|
|
117
|
+
other_event: OtherEventPayload;
|
|
118
|
+
success: SuccessEventPayload;
|
|
119
|
+
error: ErrorEventPayload;
|
|
120
|
+
};
|
|
121
|
+
type EventPayloadModifications = {};
|
|
122
|
+
type EventPayloadRemovals = [];
|
|
123
|
+
export type EventPayloadMap = Omit<AdditionsType<EventPayloadAdditions> & ModificationsType<EventPayloadModifications>, keyof RemovalsType<EventPayloadRemovals>>;
|
|
124
|
+
export type EventHandler = <T extends keyof EventPayloadMap>(eventName: T, payload: EventPayloadMap[T]) => void;
|
|
125
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { AdditionsType, ModificationsType, RemovalsType } from '../utils';
|
|
2
|
+
import type { EventPayloadMap as EventPayloadMapV2, LinkApiJob } from './v2.3';
|
|
3
|
+
import { InputAllocationEventPayload as InputAllocationEventPayload2_3 } from './v2.3';
|
|
4
|
+
export * from './v2.3';
|
|
5
|
+
export type SuccessEventPayload = {
|
|
6
|
+
accountId: string;
|
|
7
|
+
platformId: string;
|
|
8
|
+
job: LinkApiJob;
|
|
9
|
+
params?: InputAllocationEventPayload;
|
|
10
|
+
};
|
|
11
|
+
export type InputAllocationEventPayload = {
|
|
12
|
+
action: null;
|
|
13
|
+
allocation: null;
|
|
14
|
+
} | InputAllocationEventPayload2_3;
|
|
15
|
+
/**
|
|
16
|
+
* @deprecated - Use `InputAllocationEventPayload` instead.
|
|
17
|
+
*/
|
|
18
|
+
export type InputAllocation = InputAllocationEventPayload;
|
|
19
|
+
type EventPayloadAdditions = {};
|
|
20
|
+
type EventPayloadModifications = {
|
|
21
|
+
input_allocation: InputAllocationEventPayload;
|
|
22
|
+
};
|
|
23
|
+
type EventPayloadRemovals = ['input_amount'];
|
|
24
|
+
export type EventPayloadMap = Omit<EventPayloadMapV2 & AdditionsType<EventPayloadAdditions> & ModificationsType<EventPayloadModifications>, keyof RemovalsType<EventPayloadRemovals>>;
|
|
25
|
+
export type EventHandler = <T extends keyof EventPayloadMap>(eventName: T, payload: EventPayloadMap[T]) => void;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type AdditionsType<Additions> = {
|
|
2
|
+
[Event in keyof Additions]: Additions[Event];
|
|
3
|
+
};
|
|
4
|
+
export type ModificationsType<Modifications> = {
|
|
5
|
+
[Event in keyof Modifications]: Modifications[Event];
|
|
6
|
+
};
|
|
7
|
+
export type RemovalsType<Removals extends string[]> = {
|
|
8
|
+
[Event in Removals[number]]: never;
|
|
9
|
+
};
|