@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,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
- };