@zeniai/client-epic-state 4.11.19 → 4.11.21

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 (62) hide show
  1. package/lib/entity/cardPayment/cardPaymentPayload.d.ts +13 -0
  2. package/lib/entity/cardPayment/cardPaymentPayload.js +15 -0
  3. package/lib/entity/cardPayment/cardPaymentReducer.d.ts +9 -0
  4. package/lib/entity/cardPayment/cardPaymentReducer.js +47 -0
  5. package/lib/entity/cardPayment/cardPaymentSelector.d.ts +4 -0
  6. package/lib/entity/cardPayment/cardPaymentSelector.js +17 -0
  7. package/lib/entity/cardPayment/cardPaymentState.d.ts +15 -0
  8. package/lib/entity/cardPayment/cardPaymentState.js +2 -0
  9. package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
  10. package/lib/entity/snackbar/snackbarTypes.js +4 -0
  11. package/lib/entity/tag/tagReducer.js +9 -2
  12. package/lib/entity/tenant/clearAllEpic.d.ts +4 -2
  13. package/lib/entity/tenant/clearAllEpic.js +4 -0
  14. package/lib/entity/toastNotification/epic/pushToastNotificationEpic.d.ts +1 -1
  15. package/lib/epic.d.ts +5 -1
  16. package/lib/epic.js +5 -1
  17. package/lib/index.d.ts +9 -3
  18. package/lib/index.js +28 -18
  19. package/lib/reducer.d.ts +6 -0
  20. package/lib/reducer.js +6 -0
  21. package/lib/view/cardPayment/cardPaymentViewPayload.d.ts +23 -0
  22. package/lib/view/cardPayment/cardPaymentViewPayload.js +2 -0
  23. package/lib/view/cardPayment/cardPaymentViewReducer.d.ts +33 -0
  24. package/lib/view/cardPayment/cardPaymentViewReducer.js +121 -0
  25. package/lib/view/cardPayment/cardPaymentViewSelector.d.ts +19 -0
  26. package/lib/view/cardPayment/cardPaymentViewSelector.js +21 -0
  27. package/lib/view/cardPayment/cardPaymentViewState.d.ts +19 -0
  28. package/lib/view/cardPayment/cardPaymentViewState.js +2 -0
  29. package/lib/view/cardPayment/cardPaymentViewTypes.d.ts +4 -0
  30. package/lib/view/cardPayment/cardPaymentViewTypes.js +13 -0
  31. package/lib/view/cardPayment/epic/addCardPaymentSourceEpic.d.ts +29 -0
  32. package/lib/view/cardPayment/epic/addCardPaymentSourceEpic.js +68 -0
  33. package/lib/view/cardPayment/epic/confirmCardSetupIntentEpic.d.ts +25 -0
  34. package/lib/view/cardPayment/epic/confirmCardSetupIntentEpic.js +45 -0
  35. package/lib/view/cardPayment/epic/createCardSetupIntentEpic.d.ts +27 -0
  36. package/lib/view/cardPayment/epic/createCardSetupIntentEpic.js +56 -0
  37. package/lib/view/cardPayment/epic/fetchPaymentSourcesEpic.d.ts +28 -0
  38. package/lib/view/cardPayment/epic/fetchPaymentSourcesEpic.js +48 -0
  39. package/lib/view/onboardingView/cockpitView/epic/retryBankAccountConnectionForOnboardingEpic.js +2 -0
  40. package/lib/view/onboardingView/customerView/epic/customerDetails/fetchOnboardingCustomerSetupViewEpic.d.ts +1 -2
  41. package/lib/view/onboardingView/customerView/epic/customerDetails/fetchOnboardingCustomerSetupViewEpic.js +3 -6
  42. package/lib/view/onboardingView/customerView/epic/customerDetails/updateOnboardingCustomerViewLocalStoreDataEpic.js +5 -13
  43. package/lib/view/onboardingView/customerView/onboardingCustomerViewReducer.d.ts +1 -2
  44. package/lib/view/onboardingView/customerView/onboardingCustomerViewReducer.js +4 -5
  45. package/lib/view/onboardingView/customerView/onboardingCustomerViewSelector.d.ts +1 -1
  46. package/lib/view/onboardingView/customerView/onboardingCustomerViewSelector.js +12 -28
  47. package/lib/view/onboardingView/customerView/onboardingCustomerViewState.d.ts +1 -1
  48. package/lib/view/people/changeZeniPersonRolesEpic.d.ts +1 -1
  49. package/lib/view/people/deletePersonEpic.d.ts +1 -1
  50. package/lib/view/people/invitePeopleEpic.d.ts +1 -1
  51. package/lib/view/people/inviteZeniPeopleEpic.d.ts +1 -1
  52. package/lib/view/people/resendInviteEpic.d.ts +1 -1
  53. package/lib/view/reviewCompanyView/retryBankAccountConnectionEpic.js +2 -0
  54. package/lib/view/settingsView/epic/saveNotificationSettingsEpic.d.ts +1 -1
  55. package/lib/view/settingsView/settingsViewReducer.d.ts +2 -2
  56. package/lib/view/settingsView/settingsViewReducer.js +9 -2
  57. package/lib/view/settingsView/settingsViewSelector.js +2 -1
  58. package/lib/view/settingsView/settingsViewState.d.ts +4 -0
  59. package/lib/view/settingsView/types/settingsViewSelectorTypes.d.ts +2 -1
  60. package/lib/view/tagView/epics/createTagEpic.d.ts +1 -1
  61. package/lib/view/tagView/epics/deleteTagEpic.d.ts +1 -1
  62. package/package.json +2 -1
@@ -0,0 +1,68 @@
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 snackbarReducer_1 = require("../../../entity/snackbar/snackbarReducer");
8
+ const responsePayload_1 = require("../../../responsePayload");
9
+ const addCardPaymentSourceEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(cardPaymentViewReducer_1.addCardPaymentSource.match), (0, operators_1.mergeMap)((action) => {
10
+ const { type, paymentSourceType, setupIntentId } = action.payload;
11
+ const payload = {
12
+ type: type,
13
+ processor_token: setupIntentId,
14
+ payment_source_type: paymentSourceType,
15
+ };
16
+ const cardPaymentSourcePayload = Object.assign({}, prepareCreateSetupIntentPayload(payload));
17
+ const addCardPaymentSourceApi$ = zeniAPI.postAndGetJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/subscriptions/payment-sources`, cardPaymentSourcePayload);
18
+ return addCardPaymentSourceApi$.pipe((0, operators_1.mergeMap)((response) => {
19
+ if ((0, responsePayload_1.isSuccessResponse)(response) && response.data) {
20
+ return (0, rxjs_1.from)([
21
+ (0, cardPaymentViewReducer_1.updateAddCardPaymentSourceStatus)({
22
+ fetchState: 'Completed',
23
+ paymentSources: response.data.payment_sources,
24
+ }),
25
+ (0, snackbarReducer_1.openSnackbar)({
26
+ messageSection: 'add_card_payment_source',
27
+ messageText: 'success',
28
+ type: 'success',
29
+ }),
30
+ (0, cardPaymentViewReducer_1.fetchPaymentSources)(),
31
+ ]);
32
+ }
33
+ else {
34
+ return (0, rxjs_1.from)([
35
+ (0, cardPaymentViewReducer_1.updateAddCardPaymentSourceStatus)({
36
+ fetchState: 'Error',
37
+ error: response.status,
38
+ }),
39
+ (0, snackbarReducer_1.openSnackbar)({
40
+ messageSection: 'add_card_payment_source',
41
+ messageText: 'failed',
42
+ type: 'error',
43
+ variables: [
44
+ {
45
+ variableName: '_api-error_',
46
+ variableValue: response.status.message,
47
+ },
48
+ ],
49
+ }),
50
+ ]);
51
+ }
52
+ }), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, cardPaymentViewReducer_1.updateAddCardPaymentSourceStatus)({
53
+ fetchState: 'Error',
54
+ error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Add Card Payment Source API call errored out ' +
55
+ JSON.stringify(error)),
56
+ }))));
57
+ }));
58
+ exports.addCardPaymentSourceEpic = addCardPaymentSourceEpic;
59
+ /**
60
+ * Helpers
61
+ */
62
+ const prepareCreateSetupIntentPayload = (payload) => {
63
+ return {
64
+ type: payload.type,
65
+ processor_token: payload.processor_token,
66
+ payment_source_type: payload.payment_source_type,
67
+ };
68
+ };
@@ -0,0 +1,25 @@
1
+ import { ActionsObservable } from 'redux-observable';
2
+ import { 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>;
6
+ export declare const confirmCardSetupIntentEpic: (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" | "bill_pay_bulk_submit" | "bill_pay_bulk_processed" | "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" | "save_vendor_marked_as_local_contractor" | "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_card_setup" | "confirm_card_setup" | "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" | "task_group_creation_success" | "task_group_deletion_success" | "task_group_update_success";
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("@stripe/stripe-js").StripeError | undefined;
23
+ };
24
+ type: string;
25
+ }>;
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.confirmCardSetupIntentEpic = 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 confirmCardSetupIntentEpic = (actions$) => actions$.pipe((0, operators_1.filter)(cardPaymentViewReducer_1.confirmCardSetupIntent.match), (0, operators_1.mergeMap)((action) => {
9
+ var _a;
10
+ const { setupIntentData } = action.payload;
11
+ const { setupIntent, error } = setupIntentData;
12
+ if (setupIntent != null && error == null) {
13
+ const setupIntentData = {
14
+ id: setupIntent.id,
15
+ status: setupIntent.status,
16
+ clientSecret: setupIntent.client_secret,
17
+ };
18
+ return (0, rxjs_1.from)([
19
+ (0, cardPaymentViewReducer_1.updateConfirmCardSetupIntentStatus)({
20
+ fetchState: 'Completed',
21
+ setupIntentData,
22
+ }),
23
+ ]);
24
+ }
25
+ else {
26
+ return (0, rxjs_1.from)([
27
+ (0, cardPaymentViewReducer_1.updateConfirmCardSetupIntentStatus)({
28
+ fetchState: 'Error',
29
+ error,
30
+ }),
31
+ (0, snackbarReducer_1.openSnackbar)({
32
+ messageSection: 'confirm_card_setup',
33
+ messageText: 'failed',
34
+ type: 'error',
35
+ variables: [
36
+ {
37
+ variableName: '_api-error_',
38
+ variableValue: (_a = error.message) !== null && _a !== void 0 ? _a : 'Unknown error',
39
+ },
40
+ ],
41
+ }),
42
+ ]);
43
+ }
44
+ }));
45
+ exports.confirmCardSetupIntentEpic = confirmCardSetupIntentEpic;
@@ -0,0 +1,27 @@
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 createCardSetupIntentEpic: (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" | "bill_pay_bulk_submit" | "bill_pay_bulk_processed" | "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" | "save_vendor_marked_as_local_contractor" | "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_card_setup" | "confirm_card_setup" | "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" | "task_group_creation_success" | "task_group_deletion_success" | "task_group_update_success";
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 | undefined;
24
+ error?: import("../../../responsePayload").ZeniAPIStatus<Record<string, unknown>> | undefined;
25
+ };
26
+ type: string;
27
+ }>;
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createCardSetupIntentEpic = 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 createCardSetupIntentEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(cardPaymentViewReducer_1.createCardSetupIntent.match), (0, operators_1.mergeMap)((action) => {
10
+ const { paymentsMethod } = action.payload;
11
+ const payload = Object.assign({}, prepareCreateSetupIntentPayload(paymentsMethod));
12
+ const createSetupIntentApi$ = zeniAPI.postAndGetJSON(`${zeniAPI.apiEndPoints.payMicroServiceBaseUrl}/1.0/stripe/cards/setup_intent`, payload);
13
+ return createSetupIntentApi$.pipe((0, operators_1.mergeMap)((response) => {
14
+ if ((0, responsePayload_1.isSuccessResponse)(response) && response.data) {
15
+ const { client_secret } = response.data;
16
+ return (0, rxjs_1.from)([
17
+ (0, cardPaymentViewReducer_1.updateCardSetupIntentStatus)({
18
+ fetchState: 'Completed',
19
+ clientSecret: client_secret,
20
+ }),
21
+ ]);
22
+ }
23
+ else {
24
+ return (0, rxjs_1.from)([
25
+ (0, cardPaymentViewReducer_1.updateCardSetupIntentStatus)({
26
+ fetchState: 'Error',
27
+ error: response.status,
28
+ }),
29
+ (0, snackbarReducer_1.openSnackbar)({
30
+ messageSection: 'create_card_setup',
31
+ messageText: 'failed',
32
+ type: 'error',
33
+ variables: [
34
+ {
35
+ variableName: '_api-error_',
36
+ variableValue: response.status.message,
37
+ },
38
+ ],
39
+ }),
40
+ ]);
41
+ }
42
+ }), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, cardPaymentViewReducer_1.updateCardSetupIntentStatus)({
43
+ fetchState: 'Error',
44
+ error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Create Setup Intent REST API call errored out ' +
45
+ JSON.stringify(error)),
46
+ }))));
47
+ }));
48
+ exports.createCardSetupIntentEpic = createCardSetupIntentEpic;
49
+ /**
50
+ * Helpers
51
+ */
52
+ const prepareCreateSetupIntentPayload = (paymentsMethod) => {
53
+ return {
54
+ payment_method_types: paymentsMethod,
55
+ };
56
+ };
@@ -0,0 +1,28 @@
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
+ export declare type ActionType = ReturnType<typeof fetchPaymentSources> | ReturnType<typeof openSnackbar> | ReturnType<typeof updatePaymentSources>;
7
+ export declare const fetchPaymentSourcesEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<{
8
+ payload: {
9
+ 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" | "bill_pay_bulk_submit" | "bill_pay_bulk_processed" | "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" | "save_vendor_marked_as_local_contractor" | "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_card_setup" | "confirm_card_setup" | "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" | "task_group_creation_success" | "task_group_deletion_success" | "task_group_update_success";
10
+ messageText: "failed" | "success" | "notification";
11
+ type: import("../../..").SnackbarMessageType;
12
+ showStatusIcon?: boolean | undefined;
13
+ variables?: {
14
+ variableName: string;
15
+ variableValue: string;
16
+ }[] | undefined;
17
+ };
18
+ type: string;
19
+ } | {
20
+ payload: {
21
+ fetchState: import("../../..").FetchState;
22
+ error?: import("../../../responsePayload").ZeniAPIStatus<Record<string, unknown>> | undefined;
23
+ response?: import("../cardPaymentViewPayload").AddCardPaymentSourceResponse | undefined;
24
+ };
25
+ type: string;
26
+ } | import("@reduxjs/toolkit").PayloadAction<import("../../../entity/cardPayment/cardPaymentPayload").CardPaymentPayload[], string, {
27
+ updateType: import("../../..").UpdateType;
28
+ }, never>>;
@@ -0,0 +1,48 @@
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
+ const queryParams = { is_return_only_valid: true };
12
+ const fetchPaymentSourcesApi$ = zeniAPI.getJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/subscriptions/payment-sources?query=${encodeURIComponent(JSON.stringify(queryParams))}`);
13
+ return fetchPaymentSourcesApi$.pipe((0, operators_1.mergeMap)((response) => {
14
+ if ((0, responsePayload_1.isSuccessResponse)(response) && response.data) {
15
+ return (0, rxjs_1.from)([
16
+ (0, cardPaymentViewReducer_1.updatePaymentSources)({
17
+ fetchState: 'Completed',
18
+ response: response.data,
19
+ }),
20
+ (0, cardPaymentReducer_1.updateCardPayments)(response.data.payment_sources.cards),
21
+ ]);
22
+ }
23
+ else {
24
+ return (0, rxjs_1.from)([
25
+ (0, cardPaymentViewReducer_1.updatePaymentSources)({
26
+ fetchState: 'Error',
27
+ error: response.status,
28
+ }),
29
+ (0, snackbarReducer_1.openSnackbar)({
30
+ messageSection: 'fetch_payment_sources',
31
+ messageText: 'failed',
32
+ type: 'error',
33
+ variables: [
34
+ {
35
+ variableName: '_api-error_',
36
+ variableValue: response.status.message,
37
+ },
38
+ ],
39
+ }),
40
+ ]);
41
+ }
42
+ }), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, cardPaymentViewReducer_1.updatePaymentSources)({
43
+ fetchState: 'Error',
44
+ error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Fetch Payment Sources API call errored out ' +
45
+ JSON.stringify(error)),
46
+ }))));
47
+ }));
48
+ exports.fetchPaymentSourcesEpic = fetchPaymentSourcesEpic;
@@ -15,6 +15,8 @@ const retryBankAccountConnectionForOnboardingEpic = (actions$, state$, zeniAPI)
15
15
  const tenantId = company === null || company === void 0 ? void 0 : company.company.companyInfo.tenantId;
16
16
  const payload = {
17
17
  company_id: companyId,
18
+ type: 'direct_debit',
19
+ payment_source_type: 'processor_token',
18
20
  };
19
21
  if (tenantId != null) {
20
22
  return zeniAPI
@@ -9,8 +9,7 @@ import { updateFiles } from '../../../../../entity/file/fileReducer';
9
9
  import { updateAddresses } from '../../../../../entity/address/addressReducer';
10
10
  import { updateAccounts } from '../../../../../entity/account/accountReducer';
11
11
  import { updatePaymentAccounts } from '../../../../../entity/paymentAccount/paymentAccountReducer';
12
- import { updateSubscriptionPaymentAccounts } from '../../../../../entity/subscriptionPaymentAccount/subscriptionPaymentAccountReducer';
13
12
  import { openSnackbar } from '../../../../../entity/snackbar/snackbarReducer';
14
13
  import { fetchOnboardingCustomerSetupView, fetchOnboardingCustomerSetupViewSuccess, fetchOnboardingCustomerSetupViewFailure, updateOnboardingCustomerViewAccountDetails, updateOnboardingCustomerViewLocalStoreData } from '../../onboardingCustomerViewReducer';
15
- export declare type ActionType = ReturnType<typeof fetchOnboardingCustomerSetupView> | ReturnType<typeof updateAllUsers> | ReturnType<typeof updateUserRoles> | ReturnType<typeof updateCompanies> | ReturnType<typeof updateFiles> | ReturnType<typeof updateAccounts> | ReturnType<typeof updateAddresses> | ReturnType<typeof updatePaymentAccounts> | ReturnType<typeof updateSubscriptionPaymentAccounts> | ReturnType<typeof updateOnboardingCustomerViewLocalStoreData> | ReturnType<typeof updateOnboardingCustomerViewAccountDetails> | ReturnType<typeof openSnackbar> | ReturnType<typeof fetchOnboardingCustomerSetupViewSuccess> | ReturnType<typeof fetchOnboardingCustomerSetupViewFailure>;
14
+ export declare type ActionType = ReturnType<typeof fetchOnboardingCustomerSetupView> | ReturnType<typeof updateAllUsers> | ReturnType<typeof updateUserRoles> | ReturnType<typeof updateCompanies> | ReturnType<typeof updateFiles> | ReturnType<typeof updateAccounts> | ReturnType<typeof updateAddresses> | ReturnType<typeof updatePaymentAccounts> | ReturnType<typeof updateOnboardingCustomerViewLocalStoreData> | ReturnType<typeof updateOnboardingCustomerViewAccountDetails> | ReturnType<typeof openSnackbar> | ReturnType<typeof fetchOnboardingCustomerSetupViewSuccess> | ReturnType<typeof fetchOnboardingCustomerSetupViewFailure>;
16
15
  export declare const fetchOnboardingCustomerSetupViewEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
@@ -11,7 +11,6 @@ const fileReducer_1 = require("../../../../../entity/file/fileReducer");
11
11
  const addressReducer_1 = require("../../../../../entity/address/addressReducer");
12
12
  const accountReducer_1 = require("../../../../../entity/account/accountReducer");
13
13
  const paymentAccountReducer_1 = require("../../../../../entity/paymentAccount/paymentAccountReducer");
14
- const subscriptionPaymentAccountReducer_1 = require("../../../../../entity/subscriptionPaymentAccount/subscriptionPaymentAccountReducer");
15
14
  const companySelector_1 = require("../../../../../entity/company/companySelector");
16
15
  const snackbarReducer_1 = require("../../../../../entity/snackbar/snackbarReducer");
17
16
  const onboardingCustomerViewReducer_1 = require("../../onboardingCustomerViewReducer");
@@ -29,7 +28,6 @@ const fetchOnboardingCustomerSetupViewEpic = (actions$, state$, zeniAPI) => acti
29
28
  .pipe((0, operators_1.mergeMap)((response) => {
30
29
  if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
31
30
  const paymentAccountIds = response.data.payment_accounts.map((paymentAccount) => paymentAccount.payment_account_id);
32
- const subscriptionPaymentAccountIds = response.data.subscription_payment_accounts.map((subscriptionPaymentAccount) => subscriptionPaymentAccount.subscription_payment_account_id);
33
31
  const actions = [
34
32
  (0, userReducer_1.updateAllUsers)({ users: response.data.users }),
35
33
  (0, userRoleReducer_1.updateUserRoles)(response.data.user_roles),
@@ -41,8 +39,7 @@ const fetchOnboardingCustomerSetupViewEpic = (actions$, state$, zeniAPI) => acti
41
39
  (0, fileReducer_1.updateFiles)({ files: response.data.files }),
42
40
  (0, accountReducer_1.updateAccounts)(response.data.accounts, 'onboarding'),
43
41
  (0, paymentAccountReducer_1.updatePaymentAccounts)(response.data.payment_accounts),
44
- (0, subscriptionPaymentAccountReducer_1.updateSubscriptionPaymentAccounts)(response.data.subscription_payment_accounts),
45
- (0, onboardingCustomerViewReducer_1.updateOnboardingCustomerViewAccountDetails)(paymentAccountIds, subscriptionPaymentAccountIds),
42
+ (0, onboardingCustomerViewReducer_1.updateOnboardingCustomerViewAccountDetails)(paymentAccountIds),
46
43
  (0, onboardingCustomerViewReducer_1.updateOnboardingCustomerViewLocalStoreData)({
47
44
  companyId: response.data.companies[0].company_id,
48
45
  reCalculateCurrentStep,
@@ -62,8 +59,8 @@ const fetchOnboardingCustomerSetupViewEpic = (actions$, state$, zeniAPI) => acti
62
59
  JSON.stringify(error))))));
63
60
  }
64
61
  else {
65
- const { subscriptionPaymentAccountIds, paymentAccountDetails } = onboardingCustomerViewState;
66
- return (0, rxjs_1.of)((0, onboardingCustomerViewReducer_1.updateOnboardingCustomerViewAccountDetails)(paymentAccountDetails.paymentAccountIds, subscriptionPaymentAccountIds), (0, onboardingCustomerViewReducer_1.updateOnboardingCustomerViewLocalStoreData)({
62
+ const { paymentAccountDetails } = onboardingCustomerViewState;
63
+ return (0, rxjs_1.of)((0, onboardingCustomerViewReducer_1.updateOnboardingCustomerViewAccountDetails)(paymentAccountDetails.paymentAccountIds), (0, onboardingCustomerViewReducer_1.updateOnboardingCustomerViewLocalStoreData)({
67
64
  companyId,
68
65
  reCalculateCurrentStep,
69
66
  }), (0, onboardingCustomerViewReducer_1.fetchOnboardingCustomerSetupViewSuccess)());
@@ -18,12 +18,10 @@ const addressViewReducer_1 = require("../../../../addressView/addressViewReducer
18
18
  const paymentAccountSelector_1 = require("../../../../../entity/paymentAccount/paymentAccountSelector");
19
19
  const tenantSelector_1 = require("../../../../../entity/tenant/tenantSelector");
20
20
  const onboardingCustomerViewSelector_1 = require("../../onboardingCustomerViewSelector");
21
- const subscriptionPaymentAccountSelector_1 = require("../../../../../entity/subscriptionPaymentAccount/subscriptionPaymentAccountSelector");
22
21
  const updateOnboardingCustomerViewLocalStoreDataEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)(onboardingCustomerViewReducer_1.updateOnboardingCustomerViewLocalStoreData.match), (0, operators_1.mergeMap)((action) => {
23
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
22
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
24
23
  const { companyId, currentStep, reCalculateCurrentStep } = action.payload;
25
- const { companyState, companyViewState, fileState, userState, userRoleState, onboardingCustomerViewState, subscriptionPaymentAccountState, paymentAccountState, } = state$.value;
26
- const { subscriptionPaymentAccountIds } = onboardingCustomerViewState;
24
+ const { companyState, companyViewState, fileState, userState, userRoleState, onboardingCustomerViewState, paymentAccountState, } = state$.value;
27
25
  const subscriptionIDs = (0, get_1.default)(companyViewState.passportView.subscriptionIDsByCompanyID, companyId, undefined);
28
26
  const companyView = (0, getCompanyView_1.getCompanyView)(state$.value, companyId, subscriptionIDs !== null && subscriptionIDs !== void 0 ? subscriptionIDs : []);
29
27
  const company = (_a = (0, companySelector_1.getCompanyByCompanyId)(companyState, companyId)) === null || _a === void 0 ? void 0 : _a.company;
@@ -44,13 +42,8 @@ const updateOnboardingCustomerViewLocalStoreDataEpic = (actions$, state$) => act
44
42
  updatedCompanyDetails = Object.assign(Object.assign({}, onboardingCustomerViewState.companyDetails.localData), { syncToken });
45
43
  }
46
44
  let updatedCurrentStep = 'link_payment_account';
47
- let subscriptionPaymentAccount;
48
45
  const { companyOnboardingInfo } = company;
49
46
  const accountingConnectionCreationMode = (_d = companyOnboardingInfo === null || companyOnboardingInfo === void 0 ? void 0 : companyOnboardingInfo.onboardingInfo) === null || _d === void 0 ? void 0 : _d.accountingConnectionCreationMode;
50
- if (subscriptionPaymentAccountIds.length > 0) {
51
- const subscriptionPaymentAccountId = subscriptionPaymentAccountIds[0];
52
- subscriptionPaymentAccount = (0, subscriptionPaymentAccountSelector_1.getSubscriptionPaymentAccountByAccountId)(subscriptionPaymentAccountState, subscriptionPaymentAccountId);
53
- }
54
47
  const currentTenant = (0, tenantSelector_1.getCurrentTenant)(state$.value);
55
48
  const externalConnections = currentTenant.externalConnections;
56
49
  const isValidConnection = (_f = (_e = externalConnections === null || externalConnections === void 0 ? void 0 : externalConnections.accounting[0]) === null || _e === void 0 ? void 0 : _e.isValid) !== null && _f !== void 0 ? _f : false;
@@ -62,9 +55,8 @@ const updateOnboardingCustomerViewLocalStoreDataEpic = (actions$, state$) => act
62
55
  const paymentAccountId = paymentAccountIds[0];
63
56
  paymentAccount = (0, paymentAccountSelector_1.getPaymentAccountByPaymentAccountId)(paymentAccountState, paymentAccountId);
64
57
  }
65
- if ((((_h = (_g = paymentAccount === null || paymentAccount === void 0 ? void 0 : paymentAccount.providerVerificationStatus) === null || _g === void 0 ? void 0 : _g.code) === null || _h === void 0 ? void 0 : _h.includes('verified')) === true &&
66
- (paymentAccount === null || paymentAccount === void 0 ? void 0 : paymentAccount.isLoginRequired) === false) ||
67
- ((_k = (_j = subscriptionPaymentAccount === null || subscriptionPaymentAccount === void 0 ? void 0 : subscriptionPaymentAccount.providerVerificationStatus) === null || _j === void 0 ? void 0 : _j.code) === null || _k === void 0 ? void 0 : _k.includes('verified')) === true) {
58
+ if (((_h = (_g = paymentAccount === null || paymentAccount === void 0 ? void 0 : paymentAccount.providerVerificationStatus) === null || _g === void 0 ? void 0 : _g.code) === null || _h === void 0 ? void 0 : _h.includes('verified')) === true &&
59
+ (paymentAccount === null || paymentAccount === void 0 ? void 0 : paymentAccount.isLoginRequired) === false) {
68
60
  updatedCurrentStep = 'qbo_connection';
69
61
  if (isValidConnection) {
70
62
  updatedCurrentStep = 'company_officer';
@@ -80,7 +72,7 @@ const updateOnboardingCustomerViewLocalStoreDataEpic = (actions$, state$) => act
80
72
  }
81
73
  }
82
74
  }
83
- const { allStepsData } = (0, onboardingCustomerViewSelector_1.onboardingStepsData)(isValidConnection, (_l = currentTenant === null || currentTenant === void 0 ? void 0 : currentTenant.productSettings) !== null && _l !== void 0 ? _l : [], accountingConnectionCreationMode, subscriptionPaymentAccount);
75
+ const { allStepsData } = (0, onboardingCustomerViewSelector_1.onboardingStepsData)(isValidConnection, (_j = currentTenant === null || currentTenant === void 0 ? void 0 : currentTenant.productSettings) !== null && _j !== void 0 ? _j : [], accountingConnectionCreationMode);
84
76
  if (allStepsData.length > 0 &&
85
77
  allStepsData.indexOf(updatedCurrentStep) === -1) {
86
78
  updatedCurrentStep = allStepsData[0];
@@ -60,9 +60,8 @@ export declare const fetchOnboardingCustomerView: import("@reduxjs/toolkit").Act
60
60
  linkTokenType: PlaidLinkTokenType;
61
61
  }, string, never, never>, updateCurrentStep: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
62
62
  step: OnboardingStep;
63
- }, string>, updateOnboardingCustomerViewAccountDetails: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[paymentAccountIds: string[], subscriptionPaymentAccountIds: string[]], {
63
+ }, string>, updateOnboardingCustomerViewAccountDetails: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[paymentAccountIds: string[]], {
64
64
  paymentAccountIds: string[];
65
- subscriptionPaymentAccountIds: string[];
66
65
  }, string, never, never>, updateOnboardingCustomerViewLocalStoreData: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
67
66
  companyId: ID;
68
67
  currentStep?: "company_details" | "company_officer" | "link_payment_account" | "qbo_connection" | undefined;
@@ -73,7 +73,6 @@ exports.initialState = {
73
73
  updateStatus: initialStatus,
74
74
  paymentAccountIds: [],
75
75
  },
76
- subscriptionPaymentAccountIds: [],
77
76
  plaidConnectionDetails: {
78
77
  link_account: {
79
78
  fetchStatus: initialStatus,
@@ -96,6 +95,7 @@ exports.initialState = {
96
95
  error: undefined,
97
96
  uiState: {
98
97
  isQBOPopupOpen: false,
98
+ isCardPaymentPopupOpen: false,
99
99
  },
100
100
  hasValidState() {
101
101
  return this.fetchState === 'Completed';
@@ -146,13 +146,12 @@ const onboardingCustomerView = (0, toolkit_1.createSlice)({
146
146
  draft.currentStep = action.payload.step;
147
147
  },
148
148
  updateOnboardingCustomerViewAccountDetails: {
149
- prepare(paymentAccountIds, subscriptionPaymentAccountIds) {
150
- return { payload: { paymentAccountIds, subscriptionPaymentAccountIds } };
149
+ prepare(paymentAccountIds) {
150
+ return { payload: { paymentAccountIds } };
151
151
  },
152
152
  reducer(draft, action) {
153
- const { paymentAccountIds, subscriptionPaymentAccountIds } = action.payload;
153
+ const { paymentAccountIds } = action.payload;
154
154
  draft.paymentAccountDetails.paymentAccountIds = paymentAccountIds;
155
- draft.subscriptionPaymentAccountIds = subscriptionPaymentAccountIds;
156
155
  draft.paymentAccountDetails.fetchStatus = {
157
156
  fetchState: 'Completed',
158
157
  error: undefined,
@@ -46,7 +46,7 @@ export declare function getOnboardingCustomerView(state: RootState, companyId: I
46
46
  */
47
47
  export declare function isCompanyDetailsCompleted(fileState: FileState, company?: CompanyView, primaryContact?: User): boolean;
48
48
  export declare function isOfficerDetailsCompleted(companyOfficers: User[], companyOfficerRoles: UserRole[], officerDetails: CompanyOfficerLocalData, fileState: FileState): boolean;
49
- export declare const onboardingStepsData: (isValidConnection: boolean, productSettings: TenantProductSettings, accountingConnectionCreationMode?: AccountingConnectionCreationMode | undefined, subscriptionPaymentAccount?: SubscriptionPaymentAccount | undefined) => {
49
+ export declare const onboardingStepsData: (isValidConnection: boolean, productSettings: TenantProductSettings, accountingConnectionCreationMode?: AccountingConnectionCreationMode | undefined) => {
50
50
  allStepsData: OnboardingStep[];
51
51
  requiredStepsData: OnboardingStep[];
52
52
  };
@@ -2,7 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.isOfficerDetailsSavePending = exports.isCompanyDetailsSavePending = exports.onboardingStepsData = exports.isOfficerDetailsCompleted = exports.isCompanyDetailsCompleted = exports.getOnboardingCustomerView = void 0;
4
4
  const paymentAccountSelector_1 = require("../../../entity/paymentAccount/paymentAccountSelector");
5
- const subscriptionPaymentAccountSelector_1 = require("../../../entity/subscriptionPaymentAccount/subscriptionPaymentAccountSelector");
6
5
  const onboardingCustomerViewState_1 = require("./onboardingCustomerViewState");
7
6
  const tenantSelector_1 = require("../../../entity/tenant/tenantSelector");
8
7
  const getCompanyView_1 = require("../../companyView/selectorHelpers/getCompanyView");
@@ -13,11 +12,10 @@ const userSelector_1 = require("../../../entity/user/userSelector");
13
12
  const userRoleSelector_1 = require("../../../entity/userRole/userRoleSelector");
14
13
  const fileSelector_1 = require("../../../entity/file/fileSelector");
15
14
  function getOnboardingCustomerView(state, companyId) {
16
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
17
- const { fileState, paymentAccountState, onboardingCustomerViewState, userState, userRoleState, subscriptionPaymentAccountState, companyConfigState, } = state;
18
- const { companyDetails, companyOfficerUpdateStatus, primaryContactDetails, subscriptionPaymentAccountIds, paymentAccountDetails, plaidConnectionDetails, updateStatus, saveStatus, currentStep, uiState, fetchState, error, } = onboardingCustomerViewState;
15
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
16
+ const { fileState, paymentAccountState, onboardingCustomerViewState, userState, userRoleState, companyConfigState, } = state;
17
+ const { companyDetails, companyOfficerUpdateStatus, primaryContactDetails, paymentAccountDetails, plaidConnectionDetails, updateStatus, saveStatus, currentStep, uiState, fetchState, error, } = onboardingCustomerViewState;
19
18
  const { paymentAccountIds } = paymentAccountDetails;
20
- let subscriptionPaymentAccount;
21
19
  let paymentAccount;
22
20
  let paymentAccountStatus;
23
21
  if ((paymentAccountIds === null || paymentAccountIds === void 0 ? void 0 : paymentAccountIds.length) > 0) {
@@ -38,10 +36,6 @@ function getOnboardingCustomerView(state, companyId) {
38
36
  };
39
37
  }
40
38
  }
41
- if (subscriptionPaymentAccountIds.length > 0) {
42
- const subscriptionPaymentAccountId = subscriptionPaymentAccountIds[0];
43
- subscriptionPaymentAccount = (0, subscriptionPaymentAccountSelector_1.getSubscriptionPaymentAccountByAccountId)(subscriptionPaymentAccountState, subscriptionPaymentAccountId);
44
- }
45
39
  const currentTenant = (0, tenantSelector_1.getCurrentTenant)(state);
46
40
  const externalConnections = currentTenant.externalConnections;
47
41
  const companyView = (0, getCompanyView_1.getCompanyView)(state, companyId, []);
@@ -58,13 +52,12 @@ function getOnboardingCustomerView(state, companyId) {
58
52
  primaryContactDetails,
59
53
  });
60
54
  const completedSteps = [];
61
- if ((((_j = (_h = paymentAccount === null || paymentAccount === void 0 ? void 0 : paymentAccount.providerVerificationStatus) === null || _h === void 0 ? void 0 : _h.code) === null || _j === void 0 ? void 0 : _j.includes('verified')) ===
55
+ if (((_j = (_h = paymentAccount === null || paymentAccount === void 0 ? void 0 : paymentAccount.providerVerificationStatus) === null || _h === void 0 ? void 0 : _h.code) === null || _j === void 0 ? void 0 : _j.includes('verified')) ===
62
56
  true &&
63
- (paymentAccount === null || paymentAccount === void 0 ? void 0 : paymentAccount.isLoginRequired) === false) ||
64
- ((_l = (_k = subscriptionPaymentAccount === null || subscriptionPaymentAccount === void 0 ? void 0 : subscriptionPaymentAccount.providerVerificationStatus) === null || _k === void 0 ? void 0 : _k.code) === null || _l === void 0 ? void 0 : _l.includes('verified')) === true) {
57
+ (paymentAccount === null || paymentAccount === void 0 ? void 0 : paymentAccount.isLoginRequired) === false) {
65
58
  completedSteps.push('link_payment_account');
66
59
  }
67
- const isValidConnection = (_o = (_m = externalConnections === null || externalConnections === void 0 ? void 0 : externalConnections.accounting[0]) === null || _m === void 0 ? void 0 : _m.isValid) !== null && _o !== void 0 ? _o : false;
60
+ const isValidConnection = (_l = (_k = externalConnections === null || externalConnections === void 0 ? void 0 : externalConnections.accounting[0]) === null || _k === void 0 ? void 0 : _k.isValid) !== null && _l !== void 0 ? _l : false;
68
61
  if (isValidConnection) {
69
62
  completedSteps.push('qbo_connection');
70
63
  }
@@ -81,7 +74,7 @@ function getOnboardingCustomerView(state, companyId) {
81
74
  isOfficerDetailsCompleted(companyOfficers, companyOfficerRoles, companyOfficerLocalData[selectedOfficerType], fileState)) {
82
75
  completedSteps.push('company_officer');
83
76
  }
84
- const { allStepsData, requiredStepsData } = (0, exports.onboardingStepsData)(isValidConnection, (_p = currentTenant === null || currentTenant === void 0 ? void 0 : currentTenant.productSettings) !== null && _p !== void 0 ? _p : [], accountingConnectionCreationMode, subscriptionPaymentAccount);
77
+ const { allStepsData, requiredStepsData } = (0, exports.onboardingStepsData)(isValidConnection, (_m = currentTenant === null || currentTenant === void 0 ? void 0 : currentTenant.productSettings) !== null && _m !== void 0 ? _m : [], accountingConnectionCreationMode);
85
78
  const allRequiredStepsCompleted = requiredStepsData.every((step) => {
86
79
  return completedSteps.includes(step);
87
80
  });
@@ -108,7 +101,6 @@ function getOnboardingCustomerView(state, companyId) {
108
101
  allStepsCompleted,
109
102
  companyIndustries,
110
103
  externalConnections,
111
- subscriptionPaymentAccount,
112
104
  paymentAccount,
113
105
  paymentAccountStatus,
114
106
  plaidConnectionDetails,
@@ -177,23 +169,15 @@ function isOfficerDetailsCompleted(companyOfficers, companyOfficerRoles, officer
177
169
  files.length >= 2);
178
170
  }
179
171
  exports.isOfficerDetailsCompleted = isOfficerDetailsCompleted;
180
- const onboardingStepsData = (isValidConnection, productSettings, accountingConnectionCreationMode, subscriptionPaymentAccount) => {
172
+ const onboardingStepsData = (isValidConnection, productSettings, accountingConnectionCreationMode) => {
181
173
  const allStepsData = accountingConnectionCreationMode === 'zeni_user' ||
182
174
  (productSettings.isBankingEnabled && !productSettings.isBookkeepingEnabled)
183
- ? subscriptionPaymentAccount != null
184
- ? onboardingCustomerViewState_1.ALL_ZENI_USER_ONBOARDING_STEPS_WITHOUT_ACCOUNT
185
- : onboardingCustomerViewState_1.ALL_ZENI_USER_ONBOARDING_STEPS
186
- : subscriptionPaymentAccount != null
187
- ? onboardingCustomerViewState_1.ALL_CUSTOMER_ONBOARDING_STEPS_WITH_QBO
188
- : onboardingCustomerViewState_1.ALL_ONBOARDING_STEPS;
175
+ ? onboardingCustomerViewState_1.ALL_ZENI_USER_ONBOARDING_STEPS
176
+ : onboardingCustomerViewState_1.ALL_ONBOARDING_STEPS;
189
177
  const requiredStepsData = (accountingConnectionCreationMode === 'zeni_user' && isValidConnection) ||
190
178
  (productSettings.isBankingEnabled && !productSettings.isBookkeepingEnabled)
191
- ? subscriptionPaymentAccount != null
192
- ? []
193
- : onboardingCustomerViewState_1.ZENI_USER_REQUIRED_ONBOARDING_STEPS
194
- : subscriptionPaymentAccount != null
195
- ? onboardingCustomerViewState_1.CUSTOMER_REQUIRED_ONBOARDING_STEPS_WITH_QBO
196
- : onboardingCustomerViewState_1.REQUIRED_ONBOARDING_STEPS;
179
+ ? onboardingCustomerViewState_1.ZENI_USER_REQUIRED_ONBOARDING_STEPS
180
+ : onboardingCustomerViewState_1.REQUIRED_ONBOARDING_STEPS;
197
181
  return {
198
182
  allStepsData: allStepsData.map((step) => (0, onboardingCustomerViewState_1.toOnboardingStepType)(step)),
199
183
  requiredStepsData: requiredStepsData.map((step) => (0, onboardingCustomerViewState_1.toOnboardingStepType)(step)),
@@ -18,6 +18,7 @@ export declare const toOnboardingStepTypeStrict: (v: string | null) => Onboardin
18
18
  export declare type OnboardingCustomerViewLocalData = SetupViewLocalData;
19
19
  export interface OnboardingCustomerViewUIState {
20
20
  isQBOPopupOpen: boolean;
21
+ isCardPaymentPopupOpen: boolean;
21
22
  }
22
23
  export interface OnboardingCustomerViewState extends FetchedState {
23
24
  saveStatus: FetchStateAndError;
@@ -38,7 +39,6 @@ export interface OnboardingCustomerViewState extends FetchedState {
38
39
  updateStatus: FetchStateAndError;
39
40
  paymentAccountIds: ID[];
40
41
  };
41
- subscriptionPaymentAccountIds: ID[];
42
42
  plaidConnectionDetails: PlaidConnectionDetails;
43
43
  currentStep: OnboardingStep;
44
44
  uiState: OnboardingCustomerViewUIState;