@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
@@ -12,38 +12,4 @@ interface FetchRecommendationPayloadWithCOT {
12
12
  recommendations: RecommendationPayloadWithCOT[];
13
13
  }
14
14
  export type FetchRecommendationResponseWithCOT = ZeniAPIResponse<FetchRecommendationPayloadWithCOT>;
15
- export type RecommendationFeedbackDimension = 'vendor' | 'category' | 'class';
16
- export type RecommendationFeedbackSource = 'primary' | 'alternate' | 'shadow' | 'qbo';
17
- export type RecommendationFeedbackOutcome = 'accepted' | 'override_ranked' | 'override_outside' | 'retracted';
18
- export interface RecommendationFeedbackValue {
19
- name: string;
20
- id?: string | null;
21
- integrationId?: string | null;
22
- }
23
- export interface ShownRecommendationForFeedback {
24
- rank: number;
25
- source: RecommendationFeedbackSource;
26
- value: RecommendationFeedbackValue;
27
- confidence?: number | null;
28
- cot?: string[];
29
- reasoning?: string | null;
30
- }
31
- export interface SubmitRecommendationFeedbackPayload {
32
- dimension: RecommendationFeedbackDimension;
33
- outcome: RecommendationFeedbackOutcome;
34
- selected: RecommendationFeedbackValue & {
35
- isNewEntity?: boolean;
36
- };
37
- transactionId: string;
38
- features?: Record<string, unknown> | null;
39
- lineId?: string | null;
40
- matchedRank?: number | null;
41
- matchedSource?: RecommendationFeedbackSource | null;
42
- reasonText?: string | null;
43
- recommendationSetId?: string | null;
44
- retractsFeedbackId?: string | null;
45
- shownRecommendations?: ShownRecommendationForFeedback[];
46
- skipped?: boolean;
47
- topPickSource?: RecommendationFeedbackSource | null;
48
- }
49
15
  export {};
@@ -5,7 +5,6 @@ import { TransactionID } from '../../entity/transaction/stateTypes/transactionID
5
5
  import { SupportedTransaction } from '../../entity/transaction/transactionState';
6
6
  import { ZeniAPIStatus } from '../../responsePayload';
7
7
  import { TransactionsTab } from '../expenseAutomationView/types/transactionsViewState';
8
- import { SubmitRecommendationFeedbackPayload } from './recommendationPayload';
9
8
  import { EntityRecommendationState } from './recommendationState';
10
9
  export type RecommendationLineUpdateFlowType = 'categorization' | 'detail';
11
10
  type FetchEntityRecommendationsForLineUpdateCommonPayload = {
@@ -58,6 +57,6 @@ export declare const fetchEntityRecommendationsByTransactionId: import("@reduxjs
58
57
  }, "recommendation/updateRecommendationForEntityFailure">, indicateReadyToInitializeRecommendation: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[entityIdOrName: string, entityType: EntityType], {
59
58
  entityIdOrName: string;
60
59
  entityType: EntityType;
61
- }, "recommendation/indicateReadyToInitializeRecommendation", never, never>, clearRecommendation: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"recommendation/clearRecommendation">, submitRecommendationFeedback: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[args: SubmitRecommendationFeedbackPayload], SubmitRecommendationFeedbackPayload, "recommendation/submitRecommendationFeedback", never, never>;
60
+ }, "recommendation/indicateReadyToInitializeRecommendation", never, never>;
62
61
  declare const _default: import("redux").Reducer<EntityRecommendationState>;
63
62
  export default _default;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  var _a;
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.submitRecommendationFeedback = exports.clearRecommendation = exports.indicateReadyToInitializeRecommendation = exports.updateRecommendationForEntityFailure = exports.updateRecommendationForEntity = exports.fetchRecommendationByEntityId = exports.fetchRecommendationByEntityName = exports.fetchEntityRecommendationsForLineUpdate = exports.fetchEntityRecommendationsByTransactionId = exports.initialState = void 0;
4
+ exports.indicateReadyToInitializeRecommendation = exports.updateRecommendationForEntityFailure = exports.updateRecommendationForEntity = exports.fetchRecommendationByEntityId = exports.fetchRecommendationByEntityName = exports.fetchEntityRecommendationsForLineUpdate = exports.fetchEntityRecommendationsByTransactionId = exports.initialState = void 0;
5
5
  const toolkit_1 = require("@reduxjs/toolkit");
6
6
  const rootActions_1 = require("../../rootActions");
7
7
  const recommendationState_1 = require("./recommendationState");
@@ -135,21 +135,6 @@ const recommendation = (0, toolkit_1.createSlice)({
135
135
  };
136
136
  },
137
137
  },
138
- clearRecommendation(draft) {
139
- Object.assign(draft, exports.initialState);
140
- },
141
- // Fire-and-forget human feedback on a recommendation (accept, ranked
142
- // override or outside override). Handled by submitRecommendationFeedbackEpic
143
- // which POSTs to the accounting recommendation-feedback endpoint. No state
144
- // mutation: the categorization UX must not depend on the feedback round-trip.
145
- submitRecommendationFeedback: {
146
- reducer() {
147
- // Fire-and-forget: no state mutation; the epic performs the POST.
148
- },
149
- prepare(args) {
150
- return { payload: args };
151
- },
152
- },
153
138
  },
154
139
  extraReducers: (builder) => {
155
140
  builder.addCase(rootActions_1.clearAll, (draft) => {
@@ -157,7 +142,7 @@ const recommendation = (0, toolkit_1.createSlice)({
157
142
  });
158
143
  },
159
144
  });
160
- _a = recommendation.actions, exports.fetchEntityRecommendationsByTransactionId = _a.fetchEntityRecommendationsByTransactionId, exports.fetchEntityRecommendationsForLineUpdate = _a.fetchEntityRecommendationsForLineUpdate, exports.fetchRecommendationByEntityName = _a.fetchRecommendationByEntityName, exports.fetchRecommendationByEntityId = _a.fetchRecommendationByEntityId, exports.updateRecommendationForEntity = _a.updateRecommendationForEntity, exports.updateRecommendationForEntityFailure = _a.updateRecommendationForEntityFailure, exports.indicateReadyToInitializeRecommendation = _a.indicateReadyToInitializeRecommendation, exports.clearRecommendation = _a.clearRecommendation, exports.submitRecommendationFeedback = _a.submitRecommendationFeedback;
145
+ _a = recommendation.actions, exports.fetchEntityRecommendationsByTransactionId = _a.fetchEntityRecommendationsByTransactionId, exports.fetchEntityRecommendationsForLineUpdate = _a.fetchEntityRecommendationsForLineUpdate, exports.fetchRecommendationByEntityName = _a.fetchRecommendationByEntityName, exports.fetchRecommendationByEntityId = _a.fetchRecommendationByEntityId, exports.updateRecommendationForEntity = _a.updateRecommendationForEntity, exports.updateRecommendationForEntityFailure = _a.updateRecommendationForEntityFailure, exports.indicateReadyToInitializeRecommendation = _a.indicateReadyToInitializeRecommendation;
161
146
  exports.default = recommendation.reducer;
162
147
  const doUpdateRecommendationForEntity = (draft, entityId, entityType, payload) => {
163
148
  const key = (0, recommendationState_1.getEntityRecommendationKey)(entityType, entityId);
@@ -33,7 +33,7 @@ const fetchAccruedScheduleListEpic = (actions$, state$, zeniAPI) => actions$.pip
33
33
  je_schedule_type: scheduleType,
34
34
  sort_by: 'transaction_date',
35
35
  sort_order: 'desc',
36
- filter: 'all',
36
+ filter: action.payload.statusFilter,
37
37
  };
38
38
  return zeniAPI
39
39
  .getJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/schedules?query=${encodeURIComponent(JSON.stringify(queryParam))}`)
@@ -10,9 +10,14 @@ const responsePayload_1 = require("../../../../responsePayload");
10
10
  const scheduleListReducer_1 = require("../scheduleListReducer");
11
11
  const scheduleListTypes_1 = require("../scheduleListTypes");
12
12
  const fetchDownloadSchedulesEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(scheduleListReducer_1.fetchDownloadSchedules.match), (0, operators_1.mergeMap)((action) => {
13
- const { scheduleType, downloadCategories } = action.payload;
13
+ const { scheduleType, downloadCategories, statusFilter } = action.payload;
14
14
  const scheduleListState = state$.value.scheduleListState;
15
15
  // if parameters are provided, use those. else go to localdata
16
+ // Accrued is deliberately not served here. Its rows come back in a different shape, this
17
+ // epic writes them through updateJESchedules (the prepaid / fixed mapper), and
18
+ // doUpdateScheduleList never flips downloadState for accrued -- so a request would store the
19
+ // wrong data and then never report completion. Accrued downloads go through
20
+ // fetchAccruedScheduleList, which owns that shape end to end.
16
21
  let scheduleState;
17
22
  if (scheduleType !== 'accrued_expenses') {
18
23
  scheduleState = (0, scheduleListReducer_1.getState)(scheduleListState, scheduleType);
@@ -37,7 +42,7 @@ const fetchDownloadSchedulesEpic = (actions$, state$, zeniAPI) => actions$.pipe(
37
42
  base_txn_account_ids: downloadCategories,
38
43
  sort_by: 'transaction_date',
39
44
  sort_order: 'desc',
40
- filter: 'all',
45
+ filter: statusFilter,
41
46
  };
42
47
  return zeniAPI
43
48
  .getJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/schedules/download?query=${encodeURIComponent(JSON.stringify(queryParam))}`)
@@ -16,7 +16,7 @@ export declare const initialState: ScheduleListViewState;
16
16
  export declare const fetchDownloadSchedules: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[scheduleType: "prepaid_expenses" | "fixed_assets" | "accrued_expenses" | "deferred_revenue", timeframeAndCategory: {
17
17
  selectedCategoryId: ID;
18
18
  selectedTimeframe: TimeframeTick;
19
- }, downloadCategories: string[], cacheOverride?: any], {
19
+ }, downloadCategories: string[], statusFilter?: "completed" | "new" | "ongoing" | "all" | undefined, cacheOverride?: any], {
20
20
  timeframeAndCategory: {
21
21
  selectedCategoryId: ID;
22
22
  selectedTimeframe: TimeframeTick;
@@ -24,16 +24,18 @@ export declare const fetchDownloadSchedules: import("@reduxjs/toolkit").ActionCr
24
24
  scheduleType: "prepaid_expenses" | "fixed_assets" | "accrued_expenses" | "deferred_revenue";
25
25
  cacheOverride: any;
26
26
  downloadCategories: string[];
27
+ statusFilter: "completed" | "new" | "ongoing" | "all";
27
28
  }, "scheduleListView/fetchDownloadSchedules", never, never>, fetchAccruedScheduleList: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[scheduleType: "prepaid_expenses" | "fixed_assets" | "accrued_expenses" | "deferred_revenue", timeframeAndCategory?: {
28
29
  selectedCategoryId: ID;
29
30
  selectedTimeframe: TimeframeTick;
30
- } | undefined, cacheOverride?: any], {
31
+ } | undefined, cacheOverride?: any, statusFilter?: "completed" | "new" | "ongoing" | "all" | undefined], {
31
32
  timeframeAndCategory: {
32
33
  selectedCategoryId: ID;
33
34
  selectedTimeframe: TimeframeTick;
34
35
  } | undefined;
35
36
  scheduleType: "prepaid_expenses" | "fixed_assets" | "accrued_expenses" | "deferred_revenue";
36
37
  cacheOverride: any;
38
+ statusFilter: "completed" | "new" | "ongoing" | "all";
37
39
  }, "scheduleListView/fetchAccruedScheduleList", never, never>, fetchScheduleList: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[scheduleType: "prepaid_expenses" | "fixed_assets" | "accrued_expenses" | "deferred_revenue", timeframeAndCategory?: {
38
40
  selectedCategoryId: ID;
39
41
  selectedTimeframe: TimeframeTick;
@@ -90,8 +90,8 @@ const scheduleListView = (0, toolkit_1.createSlice)({
90
90
  reducers: {
91
91
  fetchDownloadSchedules: {
92
92
  reducer(draft, action) {
93
+ // Accrued is not downloaded through this action -- see fetchDownloadSchedulesEpic for why.
93
94
  if (action.payload.scheduleType !== 'accrued_expenses') {
94
- //if condition added for type narrowing
95
95
  const state = getState(draft, action.payload.scheduleType);
96
96
  const selectedTimeframe = action.payload.timeframeAndCategory.selectedTimeframe;
97
97
  const selectedCategoryId = action.payload.timeframeAndCategory.selectedCategoryId;
@@ -115,13 +115,14 @@ const scheduleListView = (0, toolkit_1.createSlice)({
115
115
  updateState(draft, action.payload.scheduleType, state);
116
116
  }
117
117
  },
118
- prepare(scheduleType, timeframeAndCategory, downloadCategories, cacheOverride = false) {
118
+ prepare(scheduleType, timeframeAndCategory, downloadCategories, statusFilter = 'all', cacheOverride = false) {
119
119
  return {
120
120
  payload: {
121
121
  timeframeAndCategory,
122
122
  scheduleType,
123
123
  cacheOverride,
124
124
  downloadCategories,
125
+ statusFilter,
125
126
  },
126
127
  };
127
128
  },
@@ -157,12 +158,13 @@ const scheduleListView = (0, toolkit_1.createSlice)({
157
158
  updateState(draft, action.payload.scheduleType, state);
158
159
  }
159
160
  },
160
- prepare(scheduleType, timeframeAndCategory, cacheOverride = false) {
161
+ prepare(scheduleType, timeframeAndCategory, cacheOverride = false, statusFilter = 'all') {
161
162
  return {
162
163
  payload: {
163
164
  timeframeAndCategory,
164
165
  scheduleType,
165
166
  cacheOverride,
167
+ statusFilter,
166
168
  },
167
169
  };
168
170
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "5.2.11-beta0ND",
3
+ "version": "5.2.11-betaAM2",
4
4
  "description": "Shared module between Web & Mobile containing required abstractions for state management, async network communication. ",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib/esm/index.js",
@@ -1,27 +0,0 @@
1
- import { of } from 'rxjs';
2
- import { catchError, filter, mergeMap, switchMap } from 'rxjs/operators';
3
- import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
4
- import { connectInvoicingStripe, fetchInvoicingSettings, invoicingStripeConnectionFailure, updateInvoicingStripeConnection, } from '../settingsViewReducer';
5
- export const connectInvoicingStripeEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(connectInvoicingStripe.match), mergeMap((action) => {
6
- const apiUrl = `${zeniAPI.apiEndPoints.invoicingMicroServiceBaseUrl}/1.0/settings/stripe-connect/setup`;
7
- const { api_key, publishable_key, webhook_secret } = action.payload;
8
- const body = {
9
- api_key,
10
- publishable_key,
11
- ...(webhook_secret != null && webhook_secret !== ''
12
- ? { webhook_secret }
13
- : {}),
14
- };
15
- return zeniAPI
16
- .postAndGetJSON(apiUrl, body)
17
- .pipe(switchMap((response) => {
18
- if (isSuccessResponse(response) && response.data != null) {
19
- return of(updateInvoicingStripeConnection({
20
- stripe_connected: response.data.stripe_connected,
21
- publishable_key: response.data.publishable_key,
22
- }), fetchInvoicingSettings());
23
- }
24
- return of(invoicingStripeConnectionFailure(response.status));
25
- }), catchError((error) => of(invoicingStripeConnectionFailure(createZeniAPIStatus('Unexpected Error', 'Stripe connect setup REST API call errored out ' +
26
- JSON.stringify(error))))));
27
- }));
@@ -1,19 +0,0 @@
1
- import { of } from 'rxjs';
2
- import { catchError, filter, mergeMap, switchMap } from 'rxjs/operators';
3
- import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
4
- import { disconnectInvoicingStripe, fetchInvoicingSettings, invoicingStripeConnectionFailure, updateInvoicingStripeConnection, } from '../settingsViewReducer';
5
- export const disconnectInvoicingStripeEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(disconnectInvoicingStripe.match), mergeMap(() => {
6
- const apiUrl = `${zeniAPI.apiEndPoints.invoicingMicroServiceBaseUrl}/1.0/settings/stripe-connect/callback`;
7
- return zeniAPI
8
- .deleteAndGetJSON(apiUrl)
9
- .pipe(switchMap((response) => {
10
- if (isSuccessResponse(response)) {
11
- return of(updateInvoicingStripeConnection({
12
- stripe_connected: false,
13
- publishable_key: '',
14
- }), fetchInvoicingSettings());
15
- }
16
- return of(invoicingStripeConnectionFailure(response.status));
17
- }), catchError((error) => of(invoicingStripeConnectionFailure(createZeniAPIStatus('Unexpected Error', 'Stripe disconnect REST API call errored out ' +
18
- JSON.stringify(error))))));
19
- }));
@@ -1,19 +0,0 @@
1
- import { of } from 'rxjs';
2
- import { catchError, filter, switchMap } from 'rxjs/operators';
3
- import { updateAddresses } from '../../../../entity/address/addressReducer';
4
- import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
5
- import { fetchInvoicingSettings, updateInvoicingSettings, updateInvoicingSettingsFailure, } from '../settingsViewReducer';
6
- export const fetchInvoicingSettingsEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(fetchInvoicingSettings.match), switchMap(() => {
7
- const apiUrl = `${zeniAPI.apiEndPoints.invoicingMicroServiceBaseUrl}/1.0/settings`;
8
- return zeniAPI.getJSON(apiUrl).pipe(switchMap((response) => {
9
- if (isSuccessResponse(response) && response.data != null) {
10
- const address = response.data.address;
11
- return [
12
- ...(address != null ? [updateAddresses([address])] : []),
13
- updateInvoicingSettings(response.data),
14
- ];
15
- }
16
- return of(updateInvoicingSettingsFailure(response.status));
17
- }), catchError((error) => of(updateInvoicingSettingsFailure(createZeniAPIStatus('Unexpected Error', 'Fetch settings REST API call errored out ' +
18
- JSON.stringify(error))))));
19
- }));
@@ -1,39 +0,0 @@
1
- import { from } from 'rxjs';
2
- import { catchError, filter, mergeMap, switchMap } from 'rxjs/operators';
3
- import { apiErrorSnackbarVariables } from '../../../../entity/snackbar/snackbarApiError';
4
- import { openSnackbar } from '../../../../entity/snackbar/snackbarReducer';
5
- import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
6
- import { saveInvoicingSettings, saveInvoicingSettingsFailure, saveInvoicingSettingsSuccess, } from '../settingsViewReducer';
7
- export const saveInvoicingSettingsEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(saveInvoicingSettings.match), mergeMap((action) => {
8
- const apiUrl = `${zeniAPI.apiEndPoints.invoicingMicroServiceBaseUrl}/1.0/settings`;
9
- const { settings, snackbarSection } = action.payload;
10
- /** `status` surfaces the platform's error text; omit it to keep the generic copy. */
11
- const snackbar = (messageText, status) => snackbarSection == null
12
- ? []
13
- : [
14
- openSnackbar({
15
- messageSection: snackbarSection,
16
- messageText,
17
- type: messageText === 'success' ? 'success' : 'error',
18
- variables: apiErrorSnackbarVariables(status),
19
- }),
20
- ];
21
- return zeniAPI
22
- .putAndGetJSON(apiUrl, { ...settings })
23
- .pipe(switchMap((response) => {
24
- if (isSuccessResponse(response) && response.data != null) {
25
- return from([
26
- saveInvoicingSettingsSuccess(response.data),
27
- ...snackbar('success'),
28
- ]);
29
- }
30
- return from([
31
- saveInvoicingSettingsFailure(response.status),
32
- ...snackbar('failed', response.status),
33
- ]);
34
- }), catchError((error) => from([
35
- saveInvoicingSettingsFailure(createZeniAPIStatus('Unexpected Error', 'Save settings REST API call errored out ' +
36
- JSON.stringify(error))),
37
- ...snackbar('failed'),
38
- ])));
39
- }));
@@ -1,25 +0,0 @@
1
- import { EMPTY, of } from 'rxjs';
2
- import { filter, mergeMap, withLatestFrom } from 'rxjs/operators';
3
- import { invoicingQboAccountByQboId } from '../../invoicingQboView/invoicingQboViewSelector';
4
- import { invoicingQboSettingsLocalDataToPayload } from '../invoicingQboSettingsFormConfig';
5
- import { saveInvoicingSettings, submitInvoicingQboSettings, } from '../settingsViewReducer';
6
- /**
7
- * Saves the QBO local data. The screen fires this without a payload — the local
8
- * data is already in the store, so sending it back through the action would make
9
- * the page the carrier for state it does not own. Converting to the request body
10
- * happens here too, keeping the wire shape out of the screen.
11
- */
12
- export const submitInvoicingQboSettingsEpic = (actions$, state$) => actions$.pipe(filter(submitInvoicingQboSettings.match), withLatestFrom(state$), mergeMap(([, state]) => {
13
- const { qboDraft } = state.invoicingSettingsViewState;
14
- // No local data means the settings response has not landed, so there is
15
- // nothing the user could have edited yet.
16
- if (qboDraft == null) {
17
- return EMPTY;
18
- }
19
- return of(saveInvoicingSettings({
20
- settings: {
21
- qbo: invoicingQboSettingsLocalDataToPayload(qboDraft, (accountId) => invoicingQboAccountByQboId(state, accountId)),
22
- },
23
- snackbarSection: 'invoicing_qbo_settings_save',
24
- }));
25
- }));
@@ -1,48 +0,0 @@
1
- import { getInvoicingQboAccountMappingId, toInvoicingQboAccountMappingSlot, toInvoicingQboAccountMappingsPayload, } from '../../../entity/invoicing/invoicingCommonPayload';
2
- export const initialInvoicingQboSettingsLocalData = {
3
- accountIdByMappingCode: {},
4
- autoCreateItems: false,
5
- closedPeriodVoidAsCreditMemo: false,
6
- customerMatching: '',
7
- isSyncEnabled: false,
8
- syncStartDate: '',
9
- trackingCategoriesEnabled: false,
10
- };
11
- /** The settings response as the page edits it. */
12
- export const entityToInvoicingQboSettingsLocalData = (qbo) => {
13
- const accountMappings = qbo?.account_mappings ?? {};
14
- const accountIdByMappingCode = {};
15
- // Keyed by the slot the payload used, which is the config code the page will
16
- // ask for — the reader tolerates the older `_id` form on the way in.
17
- Object.keys(accountMappings).forEach((key) => {
18
- const accountId = getInvoicingQboAccountMappingId(accountMappings, key);
19
- if (accountId != null) {
20
- accountIdByMappingCode[toInvoicingQboAccountMappingSlot(key)] = accountId;
21
- }
22
- });
23
- return {
24
- accountIdByMappingCode,
25
- autoCreateItems: qbo?.auto_create_items === true,
26
- closedPeriodVoidAsCreditMemo: qbo?.closed_period_void_as_credit_memo === true,
27
- customerMatching: qbo?.customer_matching ?? '',
28
- isSyncEnabled: qbo?.enabled === true,
29
- syncStartDate: qbo?.sync_start_date ?? '',
30
- trackingCategoriesEnabled: qbo?.tracking_categories_enabled === true,
31
- };
32
- };
33
- /**
34
- * The local data as the request body. `accountForId` turns each picked id into
35
- * the whole account the service stores; it comes from the epic, which is where
36
- * the account list is in reach.
37
- */
38
- export const invoicingQboSettingsLocalDataToPayload = (localData, accountForId) => {
39
- return {
40
- account_mappings: toInvoicingQboAccountMappingsPayload(localData.accountIdByMappingCode, accountForId),
41
- auto_create_items: localData.autoCreateItems,
42
- closed_period_void_as_credit_memo: localData.closedPeriodVoidAsCreditMemo,
43
- customer_matching: localData.customerMatching,
44
- enabled: localData.isSyncEnabled,
45
- sync_start_date: localData.syncStartDate !== '' ? localData.syncStartDate : null,
46
- tracking_categories_enabled: localData.trackingCategoriesEnabled,
47
- };
48
- };
@@ -1,52 +0,0 @@
1
- import { EMPTY } from 'rxjs';
2
- import { catchError, filter, mergeMap } from 'rxjs/operators';
3
- import { isSuccessStatus } from '../../responsePayload';
4
- import { submitRecommendationFeedback } from './recommendationReducer';
5
- const toRequestBody = (payload) => ({
6
- line_id: payload.lineId ?? null,
7
- dimension: payload.dimension,
8
- recommendation_set_id: payload.recommendationSetId ?? null,
9
- top_pick_source: payload.topPickSource ?? null,
10
- shown_recommendations: (payload.shownRecommendations ?? []).map((recommendation) => ({
11
- source: recommendation.source,
12
- rank: recommendation.rank,
13
- value: {
14
- name: recommendation.value.name,
15
- id: recommendation.value.id ?? null,
16
- integration_id: recommendation.value.integrationId ?? null,
17
- },
18
- confidence: recommendation.confidence ?? null,
19
- reasoning: recommendation.reasoning ?? null,
20
- cot: recommendation.cot ?? [],
21
- })),
22
- selected: {
23
- name: payload.selected.name,
24
- id: payload.selected.id ?? null,
25
- integration_id: payload.selected.integrationId ?? null,
26
- is_new_entity: payload.selected.isNewEntity ?? false,
27
- },
28
- matched_source: payload.matchedSource ?? null,
29
- matched_rank: payload.matchedRank ?? null,
30
- outcome: payload.outcome,
31
- reason_text: payload.reasonText ?? null,
32
- skipped: payload.skipped ?? false,
33
- retracts_feedback_id: payload.retractsFeedbackId ?? null,
34
- features: payload.features ?? null,
35
- });
36
- // Fire-and-forget: the epic never re-emits an action. Feedback delivery is a
37
- // side-effect that must not disrupt the categorization UX, so both the
38
- // success and error paths complete silently (errors are logged for debugging).
39
- export const submitRecommendationFeedbackEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(submitRecommendationFeedback.match), mergeMap((action) => {
40
- const { transactionId } = action.payload;
41
- return zeniAPI
42
- .postAndGetJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/transactions/${transactionId}/recommendation-feedback`, toRequestBody(action.payload))
43
- .pipe(mergeMap((response) => {
44
- if (!isSuccessStatus(response)) {
45
- console.error('submitRecommendationFeedbackEpic: recommendation feedback was not recorded', response.status);
46
- }
47
- return EMPTY;
48
- }), catchError((error) => {
49
- console.error('submitRecommendationFeedbackEpic: failed to submit recommendation feedback', error);
50
- return EMPTY;
51
- }));
52
- }));
@@ -1,6 +0,0 @@
1
- import { ActionsObservable, StateObservable } from 'redux-observable';
2
- import { Observable } from 'rxjs';
3
- import { RootState } from '../../../../rootStateTypes';
4
- import { ZeniAPI } from '../../../../zeniAPI';
5
- import { InvoicingSettingsViewActionType } from './settingsViewActionType';
6
- export declare const connectInvoicingStripeEpic: (actions$: ActionsObservable<InvoicingSettingsViewActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<InvoicingSettingsViewActionType>;
@@ -1,31 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.connectInvoicingStripeEpic = void 0;
4
- const rxjs_1 = require("rxjs");
5
- const operators_1 = require("rxjs/operators");
6
- const responsePayload_1 = require("../../../../responsePayload");
7
- const settingsViewReducer_1 = require("../settingsViewReducer");
8
- const connectInvoicingStripeEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(settingsViewReducer_1.connectInvoicingStripe.match), (0, operators_1.mergeMap)((action) => {
9
- const apiUrl = `${zeniAPI.apiEndPoints.invoicingMicroServiceBaseUrl}/1.0/settings/stripe-connect/setup`;
10
- const { api_key, publishable_key, webhook_secret } = action.payload;
11
- const body = {
12
- api_key,
13
- publishable_key,
14
- ...(webhook_secret != null && webhook_secret !== ''
15
- ? { webhook_secret }
16
- : {}),
17
- };
18
- return zeniAPI
19
- .postAndGetJSON(apiUrl, body)
20
- .pipe((0, operators_1.switchMap)((response) => {
21
- if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
22
- return (0, rxjs_1.of)((0, settingsViewReducer_1.updateInvoicingStripeConnection)({
23
- stripe_connected: response.data.stripe_connected,
24
- publishable_key: response.data.publishable_key,
25
- }), (0, settingsViewReducer_1.fetchInvoicingSettings)());
26
- }
27
- return (0, rxjs_1.of)((0, settingsViewReducer_1.invoicingStripeConnectionFailure)(response.status));
28
- }), (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 ' +
29
- JSON.stringify(error))))));
30
- }));
31
- exports.connectInvoicingStripeEpic = connectInvoicingStripeEpic;
@@ -1,6 +0,0 @@
1
- import { ActionsObservable, StateObservable } from 'redux-observable';
2
- import { Observable } from 'rxjs';
3
- import { RootState } from '../../../../rootStateTypes';
4
- import { ZeniAPI } from '../../../../zeniAPI';
5
- import { InvoicingSettingsViewActionType } from './settingsViewActionType';
6
- export declare const disconnectInvoicingStripeEpic: (actions$: ActionsObservable<InvoicingSettingsViewActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<InvoicingSettingsViewActionType>;
@@ -1,23 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.disconnectInvoicingStripeEpic = void 0;
4
- const rxjs_1 = require("rxjs");
5
- const operators_1 = require("rxjs/operators");
6
- const responsePayload_1 = require("../../../../responsePayload");
7
- const settingsViewReducer_1 = require("../settingsViewReducer");
8
- const disconnectInvoicingStripeEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(settingsViewReducer_1.disconnectInvoicingStripe.match), (0, operators_1.mergeMap)(() => {
9
- const apiUrl = `${zeniAPI.apiEndPoints.invoicingMicroServiceBaseUrl}/1.0/settings/stripe-connect/callback`;
10
- return zeniAPI
11
- .deleteAndGetJSON(apiUrl)
12
- .pipe((0, operators_1.switchMap)((response) => {
13
- if ((0, responsePayload_1.isSuccessResponse)(response)) {
14
- return (0, rxjs_1.of)((0, settingsViewReducer_1.updateInvoicingStripeConnection)({
15
- stripe_connected: false,
16
- publishable_key: '',
17
- }), (0, settingsViewReducer_1.fetchInvoicingSettings)());
18
- }
19
- return (0, rxjs_1.of)((0, settingsViewReducer_1.invoicingStripeConnectionFailure)(response.status));
20
- }), (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 ' +
21
- JSON.stringify(error))))));
22
- }));
23
- exports.disconnectInvoicingStripeEpic = disconnectInvoicingStripeEpic;
@@ -1,6 +0,0 @@
1
- import { ActionsObservable, StateObservable } from 'redux-observable';
2
- import { Observable } from 'rxjs';
3
- import { RootState } from '../../../../rootStateTypes';
4
- import { ZeniAPI } from '../../../../zeniAPI';
5
- import { InvoicingSettingsViewActionType } from './settingsViewActionType';
6
- export declare const fetchInvoicingSettingsEpic: (actions$: ActionsObservable<InvoicingSettingsViewActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<InvoicingSettingsViewActionType>;
@@ -1,23 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- 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 responsePayload_1 = require("../../../../responsePayload");
8
- const settingsViewReducer_1 = require("../settingsViewReducer");
9
- const fetchInvoicingSettingsEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(settingsViewReducer_1.fetchInvoicingSettings.match), (0, operators_1.switchMap)(() => {
10
- const apiUrl = `${zeniAPI.apiEndPoints.invoicingMicroServiceBaseUrl}/1.0/settings`;
11
- return zeniAPI.getJSON(apiUrl).pipe((0, operators_1.switchMap)((response) => {
12
- if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
13
- const address = response.data.address;
14
- return [
15
- ...(address != null ? [(0, addressReducer_1.updateAddresses)([address])] : []),
16
- (0, settingsViewReducer_1.updateInvoicingSettings)(response.data),
17
- ];
18
- }
19
- return (0, rxjs_1.of)((0, settingsViewReducer_1.updateInvoicingSettingsFailure)(response.status));
20
- }), (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 ' +
21
- JSON.stringify(error))))));
22
- }));
23
- exports.fetchInvoicingSettingsEpic = fetchInvoicingSettingsEpic;
@@ -1,6 +0,0 @@
1
- import { ActionsObservable, StateObservable } from 'redux-observable';
2
- import { Observable } from 'rxjs';
3
- import { RootState } from '../../../../rootStateTypes';
4
- import { ZeniAPI } from '../../../../zeniAPI';
5
- import { InvoicingSettingsViewActionType } from './settingsViewActionType';
6
- export declare const saveInvoicingSettingsEpic: (actions$: ActionsObservable<InvoicingSettingsViewActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<InvoicingSettingsViewActionType>;
@@ -1,43 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.saveInvoicingSettingsEpic = void 0;
4
- const rxjs_1 = require("rxjs");
5
- const operators_1 = require("rxjs/operators");
6
- const snackbarApiError_1 = require("../../../../entity/snackbar/snackbarApiError");
7
- const snackbarReducer_1 = require("../../../../entity/snackbar/snackbarReducer");
8
- const responsePayload_1 = require("../../../../responsePayload");
9
- const settingsViewReducer_1 = require("../settingsViewReducer");
10
- const saveInvoicingSettingsEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(settingsViewReducer_1.saveInvoicingSettings.match), (0, operators_1.mergeMap)((action) => {
11
- const apiUrl = `${zeniAPI.apiEndPoints.invoicingMicroServiceBaseUrl}/1.0/settings`;
12
- const { settings, snackbarSection } = action.payload;
13
- /** `status` surfaces the platform's error text; omit it to keep the generic copy. */
14
- const snackbar = (messageText, status) => snackbarSection == null
15
- ? []
16
- : [
17
- (0, snackbarReducer_1.openSnackbar)({
18
- messageSection: snackbarSection,
19
- messageText,
20
- type: messageText === 'success' ? 'success' : 'error',
21
- variables: (0, snackbarApiError_1.apiErrorSnackbarVariables)(status),
22
- }),
23
- ];
24
- return zeniAPI
25
- .putAndGetJSON(apiUrl, { ...settings })
26
- .pipe((0, operators_1.switchMap)((response) => {
27
- if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
28
- return (0, rxjs_1.from)([
29
- (0, settingsViewReducer_1.saveInvoicingSettingsSuccess)(response.data),
30
- ...snackbar('success'),
31
- ]);
32
- }
33
- return (0, rxjs_1.from)([
34
- (0, settingsViewReducer_1.saveInvoicingSettingsFailure)(response.status),
35
- ...snackbar('failed', response.status),
36
- ]);
37
- }), (0, operators_1.catchError)((error) => (0, rxjs_1.from)([
38
- (0, settingsViewReducer_1.saveInvoicingSettingsFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Save settings REST API call errored out ' +
39
- JSON.stringify(error))),
40
- ...snackbar('failed'),
41
- ])));
42
- }));
43
- exports.saveInvoicingSettingsEpic = saveInvoicingSettingsEpic;
@@ -1,5 +0,0 @@
1
- import { updateAddresses } from '../../../../entity/address/addressReducer';
2
- import { openSnackbar } from '../../../../entity/snackbar/snackbarReducer';
3
- import { connectInvoicingStripe, disconnectInvoicingStripe, fetchInvoicingSettings, invoicingStripeConnectionFailure, saveInvoicingSettings, saveInvoicingSettingsFailure, saveInvoicingSettingsSuccess, submitInvoicingQboSettings, updateInvoicingSettings, updateInvoicingSettingsFailure, updateInvoicingStripeConnection } from '../settingsViewReducer';
4
- /** Every action the settings epics accept or emit. */
5
- export type InvoicingSettingsViewActionType = ReturnType<typeof fetchInvoicingSettings> | ReturnType<typeof updateInvoicingSettings> | ReturnType<typeof updateInvoicingSettingsFailure> | ReturnType<typeof saveInvoicingSettings> | ReturnType<typeof saveInvoicingSettingsSuccess> | ReturnType<typeof submitInvoicingQboSettings> | ReturnType<typeof saveInvoicingSettingsFailure> | ReturnType<typeof connectInvoicingStripe> | ReturnType<typeof disconnectInvoicingStripe> | ReturnType<typeof updateInvoicingStripeConnection> | ReturnType<typeof invoicingStripeConnectionFailure> | ReturnType<typeof updateAddresses> | ReturnType<typeof openSnackbar>;