@zeniai/client-epic-state 5.1.51-betaAK2 → 5.1.51-betaAK4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/lib/entity/invoicing/creditNote/creditNotePayload.d.ts +1 -0
  2. package/lib/entity/invoicing/creditNote/creditNotePayload.js +3 -4
  3. package/lib/entity/invoicing/invoice/invoicePayload.d.ts +1 -0
  4. package/lib/entity/invoicing/invoice/invoicePayload.js +7 -8
  5. package/lib/entity/invoicing/invoicingCustomer/invoicingCustomerPayload.js +1 -1
  6. package/lib/entity/invoicing/invoicingTransaction/invoicingTransactionPayload.d.ts +1 -0
  7. package/lib/entity/invoicing/invoicingTransaction/invoicingTransactionPayload.js +3 -4
  8. package/lib/entity/tenant/clearAllEpic.d.ts +2 -1
  9. package/lib/entity/tenant/clearAllEpic.js +2 -0
  10. package/lib/esm/entity/invoicing/creditNote/creditNotePayload.js +3 -4
  11. package/lib/esm/entity/invoicing/invoice/invoicePayload.js +7 -8
  12. package/lib/esm/entity/invoicing/invoicingCustomer/invoicingCustomerPayload.js +1 -1
  13. package/lib/esm/entity/invoicing/invoicingTransaction/invoicingTransactionPayload.js +3 -4
  14. package/lib/esm/entity/tenant/clearAllEpic.js +2 -0
  15. package/lib/esm/view/expenseAutomationView/reducers/reconciliationViewReducer.js +24 -7
  16. package/lib/esm/view/invoicing/couponView/couponViewReducer.js +21 -1
  17. package/lib/esm/view/invoicing/createInvoice/createInvoiceEpic.js +5 -0
  18. package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/saveInvoicingCatalogItemEpic.js +15 -1
  19. package/lib/esm/view/invoicing/editInvoicingCouponDetailView/saveInvoicingCouponEpic.js +15 -3
  20. package/lib/esm/view/invoicing/editInvoicingCustomerDetailView/saveInvoicingCustomerEpic.js +12 -1
  21. package/lib/esm/view/invoicing/editInvoicingSubscriptionDetailView/saveInvoicingSubscriptionEpic.js +12 -1
  22. package/lib/esm/view/invoicing/invoiceList/invoiceListReducer.js +15 -1
  23. package/lib/esm/view/invoicing/invoicingCatalogListView/epics/fetchInvoicingCatalogListPageEpic.js +5 -3
  24. package/lib/esm/view/invoicing/invoicingCatalogListView/invoicingCatalogListViewReducer.js +21 -1
  25. package/lib/esm/view/invoicing/invoicingCustomerListView/invoicingCustomerListViewReducer.js +17 -1
  26. package/lib/esm/view/invoicing/invoicingSubscriptionListView/invoicingSubscriptionListViewReducer.js +15 -1
  27. package/lib/esm/view/invoicing/invoicingTransactionListView/invoicingTransactionListViewReducer.js +11 -1
  28. package/lib/esm/view/invoicing/recordPayment/recordPaymentEpic.js +2 -0
  29. package/lib/view/expenseAutomationView/reducers/reconciliationViewReducer.js +24 -7
  30. package/lib/view/invoicing/couponView/couponViewReducer.d.ts +5 -1
  31. package/lib/view/invoicing/couponView/couponViewReducer.js +22 -2
  32. package/lib/view/invoicing/createInvoice/createInvoiceEpic.d.ts +2 -1
  33. package/lib/view/invoicing/createInvoice/createInvoiceEpic.js +5 -0
  34. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/saveInvoicingCatalogItemEpic.d.ts +2 -1
  35. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/saveInvoicingCatalogItemEpic.js +15 -1
  36. package/lib/view/invoicing/editInvoicingCouponDetailView/saveInvoicingCouponEpic.d.ts +2 -1
  37. package/lib/view/invoicing/editInvoicingCouponDetailView/saveInvoicingCouponEpic.js +15 -3
  38. package/lib/view/invoicing/editInvoicingCustomerDetailView/saveInvoicingCustomerEpic.d.ts +2 -1
  39. package/lib/view/invoicing/editInvoicingCustomerDetailView/saveInvoicingCustomerEpic.js +12 -1
  40. package/lib/view/invoicing/editInvoicingSubscriptionDetailView/saveInvoicingSubscriptionEpic.d.ts +2 -1
  41. package/lib/view/invoicing/editInvoicingSubscriptionDetailView/saveInvoicingSubscriptionEpic.js +12 -1
  42. package/lib/view/invoicing/invoiceList/invoiceListReducer.d.ts +6 -2
  43. package/lib/view/invoicing/invoiceList/invoiceListReducer.js +16 -2
  44. package/lib/view/invoicing/invoicingCatalogListView/epics/fetchInvoicingCatalogListPageEpic.d.ts +2 -2
  45. package/lib/view/invoicing/invoicingCatalogListView/epics/fetchInvoicingCatalogListPageEpic.js +5 -3
  46. package/lib/view/invoicing/invoicingCatalogListView/invoicingCatalogListViewReducer.d.ts +4 -1
  47. package/lib/view/invoicing/invoicingCatalogListView/invoicingCatalogListViewReducer.js +22 -2
  48. package/lib/view/invoicing/invoicingCustomerListView/invoicingCustomerListViewReducer.d.ts +4 -1
  49. package/lib/view/invoicing/invoicingCustomerListView/invoicingCustomerListViewReducer.js +18 -2
  50. package/lib/view/invoicing/invoicingSubscriptionListView/invoicingSubscriptionListViewReducer.d.ts +5 -1
  51. package/lib/view/invoicing/invoicingSubscriptionListView/invoicingSubscriptionListViewReducer.js +16 -2
  52. package/lib/view/invoicing/invoicingTransactionListView/invoicingTransactionListViewReducer.d.ts +1 -1
  53. package/lib/view/invoicing/invoicingTransactionListView/invoicingTransactionListViewReducer.js +12 -2
  54. package/lib/view/invoicing/recordPayment/recordPaymentEpic.d.ts +2 -1
  55. package/lib/view/invoicing/recordPayment/recordPaymentEpic.js +2 -0
  56. package/package.json +1 -1
@@ -25,6 +25,7 @@ export interface InvoicingCreditNotePayload {
25
25
  created_at?: string;
26
26
  credit_note_number?: string;
27
27
  currency_code?: string;
28
+ currency_symbol?: string;
28
29
  customer_id?: string;
29
30
  customer_name?: string;
30
31
  date?: string;
@@ -2,10 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.mapInvoicingCreditNotePayloadToState = exports.mapInvoicingCreditNoteAllocationPayloadToState = exports.mapInvoicingCreditNoteLineItemPayloadToState = void 0;
4
4
  const amount_1 = require("../../../commonStateTypes/amount");
5
+ const currencyHelper_1 = require("../../../commonStateTypes/currencyHelper");
5
6
  const zeniDayJS_1 = require("../../../zeniDayJS");
6
7
  // ── Payload → State mappers (snake_case wire shape → camelCase domain shape) ──
7
- const DEFAULT_CURRENCY_CODE = 'USD';
8
- const DEFAULT_CURRENCY_SYMBOL = '$';
9
8
  const mapInvoicingCreditNoteLineItemPayloadToState = (payload, currencyCode, currencySymbol) => ({
10
9
  amount: (0, amount_1.toAmount)(payload.amount, currencyCode, currencySymbol),
11
10
  description: payload.description,
@@ -22,8 +21,8 @@ const mapInvoicingCreditNoteAllocationPayloadToState = (payload, currencyCode, c
22
21
  });
23
22
  exports.mapInvoicingCreditNoteAllocationPayloadToState = mapInvoicingCreditNoteAllocationPayloadToState;
24
23
  const mapInvoicingCreditNotePayloadToState = (payload) => {
25
- const currencyCode = payload.currency_code ?? DEFAULT_CURRENCY_CODE;
26
- const currencySymbol = DEFAULT_CURRENCY_SYMBOL;
24
+ const currencyCode = payload.currency_code ?? currencyHelper_1.defaultCustomerCurrency.currencyCode;
25
+ const currencySymbol = payload.currency_symbol ?? currencyHelper_1.defaultCustomerCurrency.currencySymbol;
27
26
  const toAmt = (value) => (0, amount_1.toAmount)(value, currencyCode, currencySymbol);
28
27
  return {
29
28
  id: payload.id,
@@ -60,6 +60,7 @@ export interface InvoicingInvoicePayload {
60
60
  created_at?: string;
61
61
  credits_applied?: number;
62
62
  currency_code?: string;
63
+ currency_symbol?: string;
63
64
  customer_email?: string;
64
65
  customer_name?: string;
65
66
  due_date?: string;
@@ -2,10 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.mapInvoicingInvoiceKPIsPayloadToState = exports.mapInvoicingInvoicePayloadToState = exports.extractInvoicingInvoiceAddresses = void 0;
4
4
  const amount_1 = require("../../../commonStateTypes/amount");
5
+ const currencyHelper_1 = require("../../../commonStateTypes/currencyHelper");
5
6
  const zeniDayJS_1 = require("../../../zeniDayJS");
6
7
  // ── Payload → State mappers (snake_case wire shape → camelCase domain shape) ──
7
- const DEFAULT_CURRENCY_CODE = 'USD';
8
- const DEFAULT_CURRENCY_SYMBOL = '$';
9
8
  const mapLineItem = (payload, currencyCode, currencySymbol) => ({
10
9
  amount: (0, amount_1.toAmount)(payload.amount, currencyCode, currencySymbol),
11
10
  description: payload.description,
@@ -67,8 +66,8 @@ const extractInvoicingInvoiceAddresses = (payloads) => payloads
67
66
  .filter((address) => address != null);
68
67
  exports.extractInvoicingInvoiceAddresses = extractInvoicingInvoiceAddresses;
69
68
  const mapInvoicingInvoicePayloadToState = (payload) => {
70
- const currencyCode = payload.currency_code ?? DEFAULT_CURRENCY_CODE;
71
- const currencySymbol = DEFAULT_CURRENCY_SYMBOL;
69
+ const currencyCode = payload.currency_code ?? currencyHelper_1.defaultCustomerCurrency.currencyCode;
70
+ const currencySymbol = payload.currency_symbol ?? currencyHelper_1.defaultCustomerCurrency.currencySymbol;
72
71
  const toAmt = (value) => (0, amount_1.toAmount)(value, currencyCode, currencySymbol);
73
72
  return {
74
73
  customerID: payload.customer_id,
@@ -133,9 +132,9 @@ const mapInvoicingInvoicePayloadToState = (payload) => {
133
132
  };
134
133
  exports.mapInvoicingInvoicePayloadToState = mapInvoicingInvoicePayloadToState;
135
134
  const mapInvoicingInvoiceKPIsPayloadToState = (payload) => ({
136
- dueTotal: (0, amount_1.toAmount)(payload.due_total, DEFAULT_CURRENCY_CODE, DEFAULT_CURRENCY_SYMBOL),
137
- paidTotal: (0, amount_1.toAmount)(payload.paid_total, DEFAULT_CURRENCY_CODE, DEFAULT_CURRENCY_SYMBOL),
138
- pendingTotal: (0, amount_1.toAmount)(payload.pending_total, DEFAULT_CURRENCY_CODE, DEFAULT_CURRENCY_SYMBOL),
139
- totalInvoiced: (0, amount_1.toAmount)(payload.total_invoiced, DEFAULT_CURRENCY_CODE, DEFAULT_CURRENCY_SYMBOL),
135
+ dueTotal: (0, amount_1.toAmount)(payload.due_total, currencyHelper_1.defaultCustomerCurrency.currencyCode, currencyHelper_1.defaultCustomerCurrency.currencySymbol),
136
+ paidTotal: (0, amount_1.toAmount)(payload.paid_total, currencyHelper_1.defaultCustomerCurrency.currencyCode, currencyHelper_1.defaultCustomerCurrency.currencySymbol),
137
+ pendingTotal: (0, amount_1.toAmount)(payload.pending_total, currencyHelper_1.defaultCustomerCurrency.currencyCode, currencyHelper_1.defaultCustomerCurrency.currencySymbol),
138
+ totalInvoiced: (0, amount_1.toAmount)(payload.total_invoiced, currencyHelper_1.defaultCustomerCurrency.currencyCode, currencyHelper_1.defaultCustomerCurrency.currencySymbol),
140
139
  });
141
140
  exports.mapInvoicingInvoiceKPIsPayloadToState = mapInvoicingInvoiceKPIsPayloadToState;
@@ -24,7 +24,7 @@ const mapInvoicingCustomerPayloadToState = (payload) => {
24
24
  ? (0, amount_1.toAmount)(payload.arr, currencyCode, currencySymbol)
25
25
  : undefined,
26
26
  autoCollection: payload.auto_collection,
27
- billingAddressId: payload.billing_address_id,
27
+ billingAddressId: payload.billing_address_id ?? payload.billing_address?.address_id,
28
28
  cardStatus: payload.card_status,
29
29
  company: payload.company,
30
30
  consolidatedInvoicing: payload.consolidated_invoicing,
@@ -21,6 +21,7 @@ export interface InvoicingTransactionPayload {
21
21
  amount_capturable?: number;
22
22
  amount_unused?: number;
23
23
  currency_code?: string;
24
+ currency_symbol?: string;
24
25
  customer?: string;
25
26
  customer_id?: string;
26
27
  customer_name?: string;
@@ -2,10 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.mapInvoicingTransactionPayloadToState = void 0;
4
4
  const amount_1 = require("../../../commonStateTypes/amount");
5
+ const currencyHelper_1 = require("../../../commonStateTypes/currencyHelper");
5
6
  const zeniDayJS_1 = require("../../../zeniDayJS");
6
7
  // ── Payload → State mappers (snake_case wire shape → camelCase domain shape) ──
7
- const DEFAULT_CURRENCY_CODE = 'USD';
8
- const DEFAULT_CURRENCY_SYMBOL = '$';
9
8
  const mapLinkedInvoiceRef = (payload, currencyCode, currencySymbol) => ({
10
9
  appliedAmount: (0, amount_1.toAmount)(payload.applied_amount, currencyCode, currencySymbol),
11
10
  invoiceID: payload.invoice_id,
@@ -21,8 +20,8 @@ const mapLinkedCreditNoteRef = (payload, currencyCode, currencySymbol) => ({
21
20
  cnID: payload.cn_id,
22
21
  });
23
22
  const mapInvoicingTransactionPayloadToState = (payload) => {
24
- const currencyCode = payload.currency_code ?? DEFAULT_CURRENCY_CODE;
25
- const currencySymbol = DEFAULT_CURRENCY_SYMBOL;
23
+ const currencyCode = payload.currency_code ?? currencyHelper_1.defaultCustomerCurrency.currencyCode;
24
+ const currencySymbol = payload.currency_symbol ?? currencyHelper_1.defaultCustomerCurrency.currencySymbol;
26
25
  const toAmt = (value) => (0, amount_1.toAmount)(value, currencyCode, currencySymbol);
27
26
  return {
28
27
  amount: toAmt(payload.amount),
@@ -65,6 +65,7 @@ import { clearAllInvoicingDunningActions } from '../../view/invoicing/dunningAct
65
65
  import { resetEditInvoicingCatalogItemDetailView } from '../../view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewReducer';
66
66
  import { resetEditInvoicingCouponDetailView } from '../../view/invoicing/editInvoicingCouponDetailView/editInvoicingCouponDetailViewReducer';
67
67
  import { resetEditInvoicingCustomerDetailView } from '../../view/invoicing/editInvoicingCustomerDetailView/editInvoicingCustomerDetailViewReducer';
68
+ import { resetEditInvoicingSubscriptionDetailView } from '../../view/invoicing/editInvoicingSubscriptionDetailView/editInvoicingSubscriptionDetailViewReducer';
68
69
  import { clearAllInvoicingInvoiceActions } from '../../view/invoicing/invoiceAction/invoiceActionReducer';
69
70
  import { clearAllInvoiceDetail } from '../../view/invoicing/invoiceDetail/invoiceDetailReducer';
70
71
  import { clearInvoiceList } from '../../view/invoicing/invoiceList/invoiceListReducer';
@@ -255,7 +256,7 @@ import { clearAllUserRoles } from '../userRole/userRoleReducer';
255
256
  import { clearAllVendors } from '../vendor/vendorReducer';
256
257
  import { clearAllVendorExpenseTrends } from '../vendorExpense/vendorExpenseReducer';
257
258
  import { clearAll } from './tenantReducer';
258
- type clearActionTypeForViews = ReturnType<typeof clearAccountList> | ReturnType<typeof clearAccountMappingView> | ReturnType<typeof clearActivityHistory> | ReturnType<typeof clearActivityRealTimeApproval> | ReturnType<typeof clearAddressView> | ReturnType<typeof clearAiAccountantView> | ReturnType<typeof clearAllAiAccountantCustomers> | ReturnType<typeof clearAiCfoView> | ReturnType<typeof clearAllClasses> | ReturnType<typeof clearAllProjects> | ReturnType<typeof clearAllMonthEndCloseChecksView> | ReturnType<typeof clearApAging> | ReturnType<typeof clearApAgingDetail> | ReturnType<typeof clearArAging> | ReturnType<typeof clearArAgingDetail> | ReturnType<typeof clearAuthenticationView> | ReturnType<typeof clearAutoTransferRules> | ReturnType<typeof clearBalanceSheet> | ReturnType<typeof clearBankAccountView> | ReturnType<typeof clearBillDetailView> | ReturnType<typeof clearBillList> | ReturnType<typeof clearBillPayBulkActionView> | ReturnType<typeof clearBillPayCard> | ReturnType<typeof clearBillPayConfig> | ReturnType<typeof clearBillPayReview> | ReturnType<typeof clearBillPaySetupApproverView> | ReturnType<typeof clearBillPaySetupView> | ReturnType<typeof clearCardBalance> | ReturnType<typeof clearCardPaymentView> | ReturnType<typeof clearCardPolicyDetail> | ReturnType<typeof clearCardPolicyList> | ReturnType<typeof clearCardUserOnboarding> | ReturnType<typeof clearCashbackDetail> | ReturnType<typeof clearCashBalance> | ReturnType<typeof clearCashFlow> | ReturnType<typeof clearCashInCashOut> | ReturnType<typeof clearCashPosition> | ReturnType<typeof clearChargeCardConfig> | ReturnType<typeof clearChargeCardDetail> | ReturnType<typeof clearChargeCardList> | ReturnType<typeof clearChargeCardRepaymentDetail> | ReturnType<typeof clearChargeCardSetupView> | ReturnType<typeof clearChargeCardStatementList> | ReturnType<typeof clearCheckDeposit> | ReturnType<typeof clearCompanyConfigView> | ReturnType<typeof clearCompanyHealthMetric> | ReturnType<typeof clearCompanyHealthMetricView> | ReturnType<typeof clearCompanyMonthEndReportView> | ReturnType<typeof clearCompanyTaskManagerView> | ReturnType<typeof clearCompanyView> | ReturnType<typeof clearCreateCardPolicy> | ReturnType<typeof clearCreateTransferEntry> | ReturnType<typeof clearAllCreditAgent> | ReturnType<typeof clearCreditAgentView> | ReturnType<typeof clearDashboard> | ReturnType<typeof clearDashboardLayout> | ReturnType<typeof clearDepositAccountDetail> | ReturnType<typeof clearDepositAccountList> | ReturnType<typeof clearDepositAccountTransactionList> | ReturnType<typeof clearEditBillViewDetail> | ReturnType<typeof clearEditRemiViewDetail> | ReturnType<typeof clearAllEntityAutoCompleteResults> | ReturnType<typeof clearExpenseAutomationFluxAnalysisView> | ReturnType<typeof clearExpenseAutomationJESchedulesView> | ReturnType<typeof clearExpenseAutomationMissingReceiptsView> | ReturnType<typeof clearExpenseAutomationReconciliationView> | ReturnType<typeof clearExpenseAutomationTransactionsView> | ReturnType<typeof clearExpenseAutomationView> | ReturnType<typeof clearExpressPayView> | ReturnType<typeof clearFeatureNotificationView> | ReturnType<typeof clearFileViewList> | ReturnType<typeof clearFinanceStatement> | ReturnType<typeof clearForecastList> | ReturnType<typeof clearGlobalMerchantAutoCompleteResults> | ReturnType<typeof clearGlobalMerchantView> | ReturnType<typeof clearInsightsCard> | ReturnType<typeof clearInternationalWire> | ReturnType<typeof clearInternationalVerificationView> | ReturnType<typeof clearAllInvoiceDetail> | ReturnType<typeof clearInvoiceList> | ReturnType<typeof resetCreateInvoice> | ReturnType<typeof resetRecordPayment> | ReturnType<typeof clearInvoicingOverview> | ReturnType<typeof clearInvoicingAuditView> | ReturnType<typeof resetEditInvoicingCatalogItemDetailView> | ReturnType<typeof resetEditInvoicingCouponDetailView> | ReturnType<typeof clearInvoicingCouponDetailView> | ReturnType<typeof resetEditInvoicingCustomerDetailView> | ReturnType<typeof clearAllInvoicingDataImportActions> | ReturnType<typeof clearInvoicingDataImportView> | ReturnType<typeof clearAllInvoicingInvoiceActions> | ReturnType<typeof clearAllInvoicingSubscriptionActions> | ReturnType<typeof clearAllInvoicingDunningActions> | ReturnType<typeof clearAllInvoicingPaymentActions> | ReturnType<typeof resetSaveInvoicingSettings> | ReturnType<typeof clearInvoicingCatalogItemDetailView> | ReturnType<typeof clearInvoicingCatalogListView> | ReturnType<typeof clearInvoicingCouponView> | ReturnType<typeof clearInvoicingCreditNoteDetailView> | ReturnType<typeof clearInvoicingCreditNoteListView> | ReturnType<typeof clearInvoicingCustomerDetailView> | ReturnType<typeof clearInvoicingCustomerListView> | ReturnType<typeof clearInvoicingDunningCaseDetailView> | ReturnType<typeof clearInvoicingDunningCaseListView> | ReturnType<typeof clearInvoicingOnboarding> | ReturnType<typeof clearInvoicingSettings> | ReturnType<typeof clearInvoicingSubscriptionDetailView> | ReturnType<typeof clearInvoicingSubscriptionListView> | ReturnType<typeof clearInvoicingTransactionDetailView> | ReturnType<typeof clearInvoicingTransactionListView> | ReturnType<typeof clearIssueChargeCard> | ReturnType<typeof clearMerchantList> | ReturnType<typeof clearNetBurnOrIncome> | ReturnType<typeof clearNetBurnOrIncomeClassesView> | ReturnType<typeof clearNetBurnOrIncomeStoryCard> | ReturnType<typeof clearNotificationView> | ReturnType<typeof clearOnboardingCockpitView> | ReturnType<typeof clearOnboardingCustomerView> | ReturnType<typeof clearOpEx> | ReturnType<typeof clearOpExByVendor> | ReturnType<typeof clearOpExClassesView> | ReturnType<typeof clearOwnerList> | ReturnType<typeof clearPaymentAccountList> | ReturnType<typeof clearPeople> | ReturnType<typeof clearAggregatedReport> | ReturnType<typeof clearPreviousBills> | ReturnType<typeof clearProfitAndLoss> | ReturnType<typeof clearProfitAndLossClassesView> | ReturnType<typeof clearProfitAndLossProjectView> | ReturnType<typeof clearProjectList> | ReturnType<typeof clearRecommendation> | ReturnType<typeof clearReferrals> | ReturnType<typeof clearReimbursementCard> | ReturnType<typeof clearReimbursementConfig> | ReturnType<typeof clearRemiBulkActionView> | ReturnType<typeof clearRemiDetailView> | ReturnType<typeof clearRemiList> | ReturnType<typeof clearRemiSetupApproverView> | ReturnType<typeof clearRemiSetupView> | ReturnType<typeof clearReportUIOption> | ReturnType<typeof clearRevenue> | ReturnType<typeof clearRevenueClassesView> | ReturnType<typeof clearReviewCompany> | ReturnType<typeof clearScheduleDetailView> | ReturnType<typeof clearScheduleAccruedDetailView> | ReturnType<typeof clearScheduleList> | ReturnType<typeof clearSettingsView> | ReturnType<typeof clearSetupView> | ReturnType<typeof clearPlaidAccountView> | ReturnType<typeof clearSubscriptionView> | ReturnType<typeof clearTagView> | ReturnType<typeof clearTaskDetail> | ReturnType<typeof clearTaskGroupTemplatesView> | ReturnType<typeof clearTaskGroupView> | ReturnType<typeof clearTaskList> | ReturnType<typeof clearTasksCard> | ReturnType<typeof clearTopEx> | ReturnType<typeof clearTransactionDetail> | ReturnType<typeof clearTransactionList> | ReturnType<typeof clearTransferDetail> | ReturnType<typeof clearTreasuryOverviewDetail> | ReturnType<typeof clearTreasurySetupView> | ReturnType<typeof clearTreasuryStatementList> | ReturnType<typeof clearTreasuryTaxLetterList> | ReturnType<typeof clearTreasuryTransferMoney> | ReturnType<typeof clearTrendData> | ReturnType<typeof clearTrendWithTransactions> | ReturnType<typeof clearTwoFactorAuthentication> | ReturnType<typeof clearUserFinancialAccount> | ReturnType<typeof clearUserListView> | ReturnType<typeof clearUserRoleConfigView> | ReturnType<typeof clearVendorGlobalReviewView> | ReturnType<typeof clearVendorReviewView> | ReturnType<typeof clearVendorTypeList> | ReturnType<typeof clearVendor1099TypeList> | ReturnType<typeof clearVendorView> | ReturnType<typeof clearVendorsFiling1099List> | ReturnType<typeof clearVendorsList> | ReturnType<typeof clearVendorsTabVendorView> | ReturnType<typeof clearWiseRedirectStatus> | ReturnType<typeof clearZeniAccStatementList> | ReturnType<typeof clearZeniAccountList> | ReturnType<typeof clearZeniAccountSetupView> | ReturnType<typeof clearZeniAccountsConfig> | ReturnType<typeof clearZeniAccountsPromoCard> | ReturnType<typeof clearZeniOAuthView>;
259
+ type clearActionTypeForViews = ReturnType<typeof clearAccountList> | ReturnType<typeof clearAccountMappingView> | ReturnType<typeof clearActivityHistory> | ReturnType<typeof clearActivityRealTimeApproval> | ReturnType<typeof clearAddressView> | ReturnType<typeof clearAiAccountantView> | ReturnType<typeof clearAllAiAccountantCustomers> | ReturnType<typeof clearAiCfoView> | ReturnType<typeof clearAllClasses> | ReturnType<typeof clearAllProjects> | ReturnType<typeof clearAllMonthEndCloseChecksView> | ReturnType<typeof clearApAging> | ReturnType<typeof clearApAgingDetail> | ReturnType<typeof clearArAging> | ReturnType<typeof clearArAgingDetail> | ReturnType<typeof clearAuthenticationView> | ReturnType<typeof clearAutoTransferRules> | ReturnType<typeof clearBalanceSheet> | ReturnType<typeof clearBankAccountView> | ReturnType<typeof clearBillDetailView> | ReturnType<typeof clearBillList> | ReturnType<typeof clearBillPayBulkActionView> | ReturnType<typeof clearBillPayCard> | ReturnType<typeof clearBillPayConfig> | ReturnType<typeof clearBillPayReview> | ReturnType<typeof clearBillPaySetupApproverView> | ReturnType<typeof clearBillPaySetupView> | ReturnType<typeof clearCardBalance> | ReturnType<typeof clearCardPaymentView> | ReturnType<typeof clearCardPolicyDetail> | ReturnType<typeof clearCardPolicyList> | ReturnType<typeof clearCardUserOnboarding> | ReturnType<typeof clearCashbackDetail> | ReturnType<typeof clearCashBalance> | ReturnType<typeof clearCashFlow> | ReturnType<typeof clearCashInCashOut> | ReturnType<typeof clearCashPosition> | ReturnType<typeof clearChargeCardConfig> | ReturnType<typeof clearChargeCardDetail> | ReturnType<typeof clearChargeCardList> | ReturnType<typeof clearChargeCardRepaymentDetail> | ReturnType<typeof clearChargeCardSetupView> | ReturnType<typeof clearChargeCardStatementList> | ReturnType<typeof clearCheckDeposit> | ReturnType<typeof clearCompanyConfigView> | ReturnType<typeof clearCompanyHealthMetric> | ReturnType<typeof clearCompanyHealthMetricView> | ReturnType<typeof clearCompanyMonthEndReportView> | ReturnType<typeof clearCompanyTaskManagerView> | ReturnType<typeof clearCompanyView> | ReturnType<typeof clearCreateCardPolicy> | ReturnType<typeof clearCreateTransferEntry> | ReturnType<typeof clearAllCreditAgent> | ReturnType<typeof clearCreditAgentView> | ReturnType<typeof clearDashboard> | ReturnType<typeof clearDashboardLayout> | ReturnType<typeof clearDepositAccountDetail> | ReturnType<typeof clearDepositAccountList> | ReturnType<typeof clearDepositAccountTransactionList> | ReturnType<typeof clearEditBillViewDetail> | ReturnType<typeof clearEditRemiViewDetail> | ReturnType<typeof clearAllEntityAutoCompleteResults> | ReturnType<typeof clearExpenseAutomationFluxAnalysisView> | ReturnType<typeof clearExpenseAutomationJESchedulesView> | ReturnType<typeof clearExpenseAutomationMissingReceiptsView> | ReturnType<typeof clearExpenseAutomationReconciliationView> | ReturnType<typeof clearExpenseAutomationTransactionsView> | ReturnType<typeof clearExpenseAutomationView> | ReturnType<typeof clearExpressPayView> | ReturnType<typeof clearFeatureNotificationView> | ReturnType<typeof clearFileViewList> | ReturnType<typeof clearFinanceStatement> | ReturnType<typeof clearForecastList> | ReturnType<typeof clearGlobalMerchantAutoCompleteResults> | ReturnType<typeof clearGlobalMerchantView> | ReturnType<typeof clearInsightsCard> | ReturnType<typeof clearInternationalWire> | ReturnType<typeof clearInternationalVerificationView> | ReturnType<typeof clearAllInvoiceDetail> | ReturnType<typeof clearInvoiceList> | ReturnType<typeof resetCreateInvoice> | ReturnType<typeof resetRecordPayment> | ReturnType<typeof clearInvoicingOverview> | ReturnType<typeof clearInvoicingAuditView> | ReturnType<typeof resetEditInvoicingCatalogItemDetailView> | ReturnType<typeof resetEditInvoicingCouponDetailView> | ReturnType<typeof clearInvoicingCouponDetailView> | ReturnType<typeof resetEditInvoicingCustomerDetailView> | ReturnType<typeof resetEditInvoicingSubscriptionDetailView> | ReturnType<typeof clearAllInvoicingDataImportActions> | ReturnType<typeof clearInvoicingDataImportView> | ReturnType<typeof clearAllInvoicingInvoiceActions> | ReturnType<typeof clearAllInvoicingSubscriptionActions> | ReturnType<typeof clearAllInvoicingDunningActions> | ReturnType<typeof clearAllInvoicingPaymentActions> | ReturnType<typeof resetSaveInvoicingSettings> | ReturnType<typeof clearInvoicingCatalogItemDetailView> | ReturnType<typeof clearInvoicingCatalogListView> | ReturnType<typeof clearInvoicingCouponView> | ReturnType<typeof clearInvoicingCreditNoteDetailView> | ReturnType<typeof clearInvoicingCreditNoteListView> | ReturnType<typeof clearInvoicingCustomerDetailView> | ReturnType<typeof clearInvoicingCustomerListView> | ReturnType<typeof clearInvoicingDunningCaseDetailView> | ReturnType<typeof clearInvoicingDunningCaseListView> | ReturnType<typeof clearInvoicingOnboarding> | ReturnType<typeof clearInvoicingSettings> | ReturnType<typeof clearInvoicingSubscriptionDetailView> | ReturnType<typeof clearInvoicingSubscriptionListView> | ReturnType<typeof clearInvoicingTransactionDetailView> | ReturnType<typeof clearInvoicingTransactionListView> | ReturnType<typeof clearIssueChargeCard> | ReturnType<typeof clearMerchantList> | ReturnType<typeof clearNetBurnOrIncome> | ReturnType<typeof clearNetBurnOrIncomeClassesView> | ReturnType<typeof clearNetBurnOrIncomeStoryCard> | ReturnType<typeof clearNotificationView> | ReturnType<typeof clearOnboardingCockpitView> | ReturnType<typeof clearOnboardingCustomerView> | ReturnType<typeof clearOpEx> | ReturnType<typeof clearOpExByVendor> | ReturnType<typeof clearOpExClassesView> | ReturnType<typeof clearOwnerList> | ReturnType<typeof clearPaymentAccountList> | ReturnType<typeof clearPeople> | ReturnType<typeof clearAggregatedReport> | ReturnType<typeof clearPreviousBills> | ReturnType<typeof clearProfitAndLoss> | ReturnType<typeof clearProfitAndLossClassesView> | ReturnType<typeof clearProfitAndLossProjectView> | ReturnType<typeof clearProjectList> | ReturnType<typeof clearRecommendation> | ReturnType<typeof clearReferrals> | ReturnType<typeof clearReimbursementCard> | ReturnType<typeof clearReimbursementConfig> | ReturnType<typeof clearRemiBulkActionView> | ReturnType<typeof clearRemiDetailView> | ReturnType<typeof clearRemiList> | ReturnType<typeof clearRemiSetupApproverView> | ReturnType<typeof clearRemiSetupView> | ReturnType<typeof clearReportUIOption> | ReturnType<typeof clearRevenue> | ReturnType<typeof clearRevenueClassesView> | ReturnType<typeof clearReviewCompany> | ReturnType<typeof clearScheduleDetailView> | ReturnType<typeof clearScheduleAccruedDetailView> | ReturnType<typeof clearScheduleList> | ReturnType<typeof clearSettingsView> | ReturnType<typeof clearSetupView> | ReturnType<typeof clearPlaidAccountView> | ReturnType<typeof clearSubscriptionView> | ReturnType<typeof clearTagView> | ReturnType<typeof clearTaskDetail> | ReturnType<typeof clearTaskGroupTemplatesView> | ReturnType<typeof clearTaskGroupView> | ReturnType<typeof clearTaskList> | ReturnType<typeof clearTasksCard> | ReturnType<typeof clearTopEx> | ReturnType<typeof clearTransactionDetail> | ReturnType<typeof clearTransactionList> | ReturnType<typeof clearTransferDetail> | ReturnType<typeof clearTreasuryOverviewDetail> | ReturnType<typeof clearTreasurySetupView> | ReturnType<typeof clearTreasuryStatementList> | ReturnType<typeof clearTreasuryTaxLetterList> | ReturnType<typeof clearTreasuryTransferMoney> | ReturnType<typeof clearTrendData> | ReturnType<typeof clearTrendWithTransactions> | ReturnType<typeof clearTwoFactorAuthentication> | ReturnType<typeof clearUserFinancialAccount> | ReturnType<typeof clearUserListView> | ReturnType<typeof clearUserRoleConfigView> | ReturnType<typeof clearVendorGlobalReviewView> | ReturnType<typeof clearVendorReviewView> | ReturnType<typeof clearVendorTypeList> | ReturnType<typeof clearVendor1099TypeList> | ReturnType<typeof clearVendorView> | ReturnType<typeof clearVendorsFiling1099List> | ReturnType<typeof clearVendorsList> | ReturnType<typeof clearVendorsTabVendorView> | ReturnType<typeof clearWiseRedirectStatus> | ReturnType<typeof clearZeniAccStatementList> | ReturnType<typeof clearZeniAccountList> | ReturnType<typeof clearZeniAccountSetupView> | ReturnType<typeof clearZeniAccountsConfig> | ReturnType<typeof clearZeniAccountsPromoCard> | ReturnType<typeof clearZeniOAuthView>;
259
260
  type clearActionTypeForEntities = ReturnType<typeof clearAiCfo> | ReturnType<typeof clearAllAccountGroups> | ReturnType<typeof clearAllAccountRecon> | ReturnType<typeof clearAllAccountingSummary> | ReturnType<typeof clearAllAccounts> | ReturnType<typeof clearAllAddresses> | ReturnType<typeof clearAllApprovalRules> | ReturnType<typeof clearAllBankAccounts> | ReturnType<typeof clearAllBillTransactions> | ReturnType<typeof clearAllCardPayments> | ReturnType<typeof clearAllChargeCardRepayments> | ReturnType<typeof clearAllChargeCardTransactions> | ReturnType<typeof clearAllChargeCards> | ReturnType<typeof clearAllCompanies> | ReturnType<typeof clearAllConnectedAccounts> | ReturnType<typeof clearAllCurrencies> | ReturnType<typeof clearAllCustomerIncomeTrend> | ReturnType<typeof clearAllCustomers> | ReturnType<typeof clearAllDepositAccounts> | ReturnType<typeof clearAllEntities> | ReturnType<typeof clearAllEntityApprovalStatus> | ReturnType<typeof clearAllFiles> | ReturnType<typeof clearAllForecasts> | ReturnType<typeof clearAllGlobalMerchants> | ReturnType<typeof clearAllInsights> | ReturnType<typeof clearAllInvoices> | ReturnType<typeof clearAllInvoicingCoupons> | ReturnType<typeof clearAllInvoicingCreditNotes> | ReturnType<typeof clearAllInvoicingCustomers> | ReturnType<typeof clearAllInvoicingDunningCases> | ReturnType<typeof clearAllInvoicingPlans> | ReturnType<typeof clearAllInvoicingProducts> | ReturnType<typeof clearAllInvoicingSubscriptions> | ReturnType<typeof clearAllInvoicingTransactions> | ReturnType<typeof clearAllAccruedJESchedules> | ReturnType<typeof clearAllJEScheduleTransactions> | ReturnType<typeof clearAllMerchants> | ReturnType<typeof clearAllMonthEndCloseChecks> | ReturnType<typeof clearAllNotifications> | ReturnType<typeof clearAllOnboardingCustomersInfo> | ReturnType<typeof clearAllPaymentAccounts> | ReturnType<typeof clearAllPaymentInstruments> | ReturnType<typeof clearAllRecurringBills> | ReturnType<typeof clearAllReimbursements> | ReturnType<typeof clearAllSectionsAccountsView> | ReturnType<typeof clearAllSectionsClassesViewV2> | ReturnType<typeof clearAllSectionsProjectView> | ReturnType<typeof clearAllSubscriptionAddOns> | ReturnType<typeof clearAllSubscriptionCoupons> | ReturnType<typeof clearAllSubscriptionPlans> | ReturnType<typeof clearAllSubscriptionSummary> | ReturnType<typeof clearAllSubscriptions> | ReturnType<typeof clearAllTags> | ReturnType<typeof clearAllTaskGroups> | ReturnType<typeof clearAllTaskGroupTemplates> | ReturnType<typeof clearAllTaskSummary> | ReturnType<typeof clearAllTasks> | ReturnType<typeof clearAllToastNotifications> | ReturnType<typeof clearAllTransactions> | ReturnType<typeof clearAllUserRoles> | ReturnType<typeof clearAllUsers> | ReturnType<typeof clearAllVendorExpenseTrends> | ReturnType<typeof clearAllVendors> | ReturnType<typeof clearCannedResponses> | ReturnType<typeof clearCardPolicy> | ReturnType<typeof clearClassList> | ReturnType<typeof clearContacts> | ReturnType<typeof clearCountryList> | ReturnType<typeof clearDepositAccountTransaction> | ReturnType<typeof clearSnackbar>;
260
261
  export type ActionType = clearActionTypeForViews | clearActionTypeForEntities | ReturnType<typeof clearAll>;
261
262
  export declare const clearAllEpic: (actions$: ActionsObservable<ActionType>) => import("rxjs").Observable<ActionType>;
@@ -69,6 +69,7 @@ const dunningActionReducer_1 = require("../../view/invoicing/dunningAction/dunni
69
69
  const editInvoicingCatalogItemDetailViewReducer_1 = require("../../view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewReducer");
70
70
  const editInvoicingCouponDetailViewReducer_1 = require("../../view/invoicing/editInvoicingCouponDetailView/editInvoicingCouponDetailViewReducer");
71
71
  const editInvoicingCustomerDetailViewReducer_1 = require("../../view/invoicing/editInvoicingCustomerDetailView/editInvoicingCustomerDetailViewReducer");
72
+ const editInvoicingSubscriptionDetailViewReducer_1 = require("../../view/invoicing/editInvoicingSubscriptionDetailView/editInvoicingSubscriptionDetailViewReducer");
72
73
  const invoiceActionReducer_1 = require("../../view/invoicing/invoiceAction/invoiceActionReducer");
73
74
  const invoiceDetailReducer_1 = require("../../view/invoicing/invoiceDetail/invoiceDetailReducer");
74
75
  const invoiceListReducer_1 = require("../../view/invoicing/invoiceList/invoiceListReducer");
@@ -349,6 +350,7 @@ const clearAllEpic = (actions$) => actions$.pipe((0, operators_1.filter)(tenantR
349
350
  (0, editInvoicingCouponDetailViewReducer_1.resetEditInvoicingCouponDetailView)(),
350
351
  (0, invoicingCouponDetailViewReducer_1.clearInvoicingCouponDetailView)(),
351
352
  (0, editInvoicingCustomerDetailViewReducer_1.resetEditInvoicingCustomerDetailView)(),
353
+ (0, editInvoicingSubscriptionDetailViewReducer_1.resetEditInvoicingSubscriptionDetailView)(),
352
354
  (0, dataImportActionReducer_1.clearAllInvoicingDataImportActions)(),
353
355
  (0, dataImportViewReducer_1.clearInvoicingDataImportView)(),
354
356
  (0, invoiceActionReducer_1.clearAllInvoicingInvoiceActions)(),
@@ -1,8 +1,7 @@
1
1
  import { toAmount } from '../../../commonStateTypes/amount';
2
+ import { defaultCustomerCurrency } from '../../../commonStateTypes/currencyHelper';
2
3
  import { date } from '../../../zeniDayJS';
3
4
  // ── Payload → State mappers (snake_case wire shape → camelCase domain shape) ──
4
- const DEFAULT_CURRENCY_CODE = 'USD';
5
- const DEFAULT_CURRENCY_SYMBOL = '$';
6
5
  export const mapInvoicingCreditNoteLineItemPayloadToState = (payload, currencyCode, currencySymbol) => ({
7
6
  amount: toAmount(payload.amount, currencyCode, currencySymbol),
8
7
  description: payload.description,
@@ -17,8 +16,8 @@ export const mapInvoicingCreditNoteAllocationPayloadToState = (payload, currency
17
16
  allocatedAt: payload.allocated_at != null ? date(payload.allocated_at) : undefined,
18
17
  });
19
18
  export const mapInvoicingCreditNotePayloadToState = (payload) => {
20
- const currencyCode = payload.currency_code ?? DEFAULT_CURRENCY_CODE;
21
- const currencySymbol = DEFAULT_CURRENCY_SYMBOL;
19
+ const currencyCode = payload.currency_code ?? defaultCustomerCurrency.currencyCode;
20
+ const currencySymbol = payload.currency_symbol ?? defaultCustomerCurrency.currencySymbol;
22
21
  const toAmt = (value) => toAmount(value, currencyCode, currencySymbol);
23
22
  return {
24
23
  id: payload.id,
@@ -1,8 +1,7 @@
1
1
  import { toAmount } from '../../../commonStateTypes/amount';
2
+ import { defaultCustomerCurrency } from '../../../commonStateTypes/currencyHelper';
2
3
  import { date } from '../../../zeniDayJS';
3
4
  // ── Payload → State mappers (snake_case wire shape → camelCase domain shape) ──
4
- const DEFAULT_CURRENCY_CODE = 'USD';
5
- const DEFAULT_CURRENCY_SYMBOL = '$';
6
5
  const mapLineItem = (payload, currencyCode, currencySymbol) => ({
7
6
  amount: toAmount(payload.amount, currencyCode, currencySymbol),
8
7
  description: payload.description,
@@ -63,8 +62,8 @@ export const extractInvoicingInvoiceAddresses = (payloads) => payloads
63
62
  .flatMap((payload) => [payload.billing_address, payload.shipping_address])
64
63
  .filter((address) => address != null);
65
64
  export const mapInvoicingInvoicePayloadToState = (payload) => {
66
- const currencyCode = payload.currency_code ?? DEFAULT_CURRENCY_CODE;
67
- const currencySymbol = DEFAULT_CURRENCY_SYMBOL;
65
+ const currencyCode = payload.currency_code ?? defaultCustomerCurrency.currencyCode;
66
+ const currencySymbol = payload.currency_symbol ?? defaultCustomerCurrency.currencySymbol;
68
67
  const toAmt = (value) => toAmount(value, currencyCode, currencySymbol);
69
68
  return {
70
69
  customerID: payload.customer_id,
@@ -128,8 +127,8 @@ export const mapInvoicingInvoicePayloadToState = (payload) => {
128
127
  };
129
128
  };
130
129
  export const mapInvoicingInvoiceKPIsPayloadToState = (payload) => ({
131
- dueTotal: toAmount(payload.due_total, DEFAULT_CURRENCY_CODE, DEFAULT_CURRENCY_SYMBOL),
132
- paidTotal: toAmount(payload.paid_total, DEFAULT_CURRENCY_CODE, DEFAULT_CURRENCY_SYMBOL),
133
- pendingTotal: toAmount(payload.pending_total, DEFAULT_CURRENCY_CODE, DEFAULT_CURRENCY_SYMBOL),
134
- totalInvoiced: toAmount(payload.total_invoiced, DEFAULT_CURRENCY_CODE, DEFAULT_CURRENCY_SYMBOL),
130
+ dueTotal: toAmount(payload.due_total, defaultCustomerCurrency.currencyCode, defaultCustomerCurrency.currencySymbol),
131
+ paidTotal: toAmount(payload.paid_total, defaultCustomerCurrency.currencyCode, defaultCustomerCurrency.currencySymbol),
132
+ pendingTotal: toAmount(payload.pending_total, defaultCustomerCurrency.currencyCode, defaultCustomerCurrency.currencySymbol),
133
+ totalInvoiced: toAmount(payload.total_invoiced, defaultCustomerCurrency.currencyCode, defaultCustomerCurrency.currencySymbol),
135
134
  });
@@ -20,7 +20,7 @@ export const mapInvoicingCustomerPayloadToState = (payload) => {
20
20
  ? toAmount(payload.arr, currencyCode, currencySymbol)
21
21
  : undefined,
22
22
  autoCollection: payload.auto_collection,
23
- billingAddressId: payload.billing_address_id,
23
+ billingAddressId: payload.billing_address_id ?? payload.billing_address?.address_id,
24
24
  cardStatus: payload.card_status,
25
25
  company: payload.company,
26
26
  consolidatedInvoicing: payload.consolidated_invoicing,
@@ -1,8 +1,7 @@
1
1
  import { toAmount } from '../../../commonStateTypes/amount';
2
+ import { defaultCustomerCurrency } from '../../../commonStateTypes/currencyHelper';
2
3
  import { date } from '../../../zeniDayJS';
3
4
  // ── Payload → State mappers (snake_case wire shape → camelCase domain shape) ──
4
- const DEFAULT_CURRENCY_CODE = 'USD';
5
- const DEFAULT_CURRENCY_SYMBOL = '$';
6
5
  const mapLinkedInvoiceRef = (payload, currencyCode, currencySymbol) => ({
7
6
  appliedAmount: toAmount(payload.applied_amount, currencyCode, currencySymbol),
8
7
  invoiceID: payload.invoice_id,
@@ -18,8 +17,8 @@ const mapLinkedCreditNoteRef = (payload, currencyCode, currencySymbol) => ({
18
17
  cnID: payload.cn_id,
19
18
  });
20
19
  export const mapInvoicingTransactionPayloadToState = (payload) => {
21
- const currencyCode = payload.currency_code ?? DEFAULT_CURRENCY_CODE;
22
- const currencySymbol = DEFAULT_CURRENCY_SYMBOL;
20
+ const currencyCode = payload.currency_code ?? defaultCustomerCurrency.currencyCode;
21
+ const currencySymbol = payload.currency_symbol ?? defaultCustomerCurrency.currencySymbol;
23
22
  const toAmt = (value) => toAmount(value, currencyCode, currencySymbol);
24
23
  return {
25
24
  amount: toAmt(payload.amount),
@@ -66,6 +66,7 @@ import { clearAllInvoicingDunningActions } from '../../view/invoicing/dunningAct
66
66
  import { resetEditInvoicingCatalogItemDetailView } from '../../view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewReducer';
67
67
  import { resetEditInvoicingCouponDetailView } from '../../view/invoicing/editInvoicingCouponDetailView/editInvoicingCouponDetailViewReducer';
68
68
  import { resetEditInvoicingCustomerDetailView } from '../../view/invoicing/editInvoicingCustomerDetailView/editInvoicingCustomerDetailViewReducer';
69
+ import { resetEditInvoicingSubscriptionDetailView } from '../../view/invoicing/editInvoicingSubscriptionDetailView/editInvoicingSubscriptionDetailViewReducer';
69
70
  import { clearAllInvoicingInvoiceActions } from '../../view/invoicing/invoiceAction/invoiceActionReducer';
70
71
  import { clearAllInvoiceDetail } from '../../view/invoicing/invoiceDetail/invoiceDetailReducer';
71
72
  import { clearInvoiceList } from '../../view/invoicing/invoiceList/invoiceListReducer';
@@ -346,6 +347,7 @@ export const clearAllEpic = (actions$) => actions$.pipe(filter(clearAll.match),
346
347
  resetEditInvoicingCouponDetailView(),
347
348
  clearInvoicingCouponDetailView(),
348
349
  resetEditInvoicingCustomerDetailView(),
350
+ resetEditInvoicingSubscriptionDetailView(),
349
351
  clearAllInvoicingDataImportActions(),
350
352
  clearInvoicingDataImportView(),
351
353
  clearAllInvoicingInvoiceActions(),
@@ -788,13 +788,23 @@ export default expenseAutomationReconciliationView.reducer;
788
788
  function isEntityStatementParsing(reconciliation) {
789
789
  return reconciliation.statement_data_status?.code === 'parsing';
790
790
  }
791
+ /** Entity no longer in an active parse — client latch should clear. */
792
+ function isEntityStatementParseTerminal(reconciliation) {
793
+ const statusCode = reconciliation.statement_data_status?.code;
794
+ return (statusCode === 'processed' ||
795
+ statusCode === 'validated' ||
796
+ statusCode === 'parsing_failed' ||
797
+ statusCode === 'validation_failed' ||
798
+ statusCode === 'processing_failed' ||
799
+ statusCode === 'deleting' ||
800
+ statusCode === 'deleted');
801
+ }
791
802
  function resolveStatementParseInProgressAfterFetch(oldRecord, reconciliation) {
792
803
  if (isEntityStatementParsing(reconciliation)) {
793
804
  return true;
794
805
  }
795
- if (oldRecord?.statementParseInProgress === true) {
796
- return true;
797
- }
806
+ // Keep latch while client upload/parse/reparse is actively in flight, even if
807
+ // entity already looks terminal (e.g. V3 parseStatement GET still loading).
798
808
  if (oldRecord?.statementParseStatus.fetchState === 'In-Progress') {
799
809
  return true;
800
810
  }
@@ -804,12 +814,21 @@ function resolveStatementParseInProgressAfterFetch(oldRecord, reconciliation) {
804
814
  if (oldRecord?.statementUploadStatus.fetchState === 'In-Progress') {
805
815
  return true;
806
816
  }
807
- // Reparse POST returned; async parse may not be on entity yet.
817
+ // Reparse POST returned; async parse may not be on entity yet (entity can
818
+ // still show the previous processed status).
808
819
  if (oldRecord?.reparseStatementStatus.fetchState === 'Completed' &&
809
820
  oldRecord.statementParseStatus.fetchState !== 'Completed' &&
810
821
  oldRecord.statementParseStatus.fetchState !== 'Error') {
811
822
  return true;
812
823
  }
824
+ // Entity reports parse finished and no client request is in flight — clear
825
+ // sticky latch. Critical for V1 (no parseStatement) after Pusher refresh.
826
+ if (isEntityStatementParseTerminal(reconciliation)) {
827
+ return false;
828
+ }
829
+ if (oldRecord?.statementParseInProgress === true) {
830
+ return true;
831
+ }
813
832
  // Continue-in-background while parse flow has not finished.
814
833
  if (oldRecord?.statementProcessingDismissedToBackground === true &&
815
834
  oldRecord.statementParseStatus.fetchState !== 'Completed' &&
@@ -951,9 +970,7 @@ function updateReconciliationByAccountID(draft, accounts, selectedPeriod, accoun
951
970
  : false,
952
971
  paymentAccountId: accounts.payment_account_id ?? undefined,
953
972
  };
954
- const oldStatementParseInProgress = oldRecord.statementParseInProgress;
955
- const statementParseInProgress = reconciliationData.bank_status.code === 'parsing' ||
956
- oldStatementParseInProgress === true;
973
+ const statementParseInProgress = resolveStatementParseInProgressAfterFetch(oldRecord, reconciliationData);
957
974
  if (refreshViewInBackground === true) {
958
975
  draft.accountReconciliationRecordsBySelectedPeriod[toMonthYearPeriodId(selectedPeriod)].reconciliationByAccountID[accountId] = {
959
976
  ...oldRecord,
@@ -1,4 +1,11 @@
1
1
  import { createSlice } from '@reduxjs/toolkit';
2
+ // The discounts-list tabs look up counts by tab id ('active' / 'inactive'),
3
+ // while a coupon's status is 'active' | 'expired' | 'archived'. Collapse the
4
+ // non-active statuses onto the 'inactive' tab; a newly created coupon with no
5
+ // status defaults to 'active'.
6
+ function couponStatusToTabCountKey(status) {
7
+ return status == null || status === 'active' ? 'active' : 'inactive';
8
+ }
2
9
  export const initialState = {
3
10
  fetchState: 'Not-Started',
4
11
  error: undefined,
@@ -80,10 +87,23 @@ const couponView = createSlice({
80
87
  updateInvoicingCouponFilters(draft, action) {
81
88
  draft.filters = action.payload;
82
89
  },
90
+ // Reflect a newly created coupon in the cached discounts list + tab counts
91
+ // so the list page shows it without refetching from the server. Edits keep
92
+ // the same id/counts, so only creates dispatch this.
93
+ addInvoicingCouponToList(draft, action) {
94
+ const { id, status } = action.payload;
95
+ if (draft.ids.includes(id)) {
96
+ return;
97
+ }
98
+ draft.ids = [id, ...draft.ids];
99
+ draft.counts.all += 1;
100
+ const tabCountKey = couponStatusToTabCountKey(status);
101
+ draft.counts[tabCountKey] = (draft.counts[tabCountKey] ?? 0) + 1;
102
+ },
83
103
  clearInvoicingCouponView(draft) {
84
104
  Object.assign(draft, initialState);
85
105
  },
86
106
  },
87
107
  });
88
- export const { fetchInvoicingCouponList, fetchInvoicingCouponListPage, updateInvoicingCouponList, updateInvoicingCouponListFailure, fetchInvoicingCouponCounts, updateInvoicingCouponCounts, updateInvoicingCouponCountsFailure, updateInvoicingCouponFilters, clearInvoicingCouponView, } = couponView.actions;
108
+ export const { fetchInvoicingCouponList, fetchInvoicingCouponListPage, updateInvoicingCouponList, updateInvoicingCouponListFailure, fetchInvoicingCouponCounts, updateInvoicingCouponCounts, updateInvoicingCouponCountsFailure, updateInvoicingCouponFilters, addInvoicingCouponToList, clearInvoicingCouponView, } = couponView.actions;
89
109
  export default couponView.reducer;
@@ -4,6 +4,7 @@ import { updateAddresses } from '../../../entity/address/addressReducer';
4
4
  import { extractInvoicingInvoiceAddresses } from '../../../entity/invoicing/invoice/invoicePayload';
5
5
  import { updateInvoices } from '../../../entity/invoicing/invoice/invoiceReducer';
6
6
  import { createZeniAPIStatus, isSuccessResponse } from '../../../responsePayload';
7
+ import { addInvoiceToList } from '../invoiceList/invoiceListReducer';
7
8
  import { createInvoice, createInvoiceFailure, createInvoiceSuccess, } from './createInvoiceReducer';
8
9
  export const createInvoiceEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(createInvoice.match), mergeMap((action) => {
9
10
  const apiUrl = `${zeniAPI.apiEndPoints.invoicingMicroServiceBaseUrl}/1.0/invoices`;
@@ -16,6 +17,10 @@ export const createInvoiceEpic = (actions$, _state$, zeniAPI) => actions$.pipe(f
16
17
  return [
17
18
  updateInvoices([response.data], 'merge'),
18
19
  updateAddresses(extractInvoicingInvoiceAddresses([response.data])),
20
+ addInvoiceToList({
21
+ id: response.data.id,
22
+ status: response.data.status,
23
+ }),
19
24
  createInvoiceSuccess({ invoiceId: response.data.id }),
20
25
  ];
21
26
  }
@@ -3,6 +3,7 @@ import { catchError, filter, mergeMap } from 'rxjs/operators';
3
3
  import { updateInvoicingPlans } from '../../../entity/invoicing/plan/planReducer';
4
4
  import { updateInvoicingProducts } from '../../../entity/invoicing/product/productReducer';
5
5
  import { createZeniAPIStatus, isSuccessResponse } from '../../../responsePayload';
6
+ import { addInvoicingCatalogItem } from '../invoicingCatalogListView/invoicingCatalogListViewReducer';
6
7
  import { localDataToSaveInvoicingCatalogItemPayload, } from './editInvoicingCatalogItemDetailViewPayload';
7
8
  import { saveInvoicingCatalogItem, submitInvoicingCatalogItemForm, submitInvoicingCatalogItemFormFailure, submitInvoicingCatalogItemFormSuccess, } from './editInvoicingCatalogItemDetailViewReducer';
8
9
  export const saveInvoicingCatalogItemEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter((action) => submitInvoicingCatalogItemForm.match(action) ||
@@ -39,13 +40,26 @@ export const saveInvoicingCatalogItemEpic = (actions$, state$, zeniAPI) => actio
39
40
  const entityAction = kind === 'plan'
40
41
  ? updateInvoicingPlans([response.data], 'merge')
41
42
  : updateInvoicingProducts([response.data], 'merge');
42
- return [
43
+ const resultActions = [
43
44
  entityAction,
44
45
  submitInvoicingCatalogItemFormSuccess({
45
46
  itemId: response.data.id,
46
47
  kind,
47
48
  }),
48
49
  ];
50
+ // Create (no id): reflect the new row + tab counts in the cached
51
+ // catalog lists so the list page shows it without a refetch. Edits
52
+ // keep the same id/counts, so the entity merge above is enough.
53
+ if (id == null) {
54
+ const itemType = kind === 'plan'
55
+ ? 'plan'
56
+ : response.data.item_type ===
57
+ 'charge'
58
+ ? 'charge'
59
+ : 'addon';
60
+ resultActions.push(addInvoicingCatalogItem({ id: response.data.id, type: itemType }));
61
+ }
62
+ return resultActions;
49
63
  }
50
64
  return of(submitInvoicingCatalogItemFormFailure(response.status));
51
65
  }), catchError((error) => of(submitInvoicingCatalogItemFormFailure(createZeniAPIStatus('Unexpected Error', 'Save catalog item REST API call errored out ' +
@@ -2,6 +2,7 @@ import { of } from 'rxjs';
2
2
  import { catchError, filter, mergeMap } from 'rxjs/operators';
3
3
  import { updateInvoicingCoupons } from '../../../entity/invoicing/coupon/couponReducer';
4
4
  import { createZeniAPIStatus, isSuccessResponse } from '../../../responsePayload';
5
+ import { addInvoicingCouponToList } from '../couponView/couponViewReducer';
5
6
  import { localDataToSaveInvoicingCouponPayload, } from './editInvoicingCouponDetailViewPayload';
6
7
  import { saveInvoicingCoupon, submitInvoicingCouponForm, submitInvoicingCouponFormFailure, submitInvoicingCouponFormSuccess, } from './editInvoicingCouponDetailViewReducer';
7
8
  export const saveInvoicingCouponEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter((action) => submitInvoicingCouponForm.match(action) ||
@@ -26,10 +27,21 @@ export const saveInvoicingCouponEpic = (actions$, state$, zeniAPI) => actions$.p
26
27
  : zeniAPI.postAndGetJSON(path, { ...data });
27
28
  return request$.pipe(mergeMap((response) => {
28
29
  if (isSuccessResponse(response) && response.data != null) {
29
- return [
30
- updateInvoicingCoupons([response.data], 'merge'),
31
- submitInvoicingCouponFormSuccess({ couponId: response.data.id }),
30
+ const couponPayload = response.data;
31
+ const resultActions = [
32
+ updateInvoicingCoupons([couponPayload], 'merge'),
33
+ submitInvoicingCouponFormSuccess({ couponId: couponPayload.id }),
32
34
  ];
35
+ // Create (no id): reflect the new row + tab counts in the cached
36
+ // discounts list so it shows without a refetch. Edits keep the same
37
+ // id/counts, so the entity merge above is enough.
38
+ if (id == null) {
39
+ resultActions.push(addInvoicingCouponToList({
40
+ id: couponPayload.id,
41
+ status: couponPayload.status,
42
+ }));
43
+ }
44
+ return resultActions;
33
45
  }
34
46
  return of(submitInvoicingCouponFormFailure(response.status));
35
47
  }), catchError((error) => of(submitInvoicingCouponFormFailure(createZeniAPIStatus('Unexpected Error', 'Save coupon REST API call errored out ' + JSON.stringify(error))))));
@@ -5,6 +5,7 @@ import { extractInvoicingCustomerAddresses } from '../../../entity/invoicing/inv
5
5
  import { updateInvoicingCustomers } from '../../../entity/invoicing/invoicingCustomer/invoicingCustomerReducer';
6
6
  import { createZeniAPIStatus, isSuccessResponse } from '../../../responsePayload';
7
7
  import { resetNewAddressDataInLocalStore } from '../../addressView/addressViewReducer';
8
+ import { addInvoicingCustomerToList } from '../invoicingCustomerListView/invoicingCustomerListViewReducer';
8
9
  import { localDataToSaveInvoicingCustomerPayload, } from './editInvoicingCustomerDetailViewPayload';
9
10
  import { INVOICING_CUSTOMER_BILLING_ADDRESS_TYPE } from './invoicingCustomerFormConfig';
10
11
  import { submitInvoicingCustomerForm, submitInvoicingCustomerFormFailure, submitInvoicingCustomerFormSuccess, } from './editInvoicingCustomerDetailViewReducer';
@@ -25,7 +26,7 @@ export const saveInvoicingCustomerEpic = (actions$, state$, zeniAPI) => actions$
25
26
  : zeniAPI.postAndGetJSON(`${baseUrl}/customers`, { ...data });
26
27
  return request$.pipe(mergeMap((response) => {
27
28
  if (isSuccessResponse(response) && response.data != null) {
28
- return [
29
+ const resultActions = [
29
30
  updateInvoicingCustomers([response.data], 'merge'),
30
31
  updateAddresses(extractInvoicingCustomerAddresses([response.data])),
31
32
  submitInvoicingCustomerFormSuccess({
@@ -34,6 +35,16 @@ export const saveInvoicingCustomerEpic = (actions$, state$, zeniAPI) => actions$
34
35
  // Clear the stashed address so the next customer starts fresh.
35
36
  resetNewAddressDataInLocalStore(INVOICING_CUSTOMER_BILLING_ADDRESS_TYPE),
36
37
  ];
38
+ // Create (no id): reflect the new row + tab counts in the cached
39
+ // customer list so the list page shows it without a refetch. Edits
40
+ // keep the same id/counts, so the entity merge above is enough.
41
+ if (id == null) {
42
+ resultActions.push(addInvoicingCustomerToList({
43
+ id: response.data.id,
44
+ status: response.data.status,
45
+ }));
46
+ }
47
+ return resultActions;
37
48
  }
38
49
  return of(submitInvoicingCustomerFormFailure(response.status));
39
50
  }), catchError((error) => of(submitInvoicingCustomerFormFailure(createZeniAPIStatus('Unexpected Error', 'Save customer REST API call errored out ' +
@@ -5,6 +5,7 @@ import { extractInvoicingSubscriptionAddresses } from '../../../entity/invoicing
5
5
  import { updateInvoicingSubscriptions } from '../../../entity/invoicing/invoicingSubscription/invoicingSubscriptionReducer';
6
6
  import { createZeniAPIStatus, isSuccessResponse } from '../../../responsePayload';
7
7
  import { resetNewAddressDataInLocalStore } from '../../addressView/addressViewReducer';
8
+ import { addInvoicingSubscriptionToList } from '../invoicingSubscriptionListView/invoicingSubscriptionListViewReducer';
8
9
  import { localDataToSaveInvoicingSubscriptionPayload, } from './editInvoicingSubscriptionDetailViewPayload';
9
10
  import { INVOICING_SUBSCRIPTION_SHIPPING_ADDRESS_TYPE } from './invoicingSubscriptionFormConfig';
10
11
  import { submitInvoicingSubscriptionForm, submitInvoicingSubscriptionFormFailure, submitInvoicingSubscriptionFormSuccess, } from './editInvoicingSubscriptionDetailViewReducer';
@@ -25,7 +26,7 @@ export const saveInvoicingSubscriptionEpic = (actions$, state$, zeniAPI) => acti
25
26
  : zeniAPI.postAndGetJSON(`${baseUrl}/subscriptions`, { ...data });
26
27
  return request$.pipe(mergeMap((response) => {
27
28
  if (isSuccessResponse(response) && response.data != null) {
28
- return [
29
+ const resultActions = [
29
30
  updateInvoicingSubscriptions([response.data], 'merge'),
30
31
  updateAddresses(extractInvoicingSubscriptionAddresses([response.data])),
31
32
  submitInvoicingSubscriptionFormSuccess({
@@ -34,6 +35,16 @@ export const saveInvoicingSubscriptionEpic = (actions$, state$, zeniAPI) => acti
34
35
  // Clear the stashed address so the next subscription starts fresh.
35
36
  resetNewAddressDataInLocalStore(INVOICING_SUBSCRIPTION_SHIPPING_ADDRESS_TYPE),
36
37
  ];
38
+ // Create (no id): reflect the new row + tab counts in the cached list
39
+ // so the list page shows it without a refetch. Edits keep the same
40
+ // id/counts, so the entity merge above is enough.
41
+ if (id == null) {
42
+ resultActions.push(addInvoicingSubscriptionToList({
43
+ id: response.data.id,
44
+ status: response.data.status,
45
+ }));
46
+ }
47
+ return resultActions;
37
48
  }
38
49
  return of(submitInvoicingSubscriptionFormFailure(response.status));
39
50
  }), catchError((error) => of(submitInvoicingSubscriptionFormFailure(createZeniAPIStatus('Unexpected Error', 'Save subscription REST API call errored out ' +
@@ -117,10 +117,24 @@ const invoiceList = createSlice({
117
117
  updateInvoiceListFilters(draft, action) {
118
118
  draft.filters = action.payload;
119
119
  },
120
+ // Reflect a newly created invoice in the cached list + tab counts so the
121
+ // invoices page shows it without refetching from the server. Bumps the
122
+ // `all` total and the per-status count key the tabs read (a create is
123
+ // typically `draft`). KPIs are money aggregates (Amount, not a plain
124
+ // increment), so they are left untouched and refetched lazily.
125
+ addInvoiceToList(draft, action) {
126
+ const { id, status } = action.payload;
127
+ if (draft.invoiceIds.includes(id)) {
128
+ return;
129
+ }
130
+ draft.invoiceIds = [id, ...draft.invoiceIds];
131
+ draft.counts.all += 1;
132
+ draft.counts[status] = (draft.counts[status] ?? 0) + 1;
133
+ },
120
134
  clearInvoiceList(draft) {
121
135
  Object.assign(draft, initialState);
122
136
  },
123
137
  },
124
138
  });
125
- export const { fetchInvoiceList, fetchInvoiceListPage, updateInvoiceList, updateInvoiceListFailure, fetchInvoiceCounts, updateInvoiceCounts, updateInvoiceCountsFailure, fetchInvoiceKPIs, updateInvoiceKPIs, updateInvoiceKPIsFailure, updateInvoiceListFilters, clearInvoiceList, } = invoiceList.actions;
139
+ export const { fetchInvoiceList, fetchInvoiceListPage, updateInvoiceList, updateInvoiceListFailure, fetchInvoiceCounts, updateInvoiceCounts, updateInvoiceCountsFailure, fetchInvoiceKPIs, updateInvoiceKPIs, updateInvoiceKPIsFailure, updateInvoiceListFilters, addInvoiceToList, clearInvoiceList, } = invoiceList.actions;
126
140
  export default invoiceList.reducer;