@pinwheel/react-native-pinwheel 3.5.1 → 3.5.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.
@@ -32,7 +32,7 @@ repositories {
32
32
  google()
33
33
  }
34
34
 
35
- def PW_ANDROID_SDK_VERSION = '3.5.1'
35
+ def PW_ANDROID_SDK_VERSION = '3.5.2'
36
36
 
37
37
  dependencies {
38
38
  def pwVersion = rootProject.hasProperty('pwVersion') ? rootProject.pwVersion : PW_ANDROID_SDK_VERSION
@@ -89,7 +89,7 @@ class Pinwheel : FrameLayout {
89
89
  Handler(Looper.getMainLooper()).post {
90
90
  if (this.pinwheelFragment == null) {
91
91
  this.token?.let {
92
- val pinwheelFragment = PinwheelFragment.newInstanceWithAdvancedOptions(it, "react native", "3.5.1", getReactNativeVersion(), this.handleInsets, this.useDarkMode)
92
+ val pinwheelFragment = PinwheelFragment.newInstanceWithAdvancedOptions(it, "react native", "3.5.3", getReactNativeVersion(), this.handleInsets, this.useDarkMode)
93
93
  pinwheelEventListener?.let { listener ->
94
94
  pinwheelFragment.pinwheelEventListener = listener
95
95
  }
@@ -7,8 +7,8 @@
7
7
  #import <react/renderer/components/RTNPinwheelSpec/Props.h>
8
8
  #import <react/renderer/components/RTNPinwheelSpec/RCTComponentViewHelpers.h>
9
9
 
10
- #import "RTNPinwheelEvents.h"
11
10
  #import "RCTFabricComponentsPlugins.h"
11
+ #import "RTNPinwheelEvents.h"
12
12
 
13
13
  using namespace facebook::react;
14
14
 
@@ -17,186 +17,302 @@ using namespace facebook::react;
17
17
 
18
18
  @implementation RTNPinwheelView
19
19
 
20
- + (ComponentDescriptorProvider)componentDescriptorProvider
21
- {
22
- return concreteComponentDescriptorProvider<RTNPinwheelComponentDescriptor>();
20
+ + (ComponentDescriptorProvider)componentDescriptorProvider {
21
+ return concreteComponentDescriptorProvider<RTNPinwheelComponentDescriptor>();
23
22
  }
24
23
 
25
24
  - (instancetype)initWithFrame:(CGRect)frame {
26
- if ((self = [super initWithFrame:frame])) {
27
- [self initPinwheelWrapperVC];
28
- }
29
- return self;
25
+ if ((self = [super initWithFrame:frame])) {
26
+ [self initPinwheelWrapperVC];
27
+ }
28
+ return self;
30
29
  }
31
30
 
32
31
  - (instancetype)initWithFrame:(CGRect)frame token:(NSString *)token {
33
- if ((self = [super initWithFrame:frame])) {
34
- _token = token;
35
- }
36
- return self;
32
+ if ((self = [super initWithFrame:frame])) {
33
+ _token = token;
34
+ }
35
+ return self;
37
36
  }
38
37
 
39
- - (void)initPinwheelWrapperVC {
40
- if (self.pinwheelWrapperVC != nil) {
41
- [self.pinwheelWrapperVC.view removeFromSuperview];
42
- self.pinwheelWrapperVC = nil;
43
- }
44
-
45
- if (self.token != nil) {
46
- self.pinwheelWrapperVC = [[PinwheelWrapperVC alloc] initWithToken:self.token delegate:self sdk:@"react native" version:@"3.5.1" useDarkMode:self.useDarkMode useAppBoundDomains:NO useAppBoundDomainsForNativeLink:NO];
47
- [self addSubview:self.pinwheelWrapperVC.view];
38
+ // Helper to find parent VC from a UIView
39
+ - (UIViewController *)getParentViewController {
40
+ UIResponder *responder = self.nextResponder;
41
+ while (responder) {
42
+ if ([responder isKindOfClass:[UIViewController class]]) {
43
+ return (UIViewController *)responder;
48
44
  }
45
+ responder = responder.nextResponder;
46
+ }
47
+ return nil;
49
48
  }
50
49
 
51
- - (void)setToken:(NSString *)newToken {
52
- if (![_token isEqualToString:newToken]) {
53
- _token = newToken;
54
- }
50
+ - (void)cleanUpPinwheelWrapperVC {
51
+ if (self.pinwheelWrapperVC != nil) {
52
+ [self.pinwheelWrapperVC willMoveToParentViewController:nil];
53
+ [self.pinwheelWrapperVC.view removeFromSuperview];
54
+ [self.pinwheelWrapperVC removeFromParentViewController];
55
+ self.pinwheelWrapperVC = nil;
56
+ }
55
57
  }
56
58
 
57
- - (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const &)oldProps
58
- {
59
- const auto &oldViewProps = *std::static_pointer_cast<RTNPinwheelProps const>(_props);
60
- const auto &newViewProps = *std::static_pointer_cast<RTNPinwheelProps const>(props);
59
+ - (void)initPinwheelWrapperVC {
60
+ [self cleanUpPinwheelWrapperVC];
61
+
62
+ if (self.token == nil) {
63
+ return;
64
+ }
65
+
66
+ UIViewController *parentVC = [self getParentViewController];
67
+ if (!parentVC) {
68
+ // Not yet attached to the hierarchy, skip for now and `didMoveToWindow`
69
+ // will retry later.
70
+ return;
71
+ }
72
+
73
+ self.pinwheelWrapperVC =
74
+ [[PinwheelWrapperVC alloc] initWithToken:self.token
75
+ delegate:self
76
+ sdk:@"react native"
77
+ version:@"3.5.3"
78
+ useDarkMode:self.useDarkMode
79
+ useAppBoundDomains:NO
80
+ useAppBoundDomainsForNativeLink:NO];
81
+
82
+ // Guard against double-attachment (shouldn’t happen after cleanup, but safe).
83
+ if (self.pinwheelWrapperVC.parentViewController == parentVC) {
84
+ self.pinwheelWrapperVC.view.frame = self.bounds;
85
+ return;
86
+ }
87
+
88
+ [parentVC addChildViewController:self.pinwheelWrapperVC];
89
+ [self addSubview:self.pinwheelWrapperVC.view];
90
+ self.pinwheelWrapperVC.view.frame = self.bounds;
91
+ [self.pinwheelWrapperVC didMoveToParentViewController:parentVC];
92
+ }
61
93
 
62
- if (oldViewProps.token != newViewProps.token) {
63
- NSString* convertedToken = [NSString stringWithUTF8String:newViewProps.token.c_str()];
64
- [self setToken:convertedToken];
94
+ - (void)didMoveToWindow {
95
+ [super didMoveToWindow];
96
+ if (self.window) {
97
+ if (!self.pinwheelWrapperVC) {
98
+ [self initPinwheelWrapperVC];
65
99
  }
100
+ }
101
+ }
66
102
 
67
- if (oldViewProps.useDarkMode != newViewProps.useDarkMode) {
68
- self.useDarkMode = newViewProps.useDarkMode;
69
- }
103
+ - (void)dealloc {
104
+ [self cleanUpPinwheelWrapperVC];
105
+ }
70
106
 
71
- // Ensures that the view is always re-initialized whenever the props change, or the React Native component is
72
- // re-mounted. On the new architecture, there are optimizations which causes the view to be re-used in these
73
- // scenarios, whereas the ideal functionality here is to have the Link modal reset to the starting state.
74
- [self initPinwheelWrapperVC];
107
+ - (void)setToken:(NSString *)newToken {
108
+ if (![_token isEqualToString:newToken]) {
109
+ _token = newToken;
110
+ }
111
+ }
75
112
 
76
- [super updateProps:props oldProps:oldProps];
113
+ - (void)updateProps:(Props::Shared const &)props
114
+ oldProps:(Props::Shared const &)oldProps {
115
+ const auto &oldViewProps =
116
+ *std::static_pointer_cast<RTNPinwheelProps const>(_props);
117
+ const auto &newViewProps =
118
+ *std::static_pointer_cast<RTNPinwheelProps const>(props);
119
+
120
+ if (oldViewProps.token != newViewProps.token) {
121
+ NSString *convertedToken =
122
+ [NSString stringWithUTF8String:newViewProps.token.c_str()];
123
+ [self setToken:convertedToken];
124
+ }
125
+
126
+ if (oldViewProps.useDarkMode != newViewProps.useDarkMode) {
127
+ self.useDarkMode = newViewProps.useDarkMode;
128
+ }
129
+
130
+ // Ensures that the view is always re-initialized whenever the props change,
131
+ // or the React Native component is re-mounted. On the new architecture, there
132
+ // are optimizations which causes the view to be re-used in these scenarios,
133
+ // whereas the ideal functionality here is to have the Link modal reset to the
134
+ // starting state.
135
+ [self initPinwheelWrapperVC];
136
+
137
+ [super updateProps:props oldProps:oldProps];
77
138
  }
78
139
 
79
- - (void)layoutSubviews
80
- {
81
- [super layoutSubviews];
82
- if (self.pinwheelWrapperVC != nil) {
83
- self.pinwheelWrapperVC.view.frame = self.bounds;
84
- }
140
+ - (void)layoutSubviews {
141
+ [super layoutSubviews];
142
+ if (self.pinwheelWrapperVC != nil) {
143
+ self.pinwheelWrapperVC.view.frame = self.bounds;
144
+ }
85
145
  }
86
146
 
87
- - (void)onEventWithName:(NSString *)name event:(NSDictionary<NSString *, id> *)event {
88
- NSLog(@"%@", name);
89
- NSDictionary *dataToSend = @{@"name": name, @"payload": event};
90
- [RTNPinwheelEvents.sharedInstance handlePinwheelEvent:dataToSend];
147
+ - (void)onEventWithName:(NSString *)name
148
+ event:(NSDictionary<NSString *, id> *)event {
149
+ NSLog(@"%@", name);
150
+ NSDictionary *dataToSend = @{@"name" : name, @"payload" : event};
151
+ [RTNPinwheelEvents.sharedInstance handlePinwheelEvent:dataToSend];
91
152
  }
92
153
 
93
154
  - (void)onExit:(NSDictionary<NSString *, id> *)error {
94
- NSLog(@"%@", error);
155
+ NSLog(@"%@", error);
95
156
  }
96
157
 
97
158
  - (void)onSuccess:(NSDictionary<NSString *, id> *)result {
98
- NSLog(@"%@", result);
159
+ NSLog(@"%@", result);
99
160
  }
100
161
 
101
162
  - (void)onLogin:(NSDictionary<NSString *, id> *)result {
102
- NSLog(@"%@", result);
163
+ NSLog(@"%@", result);
103
164
  }
104
165
 
105
166
  - (void)onLoginAttempt:(NSDictionary<NSString *, id> *)result {
106
- NSLog(@"%@", result);
167
+ NSLog(@"%@", result);
107
168
  }
108
169
 
109
170
  - (void)onError:(NSDictionary<NSString *, id> *)error {
110
- NSLog(@"%@", error);
171
+ NSLog(@"%@", error);
111
172
  }
112
173
 
113
174
  @end
114
175
 
115
- Class<RCTComponentViewProtocol> RTNPinwheelCls(void)
116
- {
176
+ Class<RCTComponentViewProtocol> RTNPinwheelCls(void) {
117
177
  return RTNPinwheelView.class;
118
178
  }
119
179
 
120
180
  #else
121
181
 
122
- #import "RTNPinwheelView.h"
123
182
  #import "RTNPinwheelEvents.h"
183
+ #import "RTNPinwheelView.h"
124
184
 
125
185
  @implementation RTNPinwheelView
126
186
 
127
187
  - (instancetype)initWithFrame:(CGRect)frame {
128
- if ((self = [super initWithFrame:frame])) {
129
- [self initPinwheelWrapperVC];
130
- }
131
- return self;
188
+ if ((self = [super initWithFrame:frame])) {
189
+ [self initPinwheelWrapperVC];
190
+ }
191
+ return self;
132
192
  }
133
193
 
134
194
  - (instancetype)initWithFrame:(CGRect)frame token:(NSString *)token {
135
- if ((self = [super initWithFrame:frame])) {
136
- _token = token;
195
+ if ((self = [super initWithFrame:frame])) {
196
+ _token = token;
197
+ }
198
+ return self;
199
+ }
200
+
201
+ // Helper to find parent VC from a UIView
202
+ - (UIViewController *)getParentViewController {
203
+ UIResponder *responder = self.nextResponder;
204
+ while (responder) {
205
+ if ([responder isKindOfClass:[UIViewController class]]) {
206
+ return (UIViewController *)responder;
137
207
  }
138
- return self;
208
+ responder = responder.nextResponder;
209
+ }
210
+ return nil;
211
+ }
212
+
213
+ - (void)cleanUpPinwheelWrapperVC {
214
+ if (self.pinwheelWrapperVC != nil) {
215
+ [self.pinwheelWrapperVC willMoveToParentViewController:nil];
216
+ [self.pinwheelWrapperVC.view removeFromSuperview];
217
+ [self.pinwheelWrapperVC removeFromParentViewController];
218
+ self.pinwheelWrapperVC = nil;
219
+ }
139
220
  }
140
221
 
141
222
  - (void)initPinwheelWrapperVC {
142
- if (self.pinwheelWrapperVC != nil) {
143
- [self.pinwheelWrapperVC.view removeFromSuperview];
144
- self.pinwheelWrapperVC = nil;
145
- }
223
+ [self cleanUpPinwheelWrapperVC];
224
+
225
+ if (self.token == nil) {
226
+ return;
227
+ }
228
+
229
+ UIViewController *parentVC = [self getParentViewController];
230
+ if (!parentVC) {
231
+ // Not yet attached to the hierarchy, skip for now and `didMoveToWindow`
232
+ // will retry later.
233
+ return;
234
+ }
235
+
236
+ self.pinwheelWrapperVC =
237
+ [[PinwheelWrapperVC alloc] initWithToken:self.token
238
+ delegate:self
239
+ sdk:@"react native"
240
+ version:@"3.5.3"
241
+ useDarkMode:self.useDarkMode
242
+ useAppBoundDomains:NO
243
+ useAppBoundDomainsForNativeLink:NO];
244
+
245
+ // Guard against double-attachment (shouldn’t happen after cleanup, but safe).
246
+ if (self.pinwheelWrapperVC.parentViewController == parentVC) {
247
+ self.pinwheelWrapperVC.view.frame = self.bounds;
248
+ return;
249
+ }
250
+
251
+ [parentVC addChildViewController:self.pinwheelWrapperVC];
252
+ [self addSubview:self.pinwheelWrapperVC.view];
253
+ self.pinwheelWrapperVC.view.frame = self.bounds;
254
+ [self.pinwheelWrapperVC didMoveToParentViewController:parentVC];
255
+ }
146
256
 
147
- if (self.token != nil) {
148
- self.pinwheelWrapperVC = [[PinwheelWrapperVC alloc] initWithToken:self.token delegate:self sdk:@"react native" version:@"3.5.1" useDarkMode:self.useDarkMode useAppBoundDomains:NO useAppBoundDomainsForNativeLink:NO];
149
- [self addSubview:self.pinwheelWrapperVC.view];
257
+ - (void)didMoveToWindow {
258
+ [super didMoveToWindow];
259
+ if (self.window) {
260
+ if (!self.pinwheelWrapperVC) {
261
+ [self initPinwheelWrapperVC];
150
262
  }
263
+ }
264
+ }
265
+
266
+ - (void)dealloc {
267
+ [self cleanUpPinwheelWrapperVC];
151
268
  }
152
269
 
153
270
  - (void)setToken:(NSString *)newToken {
154
- if (![_token isEqualToString:newToken]) {
155
- _token = newToken;
156
- [self initPinwheelWrapperVC];
157
- }
271
+ if (![_token isEqualToString:newToken]) {
272
+ _token = newToken;
273
+ [self initPinwheelWrapperVC];
274
+ }
158
275
  }
159
276
 
160
277
  - (void)setUseDarkMode:(BOOL)newUseDarkMode {
161
- if (_useDarkMode != newUseDarkMode) {
162
- _useDarkMode = newUseDarkMode;
163
- [self initPinwheelWrapperVC];
164
- }
278
+ if (_useDarkMode != newUseDarkMode) {
279
+ _useDarkMode = newUseDarkMode;
280
+ [self initPinwheelWrapperVC];
281
+ }
165
282
  }
166
283
 
167
- - (void)layoutSubviews
168
- {
284
+ - (void)layoutSubviews {
169
285
  [super layoutSubviews];
170
286
  self.pinwheelWrapperVC.view.frame = self.bounds;
171
287
  }
172
288
 
173
- - (void)onEventWithName:(NSString *)name event:(NSDictionary<NSString *, id> *)event {
174
- NSLog(@"%@", name);
175
- NSDictionary *dataToSend = @{@"name": name, @"payload": event};
176
- [RTNPinwheelEvents.sharedInstance handlePinwheelEvent:dataToSend];
289
+ - (void)onEventWithName:(NSString *)name
290
+ event:(NSDictionary<NSString *, id> *)event {
291
+ NSLog(@"%@", name);
292
+ NSDictionary *dataToSend = @{@"name" : name, @"payload" : event};
293
+ [RTNPinwheelEvents.sharedInstance handlePinwheelEvent:dataToSend];
177
294
  }
178
295
 
179
296
  - (void)onExit:(NSDictionary<NSString *, id> *)error {
180
- NSLog(@"%@", error);
297
+ NSLog(@"%@", error);
181
298
  }
182
299
 
183
300
  - (void)onSuccess:(NSDictionary<NSString *, id> *)result {
184
- NSLog(@"%@", result);
301
+ NSLog(@"%@", result);
185
302
  }
186
303
 
187
304
  - (void)onLogin:(NSDictionary<NSString *, id> *)result {
188
- NSLog(@"%@", result);
305
+ NSLog(@"%@", result);
189
306
  }
190
307
 
191
308
  - (void)onLoginAttempt:(NSDictionary<NSString *, id> *)result {
192
- NSLog(@"%@", result);
309
+ NSLog(@"%@", result);
193
310
  }
194
311
 
195
312
  - (void)onError:(NSDictionary<NSString *, id> *)error {
196
- NSLog(@"%@", error);
313
+ NSLog(@"%@", error);
197
314
  }
198
315
 
199
316
  @end
200
317
 
201
-
202
318
  #endif
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pinwheel/react-native-pinwheel",
3
- "version": "3.5.1",
3
+ "version": "3.5.3",
4
4
  "type": "module",
5
5
  "main": "src/index.ts",
6
6
  "types": "src/index.ts",
@@ -1,80 +1,67 @@
1
1
  import type { AdditionsType, ModificationsType, RemovalsType } from '../utils';
2
- export type PinwheelErrorType =
3
- | 'sandboxError'
4
- | 'clientError'
5
- | 'systemError'
6
- | 'userActionRequired'
7
- | 'platformError'
8
- | 'invalidAccountsConfiguration'
9
- | 'invalidUserInput'
10
- | 'invalidLinkToken'
11
- | 'networkError';
2
+ export type PinwheelErrorType = 'sandboxError' | 'clientError' | 'systemError' | 'userActionRequired' | 'platformError' | 'invalidAccountsConfiguration' | 'invalidUserInput' | 'invalidLinkToken' | 'networkError';
12
3
  export type LinkApiJob = 'login' | 'direct_deposit_switch' | 'card_switch';
13
4
  export type OpenEventPayload = {};
14
5
  export type SelectEmployerEventPayload = {
15
- selectedEmployerId: string;
16
- selectedEmployerName: string;
6
+ selectedEmployerId: string;
7
+ selectedEmployerName: string;
17
8
  };
18
9
  export type SelectPlatformEventPayload = {
19
- selectedPlatformId: string;
20
- selectedPlatformName: string;
10
+ selectedPlatformId: string;
11
+ selectedPlatformName: string;
21
12
  };
22
13
  export type IncorrectPlatformGivenEventPayload = {};
23
14
  export type LoginAttemptEventPayload = {
24
- platformId: string;
15
+ platformId: string;
25
16
  };
26
17
  export type LoginEventPayload = {
27
- accountId: string;
28
- platformId: string;
18
+ accountId: string;
19
+ platformId: string;
29
20
  };
30
21
  export type InputAmountEventPayload = {
31
- value: number;
32
- unit: '$' | '%';
22
+ value: number;
23
+ unit: '$' | '%';
33
24
  };
34
25
  type _PartialSwitch<T> = {
35
- action: 'partial_switch';
36
- allocation: T;
26
+ action: 'partial_switch';
27
+ allocation: T;
37
28
  };
38
29
  type InputAllocationPercentage = _PartialSwitch<{
39
- type: 'percentage';
40
- value: number;
30
+ type: 'percentage';
31
+ value: number;
41
32
  }>;
42
33
  type InputAllocationAmount = _PartialSwitch<{
43
- type: 'amount';
44
- value: number;
34
+ type: 'amount';
35
+ value: number;
45
36
  }>;
46
37
  type InputAllocationRemainder = _PartialSwitch<{
47
- type: 'remainder';
38
+ type: 'remainder';
48
39
  }>;
49
- export type InputAllocationEventPayload =
50
- | {
51
- action: 'full_switch';
52
- }
53
- | InputAllocationRemainder
54
- | InputAllocationAmount
55
- | InputAllocationPercentage;
40
+ export type InputAllocationEventPayload = {
41
+ action: 'full_switch';
42
+ } | InputAllocationRemainder | InputAllocationAmount | InputAllocationPercentage;
56
43
  /**
57
44
  * @deprecated - Use `InputAllocationEventPayload` instead.
58
45
  */
59
46
  export type InputAllocation = InputAllocationEventPayload;
60
47
  export type CardSwitchBeginEventPayload = {};
61
48
  export type DocUploadsBeginEventPayload = {
62
- uploadedDocumentsSubmittedCount?: number;
49
+ uploadedDocumentsSubmittedCount?: number;
63
50
  };
64
51
  export type DocUploadsSubmittedEventPayload = {
65
- uploadedDocumentSubmittedCount: number;
52
+ uploadedDocumentSubmittedCount: number;
66
53
  };
67
54
  export type DdFormBeginEventPayload = {};
68
55
  export type DdFormCreateEventPayload = {
69
- url: string;
56
+ url: string;
70
57
  };
71
58
  export type DdFormDownloadEventPayload = {};
72
59
  export type ScreenTransitionEventPayload = {
73
- screenName: string;
74
- selectedEmployerId?: string;
75
- selectedEmployerName?: string;
76
- selectedPlatformId?: string;
77
- selectedPlatformName?: string;
60
+ screenName: string;
61
+ selectedEmployerId?: string;
62
+ selectedEmployerName?: string;
63
+ selectedPlatformId?: string;
64
+ selectedPlatformName?: string;
78
65
  };
79
66
  /**
80
67
  * @deprecated - Use `ScreenTransitionEventPayload` instead.
@@ -82,80 +69,74 @@ export type ScreenTransitionEventPayload = {
82
69
  export type ScreenTransition = ScreenTransitionEventPayload;
83
70
  export type ExitEventPayload = Record<string, never>;
84
71
  export type SuccessEventPayload = {
85
- accountId: string;
86
- platformId: string;
87
- job: LinkApiJob;
88
- params?: {
89
- amount?: {
90
- value: number;
91
- unit: '%' | '$';
72
+ accountId: string;
73
+ platformId: string;
74
+ job: LinkApiJob;
75
+ params?: {
76
+ amount?: {
77
+ value: number;
78
+ unit: '%' | '$';
79
+ };
92
80
  };
93
- };
94
81
  };
95
82
  export type ErrorEventPayload = {
96
- type: PinwheelErrorType;
97
- code: string;
98
- message: string;
99
- pendingRetry: boolean;
83
+ type: PinwheelErrorType;
84
+ code: string;
85
+ message: string;
86
+ pendingRetry: boolean;
100
87
  };
101
88
  export type OtherEventPayload = {
102
- name: string;
103
- payload: {
104
- key: string;
105
- value: string;
106
- type: 'string' | 'boolean' | 'number';
107
- }[];
89
+ name: string;
90
+ payload: {
91
+ key: string;
92
+ value: string;
93
+ type: 'string' | 'boolean' | 'number';
94
+ }[];
108
95
  };
109
96
  export type BillSwitchPayload = {
110
- platformId: string;
111
- platformName: string;
112
- isGuidedSwitch: boolean;
113
- frequency: string;
114
- nextPaymentDate: string;
115
- amountCents: number;
97
+ platformId: string;
98
+ platformName: string;
99
+ isGuidedSwitch: boolean;
100
+ isIntegratedSwitch: boolean;
101
+ frequency: string;
102
+ nextPaymentDate: string;
103
+ amountCents: number;
116
104
  };
117
105
  export type ExternalAccountConnectedPayload = {
118
- institutionName: string;
119
- accountName: string;
106
+ institutionName: string;
107
+ accountName: string;
120
108
  };
121
109
  /**
122
110
  * @deprecated - Use `ErrorEventPayload` instead.
123
111
  */
124
112
  export type PinwheelError = ErrorEventPayload;
125
113
  type EventPayloadAdditions = {
126
- open: OpenEventPayload;
127
- select_employer: SelectEmployerEventPayload;
128
- select_platform: SelectPlatformEventPayload;
129
- incorrect_platform_given: IncorrectPlatformGivenEventPayload;
130
- login_attempt: LoginAttemptEventPayload;
131
- login: LoginEventPayload;
132
- input_amount: InputAmountEventPayload;
133
- input_allocation: InputAllocationEventPayload;
134
- card_switch_begin: CardSwitchBeginEventPayload;
135
- doc_uploads_begin: DocUploadsBeginEventPayload;
136
- doc_uploads_submitted: DocUploadsSubmittedEventPayload;
137
- dd_form_begin: DdFormBeginEventPayload;
138
- dd_form_create: DdFormCreateEventPayload;
139
- dd_form_download: DdFormDownloadEventPayload;
140
- screen_transition: ScreenTransitionEventPayload;
141
- exit: ErrorEventPayload | ExitEventPayload;
142
- other_event: OtherEventPayload;
143
- success: SuccessEventPayload;
144
- error: ErrorEventPayload;
145
- bill_switch_success: BillSwitchPayload;
146
- bill_removed: BillSwitchPayload;
147
- external_account_connected: ExternalAccountConnectedPayload;
148
- merchant_login_success: LoginEventPayload;
114
+ open: OpenEventPayload;
115
+ select_employer: SelectEmployerEventPayload;
116
+ select_platform: SelectPlatformEventPayload;
117
+ incorrect_platform_given: IncorrectPlatformGivenEventPayload;
118
+ login_attempt: LoginAttemptEventPayload;
119
+ login: LoginEventPayload;
120
+ input_amount: InputAmountEventPayload;
121
+ input_allocation: InputAllocationEventPayload;
122
+ card_switch_begin: CardSwitchBeginEventPayload;
123
+ doc_uploads_begin: DocUploadsBeginEventPayload;
124
+ doc_uploads_submitted: DocUploadsSubmittedEventPayload;
125
+ dd_form_begin: DdFormBeginEventPayload;
126
+ dd_form_create: DdFormCreateEventPayload;
127
+ dd_form_download: DdFormDownloadEventPayload;
128
+ screen_transition: ScreenTransitionEventPayload;
129
+ exit: ErrorEventPayload | ExitEventPayload;
130
+ other_event: OtherEventPayload;
131
+ success: SuccessEventPayload;
132
+ error: ErrorEventPayload;
133
+ bill_switch_success: BillSwitchPayload;
134
+ bill_removed: BillSwitchPayload;
135
+ external_account_connected: ExternalAccountConnectedPayload;
136
+ merchant_login_success: LoginEventPayload;
149
137
  };
150
138
  type EventPayloadModifications = {};
151
139
  type EventPayloadRemovals = [];
152
- export type EventPayloadMap = Omit<
153
- AdditionsType<EventPayloadAdditions> &
154
- ModificationsType<EventPayloadModifications>,
155
- keyof RemovalsType<EventPayloadRemovals>
156
- >;
157
- export type EventHandler = <T extends keyof EventPayloadMap>(
158
- eventName: T,
159
- payload: EventPayloadMap[T]
160
- ) => void;
140
+ export type EventPayloadMap = Omit<AdditionsType<EventPayloadAdditions> & ModificationsType<EventPayloadModifications>, keyof RemovalsType<EventPayloadRemovals>>;
141
+ export type EventHandler = <T extends keyof EventPayloadMap>(eventName: T, payload: EventPayloadMap[T]) => void;
161
142
  export {};
@@ -126,7 +126,8 @@ export type OtherEventPayload = {
126
126
  export type BillSwitchPayload = {
127
127
  platformId: string;
128
128
  platformName: string;
129
- isGuidedSwitch: boolean;
129
+ isGuidedSwitch: boolean; // deprecated: will be removed in future version
130
+ isIntegratedSwitch: boolean;
130
131
  frequency: string;
131
132
  nextPaymentDate: string;
132
133
  amountCents: number;