@zeniai/client-epic-state 4.11.5 → 4.11.6

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 (56) hide show
  1. package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
  2. package/lib/entity/snackbar/snackbarTypes.js +0 -4
  3. package/lib/entity/tenant/clearAllEpic.d.ts +2 -4
  4. package/lib/entity/tenant/clearAllEpic.js +0 -4
  5. package/lib/entity/toastNotification/epic/pushToastNotificationEpic.d.ts +1 -1
  6. package/lib/epic.d.ts +1 -5
  7. package/lib/epic.js +1 -5
  8. package/lib/index.d.ts +2 -7
  9. package/lib/index.js +9 -18
  10. package/lib/reducer.d.ts +0 -6
  11. package/lib/reducer.js +0 -6
  12. package/lib/view/onboardingView/customerView/epic/customerDetails/updateOnboardingCustomerViewLocalStoreDataEpic.js +1 -1
  13. package/lib/view/onboardingView/customerView/onboardingCustomerViewReducer.js +0 -1
  14. package/lib/view/onboardingView/customerView/onboardingCustomerViewSelector.d.ts +1 -1
  15. package/lib/view/onboardingView/customerView/onboardingCustomerViewSelector.js +14 -6
  16. package/lib/view/onboardingView/customerView/onboardingCustomerViewState.d.ts +0 -1
  17. package/lib/view/people/changeZeniPersonRolesEpic.d.ts +1 -1
  18. package/lib/view/people/deletePersonEpic.d.ts +1 -1
  19. package/lib/view/people/invitePeopleEpic.d.ts +1 -1
  20. package/lib/view/people/inviteZeniPeopleEpic.d.ts +1 -1
  21. package/lib/view/people/resendInviteEpic.d.ts +1 -1
  22. package/lib/view/settingsView/epic/saveNotificationSettingsEpic.d.ts +1 -1
  23. package/lib/view/spendManagement/zeniAccounts/zeniAccountSetUp/zeniAccountSetupViewReducer.d.ts +2 -2
  24. package/lib/view/spendManagement/zeniAccounts/zeniAccountSetUp/zeniAccountSetupViewReducer.js +2 -9
  25. package/lib/view/spendManagement/zeniAccounts/zeniAccountSetUp/zeniAccountSetupViewSelector.d.ts +0 -2
  26. package/lib/view/spendManagement/zeniAccounts/zeniAccountSetUp/zeniAccountSetupViewSelector.js +1 -1
  27. package/lib/view/spendManagement/zeniAccounts/zeniAccountSetUp/zeniAccountSetupViewState.d.ts +0 -4
  28. package/lib/view/tagView/epics/createTagEpic.d.ts +1 -1
  29. package/lib/view/tagView/epics/deleteTagEpic.d.ts +1 -1
  30. package/lib/view/transactionDetail/epics/saveTransactionHelper.js +4 -1
  31. package/lib/view/transactionDetail/epics/updateTransactionDetailEpic.js +21 -11
  32. package/package.json +1 -2
  33. package/lib/entity/cardPayment/cardPaymentPayload.d.ts +0 -26
  34. package/lib/entity/cardPayment/cardPaymentPayload.js +0 -28
  35. package/lib/entity/cardPayment/cardPaymentReducer.d.ts +0 -11
  36. package/lib/entity/cardPayment/cardPaymentReducer.js +0 -59
  37. package/lib/entity/cardPayment/cardPaymentSelector.d.ts +0 -6
  38. package/lib/entity/cardPayment/cardPaymentSelector.js +0 -27
  39. package/lib/entity/cardPayment/cardPaymentState.d.ts +0 -28
  40. package/lib/entity/cardPayment/cardPaymentState.js +0 -2
  41. package/lib/view/cardPayment/cardPaymentViewPayload.d.ts +0 -37
  42. package/lib/view/cardPayment/cardPaymentViewPayload.js +0 -2
  43. package/lib/view/cardPayment/cardPaymentViewReducer.d.ts +0 -32
  44. package/lib/view/cardPayment/cardPaymentViewReducer.js +0 -125
  45. package/lib/view/cardPayment/cardPaymentViewSelector.d.ts +0 -16
  46. package/lib/view/cardPayment/cardPaymentViewSelector.js +0 -24
  47. package/lib/view/cardPayment/cardPaymentViewState.d.ts +0 -19
  48. package/lib/view/cardPayment/cardPaymentViewState.js +0 -2
  49. package/lib/view/cardPayment/epic/addCardPaymentSourceEpic.d.ts +0 -34
  50. package/lib/view/cardPayment/epic/addCardPaymentSourceEpic.js +0 -76
  51. package/lib/view/cardPayment/epic/confirmCardSetupEpic.d.ts +0 -25
  52. package/lib/view/cardPayment/epic/confirmCardSetupEpic.js +0 -50
  53. package/lib/view/cardPayment/epic/createCardSetupIntentEpic.d.ts +0 -27
  54. package/lib/view/cardPayment/epic/createCardSetupIntentEpic.js +0 -62
  55. package/lib/view/cardPayment/epic/fetchPaymentSourcesEpic.d.ts +0 -31
  56. package/lib/view/cardPayment/epic/fetchPaymentSourcesEpic.js +0 -69
@@ -1,59 +0,0 @@
1
- "use strict";
2
- var _a;
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.clearAllCardPayments = exports.updateBankAccountsPaymentSources = exports.removeCardPayment = exports.updateCardPayments = exports.initialState = void 0;
5
- const toolkit_1 = require("@reduxjs/toolkit");
6
- const cardPaymentPayload_1 = require("./cardPaymentPayload");
7
- exports.initialState = {
8
- cardByID: {},
9
- bankAccountByID: {},
10
- };
11
- const cardPayment = (0, toolkit_1.createSlice)({
12
- name: 'cardPayment',
13
- initialState: exports.initialState,
14
- reducers: {
15
- updateCardPayments: {
16
- reducer(draft, action) {
17
- action.payload.forEach((cardPaymentPayload) => {
18
- const latestCardPayment = (0, cardPaymentPayload_1.mapCardPaymentPayloadToCardPayment)(cardPaymentPayload);
19
- if (action.meta.updateType === 'merge') {
20
- draft.cardByID[latestCardPayment.cardId] = latestCardPayment;
21
- }
22
- });
23
- },
24
- prepare(cardPayments, updateType = 'merge') {
25
- return {
26
- payload: cardPayments,
27
- meta: { updateType },
28
- };
29
- },
30
- },
31
- removeCardPayment(draft, action) {
32
- delete draft.cardByID[action.payload];
33
- },
34
- //TODO: bank account related actions
35
- updateBankAccountsPaymentSources: {
36
- reducer(draft, action) {
37
- action.payload.forEach((bankAccountPayload) => {
38
- const latestBankAccount = (0, cardPaymentPayload_1.mapBankAccountPayloadToBankAccount)(bankAccountPayload);
39
- if (action.meta.updateType === 'merge') {
40
- draft.bankAccountByID[latestBankAccount.bankAccountId] =
41
- latestBankAccount;
42
- }
43
- });
44
- },
45
- prepare(cardPayments, updateType = 'merge') {
46
- return {
47
- payload: cardPayments,
48
- meta: { updateType },
49
- };
50
- },
51
- },
52
- clearAllCardPayments(draft) {
53
- draft.cardByID = {};
54
- draft.bankAccountByID = {};
55
- },
56
- },
57
- });
58
- _a = cardPayment.actions, exports.updateCardPayments = _a.updateCardPayments, exports.removeCardPayment = _a.removeCardPayment, exports.updateBankAccountsPaymentSources = _a.updateBankAccountsPaymentSources, exports.clearAllCardPayments = _a.clearAllCardPayments;
59
- exports.default = cardPayment.reducer;
@@ -1,6 +0,0 @@
1
- import { ID } from '../../commonStateTypes/common';
2
- import { CardPaymentState, CardPayment } from './cardPaymentState';
3
- export declare function getCardById(cardState: CardPaymentState, cardId: ID): CardPayment | undefined;
4
- export declare function getCardsByIds(cardState: CardPaymentState, cardIds: ID[]): CardPayment[];
5
- export declare function getBankAccountById(cardState: CardPaymentState, bankAccountId: ID): import("./cardPaymentState").BankAccount;
6
- export declare function getBankAccountsByIds(cardState: CardPaymentState, bankAccountIds: ID[]): import("./cardPaymentState").BankAccount[];
@@ -1,27 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.getBankAccountsByIds = exports.getBankAccountById = exports.getCardsByIds = exports.getCardById = void 0;
7
- const get_1 = __importDefault(require("lodash/get"));
8
- function getCardById(cardState, cardId) {
9
- return (0, get_1.default)(cardState.cardByID, cardId);
10
- }
11
- exports.getCardById = getCardById;
12
- function getCardsByIds(cardState, cardIds) {
13
- return cardIds
14
- .map((cardId) => getCardById(cardState, cardId))
15
- .filter((value) => value != null);
16
- }
17
- exports.getCardsByIds = getCardsByIds;
18
- function getBankAccountById(cardState, bankAccountId) {
19
- return (0, get_1.default)(cardState.bankAccountByID, bankAccountId);
20
- }
21
- exports.getBankAccountById = getBankAccountById;
22
- function getBankAccountsByIds(cardState, bankAccountIds) {
23
- return bankAccountIds
24
- .map((bankAccountId) => getBankAccountById(cardState, bankAccountId))
25
- .filter((value) => value != null);
26
- }
27
- exports.getBankAccountsByIds = getBankAccountsByIds;
@@ -1,28 +0,0 @@
1
- import { ID } from '../../commonStateTypes/common';
2
- export interface CardPayment {
3
- cardId: string;
4
- status: string;
5
- brand: string;
6
- expiryMonth: number;
7
- expiryYear: number;
8
- firstName: string;
9
- last4: string;
10
- lastName: string;
11
- maskedNumber: string;
12
- }
13
- export interface BankAccount {
14
- bankAccountId: string;
15
- status: string;
16
- last4: string;
17
- nameOnAccount: string;
18
- firstName: string;
19
- directDebitScheme: string;
20
- bankName: string;
21
- accountType: string;
22
- accountHolderType: string;
23
- email: string;
24
- }
25
- export interface CardPaymentState {
26
- cardByID: Record<ID, CardPayment>;
27
- bankAccountByID: Record<ID, BankAccount>;
28
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,37 +0,0 @@
1
- import { CardPaymentPayload, BankAccountPayload } from '../../entity/cardPayment/cardPaymentPayload';
2
- import { ZeniAPIResponse } from '../../responsePayload';
3
- import { SetupIntentData } from './cardPaymentViewState';
4
- export declare type DeleteCardPaymentResponse = ZeniAPIResponse<FetchCardSetupIntentPayload>;
5
- export interface FetchCardSetupIntentPayload {
6
- client_secret: string;
7
- id: string;
8
- }
9
- export interface FetchConfirmCardSetupError {
10
- code: string;
11
- message: string;
12
- param: string;
13
- [key: string]: unknown;
14
- }
15
- export interface FetchConfirmCardSetupResponse {
16
- setupIntent?: SetupIntentData;
17
- error?: FetchConfirmCardSetupError;
18
- [key: string]: unknown;
19
- }
20
- export interface ConfirmSetupIntentPayload {
21
- payment_method_types: string[];
22
- }
23
- export declare type FetchCardSetupIntentResponse = ZeniAPIResponse<FetchCardSetupIntentPayload>;
24
- export interface AddCardPaymentSourcePayload {
25
- type: string;
26
- processor_token: string;
27
- payment_source_type: string;
28
- }
29
- export interface CardsOrBanksType {
30
- cards?: CardPaymentPayload[];
31
- bank_accounts?: BankAccountPayload[];
32
- }
33
- export interface AddCardPaymentSourceResponse {
34
- companies: unknown[];
35
- payment_sources: CardsOrBanksType;
36
- }
37
- export declare type FetchAddCardPaymentSourceResponse = ZeniAPIResponse<AddCardPaymentSourceResponse>;
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,32 +0,0 @@
1
- import { CardPaymentViewState, SetupIntentData } from './cardPaymentViewState';
2
- import { FetchState } from '../../commonStateTypes/common';
3
- import { ZeniAPIStatus } from '../../responsePayload';
4
- import { AddCardPaymentSourceResponse, CardsOrBanksType } from './cardPaymentViewPayload';
5
- export declare const initialState: CardPaymentViewState;
6
- export declare const createCardSetupIntent: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[paymentsMethod: string[]], {
7
- paymentsMethod: string[];
8
- }, string, never, never>, updateCardSetupIntentStatus: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
9
- fetchState: FetchState;
10
- clientSecret: string;
11
- error?: ZeniAPIStatus<Record<string, unknown>> | undefined;
12
- }, string>, confirmCardSetupIntent: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[setupIntentData: any], {
13
- setupIntentData: any;
14
- }, string, never, never>, updateConfirmCardSetupIntentStatus: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
15
- fetchState: FetchState;
16
- setupIntentData?: SetupIntentData | undefined;
17
- error?: ZeniAPIStatus<Record<string, unknown>> | undefined;
18
- }, string>, addCardPaymentSource: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[type: "card" | "direct_debit", paymentSourceType: string, setupIntentId: string], {
19
- type: "card" | "direct_debit";
20
- paymentSourceType: string;
21
- setupIntentId: string;
22
- }, string, never, never>, updateAddCardPaymentSourceStatus: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
23
- fetchState: FetchState;
24
- error?: ZeniAPIStatus<Record<string, unknown>> | undefined;
25
- payment_sources?: CardsOrBanksType | undefined;
26
- }, string>, fetchPaymentSources: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, updatePaymentSources: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
27
- fetchState: FetchState;
28
- error?: ZeniAPIStatus<Record<string, unknown>> | undefined;
29
- response?: AddCardPaymentSourceResponse | undefined;
30
- }, string>, clearCardPaymentView: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
31
- declare const _default: import("@reduxjs/toolkit").Reducer<CardPaymentViewState, import("@reduxjs/toolkit").AnyAction>;
32
- export default _default;
@@ -1,125 +0,0 @@
1
- "use strict";
2
- var _a;
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.clearCardPaymentView = exports.updatePaymentSources = exports.fetchPaymentSources = exports.updateAddCardPaymentSourceStatus = exports.addCardPaymentSource = exports.updateConfirmCardSetupIntentStatus = exports.confirmCardSetupIntent = exports.updateCardSetupIntentStatus = exports.createCardSetupIntent = exports.initialState = void 0;
5
- const toolkit_1 = require("@reduxjs/toolkit");
6
- exports.initialState = {
7
- cardPaymentsIDs: [],
8
- bankAccountIDs: [],
9
- clientSecret: '',
10
- fetchState: 'Not-Started',
11
- error: undefined,
12
- cardDeleteStatusById: {},
13
- cardSetupIntentStatus: {
14
- fetchState: 'Not-Started',
15
- error: undefined,
16
- },
17
- cardSetupConfirmStatus: {
18
- fetchState: 'Not-Started',
19
- error: undefined,
20
- },
21
- addCardPaymentSourceStatus: {
22
- fetchState: 'Not-Started',
23
- error: undefined,
24
- },
25
- hasValidState() {
26
- return this.fetchState == 'Completed';
27
- },
28
- };
29
- const cardPaymentView = (0, toolkit_1.createSlice)({
30
- name: 'cardPaymentView',
31
- initialState: exports.initialState,
32
- reducers: {
33
- createCardSetupIntent: {
34
- reducer(draft) {
35
- draft.cardSetupIntentStatus = {
36
- fetchState: 'In-Progress',
37
- error: undefined,
38
- };
39
- },
40
- prepare(paymentsMethod) {
41
- return {
42
- payload: { paymentsMethod }, // Add the payload property
43
- };
44
- },
45
- },
46
- updateCardSetupIntentStatus(draft, action) {
47
- draft.clientSecret = action.payload.clientSecret;
48
- draft.cardSetupIntentStatus = {
49
- fetchState: action.payload.fetchState,
50
- error: action.payload.error,
51
- };
52
- },
53
- confirmCardSetupIntent: {
54
- reducer(draft) {
55
- draft.cardSetupConfirmStatus = {
56
- fetchState: 'In-Progress',
57
- error: undefined,
58
- };
59
- },
60
- prepare(setupIntentData) {
61
- return {
62
- payload: { setupIntentData },
63
- };
64
- },
65
- },
66
- updateConfirmCardSetupIntentStatus(draft, action) {
67
- if (action.payload.setupIntentData != null) {
68
- draft.setupIntentData = action.payload.setupIntentData;
69
- }
70
- draft.cardSetupConfirmStatus = {
71
- fetchState: action.payload.fetchState,
72
- error: action.payload.error,
73
- };
74
- },
75
- addCardPaymentSource: {
76
- reducer(draft) {
77
- draft.addCardPaymentSourceStatus = {
78
- fetchState: 'In-Progress',
79
- error: undefined,
80
- };
81
- },
82
- prepare(type, paymentSourceType, setupIntentId) {
83
- return {
84
- payload: { type, paymentSourceType, setupIntentId },
85
- };
86
- },
87
- },
88
- updateAddCardPaymentSourceStatus(state, action) {
89
- var _a;
90
- state.addCardPaymentSourceStatus.fetchState = action.payload.fetchState;
91
- state.addCardPaymentSourceStatus.error = action.payload.error;
92
- const paymentMethods = action.payload.payment_sources;
93
- if (paymentMethods != null) {
94
- const cardIds = (_a = paymentMethods === null || paymentMethods === void 0 ? void 0 : paymentMethods.cards) === null || _a === void 0 ? void 0 : _a.map((card) => card.id);
95
- if (cardIds) {
96
- state.cardPaymentsIDs = cardIds;
97
- }
98
- }
99
- },
100
- fetchPaymentSources(state) {
101
- state.fetchState = 'In-Progress';
102
- },
103
- updatePaymentSources(state, action) {
104
- var _a, _b, _c;
105
- state.addCardPaymentSourceStatus.fetchState = action.payload.fetchState;
106
- state.addCardPaymentSourceStatus.error = action.payload.error;
107
- const paymentMethods = (_a = action.payload.response) === null || _a === void 0 ? void 0 : _a.payment_sources;
108
- if (paymentMethods) {
109
- const cardIds = (_b = paymentMethods === null || paymentMethods === void 0 ? void 0 : paymentMethods.cards) === null || _b === void 0 ? void 0 : _b.map((card) => card.id);
110
- if (cardIds) {
111
- state.cardPaymentsIDs = cardIds;
112
- }
113
- const bankAccountIds = (_c = paymentMethods === null || paymentMethods === void 0 ? void 0 : paymentMethods.bank_accounts) === null || _c === void 0 ? void 0 : _c.map((bankAccount) => bankAccount.id);
114
- if (bankAccountIds) {
115
- state.bankAccountIDs = bankAccountIds;
116
- }
117
- }
118
- },
119
- clearCardPaymentView(draft) {
120
- Object.assign(draft, exports.initialState);
121
- },
122
- },
123
- });
124
- _a = cardPaymentView.actions, exports.createCardSetupIntent = _a.createCardSetupIntent, exports.updateCardSetupIntentStatus = _a.updateCardSetupIntentStatus, exports.confirmCardSetupIntent = _a.confirmCardSetupIntent, exports.updateConfirmCardSetupIntentStatus = _a.updateConfirmCardSetupIntentStatus, exports.addCardPaymentSource = _a.addCardPaymentSource, exports.updateAddCardPaymentSourceStatus = _a.updateAddCardPaymentSourceStatus, exports.fetchPaymentSources = _a.fetchPaymentSources, exports.updatePaymentSources = _a.updatePaymentSources, exports.clearCardPaymentView = _a.clearCardPaymentView;
125
- exports.default = cardPaymentView.reducer;
@@ -1,16 +0,0 @@
1
- import { FetchStateAndError, ID } from '../../commonStateTypes/common';
2
- import { SelectorView } from '../../commonStateTypes/viewAndReport/viewAndReport';
3
- import { BankAccount, CardPayment } from '../../entity/cardPayment/cardPaymentState';
4
- import { RootState } from '../../reducer';
5
- import { SetupIntentData } from './cardPaymentViewState';
6
- export interface CardPaymentSelectorView extends SelectorView {
7
- cardsList: CardPayment[];
8
- bankAccountsList: BankAccount[];
9
- cardDeleteStatusById: Record<ID, FetchStateAndError>;
10
- addCardPaymentSourceStatus: FetchStateAndError;
11
- cardSetupConfirmStatus: FetchStateAndError;
12
- cardSetupIntentStatus: FetchStateAndError;
13
- clientSecret?: string;
14
- setupIntentData?: SetupIntentData;
15
- }
16
- export declare const getAllCardsAndBankPaymentMethods: (state: RootState) => CardPaymentSelectorView;
@@ -1,24 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getAllCardsAndBankPaymentMethods = void 0;
4
- const cardPaymentSelector_1 = require("../../entity/cardPayment/cardPaymentSelector");
5
- const getAllCardsAndBankPaymentMethods = (state) => {
6
- var _a, _b, _c;
7
- const { cardPaymentState, cardPaymentViewState } = state;
8
- const cardList = (0, cardPaymentSelector_1.getCardsByIds)(cardPaymentState, (_a = cardPaymentViewState.cardPaymentsIDs) !== null && _a !== void 0 ? _a : []);
9
- const bankAccountList = (0, cardPaymentSelector_1.getBankAccountsByIds)(cardPaymentState, (_b = cardPaymentViewState.bankAccountIDs) !== null && _b !== void 0 ? _b : []);
10
- return {
11
- cardsList: cardList,
12
- bankAccountsList: bankAccountList,
13
- fetchState: cardPaymentViewState.fetchState,
14
- clientSecret: (_c = cardPaymentViewState.clientSecret) !== null && _c !== void 0 ? _c : '',
15
- setupIntentData: cardPaymentViewState.setupIntentData,
16
- addCardPaymentSourceStatus: cardPaymentViewState.addCardPaymentSourceStatus,
17
- cardDeleteStatusById: cardPaymentViewState.cardDeleteStatusById,
18
- cardSetupConfirmStatus: cardPaymentViewState.cardSetupConfirmStatus,
19
- cardSetupIntentStatus: cardPaymentViewState.cardSetupIntentStatus,
20
- error: undefined,
21
- version: 0,
22
- };
23
- };
24
- exports.getAllCardsAndBankPaymentMethods = getAllCardsAndBankPaymentMethods;
@@ -1,19 +0,0 @@
1
- import { PaymentMethod } from '@stripe/stripe-js';
2
- import { FetchedState, FetchStateAndError, ID } from '../../commonStateTypes/common';
3
- export interface CardPaymentViewState extends FetchedState {
4
- cardPaymentsIDs: ID[];
5
- bankAccountIDs: ID[];
6
- cardSetupConfirmStatus: FetchStateAndError;
7
- cardSetupIntentStatus: FetchStateAndError;
8
- addCardPaymentSourceStatus: FetchStateAndError;
9
- cardDeleteStatusById: Record<ID, FetchStateAndError>;
10
- setupIntentData?: SetupIntentData;
11
- clientSecret?: string;
12
- }
13
- export interface SetupIntentData {
14
- id: string;
15
- status: string;
16
- paymentMethod: string | null | PaymentMethod;
17
- clientSecret?: string | null;
18
- [key: string]: unknown;
19
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,34 +0,0 @@
1
- import { ActionsObservable, StateObservable } from 'redux-observable';
2
- import { ZeniAPI } from '../../../zeniAPI';
3
- import { RootState } from '../../../reducer';
4
- import { addCardPaymentSource, fetchPaymentSources, updateAddCardPaymentSourceStatus } from '../cardPaymentViewReducer';
5
- import { updateOnboardingCustomerViewUIState } from '../../onboardingView/customerView/onboardingCustomerViewReducer';
6
- import { updateZeniAccountSetupViewUIState } from '../../spendManagement/zeniAccounts/zeniAccountSetUp/zeniAccountSetupViewReducer';
7
- import { openSnackbar } from '../../../entity/snackbar/snackbarReducer';
8
- export declare type ActionType = ReturnType<typeof addCardPaymentSource> | ReturnType<typeof openSnackbar> | ReturnType<typeof updateAddCardPaymentSourceStatus> | ReturnType<typeof fetchPaymentSources> | ReturnType<typeof updateZeniAccountSetupViewUIState> | ReturnType<typeof updateOnboardingCustomerViewUIState>;
9
- export declare const addCardPaymentSourceEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<{
10
- payload: undefined;
11
- type: string;
12
- } | {
13
- payload: Partial<import("../../spendManagement/zeniAccounts/zeniAccountSetUp/zeniAccountSetupViewState").ZeniAccountSetupViewUIState>;
14
- type: string;
15
- } | {
16
- payload: {
17
- messageSection: "reimbursement_setup" | "common" | "transactionDetails_updatingPastTransactions" | "transactionDetails_transactionUpdated" | "cockpit_month_end_email_sent" | "cockpit_month_end_email_save" | "cockpit_month_end_email_attachment_upload" | "audit_score_updated" | "people_invite_people" | "people_invite_multiple_people" | "people_delete_person" | "people_update_person" | "reimbursement_updated" | "reimbursement_deleted" | "reimbursement_cancelled_deleted" | "reimbursement_cancelled" | "reimbursement_approved" | "reimbursement_rejected" | "reimbursement_sent_for_approval" | "account_added" | "business_verification_save" | "business_verification_submit" | "business_verification_from_bills_submit" | "plaid_connection" | "unlink_deposit_account" | "reimbursement_approval_create" | "reimbursement_duplicate_approval_create" | "reimbursement_approval_update" | "reimbursement_duplicate_approval_update" | "reimbursement_approval_delete" | "reimbursement_create_mileage" | "reimbursement_update_mileage" | "reimbursement_accept_term" | "reimbursement_accept_employee_term" | "bill_pay_setup" | "zeni_accounts_setup" | "bill_pay_approval_create" | "bill_pay_duplicate_approval_create" | "bill_pay_approval_update" | "bill_pay_duplicate_approval_update" | "bill_pay_approval_delete" | "bill_pay_updated" | "bill_pay_deleted" | "bill_pay_cancelled_deleted" | "bill_pay_cancelled" | "bill_pay_approved" | "real_time_approver_added" | "bill_pay_rejected" | "bill_pay_sent_for_approval" | "bill_pay_accept_term" | "zeni_account_accept_term" | "update_vendor" | "data_refresh_update" | "delete_bank_account" | "create_bank_account" | "create_bank_account_ach" | "create_bank_account_wire" | "create_bank_account_international" | "transfer_money" | "update_zeni_account_nickname" | "create_checking_account" | "deposit_check" | "create_vendor" | "onboarding_customer_view" | "onboarding_customer_view_complete" | "onboarding_customer_identity_verification_save" | "onboarding_customer_identity_verification_submit" | "onboarding_customer_business_verification_save" | "onboarding_customer_business_verification_submit" | "retry_bank_account_connection" | "dashboard_invite_sent" | "onboarding_info_saved" | "approve_original_merchant" | "approve_global_merchant" | "reject_global_merchant" | "create_global_merchant" | "fetch_global_merchant_no_recommendation" | "save_vendor_renamed" | "save_vendor_sent_for_review" | "save_vendor_marked_as_employee" | "charge_card_setup" | "charge_card_accept_term" | "create_schedule" | "save_schedule" | "delete_schedule" | "save_task_detail" | "fetch_task_detail" | "delete_task" | "archive_task" | "create_tag" | "delete_tag" | "update_charge_card" | "issue_charge_card" | "notification_settings_saved" | "referral_invite_sent" | "notification_mark_as_read" | "mark_as_complete_schedule" | "settings_accounting_accounts_updated" | "create_setup_intent" | "confirm_card_setup_intent" | "add_card_payment_source" | "fetch_payment_sources" | "task_assigned_toast_notification" | "task_due_tomorrow_toast_notification" | "task_deleted_toast_notification" | "task_archived_toast_notification" | "task_overdue_toast_notification" | "task_overdue_toast_notification_creator" | "task_notification_count" | "task_activities_toast_notification" | "task_created_toast_notification";
18
- messageText: "failed" | "success" | "notification";
19
- type: import("../../..").SnackbarMessageType;
20
- showStatusIcon?: boolean | undefined;
21
- variables?: {
22
- variableName: string;
23
- variableValue: string;
24
- }[] | undefined;
25
- };
26
- type: string;
27
- } | {
28
- payload: {
29
- fetchState: import("../../..").FetchState;
30
- error?: import("../../../responsePayload").ZeniAPIStatus<Record<string, unknown>> | undefined;
31
- payment_sources?: import("../cardPaymentViewPayload").CardsOrBanksType | undefined;
32
- };
33
- type: string;
34
- }>;
@@ -1,76 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.addCardPaymentSourceEpic = void 0;
4
- const rxjs_1 = require("rxjs");
5
- const operators_1 = require("rxjs/operators");
6
- const cardPaymentViewReducer_1 = require("../cardPaymentViewReducer");
7
- const onboardingCustomerViewReducer_1 = require("../../onboardingView/customerView/onboardingCustomerViewReducer");
8
- const zeniAccountSetupViewReducer_1 = require("../../spendManagement/zeniAccounts/zeniAccountSetUp/zeniAccountSetupViewReducer");
9
- const snackbarReducer_1 = require("../../../entity/snackbar/snackbarReducer");
10
- const responsePayload_1 = require("../../../responsePayload");
11
- const addCardPaymentSourceEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(cardPaymentViewReducer_1.addCardPaymentSource.match), (0, operators_1.mergeMap)((action) => {
12
- const { type, paymentSourceType, setupIntentId } = action.payload;
13
- const payload = {
14
- type: type,
15
- processor_token: setupIntentId,
16
- payment_source_type: paymentSourceType,
17
- };
18
- return handleAddCardPaymentSource(payload, zeniAPI);
19
- }));
20
- exports.addCardPaymentSourceEpic = addCardPaymentSourceEpic;
21
- const handleAddCardPaymentSource = (payload, zeniAPI) => {
22
- const cardPaymentSourcePayload = Object.assign({}, prepareCreateSetupIntentPayload(payload));
23
- const addCardPaymentSourceApi$ = zeniAPI.postAndGetJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/subscriptions/payment-sources`, cardPaymentSourcePayload);
24
- return addCardPaymentSourceApi$.pipe((0, operators_1.mergeMap)((response) => handleAddCardPaymentSourceResponse(response)), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, cardPaymentViewReducer_1.updateAddCardPaymentSourceStatus)({
25
- fetchState: 'Error',
26
- error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Add Card Payment Source API call errored out ' +
27
- JSON.stringify(error)),
28
- }))));
29
- };
30
- const handleAddCardPaymentSourceResponse = (response) => {
31
- if ((0, responsePayload_1.isSuccessResponse)(response) && response.data) {
32
- return (0, rxjs_1.from)([
33
- (0, cardPaymentViewReducer_1.updateAddCardPaymentSourceStatus)({
34
- fetchState: 'Completed',
35
- payment_sources: response.data.payment_sources,
36
- }),
37
- (0, snackbarReducer_1.openSnackbar)({
38
- messageSection: 'add_card_payment_source',
39
- messageText: 'success',
40
- type: 'success',
41
- }),
42
- (0, onboardingCustomerViewReducer_1.updateOnboardingCustomerViewUIState)({ isCardPaymentPopupOpen: false }),
43
- (0, zeniAccountSetupViewReducer_1.updateZeniAccountSetupViewUIState)({ isCardPaymentPopupOpen: false }),
44
- (0, cardPaymentViewReducer_1.fetchPaymentSources)(),
45
- ]);
46
- }
47
- else {
48
- return (0, rxjs_1.from)([
49
- (0, cardPaymentViewReducer_1.updateAddCardPaymentSourceStatus)({
50
- fetchState: 'Error',
51
- error: response.status,
52
- }),
53
- (0, snackbarReducer_1.openSnackbar)({
54
- messageSection: 'add_card_payment_source',
55
- messageText: 'failed',
56
- type: 'error',
57
- variables: [
58
- {
59
- variableName: '_api-error_',
60
- variableValue: response.status.message,
61
- },
62
- ],
63
- }),
64
- ]);
65
- }
66
- };
67
- /**
68
- * Helpers
69
- */
70
- const prepareCreateSetupIntentPayload = (payload) => {
71
- return {
72
- type: payload.type,
73
- processor_token: payload.processor_token,
74
- payment_source_type: payload.payment_source_type,
75
- };
76
- };
@@ -1,25 +0,0 @@
1
- import { ActionsObservable } from 'redux-observable';
2
- import { addCardPaymentSource, confirmCardSetupIntent, updateConfirmCardSetupIntentStatus } from '../cardPaymentViewReducer';
3
- import { openSnackbar } from '../../../entity/snackbar/snackbarReducer';
4
- import { SetupIntentData } from '../cardPaymentViewState';
5
- export declare type ActionType = ReturnType<typeof confirmCardSetupIntent> | ReturnType<typeof openSnackbar> | ReturnType<typeof updateConfirmCardSetupIntentStatus> | ReturnType<typeof addCardPaymentSource>;
6
- export declare const confirmSetupIntentEpic: (actions$: ActionsObservable<ActionType>) => import("rxjs").Observable<{
7
- payload: {
8
- messageSection: "reimbursement_setup" | "common" | "transactionDetails_updatingPastTransactions" | "transactionDetails_transactionUpdated" | "cockpit_month_end_email_sent" | "cockpit_month_end_email_save" | "cockpit_month_end_email_attachment_upload" | "audit_score_updated" | "people_invite_people" | "people_invite_multiple_people" | "people_delete_person" | "people_update_person" | "reimbursement_updated" | "reimbursement_deleted" | "reimbursement_cancelled_deleted" | "reimbursement_cancelled" | "reimbursement_approved" | "reimbursement_rejected" | "reimbursement_sent_for_approval" | "account_added" | "business_verification_save" | "business_verification_submit" | "business_verification_from_bills_submit" | "plaid_connection" | "unlink_deposit_account" | "reimbursement_approval_create" | "reimbursement_duplicate_approval_create" | "reimbursement_approval_update" | "reimbursement_duplicate_approval_update" | "reimbursement_approval_delete" | "reimbursement_create_mileage" | "reimbursement_update_mileage" | "reimbursement_accept_term" | "reimbursement_accept_employee_term" | "bill_pay_setup" | "zeni_accounts_setup" | "bill_pay_approval_create" | "bill_pay_duplicate_approval_create" | "bill_pay_approval_update" | "bill_pay_duplicate_approval_update" | "bill_pay_approval_delete" | "bill_pay_updated" | "bill_pay_deleted" | "bill_pay_cancelled_deleted" | "bill_pay_cancelled" | "bill_pay_approved" | "real_time_approver_added" | "bill_pay_rejected" | "bill_pay_sent_for_approval" | "bill_pay_accept_term" | "zeni_account_accept_term" | "update_vendor" | "data_refresh_update" | "delete_bank_account" | "create_bank_account" | "create_bank_account_ach" | "create_bank_account_wire" | "create_bank_account_international" | "transfer_money" | "update_zeni_account_nickname" | "create_checking_account" | "deposit_check" | "create_vendor" | "onboarding_customer_view" | "onboarding_customer_view_complete" | "onboarding_customer_identity_verification_save" | "onboarding_customer_identity_verification_submit" | "onboarding_customer_business_verification_save" | "onboarding_customer_business_verification_submit" | "retry_bank_account_connection" | "dashboard_invite_sent" | "onboarding_info_saved" | "approve_original_merchant" | "approve_global_merchant" | "reject_global_merchant" | "create_global_merchant" | "fetch_global_merchant_no_recommendation" | "save_vendor_renamed" | "save_vendor_sent_for_review" | "save_vendor_marked_as_employee" | "charge_card_setup" | "charge_card_accept_term" | "create_schedule" | "save_schedule" | "delete_schedule" | "save_task_detail" | "fetch_task_detail" | "delete_task" | "archive_task" | "create_tag" | "delete_tag" | "update_charge_card" | "issue_charge_card" | "notification_settings_saved" | "referral_invite_sent" | "notification_mark_as_read" | "mark_as_complete_schedule" | "settings_accounting_accounts_updated" | "create_setup_intent" | "confirm_card_setup_intent" | "add_card_payment_source" | "fetch_payment_sources" | "task_assigned_toast_notification" | "task_due_tomorrow_toast_notification" | "task_deleted_toast_notification" | "task_archived_toast_notification" | "task_overdue_toast_notification" | "task_overdue_toast_notification_creator" | "task_notification_count" | "task_activities_toast_notification" | "task_created_toast_notification";
9
- messageText: "failed" | "success" | "notification";
10
- type: import("../../..").SnackbarMessageType;
11
- showStatusIcon?: boolean | undefined;
12
- variables?: {
13
- variableName: string;
14
- variableValue: string;
15
- }[] | undefined;
16
- };
17
- type: string;
18
- } | {
19
- payload: {
20
- fetchState: import("../../..").FetchState;
21
- setupIntentData?: SetupIntentData | undefined;
22
- error?: import("../../../responsePayload").ZeniAPIStatus<Record<string, unknown>> | undefined;
23
- };
24
- type: string;
25
- }>;
@@ -1,50 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.confirmSetupIntentEpic = void 0;
4
- const rxjs_1 = require("rxjs");
5
- const operators_1 = require("rxjs/operators");
6
- const cardPaymentViewReducer_1 = require("../cardPaymentViewReducer");
7
- const snackbarReducer_1 = require("../../../entity/snackbar/snackbarReducer");
8
- const responsePayload_1 = require("../../../responsePayload");
9
- const confirmSetupIntentEpic = (actions$) => actions$.pipe((0, operators_1.filter)(cardPaymentViewReducer_1.confirmCardSetupIntent.match), (0, operators_1.mergeMap)((action) => {
10
- const { setupIntentData } = action.payload;
11
- return handleConfirmCardSetupIntentResponse(setupIntentData);
12
- }));
13
- exports.confirmSetupIntentEpic = confirmSetupIntentEpic;
14
- const handleConfirmCardSetupIntentResponse = (response) => {
15
- var _a, _b, _c;
16
- const { setupIntent, error } = response;
17
- if (setupIntent != null && error == null) {
18
- const setupIntentData = {
19
- id: setupIntent.id,
20
- status: setupIntent.status,
21
- paymentMethod: setupIntent.payment_method,
22
- clientSecret: (_a = setupIntent.client_secret) !== null && _a !== void 0 ? _a : '',
23
- };
24
- return (0, rxjs_1.from)([
25
- (0, cardPaymentViewReducer_1.updateConfirmCardSetupIntentStatus)({
26
- fetchState: 'Completed',
27
- setupIntentData,
28
- }),
29
- ]);
30
- }
31
- else {
32
- return (0, rxjs_1.from)([
33
- (0, cardPaymentViewReducer_1.updateConfirmCardSetupIntentStatus)({
34
- fetchState: 'Error',
35
- error: (0, responsePayload_1.createZeniAPIStatus)('Error', (_b = error === null || error === void 0 ? void 0 : error.message) !== null && _b !== void 0 ? _b : 'Unknown error'),
36
- }),
37
- (0, snackbarReducer_1.openSnackbar)({
38
- messageSection: 'confirm_card_setup_intent',
39
- messageText: 'failed',
40
- type: 'error',
41
- variables: [
42
- {
43
- variableName: '_api-error_',
44
- variableValue: (_c = error === null || error === void 0 ? void 0 : error.message) !== null && _c !== void 0 ? _c : 'Unknown error',
45
- },
46
- ],
47
- }),
48
- ]);
49
- }
50
- };
@@ -1,27 +0,0 @@
1
- import { ActionsObservable, StateObservable } from 'redux-observable';
2
- import { ZeniAPI } from '../../../zeniAPI';
3
- import { RootState } from '../../../reducer';
4
- import { createCardSetupIntent, updateCardSetupIntentStatus } from '../cardPaymentViewReducer';
5
- import { updateCardPayments } from '../../../entity/cardPayment/cardPaymentReducer';
6
- import { openSnackbar } from '../../../entity/snackbar/snackbarReducer';
7
- export declare type ActionType = ReturnType<typeof createCardSetupIntent> | ReturnType<typeof updateCardSetupIntentStatus> | ReturnType<typeof openSnackbar> | ReturnType<typeof updateCardPayments>;
8
- export declare const createSetupIntentEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<{
9
- payload: {
10
- messageSection: "reimbursement_setup" | "common" | "transactionDetails_updatingPastTransactions" | "transactionDetails_transactionUpdated" | "cockpit_month_end_email_sent" | "cockpit_month_end_email_save" | "cockpit_month_end_email_attachment_upload" | "audit_score_updated" | "people_invite_people" | "people_invite_multiple_people" | "people_delete_person" | "people_update_person" | "reimbursement_updated" | "reimbursement_deleted" | "reimbursement_cancelled_deleted" | "reimbursement_cancelled" | "reimbursement_approved" | "reimbursement_rejected" | "reimbursement_sent_for_approval" | "account_added" | "business_verification_save" | "business_verification_submit" | "business_verification_from_bills_submit" | "plaid_connection" | "unlink_deposit_account" | "reimbursement_approval_create" | "reimbursement_duplicate_approval_create" | "reimbursement_approval_update" | "reimbursement_duplicate_approval_update" | "reimbursement_approval_delete" | "reimbursement_create_mileage" | "reimbursement_update_mileage" | "reimbursement_accept_term" | "reimbursement_accept_employee_term" | "bill_pay_setup" | "zeni_accounts_setup" | "bill_pay_approval_create" | "bill_pay_duplicate_approval_create" | "bill_pay_approval_update" | "bill_pay_duplicate_approval_update" | "bill_pay_approval_delete" | "bill_pay_updated" | "bill_pay_deleted" | "bill_pay_cancelled_deleted" | "bill_pay_cancelled" | "bill_pay_approved" | "real_time_approver_added" | "bill_pay_rejected" | "bill_pay_sent_for_approval" | "bill_pay_accept_term" | "zeni_account_accept_term" | "update_vendor" | "data_refresh_update" | "delete_bank_account" | "create_bank_account" | "create_bank_account_ach" | "create_bank_account_wire" | "create_bank_account_international" | "transfer_money" | "update_zeni_account_nickname" | "create_checking_account" | "deposit_check" | "create_vendor" | "onboarding_customer_view" | "onboarding_customer_view_complete" | "onboarding_customer_identity_verification_save" | "onboarding_customer_identity_verification_submit" | "onboarding_customer_business_verification_save" | "onboarding_customer_business_verification_submit" | "retry_bank_account_connection" | "dashboard_invite_sent" | "onboarding_info_saved" | "approve_original_merchant" | "approve_global_merchant" | "reject_global_merchant" | "create_global_merchant" | "fetch_global_merchant_no_recommendation" | "save_vendor_renamed" | "save_vendor_sent_for_review" | "save_vendor_marked_as_employee" | "charge_card_setup" | "charge_card_accept_term" | "create_schedule" | "save_schedule" | "delete_schedule" | "save_task_detail" | "fetch_task_detail" | "delete_task" | "archive_task" | "create_tag" | "delete_tag" | "update_charge_card" | "issue_charge_card" | "notification_settings_saved" | "referral_invite_sent" | "notification_mark_as_read" | "mark_as_complete_schedule" | "settings_accounting_accounts_updated" | "create_setup_intent" | "confirm_card_setup_intent" | "add_card_payment_source" | "fetch_payment_sources" | "task_assigned_toast_notification" | "task_due_tomorrow_toast_notification" | "task_deleted_toast_notification" | "task_archived_toast_notification" | "task_overdue_toast_notification" | "task_overdue_toast_notification_creator" | "task_notification_count" | "task_activities_toast_notification" | "task_created_toast_notification";
11
- messageText: "failed" | "success" | "notification";
12
- type: import("../../..").SnackbarMessageType;
13
- showStatusIcon?: boolean | undefined;
14
- variables?: {
15
- variableName: string;
16
- variableValue: string;
17
- }[] | undefined;
18
- };
19
- type: string;
20
- } | {
21
- payload: {
22
- fetchState: import("../../..").FetchState;
23
- clientSecret: string;
24
- error?: import("../../../responsePayload").ZeniAPIStatus<Record<string, unknown>> | undefined;
25
- };
26
- type: string;
27
- }>;