@zeniai/client-epic-state 5.3.14-beta0MM → 5.3.14-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 (20) hide show
  1. package/lib/entity/actualMatching/actualMatchingPayload.d.ts +1 -0
  2. package/lib/entity/actualMatching/actualMatchingPayload.js +3 -0
  3. package/lib/entity/actualMatching/actualMatchingReducer.js +1 -1
  4. package/lib/entity/actualMatching/actualMatchingState.d.ts +1 -0
  5. package/lib/entity/actualMatching/actualMatchingTypes.d.ts +6 -2
  6. package/lib/entity/actualMatching/actualMatchingTypes.js +12 -4
  7. package/lib/esm/entity/actualMatching/actualMatchingPayload.js +3 -0
  8. package/lib/esm/entity/actualMatching/actualMatchingReducer.js +1 -1
  9. package/lib/esm/entity/actualMatching/actualMatchingTypes.js +12 -4
  10. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/actualMatching/fetchActualMatchingEpic.js +1 -1
  11. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/actualMatching/fetchActualMatchingMatchEpic.js +13 -4
  12. package/lib/esm/view/expenseAutomationView/reducers/actualMatchingViewReducer.js +10 -8
  13. package/lib/esm/view/expenseAutomationView/selectors/actualMatchingViewSelector.js +1 -0
  14. package/lib/view/expenseAutomationView/epics/jeSchedule/actualMatching/fetchActualMatchingEpic.js +1 -1
  15. package/lib/view/expenseAutomationView/epics/jeSchedule/actualMatching/fetchActualMatchingMatchEpic.js +13 -4
  16. package/lib/view/expenseAutomationView/reducers/actualMatchingViewReducer.d.ts +5 -2
  17. package/lib/view/expenseAutomationView/reducers/actualMatchingViewReducer.js +10 -8
  18. package/lib/view/expenseAutomationView/selectorTypes/actualMatchingViewSelectorTypes.d.ts +1 -0
  19. package/lib/view/expenseAutomationView/selectors/actualMatchingViewSelector.js +1 -0
  20. package/package.json +1 -1
@@ -20,6 +20,7 @@ export interface ActualMatchingMatchPayload {
20
20
  match_batch_id?: string | null;
21
21
  match_shape?: string | null;
22
22
  match_tier?: string | null;
23
+ suggestion_key?: string | null;
23
24
  transaction_date?: string | null;
24
25
  vendor_id?: ID | null;
25
26
  vendor_name?: string | null;
@@ -37,6 +37,9 @@ function toActualMatchingMatch(payload, fallbackCurrency) {
37
37
  matchBatchId: payload.match_batch_id != null && payload.match_batch_id !== ''
38
38
  ? payload.match_batch_id
39
39
  : undefined,
40
+ suggestionKey: payload.suggestion_key != null && payload.suggestion_key !== ''
41
+ ? payload.suggestion_key
42
+ : undefined,
40
43
  transactionType: (payload.transaction_type || '').toLowerCase(),
41
44
  transactionIntegrationId: payload.transaction_integration_id,
42
45
  transactionDate: payload.transaction_date ?? undefined,
@@ -20,7 +20,7 @@ const actualMatching = (0, toolkit_1.createSlice)({
20
20
  reducer(draft, action) {
21
21
  action.payload.matches.forEach((payload) => {
22
22
  const match = (0, actualMatchingPayload_1.toActualMatchingMatch)(payload, action.payload.fallbackCurrency);
23
- draft.byMatchId[(0, actualMatchingTypes_1.actualMatchingRowKey)(match.matchId, match.matchBatchId)] = match;
23
+ draft.byMatchId[(0, actualMatchingTypes_1.actualMatchingRowKey)(match.matchId, match.matchBatchId, match.suggestionKey)] = match;
24
24
  });
25
25
  },
26
26
  },
@@ -15,6 +15,7 @@ export interface ActualMatchingMatch {
15
15
  matchBatchId?: string;
16
16
  matchShape?: string;
17
17
  matchTier?: string;
18
+ suggestionKey?: string;
18
19
  transactionDate?: string;
19
20
  vendorId?: ID;
20
21
  vendorName?: string;
@@ -1,3 +1,7 @@
1
1
  export type ActualMatchingMatchId = string;
2
- /** Store and status key. The route match id stays ``type:id``; the batch is separate. */
3
- export declare function actualMatchingRowKey(matchId: string, matchBatchId?: string | null): string;
2
+ /** Store and status key. The route match id stays ``type:id``.
3
+
4
+ The second part is the cleared ``match_batch_id`` when one exists, otherwise the
5
+ pending suggestion's ``suggestion_key``.
6
+ */
7
+ export declare function actualMatchingRowKey(matchId: string, matchBatchId?: string | null, suggestionKey?: string | null): string;
@@ -1,11 +1,19 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.actualMatchingRowKey = actualMatchingRowKey;
4
- /** Store and status key. The route match id stays ``type:id``; the batch is separate. */
5
- function actualMatchingRowKey(matchId, matchBatchId) {
4
+ /** Store and status key. The route match id stays ``type:id``.
5
+
6
+ The second part is the cleared ``match_batch_id`` when one exists, otherwise the
7
+ pending suggestion's ``suggestion_key``.
8
+ */
9
+ function actualMatchingRowKey(matchId, matchBatchId, suggestionKey) {
6
10
  const batch = (matchBatchId ?? '').trim();
7
- if (batch === '') {
11
+ if (batch !== '') {
12
+ return `${matchId}\u0000${batch}`;
13
+ }
14
+ const suggestion = (suggestionKey ?? '').trim();
15
+ if (suggestion === '') {
8
16
  return matchId;
9
17
  }
10
- return `${matchId}\u0000${batch}`;
18
+ return `${matchId}\u0000${suggestion}`;
11
19
  }
@@ -33,6 +33,9 @@ export function toActualMatchingMatch(payload, fallbackCurrency) {
33
33
  matchBatchId: payload.match_batch_id != null && payload.match_batch_id !== ''
34
34
  ? payload.match_batch_id
35
35
  : undefined,
36
+ suggestionKey: payload.suggestion_key != null && payload.suggestion_key !== ''
37
+ ? payload.suggestion_key
38
+ : undefined,
36
39
  transactionType: (payload.transaction_type || '').toLowerCase(),
37
40
  transactionIntegrationId: payload.transaction_integration_id,
38
41
  transactionDate: payload.transaction_date ?? undefined,
@@ -16,7 +16,7 @@ const actualMatching = createSlice({
16
16
  reducer(draft, action) {
17
17
  action.payload.matches.forEach((payload) => {
18
18
  const match = toActualMatchingMatch(payload, action.payload.fallbackCurrency);
19
- draft.byMatchId[actualMatchingRowKey(match.matchId, match.matchBatchId)] = match;
19
+ draft.byMatchId[actualMatchingRowKey(match.matchId, match.matchBatchId, match.suggestionKey)] = match;
20
20
  });
21
21
  },
22
22
  },
@@ -1,8 +1,16 @@
1
- /** Store and status key. The route match id stays ``type:id``; the batch is separate. */
2
- export function actualMatchingRowKey(matchId, matchBatchId) {
1
+ /** Store and status key. The route match id stays ``type:id``.
2
+
3
+ The second part is the cleared ``match_batch_id`` when one exists, otherwise the
4
+ pending suggestion's ``suggestion_key``.
5
+ */
6
+ export function actualMatchingRowKey(matchId, matchBatchId, suggestionKey) {
3
7
  const batch = (matchBatchId ?? '').trim();
4
- if (batch === '') {
8
+ if (batch !== '') {
9
+ return `${matchId}\u0000${batch}`;
10
+ }
11
+ const suggestion = (suggestionKey ?? '').trim();
12
+ if (suggestion === '') {
5
13
  return matchId;
6
14
  }
7
- return `${matchId}\u0000${batch}`;
15
+ return `${matchId}\u0000${suggestion}`;
8
16
  }
@@ -27,7 +27,7 @@ export const fetchActualMatchingEpic = (actions$, state$, zeniAPI) => actions$.p
27
27
  updateActions.push(updateActualMatchingMatches(matches, getTenantDisplayCurrency(state)));
28
28
  }
29
29
  updateActions.push(fetchActualMatchingSuccess({
30
- matchIds: matches.map((match) => actualMatchingRowKey(match.match_id, match.match_batch_id)),
30
+ matchIds: matches.map((match) => actualMatchingRowKey(match.match_id, match.match_batch_id, match.suggestion_key)),
31
31
  selectedPeriod: requestPeriod,
32
32
  refreshViewInBackground,
33
33
  }));
@@ -6,10 +6,16 @@ import { clearAll } from '../../../../../rootActions';
6
6
  import { fetchActualMatchingMatch, fetchActualMatchingMatchFailure, fetchActualMatchingMatchSuccess, } from '../../../reducers/actualMatchingViewReducer';
7
7
  import { getTenantDisplayCurrency } from '../../../selectors/actualMatchingViewSelector';
8
8
  export const fetchActualMatchingMatchEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter(fetchActualMatchingMatch.match), mergeMap((action) => {
9
- const { matchId, matchBatchId, refreshViewInBackground } = action.payload;
10
- const batchQuery = matchBatchId != null && matchBatchId !== ''
11
- ? `?batch_id=${encodeURIComponent(matchBatchId)}`
12
- : '';
9
+ const { suggestionKey, matchBatchId, matchId, refreshViewInBackground } = action.payload;
10
+ const detailQuery = new URLSearchParams();
11
+ if (matchBatchId != null && matchBatchId !== '') {
12
+ detailQuery.set('batch_id', matchBatchId);
13
+ }
14
+ else if (suggestionKey != null && suggestionKey !== '') {
15
+ detailQuery.set('suggestion_key', suggestionKey);
16
+ }
17
+ const encodedQuery = detailQuery.toString();
18
+ const batchQuery = encodedQuery === '' ? '' : `?${encodedQuery}`;
13
19
  return zeniAPI
14
20
  .getJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/accruals/actual-matching/${encodeURIComponent(matchId)}${batchQuery}`)
15
21
  .pipe(mergeMap((response) => {
@@ -17,6 +23,7 @@ export const fetchActualMatchingMatchEpic = (actions$, state$, zeniAPI) => actio
17
23
  return from([
18
24
  updateActualMatchingMatches([response.data], getTenantDisplayCurrency(state$.value)),
19
25
  fetchActualMatchingMatchSuccess({
26
+ suggestionKey,
20
27
  matchId,
21
28
  matchBatchId,
22
29
  refreshViewInBackground,
@@ -25,6 +32,7 @@ export const fetchActualMatchingMatchEpic = (actions$, state$, zeniAPI) => actio
25
32
  }
26
33
  return from([
27
34
  fetchActualMatchingMatchFailure({
35
+ suggestionKey,
28
36
  matchId,
29
37
  matchBatchId,
30
38
  refreshViewInBackground,
@@ -33,6 +41,7 @@ export const fetchActualMatchingMatchEpic = (actions$, state$, zeniAPI) => actio
33
41
  ]);
34
42
  }), catchError((error) => from([
35
43
  fetchActualMatchingMatchFailure({
44
+ suggestionKey,
36
45
  matchId,
37
46
  matchBatchId,
38
47
  refreshViewInBackground,
@@ -184,12 +184,14 @@ const expenseAutomationActualMatchingView = createSlice({
184
184
  }
185
185
  },
186
186
  fetchActualMatchingMatch: {
187
- prepare(matchId, refreshViewInBackground = false, matchBatchId) {
188
- return { payload: { matchId, matchBatchId, refreshViewInBackground } };
187
+ prepare(matchId, refreshViewInBackground = false, matchBatchId, suggestionKey) {
188
+ return {
189
+ payload: { suggestionKey, matchBatchId, matchId, refreshViewInBackground },
190
+ };
189
191
  },
190
192
  reducer(draft, action) {
191
- const { matchId, matchBatchId, refreshViewInBackground } = action.payload;
192
- const rowKey = actualMatchingRowKey(matchId, matchBatchId);
193
+ const { suggestionKey, matchBatchId, matchId, refreshViewInBackground } = action.payload;
194
+ const rowKey = actualMatchingRowKey(matchId, matchBatchId, suggestionKey);
193
195
  if (refreshViewInBackground) {
194
196
  draft.detailRefreshStatusByMatchId[rowKey] = {
195
197
  fetchState: 'In-Progress',
@@ -205,8 +207,8 @@ const expenseAutomationActualMatchingView = createSlice({
205
207
  },
206
208
  },
207
209
  fetchActualMatchingMatchSuccess(draft, action) {
208
- const { matchId, matchBatchId, refreshViewInBackground } = action.payload;
209
- const rowKey = actualMatchingRowKey(matchId, matchBatchId);
210
+ const { suggestionKey, matchBatchId, matchId, refreshViewInBackground } = action.payload;
211
+ const rowKey = actualMatchingRowKey(matchId, matchBatchId, suggestionKey);
210
212
  if (refreshViewInBackground) {
211
213
  draft.detailRefreshStatusByMatchId[rowKey] = {
212
214
  fetchState: 'Completed',
@@ -221,8 +223,8 @@ const expenseAutomationActualMatchingView = createSlice({
221
223
  }
222
224
  },
223
225
  fetchActualMatchingMatchFailure(draft, action) {
224
- const { matchId, matchBatchId, refreshViewInBackground, status } = action.payload;
225
- const rowKey = actualMatchingRowKey(matchId, matchBatchId);
226
+ const { suggestionKey, matchBatchId, matchId, refreshViewInBackground, status } = action.payload;
227
+ const rowKey = actualMatchingRowKey(matchId, matchBatchId, suggestionKey);
226
228
  if (refreshViewInBackground) {
227
229
  draft.detailRefreshStatusByMatchId[rowKey] = {
228
230
  fetchState: 'Error',
@@ -130,6 +130,7 @@ function toActualMatchingRow(match) {
130
130
  ];
131
131
  return {
132
132
  ...first,
133
+ suggestionKey: match.suggestionKey,
133
134
  matchId: match.matchId,
134
135
  matchBatchId: match.matchBatchId,
135
136
  kind: match.kind,
@@ -30,7 +30,7 @@ const fetchActualMatchingEpic = (actions$, state$, zeniAPI) => actions$.pipe((0,
30
30
  updateActions.push((0, actualMatchingReducer_1.updateActualMatchingMatches)(matches, (0, actualMatchingViewSelector_1.getTenantDisplayCurrency)(state)));
31
31
  }
32
32
  updateActions.push((0, actualMatchingViewReducer_1.fetchActualMatchingSuccess)({
33
- matchIds: matches.map((match) => (0, actualMatchingTypes_1.actualMatchingRowKey)(match.match_id, match.match_batch_id)),
33
+ matchIds: matches.map((match) => (0, actualMatchingTypes_1.actualMatchingRowKey)(match.match_id, match.match_batch_id, match.suggestion_key)),
34
34
  selectedPeriod: requestPeriod,
35
35
  refreshViewInBackground,
36
36
  }));
@@ -9,10 +9,16 @@ const rootActions_1 = require("../../../../../rootActions");
9
9
  const actualMatchingViewReducer_1 = require("../../../reducers/actualMatchingViewReducer");
10
10
  const actualMatchingViewSelector_1 = require("../../../selectors/actualMatchingViewSelector");
11
11
  const fetchActualMatchingMatchEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(actualMatchingViewReducer_1.fetchActualMatchingMatch.match), (0, operators_1.mergeMap)((action) => {
12
- const { matchId, matchBatchId, refreshViewInBackground } = action.payload;
13
- const batchQuery = matchBatchId != null && matchBatchId !== ''
14
- ? `?batch_id=${encodeURIComponent(matchBatchId)}`
15
- : '';
12
+ const { suggestionKey, matchBatchId, matchId, refreshViewInBackground } = action.payload;
13
+ const detailQuery = new URLSearchParams();
14
+ if (matchBatchId != null && matchBatchId !== '') {
15
+ detailQuery.set('batch_id', matchBatchId);
16
+ }
17
+ else if (suggestionKey != null && suggestionKey !== '') {
18
+ detailQuery.set('suggestion_key', suggestionKey);
19
+ }
20
+ const encodedQuery = detailQuery.toString();
21
+ const batchQuery = encodedQuery === '' ? '' : `?${encodedQuery}`;
16
22
  return zeniAPI
17
23
  .getJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/accruals/actual-matching/${encodeURIComponent(matchId)}${batchQuery}`)
18
24
  .pipe((0, operators_1.mergeMap)((response) => {
@@ -20,6 +26,7 @@ const fetchActualMatchingMatchEpic = (actions$, state$, zeniAPI) => actions$.pip
20
26
  return (0, rxjs_1.from)([
21
27
  (0, actualMatchingReducer_1.updateActualMatchingMatches)([response.data], (0, actualMatchingViewSelector_1.getTenantDisplayCurrency)(state$.value)),
22
28
  (0, actualMatchingViewReducer_1.fetchActualMatchingMatchSuccess)({
29
+ suggestionKey,
23
30
  matchId,
24
31
  matchBatchId,
25
32
  refreshViewInBackground,
@@ -28,6 +35,7 @@ const fetchActualMatchingMatchEpic = (actions$, state$, zeniAPI) => actions$.pip
28
35
  }
29
36
  return (0, rxjs_1.from)([
30
37
  (0, actualMatchingViewReducer_1.fetchActualMatchingMatchFailure)({
38
+ suggestionKey,
31
39
  matchId,
32
40
  matchBatchId,
33
41
  refreshViewInBackground,
@@ -36,6 +44,7 @@ const fetchActualMatchingMatchEpic = (actions$, state$, zeniAPI) => actions$.pip
36
44
  ]);
37
45
  }), (0, operators_1.catchError)((error) => (0, rxjs_1.from)([
38
46
  (0, actualMatchingViewReducer_1.fetchActualMatchingMatchFailure)({
47
+ suggestionKey,
39
48
  matchId,
40
49
  matchBatchId,
41
50
  refreshViewInBackground,
@@ -14,19 +14,22 @@ export declare const ackCloseMatchAfterIgnore: import("@reduxjs/toolkit").Action
14
14
  refreshViewInBackground: boolean;
15
15
  selectedPeriod: MonthYearPeriod;
16
16
  status: ZeniAPIStatus;
17
- }, "expenseAutomationActualMatchingView/fetchActualMatchingFailure">, fetchActualMatchingMatch: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[matchId: string, refreshViewInBackground?: any, matchBatchId?: string | undefined], {
18
- matchId: string;
17
+ }, "expenseAutomationActualMatchingView/fetchActualMatchingFailure">, fetchActualMatchingMatch: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[matchId: string, refreshViewInBackground?: any, matchBatchId?: string | undefined, suggestionKey?: string | undefined], {
18
+ suggestionKey: string | undefined;
19
19
  matchBatchId: string | undefined;
20
+ matchId: string;
20
21
  refreshViewInBackground: any;
21
22
  }, "expenseAutomationActualMatchingView/fetchActualMatchingMatch", never, never>, fetchActualMatchingMatchFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
22
23
  matchId: ActualMatchingMatchId;
23
24
  refreshViewInBackground: boolean;
24
25
  status: ZeniAPIStatus;
25
26
  matchBatchId?: string;
27
+ suggestionKey?: string;
26
28
  }, "expenseAutomationActualMatchingView/fetchActualMatchingMatchFailure">, fetchActualMatchingMatchSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
27
29
  matchId: ActualMatchingMatchId;
28
30
  refreshViewInBackground: boolean;
29
31
  matchBatchId?: string;
32
+ suggestionKey?: string;
30
33
  }, "expenseAutomationActualMatchingView/fetchActualMatchingMatchSuccess">, fetchActualMatchingPage: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[period: TimePeriod, refreshViewInBackground?: any], {
31
34
  period: TimePeriod;
32
35
  refreshViewInBackground: any;
@@ -188,12 +188,14 @@ const expenseAutomationActualMatchingView = (0, toolkit_1.createSlice)({
188
188
  }
189
189
  },
190
190
  fetchActualMatchingMatch: {
191
- prepare(matchId, refreshViewInBackground = false, matchBatchId) {
192
- return { payload: { matchId, matchBatchId, refreshViewInBackground } };
191
+ prepare(matchId, refreshViewInBackground = false, matchBatchId, suggestionKey) {
192
+ return {
193
+ payload: { suggestionKey, matchBatchId, matchId, refreshViewInBackground },
194
+ };
193
195
  },
194
196
  reducer(draft, action) {
195
- const { matchId, matchBatchId, refreshViewInBackground } = action.payload;
196
- const rowKey = (0, actualMatchingTypes_1.actualMatchingRowKey)(matchId, matchBatchId);
197
+ const { suggestionKey, matchBatchId, matchId, refreshViewInBackground } = action.payload;
198
+ const rowKey = (0, actualMatchingTypes_1.actualMatchingRowKey)(matchId, matchBatchId, suggestionKey);
197
199
  if (refreshViewInBackground) {
198
200
  draft.detailRefreshStatusByMatchId[rowKey] = {
199
201
  fetchState: 'In-Progress',
@@ -209,8 +211,8 @@ const expenseAutomationActualMatchingView = (0, toolkit_1.createSlice)({
209
211
  },
210
212
  },
211
213
  fetchActualMatchingMatchSuccess(draft, action) {
212
- const { matchId, matchBatchId, refreshViewInBackground } = action.payload;
213
- const rowKey = (0, actualMatchingTypes_1.actualMatchingRowKey)(matchId, matchBatchId);
214
+ const { suggestionKey, matchBatchId, matchId, refreshViewInBackground } = action.payload;
215
+ const rowKey = (0, actualMatchingTypes_1.actualMatchingRowKey)(matchId, matchBatchId, suggestionKey);
214
216
  if (refreshViewInBackground) {
215
217
  draft.detailRefreshStatusByMatchId[rowKey] = {
216
218
  fetchState: 'Completed',
@@ -225,8 +227,8 @@ const expenseAutomationActualMatchingView = (0, toolkit_1.createSlice)({
225
227
  }
226
228
  },
227
229
  fetchActualMatchingMatchFailure(draft, action) {
228
- const { matchId, matchBatchId, refreshViewInBackground, status } = action.payload;
229
- const rowKey = (0, actualMatchingTypes_1.actualMatchingRowKey)(matchId, matchBatchId);
230
+ const { suggestionKey, matchBatchId, matchId, refreshViewInBackground, status } = action.payload;
231
+ const rowKey = (0, actualMatchingTypes_1.actualMatchingRowKey)(matchId, matchBatchId, suggestionKey);
230
232
  if (refreshViewInBackground) {
231
233
  draft.detailRefreshStatusByMatchId[rowKey] = {
232
234
  fetchState: 'Error',
@@ -27,6 +27,7 @@ export interface ActualMatchingRow extends JEOneTimeAccrual {
27
27
  matchShape?: string;
28
28
  matchTier?: string;
29
29
  reversalDate?: ZeniDate;
30
+ suggestionKey?: string;
30
31
  transactionDate?: string;
31
32
  transactionType?: string;
32
33
  }
@@ -152,6 +152,7 @@ function toActualMatchingRow(match) {
152
152
  ];
153
153
  return {
154
154
  ...first,
155
+ suggestionKey: match.suggestionKey,
155
156
  matchId: match.matchId,
156
157
  matchBatchId: match.matchBatchId,
157
158
  kind: match.kind,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "5.3.14-beta0MM",
3
+ "version": "5.3.14-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",