@zeniai/client-epic-state 5.1.27 → 5.1.28

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.
@@ -4,7 +4,7 @@ import { getAddressByAddressId } from '../../../../entity/address/addressSelecto
4
4
  import { getOnboardingCompanyByCompanyId } from '../../../../entity/company/companySelector';
5
5
  import { toAccountingConnectionCreationModeStrict } from '../../../../entity/company/companyStateTypes';
6
6
  import { getOnboardingCustomersByCompanyId } from '../../../../entity/onboardingCustomer/onboardingCustomerSelector';
7
- import { getOnboardingTenantByTenantId, isOtherProductsEnabledForTenant, isTenantBankingOnly, isTenantBookkeepingEnabled, isTenantCardsOnly, isTenantTreasuryEnabled, } from '../../../../entity/tenant/tenantSelector';
7
+ import { getOnboardingTenantByTenantId, isOtherProductsEnabledForTenant, isTenantBankingOnly, isTenantBookkeepingEnabled, isTenantCardsOnly, } from '../../../../entity/tenant/tenantSelector';
8
8
  import { getUserByUserId } from '../../../../entity/user/userSelector';
9
9
  import { newAddressInLocalStore, resetNewAddressesInLocalStore, } from '../../../addressView/addressViewReducer';
10
10
  import { clearOnboardingCustomerViewUpdateData, initializeOnboardingCustomerViewUpdateData, saveOnboardingCustomerDataInLocalStore, saveOnboardingCustomerViewUpdateData, updateCustomerLocalStoreInitStateOnFailure, } from '../onboardingCockpitViewReducer';
@@ -112,32 +112,20 @@ const getSelectedProducts = (isDebitCardFlagEnabled, tenant) => {
112
112
  const isBookkeepingEnabled = isTenantBookkeepingEnabled(tenant);
113
113
  const isOtherProductsEnabled = isOtherProductsEnabledForTenant(tenant);
114
114
  const isCardsEnabled = isTenantCardsOnly(tenant);
115
- const isTreasuryEnabled = isTenantTreasuryEnabled(tenant);
116
115
  if (isCardsEnabled && isBankingOnly) {
117
- const selectedProducts = ['zeni_cards', 'zeni_checking'];
118
- if (isTreasuryEnabled) {
119
- selectedProducts.push('zeni_treasury');
120
- }
121
- return selectedProducts;
116
+ return [];
122
117
  }
123
118
  else if (isBankingOnly) {
124
- const selectedProducts = ['zeni_checking'];
125
- if (isTreasuryEnabled) {
126
- selectedProducts.push('zeni_treasury');
127
- }
128
- return selectedProducts;
119
+ return [];
129
120
  }
130
121
  else if (isCardsEnabled) {
131
- return ['zeni_cards'];
122
+ return [];
132
123
  }
133
124
  else if (isBookkeepingEnabled) {
134
125
  return [
135
126
  'bookkeeping',
136
127
  'zeni_bill_pay',
137
- 'zeni_checking',
138
128
  'zeni_reimbursements',
139
- 'zeni_treasury',
140
- 'zeni_cards',
141
129
  ];
142
130
  }
143
131
  else if (isOtherProductsEnabled) {
@@ -48,9 +48,9 @@ export const toOnboardingCustomerPayload = (onboardingCustomer, sendInvite, comp
48
48
  const isTreasury = selectedProducts.includes('zeni_treasury');
49
49
  if (isBookkeeping) {
50
50
  onboardingCustomerPayload.is_book_keeping_enabled = true;
51
- onboardingCustomerPayload.is_banking_enabled = true;
51
+ onboardingCustomerPayload.is_banking_enabled = isChecking;
52
52
  onboardingCustomerPayload.is_spend_management_enabled = true;
53
- onboardingCustomerPayload.is_card_enabled = true;
53
+ onboardingCustomerPayload.is_card_enabled = isCards;
54
54
  onboardingCustomerPayload.is_treasury_enabled = isTreasury;
55
55
  }
56
56
  else if (isChecking && isCards) {
@@ -1,5 +1,6 @@
1
1
  import { of } from 'rxjs';
2
2
  import { catchError, filter, mergeMap, switchMap } from 'rxjs/operators';
3
+ import { openSnackbar } from '../../../entity/snackbar/snackbarReducer';
3
4
  import { createZeniAPIStatus, isSuccessStatus } from '../../../responsePayload';
4
5
  import { sendReferralInvite, sendReferralInviteFailure, sendReferralInviteSuccess, } from '../referralReducer';
5
6
  export const sendReferralInviteEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter(sendReferralInvite.match), switchMap(() => {
@@ -13,7 +14,14 @@ export const sendReferralInviteEpic = (actions$, state$, zeniAPI) => actions$.pi
13
14
  .postAndGetJSON(`${zeniAPI.apiEndPoints.tenantMicroServiceBaseUrl}/1.0/company-referrals`, invitePayload)
14
15
  .pipe(mergeMap((response) => {
15
16
  if (isSuccessStatus(response)) {
16
- const actions = [sendReferralInviteSuccess()];
17
+ const actions = [
18
+ sendReferralInviteSuccess(),
19
+ openSnackbar({
20
+ messageSection: 'referral_invite_sent',
21
+ messageText: 'success',
22
+ type: 'success',
23
+ }),
24
+ ];
17
25
  return actions;
18
26
  }
19
27
  else {
@@ -116,32 +116,20 @@ const getSelectedProducts = (isDebitCardFlagEnabled, tenant) => {
116
116
  const isBookkeepingEnabled = (0, tenantSelector_1.isTenantBookkeepingEnabled)(tenant);
117
117
  const isOtherProductsEnabled = (0, tenantSelector_1.isOtherProductsEnabledForTenant)(tenant);
118
118
  const isCardsEnabled = (0, tenantSelector_1.isTenantCardsOnly)(tenant);
119
- const isTreasuryEnabled = (0, tenantSelector_1.isTenantTreasuryEnabled)(tenant);
120
119
  if (isCardsEnabled && isBankingOnly) {
121
- const selectedProducts = ['zeni_cards', 'zeni_checking'];
122
- if (isTreasuryEnabled) {
123
- selectedProducts.push('zeni_treasury');
124
- }
125
- return selectedProducts;
120
+ return [];
126
121
  }
127
122
  else if (isBankingOnly) {
128
- const selectedProducts = ['zeni_checking'];
129
- if (isTreasuryEnabled) {
130
- selectedProducts.push('zeni_treasury');
131
- }
132
- return selectedProducts;
123
+ return [];
133
124
  }
134
125
  else if (isCardsEnabled) {
135
- return ['zeni_cards'];
126
+ return [];
136
127
  }
137
128
  else if (isBookkeepingEnabled) {
138
129
  return [
139
130
  'bookkeeping',
140
131
  'zeni_bill_pay',
141
- 'zeni_checking',
142
132
  'zeni_reimbursements',
143
- 'zeni_treasury',
144
- 'zeni_cards',
145
133
  ];
146
134
  }
147
135
  else if (isOtherProductsEnabled) {
@@ -51,9 +51,9 @@ const toOnboardingCustomerPayload = (onboardingCustomer, sendInvite, company, te
51
51
  const isTreasury = selectedProducts.includes('zeni_treasury');
52
52
  if (isBookkeeping) {
53
53
  onboardingCustomerPayload.is_book_keeping_enabled = true;
54
- onboardingCustomerPayload.is_banking_enabled = true;
54
+ onboardingCustomerPayload.is_banking_enabled = isChecking;
55
55
  onboardingCustomerPayload.is_spend_management_enabled = true;
56
- onboardingCustomerPayload.is_card_enabled = true;
56
+ onboardingCustomerPayload.is_card_enabled = isCards;
57
57
  onboardingCustomerPayload.is_treasury_enabled = isTreasury;
58
58
  }
59
59
  else if (isChecking && isCards) {
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.sendReferralInviteEpic = void 0;
4
4
  const rxjs_1 = require("rxjs");
5
5
  const operators_1 = require("rxjs/operators");
6
+ const snackbarReducer_1 = require("../../../entity/snackbar/snackbarReducer");
6
7
  const responsePayload_1 = require("../../../responsePayload");
7
8
  const referralReducer_1 = require("../referralReducer");
8
9
  const sendReferralInviteEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(referralReducer_1.sendReferralInvite.match), (0, operators_1.switchMap)(() => {
@@ -16,7 +17,14 @@ const sendReferralInviteEpic = (actions$, state$, zeniAPI) => actions$.pipe((0,
16
17
  .postAndGetJSON(`${zeniAPI.apiEndPoints.tenantMicroServiceBaseUrl}/1.0/company-referrals`, invitePayload)
17
18
  .pipe((0, operators_1.mergeMap)((response) => {
18
19
  if ((0, responsePayload_1.isSuccessStatus)(response)) {
19
- const actions = [(0, referralReducer_1.sendReferralInviteSuccess)()];
20
+ const actions = [
21
+ (0, referralReducer_1.sendReferralInviteSuccess)(),
22
+ (0, snackbarReducer_1.openSnackbar)({
23
+ messageSection: 'referral_invite_sent',
24
+ messageText: 'success',
25
+ type: 'success',
26
+ }),
27
+ ];
20
28
  return actions;
21
29
  }
22
30
  else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "5.1.27",
3
+ "version": "5.1.28",
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
  "module": "lib/esm/index.js",