@zeniai/client-epic-state 4.11.5 → 4.11.7

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 (60) 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/companyView/selector/companyManagementViewSelector.js +11 -8
  13. package/lib/view/companyView/selector/companyPortfolioViewSelector.js +1 -6
  14. package/lib/view/onboardingView/customerView/epic/customerDetails/updateOnboardingCustomerViewLocalStoreDataEpic.js +1 -1
  15. package/lib/view/onboardingView/customerView/onboardingCustomerViewReducer.js +0 -1
  16. package/lib/view/onboardingView/customerView/onboardingCustomerViewSelector.d.ts +1 -1
  17. package/lib/view/onboardingView/customerView/onboardingCustomerViewSelector.js +14 -6
  18. package/lib/view/onboardingView/customerView/onboardingCustomerViewState.d.ts +0 -1
  19. package/lib/view/people/changeZeniPersonRolesEpic.d.ts +1 -1
  20. package/lib/view/people/deletePersonEpic.d.ts +1 -1
  21. package/lib/view/people/invitePeopleEpic.d.ts +1 -1
  22. package/lib/view/people/inviteZeniPeopleEpic.d.ts +1 -1
  23. package/lib/view/people/resendInviteEpic.d.ts +1 -1
  24. package/lib/view/reviewCompanyView/reviewCompanyViewSelector.js +20 -7
  25. package/lib/view/settingsView/epic/saveNotificationSettingsEpic.d.ts +1 -1
  26. package/lib/view/spendManagement/zeniAccounts/zeniAccountSetUp/zeniAccountSetupViewReducer.d.ts +2 -2
  27. package/lib/view/spendManagement/zeniAccounts/zeniAccountSetUp/zeniAccountSetupViewReducer.js +2 -9
  28. package/lib/view/spendManagement/zeniAccounts/zeniAccountSetUp/zeniAccountSetupViewSelector.d.ts +0 -2
  29. package/lib/view/spendManagement/zeniAccounts/zeniAccountSetUp/zeniAccountSetupViewSelector.js +1 -1
  30. package/lib/view/spendManagement/zeniAccounts/zeniAccountSetUp/zeniAccountSetupViewState.d.ts +0 -4
  31. package/lib/view/subscriptionView/subscriptionViewSelector.js +3 -1
  32. package/lib/view/tagView/epics/createTagEpic.d.ts +1 -1
  33. package/lib/view/tagView/epics/deleteTagEpic.d.ts +1 -1
  34. package/lib/view/transactionDetail/epics/saveTransactionHelper.js +4 -1
  35. package/lib/view/transactionDetail/epics/updateTransactionDetailEpic.js +21 -11
  36. package/package.json +1 -2
  37. package/lib/entity/cardPayment/cardPaymentPayload.d.ts +0 -26
  38. package/lib/entity/cardPayment/cardPaymentPayload.js +0 -28
  39. package/lib/entity/cardPayment/cardPaymentReducer.d.ts +0 -11
  40. package/lib/entity/cardPayment/cardPaymentReducer.js +0 -59
  41. package/lib/entity/cardPayment/cardPaymentSelector.d.ts +0 -6
  42. package/lib/entity/cardPayment/cardPaymentSelector.js +0 -27
  43. package/lib/entity/cardPayment/cardPaymentState.d.ts +0 -28
  44. package/lib/entity/cardPayment/cardPaymentState.js +0 -2
  45. package/lib/view/cardPayment/cardPaymentViewPayload.d.ts +0 -37
  46. package/lib/view/cardPayment/cardPaymentViewPayload.js +0 -2
  47. package/lib/view/cardPayment/cardPaymentViewReducer.d.ts +0 -32
  48. package/lib/view/cardPayment/cardPaymentViewReducer.js +0 -125
  49. package/lib/view/cardPayment/cardPaymentViewSelector.d.ts +0 -16
  50. package/lib/view/cardPayment/cardPaymentViewSelector.js +0 -24
  51. package/lib/view/cardPayment/cardPaymentViewState.d.ts +0 -19
  52. package/lib/view/cardPayment/cardPaymentViewState.js +0 -2
  53. package/lib/view/cardPayment/epic/addCardPaymentSourceEpic.d.ts +0 -34
  54. package/lib/view/cardPayment/epic/addCardPaymentSourceEpic.js +0 -76
  55. package/lib/view/cardPayment/epic/confirmCardSetupEpic.d.ts +0 -25
  56. package/lib/view/cardPayment/epic/confirmCardSetupEpic.js +0 -50
  57. package/lib/view/cardPayment/epic/createCardSetupIntentEpic.d.ts +0 -27
  58. package/lib/view/cardPayment/epic/createCardSetupIntentEpic.js +0 -62
  59. package/lib/view/cardPayment/epic/fetchPaymentSourcesEpic.d.ts +0 -31
  60. package/lib/view/cardPayment/epic/fetchPaymentSourcesEpic.js +0 -69
@@ -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
- }>;
@@ -1,62 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createSetupIntentEpic = void 0;
4
- const rxjs_1 = require("rxjs");
5
- const operators_1 = require("rxjs/operators");
6
- const responsePayload_1 = require("../../../responsePayload");
7
- const cardPaymentViewReducer_1 = require("../cardPaymentViewReducer");
8
- const snackbarReducer_1 = require("../../../entity/snackbar/snackbarReducer");
9
- const createSetupIntentEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(cardPaymentViewReducer_1.createCardSetupIntent.match), (0, operators_1.mergeMap)((action) => {
10
- const { paymentsMethod } = action.payload;
11
- return handleCreateSetupIntent(paymentsMethod, zeniAPI); // Explicitly type the payload as string[]
12
- }));
13
- exports.createSetupIntentEpic = createSetupIntentEpic;
14
- const handleCreateSetupIntent = (paymentsMethod, zeniAPI) => {
15
- const payload = Object.assign({}, prepareCreateSetupIntentPayload(paymentsMethod));
16
- const createSetupIntentApi$ = zeniAPI.postAndGetJSON(`${zeniAPI.apiEndPoints.payMicroServiceBaseUrl}/1.0/stripe/cards/setup_intent`, payload);
17
- return createSetupIntentApi$.pipe((0, operators_1.mergeMap)((response) => handleCreateSetupIntentResponse(response)), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, cardPaymentViewReducer_1.updateCardSetupIntentStatus)({
18
- fetchState: 'Error',
19
- error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Create Setup Intent REST API call errored out ' +
20
- JSON.stringify(error)),
21
- clientSecret: '',
22
- }))));
23
- };
24
- const handleCreateSetupIntentResponse = (response) => {
25
- if ((0, responsePayload_1.isSuccessResponse)(response) && response.data) {
26
- const { client_secret } = response.data;
27
- return (0, rxjs_1.from)([
28
- (0, cardPaymentViewReducer_1.updateCardSetupIntentStatus)({
29
- fetchState: 'Completed',
30
- clientSecret: client_secret,
31
- }),
32
- ]);
33
- }
34
- else {
35
- return (0, rxjs_1.from)([
36
- (0, cardPaymentViewReducer_1.updateCardSetupIntentStatus)({
37
- fetchState: 'Error',
38
- error: response.status,
39
- clientSecret: '',
40
- }),
41
- (0, snackbarReducer_1.openSnackbar)({
42
- messageSection: 'create_setup_intent',
43
- messageText: 'failed',
44
- type: 'error',
45
- variables: [
46
- {
47
- variableName: '_api-error_',
48
- variableValue: response.status.message,
49
- },
50
- ],
51
- }),
52
- ]);
53
- }
54
- };
55
- /**
56
- * Helpers
57
- */
58
- const prepareCreateSetupIntentPayload = (paymentsMethod) => {
59
- return {
60
- payment_method_types: paymentsMethod,
61
- };
62
- };
@@ -1,31 +0,0 @@
1
- import { ActionsObservable, StateObservable } from 'redux-observable';
2
- import { ZeniAPI } from '../../../zeniAPI';
3
- import { RootState } from '../../../reducer';
4
- import { fetchPaymentSources, updatePaymentSources } from '../cardPaymentViewReducer';
5
- import { openSnackbar } from '../../../entity/snackbar/snackbarReducer';
6
- import { BankAccountPayload, CardPaymentPayload } from '../../../entity/cardPayment/cardPaymentPayload';
7
- export declare type ActionType = ReturnType<typeof fetchPaymentSources> | ReturnType<typeof openSnackbar> | ReturnType<typeof updatePaymentSources>;
8
- export declare const fetchPaymentSourcesEpic: (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
- error?: import("../../../responsePayload").ZeniAPIStatus<Record<string, unknown>> | undefined;
24
- response?: import("../cardPaymentViewPayload").AddCardPaymentSourceResponse | undefined;
25
- };
26
- type: string;
27
- } | import("@reduxjs/toolkit").PayloadAction<CardPaymentPayload[], string, {
28
- updateType: import("../../..").UpdateType;
29
- }, never> | import("@reduxjs/toolkit").PayloadAction<BankAccountPayload[], string, {
30
- updateType: import("../../..").UpdateType;
31
- }, never>>;
@@ -1,69 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.fetchPaymentSourcesEpic = 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 cardPaymentReducer_1 = require("../../../entity/cardPayment/cardPaymentReducer");
10
- const fetchPaymentSourcesEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(cardPaymentViewReducer_1.fetchPaymentSources.match), (0, operators_1.mergeMap)(() => {
11
- return handleFetchPaymentSources(zeniAPI);
12
- }));
13
- exports.fetchPaymentSourcesEpic = fetchPaymentSourcesEpic;
14
- const handleFetchPaymentSources = (zeniAPI) => {
15
- const queryParams = { is_return_only_valid: true };
16
- const fetchPaymentSourcesApi$ = zeniAPI.getJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/subscriptions/payment-sources?query=${encodeURIComponent(JSON.stringify(queryParams))}`);
17
- return fetchPaymentSourcesApi$.pipe((0, operators_1.mergeMap)((response) => handleFetchPaymentSourcesResponse(response)), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, cardPaymentViewReducer_1.updatePaymentSources)({
18
- fetchState: 'Error',
19
- error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Fetch Payment Sources API call errored out ' +
20
- JSON.stringify(error)),
21
- }))));
22
- };
23
- const getCardsOrBanks = (payment_sources) => {
24
- var _a, _b;
25
- if (Object.keys(payment_sources).includes('cards') &&
26
- (payment_sources === null || payment_sources === void 0 ? void 0 : payment_sources.cards) &&
27
- ((_a = payment_sources === null || payment_sources === void 0 ? void 0 : payment_sources.cards) === null || _a === void 0 ? void 0 : _a.length) > 0) {
28
- return payment_sources.cards;
29
- }
30
- else if (Object.keys(payment_sources).includes('bank_accounts') &&
31
- (payment_sources === null || payment_sources === void 0 ? void 0 : payment_sources.bank_accounts) &&
32
- ((_b = payment_sources === null || payment_sources === void 0 ? void 0 : payment_sources.bank_accounts) === null || _b === void 0 ? void 0 : _b.length) > 0) {
33
- return payment_sources.bank_accounts;
34
- }
35
- else {
36
- return [];
37
- }
38
- };
39
- const handleFetchPaymentSourcesResponse = (response) => {
40
- if ((0, responsePayload_1.isSuccessResponse)(response) && response.data) {
41
- return (0, rxjs_1.from)([
42
- (0, cardPaymentViewReducer_1.updatePaymentSources)({
43
- fetchState: 'Completed',
44
- response: response.data,
45
- }),
46
- (0, cardPaymentReducer_1.updateCardPayments)(getCardsOrBanks(response.data.payment_sources)),
47
- (0, cardPaymentReducer_1.updateBankAccountsPaymentSources)(getCardsOrBanks(response.data.payment_sources)),
48
- ]);
49
- }
50
- else {
51
- return (0, rxjs_1.from)([
52
- (0, cardPaymentViewReducer_1.updatePaymentSources)({
53
- fetchState: 'Error',
54
- error: response.status,
55
- }),
56
- (0, snackbarReducer_1.openSnackbar)({
57
- messageSection: 'fetch_payment_sources',
58
- messageText: 'failed',
59
- type: 'error',
60
- variables: [
61
- {
62
- variableName: '_api-error_',
63
- variableValue: response.status.message,
64
- },
65
- ],
66
- }),
67
- ]);
68
- }
69
- };