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

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 (150) 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 +66 -1
  8. package/lib/entity/jeSchedules/jeSchedulesPayload.js +135 -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 +79 -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 +10 -3
  22. package/lib/epic.js +21 -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 +135 -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 +17 -8
  33. package/lib/esm/index.js +20 -15
  34. package/lib/esm/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +6 -3
  35. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulePageEpic.js +9 -1
  36. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +41 -5
  37. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/fetchOneTimeAccrualEpic.js +45 -0
  38. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/ignoreRecommendedJeScheduleEpic.js +14 -2
  39. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/createOneTimeAccrualEpic.js +99 -0
  40. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.js +25 -0
  41. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.js +110 -0
  42. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.js +79 -0
  43. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/oneTimeAccrualActionsEpic.js +139 -0
  44. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/revertJeScheduleEpic.js +106 -0
  45. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.js +22 -0
  46. package/lib/esm/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.js +140 -0
  47. package/lib/esm/view/expenseAutomationView/payload/jeSchedulesPayload.js +55 -0
  48. package/lib/esm/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +311 -29
  49. package/lib/esm/view/expenseAutomationView/selectors/jeAccountSettingsViewSelector.js +1 -0
  50. package/lib/esm/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.js +106 -0
  51. package/lib/esm/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +294 -22
  52. package/lib/esm/view/expenseAutomationView/types/jeSchedulesViewState.js +5 -6
  53. package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewPayload.js +9 -25
  54. package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/saveInvoicingCatalogItemEpic.js +1 -6
  55. package/lib/esm/view/invoicing/invoicingQboView/invoicingQboViewSelector.js +0 -40
  56. package/lib/esm/view/invoicing/settingsView/settingsViewEpics.js +92 -0
  57. package/lib/esm/view/invoicing/settingsView/settingsViewReducer.js +1 -25
  58. package/lib/esm/view/invoicing/settingsView/settingsViewSelector.js +0 -41
  59. package/lib/esm/view/recommendation/recommendationReducer.js +1 -16
  60. package/lib/esm/view/scheduleView/scheduleListView/epics/fetchAccruedScheduleListEpic.js +1 -1
  61. package/lib/esm/view/scheduleView/scheduleListView/epics/fetchDownloadSchedulesEpic.js +7 -2
  62. package/lib/esm/view/scheduleView/scheduleListView/scheduleListReducer.js +5 -3
  63. package/lib/index.d.ts +24 -22
  64. package/lib/index.js +96 -60
  65. package/lib/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +6 -3
  66. package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulePageEpic.js +9 -1
  67. package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.d.ts +3 -2
  68. package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +39 -3
  69. package/lib/view/expenseAutomationView/epics/jeSchedule/fetchOneTimeAccrualEpic.d.ts +20 -0
  70. package/lib/view/expenseAutomationView/epics/jeSchedule/fetchOneTimeAccrualEpic.js +49 -0
  71. package/lib/view/expenseAutomationView/epics/jeSchedule/ignoreRecommendedJeScheduleEpic.js +14 -2
  72. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/createOneTimeAccrualEpic.d.ts +8 -0
  73. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/createOneTimeAccrualEpic.js +103 -0
  74. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.d.ts +8 -0
  75. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.js +29 -0
  76. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.d.ts +45 -0
  77. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.js +114 -0
  78. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.d.ts +8 -0
  79. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.js +83 -0
  80. package/lib/view/expenseAutomationView/epics/jeSchedule/oneTimeAccrualActionsEpic.d.ts +12 -0
  81. package/lib/view/expenseAutomationView/epics/jeSchedule/oneTimeAccrualActionsEpic.js +146 -0
  82. package/lib/view/expenseAutomationView/epics/jeSchedule/revertJeScheduleEpic.d.ts +64 -0
  83. package/lib/view/expenseAutomationView/epics/jeSchedule/revertJeScheduleEpic.js +110 -0
  84. package/lib/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.d.ts +6 -0
  85. package/lib/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.js +26 -0
  86. package/lib/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.d.ts +36 -0
  87. package/lib/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.js +145 -0
  88. package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
  89. package/lib/view/expenseAutomationView/payload/jeSchedulesPayload.d.ts +72 -3
  90. package/lib/view/expenseAutomationView/payload/jeSchedulesPayload.js +58 -1
  91. package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.d.ts +91 -12
  92. package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +313 -29
  93. package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.d.ts +1 -1
  94. package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.d.ts +2 -2
  95. package/lib/view/expenseAutomationView/selectorTypes/jeAccountSettingsViewSelectorTypes.d.ts +1 -0
  96. package/lib/view/expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.d.ts +42 -0
  97. package/lib/view/expenseAutomationView/selectorTypes/jeSchedulesSelectorTypes.d.ts +36 -7
  98. package/lib/view/expenseAutomationView/selectors/jeAccountSettingsViewSelector.js +1 -0
  99. package/lib/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.d.ts +21 -0
  100. package/lib/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.js +112 -0
  101. package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.d.ts +34 -0
  102. package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +302 -21
  103. package/lib/view/expenseAutomationView/types/completedSubTab.d.ts +1 -1
  104. package/lib/view/expenseAutomationView/types/jeSchedulesViewState.d.ts +83 -8
  105. package/lib/view/expenseAutomationView/types/jeSchedulesViewState.js +8 -8
  106. package/lib/view/expenseAutomationView/types/reconciliationViewState.d.ts +2 -2
  107. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewPayload.d.ts +1 -12
  108. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewPayload.js +9 -25
  109. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/saveInvoicingCatalogItemEpic.js +1 -6
  110. package/lib/view/invoicing/invoicingQboView/invoicingQboViewSelector.d.ts +1 -10
  111. package/lib/view/invoicing/invoicingQboView/invoicingQboViewSelector.js +1 -43
  112. package/lib/view/invoicing/settingsView/settingsViewEpics.d.ts +12 -0
  113. package/lib/view/invoicing/settingsView/settingsViewEpics.js +99 -0
  114. package/lib/view/invoicing/settingsView/settingsViewReducer.d.ts +1 -4
  115. package/lib/view/invoicing/settingsView/settingsViewReducer.js +2 -26
  116. package/lib/view/invoicing/settingsView/settingsViewSelector.d.ts +0 -35
  117. package/lib/view/invoicing/settingsView/settingsViewSelector.js +1 -43
  118. package/lib/view/invoicing/settingsView/settingsViewState.d.ts +0 -8
  119. package/lib/view/recommendation/recommendationPayload.d.ts +0 -34
  120. package/lib/view/recommendation/recommendationReducer.d.ts +1 -2
  121. package/lib/view/recommendation/recommendationReducer.js +2 -17
  122. package/lib/view/scheduleView/scheduleListView/epics/fetchAccruedScheduleListEpic.js +1 -1
  123. package/lib/view/scheduleView/scheduleListView/epics/fetchDownloadSchedulesEpic.js +7 -2
  124. package/lib/view/scheduleView/scheduleListView/scheduleListReducer.d.ts +4 -2
  125. package/lib/view/scheduleView/scheduleListView/scheduleListReducer.js +5 -3
  126. package/package.json +1 -1
  127. package/lib/esm/view/invoicing/settingsView/epics/connectInvoicingStripeEpic.js +0 -27
  128. package/lib/esm/view/invoicing/settingsView/epics/disconnectInvoicingStripeEpic.js +0 -19
  129. package/lib/esm/view/invoicing/settingsView/epics/fetchInvoicingSettingsEpic.js +0 -19
  130. package/lib/esm/view/invoicing/settingsView/epics/saveInvoicingSettingsEpic.js +0 -39
  131. package/lib/esm/view/invoicing/settingsView/epics/submitInvoicingQboSettingsEpic.js +0 -25
  132. package/lib/esm/view/invoicing/settingsView/invoicingQboSettingsFormConfig.js +0 -48
  133. package/lib/esm/view/recommendation/submitRecommendationFeedbackEpic.js +0 -52
  134. package/lib/view/invoicing/settingsView/epics/connectInvoicingStripeEpic.d.ts +0 -6
  135. package/lib/view/invoicing/settingsView/epics/connectInvoicingStripeEpic.js +0 -31
  136. package/lib/view/invoicing/settingsView/epics/disconnectInvoicingStripeEpic.d.ts +0 -6
  137. package/lib/view/invoicing/settingsView/epics/disconnectInvoicingStripeEpic.js +0 -23
  138. package/lib/view/invoicing/settingsView/epics/fetchInvoicingSettingsEpic.d.ts +0 -6
  139. package/lib/view/invoicing/settingsView/epics/fetchInvoicingSettingsEpic.js +0 -23
  140. package/lib/view/invoicing/settingsView/epics/saveInvoicingSettingsEpic.d.ts +0 -6
  141. package/lib/view/invoicing/settingsView/epics/saveInvoicingSettingsEpic.js +0 -43
  142. package/lib/view/invoicing/settingsView/epics/settingsViewActionType.d.ts +0 -5
  143. package/lib/view/invoicing/settingsView/epics/submitInvoicingQboSettingsEpic.d.ts +0 -11
  144. package/lib/view/invoicing/settingsView/epics/submitInvoicingQboSettingsEpic.js +0 -29
  145. package/lib/view/invoicing/settingsView/invoicingQboSettingsFormConfig.d.ts +0 -34
  146. package/lib/view/invoicing/settingsView/invoicingQboSettingsFormConfig.js +0 -53
  147. package/lib/view/recommendation/submitRecommendationFeedbackEpic.d.ts +0 -7
  148. package/lib/view/recommendation/submitRecommendationFeedbackEpic.js +0 -56
  149. /package/lib/esm/view/{invoicing/settingsView/epics/settingsViewActionType.js → expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.js} +0 -0
  150. /package/lib/view/{invoicing/settingsView/epics/settingsViewActionType.js → expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.js} +0 -0
@@ -1,22 +1,31 @@
1
1
  import { NestedAccountHierarchyForReport } from '../../../commonStateTypes/accountView/nestedAccountID';
2
+ import { Amount } from '../../../commonStateTypes/amount';
2
3
  import { FetchStateAndError, FetchedState, ID } from '../../../commonStateTypes/common';
3
4
  import { Recommendation } from '../../../commonStateTypes/recommendationBase';
4
5
  import { SortOrder } from '../../../commonStateTypes/selectorTypes/sortOrderTypes';
5
- import { MonthYearPeriodId } from '../../../commonStateTypes/timePeriod';
6
+ import { MonthYearPeriodId, ScheduleDaysOfMonth } from '../../../commonStateTypes/timePeriod';
6
7
  import { AccountBase } from '../../../entity/account/accountState';
7
- import { JEScheduleTransactionKey, ScheduleTypes } from '../../../entity/jeSchedules/jeSchedulesTypes';
8
+ import { JEOneTimeAccrualKey, JEScheduleKey, JEScheduleTransactionKey, ScheduleJournalEntryStatusCodeType, ScheduleTransactionID, ScheduleTypes } from '../../../entity/jeSchedules/jeSchedulesTypes';
8
9
  import { VendorBase } from '../../../entity/vendor/vendorState';
9
- export declare const toJEScheduleSortKey: (v: string) => "type" | "vendor" | "category" | "class" | "memo" | "depCategory" | "scheduleCategory" | "startMonth" | "amortizationPeriod" | "jePostingDate" | "remainingMonths" | "runningBalance" | "totalAmount" | "transactionDate";
10
+ import { ZeniDate } from '../../../zeniDayJS';
11
+ import { JETransactionLink } from '../../scheduleView/scheduleDetailView/scheduleDetailState';
12
+ export declare const toJEScheduleSortKey: (v: string) => "type" | "vendor" | "category" | "class" | "memo" | "jePostingDate" | "runningBalance" | "depCategory" | "scheduleCategory" | "startMonth" | "amortizationPeriod" | "remainingMonths" | "totalAmount" | "transactionDate";
10
13
  export type JEScheduleSortKey = ReturnType<typeof toJEScheduleSortKey>;
11
- export declare const toJEScheduleMainTab: (v: string) => "pending_review" | "completed" | "ongoing";
12
- export type JEScheduleMainTab = ReturnType<typeof toJEScheduleMainTab>;
14
+ export declare const toJEPageTab: (v: string) => "schedules" | "existing_schedules";
15
+ export type JEPageTab = ReturnType<typeof toJEPageTab>;
16
+ export declare const ALL_JE_PAGE_TABS: readonly JEPageTab[];
17
+ export type JESchedulePeriodTabKey = `${JEPageTab}_${MonthYearPeriodId}`;
18
+ export declare const getJESchedulePeriodTabKey: (selectedPageTab: JEPageTab, monthYearPeriodId: MonthYearPeriodId) => JESchedulePeriodTabKey;
13
19
  export interface JESchedulesViewUIState {
20
+ createdGroupCollapsed: boolean;
21
+ pendingGroupCollapsed: boolean;
14
22
  scrollPosition: {
15
23
  scrollTop: number;
16
24
  scrollLeft?: number;
17
25
  } | undefined;
18
26
  searchString: string;
19
- selectedMainTab: JEScheduleMainTab;
27
+ selectedJETypeFilter: ScheduleTypes | null;
28
+ selectedPageTab: JEPageTab;
20
29
  sortKey: JEScheduleSortKey;
21
30
  sortOrder: SortOrder;
22
31
  totalCount: number;
@@ -33,14 +42,79 @@ export interface JEScheduleLocalData {
33
42
  }
34
43
  export interface JESchedulesViewState extends FetchedState {
35
44
  accountSettings: AccountSettingsState;
36
- failedJeScheduleTransactionKeysByPeriod: Record<MonthYearPeriodId, JEScheduleTransactionKey[]>;
45
+ failedJeScheduleTransactionKeysByPeriodAndTab: Record<JESchedulePeriodTabKey, JEScheduleTransactionKey[]>;
37
46
  ignoreStatusById: Record<JEScheduleTransactionKey, FetchStateAndError>;
47
+ jeScheduleAccruedKeysByPeriodAndTab: Record<JESchedulePeriodTabKey, JEScheduleKey[]>;
38
48
  jeScheduleLocalDataById: Record<ID, JEScheduleLocalData>;
39
- jeScheduleTransactionKeysByPeriod: Record<MonthYearPeriodId, JEScheduleTransactionKey[]>;
49
+ jeScheduleOneTimeAccrualKeysByPeriodAndTab: Record<JESchedulePeriodTabKey, JEOneTimeAccrualKey[]>;
50
+ jeScheduleTransactionKeysByPeriodAndTab: Record<JESchedulePeriodTabKey, JEScheduleTransactionKey[]>;
51
+ newSchedule: NewJeScheduleState;
52
+ oneTimeAccrualActionStatusById: Record<ID, FetchStateAndError>;
53
+ oneTimeAccrualFetchStatusById: Record<ID, FetchStateAndError>;
40
54
  postStatusById: Record<ID, FetchStateAndError>;
41
55
  refreshStatus: FetchStateAndError;
56
+ revertStatusById: Record<JEScheduleKey | JEScheduleTransactionKey, FetchStateAndError>;
42
57
  uiState: JESchedulesViewUIState;
43
58
  }
59
+ export interface NewJeDetailLocalData {
60
+ amount: Amount;
61
+ jeLink: JETransactionLink;
62
+ memo: string;
63
+ postingDate: ZeniDate;
64
+ postingStatus: ScheduleJournalEntryStatusCodeType;
65
+ runningBalance: Amount;
66
+ }
67
+ export interface NewScheduleLocalData {
68
+ jeScheduleDetails: NewJeDetailLocalData[];
69
+ scheduleType: ScheduleTypes;
70
+ lastDayOfMonth?: boolean;
71
+ selectedAccount?: ID;
72
+ selectedBaseTransactionId?: ScheduleTransactionID;
73
+ selectedClass?: ID;
74
+ selectedDate?: ZeniDate;
75
+ selectedDayOfMonth?: ScheduleDaysOfMonth;
76
+ selectedJEScheduleKey?: JEScheduleTransactionKey;
77
+ selectedMonths?: number;
78
+ selectedVendor?: VendorBase;
79
+ }
80
+ export interface NewScheduleLocalDataFixedAssets extends NewScheduleLocalData {
81
+ assetId?: string;
82
+ selectedAccumulatedDepreciationCategory?: ID;
83
+ }
84
+ /**
85
+ * The form values for creating a one-time accrual. Not stored in the slice — a one-time accrual is
86
+ * created in a single POST with no draft/resume step, so this is passed straight through the action
87
+ * to the payload builder.
88
+ */
89
+ export interface NewOneTimeAccrualLocalData {
90
+ amount: number;
91
+ creditAccountId: ID;
92
+ debitAccountId: ID;
93
+ memo: string;
94
+ reverseNextMonth: boolean;
95
+ serviceMonth: ZeniDate;
96
+ vendorId: ID;
97
+ vendorName: string;
98
+ creditAccountName?: string;
99
+ debitAccountName?: string;
100
+ debitClassId?: ID;
101
+ debitClassName?: string;
102
+ }
103
+ export interface SearchTransactionsState extends FetchStateAndError {
104
+ searchResults: JEScheduleTransactionKey[];
105
+ searchString?: string;
106
+ }
107
+ export declare const MIN_NEW_SCHEDULE_SEARCH_LENGTH = 2;
108
+ export interface NewJeScheduleState extends FetchStateAndError {
109
+ createOneTimeAccrualStatus: FetchStateAndError;
110
+ newScheduleState: {
111
+ fixed_assets: NewScheduleLocalDataFixedAssets;
112
+ prepaid_expenses: NewScheduleLocalData;
113
+ };
114
+ saveStatus: FetchStateAndError;
115
+ searchTransactions: SearchTransactionsState;
116
+ selectedDetailScheduleType?: ScheduleTypes;
117
+ }
44
118
  export interface AccountSettingsLocalData {
45
119
  previousAccruedExpensesAccount: AccountBase[];
46
120
  previousFixedAssetsAccount: AccountBase[];
@@ -57,6 +131,7 @@ export interface AccountSettingsState {
57
131
  fixedAssetsAccountIdList: ID[];
58
132
  fixedAssetsNestedAccountListHierarchy: NestedAccountHierarchyForReport[];
59
133
  fixedAssetsRecommendations: Recommendation[];
134
+ hasLoadedAccountSettings: boolean;
60
135
  localData: AccountSettingsLocalData;
61
136
  prepaidExpensesAccountIdList: ID[];
62
137
  prepaidExpensesNestedAccountListHierarchy: NestedAccountHierarchyForReport[];
@@ -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,10 @@ 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',
27
- ];
28
- const toJEScheduleMainTab = (v) => (0, stringToUnion_1.stringToUnion)(v, JE_SCHEDULE_MAIN_TABS);
29
- exports.toJEScheduleMainTab = toJEScheduleMainTab;
23
+ const JE_PAGE_TABS = ['schedules', 'existing_schedules'];
24
+ const toJEPageTab = (v) => (0, stringToUnion_1.stringToUnion)(v, JE_PAGE_TABS);
25
+ exports.toJEPageTab = toJEPageTab;
26
+ exports.ALL_JE_PAGE_TABS = JE_PAGE_TABS;
27
+ const getJESchedulePeriodTabKey = (selectedPageTab, monthYearPeriodId) => `${selectedPageTab}_${monthYearPeriodId}`;
28
+ exports.getJESchedulePeriodTabKey = getJESchedulePeriodTabKey;
29
+ 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;