@zeniai/client-epic-state 4.10.46 → 4.10.47

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 (67) hide show
  1. package/lib/entity/paymentAccount/paymentAccountSelector.d.ts +0 -1
  2. package/lib/entity/paymentAccount/paymentAccountSelector.js +1 -5
  3. package/lib/entity/tenant/clearAllEpic.d.ts +2 -1
  4. package/lib/entity/tenant/clearAllEpic.js +2 -0
  5. package/lib/epic.d.ts +6 -6
  6. package/lib/epic.js +6 -6
  7. package/lib/index.d.ts +6 -3
  8. package/lib/index.js +18 -15
  9. package/lib/reducer.d.ts +3 -0
  10. package/lib/reducer.js +3 -0
  11. package/lib/view/onboardingView/customerView/epic/plaidConnection/getOnboardingPlaidLinkTokenEpic.js +1 -1
  12. package/lib/view/onboardingView/customerView/onboardingCustomerViewReducer.d.ts +2 -2
  13. package/lib/view/onboardingView/customerView/onboardingCustomerViewSelector.d.ts +2 -1
  14. package/lib/view/onboardingView/customerView/onboardingCustomerViewState.d.ts +2 -1
  15. package/lib/view/settingsView/epic/fetchBankConnectionsViewEpic.d.ts +1 -1
  16. package/lib/view/settingsView/epic/fetchBankConnectionsViewEpic.js +2 -2
  17. package/lib/view/settingsView/settingsViewSelector.js +3 -3
  18. package/lib/view/spendManagement/billPay/billPayReview/billPayReviewSelector.js +3 -2
  19. package/lib/view/spendManagement/billPay/billPaySetupView/billPaySetupViewSelector.js +1 -1
  20. package/lib/view/spendManagement/billPay/billPaySetupView/epic/billPaySetup/fetchBillPaySetupViewEpic.d.ts +3 -2
  21. package/lib/view/spendManagement/billPay/billPaySetupView/epic/billPaySetup/fetchBillPaySetupViewEpic.js +5 -4
  22. package/lib/view/spendManagement/billPay/editBillView/editBillViewSelector.js +3 -2
  23. package/lib/view/spendManagement/billPay/editBillView/epics/fetchEditBillDetailPageEpic.d.ts +1 -1
  24. package/lib/view/spendManagement/billPay/editBillView/epics/fetchEditBillDetailPageEpic.js +5 -5
  25. package/lib/view/spendManagement/billPay/editBillView/epics/initializeBillToLocalStoreEpic.d.ts +1 -1
  26. package/lib/view/spendManagement/chargeCards/chargeCardSetUp/chargeCardSetUpViewSelector.js +1 -1
  27. package/lib/view/spendManagement/chargeCards/chargeCardSetUp/epic/fetchChargeCardSetupViewEpic.d.ts +3 -2
  28. package/lib/view/spendManagement/chargeCards/chargeCardSetUp/epic/fetchChargeCardSetupViewEpic.js +5 -4
  29. package/lib/view/spendManagement/commonSetup/setupViewPayload.d.ts +1 -1
  30. package/lib/view/spendManagement/commonSetup/setupViewReducer.d.ts +3 -59
  31. package/lib/view/spendManagement/commonSetup/setupViewReducer.js +2 -334
  32. package/lib/view/spendManagement/commonSetup/setupViewSelector.d.ts +3 -2
  33. package/lib/view/spendManagement/commonSetup/setupViewSelector.js +12 -6
  34. package/lib/view/spendManagement/commonSetup/setupViewState.d.ts +0 -14
  35. package/lib/view/spendManagement/{commonSetup → plaidAccount}/epic/paymentAccounts/getPaymentAccountsEpic.d.ts +1 -1
  36. package/lib/view/spendManagement/{commonSetup → plaidAccount}/epic/paymentAccounts/getPaymentAccountsEpic.js +6 -6
  37. package/lib/view/spendManagement/{commonSetup → plaidAccount}/epic/paymentAccounts/updatePaymentAccountEpic.d.ts +1 -1
  38. package/lib/view/spendManagement/{commonSetup → plaidAccount}/epic/paymentAccounts/updatePaymentAccountEpic.js +6 -6
  39. package/lib/view/spendManagement/{commonSetup → plaidAccount}/epic/paymentAccounts/updatePaymentAccountLoginStatusEpic.d.ts +1 -1
  40. package/lib/view/spendManagement/{commonSetup → plaidAccount}/epic/paymentAccounts/updatePaymentAccountLoginStatusEpic.js +7 -7
  41. package/lib/view/spendManagement/{commonSetup → plaidAccount}/epic/paymentAccounts/updatePaymentAccountStatusEpic.d.ts +1 -1
  42. package/lib/view/spendManagement/{commonSetup → plaidAccount}/epic/paymentAccounts/updatePaymentAccountStatusEpic.js +7 -7
  43. package/lib/view/spendManagement/{commonSetup → plaidAccount}/epic/plaidConnection/establishPlaidConnectionEpic.d.ts +2 -2
  44. package/lib/view/spendManagement/{commonSetup → plaidAccount}/epic/plaidConnection/establishPlaidConnectionEpic.js +7 -7
  45. package/lib/view/spendManagement/{commonSetup → plaidAccount}/epic/plaidConnection/getPlaidLinkTokenEpic.d.ts +2 -2
  46. package/lib/view/spendManagement/{commonSetup → plaidAccount}/epic/plaidConnection/getPlaidLinkTokenEpic.js +6 -6
  47. package/lib/view/spendManagement/plaidAccount/plaidAccountViewReducer.d.ts +85 -0
  48. package/lib/view/spendManagement/plaidAccount/plaidAccountViewReducer.js +332 -0
  49. package/lib/view/spendManagement/plaidAccount/plaidAccountViewSelector.d.ts +2 -0
  50. package/lib/view/spendManagement/plaidAccount/plaidAccountViewSelector.js +7 -0
  51. package/lib/view/spendManagement/plaidAccount/plaidAccountViewState.d.ts +21 -0
  52. package/lib/view/spendManagement/plaidAccount/plaidAccountViewState.js +29 -0
  53. package/lib/view/spendManagement/reimbursement/remiSetupView/epic/remiSetup/fetchRemiSetupViewEpic.d.ts +3 -2
  54. package/lib/view/spendManagement/reimbursement/remiSetupView/epic/remiSetup/fetchRemiSetupViewEpic.js +5 -4
  55. package/lib/view/spendManagement/reimbursement/remiSetupView/epic/remiSetup/updateMileageDetailsEpic.d.ts +3 -2
  56. package/lib/view/spendManagement/reimbursement/remiSetupView/remiSetupViewSelector.js +1 -1
  57. package/lib/view/spendManagement/zeniAccounts/paymentAccountList/paymentAccountListPayload.d.ts +1 -1
  58. package/lib/view/spendManagement/zeniAccounts/zeniAccountList/zeniAccountListSelector.d.ts +1 -1
  59. package/lib/view/spendManagement/zeniAccounts/zeniAccountList/zeniAccountListSelector.js +2 -2
  60. package/lib/view/spendManagement/zeniAccounts/zeniAccountSetUp/epic/fetchZeniAccountSetupViewEpic.d.ts +3 -2
  61. package/lib/view/spendManagement/zeniAccounts/zeniAccountSetUp/epic/fetchZeniAccountSetupViewEpic.js +5 -4
  62. package/lib/view/spendManagement/zeniAccounts/zeniAccountSetUp/zeniAccountSetupViewSelector.js +1 -1
  63. package/package.json +1 -1
  64. /package/lib/view/spendManagement/{commonSetup → plaidAccount}/types/paymentAccount.d.ts +0 -0
  65. /package/lib/view/spendManagement/{commonSetup → plaidAccount}/types/paymentAccount.js +0 -0
  66. /package/lib/view/spendManagement/{commonSetup → plaidAccount}/types/plaidConnection.d.ts +0 -0
  67. /package/lib/view/spendManagement/{commonSetup → plaidAccount}/types/plaidConnection.js +0 -0
@@ -0,0 +1,332 @@
1
+ "use strict";
2
+ var _a;
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.clearPlaidAccountView = exports.updatePlaidAccountViewAccountDetails = exports.establishPlaidConnectionFailure = exports.establishPlaidConnectionSuccess = exports.establishPlaidConnection = exports.getPlaidLinkTokenFailure = exports.getPlaidLinkTokenSuccess = exports.getPlaidLinkToken = exports.updatePaymentAccountLoginStatusFailure = exports.updatePaymentAccountLoginStatusSuccess = exports.updatePaymentAccountLoginStatus = exports.updatePaymentAccountStatusFailure = exports.updatePaymentAccountStatusSuccess = exports.updatePaymentAccountStatus = exports.updatePaymentAccountFailure = exports.updatePaymentAccountSuccess = exports.updatePaymentAccount = exports.getPaymentAccountsFailure = exports.getPaymentAccountsSuccess = exports.getPaymentAccounts = exports.initialState = void 0;
5
+ const toolkit_1 = require("@reduxjs/toolkit");
6
+ const zeniDayJS_1 = require("../../../zeniDayJS");
7
+ const plaidAccountViewState_1 = require("./plaidAccountViewState");
8
+ exports.initialState = {
9
+ spend_management_setup: plaidAccountViewState_1.initialPlaidAccountState,
10
+ user_reimbursement_account: plaidAccountViewState_1.initialPlaidAccountState,
11
+ external_account: plaidAccountViewState_1.initialPlaidAccountState,
12
+ };
13
+ const plaidAccountView = (0, toolkit_1.createSlice)({
14
+ name: 'plaidAccountView',
15
+ initialState: exports.initialState,
16
+ reducers: {
17
+ getPaymentAccounts: {
18
+ reducer(draft, action) {
19
+ const { plaidAccountKeyType } = action.payload;
20
+ draft[plaidAccountKeyType].accountDetails.fetchStatus = {
21
+ fetchState: 'In-Progress',
22
+ error: undefined,
23
+ };
24
+ },
25
+ prepare(setupViewType, plaidAccountKeyType, includeBalances = true) {
26
+ return { payload: { setupViewType, includeBalances, plaidAccountKeyType } };
27
+ },
28
+ },
29
+ getPaymentAccountsSuccess: {
30
+ reducer(draft, action) {
31
+ const { paymentAccountIds, plaidAccountKeyType } = action.payload;
32
+ draft[plaidAccountKeyType].accountDetails.fetchStatus = {
33
+ fetchState: 'Completed',
34
+ error: undefined,
35
+ };
36
+ draft[plaidAccountKeyType].accountDetails.paymentAccountIds =
37
+ paymentAccountIds;
38
+ },
39
+ prepare(paymentAccountIds, plaidAccountKeyType) {
40
+ return {
41
+ payload: { paymentAccountIds, plaidAccountKeyType },
42
+ };
43
+ },
44
+ },
45
+ getPaymentAccountsFailure: {
46
+ reducer(draft, action) {
47
+ const { error, plaidAccountKeyType } = action.payload;
48
+ draft[plaidAccountKeyType].accountDetails.fetchStatus = {
49
+ fetchState: 'Error',
50
+ error,
51
+ };
52
+ },
53
+ prepare(error, plaidAccountKeyType) {
54
+ return {
55
+ payload: { error, plaidAccountKeyType },
56
+ };
57
+ },
58
+ },
59
+ updatePaymentAccount: {
60
+ reducer(draft, action) {
61
+ const { plaidAccountKeyType } = action.payload;
62
+ draft[plaidAccountKeyType].accountDetails.updateStatus = {
63
+ fetchState: 'In-Progress',
64
+ error: undefined,
65
+ };
66
+ },
67
+ prepare(accountId, paymentAccountId, setupViewType, plaidAccountKeyType) {
68
+ return {
69
+ payload: {
70
+ accountId,
71
+ paymentAccountId,
72
+ setupViewType,
73
+ plaidAccountKeyType,
74
+ },
75
+ };
76
+ },
77
+ },
78
+ updatePaymentAccountSuccess: {
79
+ reducer(draft, action) {
80
+ const { paymentAccountIds, plaidAccountKeyType } = action.payload;
81
+ draft[plaidAccountKeyType].accountDetails.updateStatus = {
82
+ fetchState: 'Completed',
83
+ error: undefined,
84
+ };
85
+ draft[plaidAccountKeyType].accountDetails.paymentAccountIds =
86
+ paymentAccountIds;
87
+ },
88
+ prepare(paymentAccountIds, plaidAccountKeyType) {
89
+ return {
90
+ payload: { paymentAccountIds, plaidAccountKeyType },
91
+ };
92
+ },
93
+ },
94
+ updatePaymentAccountFailure: {
95
+ reducer(draft, action) {
96
+ const { error, plaidAccountKeyType } = action.payload;
97
+ draft[plaidAccountKeyType].accountDetails.updateStatus = {
98
+ fetchState: 'Error',
99
+ error,
100
+ };
101
+ },
102
+ prepare(error, plaidAccountKeyType) {
103
+ return {
104
+ payload: { error, plaidAccountKeyType },
105
+ };
106
+ },
107
+ },
108
+ updatePaymentAccountStatus: {
109
+ reducer(draft, action) {
110
+ const { linkTokenType, plaidAccountKeyType } = action.payload;
111
+ draft[plaidAccountKeyType].plaidConnectionDetails[linkTokenType] = Object.assign(Object.assign({}, draft[plaidAccountKeyType].plaidConnectionDetails[linkTokenType]), { updateStatus: {
112
+ fetchState: 'In-Progress',
113
+ error: undefined,
114
+ } });
115
+ },
116
+ prepare(verificationStatusCode, paymentAccountId, setupViewType, plaidAccountKeyType, linkTokenType) {
117
+ return {
118
+ payload: {
119
+ verificationStatusCode,
120
+ paymentAccountId,
121
+ setupViewType,
122
+ plaidAccountKeyType,
123
+ linkTokenType: linkTokenType !== null && linkTokenType !== void 0 ? linkTokenType : 'link_account',
124
+ },
125
+ };
126
+ },
127
+ },
128
+ updatePaymentAccountStatusSuccess: {
129
+ reducer(draft, action) {
130
+ const { paymentAccountIds, linkTokenType, plaidAccountKeyType } = action.payload;
131
+ draft[plaidAccountKeyType].plaidConnectionDetails[linkTokenType] = Object.assign(Object.assign({}, draft[plaidAccountKeyType].plaidConnectionDetails[linkTokenType]), { updateStatus: {
132
+ fetchState: 'Completed',
133
+ error: undefined,
134
+ } });
135
+ draft[plaidAccountKeyType].accountDetails.paymentAccountIds =
136
+ paymentAccountIds;
137
+ },
138
+ prepare(paymentAccountIds, linkTokenType, plaidAccountKeyType) {
139
+ return {
140
+ payload: { paymentAccountIds, linkTokenType, plaidAccountKeyType },
141
+ };
142
+ },
143
+ },
144
+ updatePaymentAccountStatusFailure: {
145
+ reducer(draft, action) {
146
+ const { error, linkTokenType, plaidAccountKeyType } = action.payload;
147
+ draft[plaidAccountKeyType].plaidConnectionDetails[linkTokenType] = Object.assign(Object.assign({}, draft[plaidAccountKeyType].plaidConnectionDetails[linkTokenType]), { updateStatus: {
148
+ fetchState: 'Error',
149
+ error,
150
+ } });
151
+ },
152
+ prepare(error, linkTokenType, plaidAccountKeyType) {
153
+ return {
154
+ payload: { error, linkTokenType, plaidAccountKeyType },
155
+ };
156
+ },
157
+ },
158
+ updatePaymentAccountLoginStatus: {
159
+ reducer(draft, action) {
160
+ const { linkTokenType, plaidAccountKeyType } = action.payload;
161
+ draft[plaidAccountKeyType].plaidConnectionDetails[linkTokenType] = Object.assign(Object.assign({}, draft[plaidAccountKeyType].plaidConnectionDetails[linkTokenType]), { updateStatus: {
162
+ fetchState: 'In-Progress',
163
+ error: undefined,
164
+ } });
165
+ },
166
+ prepare(isLoginRequired, paymentAccountId, setupViewType, plaidAccountKeyType, linkTokenType) {
167
+ return {
168
+ payload: {
169
+ isLoginRequired,
170
+ paymentAccountId,
171
+ setupViewType,
172
+ plaidAccountKeyType,
173
+ linkTokenType: linkTokenType !== null && linkTokenType !== void 0 ? linkTokenType : 'link_account',
174
+ },
175
+ };
176
+ },
177
+ },
178
+ updatePaymentAccountLoginStatusSuccess: {
179
+ reducer(draft, action) {
180
+ const { paymentAccountIds, linkTokenType, plaidAccountKeyType } = action.payload;
181
+ draft[plaidAccountKeyType].plaidConnectionDetails[linkTokenType] = Object.assign(Object.assign({}, draft[plaidAccountKeyType].plaidConnectionDetails[linkTokenType]), { updateStatus: {
182
+ fetchState: 'Completed',
183
+ error: undefined,
184
+ } });
185
+ draft[plaidAccountKeyType].accountDetails.paymentAccountIds =
186
+ paymentAccountIds;
187
+ },
188
+ prepare(paymentAccountIds, linkTokenType, plaidAccountKeyType) {
189
+ return {
190
+ payload: { paymentAccountIds, linkTokenType, plaidAccountKeyType },
191
+ };
192
+ },
193
+ },
194
+ updatePaymentAccountLoginStatusFailure: {
195
+ reducer(draft, action) {
196
+ const { error, linkTokenType, plaidAccountKeyType } = action.payload;
197
+ draft[plaidAccountKeyType].plaidConnectionDetails[linkTokenType] = Object.assign(Object.assign({}, draft[plaidAccountKeyType].plaidConnectionDetails[linkTokenType]), { updateStatus: {
198
+ fetchState: 'Error',
199
+ error,
200
+ } });
201
+ },
202
+ prepare(error, linkTokenType, plaidAccountKeyType) {
203
+ return {
204
+ payload: { error, linkTokenType, plaidAccountKeyType },
205
+ };
206
+ },
207
+ },
208
+ getPlaidLinkToken: {
209
+ reducer(draft, action) {
210
+ const { linkTokenType, paymentAccountId, plaidAccountKeyType } = action.payload;
211
+ draft[plaidAccountKeyType].plaidConnectionDetails[linkTokenType] = Object.assign(Object.assign({}, draft[plaidAccountKeyType].plaidConnectionDetails[linkTokenType]), { fetchStatus: {
212
+ fetchState: 'In-Progress',
213
+ error: undefined,
214
+ } });
215
+ if (paymentAccountId != null) {
216
+ draft[plaidAccountKeyType].accountDetails.paymentAccountIds = [
217
+ paymentAccountId,
218
+ ];
219
+ }
220
+ },
221
+ prepare(plaidAccountKeyType, linkTokenType, paymentAccountId) {
222
+ return {
223
+ payload: {
224
+ linkTokenType: linkTokenType !== null && linkTokenType !== void 0 ? linkTokenType : 'link_account',
225
+ paymentAccountId: paymentAccountId,
226
+ plaidAccountKeyType,
227
+ },
228
+ };
229
+ },
230
+ },
231
+ getPlaidLinkTokenSuccess: {
232
+ prepare(linkToken, expiration, linkTokenType, plaidAccountKeyType) {
233
+ return {
234
+ payload: { linkToken, expiration, linkTokenType, plaidAccountKeyType },
235
+ };
236
+ },
237
+ reducer(draft, action) {
238
+ const { linkToken, expiration, linkTokenType, plaidAccountKeyType } = action.payload;
239
+ draft[plaidAccountKeyType].plaidConnectionDetails[linkTokenType] = Object.assign(Object.assign({}, draft[plaidAccountKeyType].plaidConnectionDetails[linkTokenType]), { fetchStatus: {
240
+ fetchState: 'Completed',
241
+ error: undefined,
242
+ }, linkToken, expiration: (0, zeniDayJS_1.date)(expiration) });
243
+ },
244
+ },
245
+ getPlaidLinkTokenFailure: {
246
+ reducer(draft, action) {
247
+ const { error, linkTokenType, plaidAccountKeyType } = action.payload;
248
+ draft[plaidAccountKeyType].plaidConnectionDetails[linkTokenType] = Object.assign(Object.assign({}, draft[plaidAccountKeyType].plaidConnectionDetails[linkTokenType]), { fetchStatus: {
249
+ fetchState: 'Error',
250
+ error,
251
+ } });
252
+ },
253
+ prepare(error, linkTokenType, plaidAccountKeyType) {
254
+ return {
255
+ payload: { error, linkTokenType, plaidAccountKeyType },
256
+ };
257
+ },
258
+ },
259
+ establishPlaidConnection: {
260
+ reducer(draft, action) {
261
+ const { linkTokenType, plaidAccountKeyType } = action.payload;
262
+ draft[plaidAccountKeyType].plaidConnectionDetails[linkTokenType] = Object.assign(Object.assign({}, draft[plaidAccountKeyType].plaidConnectionDetails[linkTokenType]), { updateStatus: {
263
+ fetchState: 'In-Progress',
264
+ error: undefined,
265
+ } });
266
+ },
267
+ prepare(publicToken, plaidAccountKeyType, setupViewType, linkTokenType) {
268
+ return {
269
+ payload: {
270
+ publicToken,
271
+ setupViewType,
272
+ linkTokenType: linkTokenType !== null && linkTokenType !== void 0 ? linkTokenType : 'link_account',
273
+ plaidAccountKeyType,
274
+ },
275
+ };
276
+ },
277
+ },
278
+ establishPlaidConnectionSuccess: {
279
+ reducer(draft, action) {
280
+ const { paymentAccountIds, linkTokenType, plaidAccountKeyType } = action.payload;
281
+ draft[plaidAccountKeyType].plaidConnectionDetails[linkTokenType] = Object.assign(Object.assign({}, draft[plaidAccountKeyType].plaidConnectionDetails[linkTokenType]), { updateStatus: {
282
+ fetchState: 'Completed',
283
+ error: undefined,
284
+ } });
285
+ draft[plaidAccountKeyType].accountDetails.paymentAccountIds =
286
+ paymentAccountIds;
287
+ },
288
+ prepare(paymentAccountIds, linkTokenType, plaidAccountKeyType) {
289
+ return {
290
+ payload: { paymentAccountIds, linkTokenType, plaidAccountKeyType },
291
+ };
292
+ },
293
+ },
294
+ establishPlaidConnectionFailure: {
295
+ reducer(draft, action) {
296
+ const { linkTokenType, error, plaidAccountKeyType } = action.payload;
297
+ draft[plaidAccountKeyType].plaidConnectionDetails[linkTokenType] = Object.assign(Object.assign({}, draft[plaidAccountKeyType].plaidConnectionDetails[linkTokenType]), { updateStatus: {
298
+ fetchState: 'Error',
299
+ error,
300
+ } });
301
+ },
302
+ prepare(error, linkTokenType, plaidAccountKeyType) {
303
+ return {
304
+ payload: { error, linkTokenType, plaidAccountKeyType },
305
+ };
306
+ },
307
+ },
308
+ updatePlaidAccountViewAccountDetails: {
309
+ prepare(allBankAccountIds, paymentAccountIds, plaidAccountKeyType) {
310
+ return {
311
+ payload: { allBankAccountIds, paymentAccountIds, plaidAccountKeyType },
312
+ };
313
+ },
314
+ reducer(draft, action) {
315
+ const { allBankAccountIds, paymentAccountIds, plaidAccountKeyType } = action.payload;
316
+ draft[plaidAccountKeyType].accountDetails.allBankAccountIds =
317
+ allBankAccountIds;
318
+ draft[plaidAccountKeyType].accountDetails.paymentAccountIds =
319
+ paymentAccountIds;
320
+ draft[plaidAccountKeyType].accountDetails.fetchStatus = {
321
+ fetchState: 'Completed',
322
+ error: undefined,
323
+ };
324
+ },
325
+ },
326
+ clearPlaidAccountView(draft) {
327
+ Object.assign(draft, exports.initialState);
328
+ },
329
+ },
330
+ });
331
+ _a = plaidAccountView.actions, exports.getPaymentAccounts = _a.getPaymentAccounts, exports.getPaymentAccountsSuccess = _a.getPaymentAccountsSuccess, exports.getPaymentAccountsFailure = _a.getPaymentAccountsFailure, exports.updatePaymentAccount = _a.updatePaymentAccount, exports.updatePaymentAccountSuccess = _a.updatePaymentAccountSuccess, exports.updatePaymentAccountFailure = _a.updatePaymentAccountFailure, exports.updatePaymentAccountStatus = _a.updatePaymentAccountStatus, exports.updatePaymentAccountStatusSuccess = _a.updatePaymentAccountStatusSuccess, exports.updatePaymentAccountStatusFailure = _a.updatePaymentAccountStatusFailure, exports.updatePaymentAccountLoginStatus = _a.updatePaymentAccountLoginStatus, exports.updatePaymentAccountLoginStatusSuccess = _a.updatePaymentAccountLoginStatusSuccess, exports.updatePaymentAccountLoginStatusFailure = _a.updatePaymentAccountLoginStatusFailure, exports.getPlaidLinkToken = _a.getPlaidLinkToken, exports.getPlaidLinkTokenSuccess = _a.getPlaidLinkTokenSuccess, exports.getPlaidLinkTokenFailure = _a.getPlaidLinkTokenFailure, exports.establishPlaidConnection = _a.establishPlaidConnection, exports.establishPlaidConnectionSuccess = _a.establishPlaidConnectionSuccess, exports.establishPlaidConnectionFailure = _a.establishPlaidConnectionFailure, exports.updatePlaidAccountViewAccountDetails = _a.updatePlaidAccountViewAccountDetails, exports.clearPlaidAccountView = _a.clearPlaidAccountView;
332
+ exports.default = plaidAccountView.reducer;
@@ -0,0 +1,2 @@
1
+ import { PlaidAccountKeyType, PlaidAccountState, PlaidAccountViewState } from './plaidAccountViewState';
2
+ export declare function getPlaidAccountwDetails(plaidAccountViewState: PlaidAccountViewState, plaidAccountKeyType: PlaidAccountKeyType): PlaidAccountState;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getPlaidAccountwDetails = void 0;
4
+ function getPlaidAccountwDetails(plaidAccountViewState, plaidAccountKeyType) {
5
+ return plaidAccountViewState[plaidAccountKeyType];
6
+ }
7
+ exports.getPlaidAccountwDetails = getPlaidAccountwDetails;
@@ -0,0 +1,21 @@
1
+ import { FetchStateAndError, ID } from '../../../commonStateTypes/common';
2
+ import { ZeniDate } from '../../../zeniDayJS';
3
+ export declare type PlaidLinkTokenType = 'link_account' | 'update_account' | 'link_account_no_microdeposit' | 'link_external_account';
4
+ export declare type PlaidAccountKeyType = 'spend_management_setup' | 'user_reimbursement_account' | 'external_account';
5
+ export declare type PlaidConnectionDetails = Record<PlaidLinkTokenType, {
6
+ linkToken?: string;
7
+ expiration?: ZeniDate;
8
+ fetchStatus: FetchStateAndError;
9
+ updateStatus: FetchStateAndError;
10
+ }>;
11
+ export declare const initialPlaidAccountState: PlaidAccountState;
12
+ export interface PlaidAccountState {
13
+ accountDetails: {
14
+ fetchStatus: FetchStateAndError;
15
+ updateStatus: FetchStateAndError;
16
+ paymentAccountIds: ID[];
17
+ allBankAccountIds: ID[];
18
+ };
19
+ plaidConnectionDetails: PlaidConnectionDetails;
20
+ }
21
+ export declare type PlaidAccountViewState = Record<PlaidAccountKeyType, PlaidAccountState>;
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.initialPlaidAccountState = void 0;
4
+ exports.initialPlaidAccountState = {
5
+ accountDetails: {
6
+ fetchStatus: { fetchState: 'Not-Started', error: undefined },
7
+ updateStatus: { fetchState: 'Not-Started', error: undefined },
8
+ paymentAccountIds: [],
9
+ allBankAccountIds: [],
10
+ },
11
+ plaidConnectionDetails: {
12
+ link_account: {
13
+ fetchStatus: { fetchState: 'Not-Started', error: undefined },
14
+ updateStatus: { fetchState: 'Not-Started', error: undefined },
15
+ },
16
+ update_account: {
17
+ fetchStatus: { fetchState: 'Not-Started', error: undefined },
18
+ updateStatus: { fetchState: 'Not-Started', error: undefined },
19
+ },
20
+ link_account_no_microdeposit: {
21
+ fetchStatus: { fetchState: 'Not-Started', error: undefined },
22
+ updateStatus: { fetchState: 'Not-Started', error: undefined },
23
+ },
24
+ link_external_account: {
25
+ fetchStatus: { fetchState: 'Not-Started', error: undefined },
26
+ updateStatus: { fetchState: 'Not-Started', error: undefined },
27
+ },
28
+ },
29
+ };
@@ -10,7 +10,8 @@ import { updateAddresses } from '../../../../../../entity/address/addressReducer
10
10
  import { updateAccounts } from '../../../../../../entity/account/accountReducer';
11
11
  import { updatePaymentAccounts } from '../../../../../../entity/paymentAccount/paymentAccountReducer';
12
12
  import { openSnackbar } from '../../../../../../entity/snackbar/snackbarReducer';
13
- import { updateSetupViewAccountDetails, updateSetupViewLocalStoreData } from '../../../../commonSetup/setupViewReducer';
13
+ import { updateSetupViewLocalStoreData } from '../../../../commonSetup/setupViewReducer';
14
14
  import { fetchRemiSetupView, fetchRemiSetupViewSuccess, fetchRemiSetupViewFailure, updateRemiSetupViewLocalStoreData } from '../../remiSetupViewReducer';
15
- export declare type ActionType = ReturnType<typeof fetchRemiSetupView> | ReturnType<typeof updateAllUsers> | ReturnType<typeof updateUserRoles> | ReturnType<typeof updateCompanies> | ReturnType<typeof updateFiles> | ReturnType<typeof updateAccounts> | ReturnType<typeof updateAddresses> | ReturnType<typeof updatePaymentAccounts> | ReturnType<typeof updateSetupViewAccountDetails> | ReturnType<typeof updateSetupViewLocalStoreData> | ReturnType<typeof updateRemiSetupViewLocalStoreData> | ReturnType<typeof openSnackbar> | ReturnType<typeof fetchRemiSetupViewSuccess> | ReturnType<typeof fetchRemiSetupViewFailure>;
15
+ import { updatePlaidAccountViewAccountDetails } from '../../../../plaidAccount/plaidAccountViewReducer';
16
+ export declare type ActionType = ReturnType<typeof fetchRemiSetupView> | ReturnType<typeof updateAllUsers> | ReturnType<typeof updateUserRoles> | ReturnType<typeof updateCompanies> | ReturnType<typeof updateFiles> | ReturnType<typeof updateAccounts> | ReturnType<typeof updateAddresses> | ReturnType<typeof updatePaymentAccounts> | ReturnType<typeof updatePlaidAccountViewAccountDetails> | ReturnType<typeof updateSetupViewLocalStoreData> | ReturnType<typeof updateRemiSetupViewLocalStoreData> | ReturnType<typeof openSnackbar> | ReturnType<typeof fetchRemiSetupViewSuccess> | ReturnType<typeof fetchRemiSetupViewFailure>;
16
17
  export declare const fetchRemiSetupViewEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
@@ -15,10 +15,11 @@ const companySelector_1 = require("../../../../../../entity/company/companySelec
15
15
  const snackbarReducer_1 = require("../../../../../../entity/snackbar/snackbarReducer");
16
16
  const setupViewReducer_1 = require("../../../../commonSetup/setupViewReducer");
17
17
  const remiSetupViewReducer_1 = require("../../remiSetupViewReducer");
18
+ const plaidAccountViewReducer_1 = require("../../../../plaidAccount/plaidAccountViewReducer");
18
19
  const fetchRemiSetupViewEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(remiSetupViewReducer_1.fetchRemiSetupView.match), (0, operators_1.switchMap)((action) => {
19
20
  var _a;
20
21
  const { companyId, cacheOverride, refreshViewInBackground } = action.payload;
21
- const { remiSetupViewState, setupViewState, companyState } = state$.value;
22
+ const { remiSetupViewState, plaidAccountViewState, companyState } = state$.value;
22
23
  const company = (_a = (0, companySelector_1.getCompanyByCompanyId)(companyState, companyId)) === null || _a === void 0 ? void 0 : _a.company;
23
24
  if (cacheOverride === true ||
24
25
  refreshViewInBackground === true ||
@@ -48,7 +49,7 @@ const fetchRemiSetupViewEpic = (actions$, state$, zeniAPI) => actions$.pipe((0,
48
49
  (0, remiSetupViewReducer_1.updateRemiSetupViewLocalStoreData)({
49
50
  companyId: response.data.companies[0].company_id,
50
51
  }),
51
- (0, setupViewReducer_1.updateSetupViewAccountDetails)(allBankAccountIds, paymentAccountIds),
52
+ (0, plaidAccountViewReducer_1.updatePlaidAccountViewAccountDetails)(allBankAccountIds, paymentAccountIds, 'spend_management_setup'),
52
53
  (0, remiSetupViewReducer_1.fetchRemiSetupViewSuccess)(),
53
54
  ];
54
55
  return (0, rxjs_1.from)(actions);
@@ -63,10 +64,10 @@ const fetchRemiSetupViewEpic = (actions$, state$, zeniAPI) => actions$.pipe((0,
63
64
  }), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, remiSetupViewReducer_1.fetchRemiSetupViewFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Fetch Remi Setup view errored out' + JSON.stringify(error))))));
64
65
  }
65
66
  else {
66
- const { allBankAccountIds, paymentAccountIds } = setupViewState.accountDetails;
67
+ const { allBankAccountIds, paymentAccountIds } = plaidAccountViewState['spend_management_setup'].accountDetails;
67
68
  return (0, rxjs_1.of)((0, setupViewReducer_1.updateSetupViewLocalStoreData)({
68
69
  companyId,
69
- }), (0, setupViewReducer_1.updateSetupViewAccountDetails)(allBankAccountIds, paymentAccountIds), (0, remiSetupViewReducer_1.fetchRemiSetupViewSuccess)());
70
+ }), (0, plaidAccountViewReducer_1.updatePlaidAccountViewAccountDetails)(allBankAccountIds, paymentAccountIds, 'spend_management_setup'), (0, remiSetupViewReducer_1.fetchRemiSetupViewSuccess)());
70
71
  }
71
72
  }));
72
73
  exports.fetchRemiSetupViewEpic = fetchRemiSetupViewEpic;
@@ -9,8 +9,9 @@ import { updateFiles } from '../../../../../../entity/file/fileReducer';
9
9
  import { updateAddresses } from '../../../../../../entity/address/addressReducer';
10
10
  import { updateAccounts } from '../../../../../../entity/account/accountReducer';
11
11
  import { updatePaymentAccounts } from '../../../../../../entity/paymentAccount/paymentAccountReducer';
12
- import { updateSetupViewAccountDetails, updateSetupViewLocalStoreData } from '../../../../commonSetup/setupViewReducer';
12
+ import { updateSetupViewLocalStoreData } from '../../../../commonSetup/setupViewReducer';
13
13
  import { updateMileageDetails, updateMileageDetailsSuccess, updateMileageDetailsFailure, updateRemiSetupViewLocalStoreData } from '../../remiSetupViewReducer';
14
14
  import { openSnackbar } from '../../../../../../entity/snackbar/snackbarReducer';
15
- export declare type ActionType = ReturnType<typeof updateMileageDetails> | ReturnType<typeof updateAllUsers> | ReturnType<typeof updateUserRoles> | ReturnType<typeof updateCompanies> | ReturnType<typeof updateFiles> | ReturnType<typeof updateAccounts> | ReturnType<typeof updateAddresses> | ReturnType<typeof updatePaymentAccounts> | ReturnType<typeof updateSetupViewAccountDetails> | ReturnType<typeof updateSetupViewLocalStoreData> | ReturnType<typeof updateRemiSetupViewLocalStoreData> | ReturnType<typeof updateMileageDetailsSuccess> | ReturnType<typeof openSnackbar> | ReturnType<typeof updateMileageDetailsFailure>;
15
+ import { updatePlaidAccountViewAccountDetails } from '../../../../plaidAccount/plaidAccountViewReducer';
16
+ export declare type ActionType = ReturnType<typeof updateMileageDetails> | ReturnType<typeof updateAllUsers> | ReturnType<typeof updateUserRoles> | ReturnType<typeof updateCompanies> | ReturnType<typeof updateFiles> | ReturnType<typeof updateAccounts> | ReturnType<typeof updateAddresses> | ReturnType<typeof updatePaymentAccounts> | ReturnType<typeof updatePlaidAccountViewAccountDetails> | ReturnType<typeof updateSetupViewLocalStoreData> | ReturnType<typeof updateRemiSetupViewLocalStoreData> | ReturnType<typeof updateMileageDetailsSuccess> | ReturnType<typeof openSnackbar> | ReturnType<typeof updateMileageDetailsFailure>;
16
17
  export declare const updateMileageDetailsEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
@@ -5,7 +5,7 @@ const setupViewSelector_1 = require("../../commonSetup/setupViewSelector");
5
5
  const getCompanyView_1 = require("../../../companyView/selectorHelpers/getCompanyView");
6
6
  const helpers_1 = require("../../helpers");
7
7
  function getRemiSetupViewDetails(state, companyId) {
8
- const remiSetupViewDetails = (0, setupViewSelector_1.getCommonSetupViewDetails)(state, companyId, 'reimbursement');
8
+ const remiSetupViewDetails = (0, setupViewSelector_1.getCommonSetupViewDetails)(state, companyId, 'reimbursement', 'spend_management_setup');
9
9
  const { remiSetupViewState, setupViewState } = state;
10
10
  const { mileageDetails, isRefreshingViewInBackground } = remiSetupViewState;
11
11
  const { remiTermsDetails } = remiSetupViewState;
@@ -1,3 +1,3 @@
1
1
  import { ZeniAPIResponse } from '../../../../responsePayload';
2
- import { PaymentAccountsPayload } from '../../commonSetup/types/paymentAccount';
2
+ import { PaymentAccountsPayload } from '../../plaidAccount/types/paymentAccount';
3
3
  export declare type FetchPaymentAccountListResponse = ZeniAPIResponse<PaymentAccountsPayload>;
@@ -3,7 +3,7 @@ import { ID } from '../../../../commonStateTypes/common';
3
3
  import { SelectorView } from '../../../../commonStateTypes/viewAndReport/viewAndReport';
4
4
  import { PaymentAccount } from '../../../../entity/paymentAccount/paymentAccountState';
5
5
  import { RootState } from '../../../../reducer';
6
- import { PlaidConnectionDetails } from '../../commonSetup/setupViewState';
6
+ import { PlaidConnectionDetails } from '../../plaidAccount/plaidAccountViewState';
7
7
  import { DepositAccountListSelectorView } from '../depositAccountList/depositAccountListSelector';
8
8
  import { PaymentAccountListSelectorView } from '../paymentAccountList/paymentAccountListSelector';
9
9
  import { ZeniAccountsConfigSelectorView } from '../zeniAccountsConfig/zeniAccountsConfigSelector';
@@ -8,8 +8,8 @@ const depositAccountListSelector_1 = require("../depositAccountList/depositAccou
8
8
  const paymentAccountListSelector_1 = require("../paymentAccountList/paymentAccountListSelector");
9
9
  const zeniAccountsConfigSelector_1 = require("../zeniAccountsConfig/zeniAccountsConfigSelector");
10
10
  const getZeniAccountList = (state, companyId) => {
11
- const { zeniAccountListState, depositAccountState, paymentAccountState, setupViewState, depositAccountListState, paymentAccountListState, } = state;
12
- const { accountDetails, plaidConnectionDetails } = setupViewState;
11
+ const { zeniAccountListState, depositAccountState, paymentAccountState, plaidAccountViewState, depositAccountListState, paymentAccountListState, } = state;
12
+ const { accountDetails, plaidConnectionDetails } = plaidAccountViewState['external_account'];
13
13
  const depositAccountsSelectorView = (0, depositAccountListSelector_1.getAllDepostAccounts)(depositAccountState, depositAccountListState);
14
14
  const zeniAccountsConfig = (0, zeniAccountsConfigSelector_1.getZeniAccountsConfigDetail)(state);
15
15
  const companyView = (0, getCompanyView_1.getCompanyView)(state, companyId, []);
@@ -10,7 +10,8 @@ import { updateAllUsers } from '../../../../../entity/user/userReducer';
10
10
  import { updateUserRoles } from '../../../../../entity/userRole/userRoleReducer';
11
11
  import { RootState } from '../../../../../reducer';
12
12
  import { ZeniAPI } from '../../../../../zeniAPI';
13
- import { updateSetupViewAccountDetails, updateSetupViewLocalStoreData } from '../../../commonSetup/setupViewReducer';
13
+ import { updateSetupViewLocalStoreData } from '../../../commonSetup/setupViewReducer';
14
14
  import { fetchZeniAccountSetupView, fetchZeniAccountSetupViewFailure, fetchZeniAccountSetupViewSuccess } from '../zeniAccountSetupViewReducer';
15
- export declare type ActionType = ReturnType<typeof fetchZeniAccountSetupView> | ReturnType<typeof updateAllUsers> | ReturnType<typeof updateUserRoles> | ReturnType<typeof updateCompanies> | ReturnType<typeof updateFiles> | ReturnType<typeof updateAccounts> | ReturnType<typeof updateAddresses> | ReturnType<typeof updatePaymentAccounts> | ReturnType<typeof updateSetupViewAccountDetails> | ReturnType<typeof updateSetupViewLocalStoreData> | ReturnType<typeof openSnackbar> | ReturnType<typeof fetchZeniAccountSetupViewSuccess> | ReturnType<typeof fetchZeniAccountSetupViewFailure>;
15
+ import { updatePlaidAccountViewAccountDetails } from '../../../plaidAccount/plaidAccountViewReducer';
16
+ export declare type ActionType = ReturnType<typeof fetchZeniAccountSetupView> | ReturnType<typeof updateAllUsers> | ReturnType<typeof updateUserRoles> | ReturnType<typeof updateCompanies> | ReturnType<typeof updateFiles> | ReturnType<typeof updateAccounts> | ReturnType<typeof updateAddresses> | ReturnType<typeof updatePaymentAccounts> | ReturnType<typeof updatePlaidAccountViewAccountDetails> | ReturnType<typeof updateSetupViewLocalStoreData> | ReturnType<typeof openSnackbar> | ReturnType<typeof fetchZeniAccountSetupViewSuccess> | ReturnType<typeof fetchZeniAccountSetupViewFailure>;
16
17
  export declare const fetchZeniAccountSetupViewEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
@@ -15,10 +15,11 @@ const userRoleReducer_1 = require("../../../../../entity/userRole/userRoleReduce
15
15
  const responsePayload_1 = require("../../../../../responsePayload");
16
16
  const setupViewReducer_1 = require("../../../commonSetup/setupViewReducer");
17
17
  const zeniAccountSetupViewReducer_1 = require("../zeniAccountSetupViewReducer");
18
+ const plaidAccountViewReducer_1 = require("../../../plaidAccount/plaidAccountViewReducer");
18
19
  const fetchZeniAccountSetupViewEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(zeniAccountSetupViewReducer_1.fetchZeniAccountSetupView.match), (0, operators_1.switchMap)((action) => {
19
20
  var _a;
20
21
  const { companyId, cacheOverride, refreshViewInBackground } = action.payload;
21
- const { zeniAccountSetupViewState, setupViewState, companyState } = state$.value;
22
+ const { zeniAccountSetupViewState, plaidAccountViewState, companyState } = state$.value;
22
23
  const company = (_a = (0, companySelector_1.getCompanyByCompanyId)(companyState, companyId)) === null || _a === void 0 ? void 0 : _a.company;
23
24
  if (cacheOverride === true ||
24
25
  refreshViewInBackground === true ||
@@ -46,7 +47,7 @@ const fetchZeniAccountSetupViewEpic = (actions$, state$, zeniAPI) => actions$.pi
46
47
  (0, setupViewReducer_1.updateSetupViewLocalStoreData)({
47
48
  companyId: response.data.companies[0].company_id,
48
49
  }),
49
- (0, setupViewReducer_1.updateSetupViewAccountDetails)(allBankAccountIds, paymentAccountIds),
50
+ (0, plaidAccountViewReducer_1.updatePlaidAccountViewAccountDetails)(allBankAccountIds, paymentAccountIds, 'spend_management_setup'),
50
51
  (0, zeniAccountSetupViewReducer_1.fetchZeniAccountSetupViewSuccess)(),
51
52
  ];
52
53
  return (0, rxjs_1.from)(actions);
@@ -62,10 +63,10 @@ const fetchZeniAccountSetupViewEpic = (actions$, state$, zeniAPI) => actions$.pi
62
63
  JSON.stringify(error))))));
63
64
  }
64
65
  else {
65
- const { allBankAccountIds, paymentAccountIds } = setupViewState.accountDetails;
66
+ const { allBankAccountIds, paymentAccountIds } = plaidAccountViewState['spend_management_setup'].accountDetails;
66
67
  return (0, rxjs_1.of)((0, setupViewReducer_1.updateSetupViewLocalStoreData)({
67
68
  companyId,
68
- }), (0, setupViewReducer_1.updateSetupViewAccountDetails)(allBankAccountIds, paymentAccountIds), (0, zeniAccountSetupViewReducer_1.fetchZeniAccountSetupViewSuccess)());
69
+ }), (0, plaidAccountViewReducer_1.updatePlaidAccountViewAccountDetails)(allBankAccountIds, paymentAccountIds, 'spend_management_setup'), (0, zeniAccountSetupViewReducer_1.fetchZeniAccountSetupViewSuccess)());
69
70
  }
70
71
  }));
71
72
  exports.fetchZeniAccountSetupViewEpic = fetchZeniAccountSetupViewEpic;
@@ -5,7 +5,7 @@ const getCompanyView_1 = require("../../../companyView/selectorHelpers/getCompan
5
5
  const setupViewSelector_1 = require("../../commonSetup/setupViewSelector");
6
6
  const helpers_1 = require("../../helpers");
7
7
  function getZeniAccountSetupViewDetails(state, companyId) {
8
- const zeniAccountSetupViewDetails = (0, setupViewSelector_1.getCommonSetupViewDetails)(state, companyId, 'zeni_accounts');
8
+ const zeniAccountSetupViewDetails = (0, setupViewSelector_1.getCommonSetupViewDetails)(state, companyId, 'zeni_accounts', 'spend_management_setup');
9
9
  const companyView = (0, getCompanyView_1.getCompanyView)(state, companyId, []);
10
10
  const companyZeniAccountInfo = companyView === null || companyView === void 0 ? void 0 : companyView.company.company.companyZeniAccountInfo;
11
11
  const { zeniAccountSetupViewState, setupViewState } = state;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "4.10.46",
3
+ "version": "4.10.47",
4
4
  "description": "Shared module between Web & Mobile containing required abstractions for state management, async network communication. ",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",