@zeniai/client-epic-state 5.2.10-betaRD1 → 5.2.11-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 (195) hide show
  1. package/lib/entity/invoicing/invoicingCommonPayload.d.ts +27 -29
  2. package/lib/entity/invoicing/invoicingCommonPayload.js +37 -75
  3. package/lib/entity/invoicing/product/productPayload.d.ts +10 -0
  4. package/lib/entity/invoicing/product/productPayload.js +14 -2
  5. package/lib/entity/jeSchedules/jeScheduleHelper.d.ts +0 -1
  6. package/lib/entity/jeSchedules/jeScheduleHelper.js +0 -7
  7. package/lib/entity/jeSchedules/jeSchedulesPayload.d.ts +1 -66
  8. package/lib/entity/jeSchedules/jeSchedulesPayload.js +0 -135
  9. package/lib/entity/jeSchedules/jeSchedulesReducer.d.ts +2 -4
  10. package/lib/entity/jeSchedules/jeSchedulesReducer.js +2 -30
  11. package/lib/entity/jeSchedules/jeSchedulesSelector.d.ts +2 -11
  12. package/lib/entity/jeSchedules/jeSchedulesSelector.js +3 -38
  13. package/lib/entity/jeSchedules/jeSchedulesState.d.ts +1 -79
  14. package/lib/entity/jeSchedules/jeSchedulesTypes.d.ts +1 -24
  15. package/lib/entity/jeSchedules/jeSchedulesTypes.js +1 -88
  16. package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
  17. package/lib/entity/snackbar/snackbarTypes.js +0 -3
  18. package/lib/entity/transaction/payloadTypes/scheduleTransactionPayload.d.ts +0 -2
  19. package/lib/entity/transaction/payloadTypes/scheduleTransactionPayload.js +0 -2
  20. package/lib/entity/transaction/stateTypes/scheduleTransaction.d.ts +0 -2
  21. package/lib/epic.d.ts +3 -10
  22. package/lib/epic.js +12 -21
  23. package/lib/esm/entity/invoicing/invoicingCommonPayload.js +33 -73
  24. package/lib/esm/entity/invoicing/product/productPayload.js +14 -2
  25. package/lib/esm/entity/jeSchedules/jeScheduleHelper.js +0 -6
  26. package/lib/esm/entity/jeSchedules/jeSchedulesPayload.js +1 -135
  27. package/lib/esm/entity/jeSchedules/jeSchedulesReducer.js +2 -30
  28. package/lib/esm/entity/jeSchedules/jeSchedulesSelector.js +2 -36
  29. package/lib/esm/entity/jeSchedules/jeSchedulesTypes.js +0 -78
  30. package/lib/esm/entity/snackbar/snackbarTypes.js +0 -3
  31. package/lib/esm/entity/transaction/payloadTypes/scheduleTransactionPayload.js +0 -2
  32. package/lib/esm/epic.js +8 -17
  33. package/lib/esm/index.js +15 -20
  34. package/lib/esm/view/companyMonthEndReportView/companyMonthEndReportViewReducer.js +6 -2
  35. package/lib/esm/view/companyMonthEndReportView/companyMonthEndReportViewState.js +4 -0
  36. package/lib/esm/view/companyMonthEndReportView/epics/saveCompanyMonthEndReportEpic.js +10 -6
  37. package/lib/esm/view/companyMonthEndReportView/epics/sendCompanyMonthEndReportEpic.js +9 -5
  38. package/lib/esm/view/companyMonthEndReportView/monthEndTemplateData.js +32 -0
  39. package/lib/esm/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +3 -6
  40. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +5 -41
  41. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/ignoreRecommendedJeScheduleEpic.js +2 -14
  42. package/lib/esm/view/expenseAutomationView/payload/jeSchedulesPayload.js +0 -55
  43. package/lib/esm/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +29 -306
  44. package/lib/esm/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +22 -294
  45. package/lib/esm/view/expenseAutomationView/types/jeSchedulesViewState.js +6 -5
  46. package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewPayload.js +25 -9
  47. package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/saveInvoicingCatalogItemEpic.js +6 -1
  48. package/lib/esm/view/invoicing/invoicingQboView/invoicingQboViewSelector.js +40 -0
  49. package/lib/esm/view/invoicing/settingsView/epics/connectInvoicingStripeEpic.js +27 -0
  50. package/lib/esm/view/invoicing/settingsView/epics/disconnectInvoicingStripeEpic.js +19 -0
  51. package/lib/esm/view/invoicing/settingsView/epics/fetchInvoicingSettingsEpic.js +19 -0
  52. package/lib/esm/view/invoicing/settingsView/epics/saveInvoicingSettingsEpic.js +39 -0
  53. package/lib/esm/view/invoicing/settingsView/epics/submitInvoicingQboSettingsEpic.js +25 -0
  54. package/lib/esm/view/invoicing/settingsView/invoicingQboSettingsFormConfig.js +48 -0
  55. package/lib/esm/view/invoicing/settingsView/settingsViewReducer.js +25 -1
  56. package/lib/esm/view/invoicing/settingsView/settingsViewSelector.js +41 -0
  57. package/lib/esm/view/recommendation/recommendationReducer.js +16 -1
  58. package/lib/esm/view/recommendation/submitRecommendationFeedbackEpic.js +52 -0
  59. package/lib/esm/view/scheduleView/scheduleListView/epics/fetchAccruedScheduleListEpic.js +1 -1
  60. package/lib/esm/view/scheduleView/scheduleListView/epics/fetchDownloadSchedulesEpic.js +2 -7
  61. package/lib/esm/view/scheduleView/scheduleListView/scheduleListReducer.js +3 -5
  62. package/lib/index.d.ts +24 -25
  63. package/lib/index.js +60 -96
  64. package/lib/view/companyMonthEndReportView/companyMonthEndReportViewPayload.d.ts +8 -0
  65. package/lib/view/companyMonthEndReportView/companyMonthEndReportViewReducer.d.ts +6 -2
  66. package/lib/view/companyMonthEndReportView/companyMonthEndReportViewReducer.js +6 -2
  67. package/lib/view/companyMonthEndReportView/companyMonthEndReportViewState.d.ts +2 -0
  68. package/lib/view/companyMonthEndReportView/companyMonthEndReportViewState.js +4 -0
  69. package/lib/view/companyMonthEndReportView/epics/saveCompanyMonthEndReportEpic.js +10 -6
  70. package/lib/view/companyMonthEndReportView/epics/sendCompanyMonthEndReportEpic.js +9 -5
  71. package/lib/view/companyMonthEndReportView/monthEndTemplateData.d.ts +16 -0
  72. package/lib/view/companyMonthEndReportView/monthEndTemplateData.js +36 -0
  73. package/lib/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +3 -6
  74. package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.d.ts +2 -3
  75. package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +3 -39
  76. package/lib/view/expenseAutomationView/epics/jeSchedule/ignoreRecommendedJeScheduleEpic.js +2 -14
  77. package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
  78. package/lib/view/expenseAutomationView/payload/jeSchedulesPayload.d.ts +3 -72
  79. package/lib/view/expenseAutomationView/payload/jeSchedulesPayload.js +1 -58
  80. package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.d.ts +12 -91
  81. package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +29 -308
  82. package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.d.ts +1 -1
  83. package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.d.ts +2 -2
  84. package/lib/view/expenseAutomationView/selectorTypes/jeSchedulesSelectorTypes.d.ts +7 -36
  85. package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.d.ts +0 -34
  86. package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +21 -302
  87. package/lib/view/expenseAutomationView/types/completedSubTab.d.ts +1 -1
  88. package/lib/view/expenseAutomationView/types/jeSchedulesViewState.d.ts +8 -82
  89. package/lib/view/expenseAutomationView/types/jeSchedulesViewState.js +8 -8
  90. package/lib/view/expenseAutomationView/types/reconciliationViewState.d.ts +2 -2
  91. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewPayload.d.ts +12 -1
  92. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewPayload.js +25 -9
  93. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/saveInvoicingCatalogItemEpic.js +6 -1
  94. package/lib/view/invoicing/invoicingQboView/invoicingQboViewSelector.d.ts +10 -1
  95. package/lib/view/invoicing/invoicingQboView/invoicingQboViewSelector.js +43 -1
  96. package/lib/view/invoicing/settingsView/epics/connectInvoicingStripeEpic.d.ts +6 -0
  97. package/lib/view/invoicing/settingsView/epics/connectInvoicingStripeEpic.js +31 -0
  98. package/lib/view/invoicing/settingsView/epics/disconnectInvoicingStripeEpic.d.ts +6 -0
  99. package/lib/view/invoicing/settingsView/epics/disconnectInvoicingStripeEpic.js +23 -0
  100. package/lib/view/invoicing/settingsView/epics/fetchInvoicingSettingsEpic.d.ts +6 -0
  101. package/lib/view/invoicing/settingsView/epics/fetchInvoicingSettingsEpic.js +23 -0
  102. package/lib/view/invoicing/settingsView/epics/saveInvoicingSettingsEpic.d.ts +6 -0
  103. package/lib/view/invoicing/settingsView/epics/saveInvoicingSettingsEpic.js +43 -0
  104. package/lib/view/invoicing/settingsView/epics/settingsViewActionType.d.ts +5 -0
  105. package/lib/view/invoicing/settingsView/epics/submitInvoicingQboSettingsEpic.d.ts +11 -0
  106. package/lib/view/invoicing/settingsView/epics/submitInvoicingQboSettingsEpic.js +29 -0
  107. package/lib/view/invoicing/settingsView/invoicingQboSettingsFormConfig.d.ts +34 -0
  108. package/lib/view/invoicing/settingsView/invoicingQboSettingsFormConfig.js +53 -0
  109. package/lib/view/invoicing/settingsView/settingsViewReducer.d.ts +4 -1
  110. package/lib/view/invoicing/settingsView/settingsViewReducer.js +26 -2
  111. package/lib/view/invoicing/settingsView/settingsViewSelector.d.ts +35 -0
  112. package/lib/view/invoicing/settingsView/settingsViewSelector.js +43 -1
  113. package/lib/view/invoicing/settingsView/settingsViewState.d.ts +8 -0
  114. package/lib/view/recommendation/recommendationPayload.d.ts +34 -0
  115. package/lib/view/recommendation/recommendationReducer.d.ts +2 -1
  116. package/lib/view/recommendation/recommendationReducer.js +17 -2
  117. package/lib/view/recommendation/submitRecommendationFeedbackEpic.d.ts +7 -0
  118. package/lib/view/recommendation/submitRecommendationFeedbackEpic.js +56 -0
  119. package/lib/view/scheduleView/scheduleListView/epics/fetchAccruedScheduleListEpic.js +1 -1
  120. package/lib/view/scheduleView/scheduleListView/epics/fetchDownloadSchedulesEpic.js +2 -7
  121. package/lib/view/scheduleView/scheduleListView/scheduleListReducer.d.ts +2 -4
  122. package/lib/view/scheduleView/scheduleListView/scheduleListReducer.js +3 -5
  123. package/package.json +1 -1
  124. package/lib/commonStateTypes/selectorTypes/pickAndMergeForecastSection.d.ts +0 -0
  125. package/lib/commonStateTypes/selectorTypes/pickAndMergeForecastSection.js +0 -1
  126. package/lib/entity/invoicing/coupon/couponConstants.d.ts +0 -11
  127. package/lib/entity/invoicing/coupon/couponConstants.js +0 -29
  128. package/lib/esm/commonStateTypes/selectorTypes/pickAndMergeForecastSection.js +0 -1
  129. package/lib/esm/entity/invoicing/coupon/couponConstants.js +0 -26
  130. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/fetchOneTimeAccrualEpic.js +0 -45
  131. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/createOneTimeAccrualEpic.js +0 -99
  132. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.js +0 -25
  133. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.js +0 -110
  134. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.js +0 -79
  135. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/oneTimeAccrualActionsEpic.js +0 -139
  136. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/revertJeScheduleEpic.js +0 -106
  137. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.js +0 -22
  138. package/lib/esm/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.js +0 -140
  139. package/lib/esm/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.js +0 -106
  140. package/lib/esm/view/invoicing/invoicingQboView/epics/fetchInvoicingQboAccountsEpic.js +0 -25
  141. package/lib/esm/view/invoicing/invoicingQboView/epics/fetchInvoicingQboClassesEpic.js +0 -15
  142. package/lib/esm/view/invoicing/settingsView/settingsViewEpics.js +0 -92
  143. package/lib/esm/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryPromoIntroClosedByOutsideClickEpic.js +0 -18
  144. package/lib/esm/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryPromoRemindMeLaterClickedEpic.js +0 -18
  145. package/lib/esm/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryVideoViewedEpic.js +0 -18
  146. package/lib/esm/view/zeniAccountsPromoCard/zeniAccountsPromoCardEpic.js +0 -16
  147. package/lib/esm/view/zeniAccountsPromoCard/zeniAccountsPromoCardPayload.js +0 -1
  148. package/lib/esm/view/zeniAccountsPromoCard/zeniAccountsPromoCardReducer.js +0 -60
  149. package/lib/esm/view/zeniAccountsPromoCard/zeniAccountsPromoCardSelector.js +0 -12
  150. package/lib/esm/view/zeniAccountsPromoCard/zeniAccountsPromoCardState.js +0 -1
  151. package/lib/view/expenseAutomationView/epics/jeSchedule/fetchOneTimeAccrualEpic.d.ts +0 -20
  152. package/lib/view/expenseAutomationView/epics/jeSchedule/fetchOneTimeAccrualEpic.js +0 -49
  153. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/createOneTimeAccrualEpic.d.ts +0 -8
  154. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/createOneTimeAccrualEpic.js +0 -103
  155. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.d.ts +0 -8
  156. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.js +0 -29
  157. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.d.ts +0 -45
  158. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.js +0 -114
  159. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.d.ts +0 -8
  160. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.js +0 -83
  161. package/lib/view/expenseAutomationView/epics/jeSchedule/oneTimeAccrualActionsEpic.d.ts +0 -12
  162. package/lib/view/expenseAutomationView/epics/jeSchedule/oneTimeAccrualActionsEpic.js +0 -146
  163. package/lib/view/expenseAutomationView/epics/jeSchedule/revertJeScheduleEpic.d.ts +0 -64
  164. package/lib/view/expenseAutomationView/epics/jeSchedule/revertJeScheduleEpic.js +0 -110
  165. package/lib/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.d.ts +0 -6
  166. package/lib/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.js +0 -26
  167. package/lib/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.d.ts +0 -36
  168. package/lib/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.js +0 -145
  169. package/lib/view/expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.d.ts +0 -42
  170. package/lib/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.d.ts +0 -21
  171. package/lib/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.js +0 -112
  172. package/lib/view/invoicing/invoicingQboView/epics/fetchInvoicingQboAccountsEpic.d.ts +0 -6
  173. package/lib/view/invoicing/invoicingQboView/epics/fetchInvoicingQboAccountsEpic.js +0 -29
  174. package/lib/view/invoicing/invoicingQboView/epics/fetchInvoicingQboClassesEpic.d.ts +0 -6
  175. package/lib/view/invoicing/invoicingQboView/epics/fetchInvoicingQboClassesEpic.js +0 -19
  176. package/lib/view/invoicing/settingsView/settingsViewEpics.d.ts +0 -12
  177. package/lib/view/invoicing/settingsView/settingsViewEpics.js +0 -99
  178. package/lib/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryPromoIntroClosedByOutsideClickEpic.d.ts +0 -8
  179. package/lib/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryPromoIntroClosedByOutsideClickEpic.js +0 -22
  180. package/lib/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryPromoRemindMeLaterClickedEpic.d.ts +0 -8
  181. package/lib/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryPromoRemindMeLaterClickedEpic.js +0 -22
  182. package/lib/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryVideoViewedEpic.d.ts +0 -8
  183. package/lib/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryVideoViewedEpic.js +0 -22
  184. package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardEpic.d.ts +0 -13
  185. package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardEpic.js +0 -20
  186. package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardPayload.d.ts +0 -11
  187. package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardPayload.js +0 -2
  188. package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardReducer.d.ts +0 -7
  189. package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardReducer.js +0 -64
  190. package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardSelector.d.ts +0 -12
  191. package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardSelector.js +0 -15
  192. package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardState.d.ts +0 -9
  193. package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardState.js +0 -2
  194. /package/lib/esm/view/{expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.js → invoicing/settingsView/epics/settingsViewActionType.js} +0 -0
  195. /package/lib/view/{expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.js → invoicing/settingsView/epics/settingsViewActionType.js} +0 -0
@@ -1,3 +1,5 @@
1
+ import { AccountBasePayload } from '../account/accountPayload';
2
+ import { AccountBase } from '../account/accountState';
1
3
  import { AddressPayload } from '../address/addressPayload';
2
4
  export type InvoicingPriceType = 'tax_exclusive' | 'tax_inclusive';
3
5
  export declare const INVOICING_DUNNING_ACTIONS: readonly ["email_only", "email_and_retry", "do_nothing", "retry_only"];
@@ -92,42 +94,38 @@ export declare function toInvoicingQboCustomerMatchingMode(value: string): Invoi
92
94
  * A mapped account as the newer settings payload returns it: the platform id,
93
95
  * plus hydrated fields the client only displays.
94
96
  */
95
- export interface InvoicingQboMappedAccountPayload {
96
- account_id?: string | null;
97
- account_name?: string | null;
98
- fully_qualified_name?: string | null;
99
- qbo_id?: string | null;
100
- }
101
97
  /**
102
- * Account mappings arrive in two shapes. The original sends a bare id per slot
103
- * (`deposit_account_id`); the newer one sends an object holding the platform id
104
- * (`deposit_account: {account_id}`). Both are declared because a tenant can be
105
- * served either depending on when its backend rolled, and a page that understands
106
- * only one renders an empty picker over data that exists.
98
+ * Account mappings as the service stores them: one entry per mapping kind the
99
+ * config API defines, keyed by that kind's code (`deposit_account`,
100
+ * `default_income_account`, …). The value is the whole account, or just its id
101
+ * for a tenant whose backend has not rolled — both are read, and a save writes
102
+ * the record.
103
+ *
104
+ * An index signature rather than a field list, because the config owns which
105
+ * kinds exist: enumerating them here means a kind it adds gets dropped.
107
106
  */
108
- export interface InvoicingQboAccountMappingsPayload {
109
- default_income_account?: InvoicingQboMappedAccountPayload | null;
110
- default_income_account_id?: string | null;
111
- deposit_account?: InvoicingQboMappedAccountPayload | null;
112
- deposit_account_id?: string | null;
113
- deposit_account_overrides?: Record<string, string> | null;
114
- discounts_account?: InvoicingQboMappedAccountPayload | null;
115
- discounts_account_id?: string | null;
116
- rounding_account?: InvoicingQboMappedAccountPayload | null;
117
- rounding_account_id?: string | null;
118
- write_off_account?: InvoicingQboMappedAccountPayload | null;
119
- write_off_account_id?: string | null;
120
- }
107
+ export type InvoicingQboAccountMappingsPayload = Record<string, Partial<AccountBasePayload> | string | null>;
108
+ /**
109
+ * The first id a picker can actually select. Callers list the QuickBooks id
110
+ * first: the options are keyed on it, so a platform id selects nothing even when
111
+ * it names the same record. Blank counts as absent.
112
+ */
113
+ export declare const firstSelectableInvoicingId: (candidates: readonly (string | null | undefined)[]) => string | undefined;
121
114
  /**
122
- * Read one account-mapping dropdown value by its config `code` (the codes in
123
- * `qbo_account_mapping_kind_options` match the `account_mappings` field names).
115
+ * The slot a mapping code names. Codes arrive from the config API as the slot
116
+ * itself (`deposit_account`); a trailing `_id` is tolerated so a tenant sending
117
+ * the older `deposit_account_id` resolves to the same mapping.
124
118
  */
119
+ export declare const toInvoicingQboAccountMappingSlot: (code: string) => string;
120
+ /** Read one account-mapping dropdown value by its config `code`. */
125
121
  export declare function getInvoicingQboAccountMappingId(accountMappings: InvoicingQboAccountMappingsPayload | undefined, code: string): string | undefined;
126
122
  /**
127
- * Return a copy of the account mappings with the dropdown slot named by
128
- * `code` set to `accountId`. Unknown codes leave the mappings unchanged.
123
+ * Build the `account_mappings` request body from the ids the pickers submitted.
124
+ * Each kind is sent as the whole account, which is what the service stores; an
125
+ * id that resolves to no account is sent as it stands rather than dropped, so a
126
+ * save never silently unsets a mapping it could not expand.
129
127
  */
130
- export declare function withInvoicingQboAccountMappingId(accountMappings: InvoicingQboAccountMappingsPayload | undefined, code: string, accountId: string): InvoicingQboAccountMappingsPayload;
128
+ export declare const toInvoicingQboAccountMappingsPayload: (accountIdByMappingCode: Record<string, string>, accountForId: (accountId: string) => AccountBase | undefined) => InvoicingQboAccountMappingsPayload;
131
129
  export interface InvoicingQboSettingsPayload {
132
130
  account_mappings?: InvoicingQboAccountMappingsPayload | null;
133
131
  auto_create_items?: boolean;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ALL_INVOICING_FIELD_HELP_GROUPS = exports.INVOICING_QBO_CUSTOMER_MATCHING_MODES = exports.INVOICING_DISCOUNT_LIFECYCLE_ACTIONS = exports.INVOICING_CATALOG_PRODUCT_LIFECYCLE_ACTIONS = exports.INVOICING_CATALOG_ITEM_LIFECYCLE_ACTIONS = exports.INVOICING_SUBSCRIPTION_LIFECYCLE_ACTIONS = exports.INVOICING_DUNNING_ACTIONS = void 0;
3
+ exports.ALL_INVOICING_FIELD_HELP_GROUPS = exports.toInvoicingQboAccountMappingsPayload = exports.toInvoicingQboAccountMappingSlot = exports.firstSelectableInvoicingId = exports.INVOICING_QBO_CUSTOMER_MATCHING_MODES = exports.INVOICING_DISCOUNT_LIFECYCLE_ACTIONS = exports.INVOICING_CATALOG_PRODUCT_LIFECYCLE_ACTIONS = exports.INVOICING_CATALOG_ITEM_LIFECYCLE_ACTIONS = exports.INVOICING_SUBSCRIPTION_LIFECYCLE_ACTIONS = exports.INVOICING_DUNNING_ACTIONS = void 0;
4
4
  exports.toInvoicingDunningAction = toInvoicingDunningAction;
5
5
  exports.toInvoicingSubscriptionLifecycleAction = toInvoicingSubscriptionLifecycleAction;
6
6
  exports.toInvoicingSubscriptionLifecycleActionOption = toInvoicingSubscriptionLifecycleActionOption;
@@ -12,7 +12,6 @@ exports.toInvoicingDiscountLifecycleAction = toInvoicingDiscountLifecycleAction;
12
12
  exports.toInvoicingDiscountLifecycleActionOption = toInvoicingDiscountLifecycleActionOption;
13
13
  exports.toInvoicingQboCustomerMatchingMode = toInvoicingQboCustomerMatchingMode;
14
14
  exports.getInvoicingQboAccountMappingId = getInvoicingQboAccountMappingId;
15
- exports.withInvoicingQboAccountMappingId = withInvoicingQboAccountMappingId;
16
15
  exports.toInvoicingQboAccountMappingKindOption = toInvoicingQboAccountMappingKindOption;
17
16
  exports.toInvoicingNamedOption = toInvoicingNamedOption;
18
17
  exports.toInvoicingFormOption = toInvoicingFormOption;
@@ -23,6 +22,7 @@ exports.toInvoicingSubscriptionEditFieldOption = toInvoicingSubscriptionEditFiel
23
22
  exports.toAuditLogEntityRouteOption = toAuditLogEntityRouteOption;
24
23
  exports.buildInvoicingEntityPath = buildInvoicingEntityPath;
25
24
  exports.isInvoicingEntityLinkable = isInvoicingEntityLinkable;
25
+ const accountPayload_1 = require("../account/accountPayload");
26
26
  exports.INVOICING_DUNNING_ACTIONS = [
27
27
  'email_only',
28
28
  'email_and_retry',
@@ -154,87 +154,49 @@ function toInvoicingQboCustomerMatchingMode(value) {
154
154
  }
155
155
  }
156
156
  /**
157
- * The id for one mapping slot, from whichever shape the backend sent. The object
158
- * form wins when present; a blank id in either is treated as unset so the picker
159
- * shows its placeholder rather than selecting nothing.
157
+ * The first id a picker can actually select. Callers list the QuickBooks id
158
+ * first: the options are keyed on it, so a platform id selects nothing even when
159
+ * it names the same record. Blank counts as absent.
160
160
  */
161
- function readInvoicingQboMappedAccountId(mappedAccount, legacyAccountId) {
162
- // `qbo_id` first: the pickers key their options on the QuickBooks id, so an
163
- // internal `account_id` would not select anything even when it is the same
164
- // account. Both are read because the mapping arrives either way depending on
165
- // how it was saved.
166
- const candidates = [
167
- mappedAccount?.qbo_id,
168
- mappedAccount?.account_id,
169
- legacyAccountId,
170
- ];
171
- return candidates.find((candidate) => candidate != null && candidate !== '');
172
- }
161
+ const firstSelectableInvoicingId = (candidates) => candidates.find((candidate) => candidate != null && candidate !== '');
162
+ exports.firstSelectableInvoicingId = firstSelectableInvoicingId;
173
163
  /**
174
- * Read one account-mapping dropdown value by its config `code` (the codes in
175
- * `qbo_account_mapping_kind_options` match the `account_mappings` field names).
164
+ * The slot a mapping code names. Codes arrive from the config API as the slot
165
+ * itself (`deposit_account`); a trailing `_id` is tolerated so a tenant sending
166
+ * the older `deposit_account_id` resolves to the same mapping.
176
167
  */
168
+ const toInvoicingQboAccountMappingSlot = (code) => code.replace(/_id$/, '');
169
+ exports.toInvoicingQboAccountMappingSlot = toInvoicingQboAccountMappingSlot;
170
+ /** Read one account-mapping dropdown value by its config `code`. */
177
171
  function getInvoicingQboAccountMappingId(accountMappings, code) {
178
- switch (code) {
179
- case 'deposit_account_id':
180
- return readInvoicingQboMappedAccountId(accountMappings?.deposit_account, accountMappings?.deposit_account_id);
181
- case 'default_income_account_id':
182
- return readInvoicingQboMappedAccountId(accountMappings?.default_income_account, accountMappings?.default_income_account_id);
183
- case 'discounts_account_id':
184
- return readInvoicingQboMappedAccountId(accountMappings?.discounts_account, accountMappings?.discounts_account_id);
185
- case 'rounding_account_id':
186
- return readInvoicingQboMappedAccountId(accountMappings?.rounding_account, accountMappings?.rounding_account_id);
187
- case 'write_off_account_id':
188
- return readInvoicingQboMappedAccountId(accountMappings?.write_off_account, accountMappings?.write_off_account_id);
189
- default:
190
- return undefined;
172
+ const slotKey = (0, exports.toInvoicingQboAccountMappingSlot)(code);
173
+ // Either key: the service sends `deposit_account`, but an older payload put
174
+ // the id under `deposit_account_id`.
175
+ const slot = accountMappings?.[slotKey] ?? accountMappings?.[`${slotKey}_id`];
176
+ if (typeof slot === 'string') {
177
+ return slot !== '' ? slot : undefined;
191
178
  }
179
+ return (0, exports.firstSelectableInvoicingId)([slot?.qbo_id, slot?.account_id]);
192
180
  }
193
181
  /**
194
- * Return a copy of the account mappings with the dropdown slot named by
195
- * `code` set to `accountId`. Unknown codes leave the mappings unchanged.
182
+ * Build the `account_mappings` request body from the ids the pickers submitted.
183
+ * Each kind is sent as the whole account, which is what the service stores; an
184
+ * id that resolves to no account is sent as it stands rather than dropped, so a
185
+ * save never silently unsets a mapping it could not expand.
196
186
  */
197
- function withInvoicingQboAccountMappingId(accountMappings, code, accountId) {
198
- // Both slots are written together. Setting only the bare id would leave the
199
- // object shape behind, and the reader prefers it — so the selection just made
200
- // would read back as whatever was mapped before. The object is dropped rather
201
- // than rebuilt: only the id is known here, not the name that came with it.
202
- const base = accountMappings ?? {};
203
- switch (code) {
204
- case 'deposit_account_id':
205
- return {
206
- ...base,
207
- deposit_account: undefined,
208
- deposit_account_id: accountId,
209
- };
210
- case 'default_income_account_id':
211
- return {
212
- ...base,
213
- default_income_account: undefined,
214
- default_income_account_id: accountId,
215
- };
216
- case 'discounts_account_id':
217
- return {
218
- ...base,
219
- discounts_account: undefined,
220
- discounts_account_id: accountId,
221
- };
222
- case 'rounding_account_id':
223
- return {
224
- ...base,
225
- rounding_account: undefined,
226
- rounding_account_id: accountId,
227
- };
228
- case 'write_off_account_id':
229
- return {
230
- ...base,
231
- write_off_account: undefined,
232
- write_off_account_id: accountId,
233
- };
234
- default:
235
- return base;
236
- }
237
- }
187
+ const toInvoicingQboAccountMappingsPayload = (accountIdByMappingCode, accountForId) => {
188
+ const mappings = {};
189
+ Object.entries(accountIdByMappingCode).forEach(([code, accountId]) => {
190
+ if (accountId === '') {
191
+ return;
192
+ }
193
+ const account = accountForId(accountId);
194
+ mappings[(0, exports.toInvoicingQboAccountMappingSlot)(code)] =
195
+ account != null ? (0, accountPayload_1.toAccountPayload)(account) : accountId;
196
+ });
197
+ return mappings;
198
+ };
199
+ exports.toInvoicingQboAccountMappingsPayload = toInvoicingQboAccountMappingsPayload;
238
200
  function toInvoicingQboAccountMappingKindOption(option) {
239
201
  return {
240
202
  accountTypes: option.account_types,
@@ -1,3 +1,5 @@
1
+ import { AccountBasePayload } from '../../account/accountPayload';
2
+ import { ClassBasePayload } from '../../class/classPayload';
1
3
  import { InvoicingPlanTier, InvoicingProduct } from './productState';
2
4
  export interface InvoicingPlanTierPayload {
3
5
  price: number;
@@ -7,10 +9,18 @@ export interface InvoicingPlanTierPayload {
7
9
  pricing_type?: string;
8
10
  }
9
11
  export interface InvoicingAccountingDetailPayload {
12
+ /**
13
+ * `account` and `accounting_class` hold whole records — what the service stores
14
+ * and what the catalog payload builder sends. The bare `accounting_code` /
15
+ * `accounting_category_1` are the older shape, still read so a plan saved
16
+ * before the rollover prefills.
17
+ */
18
+ account?: Partial<AccountBasePayload> | null;
10
19
  accounting_category_1?: string;
11
20
  accounting_category_2?: string;
12
21
  accounting_category_3?: string;
13
22
  accounting_category_4?: string;
23
+ accounting_class?: Partial<ClassBasePayload> | null;
14
24
  accounting_code?: string;
15
25
  sku?: string;
16
26
  }
@@ -4,6 +4,7 @@ exports.mapInvoicingProductPayloadToState = exports.mapInvoicingPlanTierPayloadT
4
4
  const amount_1 = require("../../../commonStateTypes/amount");
5
5
  const currencyHelper_1 = require("../../../commonStateTypes/currencyHelper");
6
6
  const zeniDayJS_1 = require("../../../zeniDayJS");
7
+ const invoicingCommonPayload_1 = require("../invoicingCommonPayload");
7
8
  // ── Payload → State mappers (snake_case wire shape → camelCase domain shape) ──
8
9
  const mapInvoicingPlanTierPayloadToState = (payload, currencyCode, currencySymbol) => ({
9
10
  price: (0, amount_1.toAmount)(payload.price, currencyCode, currencySymbol),
@@ -14,11 +15,22 @@ const mapInvoicingPlanTierPayloadToState = (payload, currencyCode, currencySymbo
14
15
  });
15
16
  exports.mapInvoicingPlanTierPayloadToState = mapInvoicingPlanTierPayloadToState;
16
17
  const mapInvoicingAccountingDetailPayloadToState = (payload) => ({
17
- accountingCategory1: payload.accounting_category_1,
18
+ // The QuickBooks id first in both, for the reason `firstSelectableInvoicingId`
19
+ // documents: the form's pickers are keyed on it, so reading the internal id
20
+ // would leave the field blank over a mapping that exists.
21
+ accountingCategory1: (0, invoicingCommonPayload_1.firstSelectableInvoicingId)([
22
+ payload.accounting_class?.qbo_id,
23
+ payload.accounting_class?.accounting_class_id,
24
+ payload.accounting_category_1,
25
+ ]),
18
26
  accountingCategory2: payload.accounting_category_2,
19
27
  accountingCategory3: payload.accounting_category_3,
20
28
  accountingCategory4: payload.accounting_category_4,
21
- accountingCode: payload.accounting_code,
29
+ accountingCode: (0, invoicingCommonPayload_1.firstSelectableInvoicingId)([
30
+ payload.account?.qbo_id,
31
+ payload.account?.account_id,
32
+ payload.accounting_code,
33
+ ]),
22
34
  sku: payload.sku,
23
35
  });
24
36
  const mapInvoicingProductPayloadToState = (payload) => {
@@ -1,3 +1,2 @@
1
1
  import { ID } from '../../commonStateTypes/common';
2
2
  export declare function generateJEScheduleKey(jeScheduleId: ID, jeScheduleType: string): `${string}_${string}`;
3
- export declare function generateJEOneTimeAccrualKey(accrualId: ID): `${string}_one_time_accrual`;
@@ -1,13 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.generateJEScheduleKey = generateJEScheduleKey;
4
- exports.generateJEOneTimeAccrualKey = generateJEOneTimeAccrualKey;
5
4
  function generateJEScheduleKey(jeScheduleId, jeScheduleType) {
6
5
  return `${jeScheduleId}_${jeScheduleType}`;
7
6
  }
8
- // Suffixed rather than using the bare Mongo _id so the key is a distinct type from
9
- // JEScheduleKey / JEScheduleTransactionKey and the three cannot be passed interchangeably.
10
- // The unsuffixed id stays on the entity as `accrualId` for callers that need it.
11
- function generateJEOneTimeAccrualKey(accrualId) {
12
- return `${accrualId}_one_time_accrual`;
13
- }
@@ -7,7 +7,7 @@ import { TransactionIDPayload } from '../transaction/payloadTypes/transactionIDP
7
7
  import { TransactionCategory } from '../transaction/stateTypes/transactionType';
8
8
  import { UserPayload } from '../user/userPayload';
9
9
  import { VendorPayload } from '../vendor/vendorPayload';
10
- import { JEAccruedScheduledTransactionState, JEOneTimeAccrualState, JEScheduledTransactionState, ScheduledJournalEntryState } from './jeSchedulesState';
10
+ import { JEAccruedScheduledTransactionState, JEScheduledTransactionState, ScheduledJournalEntryState } from './jeSchedulesState';
11
11
  import { JEScheduleKey, JEScheduleTransactionKey } from './jeSchedulesTypes';
12
12
  export interface JEScheduleOtherAttributesPayload {
13
13
  asset_id?: string | null;
@@ -72,13 +72,9 @@ export interface JEScheduledTransactionPayload {
72
72
  updated_by: UserPayload;
73
73
  vendor: VendorPayload;
74
74
  ai_summaries?: JEScheduleAISummariesPayload;
75
- confidence_score?: number | null;
76
- create_time?: string | null;
77
75
  created_by?: UserPayload;
78
76
  end_date?: string | null;
79
- posted_count?: number | null;
80
77
  recommendations?: JEScheduleRecommendationsPayload;
81
- recurring_amount?: number | null;
82
78
  updated_at?: string | null;
83
79
  }
84
80
  export interface JEAccruedScheduledTransactionPayload extends Omit<JEScheduledTransactionPayload, 'base_transaction' | 'je_schedule_id' | 'je_schedule_type'> {
@@ -88,66 +84,6 @@ export interface JEAccruedScheduledTransactionPayload extends Omit<JEScheduledTr
88
84
  memo: string;
89
85
  recurring_amount: number;
90
86
  }
91
- /**
92
- * The frozen vendor profile the Cron used to decide an accrual, so the detail page can show its
93
- * reasoning even after the live profile is rebuilt. Present on agent/Cron rows ONLY — a human-created
94
- * accrual carries none, which is why every consumer has to treat it as absent rather than empty.
95
- */
96
- export interface JEOneTimeAccrualProfileSnapshotPayload {
97
- billing_pattern?: {
98
- avg_amount?: number | null;
99
- billing_lag_days?: number | null;
100
- consistency_score?: number | null;
101
- frequency?: string | null;
102
- last_bill_amount?: number | null;
103
- last_bill_date?: string | null;
104
- months_of_history?: number | null;
105
- typical_bill_day?: number | null;
106
- } | null;
107
- monthly_totals?: Record<string, number> | null;
108
- sorted_months?: string[] | null;
109
- }
110
- /** The JE the AI originally suggested, frozen at draft time for suggested-vs-posted comparison. */
111
- export interface JEOneTimeAccrualAiSuggestionPayload {
112
- estimated_amount?: number | null;
113
- je_credit_account_id?: ID | null;
114
- je_credit_account_name?: string | null;
115
- je_debit_account_id?: ID | null;
116
- je_debit_account_name?: string | null;
117
- memo?: string | null;
118
- }
119
- export interface JEOneTimeAccrualPayload {
120
- _id: ID;
121
- estimated_amount: number;
122
- origin: string;
123
- service_month: string;
124
- status: string;
125
- vendor_id: ID;
126
- vendor_name: string;
127
- actual_post_date?: string | null;
128
- actual_reversal_post_date?: string | null;
129
- ai_suggestion?: JEOneTimeAccrualAiSuggestionPayload | null;
130
- automation_tier?: string | null;
131
- created_by_user?: UserPayload | null;
132
- currency?: string | null;
133
- expected_reversal_date?: string | null;
134
- je_credit_account_id?: ID | null;
135
- je_credit_account_name?: string | null;
136
- je_credit_accounting_class_id?: ID | null;
137
- je_credit_accounting_class_name?: string | null;
138
- je_debit_account_id?: ID | null;
139
- je_debit_account_name?: string | null;
140
- je_debit_accounting_class_id?: ID | null;
141
- je_debit_accounting_class_name?: string | null;
142
- memo?: string | null;
143
- posting_date?: string | null;
144
- profile_snapshot?: JEOneTimeAccrualProfileSnapshotPayload | null;
145
- reversal_policy?: string | null;
146
- reversal_transaction_id?: ID | null;
147
- reversal_trigger?: string | null;
148
- transaction_id?: ID | null;
149
- transaction_integration_id?: ID | null;
150
- }
151
87
  export interface ScheduledJournalEntryPayload {
152
88
  actual_post_date: string | null;
153
89
  create_time: string | null;
@@ -178,4 +114,3 @@ export declare function getJEScheduleTransactionDetailKeyPayload(payload: Schedu
178
114
  export declare function getJEScheduleKey(payload: JEAccruedScheduledTransactionPayload): JEScheduleKey;
179
115
  export declare function toJEScheduledTransaction(payload: JEScheduledTransactionPayload): JEScheduledTransactionState;
180
116
  export declare function toJEAccruedScheduledTransaction(payload: JEAccruedScheduledTransactionPayload): JEAccruedScheduledTransactionState;
181
- export declare function toJEOneTimeAccrual(payload: JEOneTimeAccrualPayload): JEOneTimeAccrualState;
@@ -8,15 +8,12 @@ exports.getJEScheduleTransactionDetailKeyPayload = getJEScheduleTransactionDetai
8
8
  exports.getJEScheduleKey = getJEScheduleKey;
9
9
  exports.toJEScheduledTransaction = toJEScheduledTransaction;
10
10
  exports.toJEAccruedScheduledTransaction = toJEAccruedScheduledTransaction;
11
- exports.toJEOneTimeAccrual = toJEOneTimeAccrual;
12
11
  const amount_1 = require("../../commonStateTypes/amount");
13
12
  const timePeriod_1 = require("../../commonStateTypes/timePeriod");
14
13
  const zeniDayJS_1 = require("../../zeniDayJS");
15
- const zeniUrl_1 = require("../../zeniUrl");
16
14
  const transactionIDPayload_1 = require("../transaction/payloadTypes/transactionIDPayload");
17
15
  const jeScheduleHelper_1 = require("./jeScheduleHelper");
18
16
  const jeSchedulesTypes_1 = require("./jeSchedulesTypes");
19
- const USD_CURRENCY_CODE = 'USD';
20
17
  function toScheduledJournalEntryState(payload, currency_code, currency_symbol) {
21
18
  return {
22
19
  status: {
@@ -261,18 +258,9 @@ function toJEScheduledTransaction(payload) {
261
258
  startDate: payload.start_date != null ? (0, zeniDayJS_1.date)(payload.start_date) : undefined,
262
259
  endDate: payload.end_date != null ? (0, zeniDayJS_1.date)(payload.end_date) : undefined,
263
260
  period: payload.period != null ? Number(payload.period) : undefined,
264
- recurringAmount: payload.recurring_amount != null
265
- ? {
266
- amount: payload.recurring_amount,
267
- currencyCode: payload.currency_code,
268
- currencySymbol: payload.currency_symbol,
269
- }
270
- : undefined,
271
- postedCount: payload.posted_count ?? undefined,
272
261
  updatedByUserID: payload.updated_by.user_id,
273
262
  balanceAsOfToday: payload.balance ?? undefined,
274
263
  updatedAt: payload.updated_at != null ? (0, zeniDayJS_1.date)(payload.updated_at) : undefined,
275
- createTime: payload.create_time != null ? (0, zeniDayJS_1.date)(payload.create_time) : undefined,
276
264
  jeCredit: {
277
265
  accountId: payload.je_credit_account_id ?? undefined,
278
266
  accountingClassId: payload.je_credit_accounting_class_id ?? undefined,
@@ -297,7 +285,6 @@ function toJEScheduledTransaction(payload) {
297
285
  : {},
298
286
  scheduledJournalEntry: [],
299
287
  aiSummaries: toJEScheduleAISummaries(payload.ai_summaries),
300
- confidenceScore: payload.confidence_score ?? undefined,
301
288
  createdByUserID: payload.created_by?.user_id ?? undefined,
302
289
  recommendations: toJEScheduleRecommendations(payload.recommendations),
303
290
  };
@@ -355,125 +342,3 @@ function toJEAccruedScheduledTransaction(payload) {
355
342
  jeScheduleType: (0, jeSchedulesTypes_1.toScheduleTypesTypeStrict)(payload.je_schedule_type),
356
343
  };
357
344
  }
358
- /**
359
- * Reads the months in the order the snapshot gives them rather than deriving a range: a vendor that
360
- * skipped a month has no entry for it, so filling gaps would invent history that was never billed.
361
- */
362
- function toJEOneTimeAccrualMonthlyTotals(snapshot, currencyCode) {
363
- const monthlyTotals = snapshot.monthly_totals;
364
- if (monthlyTotals == null) {
365
- return [];
366
- }
367
- const months = snapshot.sorted_months ?? Object.keys(monthlyTotals).sort();
368
- return months
369
- .filter((month) => monthlyTotals[month] != null)
370
- .map((month) => ({
371
- month,
372
- amount: toOneTimeAccrualAmount(monthlyTotals[month], currencyCode),
373
- }));
374
- }
375
- function toJEOneTimeAccrualProfileSnapshot(payload, currencyCode) {
376
- if (payload == null) {
377
- return undefined;
378
- }
379
- const billingPattern = payload.billing_pattern;
380
- return {
381
- monthlyTotals: toJEOneTimeAccrualMonthlyTotals(payload, currencyCode),
382
- billingPattern: billingPattern != null
383
- ? {
384
- frequency: billingPattern.frequency ?? undefined,
385
- monthsOfHistory: billingPattern.months_of_history ?? undefined,
386
- consistencyScore: billingPattern.consistency_score ?? undefined,
387
- billingLagDays: billingPattern.billing_lag_days ?? undefined,
388
- typicalBillDay: billingPattern.typical_bill_day ?? undefined,
389
- avgAmount: billingPattern.avg_amount != null
390
- ? toOneTimeAccrualAmount(billingPattern.avg_amount, currencyCode)
391
- : undefined,
392
- lastBillAmount: billingPattern.last_bill_amount != null
393
- ? toOneTimeAccrualAmount(billingPattern.last_bill_amount, currencyCode)
394
- : undefined,
395
- lastBillDate: billingPattern.last_bill_date != null
396
- ? (0, zeniDayJS_1.date)(billingPattern.last_bill_date)
397
- : undefined,
398
- }
399
- : undefined,
400
- };
401
- }
402
- function toJEOneTimeAccrualAiSuggestion(payload, currencyCode) {
403
- if (payload == null) {
404
- return undefined;
405
- }
406
- return {
407
- memo: payload.memo ?? undefined,
408
- jeDebitAccountName: payload.je_debit_account_name ?? undefined,
409
- jeCreditAccountName: payload.je_credit_account_name ?? undefined,
410
- estimatedAmount: payload.estimated_amount != null
411
- ? toOneTimeAccrualAmount(payload.estimated_amount, currencyCode)
412
- : undefined,
413
- };
414
- }
415
- function toJEOneTimeAccrual(payload) {
416
- return {
417
- accrualId: payload._id,
418
- vendorId: payload.vendor_id,
419
- vendorName: payload.vendor_name,
420
- serviceMonth: payload.service_month,
421
- accrualStatus: (0, jeSchedulesTypes_1.toOneTimeAccrualStatusCodeType)(payload.status),
422
- origin: (0, jeSchedulesTypes_1.toOneTimeAccrualOriginType)(payload.origin),
423
- automationTier: payload.automation_tier != null
424
- ? (0, jeSchedulesTypes_1.toOneTimeAccrualAutomationTierType)(payload.automation_tier)
425
- : undefined,
426
- estimatedAmount: toOneTimeAccrualAmount(payload.estimated_amount, payload.currency),
427
- memo: payload.memo ?? '',
428
- profileSnapshot: toJEOneTimeAccrualProfileSnapshot(payload.profile_snapshot, payload.currency),
429
- aiSuggestion: toJEOneTimeAccrualAiSuggestion(payload.ai_suggestion, payload.currency),
430
- // Exclusive by contract: a scheduled row reverses on expectedReversalDate and bills never
431
- // drive it, so the two never need reconciling. Defaulting to on_bill_match matches the
432
- // create path's default when the field is absent on an older document.
433
- reversalPolicy: (0, jeSchedulesTypes_1.toOneTimeAccrualReversalPolicyType)(payload.reversal_policy ?? 'on_bill_match'),
434
- reversalTrigger: (0, jeSchedulesTypes_1.toOneTimeAccrualReversalTriggerType)(payload.reversal_trigger ?? undefined),
435
- expectedReversalDate: payload.expected_reversal_date != null
436
- ? (0, zeniDayJS_1.date)(payload.expected_reversal_date)
437
- : undefined,
438
- postingDate: payload.posting_date != null ? (0, zeniDayJS_1.date)(payload.posting_date) : undefined,
439
- actualPostDate: payload.actual_post_date != null
440
- ? (0, zeniDayJS_1.date)(payload.actual_post_date)
441
- : undefined,
442
- actualReversalPostDate: payload.actual_reversal_post_date != null
443
- ? (0, zeniDayJS_1.date)(payload.actual_reversal_post_date)
444
- : undefined,
445
- jeDebitAccountId: payload.je_debit_account_id ?? undefined,
446
- jeDebitAccountName: payload.je_debit_account_name ?? undefined,
447
- jeDebitAccountingClassId: payload.je_debit_accounting_class_id ?? undefined,
448
- jeDebitAccountingClassName: payload.je_debit_accounting_class_name ?? undefined,
449
- jeCreditAccountId: payload.je_credit_account_id ?? undefined,
450
- jeCreditAccountName: payload.je_credit_account_name ?? undefined,
451
- jeCreditAccountingClassId: payload.je_credit_accounting_class_id ?? undefined,
452
- jeCreditAccountingClassName: payload.je_credit_accounting_class_name ?? undefined,
453
- transactionId: payload.transaction_id ?? undefined,
454
- transactionIntegrationId: payload.transaction_integration_id ?? undefined,
455
- reversalTransactionId: payload.reversal_transaction_id ?? undefined,
456
- createdBy: toJEOneTimeAccrualCreator(payload.created_by_user),
457
- };
458
- }
459
- // The accrual wire format carries a currency CODE but no symbol, so the symbol has to be derived.
460
- // Only USD has a known glyph today (the create path is USD-only); anything else falls back to the
461
- // code, which reads correctly as "EUR 1,200" rather than silently rendering a wrong "$".
462
- function toOneTimeAccrualAmount(amount, currencyCode) {
463
- const code = currencyCode ?? USD_CURRENCY_CODE;
464
- return (0, amount_1.toAmount)(amount, code, code === USD_CURRENCY_CODE ? '$' : code);
465
- }
466
- function toJEOneTimeAccrualCreator(payload) {
467
- if (payload == null) {
468
- return undefined;
469
- }
470
- return {
471
- userId: payload.user_id,
472
- email: payload.email ?? undefined,
473
- firstName: payload.first_name ?? undefined,
474
- lastName: payload.last_name ?? undefined,
475
- photo: payload.photo?.original != null
476
- ? (0, zeniUrl_1.toZeniUrl)(payload.photo.original)
477
- : undefined,
478
- };
479
- }
@@ -1,5 +1,5 @@
1
1
  import { UpdateType } from '../../commonStateTypes/common';
2
- import { JEAccruedScheduledTransactionPayload, JEOneTimeAccrualPayload, JEScheduledTransactionPayload, ScheduledJournalEntryPayload } from './jeSchedulesPayload';
2
+ import { JEAccruedScheduledTransactionPayload, JEScheduledTransactionPayload, ScheduledJournalEntryPayload } from './jeSchedulesPayload';
3
3
  import { JESchedulesState } from './jeSchedulesState';
4
4
  export declare const initialState: JESchedulesState;
5
5
  export declare const updateJESchedules: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[jeSchedulesTransactionsPayload: JEScheduledTransactionPayload[]], {
@@ -22,8 +22,6 @@ export declare const updateJESchedules: import("@reduxjs/toolkit").ActionCreator
22
22
  jeScheduleTransactionKey: `${string}_expense_${string}` | `${string}_check_${string}` | `${string}_invoice_${string}` | `${string}_payment_${string}` | `${string}_credit_memo_${string}` | `${string}_sales_receipt_${string}` | `${string}_delayed_credit_${string}` | `${string}_delayed_charge_${string}` | `${string}_refund_${string}` | `${string}_bill_${string}` | `${string}_bill_payment_${string}` | `${string}_bill_payment_check_${string}` | `${string}_bill_payment_credit_card_${string}` | `${string}_vendor_credit_${string}` | `${string}_credit_card_credit_${string}` | `${string}_transfer_${string}` | `${string}_credit_card_payment_${string}` | `${string}_deposit_${string}` | `${string}_journal_entry_${string}`;
23
23
  }, "jeSchedules/deleteJESchedulesDetails", never, never>, deleteAccruedJESchedulesDetails: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[JEScheduleKey: `${string}_${string}`], {
24
24
  JEScheduleKey: `${string}_${string}`;
25
- }, "jeSchedules/deleteAccruedJESchedulesDetails", never, never>, clearAllAccruedJESchedules: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"jeSchedules/clearAllAccruedJESchedules">, clearAllJEScheduleTransactions: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"jeSchedules/clearAllJEScheduleTransactions">, updateJEOneTimeAccruals: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[jeOneTimeAccrualsPayload: JEOneTimeAccrualPayload[]], {
26
- jeOneTimeAccrualsPayload: JEOneTimeAccrualPayload[];
27
- }, "jeSchedules/updateJEOneTimeAccruals", never, never>;
25
+ }, "jeSchedules/deleteAccruedJESchedulesDetails", never, never>;
28
26
  declare const _default: import("redux").Reducer<JESchedulesState>;
29
27
  export default _default;