@zeniai/client-epic-state 5.2.11-beta0ND → 5.2.11-betaAM2

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 (191) hide show
  1. package/lib/entity/invoicing/invoicingCommonPayload.d.ts +29 -27
  2. package/lib/entity/invoicing/invoicingCommonPayload.js +75 -37
  3. package/lib/entity/invoicing/product/productPayload.d.ts +0 -10
  4. package/lib/entity/invoicing/product/productPayload.js +2 -14
  5. package/lib/entity/jeSchedules/jeScheduleHelper.d.ts +1 -0
  6. package/lib/entity/jeSchedules/jeScheduleHelper.js +7 -0
  7. package/lib/entity/jeSchedules/jeSchedulesPayload.d.ts +97 -1
  8. package/lib/entity/jeSchedules/jeSchedulesPayload.js +209 -0
  9. package/lib/entity/jeSchedules/jeSchedulesReducer.d.ts +4 -2
  10. package/lib/entity/jeSchedules/jeSchedulesReducer.js +30 -2
  11. package/lib/entity/jeSchedules/jeSchedulesSelector.d.ts +11 -2
  12. package/lib/entity/jeSchedules/jeSchedulesSelector.js +38 -3
  13. package/lib/entity/jeSchedules/jeSchedulesState.d.ts +140 -1
  14. package/lib/entity/jeSchedules/jeSchedulesTypes.d.ts +24 -1
  15. package/lib/entity/jeSchedules/jeSchedulesTypes.js +88 -1
  16. package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
  17. package/lib/entity/snackbar/snackbarTypes.js +3 -0
  18. package/lib/entity/transaction/payloadTypes/scheduleTransactionPayload.d.ts +2 -0
  19. package/lib/entity/transaction/payloadTypes/scheduleTransactionPayload.js +2 -0
  20. package/lib/entity/transaction/stateTypes/scheduleTransaction.d.ts +2 -0
  21. package/lib/epic.d.ts +15 -3
  22. package/lib/epic.js +31 -12
  23. package/lib/esm/entity/invoicing/invoicingCommonPayload.js +73 -33
  24. package/lib/esm/entity/invoicing/product/productPayload.js +2 -14
  25. package/lib/esm/entity/jeSchedules/jeScheduleHelper.js +6 -0
  26. package/lib/esm/entity/jeSchedules/jeSchedulesPayload.js +209 -1
  27. package/lib/esm/entity/jeSchedules/jeSchedulesReducer.js +30 -2
  28. package/lib/esm/entity/jeSchedules/jeSchedulesSelector.js +36 -2
  29. package/lib/esm/entity/jeSchedules/jeSchedulesTypes.js +78 -0
  30. package/lib/esm/entity/snackbar/snackbarTypes.js +3 -0
  31. package/lib/esm/entity/transaction/payloadTypes/scheduleTransactionPayload.js +2 -0
  32. package/lib/esm/epic.js +27 -8
  33. package/lib/esm/index.js +23 -14
  34. package/lib/esm/reducer.js +3 -0
  35. package/lib/esm/view/expenseAutomationView/epics/actualMatching/fetchActualMatchingEpic.js +46 -0
  36. package/lib/esm/view/expenseAutomationView/epics/actualMatching/fetchActualMatchingPageEpic.js +7 -0
  37. package/lib/esm/view/expenseAutomationView/epics/actualMatching/matchAndReverseAccrualsEpic.js +50 -0
  38. package/lib/esm/view/expenseAutomationView/epics/actualMatching/searchMatchAccrualsEpic.js +44 -0
  39. package/lib/esm/view/expenseAutomationView/epics/actualMatching/searchMatchTransactionsEpic.js +44 -0
  40. package/lib/esm/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +30 -10
  41. package/lib/esm/view/expenseAutomationView/epics/common/refreshExpenseAutomationCurrentTabEpic.js +9 -1
  42. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulePageEpic.js +9 -1
  43. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +41 -5
  44. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/fetchOneTimeAccrualEpic.js +45 -0
  45. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/ignoreRecommendedJeScheduleEpic.js +14 -2
  46. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/createOneTimeAccrualEpic.js +104 -0
  47. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.js +25 -0
  48. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.js +136 -0
  49. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.js +79 -0
  50. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/oneTimeAccrualActionsEpic.js +180 -0
  51. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/revertJeScheduleEpic.js +111 -0
  52. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.js +33 -0
  53. package/lib/esm/view/expenseAutomationView/expenseAutomationViewSelector.js +22 -7
  54. package/lib/esm/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.js +140 -0
  55. package/lib/esm/view/expenseAutomationView/payload/actualMatchingPayload.js +35 -0
  56. package/lib/esm/view/expenseAutomationView/payload/jeSchedulesPayload.js +55 -0
  57. package/lib/esm/view/expenseAutomationView/reducers/actualMatchingViewReducer.js +260 -0
  58. package/lib/esm/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +319 -29
  59. package/lib/esm/view/expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.js +1 -0
  60. package/lib/esm/view/expenseAutomationView/selectors/actualMatchingViewSelector.js +162 -0
  61. package/lib/esm/view/expenseAutomationView/selectors/jeAccountSettingsViewSelector.js +1 -0
  62. package/lib/esm/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.js +106 -0
  63. package/lib/esm/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +297 -22
  64. package/lib/esm/view/expenseAutomationView/types/actualMatchingViewState.js +22 -0
  65. package/lib/esm/view/expenseAutomationView/types/jeSchedulesViewState.js +8 -5
  66. package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewPayload.js +9 -25
  67. package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/saveInvoicingCatalogItemEpic.js +1 -6
  68. package/lib/esm/view/invoicing/invoicingQboView/invoicingQboViewSelector.js +0 -40
  69. package/lib/esm/view/invoicing/settingsView/settingsViewEpics.js +92 -0
  70. package/lib/esm/view/invoicing/settingsView/settingsViewReducer.js +1 -25
  71. package/lib/esm/view/invoicing/settingsView/settingsViewSelector.js +0 -41
  72. package/lib/esm/view/recommendation/recommendationReducer.js +1 -16
  73. package/lib/esm/view/scheduleView/scheduleListView/epics/fetchAccruedScheduleListEpic.js +1 -1
  74. package/lib/esm/view/scheduleView/scheduleListView/epics/fetchDownloadSchedulesEpic.js +7 -2
  75. package/lib/esm/view/scheduleView/scheduleListView/scheduleListReducer.js +5 -3
  76. package/lib/index.d.ts +29 -22
  77. package/lib/index.js +116 -56
  78. package/lib/reducer.d.ts +1 -0
  79. package/lib/reducer.js +3 -0
  80. package/lib/rootStateTypes.d.ts +2 -0
  81. package/lib/view/expenseAutomationView/epics/actualMatching/fetchActualMatchingEpic.d.ts +9 -0
  82. package/lib/view/expenseAutomationView/epics/actualMatching/fetchActualMatchingEpic.js +50 -0
  83. package/lib/view/expenseAutomationView/epics/actualMatching/fetchActualMatchingPageEpic.d.ts +5 -0
  84. package/lib/view/expenseAutomationView/epics/actualMatching/fetchActualMatchingPageEpic.js +11 -0
  85. package/lib/view/expenseAutomationView/epics/actualMatching/matchAndReverseAccrualsEpic.d.ts +8 -0
  86. package/lib/view/expenseAutomationView/epics/actualMatching/matchAndReverseAccrualsEpic.js +54 -0
  87. package/lib/view/expenseAutomationView/epics/actualMatching/searchMatchAccrualsEpic.d.ts +8 -0
  88. package/lib/view/expenseAutomationView/epics/actualMatching/searchMatchAccrualsEpic.js +48 -0
  89. package/lib/view/expenseAutomationView/epics/actualMatching/searchMatchTransactionsEpic.d.ts +8 -0
  90. package/lib/view/expenseAutomationView/epics/actualMatching/searchMatchTransactionsEpic.js +48 -0
  91. package/lib/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.d.ts +2 -1
  92. package/lib/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +30 -10
  93. package/lib/view/expenseAutomationView/epics/common/refreshExpenseAutomationCurrentTabEpic.d.ts +2 -1
  94. package/lib/view/expenseAutomationView/epics/common/refreshExpenseAutomationCurrentTabEpic.js +9 -1
  95. package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulePageEpic.js +9 -1
  96. package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.d.ts +3 -2
  97. package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +39 -3
  98. package/lib/view/expenseAutomationView/epics/jeSchedule/fetchOneTimeAccrualEpic.d.ts +21 -0
  99. package/lib/view/expenseAutomationView/epics/jeSchedule/fetchOneTimeAccrualEpic.js +49 -0
  100. package/lib/view/expenseAutomationView/epics/jeSchedule/ignoreRecommendedJeScheduleEpic.js +14 -2
  101. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/createOneTimeAccrualEpic.d.ts +9 -0
  102. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/createOneTimeAccrualEpic.js +108 -0
  103. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.d.ts +8 -0
  104. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.js +29 -0
  105. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.d.ts +9 -0
  106. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.js +140 -0
  107. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.d.ts +8 -0
  108. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.js +83 -0
  109. package/lib/view/expenseAutomationView/epics/jeSchedule/oneTimeAccrualActionsEpic.d.ts +13 -0
  110. package/lib/view/expenseAutomationView/epics/jeSchedule/oneTimeAccrualActionsEpic.js +187 -0
  111. package/lib/view/expenseAutomationView/epics/jeSchedule/revertJeScheduleEpic.d.ts +65 -0
  112. package/lib/view/expenseAutomationView/epics/jeSchedule/revertJeScheduleEpic.js +115 -0
  113. package/lib/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.d.ts +7 -0
  114. package/lib/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.js +37 -0
  115. package/lib/view/expenseAutomationView/expenseAutomationViewSelector.js +22 -7
  116. package/lib/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.d.ts +36 -0
  117. package/lib/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.js +145 -0
  118. package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
  119. package/lib/view/expenseAutomationView/payload/actualMatchingPayload.d.ts +66 -0
  120. package/lib/view/expenseAutomationView/payload/actualMatchingPayload.js +40 -0
  121. package/lib/view/expenseAutomationView/payload/jeSchedulesPayload.d.ts +86 -3
  122. package/lib/view/expenseAutomationView/payload/jeSchedulesPayload.js +58 -1
  123. package/lib/view/expenseAutomationView/reducers/actualMatchingViewReducer.d.ts +53 -0
  124. package/lib/view/expenseAutomationView/reducers/actualMatchingViewReducer.js +264 -0
  125. package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.d.ts +93 -12
  126. package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +321 -29
  127. package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.d.ts +1 -1
  128. package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.d.ts +2 -2
  129. package/lib/view/expenseAutomationView/selectorTypes/actualMatchingViewSelectorTypes.d.ts +58 -0
  130. package/lib/view/expenseAutomationView/selectorTypes/expenseAutomationViewSelectorTypes.d.ts +2 -0
  131. package/lib/view/expenseAutomationView/selectorTypes/jeAccountSettingsViewSelectorTypes.d.ts +1 -0
  132. package/lib/view/expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.d.ts +42 -0
  133. package/lib/view/expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.js +2 -0
  134. package/lib/view/expenseAutomationView/selectorTypes/jeSchedulesSelectorTypes.d.ts +36 -7
  135. package/lib/view/expenseAutomationView/selectors/actualMatchingViewSelector.d.ts +9 -0
  136. package/lib/view/expenseAutomationView/selectors/actualMatchingViewSelector.js +172 -0
  137. package/lib/view/expenseAutomationView/selectors/jeAccountSettingsViewSelector.js +1 -0
  138. package/lib/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.d.ts +21 -0
  139. package/lib/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.js +112 -0
  140. package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.d.ts +34 -0
  141. package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +305 -21
  142. package/lib/view/expenseAutomationView/types/actualMatchingViewState.d.ts +76 -0
  143. package/lib/view/expenseAutomationView/types/actualMatchingViewState.js +27 -0
  144. package/lib/view/expenseAutomationView/types/completedSubTab.d.ts +1 -1
  145. package/lib/view/expenseAutomationView/types/jeSchedulesViewState.d.ts +83 -8
  146. package/lib/view/expenseAutomationView/types/jeSchedulesViewState.js +11 -7
  147. package/lib/view/expenseAutomationView/types/reconciliationViewState.d.ts +2 -2
  148. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewPayload.d.ts +1 -12
  149. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewPayload.js +9 -25
  150. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/saveInvoicingCatalogItemEpic.js +1 -6
  151. package/lib/view/invoicing/invoicingQboView/invoicingQboViewSelector.d.ts +1 -10
  152. package/lib/view/invoicing/invoicingQboView/invoicingQboViewSelector.js +1 -43
  153. package/lib/view/invoicing/settingsView/settingsViewEpics.d.ts +12 -0
  154. package/lib/view/invoicing/settingsView/settingsViewEpics.js +99 -0
  155. package/lib/view/invoicing/settingsView/settingsViewReducer.d.ts +1 -4
  156. package/lib/view/invoicing/settingsView/settingsViewReducer.js +2 -26
  157. package/lib/view/invoicing/settingsView/settingsViewSelector.d.ts +0 -35
  158. package/lib/view/invoicing/settingsView/settingsViewSelector.js +1 -43
  159. package/lib/view/invoicing/settingsView/settingsViewState.d.ts +0 -8
  160. package/lib/view/recommendation/recommendationPayload.d.ts +0 -34
  161. package/lib/view/recommendation/recommendationReducer.d.ts +1 -2
  162. package/lib/view/recommendation/recommendationReducer.js +2 -17
  163. package/lib/view/scheduleView/scheduleListView/epics/fetchAccruedScheduleListEpic.js +1 -1
  164. package/lib/view/scheduleView/scheduleListView/epics/fetchDownloadSchedulesEpic.js +7 -2
  165. package/lib/view/scheduleView/scheduleListView/scheduleListReducer.d.ts +4 -2
  166. package/lib/view/scheduleView/scheduleListView/scheduleListReducer.js +5 -3
  167. package/package.json +1 -1
  168. package/lib/esm/view/invoicing/settingsView/epics/connectInvoicingStripeEpic.js +0 -27
  169. package/lib/esm/view/invoicing/settingsView/epics/disconnectInvoicingStripeEpic.js +0 -19
  170. package/lib/esm/view/invoicing/settingsView/epics/fetchInvoicingSettingsEpic.js +0 -19
  171. package/lib/esm/view/invoicing/settingsView/epics/saveInvoicingSettingsEpic.js +0 -39
  172. package/lib/esm/view/invoicing/settingsView/epics/submitInvoicingQboSettingsEpic.js +0 -25
  173. package/lib/esm/view/invoicing/settingsView/invoicingQboSettingsFormConfig.js +0 -48
  174. package/lib/esm/view/recommendation/submitRecommendationFeedbackEpic.js +0 -52
  175. package/lib/view/invoicing/settingsView/epics/connectInvoicingStripeEpic.d.ts +0 -6
  176. package/lib/view/invoicing/settingsView/epics/connectInvoicingStripeEpic.js +0 -31
  177. package/lib/view/invoicing/settingsView/epics/disconnectInvoicingStripeEpic.d.ts +0 -6
  178. package/lib/view/invoicing/settingsView/epics/disconnectInvoicingStripeEpic.js +0 -23
  179. package/lib/view/invoicing/settingsView/epics/fetchInvoicingSettingsEpic.d.ts +0 -6
  180. package/lib/view/invoicing/settingsView/epics/fetchInvoicingSettingsEpic.js +0 -23
  181. package/lib/view/invoicing/settingsView/epics/saveInvoicingSettingsEpic.d.ts +0 -6
  182. package/lib/view/invoicing/settingsView/epics/saveInvoicingSettingsEpic.js +0 -43
  183. package/lib/view/invoicing/settingsView/epics/settingsViewActionType.d.ts +0 -5
  184. package/lib/view/invoicing/settingsView/epics/submitInvoicingQboSettingsEpic.d.ts +0 -11
  185. package/lib/view/invoicing/settingsView/epics/submitInvoicingQboSettingsEpic.js +0 -29
  186. package/lib/view/invoicing/settingsView/invoicingQboSettingsFormConfig.d.ts +0 -34
  187. package/lib/view/invoicing/settingsView/invoicingQboSettingsFormConfig.js +0 -53
  188. package/lib/view/recommendation/submitRecommendationFeedbackEpic.d.ts +0 -7
  189. package/lib/view/recommendation/submitRecommendationFeedbackEpic.js +0 -56
  190. /package/lib/esm/view/{invoicing/settingsView/epics/settingsViewActionType.js → expenseAutomationView/selectorTypes/actualMatchingViewSelectorTypes.js} +0 -0
  191. /package/lib/view/{invoicing/settingsView/epics/settingsViewActionType.js → expenseAutomationView/selectorTypes/actualMatchingViewSelectorTypes.js} +0 -0
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.toJEScheduleMainTab = exports.toJEScheduleSortKey = void 0;
3
+ exports.MIN_NEW_SCHEDULE_SEARCH_LENGTH = exports.getJESchedulePeriodTabKey = exports.ALL_JE_PAGE_TABS = exports.toJEPageTab = exports.toJEScheduleSortKey = void 0;
4
4
  const stringToUnion_1 = require("../../../commonStateTypes/stringToUnion");
5
5
  const JE_SCHEDULE_SORT_KEYS = [
6
6
  'vendor',
@@ -20,10 +20,14 @@ const JE_SCHEDULE_SORT_KEYS = [
20
20
  ];
21
21
  const toJEScheduleSortKey = (v) => (0, stringToUnion_1.stringToUnion)(v, JE_SCHEDULE_SORT_KEYS);
22
22
  exports.toJEScheduleSortKey = toJEScheduleSortKey;
23
- const JE_SCHEDULE_MAIN_TABS = [
24
- 'pending_review',
25
- 'ongoing',
26
- 'completed',
23
+ const JE_PAGE_TABS = [
24
+ 'schedules',
25
+ 'actual_matching',
26
+ 'existing_schedules',
27
27
  ];
28
- const toJEScheduleMainTab = (v) => (0, stringToUnion_1.stringToUnion)(v, JE_SCHEDULE_MAIN_TABS);
29
- exports.toJEScheduleMainTab = toJEScheduleMainTab;
28
+ const toJEPageTab = (v) => (0, stringToUnion_1.stringToUnion)(v, JE_PAGE_TABS);
29
+ exports.toJEPageTab = toJEPageTab;
30
+ exports.ALL_JE_PAGE_TABS = JE_PAGE_TABS;
31
+ const getJESchedulePeriodTabKey = (selectedPageTab, monthYearPeriodId) => `${selectedPageTab}_${monthYearPeriodId}`;
32
+ exports.getJESchedulePeriodTabKey = getJESchedulePeriodTabKey;
33
+ exports.MIN_NEW_SCHEDULE_SEARCH_LENGTH = 2;
@@ -200,7 +200,7 @@ export interface SaveReconciliationDetailFailurePayload {
200
200
  }
201
201
  export declare const toReconciliationTabsType: (v: string) => "review" | "reconcile";
202
202
  export declare type ReconciliationViewTabType = ReturnType<typeof toReconciliationTabsType>;
203
- declare const toReconReconcileSortKeysType: (v: string) => "type" | "date" | "amount" | "memo" | "account" | "clearedDate" | "payee" | "transactionDirection" | "recommended";
203
+ declare const toReconReconcileSortKeysType: (v: string) => "type" | "date" | "amount" | "memo" | "account" | "recommended" | "clearedDate" | "payee" | "transactionDirection";
204
204
  export declare type ReconReconcileSortKey = ReturnType<typeof toReconReconcileSortKeysType>;
205
205
  export interface ReconciliationReconcileTabLocalData {
206
206
  selectedTransactionIds: ID[];
@@ -232,7 +232,7 @@ export interface ReconciliationTabsState {
232
232
  uiState: ReconciliationReviewTabViewUiState;
233
233
  };
234
234
  }
235
- declare const toReconReviewSortKey: (v: string) => "date" | "amount" | "memo" | "match" | "payee" | "direction";
235
+ declare const toReconReviewSortKey: (v: string) => "date" | "amount" | "memo" | "payee" | "direction" | "match";
236
236
  export type ReconReviewSortKey = ReturnType<typeof toReconReviewSortKey>;
237
237
  export interface ReconciliationReviewTabViewUiState {
238
238
  scrollPosition: {
@@ -1,20 +1,9 @@
1
- import { AccountBase } from '../../../entity/account/accountState';
2
- import { ClassBase } from '../../../entity/class/classState';
3
1
  import { InvoicingPlanPayload } from '../../../entity/invoicing/plan/planPayload';
4
2
  import { ZeniAPIResponse } from '../../../responsePayload';
5
3
  import { InvoicingCatalogItemFormLocalData } from './editInvoicingCatalogItemDetailViewState';
6
4
  export type SaveInvoicingCatalogItemResponse = ZeniAPIResponse<InvoicingPlanPayload>;
7
- /**
8
- * Resolves the QuickBooks ids the pickers submit back to the entities they name.
9
- * The payload carries the whole account and class, so the ids alone are not
10
- * enough; `saveInvoicingCatalogItemEpic` builds this from the shared lists.
11
- */
12
- export interface InvoicingCatalogAccountingLookup {
13
- accountByQboId: (qboId: string) => AccountBase | undefined;
14
- classByQboId: (qboId: string) => ClassBase | undefined;
15
- }
16
5
  /**
17
6
  * Build the parent catalog-item request body from the form draft. Creates omit
18
7
  * both parent and sub-family IDs; edits retain returned sub-family IDs.
19
8
  */
20
- export declare const localDataToSaveInvoicingCatalogItemPayload: (localData: InvoicingCatalogItemFormLocalData, isCreate: boolean, lookup: InvoicingCatalogAccountingLookup) => Record<string, unknown>;
9
+ export declare const localDataToSaveInvoicingCatalogItemPayload: (localData: InvoicingCatalogItemFormLocalData, isCreate: boolean) => Record<string, unknown>;
@@ -1,8 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.localDataToSaveInvoicingCatalogItemPayload = void 0;
4
- const accountPayload_1 = require("../../../entity/account/accountPayload");
5
- const classPayload_1 = require("../../../entity/class/classPayload");
6
4
  const invoicingCatalogItemFormConfig_1 = require("./invoicingCatalogItemFormConfig");
7
5
  const CURRENCY_CODE = 'USD';
8
6
  const trimOrUndefined = (value) => value.trim() !== '' ? value.trim() : undefined;
@@ -12,26 +10,20 @@ const toProductCode = (value) => value
12
10
  .toLowerCase()
13
11
  .replace(/[^a-z0-9]+/g, '-')
14
12
  .replace(/^-|-$/g, '');
15
- const buildAccountingDetail = (subFamily, lookup) => {
13
+ const buildAccountingDetail = (subFamily) => {
16
14
  const detail = {};
17
15
  if (subFamily.sku.trim() !== '') {
18
16
  detail.sku = subFamily.sku.trim();
19
17
  }
20
- // The account and class travel as whole objects rather than bare codes, built
21
- // by the same helpers the transaction and vendor payloads use. An id that no
22
- // longer resolves is dropped: sending a code the service cannot expand is how
23
- // a mapping silently lands on the wrong account.
24
- const account = lookup.accountByQboId(subFamily.accountingCode.trim());
25
- if (account != null) {
26
- detail.account = (0, accountPayload_1.toAccountPayload)(account);
18
+ if (subFamily.accountingCode.trim() !== '') {
19
+ detail.accounting_code = subFamily.accountingCode.trim();
27
20
  }
28
- const accountingClass = lookup.classByQboId(subFamily.accountingCategory.trim());
29
- if (accountingClass != null) {
30
- detail.accounting_class = (0, classPayload_1.toClassBasePayload)(accountingClass);
21
+ if (subFamily.accountingCategory.trim() !== '') {
22
+ detail.accounting_category_1 = subFamily.accountingCategory.trim();
31
23
  }
32
24
  return Object.keys(detail).length > 0 ? detail : undefined;
33
25
  };
34
- const buildSubFamilyPayload = (localData, subFamily, clearEmptyValues, lookup) => {
26
+ const buildSubFamilyPayload = (localData, subFamily, clearEmptyValues) => {
35
27
  const isAddon = localData.catalogType === 'addon';
36
28
  const tiered = (0, invoicingCatalogItemFormConfig_1.isTieredCatalogPricingModel)(subFamily.pricingModel);
37
29
  const name = subFamily.name.trim();
@@ -85,7 +77,7 @@ const buildSubFamilyPayload = (localData, subFamily, clearEmptyValues, lookup) =
85
77
  starting_unit: Number(tier.startingUnit) || 1,
86
78
  }));
87
79
  }
88
- const accountingDetail = buildAccountingDetail(subFamily, lookup);
80
+ const accountingDetail = buildAccountingDetail(subFamily);
89
81
  if (accountingDetail != null) {
90
82
  payload.accounting_detail = accountingDetail;
91
83
  }
@@ -97,7 +89,7 @@ const DEFAULT_CATALOG_ITEM_UNIT = 'USD';
97
89
  * Build the parent catalog-item request body from the form draft. Creates omit
98
90
  * both parent and sub-family IDs; edits retain returned sub-family IDs.
99
91
  */
100
- const localDataToSaveInvoicingCatalogItemPayload = (localData, isCreate, lookup) => {
92
+ const localDataToSaveInvoicingCatalogItemPayload = (localData, isCreate) => {
101
93
  const description = trimOrUndefined(localData.description);
102
94
  const productCode = trimOrUndefined(localData.productCode) ?? toProductCode(localData.name);
103
95
  const itemPayload = {
@@ -125,7 +117,7 @@ const localDataToSaveInvoicingCatalogItemPayload = (localData, isCreate, lookup)
125
117
  ? localData.subFamilies
126
118
  : [(0, invoicingCatalogItemFormConfig_1.blankInvoicingCatalogSubFamily)()];
127
119
  itemPayload.sub_family_details = isCreate
128
- ? subFamilies.map((subFamily) => buildSubFamilyPayload(localData, subFamily, false, lookup))
120
+ ? subFamilies.map((subFamily) => buildSubFamilyPayload(localData, subFamily, false))
129
121
  : subFamilies.map((subFamily) => {
130
122
  const priceCode = trimOrUndefined(subFamily.priceCode) ?? toProductCode(subFamily.name);
131
123
  const detail = {
@@ -135,14 +127,6 @@ const localDataToSaveInvoicingCatalogItemPayload = (localData, isCreate, lookup)
135
127
  price_code: priceCode,
136
128
  show_description_in_invoices: subFamily.showDescriptionInInvoices,
137
129
  };
138
- // Edits send a narrower body than creates, but the accounting mapping
139
- // is editable on this form, so leaving it out dropped the account and
140
- // class the user had just picked. `null` rather than omitted when it is
141
- // empty: an absent key on an update reads as "leave it alone", which
142
- // would make a cleared mapping impossible to save — the same reason
143
- // `description` and `invoice_notes` go through `trimOrNull`.
144
- detail.accounting_detail =
145
- buildAccountingDetail(subFamily, lookup) ?? null;
146
130
  const id = trimOrUndefined(subFamily.id);
147
131
  return id != null ? { ...detail, id } : detail;
148
132
  });
@@ -9,7 +9,6 @@ const snackbarApiError_1 = require("../../../entity/snackbar/snackbarApiError");
9
9
  const snackbarReducer_1 = require("../../../entity/snackbar/snackbarReducer");
10
10
  const responsePayload_1 = require("../../../responsePayload");
11
11
  const invoicingCatalogListViewReducer_1 = require("../invoicingCatalogListView/invoicingCatalogListViewReducer");
12
- const invoicingQboViewSelector_1 = require("../invoicingQboView/invoicingQboViewSelector");
13
12
  const editInvoicingCatalogItemDetailViewPayload_1 = require("./editInvoicingCatalogItemDetailViewPayload");
14
13
  const editInvoicingCatalogItemDetailViewReducer_1 = require("./editInvoicingCatalogItemDetailViewReducer");
15
14
  const saveInvoicingCatalogItemEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)((action) => editInvoicingCatalogItemDetailViewReducer_1.submitInvoicingCatalogItemForm.match(action) ||
@@ -24,11 +23,7 @@ const saveInvoicingCatalogItemEpic = (actions$, state$, zeniAPI) => actions$.pip
24
23
  const viewState = state$.value.editInvoicingCatalogItemDetailViewState;
25
24
  const localData = (id != null ? viewState.editDraftById[id] : viewState.newItemDraft) ??
26
25
  viewState.newItemDraft;
27
- const state = state$.value;
28
- data = (0, editInvoicingCatalogItemDetailViewPayload_1.localDataToSaveInvoicingCatalogItemPayload)(localData, id == null, {
29
- accountByQboId: (qboId) => (0, invoicingQboViewSelector_1.invoicingQboAccountByQboId)(state, qboId),
30
- classByQboId: (qboId) => (0, invoicingQboViewSelector_1.invoicingQboClassByQboId)(state, qboId),
31
- });
26
+ data = (0, editInvoicingCatalogItemDetailViewPayload_1.localDataToSaveInvoicingCatalogItemPayload)(localData, id == null);
32
27
  }
33
28
  const baseUrl = `${zeniAPI.apiEndPoints.invoicingMicroServiceBaseUrl}/1.0`;
34
29
  const path = id != null
@@ -1,8 +1,7 @@
1
1
  import { NestedAccountHierarchyForReport } from '../../../commonStateTypes/accountView/nestedAccountID';
2
2
  import { NestedClassHierarchyForReport } from '../../../commonStateTypes/classesView/nestedClassID';
3
3
  import { FetchStateAndError } from '../../../commonStateTypes/common';
4
- import { AccountBase, AccountType } from '../../../entity/account/accountState';
5
- import { ClassBase } from '../../../entity/class/classState';
4
+ import { AccountType } from '../../../entity/account/accountState';
6
5
  import { RootState } from '../../../rootStateTypes';
7
6
  import { InvoicingQboConnection, InvoicingQboSyncHealth } from './invoicingQboViewPayload';
8
7
  export declare const INVOICING_ACCOUNT_LIST_KEY: "accountList";
@@ -21,14 +20,6 @@ export declare const getInvoicingQboConnectionFetchState: (state: RootState) =>
21
20
  * "income accounts" rather than repeating the accounting service's vocabulary.
22
21
  */
23
22
  export declare const INVOICING_INCOME_ACCOUNT_TYPES: readonly AccountType[];
24
- /**
25
- * The account behind a picker value. The pickers submit the QuickBooks id, so
26
- * that is what callers hold; the payload builders need the whole entity to send
27
- * `toAccountPayload`, which is why the lookup lives here next to the options.
28
- */
29
- export declare const invoicingQboAccountByQboId: (state: RootState, qboId: string | undefined) => AccountBase | undefined;
30
- /** The class behind a picker value, for the same reason as the account above. */
31
- export declare const invoicingQboClassByQboId: (state: RootState, qboId: string | undefined) => ClassBase | undefined;
32
23
  /** An account or class as the invoicing pickers render and submit it. */
33
24
  export interface InvoicingAccountingOption {
34
25
  id: string;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getInvoicingQboView = exports.invoicingAccountHierarchyForTypes = exports.invoicingAccountsForQboAccountTypes = exports.invoicingQboClassByQboId = exports.invoicingQboAccountByQboId = exports.INVOICING_INCOME_ACCOUNT_TYPES = exports.getInvoicingQboConnectionFetchState = exports.isInvoicingAccountingPickerDataLoading = exports.isInvoicingQboConnected = exports.INVOICING_ACCOUNT_LIST_KEY = void 0;
3
+ exports.getInvoicingQboView = exports.invoicingAccountHierarchyForTypes = exports.invoicingAccountsForQboAccountTypes = exports.INVOICING_INCOME_ACCOUNT_TYPES = exports.getInvoicingQboConnectionFetchState = exports.isInvoicingAccountingPickerDataLoading = exports.isInvoicingQboConnected = exports.INVOICING_ACCOUNT_LIST_KEY = void 0;
4
4
  const accountListSelector_1 = require("../../accountList/accountListSelector");
5
5
  const classListSelector_1 = require("../../classList/classListSelector");
6
6
  // The shared bucket, fetched with the same arguments as the other consumers so
@@ -43,48 +43,6 @@ exports.INVOICING_INCOME_ACCOUNT_TYPES = [
43
43
  'income',
44
44
  'other_income',
45
45
  ];
46
- /**
47
- * The account behind a picker value. The pickers submit the QuickBooks id, so
48
- * that is what callers hold; the payload builders need the whole entity to send
49
- * `toAccountPayload`, which is why the lookup lives here next to the options.
50
- */
51
- const invoicingQboAccountByQboId = (state, qboId) => {
52
- if (qboId == null || qboId === '') {
53
- return undefined;
54
- }
55
- // `getAccountList` throws when a listed id is missing from the entity slice.
56
- // That is survivable when looking one account up — the caller falls back to
57
- // the id it already had — but not when it happens inside an epic, where the
58
- // throw would take the whole request with it.
59
- try {
60
- const { accounts } = (0, accountListSelector_1.getAccountList)(state.accountState, state.accountListState, exports.INVOICING_ACCOUNT_LIST_KEY);
61
- // Matched on any id the account is known by. The pickers submit `qboId`,
62
- // but a mapping that arrived from the service can name the account by its
63
- // platform id instead, and an account we cannot resolve is a mapping that
64
- // cannot be sent as a record.
65
- return accounts.find((account) => account.qboId === qboId ||
66
- account.accountId === qboId ||
67
- account.coaId === qboId);
68
- }
69
- catch {
70
- return undefined;
71
- }
72
- };
73
- exports.invoicingQboAccountByQboId = invoicingQboAccountByQboId;
74
- /** The class behind a picker value, for the same reason as the account above. */
75
- const invoicingQboClassByQboId = (state, qboId) => {
76
- if (qboId == null || qboId === '') {
77
- return undefined;
78
- }
79
- try {
80
- const { classes } = (0, classListSelector_1.getClassList)(state.classState, state.classListState);
81
- return classes.find((accountingClass) => accountingClass.qboId === qboId);
82
- }
83
- catch {
84
- return undefined;
85
- }
86
- };
87
- exports.invoicingQboClassByQboId = invoicingQboClassByQboId;
88
46
  /**
89
47
  * Accounts and classes as the invoicing pickers need them. Both come from the
90
48
  * shared accounting-service lists, so whatever another screen already loaded
@@ -0,0 +1,12 @@
1
+ import { ActionsObservable, StateObservable } from 'redux-observable';
2
+ import { Observable } from 'rxjs';
3
+ import { updateAddresses } from '../../../entity/address/addressReducer';
4
+ import { openSnackbar } from '../../../entity/snackbar/snackbarReducer';
5
+ import { RootState } from '../../../rootStateTypes';
6
+ import { ZeniAPI } from '../../../zeniAPI';
7
+ import { connectInvoicingStripe, disconnectInvoicingStripe, fetchInvoicingSettings, invoicingStripeConnectionFailure, saveInvoicingSettings, saveInvoicingSettingsFailure, saveInvoicingSettingsSuccess, updateInvoicingSettings, updateInvoicingSettingsFailure, updateInvoicingStripeConnection } from './settingsViewReducer';
8
+ export type ActionType = ReturnType<typeof fetchInvoicingSettings> | ReturnType<typeof updateInvoicingSettings> | ReturnType<typeof updateInvoicingSettingsFailure> | ReturnType<typeof saveInvoicingSettings> | ReturnType<typeof saveInvoicingSettingsSuccess> | ReturnType<typeof saveInvoicingSettingsFailure> | ReturnType<typeof connectInvoicingStripe> | ReturnType<typeof disconnectInvoicingStripe> | ReturnType<typeof updateInvoicingStripeConnection> | ReturnType<typeof invoicingStripeConnectionFailure> | ReturnType<typeof updateAddresses> | ReturnType<typeof openSnackbar>;
9
+ export declare const fetchInvoicingSettingsEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
10
+ export declare const connectInvoicingStripeEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
11
+ export declare const disconnectInvoicingStripeEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
12
+ export declare const saveInvoicingSettingsEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
@@ -0,0 +1,99 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.saveInvoicingSettingsEpic = exports.disconnectInvoicingStripeEpic = exports.connectInvoicingStripeEpic = exports.fetchInvoicingSettingsEpic = void 0;
4
+ const rxjs_1 = require("rxjs");
5
+ const operators_1 = require("rxjs/operators");
6
+ const addressReducer_1 = require("../../../entity/address/addressReducer");
7
+ const snackbarApiError_1 = require("../../../entity/snackbar/snackbarApiError");
8
+ const snackbarReducer_1 = require("../../../entity/snackbar/snackbarReducer");
9
+ const responsePayload_1 = require("../../../responsePayload");
10
+ const settingsViewReducer_1 = require("./settingsViewReducer");
11
+ const fetchInvoicingSettingsEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(settingsViewReducer_1.fetchInvoicingSettings.match), (0, operators_1.switchMap)(() => {
12
+ const apiUrl = `${zeniAPI.apiEndPoints.invoicingMicroServiceBaseUrl}/1.0/settings`;
13
+ return zeniAPI.getJSON(apiUrl).pipe((0, operators_1.switchMap)((response) => {
14
+ if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
15
+ const address = response.data.address;
16
+ return [
17
+ ...(address != null ? [(0, addressReducer_1.updateAddresses)([address])] : []),
18
+ (0, settingsViewReducer_1.updateInvoicingSettings)(response.data),
19
+ ];
20
+ }
21
+ return (0, rxjs_1.of)((0, settingsViewReducer_1.updateInvoicingSettingsFailure)(response.status));
22
+ }), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, settingsViewReducer_1.updateInvoicingSettingsFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Fetch settings REST API call errored out ' +
23
+ JSON.stringify(error))))));
24
+ }));
25
+ exports.fetchInvoicingSettingsEpic = fetchInvoicingSettingsEpic;
26
+ const connectInvoicingStripeEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(settingsViewReducer_1.connectInvoicingStripe.match), (0, operators_1.mergeMap)((action) => {
27
+ const apiUrl = `${zeniAPI.apiEndPoints.invoicingMicroServiceBaseUrl}/1.0/settings/stripe-connect/setup`;
28
+ const { api_key, publishable_key, webhook_secret } = action.payload;
29
+ const body = {
30
+ api_key,
31
+ publishable_key,
32
+ ...(webhook_secret != null && webhook_secret !== ''
33
+ ? { webhook_secret }
34
+ : {}),
35
+ };
36
+ return zeniAPI
37
+ .postAndGetJSON(apiUrl, body)
38
+ .pipe((0, operators_1.switchMap)((response) => {
39
+ if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
40
+ return (0, rxjs_1.of)((0, settingsViewReducer_1.updateInvoicingStripeConnection)({
41
+ stripe_connected: response.data.stripe_connected,
42
+ publishable_key: response.data.publishable_key,
43
+ }), (0, settingsViewReducer_1.fetchInvoicingSettings)());
44
+ }
45
+ return (0, rxjs_1.of)((0, settingsViewReducer_1.invoicingStripeConnectionFailure)(response.status));
46
+ }), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, settingsViewReducer_1.invoicingStripeConnectionFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Stripe connect setup REST API call errored out ' +
47
+ JSON.stringify(error))))));
48
+ }));
49
+ exports.connectInvoicingStripeEpic = connectInvoicingStripeEpic;
50
+ const disconnectInvoicingStripeEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(settingsViewReducer_1.disconnectInvoicingStripe.match), (0, operators_1.mergeMap)(() => {
51
+ const apiUrl = `${zeniAPI.apiEndPoints.invoicingMicroServiceBaseUrl}/1.0/settings/stripe-connect/callback`;
52
+ return zeniAPI
53
+ .deleteAndGetJSON(apiUrl)
54
+ .pipe((0, operators_1.switchMap)((response) => {
55
+ if ((0, responsePayload_1.isSuccessResponse)(response)) {
56
+ return (0, rxjs_1.of)((0, settingsViewReducer_1.updateInvoicingStripeConnection)({
57
+ stripe_connected: false,
58
+ publishable_key: '',
59
+ }), (0, settingsViewReducer_1.fetchInvoicingSettings)());
60
+ }
61
+ return (0, rxjs_1.of)((0, settingsViewReducer_1.invoicingStripeConnectionFailure)(response.status));
62
+ }), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, settingsViewReducer_1.invoicingStripeConnectionFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Stripe disconnect REST API call errored out ' +
63
+ JSON.stringify(error))))));
64
+ }));
65
+ exports.disconnectInvoicingStripeEpic = disconnectInvoicingStripeEpic;
66
+ const saveInvoicingSettingsEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(settingsViewReducer_1.saveInvoicingSettings.match), (0, operators_1.mergeMap)((action) => {
67
+ const apiUrl = `${zeniAPI.apiEndPoints.invoicingMicroServiceBaseUrl}/1.0/settings`;
68
+ const { settings, snackbarSection } = action.payload;
69
+ /** `status` surfaces the platform's error text; omit it to keep the generic copy. */
70
+ const snackbar = (messageText, status) => snackbarSection == null
71
+ ? []
72
+ : [
73
+ (0, snackbarReducer_1.openSnackbar)({
74
+ messageSection: snackbarSection,
75
+ messageText,
76
+ type: messageText === 'success' ? 'success' : 'error',
77
+ variables: (0, snackbarApiError_1.apiErrorSnackbarVariables)(status),
78
+ }),
79
+ ];
80
+ return zeniAPI
81
+ .putAndGetJSON(apiUrl, { ...settings })
82
+ .pipe((0, operators_1.switchMap)((response) => {
83
+ if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
84
+ return (0, rxjs_1.from)([
85
+ (0, settingsViewReducer_1.saveInvoicingSettingsSuccess)(response.data),
86
+ ...snackbar('success'),
87
+ ]);
88
+ }
89
+ return (0, rxjs_1.from)([
90
+ (0, settingsViewReducer_1.saveInvoicingSettingsFailure)(response.status),
91
+ ...snackbar('failed', response.status),
92
+ ]);
93
+ }), (0, operators_1.catchError)((error) => (0, rxjs_1.from)([
94
+ (0, settingsViewReducer_1.saveInvoicingSettingsFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Save settings REST API call errored out ' +
95
+ JSON.stringify(error))),
96
+ ...snackbar('failed'),
97
+ ])));
98
+ }));
99
+ exports.saveInvoicingSettingsEpic = saveInvoicingSettingsEpic;
@@ -2,7 +2,6 @@ import { InvoicingSettingsPayload } from '../../../entity/invoicing/invoicingCom
2
2
  import { SnackbarMessageSections } from '../../../entity/snackbar/snackbarTypes';
3
3
  import { ZeniAPIStatus } from '../../../responsePayload';
4
4
  import { InvoicingBrandingFormLocalData } from './invoicingBrandingFormConfig';
5
- import { InvoicingQboSettingsLocalData } from './invoicingQboSettingsFormConfig';
6
5
  import { StripeConnectCredentials } from './settingsViewPayload';
7
6
  import { InvoicingSettingsViewState } from './settingsViewState';
8
7
  export interface InvoicingStripeConnectionUpdate {
@@ -20,8 +19,6 @@ export interface SaveInvoicingSettingsPayload {
20
19
  export declare const initialState: InvoicingSettingsViewState;
21
20
  export declare const fetchInvoicingSettings: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"invoicingSettingsView/fetchInvoicingSettings">, updateInvoicingSettings: import("@reduxjs/toolkit").ActionCreatorWithPayload<InvoicingSettingsPayload, "invoicingSettingsView/updateInvoicingSettings">, updateInvoicingSettingsFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "invoicingSettingsView/updateInvoicingSettingsFailure">, saveInvoicingSettings: import("@reduxjs/toolkit").ActionCreatorWithPayload<SaveInvoicingSettingsPayload, "invoicingSettingsView/saveInvoicingSettings">, saveInvoicingSettingsSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<InvoicingSettingsPayload, "invoicingSettingsView/saveInvoicingSettingsSuccess">, saveInvoicingSettingsFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "invoicingSettingsView/saveInvoicingSettingsFailure">, resetSaveInvoicingSettings: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"invoicingSettingsView/resetSaveInvoicingSettings">, updateInvoicingBrandingFormDraft: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
22
21
  localData: InvoicingBrandingFormLocalData;
23
- }, "invoicingSettingsView/updateInvoicingBrandingFormDraft">, submitInvoicingBrandingForm: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"invoicingSettingsView/submitInvoicingBrandingForm">, resetInvoicingBrandingFormDraft: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"invoicingSettingsView/resetInvoicingBrandingFormDraft">, updateInvoicingQboSettingsDraft: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
24
- localData: InvoicingQboSettingsLocalData;
25
- }, "invoicingSettingsView/updateInvoicingQboSettingsDraft">, submitInvoicingQboSettings: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"invoicingSettingsView/submitInvoicingQboSettings">, resetInvoicingQboSettingsDraft: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"invoicingSettingsView/resetInvoicingQboSettingsDraft">, connectInvoicingStripe: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[credentials: StripeConnectCredentials], StripeConnectCredentials, "invoicingSettingsView/connectInvoicingStripe", never, never>, disconnectInvoicingStripe: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"invoicingSettingsView/disconnectInvoicingStripe">, updateInvoicingStripeConnection: import("@reduxjs/toolkit").ActionCreatorWithPayload<InvoicingStripeConnectionUpdate, "invoicingSettingsView/updateInvoicingStripeConnection">, invoicingStripeConnectionFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "invoicingSettingsView/invoicingStripeConnectionFailure">;
22
+ }, "invoicingSettingsView/updateInvoicingBrandingFormDraft">, submitInvoicingBrandingForm: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"invoicingSettingsView/submitInvoicingBrandingForm">, resetInvoicingBrandingFormDraft: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"invoicingSettingsView/resetInvoicingBrandingFormDraft">, connectInvoicingStripe: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[credentials: StripeConnectCredentials], StripeConnectCredentials, "invoicingSettingsView/connectInvoicingStripe", never, never>, disconnectInvoicingStripe: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"invoicingSettingsView/disconnectInvoicingStripe">, updateInvoicingStripeConnection: import("@reduxjs/toolkit").ActionCreatorWithPayload<InvoicingStripeConnectionUpdate, "invoicingSettingsView/updateInvoicingStripeConnection">, invoicingStripeConnectionFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "invoicingSettingsView/invoicingStripeConnectionFailure">;
26
23
  declare const _default: import("redux").Reducer<InvoicingSettingsViewState>;
27
24
  export default _default;
@@ -1,20 +1,15 @@
1
1
  "use strict";
2
2
  var _a;
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.invoicingStripeConnectionFailure = exports.updateInvoicingStripeConnection = exports.disconnectInvoicingStripe = exports.connectInvoicingStripe = exports.resetInvoicingQboSettingsDraft = exports.submitInvoicingQboSettings = exports.updateInvoicingQboSettingsDraft = exports.resetInvoicingBrandingFormDraft = exports.submitInvoicingBrandingForm = exports.updateInvoicingBrandingFormDraft = exports.resetSaveInvoicingSettings = exports.saveInvoicingSettingsFailure = exports.saveInvoicingSettingsSuccess = exports.saveInvoicingSettings = exports.updateInvoicingSettingsFailure = exports.updateInvoicingSettings = exports.fetchInvoicingSettings = exports.initialState = void 0;
4
+ exports.invoicingStripeConnectionFailure = exports.updateInvoicingStripeConnection = exports.disconnectInvoicingStripe = exports.connectInvoicingStripe = exports.resetInvoicingBrandingFormDraft = exports.submitInvoicingBrandingForm = exports.updateInvoicingBrandingFormDraft = exports.resetSaveInvoicingSettings = exports.saveInvoicingSettingsFailure = exports.saveInvoicingSettingsSuccess = exports.saveInvoicingSettings = exports.updateInvoicingSettingsFailure = exports.updateInvoicingSettings = exports.fetchInvoicingSettings = exports.initialState = void 0;
5
5
  const toolkit_1 = require("@reduxjs/toolkit");
6
6
  const rootActions_1 = require("../../../rootActions");
7
- const invoicingQboSettingsFormConfig_1 = require("./invoicingQboSettingsFormConfig");
8
7
  exports.initialState = {
9
8
  fetchState: 'Not-Started',
10
9
  error: undefined,
11
10
  saveFetchState: { fetchState: 'Not-Started', error: undefined },
12
11
  stripeFetchState: { fetchState: 'Not-Started', error: undefined },
13
12
  settings: undefined,
14
- // Listed so `clearAll` resets them: an in-progress draft left behind by a
15
- // tenant switch would be shown and saved against the tenant switched to.
16
- brandingDraft: undefined,
17
- qboDraft: undefined,
18
13
  hasValidState() {
19
14
  return this.fetchState === 'Completed' && this.settings != null;
20
15
  },
@@ -31,11 +26,6 @@ const settingsView = (0, toolkit_1.createSlice)({
31
26
  draft.settings = action.payload;
32
27
  draft.fetchState = 'Completed';
33
28
  draft.error = undefined;
34
- // Seed the QBO page's local data from the response. An edit already in
35
- // progress wins: a refetch behind the user must not discard it.
36
- if (draft.qboDraft == null) {
37
- draft.qboDraft = (0, invoicingQboSettingsFormConfig_1.entityToInvoicingQboSettingsLocalData)(action.payload.qbo);
38
- }
39
29
  },
40
30
  updateInvoicingSettingsFailure(draft, action) {
41
31
  draft.fetchState = 'Error';
@@ -50,9 +40,6 @@ const settingsView = (0, toolkit_1.createSlice)({
50
40
  saveInvoicingSettingsSuccess(draft, action) {
51
41
  draft.settings = action.payload;
52
42
  draft.saveFetchState = { fetchState: 'Completed', error: undefined };
53
- // Re-seeded from what was just persisted, so the page keeps working off
54
- // local data while showing the server's version of it.
55
- draft.qboDraft = (0, invoicingQboSettingsFormConfig_1.entityToInvoicingQboSettingsLocalData)(action.payload.qbo);
56
43
  },
57
44
  saveInvoicingSettingsFailure(draft, action) {
58
45
  draft.saveFetchState = { fetchState: 'Error', error: action.payload };
@@ -71,17 +58,6 @@ const settingsView = (0, toolkit_1.createSlice)({
71
58
  resetInvoicingBrandingFormDraft(draft) {
72
59
  draft.brandingDraft = undefined;
73
60
  },
74
- updateInvoicingQboSettingsDraft(draft, action) {
75
- draft.qboDraft = action.payload.localData;
76
- },
77
- // Trigger only — handled by submitInvoicingQboSettingsEpic, which reads the
78
- // local data and converts it to the request body.
79
- submitInvoicingQboSettings(draft) {
80
- draft.saveFetchState = { fetchState: 'In-Progress', error: undefined };
81
- },
82
- resetInvoicingQboSettingsDraft(draft) {
83
- draft.qboDraft = undefined;
84
- },
85
61
  connectInvoicingStripe: {
86
62
  reducer(draft) {
87
63
  draft.stripeFetchState = { fetchState: 'In-Progress', error: undefined };
@@ -113,5 +89,5 @@ const settingsView = (0, toolkit_1.createSlice)({
113
89
  });
114
90
  },
115
91
  });
116
- _a = settingsView.actions, exports.fetchInvoicingSettings = _a.fetchInvoicingSettings, exports.updateInvoicingSettings = _a.updateInvoicingSettings, exports.updateInvoicingSettingsFailure = _a.updateInvoicingSettingsFailure, exports.saveInvoicingSettings = _a.saveInvoicingSettings, exports.saveInvoicingSettingsSuccess = _a.saveInvoicingSettingsSuccess, exports.saveInvoicingSettingsFailure = _a.saveInvoicingSettingsFailure, exports.resetSaveInvoicingSettings = _a.resetSaveInvoicingSettings, exports.updateInvoicingBrandingFormDraft = _a.updateInvoicingBrandingFormDraft, exports.submitInvoicingBrandingForm = _a.submitInvoicingBrandingForm, exports.resetInvoicingBrandingFormDraft = _a.resetInvoicingBrandingFormDraft, exports.updateInvoicingQboSettingsDraft = _a.updateInvoicingQboSettingsDraft, exports.submitInvoicingQboSettings = _a.submitInvoicingQboSettings, exports.resetInvoicingQboSettingsDraft = _a.resetInvoicingQboSettingsDraft, exports.connectInvoicingStripe = _a.connectInvoicingStripe, exports.disconnectInvoicingStripe = _a.disconnectInvoicingStripe, exports.updateInvoicingStripeConnection = _a.updateInvoicingStripeConnection, exports.invoicingStripeConnectionFailure = _a.invoicingStripeConnectionFailure;
92
+ _a = settingsView.actions, exports.fetchInvoicingSettings = _a.fetchInvoicingSettings, exports.updateInvoicingSettings = _a.updateInvoicingSettings, exports.updateInvoicingSettingsFailure = _a.updateInvoicingSettingsFailure, exports.saveInvoicingSettings = _a.saveInvoicingSettings, exports.saveInvoicingSettingsSuccess = _a.saveInvoicingSettingsSuccess, exports.saveInvoicingSettingsFailure = _a.saveInvoicingSettingsFailure, exports.resetSaveInvoicingSettings = _a.resetSaveInvoicingSettings, exports.updateInvoicingBrandingFormDraft = _a.updateInvoicingBrandingFormDraft, exports.submitInvoicingBrandingForm = _a.submitInvoicingBrandingForm, exports.resetInvoicingBrandingFormDraft = _a.resetInvoicingBrandingFormDraft, exports.connectInvoicingStripe = _a.connectInvoicingStripe, exports.disconnectInvoicingStripe = _a.disconnectInvoicingStripe, exports.updateInvoicingStripeConnection = _a.updateInvoicingStripeConnection, exports.invoicingStripeConnectionFailure = _a.invoicingStripeConnectionFailure;
117
93
  exports.default = settingsView.reducer;
@@ -1,12 +1,8 @@
1
- import { NestedAccountHierarchyForReport } from '../../../commonStateTypes/accountView/nestedAccountID';
2
1
  import { FetchState, FetchStateAndError } from '../../../commonStateTypes/common';
3
2
  import { InvoicingDunningActionOption, InvoicingNamedOption, InvoicingQboAccountMappingKindOption, InvoicingSettingsPayload } from '../../../entity/invoicing/invoicingCommonPayload';
4
3
  import { ZeniAPIStatus } from '../../../responsePayload';
5
4
  import { RootState } from '../../../rootStateTypes';
6
- import { InvoicingQboConnection, InvoicingQboSyncHealth } from '../invoicingQboView/invoicingQboViewPayload';
7
- import { InvoicingAccountingOption } from '../invoicingQboView/invoicingQboViewSelector';
8
5
  import { InvoicingBrandingFormLocalData } from './invoicingBrandingFormConfig';
9
- import { InvoicingQboSettingsLocalData } from './invoicingQboSettingsFormConfig';
10
6
  /**
11
7
  * Shared primitive: the raw invoicing settings. Consumed internally by other
12
8
  * CES selectors (create-invoice, customer-detail, overview) and by non-settings
@@ -87,37 +83,6 @@ export interface InvoicingSettingsHubView {
87
83
  * and QBO slices read here are only fetched once a settings screen is mounted.
88
84
  */
89
85
  export declare const getInvoicingSettingsHubView: (state: RootState) => InvoicingSettingsHubView;
90
- export interface InvoicingQboSettingsFormView {
91
- accountMappingKindOptions: InvoicingQboAccountMappingKindOption[];
92
- /** Accounts for the mapping dropdowns, narrowed per kind by the page. */
93
- accounts: InvoicingAccountingOption[];
94
- backfillState: FetchStateAndError;
95
- /** So the screen can fetch only what is missing, without reading the slices. */
96
- configFetchState: FetchState;
97
- customerMatchingOptions: InvoicingNamedOption[];
98
- isLoading: boolean;
99
- /** The persisted sync toggle — the backfill guard checks that, not the draft. */
100
- isSyncEnabledSaved: boolean;
101
- /** The draft the page edits, seeded from the settings response. */
102
- localData: InvoicingQboSettingsLocalData;
103
- nestedAccountHierarchy: NestedAccountHierarchyForReport[];
104
- retryFetchStateByTaskId: Record<string, FetchStateAndError>;
105
- saveState: FetchStateAndError;
106
- settingsFetchState: FetchState;
107
- syncStatusOptions: InvoicingNamedOption[];
108
- connection?: InvoicingQboConnection;
109
- syncHealth?: InvoicingQboSyncHealth;
110
- }
111
- /**
112
- * Bundled view for the QBO configuration page: the draft it edits, the accounts
113
- * and option lists its dropdowns render, the connection and sync health it
114
- * reports, and the fetch states that decide between skeleton, form and error.
115
- *
116
- * `localData` is the draft once the user has edited, and the settings response
117
- * before that — so the page has one field to read and CES owns when it becomes
118
- * available, rather than the page copying settings into local state.
119
- */
120
- export declare const getInvoicingQboSettingsFormView: (state: RootState) => InvoicingQboSettingsFormView;
121
86
  export interface InvoicingBrandingFormView {
122
87
  dateFormatOptions: InvoicingNamedOption[];
123
88
  localData: InvoicingBrandingFormLocalData;
@@ -1,13 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getInvoicingBrandingFormView = exports.getInvoicingQboSettingsFormView = exports.getInvoicingSettingsHubView = exports.getInvoicingSettingsView = exports.getInvoicingSettingsFetchState = exports.getInvoicingSettings = void 0;
3
+ exports.getInvoicingBrandingFormView = exports.getInvoicingSettingsHubView = exports.getInvoicingSettingsView = exports.getInvoicingSettingsFetchState = exports.getInvoicingSettings = void 0;
4
4
  exports.deriveInvoicingEnablePrerequisites = deriveInvoicingEnablePrerequisites;
5
5
  const invoicingCommonPayload_1 = require("../../../entity/invoicing/invoicingCommonPayload");
6
6
  const addressViewSelector_1 = require("../../addressView/addressViewSelector");
7
7
  const invoicingConfigViewSelector_1 = require("../invoicingConfigView/invoicingConfigViewSelector");
8
- const invoicingQboViewSelector_1 = require("../invoicingQboView/invoicingQboViewSelector");
9
8
  const invoicingBrandingFormConfig_1 = require("./invoicingBrandingFormConfig");
10
- const invoicingQboSettingsFormConfig_1 = require("./invoicingQboSettingsFormConfig");
11
9
  /**
12
10
  * Shared primitive: the raw invoicing settings. Consumed internally by other
13
11
  * CES selectors (create-invoice, customer-detail, overview) and by non-settings
@@ -102,46 +100,6 @@ const getInvoicingSettingsHubView = (state) => {
102
100
  };
103
101
  };
104
102
  exports.getInvoicingSettingsHubView = getInvoicingSettingsHubView;
105
- /**
106
- * Bundled view for the QBO configuration page: the draft it edits, the accounts
107
- * and option lists its dropdowns render, the connection and sync health it
108
- * reports, and the fetch states that decide between skeleton, form and error.
109
- *
110
- * `localData` is the draft once the user has edited, and the settings response
111
- * before that — so the page has one field to read and CES owns when it becomes
112
- * available, rather than the page copying settings into local state.
113
- */
114
- const getInvoicingQboSettingsFormView = (state) => {
115
- const { error, fetchState, qboDraft, saveFetchState, settings } = state.invoicingSettingsViewState;
116
- const { fetchState: configFetchState, qboAccountMappingKindOptions, qboCustomerMatchingOptions, qboSyncStatusOptions, } = (0, invoicingConfigViewSelector_1.getInvoicingConfigView)(state);
117
- const qboView = (0, invoicingQboViewSelector_1.getInvoicingQboView)(state);
118
- return {
119
- accountMappingKindOptions: qboAccountMappingKindOptions,
120
- accounts: qboView.accounts,
121
- backfillState: qboView.backfillState,
122
- connection: qboView.connection,
123
- configFetchState,
124
- customerMatchingOptions: qboCustomerMatchingOptions,
125
- // The dropdowns cannot be built before both the settings and the accounts
126
- // land, so the page waits on either rather than rendering empty pickers.
127
- isLoading: fetchState === 'Not-Started' ||
128
- fetchState === 'In-Progress' ||
129
- (0, invoicingQboViewSelector_1.isInvoicingAccountingPickerDataLoading)(state),
130
- isSyncEnabledSaved: settings?.qbo?.enabled === true,
131
- // Seeded in the reducer when the settings response lands, so this is a plain
132
- // read rather than a second place that decides what the page starts from.
133
- localData: qboDraft ?? invoicingQboSettingsFormConfig_1.initialInvoicingQboSettingsLocalData,
134
- nestedAccountHierarchy: qboView.nestedAccountHierarchy,
135
- retryFetchStateByTaskId: qboView.retryFetchStateByTaskId,
136
- saveState: saveFetchState.fetchState === 'Not-Started' && error != null
137
- ? { fetchState, error }
138
- : saveFetchState,
139
- settingsFetchState: fetchState,
140
- syncHealth: qboView.syncHealth,
141
- syncStatusOptions: qboSyncStatusOptions,
142
- };
143
- };
144
- exports.getInvoicingQboSettingsFormView = getInvoicingQboSettingsFormView;
145
103
  /**
146
104
  * Bundled view for the branding settings form: the draft `localData` (seeded
147
105
  * from the existing settings until the user edits), the business-address label
@@ -1,17 +1,9 @@
1
1
  import { FetchStateAndError, FetchedState } from '../../../commonStateTypes/common';
2
2
  import { InvoicingSettingsPayload } from '../../../entity/invoicing/invoicingCommonPayload';
3
3
  import { InvoicingBrandingFormLocalData } from './invoicingBrandingFormConfig';
4
- import { InvoicingQboSettingsLocalData } from './invoicingQboSettingsFormConfig';
5
4
  export interface InvoicingSettingsViewState extends FetchedState {
6
5
  saveFetchState: FetchStateAndError;
7
6
  stripeFetchState: FetchStateAndError;
8
7
  brandingDraft?: InvoicingBrandingFormLocalData;
9
- /**
10
- * In-progress QBO settings edits. Held here rather than in the page so a
11
- * selection cannot be lost between the change and the save, and so a
12
- * half-finished edit survives navigating away. Undefined until first edited,
13
- * which is what makes the server's settings the fallback.
14
- */
15
- qboDraft?: InvoicingQboSettingsLocalData;
16
8
  settings?: InvoicingSettingsPayload;
17
9
  }