@zeniai/client-epic-state 5.2.11-betaRD1 → 5.2.11-betaRD2

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 (45) hide show
  1. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulePageEpic.js +9 -1
  2. package/lib/esm/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +5 -0
  3. package/lib/esm/view/expenseAutomationView/selectors/jeAccountSettingsViewSelector.js +1 -0
  4. package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulePageEpic.js +9 -1
  5. package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +5 -0
  6. package/lib/view/expenseAutomationView/selectorTypes/jeAccountSettingsViewSelectorTypes.d.ts +1 -0
  7. package/lib/view/expenseAutomationView/selectors/jeAccountSettingsViewSelector.js +1 -0
  8. package/lib/view/expenseAutomationView/types/jeSchedulesViewState.d.ts +1 -0
  9. package/package.json +1 -1
  10. package/lib/commonStateTypes/selectorTypes/pickAndMergeForecastSection.d.ts +0 -0
  11. package/lib/commonStateTypes/selectorTypes/pickAndMergeForecastSection.js +0 -1
  12. package/lib/entity/invoicing/coupon/couponConstants.d.ts +0 -11
  13. package/lib/entity/invoicing/coupon/couponConstants.js +0 -29
  14. package/lib/esm/commonStateTypes/selectorTypes/pickAndMergeForecastSection.js +0 -1
  15. package/lib/esm/entity/invoicing/coupon/couponConstants.js +0 -26
  16. package/lib/esm/view/invoicing/invoicingQboView/epics/fetchInvoicingQboAccountsEpic.js +0 -25
  17. package/lib/esm/view/invoicing/invoicingQboView/epics/fetchInvoicingQboClassesEpic.js +0 -15
  18. package/lib/esm/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryPromoIntroClosedByOutsideClickEpic.js +0 -18
  19. package/lib/esm/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryPromoRemindMeLaterClickedEpic.js +0 -18
  20. package/lib/esm/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryVideoViewedEpic.js +0 -18
  21. package/lib/esm/view/zeniAccountsPromoCard/zeniAccountsPromoCardEpic.js +0 -16
  22. package/lib/esm/view/zeniAccountsPromoCard/zeniAccountsPromoCardPayload.js +0 -1
  23. package/lib/esm/view/zeniAccountsPromoCard/zeniAccountsPromoCardReducer.js +0 -60
  24. package/lib/esm/view/zeniAccountsPromoCard/zeniAccountsPromoCardSelector.js +0 -12
  25. package/lib/esm/view/zeniAccountsPromoCard/zeniAccountsPromoCardState.js +0 -1
  26. package/lib/view/invoicing/invoicingQboView/epics/fetchInvoicingQboAccountsEpic.d.ts +0 -6
  27. package/lib/view/invoicing/invoicingQboView/epics/fetchInvoicingQboAccountsEpic.js +0 -29
  28. package/lib/view/invoicing/invoicingQboView/epics/fetchInvoicingQboClassesEpic.d.ts +0 -6
  29. package/lib/view/invoicing/invoicingQboView/epics/fetchInvoicingQboClassesEpic.js +0 -19
  30. package/lib/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryPromoIntroClosedByOutsideClickEpic.d.ts +0 -8
  31. package/lib/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryPromoIntroClosedByOutsideClickEpic.js +0 -22
  32. package/lib/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryPromoRemindMeLaterClickedEpic.d.ts +0 -8
  33. package/lib/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryPromoRemindMeLaterClickedEpic.js +0 -22
  34. package/lib/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryVideoViewedEpic.d.ts +0 -8
  35. package/lib/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryVideoViewedEpic.js +0 -22
  36. package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardEpic.d.ts +0 -13
  37. package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardEpic.js +0 -20
  38. package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardPayload.d.ts +0 -11
  39. package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardPayload.js +0 -2
  40. package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardReducer.d.ts +0 -7
  41. package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardReducer.js +0 -64
  42. package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardSelector.d.ts +0 -12
  43. package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardSelector.js +0 -15
  44. package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardState.d.ts +0 -9
  45. package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardState.js +0 -2
@@ -14,6 +14,14 @@ export const fetchJeSchedulesPageEpic = (actions$, state$) => actions$.pipe(filt
14
14
  jeSchedulePageActions.push(fetchAccountList(accountType.accountListKey, true, false, false, false, accountType.allowedAccountList));
15
15
  }
16
16
  jeSchedulePageActions.push(fetchJeSchedules(period, refreshViewInBackground));
17
- jeSchedulePageActions.push(initializeAccountSettingsView());
17
+ // Only on the first page load. Account settings cannot change from a tab switch or a
18
+ // refresh, and re-initializing puts accountSettingsView back to 'In-Progress' -- which the
19
+ // page reads as "still loading" and answers with a full skeleton over rows it already has.
20
+ // The action also resets localData, so re-dispatching it blindly would empty the settings
21
+ // form until the refetch lands. Saving account settings still re-initializes explicitly.
22
+ if (!state$.value.expenseAutomationJESchedulesViewState.accountSettings
23
+ .hasLoadedAccountSettings) {
24
+ jeSchedulePageActions.push(initializeAccountSettingsView());
25
+ }
18
26
  return concat(from(jeSchedulePageActions));
19
27
  }));
@@ -25,6 +25,7 @@ export const accountSettingsInitialState = {
25
25
  error: undefined,
26
26
  fetchState: 'Not-Started',
27
27
  },
28
+ hasLoadedAccountSettings: false,
28
29
  recommendationFetchState: {
29
30
  error: undefined,
30
31
  fetchState: 'Not-Started',
@@ -426,6 +427,9 @@ const expenseAutomationJESchedulesView = createSlice({
426
427
  error: status,
427
428
  fetchState: 'Error',
428
429
  };
430
+ // Set on failure too: a tenant whose account list errors must still reach the page rather
431
+ // than sit under a skeleton forever.
432
+ draft.accountSettings.hasLoadedAccountSettings = true;
429
433
  },
430
434
  updateAccountSettingsListForAccountTypes(draft, action) {
431
435
  doUpdateAccountSettingsListForAccountTypes(draft.accountSettings, action.payload.accountPayload);
@@ -741,4 +745,5 @@ const doUpdateAccountSettingsListForAccountTypes = (draft, accountPayloadList) =
741
745
  error: undefined,
742
746
  fetchState: 'Completed',
743
747
  };
748
+ draft.hasLoadedAccountSettings = true;
744
749
  };
@@ -22,6 +22,7 @@ export const getJEAccountSettingsView = createSelector((state) => state.expenseA
22
22
  fixedAssetsAccountHierarchy: jeAccountMappingState.fixedAssetsNestedAccountListHierarchy,
23
23
  accruedExpensesAccountHierarchy: jeAccountMappingState.accruedExpensesNestedAccountListHierarchy,
24
24
  fetchState: fetchState.fetchState,
25
+ hasLoaded: jeAccountMappingState.hasLoadedAccountSettings,
25
26
  saveState,
26
27
  };
27
28
  });
@@ -17,7 +17,15 @@ const fetchJeSchedulesPageEpic = (actions$, state$) => actions$.pipe((0, operato
17
17
  jeSchedulePageActions.push((0, accountListReducer_1.fetchAccountList)(accountType.accountListKey, true, false, false, false, accountType.allowedAccountList));
18
18
  }
19
19
  jeSchedulePageActions.push((0, jeSchedulesViewReducer_1.fetchJeSchedules)(period, refreshViewInBackground));
20
- jeSchedulePageActions.push((0, jeSchedulesViewReducer_1.initializeAccountSettingsView)());
20
+ // Only on the first page load. Account settings cannot change from a tab switch or a
21
+ // refresh, and re-initializing puts accountSettingsView back to 'In-Progress' -- which the
22
+ // page reads as "still loading" and answers with a full skeleton over rows it already has.
23
+ // The action also resets localData, so re-dispatching it blindly would empty the settings
24
+ // form until the refetch lands. Saving account settings still re-initializes explicitly.
25
+ if (!state$.value.expenseAutomationJESchedulesViewState.accountSettings
26
+ .hasLoadedAccountSettings) {
27
+ jeSchedulePageActions.push((0, jeSchedulesViewReducer_1.initializeAccountSettingsView)());
28
+ }
21
29
  return (0, rxjs_1.concat)((0, rxjs_1.from)(jeSchedulePageActions));
22
30
  }));
23
31
  exports.fetchJeSchedulesPageEpic = fetchJeSchedulesPageEpic;
@@ -30,6 +30,7 @@ exports.accountSettingsInitialState = {
30
30
  error: undefined,
31
31
  fetchState: 'Not-Started',
32
32
  },
33
+ hasLoadedAccountSettings: false,
33
34
  recommendationFetchState: {
34
35
  error: undefined,
35
36
  fetchState: 'Not-Started',
@@ -432,6 +433,9 @@ const expenseAutomationJESchedulesView = (0, toolkit_1.createSlice)({
432
433
  error: status,
433
434
  fetchState: 'Error',
434
435
  };
436
+ // Set on failure too: a tenant whose account list errors must still reach the page rather
437
+ // than sit under a skeleton forever.
438
+ draft.accountSettings.hasLoadedAccountSettings = true;
435
439
  },
436
440
  updateAccountSettingsListForAccountTypes(draft, action) {
437
441
  doUpdateAccountSettingsListForAccountTypes(draft.accountSettings, action.payload.accountPayload);
@@ -747,4 +751,5 @@ const doUpdateAccountSettingsListForAccountTypes = (draft, accountPayloadList) =
747
751
  error: undefined,
748
752
  fetchState: 'Completed',
749
753
  };
754
+ draft.hasLoadedAccountSettings = true;
750
755
  };
@@ -12,6 +12,7 @@ export interface JEAccountSettingsView extends SelectorView {
12
12
  fixedAssetsAccountHierarchy: NestedAccountHierarchyForReport[];
13
13
  fixedAssetsAccountList: AccountBase[];
14
14
  fixedAssetsRecommendations: Recommendation[];
15
+ hasLoaded: boolean;
15
16
  prepaidExpensesAccountHierarchy: NestedAccountHierarchyForReport[];
16
17
  prepaidExpensesAccountList: AccountBase[];
17
18
  prepaidExpensesRecommendations: Recommendation[];
@@ -25,6 +25,7 @@ exports.getJEAccountSettingsView = (0, toolkit_1.createSelector)((state) => stat
25
25
  fixedAssetsAccountHierarchy: jeAccountMappingState.fixedAssetsNestedAccountListHierarchy,
26
26
  accruedExpensesAccountHierarchy: jeAccountMappingState.accruedExpensesNestedAccountListHierarchy,
27
27
  fetchState: fetchState.fetchState,
28
+ hasLoaded: jeAccountMappingState.hasLoadedAccountSettings,
28
29
  saveState,
29
30
  };
30
31
  });
@@ -131,6 +131,7 @@ export interface AccountSettingsState {
131
131
  fixedAssetsAccountIdList: ID[];
132
132
  fixedAssetsNestedAccountListHierarchy: NestedAccountHierarchyForReport[];
133
133
  fixedAssetsRecommendations: Recommendation[];
134
+ hasLoadedAccountSettings: boolean;
134
135
  localData: AccountSettingsLocalData;
135
136
  prepaidExpensesAccountIdList: ID[];
136
137
  prepaidExpensesNestedAccountListHierarchy: NestedAccountHierarchyForReport[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "5.2.11-betaRD1",
3
+ "version": "5.2.11-betaRD2",
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",
@@ -1,11 +0,0 @@
1
- import { InvoicingFormOption } from '../invoicingCommonPayload';
2
- import { InvoicingCouponApplyOn, InvoicingCouponDurationType, InvoicingCouponPeriodUnit, InvoicingDiscountType } from './couponPayload';
3
- /**
4
- * Coupon form select options. Single source of truth (CES-owned) for the value
5
- * sets that back the coupon's string-union domain fields; surfaced to the form
6
- * via `getInvoicingCouponFormView` so web-components need not hardcode them.
7
- */
8
- export declare const INVOICING_DISCOUNT_TYPE_OPTIONS: readonly InvoicingFormOption<InvoicingDiscountType>[];
9
- export declare const INVOICING_COUPON_DURATION_TYPE_OPTIONS: readonly InvoicingFormOption<InvoicingCouponDurationType>[];
10
- export declare const INVOICING_COUPON_PERIOD_UNIT_OPTIONS: readonly InvoicingFormOption<InvoicingCouponPeriodUnit>[];
11
- export declare const INVOICING_COUPON_APPLY_ON_OPTIONS: readonly InvoicingFormOption<InvoicingCouponApplyOn>[];
@@ -1,29 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.INVOICING_COUPON_APPLY_ON_OPTIONS = exports.INVOICING_COUPON_PERIOD_UNIT_OPTIONS = exports.INVOICING_COUPON_DURATION_TYPE_OPTIONS = exports.INVOICING_DISCOUNT_TYPE_OPTIONS = void 0;
4
- /**
5
- * Coupon form select options. Single source of truth (CES-owned) for the value
6
- * sets that back the coupon's string-union domain fields; surfaced to the form
7
- * via `getInvoicingCouponFormView` so web-components need not hardcode them.
8
- */
9
- exports.INVOICING_DISCOUNT_TYPE_OPTIONS = [
10
- { label: 'Percentage', value: 'percentage' },
11
- { label: 'Fixed amount', value: 'fixed_amount' },
12
- { label: 'Offer quantity', value: 'offer_quantity' },
13
- ];
14
- exports.INVOICING_COUPON_DURATION_TYPE_OPTIONS = [
15
- { label: 'One time', value: 'one_time' },
16
- { label: 'Forever', value: 'forever' },
17
- { label: 'Limited period', value: 'limited_period' },
18
- ];
19
- exports.INVOICING_COUPON_PERIOD_UNIT_OPTIONS = [
20
- { label: 'Day', value: 'day' },
21
- { label: 'Week', value: 'week' },
22
- { label: 'Month', value: 'month' },
23
- { label: 'Year', value: 'year' },
24
- ];
25
- exports.INVOICING_COUPON_APPLY_ON_OPTIONS = [
26
- { label: 'Invoice amount', value: 'invoice_amount' },
27
- { label: 'Each specified item', value: 'each_specified_item' },
28
- { label: 'Specified items total', value: 'specified_items_total' },
29
- ];
@@ -1,26 +0,0 @@
1
- /**
2
- * Coupon form select options. Single source of truth (CES-owned) for the value
3
- * sets that back the coupon's string-union domain fields; surfaced to the form
4
- * via `getInvoicingCouponFormView` so web-components need not hardcode them.
5
- */
6
- export const INVOICING_DISCOUNT_TYPE_OPTIONS = [
7
- { label: 'Percentage', value: 'percentage' },
8
- { label: 'Fixed amount', value: 'fixed_amount' },
9
- { label: 'Offer quantity', value: 'offer_quantity' },
10
- ];
11
- export const INVOICING_COUPON_DURATION_TYPE_OPTIONS = [
12
- { label: 'One time', value: 'one_time' },
13
- { label: 'Forever', value: 'forever' },
14
- { label: 'Limited period', value: 'limited_period' },
15
- ];
16
- export const INVOICING_COUPON_PERIOD_UNIT_OPTIONS = [
17
- { label: 'Day', value: 'day' },
18
- { label: 'Week', value: 'week' },
19
- { label: 'Month', value: 'month' },
20
- { label: 'Year', value: 'year' },
21
- ];
22
- export const INVOICING_COUPON_APPLY_ON_OPTIONS = [
23
- { label: 'Invoice amount', value: 'invoice_amount' },
24
- { label: 'Each specified item', value: 'each_specified_item' },
25
- { label: 'Specified items total', value: 'specified_items_total' },
26
- ];
@@ -1,25 +0,0 @@
1
- import { of } from 'rxjs';
2
- import { catchError, filter, map, mergeMap } from 'rxjs/operators';
3
- import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
4
- import { mapInvoicingQboAccountOptions, } from '../invoicingQboViewPayload';
5
- import { fetchInvoicingQboAccounts, updateInvoicingQboAccounts, updateInvoicingQboAccountsFailure, } from '../invoicingQboViewReducer';
6
- export const fetchInvoicingQboAccountsEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(fetchInvoicingQboAccounts.match), mergeMap((action) => {
7
- const { accountTypes } = action.payload;
8
- const apiUrl = `${zeniAPI.apiEndPoints.invoicingMicroServiceBaseUrl}/1.0/qbo/accounts?account_types=${encodeURIComponent(accountTypes)}`;
9
- return zeniAPI.getJSON(apiUrl).pipe(map((response) => {
10
- if (isSuccessResponse(response)) {
11
- return updateInvoicingQboAccounts({
12
- accountTypes,
13
- accounts: mapInvoicingQboAccountOptions(response.data?.accounts ?? []),
14
- });
15
- }
16
- return updateInvoicingQboAccountsFailure({
17
- accountTypes,
18
- status: response.status,
19
- });
20
- }), catchError((error) => of(updateInvoicingQboAccountsFailure({
21
- accountTypes,
22
- status: createZeniAPIStatus('Unexpected Error', 'Fetch QBO accounts REST API call errored out ' +
23
- JSON.stringify(error)),
24
- }))));
25
- }));
@@ -1,15 +0,0 @@
1
- import { of } from 'rxjs';
2
- import { catchError, filter, map, switchMap } from 'rxjs/operators';
3
- import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
4
- import { mapInvoicingQboAccountOptions, } from '../invoicingQboViewPayload';
5
- import { fetchInvoicingQboClasses, updateInvoicingQboClasses, updateInvoicingQboClassesFailure, } from '../invoicingQboViewReducer';
6
- export const fetchInvoicingQboClassesEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(fetchInvoicingQboClasses.match), switchMap(() => {
7
- const apiUrl = `${zeniAPI.apiEndPoints.invoicingMicroServiceBaseUrl}/1.0/qbo/classes`;
8
- return zeniAPI.getJSON(apiUrl).pipe(map((response) => {
9
- if (isSuccessResponse(response)) {
10
- return updateInvoicingQboClasses(mapInvoicingQboAccountOptions(response.data?.accounts ?? []));
11
- }
12
- return updateInvoicingQboClassesFailure(response.status);
13
- }), catchError((error) => of(updateInvoicingQboClassesFailure(createZeniAPIStatus('Unexpected Error', 'Fetch QBO classes REST API call errored out ' +
14
- JSON.stringify(error))))));
15
- }));
@@ -1,18 +0,0 @@
1
- import { of } from 'rxjs';
2
- import { catchError, filter, mergeMap, switchMap } from 'rxjs/operators';
3
- import { updateTreasuryPromoIntroClosedByOutsideClickForLoggedInUser } from '../../../../../entity/tenant/tenantReducer';
4
- import { createZeniAPIStatus, isSuccessStatus, } from '../../../../../responsePayload';
5
- import { updateTreasuryPromoIntroClosedByOutsideClick, updateTreasuryPromoIntroClosedByOutsideClickFailure, updateTreasuryPromoIntroClosedByOutsideClickSuccess, } from '../treasurySetupViewReducer';
6
- export const updateTreasuryPromoIntroClosedByOutsideClickEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(updateTreasuryPromoIntroClosedByOutsideClick.match), switchMap(() => {
7
- return zeniAPI
8
- .putAndGetJSON(`${zeniAPI.apiEndPoints.tenantMicroServiceBaseUrl}/1.0/user/self`, { is_treasury_promo_intro_closed_by_outside_click: true })
9
- .pipe(mergeMap((response) => {
10
- if (isSuccessStatus(response)) {
11
- return of(updateTreasuryPromoIntroClosedByOutsideClickForLoggedInUser(), updateTreasuryPromoIntroClosedByOutsideClickSuccess());
12
- }
13
- else {
14
- return of(updateTreasuryPromoIntroClosedByOutsideClickFailure(response.status));
15
- }
16
- }), catchError((error) => of(updateTreasuryPromoIntroClosedByOutsideClickFailure(createZeniAPIStatus('Unexpected error', 'Update treasury promo intro closed by outside click REST API call errored out' +
17
- (error?.message ?? JSON.stringify(error)))))));
18
- }));
@@ -1,18 +0,0 @@
1
- import { of } from 'rxjs';
2
- import { catchError, filter, mergeMap, switchMap } from 'rxjs/operators';
3
- import { updateTreasuryPromoRemindMeLaterClickedForLoggedInUser } from '../../../../../entity/tenant/tenantReducer';
4
- import { createZeniAPIStatus, isSuccessStatus, } from '../../../../../responsePayload';
5
- import { updateTreasuryPromoRemindMeLaterClicked, updateTreasuryPromoRemindMeLaterClickedFailure, updateTreasuryPromoRemindMeLaterClickedSuccess, } from '../treasurySetupViewReducer';
6
- export const updateTreasuryPromoRemindMeLaterClickedEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(updateTreasuryPromoRemindMeLaterClicked.match), switchMap(() => {
7
- return zeniAPI
8
- .putAndGetJSON(`${zeniAPI.apiEndPoints.tenantMicroServiceBaseUrl}/1.0/user/self`, { is_treasury_promo_video_remind_me_later_clicked: true })
9
- .pipe(mergeMap((response) => {
10
- if (isSuccessStatus(response)) {
11
- return of(updateTreasuryPromoRemindMeLaterClickedForLoggedInUser(), updateTreasuryPromoRemindMeLaterClickedSuccess());
12
- }
13
- else {
14
- return of(updateTreasuryPromoRemindMeLaterClickedFailure(response.status));
15
- }
16
- }), catchError((error) => of(updateTreasuryPromoRemindMeLaterClickedFailure(createZeniAPIStatus('Unexpected error', 'Update treasury promo remind me later REST API call errored out' +
17
- (error?.message ?? JSON.stringify(error)))))));
18
- }));
@@ -1,18 +0,0 @@
1
- import { of } from 'rxjs';
2
- import { catchError, filter, mergeMap, switchMap } from 'rxjs/operators';
3
- import { updateTreasuryVideoViewedForLoggedInUser } from '../../../../../entity/tenant/tenantReducer';
4
- import { createZeniAPIStatus, isSuccessStatus, } from '../../../../../responsePayload';
5
- import { updateTreasuryVideoViewed, updateTreasuryVideoViewedFailure, updateTreasuryVideoViewedSuccess, } from '../treasurySetupViewReducer';
6
- export const updateTreasuryVideoViewedEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(updateTreasuryVideoViewed.match), switchMap(() => {
7
- return zeniAPI
8
- .putAndGetJSON(`${zeniAPI.apiEndPoints.tenantMicroServiceBaseUrl}/1.0/user/self`, { is_treasury_promo_video_played: true })
9
- .pipe(mergeMap((response) => {
10
- if (isSuccessStatus(response)) {
11
- return of(updateTreasuryVideoViewedForLoggedInUser(), updateTreasuryVideoViewedSuccess());
12
- }
13
- else {
14
- return of(updateTreasuryVideoViewedFailure(response.status));
15
- }
16
- }), catchError((error) => of(updateTreasuryVideoViewedFailure(createZeniAPIStatus('Unexpected error', 'Update treasury video viewed REST API call errored out' +
17
- (error?.message ?? JSON.stringify(error)))))));
18
- }));
@@ -1,16 +0,0 @@
1
- import { of } from 'rxjs';
2
- import { catchError, filter, mergeMap, switchMap } from 'rxjs/operators';
3
- import { createZeniAPIStatus, isSuccessResponse } from '../../responsePayload';
4
- import { fetchZeniAccountsPromoCard, updateZeniAccountsPromoCard, updateZeniAccountsPromoCardFailure, } from './zeniAccountsPromoCardReducer';
5
- export const fetchZeniAccountsPromoCardEpic = (actions$, _, zeniAPI) => actions$.pipe(filter(fetchZeniAccountsPromoCard.match), switchMap(() => zeniAPI
6
- .getJSON(`${zeniAPI.apiEndPoints.bankingMicroServiceBaseUrl}/1.0/deposit-accounts/promo-card`)
7
- .pipe(mergeMap((response) => {
8
- if (isSuccessResponse(response)) {
9
- return of(updateZeniAccountsPromoCard(response.data) // eslint-disable-line @typescript-eslint/no-non-null-assertion
10
- );
11
- }
12
- else {
13
- return of(updateZeniAccountsPromoCardFailure(response.status));
14
- }
15
- }), catchError((error) => of(updateZeniAccountsPromoCardFailure(createZeniAPIStatus('Unexpected error', 'Zeni Accounts Promo Card REST API call errored out' +
16
- JSON.stringify(error))))))));
@@ -1,60 +0,0 @@
1
- import { createSlice } from '@reduxjs/toolkit';
2
- import { clearAll } from '../../rootActions';
3
- export const initialState = {
4
- fetchState: 'Not-Started',
5
- error: undefined,
6
- depositAccountId: undefined,
7
- maxInsuredAmount: 0,
8
- maxAnnualPercentageYield: 0,
9
- maxPossibleInterest: 0,
10
- maxCashBalanceAvailable: 0,
11
- isShowDepositAccountsPromo: false,
12
- hasValidState() {
13
- return this.fetchState == 'Completed';
14
- },
15
- };
16
- const zeniAccountsPromoCard = createSlice({
17
- name: 'zeniAccountsPromoCard',
18
- initialState,
19
- reducers: {
20
- fetchZeniAccountsPromoCard(draft) {
21
- draft.fetchState = 'In-Progress';
22
- draft.error = undefined;
23
- },
24
- updateZeniAccountsPromoCard(draft, action) {
25
- draft.fetchState = 'Completed';
26
- draft.error = undefined;
27
- const promoPayload = action.payload;
28
- draft.isShowDepositAccountsPromo =
29
- promoPayload.is_show_deposit_accounts_promo_card;
30
- draft.maxAnnualPercentageYield = promoPayload.max_apy;
31
- draft.maxPossibleInterest =
32
- promoPayload.max_possible_interest != null
33
- ? promoPayload.max_possible_interest
34
- : undefined;
35
- draft.maxCashBalanceAvailable =
36
- promoPayload.max_cash_balance_available != null
37
- ? promoPayload.max_cash_balance_available
38
- : undefined;
39
- draft.maxInsuredAmount = promoPayload.max_insured_amount;
40
- draft.depositAccountId =
41
- promoPayload.primary_deposit_account_id != null
42
- ? promoPayload.primary_deposit_account_id
43
- : undefined;
44
- },
45
- updateZeniAccountsPromoCardFailure(draft, action) {
46
- draft.fetchState = 'Error';
47
- draft.error = action.payload;
48
- },
49
- clearZeniAccountsPromoCard(draft) {
50
- Object.assign(draft, initialState);
51
- },
52
- },
53
- extraReducers: (builder) => {
54
- builder.addCase(clearAll, (draft) => {
55
- Object.assign(draft, initialState);
56
- });
57
- },
58
- });
59
- export const { fetchZeniAccountsPromoCard, updateZeniAccountsPromoCard, updateZeniAccountsPromoCardFailure, clearZeniAccountsPromoCard, } = zeniAccountsPromoCard.actions;
60
- export default zeniAccountsPromoCard.reducer;
@@ -1,12 +0,0 @@
1
- import { createSelector } from '@reduxjs/toolkit';
2
- export const getZeniAccountsPromoCard = createSelector((state) => state.zeniAccountsPromoCardState, (zeniAccountsPromoCardState) => ({
3
- isShowDepositAccountsPromo: zeniAccountsPromoCardState.isShowDepositAccountsPromo,
4
- maxAnnualPercentageYield: zeniAccountsPromoCardState.maxAnnualPercentageYield,
5
- maxPossibleInterest: zeniAccountsPromoCardState.maxPossibleInterest,
6
- maxCashBalanceAvailable: zeniAccountsPromoCardState.maxCashBalanceAvailable,
7
- maxInsuredAmount: zeniAccountsPromoCardState.maxInsuredAmount,
8
- depositAccountId: zeniAccountsPromoCardState.depositAccountId,
9
- reportId: 'zeni_accounts_promo_card',
10
- fetchState: zeniAccountsPromoCardState.fetchState,
11
- error: zeniAccountsPromoCardState.error,
12
- }));
@@ -1,6 +0,0 @@
1
- import { ActionsObservable, StateObservable } from 'redux-observable';
2
- import { Observable } from 'rxjs';
3
- import { RootState } from '../../../../reducer';
4
- import { ZeniAPI } from '../../../../zeniAPI';
5
- import { InvoicingQboViewActionType } from './invoicingQboViewActionType';
6
- export declare const fetchInvoicingQboAccountsEpic: (actions$: ActionsObservable<InvoicingQboViewActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<InvoicingQboViewActionType>;
@@ -1,29 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.fetchInvoicingQboAccountsEpic = void 0;
4
- const rxjs_1 = require("rxjs");
5
- const operators_1 = require("rxjs/operators");
6
- const responsePayload_1 = require("../../../../responsePayload");
7
- const invoicingQboViewPayload_1 = require("../invoicingQboViewPayload");
8
- const invoicingQboViewReducer_1 = require("../invoicingQboViewReducer");
9
- const fetchInvoicingQboAccountsEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(invoicingQboViewReducer_1.fetchInvoicingQboAccounts.match), (0, operators_1.mergeMap)((action) => {
10
- const { accountTypes } = action.payload;
11
- const apiUrl = `${zeniAPI.apiEndPoints.invoicingMicroServiceBaseUrl}/1.0/qbo/accounts?account_types=${encodeURIComponent(accountTypes)}`;
12
- return zeniAPI.getJSON(apiUrl).pipe((0, operators_1.map)((response) => {
13
- if ((0, responsePayload_1.isSuccessResponse)(response)) {
14
- return (0, invoicingQboViewReducer_1.updateInvoicingQboAccounts)({
15
- accountTypes,
16
- accounts: (0, invoicingQboViewPayload_1.mapInvoicingQboAccountOptions)(response.data?.accounts ?? []),
17
- });
18
- }
19
- return (0, invoicingQboViewReducer_1.updateInvoicingQboAccountsFailure)({
20
- accountTypes,
21
- status: response.status,
22
- });
23
- }), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, invoicingQboViewReducer_1.updateInvoicingQboAccountsFailure)({
24
- accountTypes,
25
- status: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Fetch QBO accounts REST API call errored out ' +
26
- JSON.stringify(error)),
27
- }))));
28
- }));
29
- exports.fetchInvoicingQboAccountsEpic = fetchInvoicingQboAccountsEpic;
@@ -1,6 +0,0 @@
1
- import { ActionsObservable, StateObservable } from 'redux-observable';
2
- import { Observable } from 'rxjs';
3
- import { RootState } from '../../../../reducer';
4
- import { ZeniAPI } from '../../../../zeniAPI';
5
- import { InvoicingQboViewActionType } from './invoicingQboViewActionType';
6
- export declare const fetchInvoicingQboClassesEpic: (actions$: ActionsObservable<InvoicingQboViewActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<InvoicingQboViewActionType>;
@@ -1,19 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.fetchInvoicingQboClassesEpic = void 0;
4
- const rxjs_1 = require("rxjs");
5
- const operators_1 = require("rxjs/operators");
6
- const responsePayload_1 = require("../../../../responsePayload");
7
- const invoicingQboViewPayload_1 = require("../invoicingQboViewPayload");
8
- const invoicingQboViewReducer_1 = require("../invoicingQboViewReducer");
9
- const fetchInvoicingQboClassesEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(invoicingQboViewReducer_1.fetchInvoicingQboClasses.match), (0, operators_1.switchMap)(() => {
10
- const apiUrl = `${zeniAPI.apiEndPoints.invoicingMicroServiceBaseUrl}/1.0/qbo/classes`;
11
- return zeniAPI.getJSON(apiUrl).pipe((0, operators_1.map)((response) => {
12
- if ((0, responsePayload_1.isSuccessResponse)(response)) {
13
- return (0, invoicingQboViewReducer_1.updateInvoicingQboClasses)((0, invoicingQboViewPayload_1.mapInvoicingQboAccountOptions)(response.data?.accounts ?? []));
14
- }
15
- return (0, invoicingQboViewReducer_1.updateInvoicingQboClassesFailure)(response.status);
16
- }), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, invoicingQboViewReducer_1.updateInvoicingQboClassesFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Fetch QBO classes REST API call errored out ' +
17
- JSON.stringify(error))))));
18
- }));
19
- exports.fetchInvoicingQboClassesEpic = fetchInvoicingQboClassesEpic;
@@ -1,8 +0,0 @@
1
- import { ActionsObservable, StateObservable } from 'redux-observable';
2
- import { Observable } from 'rxjs';
3
- import { updateTreasuryPromoIntroClosedByOutsideClickForLoggedInUser } from '../../../../../entity/tenant/tenantReducer';
4
- import { RootState } from '../../../../../reducer';
5
- import { ZeniAPI } from '../../../../../zeniAPI';
6
- import { updateTreasuryPromoIntroClosedByOutsideClick, updateTreasuryPromoIntroClosedByOutsideClickFailure, updateTreasuryPromoIntroClosedByOutsideClickSuccess } from '../treasurySetupViewReducer';
7
- export type ActionType = ReturnType<typeof updateTreasuryPromoIntroClosedByOutsideClick> | ReturnType<typeof updateTreasuryPromoIntroClosedByOutsideClickForLoggedInUser> | ReturnType<typeof updateTreasuryPromoIntroClosedByOutsideClickSuccess> | ReturnType<typeof updateTreasuryPromoIntroClosedByOutsideClickFailure>;
8
- export declare const updateTreasuryPromoIntroClosedByOutsideClickEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
@@ -1,22 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.updateTreasuryPromoIntroClosedByOutsideClickEpic = void 0;
4
- const rxjs_1 = require("rxjs");
5
- const operators_1 = require("rxjs/operators");
6
- const tenantReducer_1 = require("../../../../../entity/tenant/tenantReducer");
7
- const responsePayload_1 = require("../../../../../responsePayload");
8
- const treasurySetupViewReducer_1 = require("../treasurySetupViewReducer");
9
- const updateTreasuryPromoIntroClosedByOutsideClickEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(treasurySetupViewReducer_1.updateTreasuryPromoIntroClosedByOutsideClick.match), (0, operators_1.switchMap)(() => {
10
- return zeniAPI
11
- .putAndGetJSON(`${zeniAPI.apiEndPoints.tenantMicroServiceBaseUrl}/1.0/user/self`, { is_treasury_promo_intro_closed_by_outside_click: true })
12
- .pipe((0, operators_1.mergeMap)((response) => {
13
- if ((0, responsePayload_1.isSuccessStatus)(response)) {
14
- return (0, rxjs_1.of)((0, tenantReducer_1.updateTreasuryPromoIntroClosedByOutsideClickForLoggedInUser)(), (0, treasurySetupViewReducer_1.updateTreasuryPromoIntroClosedByOutsideClickSuccess)());
15
- }
16
- else {
17
- return (0, rxjs_1.of)((0, treasurySetupViewReducer_1.updateTreasuryPromoIntroClosedByOutsideClickFailure)(response.status));
18
- }
19
- }), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, treasurySetupViewReducer_1.updateTreasuryPromoIntroClosedByOutsideClickFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected error', 'Update treasury promo intro closed by outside click REST API call errored out' +
20
- (error?.message ?? JSON.stringify(error)))))));
21
- }));
22
- exports.updateTreasuryPromoIntroClosedByOutsideClickEpic = updateTreasuryPromoIntroClosedByOutsideClickEpic;
@@ -1,8 +0,0 @@
1
- import { ActionsObservable, StateObservable } from 'redux-observable';
2
- import { Observable } from 'rxjs';
3
- import { updateTreasuryPromoRemindMeLaterClickedForLoggedInUser } from '../../../../../entity/tenant/tenantReducer';
4
- import { RootState } from '../../../../../reducer';
5
- import { ZeniAPI } from '../../../../../zeniAPI';
6
- import { updateTreasuryPromoRemindMeLaterClicked, updateTreasuryPromoRemindMeLaterClickedFailure, updateTreasuryPromoRemindMeLaterClickedSuccess } from '../treasurySetupViewReducer';
7
- export type ActionType = ReturnType<typeof updateTreasuryPromoRemindMeLaterClicked> | ReturnType<typeof updateTreasuryPromoRemindMeLaterClickedForLoggedInUser> | ReturnType<typeof updateTreasuryPromoRemindMeLaterClickedSuccess> | ReturnType<typeof updateTreasuryPromoRemindMeLaterClickedFailure>;
8
- export declare const updateTreasuryPromoRemindMeLaterClickedEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
@@ -1,22 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.updateTreasuryPromoRemindMeLaterClickedEpic = void 0;
4
- const rxjs_1 = require("rxjs");
5
- const operators_1 = require("rxjs/operators");
6
- const tenantReducer_1 = require("../../../../../entity/tenant/tenantReducer");
7
- const responsePayload_1 = require("../../../../../responsePayload");
8
- const treasurySetupViewReducer_1 = require("../treasurySetupViewReducer");
9
- const updateTreasuryPromoRemindMeLaterClickedEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(treasurySetupViewReducer_1.updateTreasuryPromoRemindMeLaterClicked.match), (0, operators_1.switchMap)(() => {
10
- return zeniAPI
11
- .putAndGetJSON(`${zeniAPI.apiEndPoints.tenantMicroServiceBaseUrl}/1.0/user/self`, { is_treasury_promo_video_remind_me_later_clicked: true })
12
- .pipe((0, operators_1.mergeMap)((response) => {
13
- if ((0, responsePayload_1.isSuccessStatus)(response)) {
14
- return (0, rxjs_1.of)((0, tenantReducer_1.updateTreasuryPromoRemindMeLaterClickedForLoggedInUser)(), (0, treasurySetupViewReducer_1.updateTreasuryPromoRemindMeLaterClickedSuccess)());
15
- }
16
- else {
17
- return (0, rxjs_1.of)((0, treasurySetupViewReducer_1.updateTreasuryPromoRemindMeLaterClickedFailure)(response.status));
18
- }
19
- }), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, treasurySetupViewReducer_1.updateTreasuryPromoRemindMeLaterClickedFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected error', 'Update treasury promo remind me later REST API call errored out' +
20
- (error?.message ?? JSON.stringify(error)))))));
21
- }));
22
- exports.updateTreasuryPromoRemindMeLaterClickedEpic = updateTreasuryPromoRemindMeLaterClickedEpic;
@@ -1,8 +0,0 @@
1
- import { ActionsObservable, StateObservable } from 'redux-observable';
2
- import { Observable } from 'rxjs';
3
- import { updateTreasuryVideoViewedForLoggedInUser } from '../../../../../entity/tenant/tenantReducer';
4
- import { RootState } from '../../../../../reducer';
5
- import { ZeniAPI } from '../../../../../zeniAPI';
6
- import { updateTreasuryVideoViewed, updateTreasuryVideoViewedFailure, updateTreasuryVideoViewedSuccess } from '../treasurySetupViewReducer';
7
- export type ActionType = ReturnType<typeof updateTreasuryVideoViewed> | ReturnType<typeof updateTreasuryVideoViewedForLoggedInUser> | ReturnType<typeof updateTreasuryVideoViewedSuccess> | ReturnType<typeof updateTreasuryVideoViewedFailure>;
8
- export declare const updateTreasuryVideoViewedEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
@@ -1,22 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.updateTreasuryVideoViewedEpic = void 0;
4
- const rxjs_1 = require("rxjs");
5
- const operators_1 = require("rxjs/operators");
6
- const tenantReducer_1 = require("../../../../../entity/tenant/tenantReducer");
7
- const responsePayload_1 = require("../../../../../responsePayload");
8
- const treasurySetupViewReducer_1 = require("../treasurySetupViewReducer");
9
- const updateTreasuryVideoViewedEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(treasurySetupViewReducer_1.updateTreasuryVideoViewed.match), (0, operators_1.switchMap)(() => {
10
- return zeniAPI
11
- .putAndGetJSON(`${zeniAPI.apiEndPoints.tenantMicroServiceBaseUrl}/1.0/user/self`, { is_treasury_promo_video_played: true })
12
- .pipe((0, operators_1.mergeMap)((response) => {
13
- if ((0, responsePayload_1.isSuccessStatus)(response)) {
14
- return (0, rxjs_1.of)((0, tenantReducer_1.updateTreasuryVideoViewedForLoggedInUser)(), (0, treasurySetupViewReducer_1.updateTreasuryVideoViewedSuccess)());
15
- }
16
- else {
17
- return (0, rxjs_1.of)((0, treasurySetupViewReducer_1.updateTreasuryVideoViewedFailure)(response.status));
18
- }
19
- }), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, treasurySetupViewReducer_1.updateTreasuryVideoViewedFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected error', 'Update treasury video viewed REST API call errored out' +
20
- (error?.message ?? JSON.stringify(error)))))));
21
- }));
22
- exports.updateTreasuryVideoViewedEpic = updateTreasuryVideoViewedEpic;
@@ -1,13 +0,0 @@
1
- import { ActionsObservable, StateObservable } from 'redux-observable';
2
- import { updateAccounts } from '../../entity/account/accountReducer';
3
- import { RootState } from '../../reducer';
4
- import { ZeniAPI } from '../../zeniAPI';
5
- import { fetchZeniAccountsPromoCard, updateZeniAccountsPromoCard, updateZeniAccountsPromoCardFailure } from './zeniAccountsPromoCardReducer';
6
- export type ActionType = ReturnType<typeof fetchZeniAccountsPromoCard> | ReturnType<typeof updateZeniAccountsPromoCard> | ReturnType<typeof updateZeniAccountsPromoCardFailure> | ReturnType<typeof updateAccounts>;
7
- export declare const fetchZeniAccountsPromoCardEpic: (actions$: ActionsObservable<ActionType>, _: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<{
8
- payload: import("./zeniAccountsPromoCardPayload").ZeniAccountsPromoCardPayload;
9
- type: "zeniAccountsPromoCard/updateZeniAccountsPromoCard";
10
- } | {
11
- payload: import("../../responsePayload").ZeniAPIStatus<Record<string, unknown>>;
12
- type: "zeniAccountsPromoCard/updateZeniAccountsPromoCardFailure";
13
- }>;
@@ -1,20 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.fetchZeniAccountsPromoCardEpic = void 0;
4
- const rxjs_1 = require("rxjs");
5
- const operators_1 = require("rxjs/operators");
6
- const responsePayload_1 = require("../../responsePayload");
7
- const zeniAccountsPromoCardReducer_1 = require("./zeniAccountsPromoCardReducer");
8
- const fetchZeniAccountsPromoCardEpic = (actions$, _, zeniAPI) => actions$.pipe((0, operators_1.filter)(zeniAccountsPromoCardReducer_1.fetchZeniAccountsPromoCard.match), (0, operators_1.switchMap)(() => zeniAPI
9
- .getJSON(`${zeniAPI.apiEndPoints.bankingMicroServiceBaseUrl}/1.0/deposit-accounts/promo-card`)
10
- .pipe((0, operators_1.mergeMap)((response) => {
11
- if ((0, responsePayload_1.isSuccessResponse)(response)) {
12
- return (0, rxjs_1.of)((0, zeniAccountsPromoCardReducer_1.updateZeniAccountsPromoCard)(response.data) // eslint-disable-line @typescript-eslint/no-non-null-assertion
13
- );
14
- }
15
- else {
16
- return (0, rxjs_1.of)((0, zeniAccountsPromoCardReducer_1.updateZeniAccountsPromoCardFailure)(response.status));
17
- }
18
- }), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, zeniAccountsPromoCardReducer_1.updateZeniAccountsPromoCardFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected error', 'Zeni Accounts Promo Card REST API call errored out' +
19
- JSON.stringify(error))))))));
20
- exports.fetchZeniAccountsPromoCardEpic = fetchZeniAccountsPromoCardEpic;
@@ -1,11 +0,0 @@
1
- import { ID } from '../../commonStateTypes/common';
2
- import { ZeniAPIResponse } from '../../responsePayload';
3
- export interface ZeniAccountsPromoCardPayload {
4
- is_show_deposit_accounts_promo_card: boolean;
5
- max_apy: number;
6
- max_cash_balance_available: number | null;
7
- max_insured_amount: number;
8
- max_possible_interest: number | null;
9
- primary_deposit_account_id: ID | null;
10
- }
11
- export type ZeniAccountsPromoCardResponse = ZeniAPIResponse<ZeniAccountsPromoCardPayload>;
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,7 +0,0 @@
1
- import { ZeniAPIStatus } from '../../responsePayload';
2
- import { ZeniAccountsPromoCardPayload } from './zeniAccountsPromoCardPayload';
3
- import { ZeniAccountsPromoCardState } from './zeniAccountsPromoCardState';
4
- export declare const initialState: ZeniAccountsPromoCardState;
5
- export declare const fetchZeniAccountsPromoCard: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"zeniAccountsPromoCard/fetchZeniAccountsPromoCard">, updateZeniAccountsPromoCard: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAccountsPromoCardPayload, "zeniAccountsPromoCard/updateZeniAccountsPromoCard">, updateZeniAccountsPromoCardFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "zeniAccountsPromoCard/updateZeniAccountsPromoCardFailure">, clearZeniAccountsPromoCard: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"zeniAccountsPromoCard/clearZeniAccountsPromoCard">;
6
- declare const _default: import("redux").Reducer<ZeniAccountsPromoCardState>;
7
- export default _default;
@@ -1,64 +0,0 @@
1
- "use strict";
2
- var _a;
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.clearZeniAccountsPromoCard = exports.updateZeniAccountsPromoCardFailure = exports.updateZeniAccountsPromoCard = exports.fetchZeniAccountsPromoCard = exports.initialState = void 0;
5
- const toolkit_1 = require("@reduxjs/toolkit");
6
- const rootActions_1 = require("../../rootActions");
7
- exports.initialState = {
8
- fetchState: 'Not-Started',
9
- error: undefined,
10
- depositAccountId: undefined,
11
- maxInsuredAmount: 0,
12
- maxAnnualPercentageYield: 0,
13
- maxPossibleInterest: 0,
14
- maxCashBalanceAvailable: 0,
15
- isShowDepositAccountsPromo: false,
16
- hasValidState() {
17
- return this.fetchState == 'Completed';
18
- },
19
- };
20
- const zeniAccountsPromoCard = (0, toolkit_1.createSlice)({
21
- name: 'zeniAccountsPromoCard',
22
- initialState: exports.initialState,
23
- reducers: {
24
- fetchZeniAccountsPromoCard(draft) {
25
- draft.fetchState = 'In-Progress';
26
- draft.error = undefined;
27
- },
28
- updateZeniAccountsPromoCard(draft, action) {
29
- draft.fetchState = 'Completed';
30
- draft.error = undefined;
31
- const promoPayload = action.payload;
32
- draft.isShowDepositAccountsPromo =
33
- promoPayload.is_show_deposit_accounts_promo_card;
34
- draft.maxAnnualPercentageYield = promoPayload.max_apy;
35
- draft.maxPossibleInterest =
36
- promoPayload.max_possible_interest != null
37
- ? promoPayload.max_possible_interest
38
- : undefined;
39
- draft.maxCashBalanceAvailable =
40
- promoPayload.max_cash_balance_available != null
41
- ? promoPayload.max_cash_balance_available
42
- : undefined;
43
- draft.maxInsuredAmount = promoPayload.max_insured_amount;
44
- draft.depositAccountId =
45
- promoPayload.primary_deposit_account_id != null
46
- ? promoPayload.primary_deposit_account_id
47
- : undefined;
48
- },
49
- updateZeniAccountsPromoCardFailure(draft, action) {
50
- draft.fetchState = 'Error';
51
- draft.error = action.payload;
52
- },
53
- clearZeniAccountsPromoCard(draft) {
54
- Object.assign(draft, exports.initialState);
55
- },
56
- },
57
- extraReducers: (builder) => {
58
- builder.addCase(rootActions_1.clearAll, (draft) => {
59
- Object.assign(draft, exports.initialState);
60
- });
61
- },
62
- });
63
- _a = zeniAccountsPromoCard.actions, exports.fetchZeniAccountsPromoCard = _a.fetchZeniAccountsPromoCard, exports.updateZeniAccountsPromoCard = _a.updateZeniAccountsPromoCard, exports.updateZeniAccountsPromoCardFailure = _a.updateZeniAccountsPromoCardFailure, exports.clearZeniAccountsPromoCard = _a.clearZeniAccountsPromoCard;
64
- exports.default = zeniAccountsPromoCard.reducer;
@@ -1,12 +0,0 @@
1
- import { ID } from '../../commonStateTypes/common';
2
- import { SelectorView } from '../../commonStateTypes/viewAndReport/viewAndReport';
3
- import { RootState } from '../../reducer';
4
- export interface ZeniAccountsPromoCardReport extends SelectorView {
5
- isShowDepositAccountsPromo: boolean;
6
- maxAnnualPercentageYield: number;
7
- maxInsuredAmount: number;
8
- depositAccountId?: ID;
9
- maxCashBalanceAvailable?: number;
10
- maxPossibleInterest?: number;
11
- }
12
- export declare const getZeniAccountsPromoCard: (state: RootState) => ZeniAccountsPromoCardReport;
@@ -1,15 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getZeniAccountsPromoCard = void 0;
4
- const toolkit_1 = require("@reduxjs/toolkit");
5
- exports.getZeniAccountsPromoCard = (0, toolkit_1.createSelector)((state) => state.zeniAccountsPromoCardState, (zeniAccountsPromoCardState) => ({
6
- isShowDepositAccountsPromo: zeniAccountsPromoCardState.isShowDepositAccountsPromo,
7
- maxAnnualPercentageYield: zeniAccountsPromoCardState.maxAnnualPercentageYield,
8
- maxPossibleInterest: zeniAccountsPromoCardState.maxPossibleInterest,
9
- maxCashBalanceAvailable: zeniAccountsPromoCardState.maxCashBalanceAvailable,
10
- maxInsuredAmount: zeniAccountsPromoCardState.maxInsuredAmount,
11
- depositAccountId: zeniAccountsPromoCardState.depositAccountId,
12
- reportId: 'zeni_accounts_promo_card',
13
- fetchState: zeniAccountsPromoCardState.fetchState,
14
- error: zeniAccountsPromoCardState.error,
15
- }));
@@ -1,9 +0,0 @@
1
- import { FetchedState, ID } from '../../commonStateTypes/common';
2
- export interface ZeniAccountsPromoCardState extends FetchedState {
3
- isShowDepositAccountsPromo: boolean;
4
- maxAnnualPercentageYield: number;
5
- maxInsuredAmount: number;
6
- depositAccountId?: ID;
7
- maxCashBalanceAvailable?: number;
8
- maxPossibleInterest?: number;
9
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });