@zeniai/client-epic-state 5.2.39 → 5.2.41-beta1MM

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 (124) hide show
  1. package/lib/entity/actualMatching/actualMatchingPayload.d.ts +31 -0
  2. package/lib/entity/actualMatching/actualMatchingPayload.js +52 -0
  3. package/lib/entity/actualMatching/actualMatchingReducer.d.ts +9 -0
  4. package/lib/entity/actualMatching/actualMatchingReducer.js +33 -0
  5. package/lib/entity/actualMatching/actualMatchingSelector.d.ts +3 -0
  6. package/lib/entity/actualMatching/actualMatchingSelector.js +6 -0
  7. package/lib/entity/actualMatching/actualMatchingState.d.ts +23 -0
  8. package/lib/entity/actualMatching/actualMatchingState.js +2 -0
  9. package/lib/entity/actualMatching/actualMatchingTypes.d.ts +1 -0
  10. package/lib/entity/actualMatching/actualMatchingTypes.js +2 -0
  11. package/lib/entity/aiCfo/aiCfoReducer.js +78 -4
  12. package/lib/entity/aiCfo/aiCfoState.d.ts +16 -0
  13. package/lib/entity/file/fileReducer.d.ts +8 -0
  14. package/lib/entity/file/fileReducer.js +10 -2
  15. package/lib/entity/invoicing/invoicingCommonPayload.d.ts +14 -1
  16. package/lib/entity/jeSchedules/jeSchedulesPayload.d.ts +31 -0
  17. package/lib/entity/jeSchedules/jeSchedulesPayload.js +53 -0
  18. package/lib/entity/jeSchedules/jeSchedulesState.d.ts +33 -0
  19. package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
  20. package/lib/entity/snackbar/snackbarTypes.js +2 -0
  21. package/lib/epic.d.ts +8 -1
  22. package/lib/epic.js +14 -0
  23. package/lib/esm/entity/actualMatching/actualMatchingPayload.js +48 -0
  24. package/lib/esm/entity/actualMatching/actualMatchingReducer.js +30 -0
  25. package/lib/esm/entity/actualMatching/actualMatchingSelector.js +3 -0
  26. package/lib/esm/entity/actualMatching/actualMatchingState.js +1 -0
  27. package/lib/esm/entity/actualMatching/actualMatchingTypes.js +1 -0
  28. package/lib/esm/entity/aiCfo/aiCfoReducer.js +79 -5
  29. package/lib/esm/entity/file/fileReducer.js +10 -2
  30. package/lib/esm/entity/jeSchedules/jeSchedulesPayload.js +53 -0
  31. package/lib/esm/entity/snackbar/snackbarTypes.js +2 -0
  32. package/lib/esm/epic.js +14 -0
  33. package/lib/esm/index.js +7 -3
  34. package/lib/esm/reducer.js +6 -0
  35. package/lib/esm/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +25 -12
  36. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/actualMatching/fetchActualMatchingEpic.js +46 -0
  37. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/actualMatching/fetchActualMatchingMatchEpic.js +36 -0
  38. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/actualMatching/fetchActualMatchingPageEpic.js +7 -0
  39. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/actualMatching/matchAndReverseAccrualsEpic.js +108 -0
  40. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/actualMatching/refreshActualMatchingList.js +16 -0
  41. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/actualMatching/searchMatchAccrualsEpic.js +60 -0
  42. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/actualMatching/searchMatchTransactionsEpic.js +74 -0
  43. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/actualMatching/undoReversalAccrualsEpic.js +78 -0
  44. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulePageEpic.js +13 -3
  45. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/prefetchOtherJeSchedulesTabEpic.js +40 -15
  46. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.js +19 -8
  47. package/lib/esm/view/expenseAutomationView/expenseAutomationViewReducer.js +2 -1
  48. package/lib/esm/view/expenseAutomationView/expenseAutomationViewSelector.js +24 -6
  49. package/lib/esm/view/expenseAutomationView/expenseAutomationViewState.js +4 -2
  50. package/lib/esm/view/expenseAutomationView/payload/actualMatchingPayload.js +68 -0
  51. package/lib/esm/view/expenseAutomationView/reducers/actualMatchingViewReducer.js +462 -0
  52. package/lib/esm/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +2 -1
  53. package/lib/esm/view/expenseAutomationView/selectorTypes/actualMatchingViewSelectorTypes.js +1 -0
  54. package/lib/esm/view/expenseAutomationView/selectors/actualMatchingViewSelector.js +426 -0
  55. package/lib/esm/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +4 -0
  56. package/lib/esm/view/expenseAutomationView/types/actualMatchingViewState.js +38 -0
  57. package/lib/esm/view/expenseAutomationView/types/jeSchedulesViewState.js +8 -1
  58. package/lib/esm/view/financeStatement/financeStatementReducer.js +17 -27
  59. package/lib/esm/view/invoicing/editInvoicingCustomerDetailView/editInvoicingCustomerDetailViewSelector.js +1 -1
  60. package/lib/esm/view/invoicing/settingsView/epics/fetchInvoicingSettingsEpic.js +6 -0
  61. package/lib/esm/view/invoicing/settingsView/epics/saveInvoicingSettingsEpic.js +7 -0
  62. package/lib/esm/view/invoicing/settingsView/invoicingBrandingFormConfig.js +1 -1
  63. package/lib/esm/view/invoicing/settingsView/settingsViewSelector.js +5 -0
  64. package/lib/esm/view/invoicing/settingsView/submitInvoicingBrandingFormEpic.js +9 -0
  65. package/lib/index.d.ts +14 -5
  66. package/lib/index.js +82 -48
  67. package/lib/reducer.d.ts +2 -0
  68. package/lib/reducer.js +6 -0
  69. package/lib/rootStateTypes.d.ts +4 -0
  70. package/lib/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +25 -12
  71. package/lib/view/expenseAutomationView/epics/jeSchedule/actualMatching/fetchActualMatchingEpic.d.ts +9 -0
  72. package/lib/view/expenseAutomationView/epics/jeSchedule/actualMatching/fetchActualMatchingEpic.js +50 -0
  73. package/lib/view/expenseAutomationView/epics/jeSchedule/actualMatching/fetchActualMatchingMatchEpic.d.ts +12 -0
  74. package/lib/view/expenseAutomationView/epics/jeSchedule/actualMatching/fetchActualMatchingMatchEpic.js +40 -0
  75. package/lib/view/expenseAutomationView/epics/jeSchedule/actualMatching/fetchActualMatchingPageEpic.d.ts +5 -0
  76. package/lib/view/expenseAutomationView/epics/jeSchedule/actualMatching/fetchActualMatchingPageEpic.js +11 -0
  77. package/lib/view/expenseAutomationView/epics/jeSchedule/actualMatching/matchAndReverseAccrualsEpic.d.ts +9 -0
  78. package/lib/view/expenseAutomationView/epics/jeSchedule/actualMatching/matchAndReverseAccrualsEpic.js +112 -0
  79. package/lib/view/expenseAutomationView/epics/jeSchedule/actualMatching/refreshActualMatchingList.d.ts +3 -0
  80. package/lib/view/expenseAutomationView/epics/jeSchedule/actualMatching/refreshActualMatchingList.js +19 -0
  81. package/lib/view/expenseAutomationView/epics/jeSchedule/actualMatching/searchMatchAccrualsEpic.d.ts +9 -0
  82. package/lib/view/expenseAutomationView/epics/jeSchedule/actualMatching/searchMatchAccrualsEpic.js +64 -0
  83. package/lib/view/expenseAutomationView/epics/jeSchedule/actualMatching/searchMatchTransactionsEpic.d.ts +8 -0
  84. package/lib/view/expenseAutomationView/epics/jeSchedule/actualMatching/searchMatchTransactionsEpic.js +78 -0
  85. package/lib/view/expenseAutomationView/epics/jeSchedule/actualMatching/undoReversalAccrualsEpic.d.ts +9 -0
  86. package/lib/view/expenseAutomationView/epics/jeSchedule/actualMatching/undoReversalAccrualsEpic.js +82 -0
  87. package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulePageEpic.d.ts +2 -1
  88. package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulePageEpic.js +13 -3
  89. package/lib/view/expenseAutomationView/epics/jeSchedule/prefetchOtherJeSchedulesTabEpic.d.ts +5 -1
  90. package/lib/view/expenseAutomationView/epics/jeSchedule/prefetchOtherJeSchedulesTabEpic.js +39 -14
  91. package/lib/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.js +18 -7
  92. package/lib/view/expenseAutomationView/expenseAutomationViewReducer.d.ts +2 -1
  93. package/lib/view/expenseAutomationView/expenseAutomationViewReducer.js +2 -1
  94. package/lib/view/expenseAutomationView/expenseAutomationViewSelector.js +24 -6
  95. package/lib/view/expenseAutomationView/expenseAutomationViewState.d.ts +2 -1
  96. package/lib/view/expenseAutomationView/expenseAutomationViewState.js +6 -3
  97. package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
  98. package/lib/view/expenseAutomationView/payload/actualMatchingPayload.d.ts +85 -0
  99. package/lib/view/expenseAutomationView/payload/actualMatchingPayload.js +74 -0
  100. package/lib/view/expenseAutomationView/reducers/actualMatchingViewReducer.d.ts +79 -0
  101. package/lib/view/expenseAutomationView/reducers/actualMatchingViewReducer.js +466 -0
  102. package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.d.ts +6 -5
  103. package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +2 -1
  104. package/lib/view/expenseAutomationView/selectorTypes/actualMatchingViewSelectorTypes.d.ts +87 -0
  105. package/lib/view/expenseAutomationView/selectorTypes/actualMatchingViewSelectorTypes.js +2 -0
  106. package/lib/view/expenseAutomationView/selectorTypes/expenseAutomationViewSelectorTypes.d.ts +11 -0
  107. package/lib/view/expenseAutomationView/selectors/actualMatchingViewSelector.d.ts +38 -0
  108. package/lib/view/expenseAutomationView/selectors/actualMatchingViewSelector.js +445 -0
  109. package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +4 -0
  110. package/lib/view/expenseAutomationView/types/actualMatchingViewState.d.ts +106 -0
  111. package/lib/view/expenseAutomationView/types/actualMatchingViewState.js +46 -0
  112. package/lib/view/expenseAutomationView/types/jeSchedulesViewState.d.ts +1 -1
  113. package/lib/view/expenseAutomationView/types/jeSchedulesViewState.js +8 -1
  114. package/lib/view/financeStatement/financeStatementReducer.js +17 -27
  115. package/lib/view/invoicing/editInvoicingCustomerDetailView/editInvoicingCustomerDetailViewSelector.js +1 -1
  116. package/lib/view/invoicing/settingsView/epics/fetchInvoicingSettingsEpic.js +6 -0
  117. package/lib/view/invoicing/settingsView/epics/saveInvoicingSettingsEpic.js +7 -0
  118. package/lib/view/invoicing/settingsView/epics/settingsViewActionType.d.ts +2 -1
  119. package/lib/view/invoicing/settingsView/invoicingBrandingFormConfig.js +1 -1
  120. package/lib/view/invoicing/settingsView/settingsViewSelector.d.ts +8 -0
  121. package/lib/view/invoicing/settingsView/settingsViewSelector.js +5 -0
  122. package/lib/view/invoicing/settingsView/submitInvoicingBrandingFormEpic.d.ts +2 -1
  123. package/lib/view/invoicing/settingsView/submitInvoicingBrandingFormEpic.js +9 -0
  124. package/package.json +1 -1
@@ -0,0 +1,106 @@
1
+ import { FetchStateAndError, FetchedState, ID } from '../../../commonStateTypes/common';
2
+ import { SortOrder } from '../../../commonStateTypes/selectorTypes/sortOrderTypes';
3
+ import { MonthYearPeriodId } from '../../../commonStateTypes/timePeriod';
4
+ import { ActualMatchingMatchId } from '../../../entity/actualMatching/actualMatchingTypes';
5
+ import { JEOneTimeAccrualKey } from '../../../entity/jeSchedules/jeSchedulesTypes';
6
+ export declare const toActualMatchingSortKey: (v: string) => "type" | "date" | "vendor" | "category" | "class" | "amount" | "variance" | "lifecycle" | "service" | "accrued" | "actual";
7
+ export type ActualMatchingSortKey = ReturnType<typeof toActualMatchingSortKey>;
8
+ export declare const MATCH_TRANSACTION_SEARCH_PAGE_SIZE = 50;
9
+ export declare const MATCH_ACCRUAL_SEARCH_LIMIT = 50;
10
+ export declare const MATCH_SEARCH_DEBOUNCE_MS = 300;
11
+ export declare const toMatchAndReverseResultStatus: (v: string) => "error" | "reversed" | "noop" | "conflict" | "claim_lost";
12
+ export type MatchAndReverseResultStatus = ReturnType<typeof toMatchAndReverseResultStatus>;
13
+ export interface ActualMatchingViewUIState {
14
+ scrollPosition: {
15
+ scrollTop: number;
16
+ scrollLeft?: number;
17
+ } | undefined;
18
+ searchString: string;
19
+ sortKey: ActualMatchingSortKey;
20
+ sortOrder: SortOrder;
21
+ }
22
+ /**
23
+ * Sibling of Missing Receipts `MatchCandidate`. Confirm needs `lineId` and
24
+ * `transactionIntegrationId` on every row — those fields are required here.
25
+ */
26
+ export interface ActualMatchingTransactionSearchResult {
27
+ amount: number;
28
+ currencyCode: string;
29
+ currencySymbol: string;
30
+ lineId: string;
31
+ syncToken: string;
32
+ transactionDate: string;
33
+ transactionId: ID;
34
+ transactionIntegrationId: string;
35
+ transactionType: string;
36
+ vendorName: string;
37
+ accountDescription?: string;
38
+ accountId?: ID;
39
+ accountingClassId?: ID;
40
+ accountingClassName?: string;
41
+ accountName?: string;
42
+ transactionDescription?: string;
43
+ transactionMemo?: string;
44
+ transactionTypeName?: string;
45
+ vendorId?: ID;
46
+ }
47
+ export interface MatchAndReverseResult {
48
+ accrualId: ID;
49
+ status: MatchAndReverseResultStatus;
50
+ reason?: string;
51
+ }
52
+ export declare function isMatchAndReverseCompleteStatus(status: MatchAndReverseResultStatus): boolean;
53
+ export interface MatchAndReverseAccrualsParams {
54
+ accrualIds: ID[];
55
+ lineIds: ID[];
56
+ transactionId: ID;
57
+ transactionIntegrationId: string;
58
+ transactionSyncToken: string;
59
+ transactionType: string;
60
+ }
61
+ export declare const toUndoReversalResultStatus: (v: string) => "error" | "claim_lost" | "undone";
62
+ export type UndoReversalResultStatus = ReturnType<typeof toUndoReversalResultStatus>;
63
+ export interface UndoReversalResult {
64
+ accrualId: ID;
65
+ status: UndoReversalResultStatus;
66
+ reason?: string;
67
+ }
68
+ export interface UndoReversalAccrualsParams {
69
+ accrualIds: ID[];
70
+ matchId: ActualMatchingMatchId;
71
+ }
72
+ export interface ActualMatchingTransactionSearchState extends FetchStateAndError {
73
+ isLoadingMore: boolean;
74
+ nextPageToken: string | null;
75
+ query: string;
76
+ results: ActualMatchingTransactionSearchResult[];
77
+ }
78
+ export interface ActualMatchingAccrualSearchState extends FetchStateAndError {
79
+ isLoadingMore: boolean;
80
+ nextPageToken: string | null;
81
+ query: string;
82
+ results: JEOneTimeAccrualKey[];
83
+ }
84
+ export interface ActualMatchingMatchModalState {
85
+ accrualSearch: ActualMatchingAccrualSearchState;
86
+ confirmStatus: FetchStateAndError;
87
+ didPinPrefillTransactions: boolean;
88
+ isOpen: boolean;
89
+ pinnedTransactionResults: ActualMatchingTransactionSearchResult[];
90
+ transactionSearch: ActualMatchingTransactionSearchState;
91
+ lastBatchResults?: MatchAndReverseResult[];
92
+ openedFromMatchId?: ActualMatchingMatchId;
93
+ }
94
+ export declare function actualMatchingTransactionLineKey(transactionType: string, transactionIntegrationId: string, lineId: string): string;
95
+ export interface ActualMatchingViewState extends FetchedState {
96
+ closeMatchAfterUndo: boolean;
97
+ detailFetchStateByMatchId: Record<ActualMatchingMatchId, FetchStateAndError>;
98
+ detailRefreshStatusByMatchId: Record<ActualMatchingMatchId, FetchStateAndError>;
99
+ lastMatchResultsByMatchId: Record<ActualMatchingMatchId, MatchAndReverseResult[]>;
100
+ lastUndoResultsByMatchId: Record<ActualMatchingMatchId, UndoReversalResult[]>;
101
+ matchIdsByPeriod: Record<MonthYearPeriodId, ActualMatchingMatchId[]>;
102
+ matchModal: ActualMatchingMatchModalState;
103
+ refreshStatus: FetchStateAndError;
104
+ uiState: ActualMatchingViewUIState;
105
+ undoReversalStatusByMatchId: Record<ActualMatchingMatchId, FetchStateAndError>;
106
+ }
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.toUndoReversalResultStatus = exports.toMatchAndReverseResultStatus = exports.MATCH_SEARCH_DEBOUNCE_MS = exports.MATCH_ACCRUAL_SEARCH_LIMIT = exports.MATCH_TRANSACTION_SEARCH_PAGE_SIZE = exports.toActualMatchingSortKey = void 0;
4
+ exports.isMatchAndReverseCompleteStatus = isMatchAndReverseCompleteStatus;
5
+ exports.actualMatchingTransactionLineKey = actualMatchingTransactionLineKey;
6
+ const stringToUnion_1 = require("../../../commonStateTypes/stringToUnion");
7
+ const ACTUAL_MATCHING_SORT_KEYS = [
8
+ 'vendor',
9
+ 'date',
10
+ 'amount',
11
+ 'category',
12
+ 'class',
13
+ 'type',
14
+ 'lifecycle',
15
+ 'service',
16
+ 'accrued',
17
+ 'actual',
18
+ 'variance',
19
+ ];
20
+ const toActualMatchingSortKey = (v) => (0, stringToUnion_1.stringToUnion)(v, ACTUAL_MATCHING_SORT_KEYS);
21
+ exports.toActualMatchingSortKey = toActualMatchingSortKey;
22
+ exports.MATCH_TRANSACTION_SEARCH_PAGE_SIZE = 50;
23
+ exports.MATCH_ACCRUAL_SEARCH_LIMIT = 50;
24
+ exports.MATCH_SEARCH_DEBOUNCE_MS = 300;
25
+ const MATCH_AND_REVERSE_RESULT_STATUSES = [
26
+ 'reversed',
27
+ 'noop',
28
+ 'conflict',
29
+ 'claim_lost',
30
+ 'error',
31
+ ];
32
+ const toMatchAndReverseResultStatus = (v) => (0, stringToUnion_1.stringToUnion)(v, MATCH_AND_REVERSE_RESULT_STATUSES);
33
+ exports.toMatchAndReverseResultStatus = toMatchAndReverseResultStatus;
34
+ function isMatchAndReverseCompleteStatus(status) {
35
+ return status === 'reversed' || status === 'noop';
36
+ }
37
+ const UNDO_REVERSAL_RESULT_STATUSES = [
38
+ 'undone',
39
+ 'claim_lost',
40
+ 'error',
41
+ ];
42
+ const toUndoReversalResultStatus = (v) => (0, stringToUnion_1.stringToUnion)(v, UNDO_REVERSAL_RESULT_STATUSES);
43
+ exports.toUndoReversalResultStatus = toUndoReversalResultStatus;
44
+ function actualMatchingTransactionLineKey(transactionType, transactionIntegrationId, lineId) {
45
+ return `${transactionType}:${transactionIntegrationId}:${lineId}`;
46
+ }
@@ -12,7 +12,7 @@ import { ZeniDate } from '../../../zeniDayJS';
12
12
  import { JETransactionLink } from '../../scheduleView/scheduleDetailView/scheduleDetailState';
13
13
  export declare const toJEScheduleSortKey: (v: string) => "type" | "vendor" | "category" | "class" | "memo" | "jePostingDate" | "runningBalance" | "depCategory" | "scheduleCategory" | "startMonth" | "amortizationPeriod" | "remainingMonths" | "totalAmount" | "transactionDate";
14
14
  export type JEScheduleSortKey = ReturnType<typeof toJEScheduleSortKey>;
15
- export declare const toJEPageTab: (v: string) => "schedules" | "existing_schedules";
15
+ export declare const toJEPageTab: (v: string) => "schedules" | "actual_matching" | "existing_schedules";
16
16
  export type JEPageTab = ReturnType<typeof toJEPageTab>;
17
17
  export declare const ALL_JE_PAGE_TABS: readonly JEPageTab[];
18
18
  export type JESchedulePeriodTabKey = `${JEPageTab}_${MonthYearPeriodId}`;
@@ -20,7 +20,14 @@ const JE_SCHEDULE_SORT_KEYS = [
20
20
  ];
21
21
  const toJEScheduleSortKey = (v) => (0, stringToUnion_1.stringToUnion)(v, JE_SCHEDULE_SORT_KEYS);
22
22
  exports.toJEScheduleSortKey = toJEScheduleSortKey;
23
- const JE_PAGE_TABS = ['schedules', 'existing_schedules'];
23
+ // `actual_matching` is chrome only: the JE tab bar includes it, but AM data is
24
+ // `expenseAutomationActualMatchingViewState`, not the schedules period-tab
25
+ // cache below. Walks of ALL_JE_PAGE_TABS that read schedule keys must skip it.
26
+ const JE_PAGE_TABS = [
27
+ 'schedules',
28
+ 'actual_matching',
29
+ 'existing_schedules',
30
+ ];
24
31
  const toJEPageTab = (v) => (0, stringToUnion_1.stringToUnion)(v, JE_PAGE_TABS);
25
32
  exports.toJEPageTab = toJEPageTab;
26
33
  exports.ALL_JE_PAGE_TABS = JE_PAGE_TABS;
@@ -37,9 +37,18 @@ const financeStatement = (0, toolkit_1.createSlice)({
37
37
  },
38
38
  },
39
39
  updateFinanceStatementTimeframe(draft, action) {
40
+ // Unrelated UI re-dispatches the *current* timeframe as a side effect (the
41
+ // reports page hangs its table scroll reset off that callback); dropping the
42
+ // anchor there would silently reset the user's period to the latest one.
43
+ if (draft.timeframe === action.payload) {
44
+ return;
45
+ }
40
46
  draft.timeframe = action.payload;
47
+ // A month anchor is meaningless once the timeframe becomes quarter/year, so
48
+ // a real change drops it and returns the width to the default — 12 months
49
+ // must not become 12 quarters. Order is the user's, so it survives.
41
50
  draft.selectedCOABalancesRange = {
42
- numberOfPeriods: draft.selectedCOABalancesRange.numberOfPeriods,
51
+ numberOfPeriods: exports.initialFinanceStatementState.selectedCOABalancesRange.numberOfPeriods,
43
52
  orderBy: draft.selectedCOABalancesRange.orderBy,
44
53
  };
45
54
  },
@@ -81,8 +90,7 @@ const financeStatement = (0, toolkit_1.createSlice)({
81
90
  draft.selectedReportId = action.payload;
82
91
  },
83
92
  updateFinanceStatementAdditionalBalancesSelection(draft, action) {
84
- const { firstMonthOfFY, additionalBalances: additionalBalancesPayload, coaBalances, maxNumOfPeriodsToHighlight, } = action.payload;
85
- const safeCoaBalances = coaBalances != null ? coaBalances : [];
93
+ const { additionalBalances: additionalBalancesPayload, maxNumOfPeriodsToHighlight, } = action.payload;
86
94
  const additionalBalances = additionalBalancesPayload ?? [];
87
95
  let tempAdditionalBalances = [...additionalBalances];
88
96
  if (additionalBalances.includes('this_period_vs_last_period') ||
@@ -98,30 +106,12 @@ const financeStatement = (0, toolkit_1.createSlice)({
98
106
  draft.maxNumOfPeriodsToHighlight = maxNumOfPeriodsToHighlight;
99
107
  draft.isAdditionalBalancesShown =
100
108
  additionalBalances.length != 0 ? true : false;
101
- const { timeframe, selectedCOABalancesRange } = draft;
102
- if (safeCoaBalances.length > 0) {
103
- const thisPeriod = (0, thisPeriodHelpers_1.extractThisPeriod)(action.payload.firstMonthOfFY, timeframe, selectedCOABalancesRange, safeCoaBalances);
104
- if (thisPeriod != null) {
105
- const selectedCoaBalancesRangeWithThisPeriod = {
106
- ...selectedCOABalancesRange,
107
- thisPeriod,
108
- };
109
- const selectionRanges = (0, getSelectedAndHighlightedRanges_1.getSelectedAndHighlightedRangesForThisPeriod)({
110
- firstMonthOfFY,
111
- thisPeriod: thisPeriod,
112
- coaBalances: safeCoaBalances,
113
- timeframe,
114
- maxNumOfPeriodsToHighlight: maxNumOfPeriodsToHighlight,
115
- currentSelection: {
116
- selectedCOABalancesRange: selectedCoaBalancesRangeWithThisPeriod,
117
- },
118
- orderBy: 'ascending_date',
119
- maxNumOfPeriodsToSelect: maxNumOfPeriodsToHighlight,
120
- });
121
- draft.selectedCOABalancesRange =
122
- selectionRanges.selectedCOABalancesRange;
123
- }
124
- }
109
+ // Column metadata only — must not touch selectedCOABalancesRange. The
110
+ // reports page fires this on load, on resize and on every fetch-state
111
+ // transition (so also on report switch and on remount after a drill-down)
112
+ // with a viewport-derived period count that knows nothing about the range
113
+ // the user picked. The width default comes from initial state, and from
114
+ // updateFinanceStatementTimeframe on a real timeframe change.
125
115
  },
126
116
  updateDownloadState(draft, action) {
127
117
  draft.downloadState = action.payload;
@@ -39,7 +39,7 @@ const getInvoicingCustomerRecord = (state, invoicingCustomerID) => {
39
39
  brandingAccentColor: settings?.accent_color,
40
40
  brandingCompanyName: settings?.company_name,
41
41
  brandingEmail: settings?.email,
42
- brandingLogoUrl: settings?.logo_url,
42
+ brandingLogoUrl: settings?.logo_file?.signed_url,
43
43
  stripeConnected: (0, invoicingSettingsHelpers_1.isStripeConnectedFromSettings)(settings),
44
44
  fetchState: invoicingCustomerDetail?.fetchState ?? 'Not-Started',
45
45
  error: invoicingCustomerDetail?.error,
@@ -4,6 +4,7 @@ exports.fetchInvoicingSettingsEpic = void 0;
4
4
  const rxjs_1 = require("rxjs");
5
5
  const operators_1 = require("rxjs/operators");
6
6
  const addressReducer_1 = require("../../../../entity/address/addressReducer");
7
+ const fileReducer_1 = require("../../../../entity/file/fileReducer");
7
8
  const responsePayload_1 = require("../../../../responsePayload");
8
9
  const settingsViewReducer_1 = require("../settingsViewReducer");
9
10
  const fetchInvoicingSettingsEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(settingsViewReducer_1.fetchInvoicingSettings.match), (0, operators_1.switchMap)(() => {
@@ -11,8 +12,13 @@ const fetchInvoicingSettingsEpic = (actions$, _state$, zeniAPI) => actions$.pipe
11
12
  return zeniAPI.getJSON(apiUrl).pipe((0, operators_1.switchMap)((response) => {
12
13
  if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
13
14
  const address = response.data.address;
15
+ // The logo record goes to the file entity, like the address goes to
16
+ // the address entity: the settings view keeps only its id and reads
17
+ // the file back through the file selector, so one copy is canonical.
18
+ const logoFile = response.data.logo_file;
14
19
  return [
15
20
  ...(address != null ? [(0, addressReducer_1.updateAddresses)([address])] : []),
21
+ ...(logoFile != null ? [(0, fileReducer_1.updateFiles)({ files: [logoFile] })] : []),
16
22
  (0, settingsViewReducer_1.updateInvoicingSettings)(response.data),
17
23
  ];
18
24
  }
@@ -7,6 +7,7 @@ const snackbarApiError_1 = require("../../../../entity/snackbar/snackbarApiError
7
7
  const snackbarReducer_1 = require("../../../../entity/snackbar/snackbarReducer");
8
8
  const responsePayload_1 = require("../../../../responsePayload");
9
9
  const settingsViewReducer_1 = require("../settingsViewReducer");
10
+ const fileReducer_1 = require("../../../../entity/file/fileReducer");
10
11
  const saveInvoicingSettingsEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(settingsViewReducer_1.saveInvoicingSettings.match), (0, operators_1.mergeMap)((action) => {
11
12
  const apiUrl = `${zeniAPI.apiEndPoints.invoicingMicroServiceBaseUrl}/1.0/settings`;
12
13
  const { settings, snackbarSection } = action.payload;
@@ -25,7 +26,13 @@ const saveInvoicingSettingsEpic = (actions$, _state$, zeniAPI) => actions$.pipe(
25
26
  .putAndGetJSON(apiUrl, { ...settings })
26
27
  .pipe((0, operators_1.switchMap)((response) => {
27
28
  if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
29
+ // Keep the file entity in step with what was persisted — the
30
+ // settings view resolves the logo by id, not from the response.
31
+ const savedLogoFile = response.data.logo_file;
28
32
  return (0, rxjs_1.from)([
33
+ ...(savedLogoFile != null
34
+ ? [(0, fileReducer_1.updateFiles)({ files: [savedLogoFile] })]
35
+ : []),
29
36
  (0, settingsViewReducer_1.saveInvoicingSettingsSuccess)(response.data),
30
37
  ...snackbar('success'),
31
38
  ]);
@@ -1,5 +1,6 @@
1
1
  import { updateAddresses } from '../../../../entity/address/addressReducer';
2
+ import { updateFiles } from '../../../../entity/file/fileReducer';
2
3
  import { openSnackbar } from '../../../../entity/snackbar/snackbarReducer';
3
4
  import { connectInvoicingStripe, disconnectInvoicingStripe, fetchInvoicingSettings, invoicingStripeConnectionFailure, saveInvoicingSettings, saveInvoicingSettingsFailure, saveInvoicingSettingsSuccess, submitInvoicingQboSettings, updateInvoicingSettings, updateInvoicingSettingsFailure, updateInvoicingStripeConnection } from '../settingsViewReducer';
4
5
  /** 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>;
6
+ 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 updateFiles> | ReturnType<typeof openSnackbar>;
@@ -25,7 +25,7 @@ const entityToInvoicingBrandingFormLocalData = (settings) => ({
25
25
  email: settings?.email ?? '',
26
26
  invoiceFooterText: settings?.invoice_footer_text ?? '',
27
27
  invoicePrefix: settings?.invoice_prefix ?? '',
28
- logoFileId: settings?.logo_file_id ?? '',
28
+ logoFileId: settings?.logo_file?.file_id ?? '',
29
29
  phone: settings?.phone ?? '',
30
30
  taxId: settings?.tax_id ?? '',
31
31
  });
@@ -1,6 +1,7 @@
1
1
  import { NestedAccountHierarchyForReport } from '../../../commonStateTypes/accountView/nestedAccountID';
2
2
  import { FetchState, FetchStateAndError } from '../../../commonStateTypes/common';
3
3
  import { InvoicingDunningActionOption, InvoicingFieldHelpByCode, InvoicingNamedOption, InvoicingQboAccountMappingKindOption, InvoicingSettingsPayload } from '../../../entity/invoicing/invoicingCommonPayload';
4
+ import { File } from '../../../entity/file/fileState';
4
5
  import { ZeniAPIStatus } from '../../../responsePayload';
5
6
  import { RootState } from '../../../rootStateTypes';
6
7
  import { InvoicingQboConnection, InvoicingQboSyncHealth } from '../invoicingQboView/invoicingQboViewPayload';
@@ -24,6 +25,13 @@ export interface InvoicingSettingsView {
24
25
  saveState: FetchStateAndError;
25
26
  stripeConnectState: FetchStateAndError;
26
27
  error?: ZeniAPIStatus;
28
+ /**
29
+ * The tenant's logo, read back out of the file entity the settings fetch
30
+ * stored it in. `undefined` when no logo is set — the settings response
31
+ * returns no record then, which is also how a logo deleted out from under a
32
+ * stale id reads, so the screen has nothing to show either way.
33
+ */
34
+ logoFile?: File;
27
35
  settings?: InvoicingSettingsPayload;
28
36
  }
29
37
  /**
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getInvoicingBrandingFormView = exports.getInvoicingQboSettingsFormView = exports.getInvoicingSettingsHubView = exports.getInvoicingSettingsView = exports.getInvoicingSettingsFetchState = exports.getInvoicingSettings = void 0;
4
4
  exports.deriveInvoicingEnablePrerequisites = deriveInvoicingEnablePrerequisites;
5
5
  const invoicingCommonPayload_1 = require("../../../entity/invoicing/invoicingCommonPayload");
6
+ const fileSelector_1 = require("../../../entity/file/fileSelector");
6
7
  const addressViewSelector_1 = require("../../addressView/addressViewSelector");
7
8
  const invoicingConfigViewSelector_1 = require("../invoicingConfigView/invoicingConfigViewSelector");
8
9
  const invoicingQboViewSelector_1 = require("../invoicingQboView/invoicingQboViewSelector");
@@ -31,10 +32,14 @@ exports.getInvoicingSettingsFetchState = getInvoicingSettingsFetchState;
31
32
  */
32
33
  const getInvoicingSettingsView = (state) => {
33
34
  const { error, fetchState, saveFetchState, settings, stripeFetchState } = state.invoicingSettingsViewState;
35
+ const logoFileId = settings?.logo_file?.file_id ?? '';
34
36
  return {
35
37
  fieldHelp: (0, invoicingConfigViewSelector_1.invoicingFieldHelpForGroup)(state, 'settings'),
36
38
  error,
37
39
  fetchState,
40
+ logoFile: logoFileId !== ''
41
+ ? (0, fileSelector_1.getFileByFileId)(state.fileState, logoFileId)
42
+ : undefined,
38
43
  saveState: saveFetchState,
39
44
  settings,
40
45
  stripeConnectState: stripeFetchState,
@@ -1,11 +1,12 @@
1
1
  import { ActionsObservable, StateObservable } from 'redux-observable';
2
2
  import { Observable } from 'rxjs';
3
3
  import { updateAddresses } from '../../../entity/address/addressReducer';
4
+ import { updateFiles } from '../../../entity/file/fileReducer';
4
5
  import { RootState } from '../../../rootStateTypes';
5
6
  import { ZeniAPI } from '../../../zeniAPI';
6
7
  import { resetNewAddressDataInLocalStore } from '../../addressView/addressViewReducer';
7
8
  import { saveInvoicingSettingsFailure, saveInvoicingSettingsSuccess, submitInvoicingBrandingForm } from './settingsViewReducer';
8
- export type SubmitActionType = ReturnType<typeof submitInvoicingBrandingForm> | ReturnType<typeof saveInvoicingSettingsSuccess> | ReturnType<typeof saveInvoicingSettingsFailure> | ReturnType<typeof resetNewAddressDataInLocalStore> | ReturnType<typeof updateAddresses>;
9
+ export type SubmitActionType = ReturnType<typeof submitInvoicingBrandingForm> | ReturnType<typeof saveInvoicingSettingsSuccess> | ReturnType<typeof saveInvoicingSettingsFailure> | ReturnType<typeof resetNewAddressDataInLocalStore> | ReturnType<typeof updateAddresses> | ReturnType<typeof updateFiles>;
9
10
  /**
10
11
  * On `submitInvoicingBrandingForm`, PUT the settings body built from the branding
11
12
  * draft + the business address captured via the shared Address screen. The
@@ -4,6 +4,7 @@ exports.submitInvoicingBrandingFormEpic = void 0;
4
4
  const rxjs_1 = require("rxjs");
5
5
  const operators_1 = require("rxjs/operators");
6
6
  const addressReducer_1 = require("../../../entity/address/addressReducer");
7
+ const fileReducer_1 = require("../../../entity/file/fileReducer");
7
8
  const responsePayload_1 = require("../../../responsePayload");
8
9
  const addressViewReducer_1 = require("../../addressView/addressViewReducer");
9
10
  const invoicingBrandingFormConfig_1 = require("./invoicingBrandingFormConfig");
@@ -26,10 +27,18 @@ const submitInvoicingBrandingFormEpic = (actions$, state$, zeniAPI) => actions$.
26
27
  .pipe((0, operators_1.mergeMap)((response) => {
27
28
  if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
28
29
  const savedAddress = response.data.address;
30
+ // The saved logo goes to the file entity for the same reason the
31
+ // saved address goes to the address entity: the settings view
32
+ // resolves the file by id, so without this a save that changes
33
+ // the logo leaves the view resolving an id nothing holds.
34
+ const savedLogoFile = response.data.logo_file;
29
35
  return [
30
36
  ...(savedAddress != null
31
37
  ? [(0, addressReducer_1.updateAddresses)([savedAddress])]
32
38
  : []),
39
+ ...(savedLogoFile != null
40
+ ? [(0, fileReducer_1.updateFiles)({ files: [savedLogoFile] })]
41
+ : []),
33
42
  (0, settingsViewReducer_1.saveInvoicingSettingsSuccess)(response.data),
34
43
  (0, addressViewReducer_1.resetNewAddressDataInLocalStore)(invoicingBrandingFormConfig_1.INVOICING_BUSINESS_ADDRESS_TYPE),
35
44
  ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "5.2.39",
3
+ "version": "5.2.41-beta1MM",
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",