@zeniai/client-epic-state 4.10.70 → 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.
@@ -199,6 +199,12 @@ const mapPaymentAccToFundingAccount = (paymentAcc) => {
199
199
  accType: 'paymentAccount',
200
200
  maskedAccountNumber: paymentAcc.maskedAccountNumber,
201
201
  zeniAccountId: paymentAcc.zeniAccountId,
202
+ institutionDetails: paymentAcc.institutionDetails,
203
+ accountSubType: paymentAcc.accountSubType,
204
+ isLoginRequired: paymentAcc.isLoginRequired,
205
+ isVerified: paymentAcc.isVerified,
206
+ providerAccountId: paymentAcc.providerAccountId,
207
+ providerVerificationStatus: paymentAcc.providerVerificationStatus,
202
208
  label: Boolean(paymentAcc.institutionDetails.institutionName) === true
203
209
  ? paymentAcc.institutionDetails.institutionName
204
210
  : (0, depositAccountPayload_1.getZeniAccountFallbackName)(paymentAcc.maskedAccountNumber, (_a = paymentAcc.accountSubType) === null || _a === void 0 ? void 0 : _a.name),
@@ -23,6 +23,9 @@ const establishPlaidConnectionEpic = (actions$, state, zeniAPI) => actions$.pipe
23
23
  if (setupViewType == null) {
24
24
  requestPayload.is_user_account = true;
25
25
  }
26
+ else if (plaidAccountKeyType === 'reimbursement_setup') {
27
+ requestPayload.is_primary_for_reimbursements = true;
28
+ }
26
29
  else {
27
30
  requestPayload.is_primary_for_bill_pay = true;
28
31
  }
@@ -32,13 +35,17 @@ const establishPlaidConnectionEpic = (actions$, state, zeniAPI) => actions$.pipe
32
35
  .pipe((0, operators_1.mergeMap)((response) => {
33
36
  if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
34
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;
35
42
  const actions = [
36
43
  (0, paymentAccountReducer_1.updatePaymentAccounts)(response.data.payment_accounts),
37
44
  (0, paymentAccountListReducer_1.updatePaymentAccountList)({
38
45
  data: response.data.payment_accounts,
39
46
  updateType: 'merge',
40
47
  }),
41
- (0, plaidAccountViewReducer_1.establishPlaidConnectionSuccess)(paymentAccountIds, linkTokenType, plaidAccountKeyType),
48
+ (0, plaidAccountViewReducer_1.establishPlaidConnectionSuccess)(primaryFundingAccountId, [...paymentAccountIds, ...existingPaymentAccountIds], linkTokenType, plaidAccountKeyType),
42
49
  ];
43
50
  if (response.data.bank_accounts != null) {
44
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: { paymentAccountIds, linkTokenType, plaidAccountKeyType },
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.70",
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",