@pinwheel/react-native-pinwheel 3.0.5 → 3.2.0-rc.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.
Files changed (62) hide show
  1. package/PinwheelLinkSDKObjC/ObjCWrapper.xcframework/Info.plist +44 -0
  2. package/PinwheelLinkSDKObjC/ObjCWrapper.xcframework/ios-arm64/ObjCWrapper.framework/Headers/ObjCWrapper.h +18 -0
  3. package/PinwheelLinkSDKObjC/ObjCWrapper.xcframework/ios-arm64/ObjCWrapper.framework/Headers/PinwheelVCWrapper.h +14 -0
  4. package/PinwheelLinkSDKObjC/ObjCWrapper.xcframework/ios-arm64/ObjCWrapper.framework/Info.plist +0 -0
  5. package/PinwheelLinkSDKObjC/ObjCWrapper.xcframework/ios-arm64/ObjCWrapper.framework/Modules/module.modulemap +6 -0
  6. package/PinwheelLinkSDKObjC/ObjCWrapper.xcframework/ios-arm64/ObjCWrapper.framework/ObjCWrapper +0 -0
  7. package/PinwheelLinkSDKObjC/ObjCWrapper.xcframework/ios-arm64/ObjCWrapper.framework/README.md +15 -0
  8. package/PinwheelLinkSDKObjC/ObjCWrapper.xcframework/ios-arm64/ObjCWrapper.framework/_CodeSignature/CodeResources +146 -0
  9. package/PinwheelLinkSDKObjC/ObjCWrapper.xcframework/ios-arm64_x86_64-simulator/ObjCWrapper.framework/Headers/ObjCWrapper.h +18 -0
  10. package/PinwheelLinkSDKObjC/ObjCWrapper.xcframework/ios-arm64_x86_64-simulator/ObjCWrapper.framework/Headers/PinwheelVCWrapper.h +14 -0
  11. package/PinwheelLinkSDKObjC/ObjCWrapper.xcframework/ios-arm64_x86_64-simulator/ObjCWrapper.framework/Info.plist +0 -0
  12. package/PinwheelLinkSDKObjC/ObjCWrapper.xcframework/ios-arm64_x86_64-simulator/ObjCWrapper.framework/Modules/module.modulemap +6 -0
  13. package/PinwheelLinkSDKObjC/ObjCWrapper.xcframework/ios-arm64_x86_64-simulator/ObjCWrapper.framework/ObjCWrapper +0 -0
  14. package/PinwheelLinkSDKObjC/ObjCWrapper.xcframework/ios-arm64_x86_64-simulator/ObjCWrapper.framework/README.md +15 -0
  15. package/PinwheelLinkSDKObjC/ObjCWrapper.xcframework/ios-arm64_x86_64-simulator/ObjCWrapper.framework/_CodeSignature/CodeResources +146 -0
  16. package/RNPinwheelSDK.podspec +21 -17
  17. package/android/build.gradle +26 -35
  18. package/android/src/main/java/com/rtnpinwheel/Pinwheel.kt +103 -0
  19. package/android/src/main/java/com/{underdog_tech/react/PinwheelViewManager.kt → rtnpinwheel/PinwheelEventsModule.kt} +55 -120
  20. package/android/src/main/java/com/rtnpinwheel/PinwheelManager.kt +54 -0
  21. package/android/src/main/java/com/{underdog_tech/react → rtnpinwheel}/PinwheelPackage.kt +7 -9
  22. package/ios/RTNPinwheelEvents.h +13 -0
  23. package/ios/{RNTPinwheelEvents.m → RTNPinwheelEvents.mm} +15 -3
  24. package/ios/RTNPinwheelManager.mm +21 -0
  25. package/ios/RTNPinwheelView.h +17 -0
  26. package/ios/RTNPinwheelView.mm +102 -0
  27. package/package.json +32 -9
  28. package/src/NativePinwheelEvents.ts +62 -0
  29. package/src/Pinwheel.tsx +80 -0
  30. package/src/PinwheelEvents.ts +23 -0
  31. package/src/RTNPinwheelNativeComponent.ts +15 -0
  32. package/src/client-events/client.ts +17 -0
  33. package/src/client-events/registry/v2.3.ts +166 -0
  34. package/src/client-events/registry/v3.ts +47 -0
  35. package/src/client-events/utils.ts +12 -0
  36. package/src/index.ts +3 -0
  37. package/.vscode/settings.json +0 -4
  38. package/CHANGELOG.md +0 -152
  39. package/android/src/main/AndroidManifest.xml +0 -6
  40. package/android/src/main/java/com/underdog_tech/react/RNTPinwheelEvents.kt +0 -51
  41. package/dist/client-events/client.d.ts +0 -10
  42. package/dist/client-events/client.js +0 -1
  43. package/dist/client-events/registry/v2.3.d.ts +0 -125
  44. package/dist/client-events/registry/v2.3.js +0 -1
  45. package/dist/client-events/registry/v3.d.ts +0 -25
  46. package/dist/client-events/registry/v3.js +0 -4
  47. package/dist/client-events/utils.d.ts +0 -9
  48. package/dist/client-events/utils.js +0 -1
  49. package/dist/constants.d.ts +0 -4
  50. package/dist/constants.js +0 -4
  51. package/dist/index.d.ts +0 -5
  52. package/dist/index.js +0 -49
  53. package/dist/pinwheel-view.d.ts +0 -6
  54. package/dist/pinwheel-view.js +0 -2
  55. package/dist/pinwheel-wrapper.android.d.ts +0 -4
  56. package/dist/pinwheel-wrapper.android.js +0 -33
  57. package/dist/pinwheel-wrapper.ios.d.ts +0 -4
  58. package/dist/pinwheel-wrapper.ios.js +0 -17
  59. package/ios/RNTPinwheelEvents.h +0 -9
  60. package/ios/RNTPinwheelManager.m +0 -21
  61. package/ios/RNTPinwheelView.h +0 -12
  62. package/ios/RNTPinwheelView.m +0 -65
@@ -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
- screen_name: 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,4 +0,0 @@
1
- /*
2
- * Export all the types from V3 and we override whatever changes
3
- */
4
- export * from './v2.3';
@@ -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 {};
@@ -1,4 +0,0 @@
1
- /**
2
- * Importing package.json here causes a problem with the folder structure when we npm pack and publish.
3
- */
4
- export declare const VERSION = "3.0.5";
package/dist/constants.js DELETED
@@ -1,4 +0,0 @@
1
- /**
2
- * Importing package.json here causes a problem with the folder structure when we npm pack and publish.
3
- */
4
- export const VERSION = '3.0.5';
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
- };
@@ -1,6 +0,0 @@
1
- export interface RNTPinwheelProps {
2
- token: string;
3
- style: any;
4
- onEvent: (event: any) => void;
5
- }
6
- export declare const RNTPinwheel: import("react-native").HostComponent<RNTPinwheelProps>;
@@ -1,2 +0,0 @@
1
- import { requireNativeComponent } from 'react-native';
2
- export const RNTPinwheel = requireNativeComponent('RNTPinwheel');
@@ -1,4 +0,0 @@
1
- import React from 'react';
2
- import { RNTPinwheelProps } from './pinwheel-view';
3
- declare const RNTPinwheelView: (props: RNTPinwheelProps) => React.JSX.Element;
4
- export default RNTPinwheelView;
@@ -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,4 +0,0 @@
1
- import React from 'react';
2
- import { RNTPinwheelProps } from './pinwheel-view';
3
- declare const RNTPinwheelView: (props: RNTPinwheelProps) => React.JSX.Element;
4
- 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;
@@ -1,9 +0,0 @@
1
- #import <React/RCTBridgeModule.h>
2
- #import <React/RCTEventEmitter.h>
3
-
4
- @interface RNTPinwheelEvents : RCTEventEmitter <RCTBridgeModule>
5
-
6
- + (instancetype)sharedInstance;
7
- - (void)handlePinwheelEvent:(NSDictionary<NSString *, id> *)payload;
8
-
9
- @end
@@ -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
-
@@ -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
@@ -1,65 +0,0 @@
1
- #import "RNTPinwheelView.h"
2
-
3
- @implementation RNTPinwheelView
4
-
5
- - (instancetype)initWithFrame:(CGRect)frame {
6
- if ((self = [super initWithFrame:frame])) {
7
- [self initPinwheelWrapperVC];
8
- }
9
- return self;
10
- }
11
-
12
- - (instancetype)initWithFrame:(CGRect)frame token:(NSString *)token {
13
- if ((self = [super initWithFrame:frame])) {
14
- _token = token;
15
- }
16
- return self;
17
- }
18
-
19
- - (void)initPinwheelWrapperVC {
20
- if (self.token != nil && self.pinwheelWrapperVC == nil) {
21
- self.pinwheelWrapperVC = [[PinwheelWrapperVC alloc] initWithToken:self.token delegate:self sdk:@"react native" version: @"3.0.5"];
22
- [self addSubview:self.pinwheelWrapperVC.view];
23
- }
24
- }
25
-
26
- - (void)setToken:(NSString *)newToken {
27
- if (![_token isEqualToString:newToken]) {
28
- _token = newToken;
29
- [self initPinwheelWrapperVC];
30
- }
31
- }
32
-
33
- - (void)layoutSubviews
34
- {
35
- [super layoutSubviews];
36
- self.pinwheelWrapperVC.view.frame = self.bounds;
37
- }
38
-
39
- - (void)onEventWithName:(NSString *)name event:(NSDictionary<NSString *, id> *)event {
40
- NSLog(@"%@", name);
41
- NSDictionary *dataToSend = @{@"name": name, @"payload": event};
42
- [RNTPinwheelEvents.sharedInstance handlePinwheelEvent:dataToSend];
43
- }
44
-
45
- - (void)onExit:(NSDictionary<NSString *, id> *)error {
46
- NSLog(@"%@", error);
47
- }
48
-
49
- - (void)onSuccess:(NSDictionary<NSString *, id> *)result {
50
- NSLog(@"%@", result);
51
- }
52
-
53
- - (void)onLogin:(NSDictionary<NSString *, id> *)result {
54
- NSLog(@"%@", result);
55
- }
56
-
57
- - (void)onLoginAttempt:(NSDictionary<NSString *, id> *)result {
58
- NSLog(@"%@", result);
59
- }
60
-
61
- - (void)onError:(NSDictionary<NSString *, id> *)error {
62
- NSLog(@"%@", error);
63
- }
64
-
65
- @end