@zeniai/client-epic-state 5.1.67 → 5.1.68-beta0ND

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 (50) hide show
  1. package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
  2. package/lib/entity/snackbar/snackbarTypes.js +1 -0
  3. package/lib/entity/tenant/tenantReducer.d.ts +5 -1
  4. package/lib/entity/tenant/tenantReducer.js +19 -2
  5. package/lib/epic.d.ts +5 -3
  6. package/lib/epic.js +5 -3
  7. package/lib/esm/entity/snackbar/snackbarTypes.js +1 -0
  8. package/lib/esm/entity/tenant/tenantReducer.js +18 -1
  9. package/lib/esm/epic.js +5 -3
  10. package/lib/esm/index.js +3 -3
  11. package/lib/esm/view/companyView/companyViewReducer.js +26 -1
  12. package/lib/esm/view/companyView/epic/companyPassport/updateCompanyProductServicesEpic.js +81 -0
  13. package/lib/esm/view/companyView/selector/companyManagementViewSelector.js +6 -0
  14. package/lib/esm/view/companyView/types/cockpitTypes.js +1 -0
  15. package/lib/esm/view/companyView/types/companyPassport/companyPassportViewState.js +4 -0
  16. package/lib/esm/view/invoicing/createInvoice/createInvoiceReducer.js +15 -1
  17. package/lib/esm/view/invoicing/createInvoice/createInvoiceSelector.js +5 -1
  18. package/lib/esm/view/invoicing/createInvoice/epics/fetchCreateInvoiceFormPageEpic.js +50 -0
  19. package/lib/esm/view/invoicing/editInvoicingCouponDetailView/editInvoicingCouponDetailViewPayload.js +0 -1
  20. package/lib/esm/view/spendManagement/billPay/billDetailView/billDetailViewSelector.js +4 -4
  21. package/lib/esm/view/spendManagement/billPay/billList/billListSelector.js +1 -1
  22. package/lib/esm/view/spendManagement/helpers.js +1 -1
  23. package/lib/esm/view/spendManagement/reimbursement/remiDetailView/remiDetailViewSelector.js +4 -4
  24. package/lib/esm/view/spendManagement/reimbursement/remiListView/remiListSelector.js +2 -2
  25. package/lib/index.d.ts +3 -3
  26. package/lib/index.js +39 -37
  27. package/lib/view/companyView/companyViewReducer.d.ts +11 -1
  28. package/lib/view/companyView/companyViewReducer.js +28 -3
  29. package/lib/view/companyView/epic/companyPassport/updateCompanyProductServicesEpic.d.ts +10 -0
  30. package/lib/view/companyView/epic/companyPassport/updateCompanyProductServicesEpic.js +85 -0
  31. package/lib/view/companyView/selector/companyManagementViewSelector.js +6 -0
  32. package/lib/view/companyView/types/cockpitTypes.d.ts +2 -2
  33. package/lib/view/companyView/types/cockpitTypes.js +1 -0
  34. package/lib/view/companyView/types/companyPassport/companyPassportViewState.d.ts +1 -0
  35. package/lib/view/companyView/types/companyPassport/companyPassportViewState.js +4 -0
  36. package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
  37. package/lib/view/invoicing/createInvoice/createInvoiceReducer.d.ts +5 -1
  38. package/lib/view/invoicing/createInvoice/createInvoiceReducer.js +16 -2
  39. package/lib/view/invoicing/createInvoice/createInvoiceSelector.d.ts +1 -0
  40. package/lib/view/invoicing/createInvoice/createInvoiceSelector.js +5 -1
  41. package/lib/view/invoicing/createInvoice/epics/fetchCreateInvoiceFormPageEpic.d.ts +15 -0
  42. package/lib/view/invoicing/createInvoice/epics/fetchCreateInvoiceFormPageEpic.js +54 -0
  43. package/lib/view/invoicing/editInvoicingCouponDetailView/editInvoicingCouponDetailViewPayload.js +0 -1
  44. package/lib/view/spendManagement/billPay/billDetailView/billDetailViewSelector.d.ts +1 -0
  45. package/lib/view/spendManagement/billPay/billDetailView/billDetailViewSelector.js +4 -4
  46. package/lib/view/spendManagement/billPay/billList/billListSelector.js +1 -1
  47. package/lib/view/spendManagement/helpers.js +1 -1
  48. package/lib/view/spendManagement/reimbursement/remiDetailView/remiDetailViewSelector.js +4 -4
  49. package/lib/view/spendManagement/reimbursement/remiListView/remiListSelector.js +1 -1
  50. package/package.json +1 -1
@@ -0,0 +1,85 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.updateCompanyProductServicesEpic = void 0;
4
+ const rxjs_1 = require("rxjs");
5
+ const operators_1 = require("rxjs/operators");
6
+ const companyReducer_1 = require("../../../../entity/company/companyReducer");
7
+ const snackbarReducer_1 = require("../../../../entity/snackbar/snackbarReducer");
8
+ const tenantReducer_1 = require("../../../../entity/tenant/tenantReducer");
9
+ const responsePayload_1 = require("../../../../responsePayload");
10
+ const companyViewReducer_1 = require("../../companyViewReducer");
11
+ const updateCompanyProductServicesEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(companyViewReducer_1.updateCompanyProductServices.match), (0, operators_1.switchMap)((action) => {
12
+ const { companyId, services } = action.payload;
13
+ const { isBookkeepingEnabled, isBillPayEnabled, isReimbursementEnabled } = services;
14
+ const tenantId = Object.values(state$.value.tenantState.tenantsById).find((tenant) => tenant?.companyId === companyId)?.tenantId;
15
+ // Send only the service-enable fields so the backend routes this through
16
+ // its isolated "enable services" path. Bookkeeping is a Tenant product
17
+ // flag and implies spend management; bill pay / reimbursement are Company
18
+ // feature flags.
19
+ const requestBody = {};
20
+ if (isBookkeepingEnabled != null) {
21
+ requestBody.is_book_keeping_enabled = isBookkeepingEnabled;
22
+ requestBody.is_spend_management_enabled = isBookkeepingEnabled;
23
+ }
24
+ if (isBillPayEnabled != null) {
25
+ requestBody.is_bill_pay_feature_enabled = isBillPayEnabled;
26
+ }
27
+ if (isReimbursementEnabled != null) {
28
+ requestBody.is_reimbursement_feature_enabled = isReimbursementEnabled;
29
+ }
30
+ return zeniAPI
31
+ .putAndGetJSON(`${zeniAPI.apiEndPoints.tenantMicroServiceBaseUrl}/1.0/companies/${companyId}`, requestBody)
32
+ .pipe((0, operators_1.mergeMap)((response) => {
33
+ if ((0, responsePayload_1.isSuccessResponse)(response)) {
34
+ const companies = response.data?.companies ?? [];
35
+ if (companies.length > 0) {
36
+ const actions = [
37
+ (0, companyReducer_1.updateCompanies)({
38
+ payload: companies,
39
+ schema: {},
40
+ }),
41
+ ];
42
+ // The company response carries the company feature flags; the
43
+ // tenant product flags are not part of it, so merge them from
44
+ // the (now-succeeded) request values.
45
+ if (isBookkeepingEnabled != null && tenantId != null) {
46
+ actions.push((0, tenantReducer_1.updateTenantProductSettings)({
47
+ tenantId,
48
+ isBookkeepingEnabled,
49
+ isSpendManagementEnabled: isBookkeepingEnabled,
50
+ }));
51
+ }
52
+ actions.push((0, companyViewReducer_1.updateCompanyProductServicesSuccess)());
53
+ actions.push((0, snackbarReducer_1.openSnackbar)({
54
+ messageSection: 'product_services_update',
55
+ messageText: 'success',
56
+ type: 'success',
57
+ }));
58
+ return (0, rxjs_1.from)(actions);
59
+ }
60
+ }
61
+ return (0, rxjs_1.from)([
62
+ (0, companyViewReducer_1.updateCompanyProductServicesFailure)({
63
+ status: response.status,
64
+ }),
65
+ (0, snackbarReducer_1.openSnackbar)({
66
+ messageSection: 'product_services_update',
67
+ messageText: 'failed',
68
+ type: 'error',
69
+ }),
70
+ ]);
71
+ }), (0, operators_1.catchError)((error) => (0, rxjs_1.from)([
72
+ (0, companyViewReducer_1.updateCompanyProductServicesFailure)({
73
+ status: (0, responsePayload_1.createZeniAPIStatus)('Unexpected error', 'Update Company Product Services errored out' +
74
+ (error instanceof Error
75
+ ? error.message
76
+ : JSON.stringify(error))),
77
+ }),
78
+ (0, snackbarReducer_1.openSnackbar)({
79
+ messageSection: 'product_services_update',
80
+ messageText: 'failed',
81
+ type: 'error',
82
+ }),
83
+ ])));
84
+ }));
85
+ exports.updateCompanyProductServicesEpic = updateCompanyProductServicesEpic;
@@ -201,6 +201,7 @@ const sortAndFilterCompanies = (sortKey, sortOrder, filterText, companies, userS
201
201
  updatedCompanies.forEach((company) => {
202
202
  switch (sortKey) {
203
203
  case 'companyName':
204
+ case 'productVerticals':
204
205
  companiesWithSortKeyValue.push(company);
205
206
  break;
206
207
  case 'status':
@@ -436,6 +437,11 @@ const sortAndFilterCompanies = (sortKey, sortOrder, filterText, companies, userS
436
437
  primarySortValue = (company.company.company.companyInfo.bookCloseDate ??
437
438
  (0, zeniDayJS_1.date)('1970-01-01T00:00:00.000Z')).valueOf();
438
439
  break;
440
+ case 'productVerticals':
441
+ // Not a meaningful sort axis (bookkeeping is tenant-level and not
442
+ // in this view); keep stable order rather than falling through to
443
+ // the status/group default sort.
444
+ break;
439
445
  case 'status':
440
446
  default: {
441
447
  isMultiSortApplicable = true;
@@ -4,9 +4,9 @@ import { SubscriptionViewSortKey } from '../../subscriptionView/types/subscripti
4
4
  import { FilterCategoryValueType } from '../helpers/cockpitHelpers';
5
5
  import { CockpitDownloadTabsID, CockpitTabsFileType } from './cockpitTabsID';
6
6
  export declare const toPortfolioSortKeyType: (v: string) => "companyName" | "expenses" | "runway" | "cashBalance" | "revenues" | "netIncome";
7
- export declare const toManagementSortKeyType: (v: string) => "status" | "bookCloseDate" | "companyName" | "group" | "controller" | "plans" | "monthlyRecurringRevenue" | "notes" | "taxStatus" | "preparer" | "reviewer" | "annualRecurringRevenue" | "task" | "customerSuccessManager" | "apAnalyst" | "reportSent" | "taxLead" | "satisfaction";
7
+ export declare const toManagementSortKeyType: (v: string) => "status" | "bookCloseDate" | "companyName" | "group" | "controller" | "plans" | "monthlyRecurringRevenue" | "notes" | "taxStatus" | "preparer" | "reviewer" | "annualRecurringRevenue" | "task" | "productVerticals" | "customerSuccessManager" | "apAnalyst" | "reportSent" | "taxLead" | "satisfaction";
8
8
  export declare const toOnboardingSortKeyType: (v: string) => "companyName" | "notes" | "businessVerified" | "identityVerified" | "bankAccountLinked" | "customerCreated" | "groupCreated" | "qboLinked" | "enroller" | "invite" | "latestCreated";
9
- export declare const toHealthSortKeyType: (v: string) => "companyName" | "group" | "controller" | "monthlyRecurringRevenue" | "runway" | "companyEngagementMetricsUpdatedAt" | "customerSatisfactionScore" | "externalProductServiceExposure" | "netPromoterScore" | "customerSuccessManager" | "issues" | "productVerticals" | "churnProbability" | "lastReportSent" | "subscriptionDate" | "renewalDate" | "dashboardLastSeen" | "lastEngagement";
9
+ export declare const toHealthSortKeyType: (v: string) => "companyName" | "group" | "controller" | "monthlyRecurringRevenue" | "runway" | "companyEngagementMetricsUpdatedAt" | "customerSatisfactionScore" | "externalProductServiceExposure" | "netPromoterScore" | "productVerticals" | "customerSuccessManager" | "issues" | "churnProbability" | "lastReportSent" | "subscriptionDate" | "renewalDate" | "dashboardLastSeen" | "lastEngagement";
10
10
  export declare const toTaskManagerSortKeyType: (v: string) => "status" | "name" | "priority" | "tags" | "createdBy" | "dueDate" | "assignee" | "taskName";
11
11
  export type PortfolioViewSortKey = ReturnType<typeof toPortfolioSortKeyType>;
12
12
  export type ManagementViewSortKey = ReturnType<typeof toManagementSortKeyType>;
@@ -16,6 +16,7 @@ const ALL_MANAGEMENT_SORT_KEYS = [
16
16
  'status',
17
17
  'group',
18
18
  'plans',
19
+ 'productVerticals',
19
20
  'controller',
20
21
  'customerSuccessManager',
21
22
  'reviewer',
@@ -20,5 +20,6 @@ export interface CompanyPassportViewState extends CommonState, FetchedState {
20
20
  updateStatus: FetchStateAndError;
21
21
  localData?: PrimaryContactLocalData;
22
22
  };
23
+ productServicesUpdateStatus: FetchStateAndError;
23
24
  }
24
25
  export declare const initialCompanyPassportView: CompanyPassportViewState;
@@ -12,6 +12,10 @@ exports.initialCompanyPassportView = {
12
12
  fetchState: 'Not-Started',
13
13
  error: undefined,
14
14
  },
15
+ productServicesUpdateStatus: {
16
+ fetchState: 'Not-Started',
17
+ error: undefined,
18
+ },
15
19
  capitalizationThresholdUpdateStatus: {
16
20
  fetchState: 'Not-Started',
17
21
  error: undefined,
@@ -39,7 +39,7 @@ export declare const getLineItemsByTransactionsIdsFromResponse: (transactions: S
39
39
  export declare const getLineItemsByTransactionIdsFromLocalData: (transactionLocalData: TransactionReviewLocalDataSelectorView[], selectedTab: TransactionsTab) => Record<ID, string[]>;
40
40
  export declare const mergeTabSpecificLineItems: (currentTabSpecificLineItems: TabSpecificLineItems, selectedTab: TransactionsTab, newLineItems: TabSpecificLineItems) => TabSpecificLineItems;
41
41
  export declare const getSnackbarMessageForTransactionReview: (updatedCount: number, failedCount: number, categorizedCount: number) => {
42
- messageSection: "common" | "transactionDetails_updatingPastTransactions" | "transactionDetails_transactionUpdated" | "cockpit_month_end_email_sent" | "cockpit_month_end_email_save" | "cockpit_month_end_email_attachment_upload" | "je_bill_link" | "je_posted" | "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_setup" | "reimbursement_approval_create" | "reimbursement_duplicate_approval_create" | "reimbursement_approval_update" | "reimbursement_duplicate_approval_update" | "reimbursement_approval_delete" | "reimbursement_approval_reorder" | "reimbursement_create_mileage" | "reimbursement_update_mileage" | "reimbursement_accept_term" | "reimbursement_accept_employee_term" | "reimbursement_bulk_submit" | "reimbursement_bulk_processed" | "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_approval_reorder" | "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" | "bill_pay_refund" | "bill_pay_retry" | "bill_pay_marked_as_paid" | "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" | "charge_card_receipt_upload" | "charge_card_resend_invite" | "charge_card_revoke_invite" | "card_policy_created" | "card_policy_updated" | "card_policy_deleted" | "charge_card_update_limit" | "charge_cards_update_limit" | "close_charge_card" | "lock_charge_card" | "lock_charge_card_card_user" | "lock_charge_cards" | "unlock_charge_card" | "unlock_charge_card_card_user" | "unlock_charge_cards" | "close_charge_cards" | "revoke_invite_charge_cards" | "charge_card_express_interest" | "create_schedule" | "save_schedule" | "delete_schedule" | "ignore_schedule" | "save_task_detail" | "fetch_task_detail" | "delete_task" | "archive_task" | "snooze_task" | "unsnooze_task" | "create_tag" | "delete_tag" | "update_charge_card" | "update_charge_card_name" | "update_charge_card_name_card_user" | "issue_charge_card" | "issue_charge_cards" | "notification_settings_saved" | "referral_invite_sent" | "notification_mark_as_read" | "mark_as_complete_schedule" | "cancel_journal_entry" | "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" | "primary_funding_account_updated" | "task_time_spent_validation" | "missing_receipts_attachment" | "flux_analysis_unreviewed" | "flux_analysis_reviewed" | "receipt_match" | "receipts_upload" | "receipts_bulk_match" | "billing_address_view" | "express_pay_submit" | "exclude_transaction" | "reconcile" | "save_reconcile_for_later" | "recon_transaction_categorize" | "recon_transaction_match" | "update_debit_card_pin_attempt" | "set_debit_card_pin" | "ai_cfo_create_session_and_submit" | "ai_cfo_chat_session_deleted" | "charge_card_auto_pay_enable" | "charge_card_auto_pay_disable" | "treasury_setup" | "treasury_accept_term" | "treasury_transfer_money" | "treasury_transfer_money_failed" | "auto_transfer_rule_create" | "auto_transfer_rule_update" | "auto_transfer_rule_delete" | "auto_transfer_rule_pause" | "auto_transfer_rule_resume" | "treasury_update_portfolio_allocation" | "send_email_magic_link_to_user" | "complete_profile_done" | "create_transfer_entry" | "reports_resync" | "invalid_phone_number" | "transactions_categorized_updated_failed" | "transaction_categorized_updated_failed" | "transactionsCategorized_transactionsUpdated" | "transactionsCategorized_transactionUpdated" | "transactionCategorized_transactionsUpdated" | "transactionCategorized_transactionUpdated" | "transactionsCategorized_transactionsFailed" | "transactionsCategorized_transactionFailed" | "transactionCategorized_transactionsFailed" | "transactionCategorized_transactionFailed" | "transactionsUpdated_transactionsFailed" | "transactionsUpdated_transactionFailed" | "transactionUpdated_transactionsFailed" | "transactionUpdated_transactionFailed" | "transactionsCategorized_transactionsUpdated_transactionsFailed" | "transactionsCategorized_transactionsUpdated_transactionFailed" | "transactionsCategorized_transactionUpdated_transactionsFailed" | "transactionCategorized_transactionsUpdated_transactionsFailed" | "transactionsCategorized_transactionUpdated_transactionFailed" | "transactionCategorized_transactionsUpdated_transactionFailed" | "transactionCategorized_transactionUpdated_transactionsFailed" | "transactionCategorized_transactionUpdated_transactionFailed" | "accounting_classes_enabled_update" | "accounting_projects_enabled_update" | "accounting_projects_qbo_not_enabled" | "capitalization_threshold_update" | "account_excluded_from_reconciliation" | "account_included_in_reconciliation" | "statement_parsing_in_progress" | "statement_parsing_complete" | "ai_accountant_trigger_job" | "oauth_consent_approve" | "oauth_consent_invalid_request" | "credit_agent_update_profile" | "credit_agent_save_macro" | "credit_agent_schedule_cron" | "create_sub_task" | "qbo_connection_already_linked" | "qbo_connection_failed" | "accounting_projects_qbo_reconnect_failed";
42
+ messageSection: "common" | "transactionDetails_updatingPastTransactions" | "transactionDetails_transactionUpdated" | "cockpit_month_end_email_sent" | "cockpit_month_end_email_save" | "cockpit_month_end_email_attachment_upload" | "je_bill_link" | "je_posted" | "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_setup" | "reimbursement_approval_create" | "reimbursement_duplicate_approval_create" | "reimbursement_approval_update" | "reimbursement_duplicate_approval_update" | "reimbursement_approval_delete" | "reimbursement_approval_reorder" | "reimbursement_create_mileage" | "reimbursement_update_mileage" | "reimbursement_accept_term" | "reimbursement_accept_employee_term" | "reimbursement_bulk_submit" | "reimbursement_bulk_processed" | "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_approval_reorder" | "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" | "bill_pay_refund" | "bill_pay_retry" | "bill_pay_marked_as_paid" | "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" | "charge_card_receipt_upload" | "charge_card_resend_invite" | "charge_card_revoke_invite" | "card_policy_created" | "card_policy_updated" | "card_policy_deleted" | "charge_card_update_limit" | "charge_cards_update_limit" | "close_charge_card" | "lock_charge_card" | "lock_charge_card_card_user" | "lock_charge_cards" | "unlock_charge_card" | "unlock_charge_card_card_user" | "unlock_charge_cards" | "close_charge_cards" | "revoke_invite_charge_cards" | "charge_card_express_interest" | "create_schedule" | "save_schedule" | "delete_schedule" | "ignore_schedule" | "save_task_detail" | "fetch_task_detail" | "delete_task" | "archive_task" | "snooze_task" | "unsnooze_task" | "create_tag" | "delete_tag" | "update_charge_card" | "update_charge_card_name" | "update_charge_card_name_card_user" | "issue_charge_card" | "issue_charge_cards" | "notification_settings_saved" | "referral_invite_sent" | "notification_mark_as_read" | "mark_as_complete_schedule" | "cancel_journal_entry" | "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" | "primary_funding_account_updated" | "task_time_spent_validation" | "missing_receipts_attachment" | "flux_analysis_unreviewed" | "flux_analysis_reviewed" | "receipt_match" | "receipts_upload" | "receipts_bulk_match" | "billing_address_view" | "express_pay_submit" | "exclude_transaction" | "reconcile" | "save_reconcile_for_later" | "recon_transaction_categorize" | "recon_transaction_match" | "update_debit_card_pin_attempt" | "set_debit_card_pin" | "ai_cfo_create_session_and_submit" | "ai_cfo_chat_session_deleted" | "charge_card_auto_pay_enable" | "charge_card_auto_pay_disable" | "treasury_setup" | "treasury_accept_term" | "treasury_transfer_money" | "treasury_transfer_money_failed" | "auto_transfer_rule_create" | "auto_transfer_rule_update" | "auto_transfer_rule_delete" | "auto_transfer_rule_pause" | "auto_transfer_rule_resume" | "treasury_update_portfolio_allocation" | "send_email_magic_link_to_user" | "complete_profile_done" | "create_transfer_entry" | "reports_resync" | "invalid_phone_number" | "transactions_categorized_updated_failed" | "transaction_categorized_updated_failed" | "transactionsCategorized_transactionsUpdated" | "transactionsCategorized_transactionUpdated" | "transactionCategorized_transactionsUpdated" | "transactionCategorized_transactionUpdated" | "transactionsCategorized_transactionsFailed" | "transactionsCategorized_transactionFailed" | "transactionCategorized_transactionsFailed" | "transactionCategorized_transactionFailed" | "transactionsUpdated_transactionsFailed" | "transactionsUpdated_transactionFailed" | "transactionUpdated_transactionsFailed" | "transactionUpdated_transactionFailed" | "transactionsCategorized_transactionsUpdated_transactionsFailed" | "transactionsCategorized_transactionsUpdated_transactionFailed" | "transactionsCategorized_transactionUpdated_transactionsFailed" | "transactionCategorized_transactionsUpdated_transactionsFailed" | "transactionsCategorized_transactionUpdated_transactionFailed" | "transactionCategorized_transactionsUpdated_transactionFailed" | "transactionCategorized_transactionUpdated_transactionsFailed" | "transactionCategorized_transactionUpdated_transactionFailed" | "accounting_classes_enabled_update" | "accounting_projects_enabled_update" | "accounting_projects_qbo_not_enabled" | "capitalization_threshold_update" | "account_excluded_from_reconciliation" | "account_included_in_reconciliation" | "statement_parsing_in_progress" | "statement_parsing_complete" | "ai_accountant_trigger_job" | "oauth_consent_approve" | "oauth_consent_invalid_request" | "credit_agent_update_profile" | "credit_agent_save_macro" | "credit_agent_schedule_cron" | "create_sub_task" | "qbo_connection_already_linked" | "qbo_connection_failed" | "accounting_projects_qbo_reconnect_failed" | "product_services_update";
43
43
  messageText: "notification" | "failed" | "success";
44
44
  type: "error" | "success" | "info";
45
45
  variables: {
@@ -5,6 +5,10 @@ import { CreateInvoiceState, InvoicingCreateInvoiceFormLocalData } from './creat
5
5
  export declare const initialState: CreateInvoiceState;
6
6
  export declare const createInvoice: import("@reduxjs/toolkit").ActionCreatorWithPayload<CreateInvoiceRequest, "invoicingCreateInvoice/createInvoice">, createInvoiceSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
7
7
  invoiceId: ID;
8
- }, "invoicingCreateInvoice/createInvoiceSuccess">, createInvoiceFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "invoicingCreateInvoice/createInvoiceFailure">, resetCreateInvoice: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"invoicingCreateInvoice/resetCreateInvoice">, updateInvoicingCreateInvoiceFormDraft: import("@reduxjs/toolkit").ActionCreatorWithPayload<InvoicingCreateInvoiceFormLocalData, "invoicingCreateInvoice/updateInvoicingCreateInvoiceFormDraft">;
8
+ }, "invoicingCreateInvoice/createInvoiceSuccess">, createInvoiceFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "invoicingCreateInvoice/createInvoiceFailure">, fetchCreateInvoiceFormPage: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[payload: {
9
+ cacheOverride: boolean;
10
+ }], {
11
+ cacheOverride: boolean;
12
+ }, "invoicingCreateInvoice/fetchCreateInvoiceFormPage", never, never>, resetCreateInvoice: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"invoicingCreateInvoice/resetCreateInvoice">, updateInvoicingCreateInvoiceFormDraft: import("@reduxjs/toolkit").ActionCreatorWithPayload<InvoicingCreateInvoiceFormLocalData, "invoicingCreateInvoice/updateInvoicingCreateInvoiceFormDraft">;
9
13
  declare const _default: import("redux").Reducer<CreateInvoiceState>;
10
14
  export default _default;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  var _a;
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.updateInvoicingCreateInvoiceFormDraft = exports.resetCreateInvoice = exports.createInvoiceFailure = exports.createInvoiceSuccess = exports.createInvoice = exports.initialState = void 0;
4
+ exports.updateInvoicingCreateInvoiceFormDraft = exports.resetCreateInvoice = exports.fetchCreateInvoiceFormPage = exports.createInvoiceFailure = exports.createInvoiceSuccess = exports.createInvoice = exports.initialState = void 0;
5
5
  const toolkit_1 = require("@reduxjs/toolkit");
6
6
  const createInvoiceFormConfig_1 = require("./createInvoiceFormConfig");
7
7
  exports.initialState = {
@@ -18,6 +18,20 @@ const createInvoiceSlice = (0, toolkit_1.createSlice)({
18
18
  name: 'invoicingCreateInvoice',
19
19
  initialState: exports.initialState,
20
20
  reducers: {
21
+ /**
22
+ * Trigger-only action for {@link fetchCreateInvoiceFormPageEpic}: fans out to
23
+ * the customer/plan/product/settings fetches, skipping any already cached
24
+ * unless `cacheOverride` is set. Holds no state of its own.
25
+ */
26
+ fetchCreateInvoiceFormPage: {
27
+ reducer() {
28
+ // No state mutation; fetchCreateInvoiceFormPageEpic fans out to the
29
+ // customer/plan/product/settings fetches in response to this action.
30
+ },
31
+ prepare(payload) {
32
+ return { payload };
33
+ },
34
+ },
21
35
  updateInvoicingCreateInvoiceFormDraft(draft, action) {
22
36
  draft.formDraft = action.payload;
23
37
  },
@@ -41,5 +55,5 @@ const createInvoiceSlice = (0, toolkit_1.createSlice)({
41
55
  },
42
56
  },
43
57
  });
44
- _a = createInvoiceSlice.actions, exports.createInvoice = _a.createInvoice, exports.createInvoiceSuccess = _a.createInvoiceSuccess, exports.createInvoiceFailure = _a.createInvoiceFailure, exports.resetCreateInvoice = _a.resetCreateInvoice, exports.updateInvoicingCreateInvoiceFormDraft = _a.updateInvoicingCreateInvoiceFormDraft;
58
+ _a = createInvoiceSlice.actions, exports.createInvoice = _a.createInvoice, exports.createInvoiceSuccess = _a.createInvoiceSuccess, exports.createInvoiceFailure = _a.createInvoiceFailure, exports.fetchCreateInvoiceFormPage = _a.fetchCreateInvoiceFormPage, exports.resetCreateInvoice = _a.resetCreateInvoice, exports.updateInvoicingCreateInvoiceFormDraft = _a.updateInvoicingCreateInvoiceFormDraft;
45
59
  exports.default = createInvoiceSlice.reducer;
@@ -8,6 +8,7 @@ import { InvoicingCreateInvoiceFormLocalData } from './createInvoiceState';
8
8
  export interface CreateInvoiceFormView extends SelectorView {
9
9
  customers: InvoicingCustomer[];
10
10
  localData: InvoicingCreateInvoiceFormLocalData;
11
+ planNames: string[];
11
12
  plans: InvoicingProduct[];
12
13
  products: InvoicingProduct[];
13
14
  savedInvoiceId?: ID;
@@ -15,10 +15,14 @@ const settingsViewSelector_1 = require("../settingsView/settingsViewSelector");
15
15
  const getCreateInvoiceFormView = (state) => {
16
16
  const createInvoiceState = state.invoicingCreateInvoiceState;
17
17
  const catalogListView = (0, invoicingCatalogListViewSelector_1.getInvoicingCatalogListView)(state);
18
+ const plans = (0, invoicingCatalogListViewSelector_1.getInvoicingCatalogPrices)(catalogListView.plans);
18
19
  return {
19
20
  customers: (0, invoicingCustomerListViewSelector_1.getInvoicingCustomerListView)(state).customers,
20
21
  localData: createInvoiceState.formDraft,
21
- plans: (0, invoicingCatalogListViewSelector_1.getInvoicingCatalogPrices)(catalogListView.plans),
22
+ planNames: plans
23
+ .map((plan) => plan.name ?? '')
24
+ .filter((name) => name !== ''),
25
+ plans,
22
26
  products: (0, invoicingCatalogListViewSelector_1.getInvoicingCatalogPrices)(catalogListView.products),
23
27
  savedInvoiceId: createInvoiceState.createdInvoiceId,
24
28
  settings: (0, settingsViewSelector_1.getInvoicingSettings)(state),
@@ -0,0 +1,15 @@
1
+ import { ActionsObservable, StateObservable } from 'redux-observable';
2
+ import { Observable } from 'rxjs';
3
+ import { RootState } from '../../../../reducer';
4
+ import { fetchInvoicingCatalogPlanList, fetchInvoicingCatalogProductList } from '../../invoicingCatalogListView/invoicingCatalogListViewReducer';
5
+ import { fetchInvoicingCustomerList } from '../../invoicingCustomerListView/invoicingCustomerListViewReducer';
6
+ import { fetchInvoicingSettings } from '../../settingsView/settingsViewReducer';
7
+ import { fetchCreateInvoiceFormPage } from '../createInvoiceReducer';
8
+ export type ActionType = ReturnType<typeof fetchCreateInvoiceFormPage> | ReturnType<typeof fetchInvoicingCustomerList> | ReturnType<typeof fetchInvoicingCatalogPlanList> | ReturnType<typeof fetchInvoicingCatalogProductList> | ReturnType<typeof fetchInvoicingSettings>;
9
+ /**
10
+ * Orchestrates the create-invoice form's option sources: on
11
+ * `fetchCreateInvoiceFormPage`, fans out to the customer, catalog plan, catalog
12
+ * product and settings fetches, skipping any already cached unless
13
+ * `cacheOverride` is set.
14
+ */
15
+ export declare const fetchCreateInvoiceFormPageEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>) => Observable<ActionType>;
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.fetchCreateInvoiceFormPageEpic = void 0;
4
+ const rxjs_1 = require("rxjs");
5
+ const operators_1 = require("rxjs/operators");
6
+ const invoicingCatalogListViewReducer_1 = require("../../invoicingCatalogListView/invoicingCatalogListViewReducer");
7
+ const invoicingCustomerListViewReducer_1 = require("../../invoicingCustomerListView/invoicingCustomerListViewReducer");
8
+ const settingsViewReducer_1 = require("../../settingsView/settingsViewReducer");
9
+ const createInvoiceReducer_1 = require("../createInvoiceReducer");
10
+ /**
11
+ * Fetch unless the resource is already loaded or in flight — or always when the
12
+ * caller forces a refresh via `cacheOverride` (false on a plain page open, true
13
+ * to force a reload).
14
+ */
15
+ const shouldFetch = (fetchStateAndError, cacheOverride) => cacheOverride ||
16
+ (fetchStateAndError.fetchState !== 'Completed' &&
17
+ fetchStateAndError.fetchState !== 'In-Progress');
18
+ /**
19
+ * Orchestrates the create-invoice form's option sources: on
20
+ * `fetchCreateInvoiceFormPage`, fans out to the customer, catalog plan, catalog
21
+ * product and settings fetches, skipping any already cached unless
22
+ * `cacheOverride` is set.
23
+ */
24
+ const fetchCreateInvoiceFormPageEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)(createInvoiceReducer_1.fetchCreateInvoiceFormPage.match), (0, operators_1.mergeMap)((action) => {
25
+ const { cacheOverride } = action.payload;
26
+ const state = state$.value;
27
+ const customerState = state.invoicingCustomerListViewState;
28
+ const catalogState = state.invoicingCatalogListViewState;
29
+ const settingsState = state.invoicingSettingsViewState;
30
+ const pageActions = [];
31
+ if (shouldFetch({ fetchState: customerState.fetchState, error: customerState.error }, cacheOverride)) {
32
+ pageActions.push((0, invoicingCustomerListViewReducer_1.fetchInvoicingCustomerList)({
33
+ filters: {},
34
+ keepExistingListItems: false,
35
+ }));
36
+ }
37
+ if (shouldFetch({ fetchState: catalogState.fetchState, error: catalogState.error }, cacheOverride)) {
38
+ pageActions.push((0, invoicingCatalogListViewReducer_1.fetchInvoicingCatalogPlanList)({
39
+ filters: { type: 'plan' },
40
+ keepExistingListItems: false,
41
+ }));
42
+ }
43
+ if (shouldFetch(catalogState.productFetchState, cacheOverride)) {
44
+ pageActions.push((0, invoicingCatalogListViewReducer_1.fetchInvoicingCatalogProductList)({
45
+ filters: { type: 'addon|charge' },
46
+ keepExistingListItems: false,
47
+ }));
48
+ }
49
+ if (shouldFetch({ fetchState: settingsState.fetchState, error: settingsState.error }, cacheOverride)) {
50
+ pageActions.push((0, settingsViewReducer_1.fetchInvoicingSettings)());
51
+ }
52
+ return (0, rxjs_1.from)(pageActions);
53
+ }));
54
+ exports.fetchCreateInvoiceFormPageEpic = fetchCreateInvoiceFormPageEpic;
@@ -12,7 +12,6 @@ const localDataToSaveInvoicingCouponPayload = (localData, isCreate) => {
12
12
  discount_type: localData.discountType,
13
13
  duration_type: localData.durationType,
14
14
  name: localData.name.trim(),
15
- status: 'active',
16
15
  };
17
16
  if (isCreate) {
18
17
  data.id = localData.couponId.trim();
@@ -63,6 +63,7 @@ export interface ActorActivityWithUser {
63
63
  type: string;
64
64
  userId: ID;
65
65
  actor?: User;
66
+ isImplicitActor?: boolean;
66
67
  lastUpdateTime?: ZeniDate;
67
68
  subType?: string;
68
69
  }
@@ -316,7 +316,7 @@ const checkApproveRejectBtnShow = (billActivities, isUserAdmin, signedInUser) =>
316
316
  (actorActivity.subType === 'manager' ||
317
317
  actorActivity.subType === 'vendor_owner') &&
318
318
  actorActivity.userId === null &&
319
- isAdminFallbackApprover &&
319
+ isAdminFallbackApprover === true &&
320
320
  isUserAdmin &&
321
321
  signedInUser?.userId != null &&
322
322
  signedInUser.userId !== sodExcludedApproverUserId) {
@@ -330,7 +330,7 @@ const checkApproveRejectBtnShow = (billActivities, isUserAdmin, signedInUser) =>
330
330
  isUserAdmin &&
331
331
  signedInUser?.userId != null &&
332
332
  signedInUser.userId !== sodExcludedApproverUserId &&
333
- pendingStep.displayPendingApproverAsAdmin) {
333
+ pendingStep.displayPendingApproverAsAdmin === true) {
334
334
  isApprovalorRejectBtnVisible = true;
335
335
  isMarkAsPaidBtnVisible = isLastApprovalStep;
336
336
  }
@@ -365,7 +365,7 @@ const checkApproveRejectBtnShow = (billActivities, isUserAdmin, signedInUser) =>
365
365
  (actorActivity.subType === 'manager' ||
366
366
  actorActivity.subType === 'vendor_owner') &&
367
367
  actorActivity.userId === null &&
368
- isAdminFallbackApprover &&
368
+ isAdminFallbackApprover === true &&
369
369
  isUserAdmin &&
370
370
  signedInUser?.userId != null &&
371
371
  signedInUser.userId !== sodExcludedApproverUserId) {
@@ -379,7 +379,7 @@ const checkApproveRejectBtnShow = (billActivities, isUserAdmin, signedInUser) =>
379
379
  isUserAdmin &&
380
380
  signedInUser?.userId != null &&
381
381
  signedInUser.userId !== sodExcludedApproverUserId &&
382
- stepWithStatus.displayPendingApproverAsAdmin) {
382
+ stepWithStatus.displayPendingApproverAsAdmin === true) {
383
383
  isApprovalorRejectBtnVisible = true;
384
384
  isMarkAsPaidBtnVisible = true;
385
385
  }
@@ -326,7 +326,7 @@ const getApproversOrRejectors = (billTransaction, entityApprovalStatusState, use
326
326
  requireApprovalInfo = [stepsApprovalStatus[currentPendingStepIndex]];
327
327
  }
328
328
  requireApprovalInfo.forEach((approvalStep) => {
329
- if (approvers.displayPendingApproverAsAdmin) {
329
+ if (approvers.displayPendingApproverAsAdmin === true) {
330
330
  return;
331
331
  }
332
332
  const pendingActivities = approvalStep.actorsActivity.filter((activity) => activity.activity === 'pending');
@@ -25,7 +25,7 @@ const isSodExcludedViewerBlocked = (sodExcludedApproverUserId, signedInUserId, s
25
25
  (0, exports.isUserActorOnApprovalStep)(sodExcludedApproverUserId, stepActorsActivity);
26
26
  exports.isSodExcludedViewerBlocked = isSodExcludedViewerBlocked;
27
27
  const isSodAdminFallbackEligibleForStep = (sodExcludedApproverUserId, isAdminFallbackApprover, stepActorsActivity = []) => {
28
- if (sodExcludedApproverUserId == null || !isAdminFallbackApprover) {
28
+ if (sodExcludedApproverUserId == null || isAdminFallbackApprover !== true) {
29
29
  return false;
30
30
  }
31
31
  const pendingResolvedApprovers = stepActorsActivity.filter((activity) => activity.activity === 'pending' && getUserActorId(activity) != null);
@@ -247,7 +247,7 @@ const checkApproveRejectBtnShow = (remiActivities, isUserAdmin, signedInUser) =>
247
247
  actorActivity.subType === 'vendor_owner' ||
248
248
  actorActivity.subType === 'manager_of_manager') &&
249
249
  actorActivity.userId === null &&
250
- isAdminFallbackApprover &&
250
+ isAdminFallbackApprover === true &&
251
251
  isUserAdmin &&
252
252
  signedInUser?.userId != null &&
253
253
  signedInUser.userId !== sodExcludedApproverUserId) {
@@ -258,7 +258,7 @@ const checkApproveRejectBtnShow = (remiActivities, isUserAdmin, signedInUser) =>
258
258
  isUserAdmin &&
259
259
  signedInUser?.userId != null &&
260
260
  signedInUser.userId !== sodExcludedApproverUserId &&
261
- pendingStep.displayPendingApproverAsAdmin) {
261
+ pendingStep.displayPendingApproverAsAdmin === true) {
262
262
  isApprovalorRejectBtnVisible = true;
263
263
  }
264
264
  }
@@ -293,7 +293,7 @@ const checkApproveRejectBtnShow = (remiActivities, isUserAdmin, signedInUser) =>
293
293
  actorActivity.subType === 'vendor_owner' ||
294
294
  actorActivity.subType === 'manager_of_manager') &&
295
295
  actorActivity.userId === null &&
296
- isAdminFallbackApprover &&
296
+ isAdminFallbackApprover === true &&
297
297
  isUserAdmin &&
298
298
  signedInUser?.userId != null &&
299
299
  signedInUser.userId !== sodExcludedApproverUserId) {
@@ -304,7 +304,7 @@ const checkApproveRejectBtnShow = (remiActivities, isUserAdmin, signedInUser) =>
304
304
  isUserAdmin &&
305
305
  signedInUser?.userId != null &&
306
306
  signedInUser.userId !== sodExcludedApproverUserId &&
307
- stepWithStatus.displayPendingApproverAsAdmin) {
307
+ stepWithStatus.displayPendingApproverAsAdmin === true) {
308
308
  isApprovalorRejectBtnVisible = true;
309
309
  }
310
310
  }
@@ -245,7 +245,7 @@ const getApproversOrRejectors = (reimbursement, entityApprovalStatusState, userS
245
245
  requireApprovalInfo = [stepsApprovalStatus[currentPendingStepIndex]];
246
246
  }
247
247
  requireApprovalInfo.forEach((approvalStep) => {
248
- if (approvers.displayPendingApproverAsAdmin) {
248
+ if (approvers.displayPendingApproverAsAdmin === true) {
249
249
  return;
250
250
  }
251
251
  const pendingActivities = approvalStep.actorsActivity.filter((activity) => activity.activity === 'pending');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "5.1.67",
3
+ "version": "5.1.68-beta0ND",
4
4
  "description": "Shared module between Web & Mobile containing required abstractions for state management, async network communication. ",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib/esm/index.js",