@pinwheel/react-native-pinwheel 3.1.0 → 3.2.0-rc.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/PinwheelLinkSDKObjC/ObjCWrapper.xcframework/Info.plist +44 -0
- package/PinwheelLinkSDKObjC/ObjCWrapper.xcframework/ios-arm64/ObjCWrapper.framework/Headers/ObjCWrapper.h +18 -0
- package/PinwheelLinkSDKObjC/ObjCWrapper.xcframework/ios-arm64/ObjCWrapper.framework/Headers/PinwheelVCWrapper.h +14 -0
- package/PinwheelLinkSDKObjC/ObjCWrapper.xcframework/ios-arm64/ObjCWrapper.framework/Info.plist +0 -0
- package/PinwheelLinkSDKObjC/ObjCWrapper.xcframework/ios-arm64/ObjCWrapper.framework/Modules/module.modulemap +6 -0
- package/PinwheelLinkSDKObjC/ObjCWrapper.xcframework/ios-arm64/ObjCWrapper.framework/ObjCWrapper +0 -0
- package/PinwheelLinkSDKObjC/ObjCWrapper.xcframework/ios-arm64/ObjCWrapper.framework/README.md +15 -0
- package/PinwheelLinkSDKObjC/ObjCWrapper.xcframework/ios-arm64/ObjCWrapper.framework/_CodeSignature/CodeResources +146 -0
- package/PinwheelLinkSDKObjC/ObjCWrapper.xcframework/ios-arm64_x86_64-simulator/ObjCWrapper.framework/Headers/ObjCWrapper.h +18 -0
- package/PinwheelLinkSDKObjC/ObjCWrapper.xcframework/ios-arm64_x86_64-simulator/ObjCWrapper.framework/Headers/PinwheelVCWrapper.h +14 -0
- package/PinwheelLinkSDKObjC/ObjCWrapper.xcframework/ios-arm64_x86_64-simulator/ObjCWrapper.framework/Info.plist +0 -0
- package/PinwheelLinkSDKObjC/ObjCWrapper.xcframework/ios-arm64_x86_64-simulator/ObjCWrapper.framework/Modules/module.modulemap +6 -0
- package/PinwheelLinkSDKObjC/ObjCWrapper.xcframework/ios-arm64_x86_64-simulator/ObjCWrapper.framework/ObjCWrapper +0 -0
- package/PinwheelLinkSDKObjC/ObjCWrapper.xcframework/ios-arm64_x86_64-simulator/ObjCWrapper.framework/README.md +15 -0
- package/PinwheelLinkSDKObjC/ObjCWrapper.xcframework/ios-arm64_x86_64-simulator/ObjCWrapper.framework/_CodeSignature/CodeResources +146 -0
- package/RNPinwheelSDK.podspec +21 -17
- package/android/build.gradle +25 -34
- package/android/src/main/java/com/rtnpinwheel/Pinwheel.kt +103 -0
- package/android/src/main/java/com/{underdog_tech/react/PinwheelViewManager.kt → rtnpinwheel/PinwheelEventsModule.kt} +55 -120
- package/android/src/main/java/com/rtnpinwheel/PinwheelManager.kt +54 -0
- package/android/src/main/java/com/{underdog_tech/react → rtnpinwheel}/PinwheelPackage.kt +7 -9
- package/ios/RTNPinwheelEvents.h +13 -0
- package/ios/{RNTPinwheelEvents.m → RTNPinwheelEvents.mm} +15 -3
- package/ios/RTNPinwheelManager.mm +21 -0
- package/ios/RTNPinwheelView.h +17 -0
- package/ios/{RNTPinwheelView.m → RTNPinwheelView.mm} +41 -4
- package/package.json +32 -9
- package/src/NativePinwheelEvents.ts +62 -0
- package/src/Pinwheel.tsx +80 -0
- package/src/PinwheelEvents.ts +23 -0
- package/src/RTNPinwheelNativeComponent.ts +15 -0
- package/src/client-events/client.ts +17 -0
- package/src/client-events/registry/v2.3.ts +166 -0
- package/src/client-events/registry/v3.ts +47 -0
- package/src/client-events/utils.ts +12 -0
- package/src/index.ts +3 -0
- package/.vscode/settings.json +0 -4
- package/CHANGELOG.md +0 -157
- package/android/src/main/AndroidManifest.xml +0 -6
- package/android/src/main/java/com/underdog_tech/react/RNTPinwheelEvents.kt +0 -51
- package/dist/client-events/client.d.ts +0 -10
- package/dist/client-events/client.js +0 -1
- package/dist/client-events/registry/v2.3.d.ts +0 -125
- package/dist/client-events/registry/v2.3.js +0 -1
- package/dist/client-events/registry/v3.d.ts +0 -25
- package/dist/client-events/registry/v3.js +0 -4
- package/dist/client-events/utils.d.ts +0 -9
- package/dist/client-events/utils.js +0 -1
- package/dist/constants.d.ts +0 -4
- package/dist/constants.js +0 -4
- package/dist/index.d.ts +0 -5
- package/dist/index.js +0 -49
- package/dist/pinwheel-view.d.ts +0 -6
- package/dist/pinwheel-view.js +0 -2
- package/dist/pinwheel-wrapper.android.d.ts +0 -4
- package/dist/pinwheel-wrapper.android.js +0 -33
- package/dist/pinwheel-wrapper.ios.d.ts +0 -4
- package/dist/pinwheel-wrapper.ios.js +0 -17
- package/ios/RNTPinwheelEvents.h +0 -9
- package/ios/RNTPinwheelManager.m +0 -21
- package/ios/RNTPinwheelView.h +0 -12
|
@@ -1,125 +0,0 @@
|
|
|
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 {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,25 +0,0 @@
|
|
|
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;
|
|
@@ -1,9 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/constants.d.ts
DELETED
package/dist/constants.js
DELETED
package/dist/index.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { LinkOptions } from './client-events/client';
|
|
3
|
-
type PinwheelProps = {} & LinkOptions;
|
|
4
|
-
declare const _default: ({ linkToken, onLogin, onLoginAttempt, onSuccess, onError, onExit, onEvent }: PinwheelProps) => React.JSX.Element;
|
|
5
|
-
export default _default;
|
package/dist/index.js
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
// @ts-ignore-next-line
|
|
3
|
-
import Pinwheel from './pinwheel-wrapper';
|
|
4
|
-
import { SafeAreaView, StyleSheet } from 'react-native';
|
|
5
|
-
const styles = StyleSheet.create({
|
|
6
|
-
container: {
|
|
7
|
-
flex: 1,
|
|
8
|
-
},
|
|
9
|
-
});
|
|
10
|
-
export default ({ linkToken, onLogin, onLoginAttempt, onSuccess, onError, onExit, onEvent }) => {
|
|
11
|
-
const handleEvent = (event) => {
|
|
12
|
-
if (!event) {
|
|
13
|
-
// first event is always an empty string
|
|
14
|
-
return;
|
|
15
|
-
}
|
|
16
|
-
const { name, payload } = event;
|
|
17
|
-
// Our Android SDK, since the beginning, has been firing events with upper case.
|
|
18
|
-
// Since we are now wrapping the Android SDK to create the RN SDK, we need to reconcile
|
|
19
|
-
// the event names here.
|
|
20
|
-
const normalizedName = name.toLowerCase();
|
|
21
|
-
onEvent && onEvent(normalizedName, payload);
|
|
22
|
-
switch (normalizedName) {
|
|
23
|
-
case 'exit':
|
|
24
|
-
// console.log(`case: exit, onExit: ${onExit}`);
|
|
25
|
-
onExit && onExit(payload);
|
|
26
|
-
break;
|
|
27
|
-
case 'success':
|
|
28
|
-
// console.log(`case: success, onSuccess: ${onSuccess}`);
|
|
29
|
-
onSuccess && onSuccess(payload);
|
|
30
|
-
break;
|
|
31
|
-
case 'login':
|
|
32
|
-
// console.log(`case: login, onLogin: ${onLogin}`);
|
|
33
|
-
onLogin && onLogin(payload);
|
|
34
|
-
break;
|
|
35
|
-
case 'login_attempt':
|
|
36
|
-
// console.log(`case: login_attempt, onLoginAttempt: ${onLoginAttempt}`);
|
|
37
|
-
onLoginAttempt && onLoginAttempt(payload);
|
|
38
|
-
break;
|
|
39
|
-
case 'error':
|
|
40
|
-
// console.log(`case: error, onError: ${onError}`);
|
|
41
|
-
onError && onError(payload);
|
|
42
|
-
break;
|
|
43
|
-
default:
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
return (<SafeAreaView style={styles.container}>
|
|
47
|
-
{linkToken && <Pinwheel token={linkToken} style={{ flex: 1 }} onEvent={handleEvent}/>}
|
|
48
|
-
</SafeAreaView>);
|
|
49
|
-
};
|
package/dist/pinwheel-view.d.ts
DELETED
package/dist/pinwheel-view.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import React, { useEffect, useRef } from 'react';
|
|
2
|
-
import { UIManager, findNodeHandle, NativeEventEmitter, NativeModules } from 'react-native';
|
|
3
|
-
import { RNTPinwheel } from './pinwheel-view';
|
|
4
|
-
const createFragment = (viewId) => {
|
|
5
|
-
UIManager.dispatchViewManagerCommand(viewId,
|
|
6
|
-
// we are calling the 'create' command
|
|
7
|
-
// @ts-ignore
|
|
8
|
-
UIManager.RNTPinwheel.Commands.create.toString(), [viewId]);
|
|
9
|
-
};
|
|
10
|
-
const RNTPinwheelView = (props) => {
|
|
11
|
-
const ref = useRef(null);
|
|
12
|
-
const eventListenerRef = useRef(null);
|
|
13
|
-
useEffect(() => {
|
|
14
|
-
setTimeout(() => {
|
|
15
|
-
const viewId = findNodeHandle(ref.current);
|
|
16
|
-
if (viewId) {
|
|
17
|
-
createFragment(viewId);
|
|
18
|
-
}
|
|
19
|
-
// events
|
|
20
|
-
const { RNTPinwheelEvents } = NativeModules;
|
|
21
|
-
const eventEmitter = new NativeEventEmitter(RNTPinwheelEvents);
|
|
22
|
-
eventListenerRef.current = eventEmitter.addListener('PINWHEEL_EVENT', (event) => {
|
|
23
|
-
props.onEvent(event);
|
|
24
|
-
});
|
|
25
|
-
}, 10);
|
|
26
|
-
return () => {
|
|
27
|
-
var _a;
|
|
28
|
-
(_a = eventListenerRef.current) === null || _a === void 0 ? void 0 : _a.remove();
|
|
29
|
-
};
|
|
30
|
-
}, []);
|
|
31
|
-
return <RNTPinwheel {...props} ref={ref}/>;
|
|
32
|
-
};
|
|
33
|
-
export default RNTPinwheelView;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import React, { useEffect } from 'react';
|
|
2
|
-
import { NativeEventEmitter, NativeModules } from 'react-native';
|
|
3
|
-
import { RNTPinwheel } from './pinwheel-view';
|
|
4
|
-
const RNTPinwheelView = (props) => {
|
|
5
|
-
useEffect(() => {
|
|
6
|
-
const { RNTPinwheelEvents } = NativeModules;
|
|
7
|
-
const eventEmitter = new NativeEventEmitter(RNTPinwheelEvents);
|
|
8
|
-
const eventListener = eventEmitter.addListener('PINWHEEL_EVENT', (event) => {
|
|
9
|
-
props.onEvent(event);
|
|
10
|
-
});
|
|
11
|
-
return () => {
|
|
12
|
-
eventListener.remove();
|
|
13
|
-
};
|
|
14
|
-
}, []);
|
|
15
|
-
return <RNTPinwheel {...props}/>;
|
|
16
|
-
};
|
|
17
|
-
export default RNTPinwheelView;
|
package/ios/RNTPinwheelEvents.h
DELETED
package/ios/RNTPinwheelManager.m
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
#import <React/RCTViewManager.h>
|
|
2
|
-
#import "RNTPinwheelView.h"
|
|
3
|
-
|
|
4
|
-
@interface RNTPinwheelManager : RCTViewManager
|
|
5
|
-
|
|
6
|
-
@end
|
|
7
|
-
|
|
8
|
-
@implementation RNTPinwheelManager : RCTViewManager
|
|
9
|
-
|
|
10
|
-
RCT_EXPORT_MODULE(RNTPinwheelManager);
|
|
11
|
-
|
|
12
|
-
- (UIView *)view
|
|
13
|
-
{
|
|
14
|
-
RNTPinwheelView *pv = [[RNTPinwheelView alloc] init];
|
|
15
|
-
return pv;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
RCT_EXPORT_VIEW_PROPERTY(token, NSString);
|
|
19
|
-
|
|
20
|
-
@end
|
|
21
|
-
|
package/ios/RNTPinwheelView.h
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
#import <UIKit/UIKit.h>
|
|
2
|
-
#import <PinwheelSDK/PinwheelSDK-Swift.h>
|
|
3
|
-
#import "RNTPinwheelEvents.h"
|
|
4
|
-
|
|
5
|
-
@interface RNTPinwheelView : UIView <PinwheelWrapperDelegate>
|
|
6
|
-
|
|
7
|
-
@property (nonatomic, strong) PinwheelWrapperVC *pinwheelWrapperVC;
|
|
8
|
-
@property (nonatomic, assign) NSString *token;
|
|
9
|
-
|
|
10
|
-
- (instancetype)initWithFrame:(CGRect)frame token:(NSString *)token;
|
|
11
|
-
|
|
12
|
-
@end
|