@zeniai/client-epic-state 4.10.71 → 4.10.72
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/lib/view/spendManagement/plaidAccount/epic/plaidConnection/establishPlaidConnectionEpic.js
CHANGED
|
@@ -35,13 +35,17 @@ const establishPlaidConnectionEpic = (actions$, state, zeniAPI) => actions$.pipe
|
|
|
35
35
|
.pipe((0, operators_1.mergeMap)((response) => {
|
|
36
36
|
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
37
37
|
const paymentAccountIds = response.data.payment_accounts.map((paymentAccount) => paymentAccount.payment_account_id);
|
|
38
|
+
// the payment account received in the response is the new primary funding account
|
|
39
|
+
const primaryFundingAccountId = paymentAccountIds[0];
|
|
40
|
+
const existingPaymentAccountIds = state.value.plaidAccountViewState['reimbursement_setup']
|
|
41
|
+
.accountDetails.paymentAccountIds;
|
|
38
42
|
const actions = [
|
|
39
43
|
(0, paymentAccountReducer_1.updatePaymentAccounts)(response.data.payment_accounts),
|
|
40
44
|
(0, paymentAccountListReducer_1.updatePaymentAccountList)({
|
|
41
45
|
data: response.data.payment_accounts,
|
|
42
46
|
updateType: 'merge',
|
|
43
47
|
}),
|
|
44
|
-
(0, plaidAccountViewReducer_1.establishPlaidConnectionSuccess)(paymentAccountIds, linkTokenType, plaidAccountKeyType),
|
|
48
|
+
(0, plaidAccountViewReducer_1.establishPlaidConnectionSuccess)(primaryFundingAccountId, [...paymentAccountIds, ...existingPaymentAccountIds], linkTokenType, plaidAccountKeyType),
|
|
45
49
|
];
|
|
46
50
|
if (response.data.bank_accounts != null) {
|
|
47
51
|
const bankAccountIds = response.data.bank_accounts.map((bank_account) => bank_account.bank_account_id);
|
|
@@ -69,7 +69,8 @@ export declare const getPaymentAccounts: import("@reduxjs/toolkit").ActionCreato
|
|
|
69
69
|
setupViewType: "bill_pay" | "reimbursement" | "zeni_accounts" | "charge_cards" | undefined;
|
|
70
70
|
linkTokenType: PlaidLinkTokenType;
|
|
71
71
|
plaidAccountKeyType: PlaidAccountKeyType;
|
|
72
|
-
}, string, never, never>, establishPlaidConnectionSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[paymentAccountIds: string[], linkTokenType: PlaidLinkTokenType, plaidAccountKeyType: PlaidAccountKeyType], {
|
|
72
|
+
}, string, never, never>, establishPlaidConnectionSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[primaryFundingAccountId: string, paymentAccountIds: string[], linkTokenType: PlaidLinkTokenType, plaidAccountKeyType: PlaidAccountKeyType], {
|
|
73
|
+
primaryFundingAccountId: string;
|
|
73
74
|
paymentAccountIds: string[];
|
|
74
75
|
linkTokenType: PlaidLinkTokenType;
|
|
75
76
|
plaidAccountKeyType: PlaidAccountKeyType;
|
|
@@ -276,17 +276,26 @@ const plaidAccountView = (0, toolkit_1.createSlice)({
|
|
|
276
276
|
},
|
|
277
277
|
establishPlaidConnectionSuccess: {
|
|
278
278
|
reducer(draft, action) {
|
|
279
|
-
const { paymentAccountIds, linkTokenType, plaidAccountKeyType } = action.payload;
|
|
279
|
+
const { primaryFundingAccountId, paymentAccountIds, linkTokenType, plaidAccountKeyType, } = action.payload;
|
|
280
280
|
draft[plaidAccountKeyType].plaidConnectionDetails[linkTokenType] = Object.assign(Object.assign({}, draft[plaidAccountKeyType].plaidConnectionDetails[linkTokenType]), { updateStatus: {
|
|
281
281
|
fetchState: 'Completed',
|
|
282
282
|
error: undefined,
|
|
283
283
|
} });
|
|
284
|
+
draft[plaidAccountKeyType].accountDetails.primaryFundingAccount = {
|
|
285
|
+
accountId: primaryFundingAccountId,
|
|
286
|
+
accountType: 'paymentAccount',
|
|
287
|
+
};
|
|
284
288
|
draft[plaidAccountKeyType].accountDetails.paymentAccountIds =
|
|
285
289
|
paymentAccountIds;
|
|
286
290
|
},
|
|
287
|
-
prepare(paymentAccountIds, linkTokenType, plaidAccountKeyType) {
|
|
291
|
+
prepare(primaryFundingAccountId, paymentAccountIds, linkTokenType, plaidAccountKeyType) {
|
|
288
292
|
return {
|
|
289
|
-
payload: {
|
|
293
|
+
payload: {
|
|
294
|
+
primaryFundingAccountId,
|
|
295
|
+
paymentAccountIds,
|
|
296
|
+
linkTokenType,
|
|
297
|
+
plaidAccountKeyType,
|
|
298
|
+
},
|
|
290
299
|
};
|
|
291
300
|
},
|
|
292
301
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "4.10.
|
|
3
|
+
"version": "4.10.72",
|
|
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",
|