@zeniai/client-epic-state 4.19.99-betaSS4 → 4.19.99-betaVR3

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.
@@ -24,13 +24,13 @@ const fetchJeSchedulesEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, op
24
24
  if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
25
25
  const updateActions = [];
26
26
  updateActions.push((0, jeSchedulesReducer_1.updateJESchedules)([
27
- ...response.data.je_schedules,
27
+ ...response.data.draft_je_schedules,
28
28
  ...response.data.failed_je_postings.je_schedules,
29
29
  ]), (0, jeSchedulesReducer_1.updateJESchedulesDetails)([...response.data.failed_je_postings.je_schedules], response.data.failed_je_postings.scheduled_journal_entries), (0, jeSchedulesViewReducer_1.initializeJeScheduleLocalData)([
30
30
  ...response.data.failed_je_postings.je_schedules,
31
31
  ]));
32
32
  updateActions.push((0, jeSchedulesViewReducer_1.fetchJeSchedulesSuccess)({
33
- jeSchedules: [...response.data.je_schedules],
33
+ jeSchedules: [...response.data.draft_je_schedules],
34
34
  failedJeSchedules: [
35
35
  ...response.data.failed_je_postings.je_schedules,
36
36
  ],
@@ -10,11 +10,11 @@ export interface ExpenseAutomationJESchedulesQueryPayload {
10
10
  start_date: string;
11
11
  }
12
12
  interface ExpenseAutomationJESchedulesPayload {
13
+ draft_je_schedules: JEScheduledTransactionPayload[];
13
14
  failed_je_postings: {
14
15
  je_schedules: JEScheduledTransactionPayload[];
15
16
  scheduled_journal_entries: ScheduledJournalEntryPayload[];
16
17
  };
17
- je_schedules: JEScheduledTransactionPayload[];
18
18
  }
19
19
  export type ExpenseAutomationJESchedulesResponse = ZeniAPIResponse<ExpenseAutomationJESchedulesPayload>;
20
20
  export interface IgnoreDraftJESchedulePayload {
@@ -42,17 +42,17 @@ function enrichHorizontalSection(report, section) {
42
42
  };
43
43
  const siblingsPerRow = buildSiblingIndicesPerRow(section.accounts, parentIndices);
44
44
  const hasChildFlags = computeHorizontalHasChildFlags(parentIndices);
45
- for (let accountIndex = 0; accountIndex < section.accounts.length; accountIndex++) {
46
- const row = section.accounts[accountIndex];
45
+ for (let i = 0; i < section.accounts.length; i++) {
46
+ const row = section.accounts[i];
47
47
  // Same column order as `report.classColumns` (see `pivotSectionToHorizontal`).
48
- const classRowAmounts = row.classBalances.map((classBalance) => classBalance.balance.amount);
48
+ const classRowAmounts = row.classBalances.map((b) => b.balance.amount);
49
49
  row.accountReportData = {
50
50
  accountId: row.accountId,
51
51
  accountName: row.accountName,
52
52
  accountType: row.accountType,
53
53
  depth: row.depth,
54
54
  balancesInTimeframe: buildHorizontalClassColumnBalancesSlice(report, classRowAmounts, row.rowTotal.amount),
55
- horizontalTreeView: buildHorizontalTreeViewFromPrecomputed(section.accounts, accountIndex, parentIndices, siblingsPerRow, hasChildFlags),
55
+ horizontalTreeView: buildHorizontalTreeViewFromPrecomputed(section.accounts, i, parentIndices, siblingsPerRow, hasChildFlags),
56
56
  };
57
57
  }
58
58
  }
@@ -84,9 +84,9 @@ function buildHorizontalClassColumnBalancesSlice(report, classAmounts, totalAmou
84
84
  return emptySlice;
85
85
  }
86
86
  const { startDate, endDate } = report.selectedPeriod;
87
- const balances = report.classColumns.map((col, columnIndex) => ({
87
+ const balances = report.classColumns.map((col, i) => ({
88
88
  balance: {
89
- amount: classAmounts[columnIndex] ?? 0,
89
+ amount: classAmounts[i] ?? 0,
90
90
  currencyCode,
91
91
  currencySymbol,
92
92
  },
@@ -137,23 +137,23 @@ function computeHorizontalAccountParentIndices(rows) {
137
137
  if (accountRow == null) {
138
138
  continue;
139
139
  }
140
- const depth = accountRow.depth;
140
+ const d = accountRow.depth;
141
141
  while (stack.length > 0) {
142
- const topIndex = stack[stack.length - 1];
143
- if (topIndex == null) {
142
+ const topIdx = stack[stack.length - 1];
143
+ if (topIdx == null) {
144
144
  break;
145
145
  }
146
- const topRow = rows[topIndex];
146
+ const topRow = rows[topIdx];
147
147
  if (topRow == null) {
148
148
  stack.pop();
149
149
  continue;
150
150
  }
151
- if (topRow.depth < depth) {
151
+ if (topRow.depth < d) {
152
152
  break;
153
153
  }
154
154
  stack.pop();
155
155
  }
156
- if (depth <= 2) {
156
+ if (d <= 2) {
157
157
  parentIndex[rowIndex] = -1;
158
158
  }
159
159
  else if (stack.length === 0) {
@@ -167,7 +167,7 @@ function computeHorizontalAccountParentIndices(rows) {
167
167
  else {
168
168
  const parentRow = rows[peek];
169
169
  parentIndex[rowIndex] =
170
- parentRow != null && parentRow.depth === depth - 1 ? peek : -1;
170
+ parentRow != null && parentRow.depth === d - 1 ? peek : -1;
171
171
  }
172
172
  }
173
173
  stack.push(rowIndex);
@@ -185,12 +185,12 @@ function buildSiblingIndicesPerRow(rows, parentIndices) {
185
185
  continue;
186
186
  }
187
187
  const key = `${parentRowIndex}:${accountRow.depth}`;
188
- let siblingGroup = keyToIndices.get(key);
189
- if (siblingGroup == null) {
190
- siblingGroup = [];
191
- keyToIndices.set(key, siblingGroup);
188
+ let g = keyToIndices.get(key);
189
+ if (g == null) {
190
+ g = [];
191
+ keyToIndices.set(key, g);
192
192
  }
193
- siblingGroup.push(rowIndex);
193
+ g.push(rowIndex);
194
194
  }
195
195
  const siblingsPerRow = new Array(accountRowCount);
196
196
  for (let rowIndex = 0; rowIndex < accountRowCount; rowIndex++) {
@@ -258,14 +258,14 @@ function buildHorizontalTreeViewFromPrecomputed(dfsOrderedAccountRows, currentRo
258
258
  const hasChildrenFlag = hasChildFlags[currentRowIndex];
259
259
  const treeDepth = accountRow != null ? Math.max(0, accountRow.depth - 2) : 0;
260
260
  const hasChildren = hasChildrenFlag === true;
261
- const siblings = siblingIndices ?? [currentRowIndex];
261
+ const sibs = siblingIndices ?? [currentRowIndex];
262
262
  return {
263
263
  subAccountAncestorMetadata: buildHorizontalSubAccountAncestorMetadataFromPrecomputed(dfsOrderedAccountRows, currentRowIndex, parentIndices, siblingsPerRow, hasChildFlags),
264
264
  treeDepth,
265
265
  hasChildren,
266
- hasSiblings: siblings.length > 1,
266
+ hasSiblings: sibs.length > 1,
267
267
  isLeaf: !hasChildren,
268
- isLastNode: currentRowIndex === siblings[siblings.length - 1],
268
+ isLastNode: currentRowIndex === sibs[sibs.length - 1],
269
269
  };
270
270
  }
271
271
  function buildHorizontalAccountChildIndicesByParent(parentIndices) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "4.19.99-betaSS4",
3
+ "version": "4.19.99-betaVR3",
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",