@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.
@@ -21,13 +21,13 @@ export const fetchJeSchedulesEpic = (actions$, state$, zeniAPI) => actions$.pipe
21
21
  if (isSuccessResponse(response) && response.data != null) {
22
22
  const updateActions = [];
23
23
  updateActions.push(updateJESchedules([
24
- ...response.data.je_schedules,
24
+ ...response.data.draft_je_schedules,
25
25
  ...response.data.failed_je_postings.je_schedules,
26
26
  ]), updateJESchedulesDetails([...response.data.failed_je_postings.je_schedules], response.data.failed_je_postings.scheduled_journal_entries), initializeJeScheduleLocalData([
27
27
  ...response.data.failed_je_postings.je_schedules,
28
28
  ]));
29
29
  updateActions.push(fetchJeSchedulesSuccess({
30
- jeSchedules: [...response.data.je_schedules],
30
+ jeSchedules: [...response.data.draft_je_schedules],
31
31
  failedJeSchedules: [
32
32
  ...response.data.failed_je_postings.je_schedules,
33
33
  ],
@@ -39,17 +39,17 @@ function enrichHorizontalSection(report, section) {
39
39
  };
40
40
  const siblingsPerRow = buildSiblingIndicesPerRow(section.accounts, parentIndices);
41
41
  const hasChildFlags = computeHorizontalHasChildFlags(parentIndices);
42
- for (let accountIndex = 0; accountIndex < section.accounts.length; accountIndex++) {
43
- const row = section.accounts[accountIndex];
42
+ for (let i = 0; i < section.accounts.length; i++) {
43
+ const row = section.accounts[i];
44
44
  // Same column order as `report.classColumns` (see `pivotSectionToHorizontal`).
45
- const classRowAmounts = row.classBalances.map((classBalance) => classBalance.balance.amount);
45
+ const classRowAmounts = row.classBalances.map((b) => b.balance.amount);
46
46
  row.accountReportData = {
47
47
  accountId: row.accountId,
48
48
  accountName: row.accountName,
49
49
  accountType: row.accountType,
50
50
  depth: row.depth,
51
51
  balancesInTimeframe: buildHorizontalClassColumnBalancesSlice(report, classRowAmounts, row.rowTotal.amount),
52
- horizontalTreeView: buildHorizontalTreeViewFromPrecomputed(section.accounts, accountIndex, parentIndices, siblingsPerRow, hasChildFlags),
52
+ horizontalTreeView: buildHorizontalTreeViewFromPrecomputed(section.accounts, i, parentIndices, siblingsPerRow, hasChildFlags),
53
53
  };
54
54
  }
55
55
  }
@@ -81,9 +81,9 @@ function buildHorizontalClassColumnBalancesSlice(report, classAmounts, totalAmou
81
81
  return emptySlice;
82
82
  }
83
83
  const { startDate, endDate } = report.selectedPeriod;
84
- const balances = report.classColumns.map((col, columnIndex) => ({
84
+ const balances = report.classColumns.map((col, i) => ({
85
85
  balance: {
86
- amount: classAmounts[columnIndex] ?? 0,
86
+ amount: classAmounts[i] ?? 0,
87
87
  currencyCode,
88
88
  currencySymbol,
89
89
  },
@@ -134,23 +134,23 @@ function computeHorizontalAccountParentIndices(rows) {
134
134
  if (accountRow == null) {
135
135
  continue;
136
136
  }
137
- const depth = accountRow.depth;
137
+ const d = accountRow.depth;
138
138
  while (stack.length > 0) {
139
- const topIndex = stack[stack.length - 1];
140
- if (topIndex == null) {
139
+ const topIdx = stack[stack.length - 1];
140
+ if (topIdx == null) {
141
141
  break;
142
142
  }
143
- const topRow = rows[topIndex];
143
+ const topRow = rows[topIdx];
144
144
  if (topRow == null) {
145
145
  stack.pop();
146
146
  continue;
147
147
  }
148
- if (topRow.depth < depth) {
148
+ if (topRow.depth < d) {
149
149
  break;
150
150
  }
151
151
  stack.pop();
152
152
  }
153
- if (depth <= 2) {
153
+ if (d <= 2) {
154
154
  parentIndex[rowIndex] = -1;
155
155
  }
156
156
  else if (stack.length === 0) {
@@ -164,7 +164,7 @@ function computeHorizontalAccountParentIndices(rows) {
164
164
  else {
165
165
  const parentRow = rows[peek];
166
166
  parentIndex[rowIndex] =
167
- parentRow != null && parentRow.depth === depth - 1 ? peek : -1;
167
+ parentRow != null && parentRow.depth === d - 1 ? peek : -1;
168
168
  }
169
169
  }
170
170
  stack.push(rowIndex);
@@ -182,12 +182,12 @@ function buildSiblingIndicesPerRow(rows, parentIndices) {
182
182
  continue;
183
183
  }
184
184
  const key = `${parentRowIndex}:${accountRow.depth}`;
185
- let siblingGroup = keyToIndices.get(key);
186
- if (siblingGroup == null) {
187
- siblingGroup = [];
188
- keyToIndices.set(key, siblingGroup);
185
+ let g = keyToIndices.get(key);
186
+ if (g == null) {
187
+ g = [];
188
+ keyToIndices.set(key, g);
189
189
  }
190
- siblingGroup.push(rowIndex);
190
+ g.push(rowIndex);
191
191
  }
192
192
  const siblingsPerRow = new Array(accountRowCount);
193
193
  for (let rowIndex = 0; rowIndex < accountRowCount; rowIndex++) {
@@ -255,14 +255,14 @@ function buildHorizontalTreeViewFromPrecomputed(dfsOrderedAccountRows, currentRo
255
255
  const hasChildrenFlag = hasChildFlags[currentRowIndex];
256
256
  const treeDepth = accountRow != null ? Math.max(0, accountRow.depth - 2) : 0;
257
257
  const hasChildren = hasChildrenFlag === true;
258
- const siblings = siblingIndices ?? [currentRowIndex];
258
+ const sibs = siblingIndices ?? [currentRowIndex];
259
259
  return {
260
260
  subAccountAncestorMetadata: buildHorizontalSubAccountAncestorMetadataFromPrecomputed(dfsOrderedAccountRows, currentRowIndex, parentIndices, siblingsPerRow, hasChildFlags),
261
261
  treeDepth,
262
262
  hasChildren,
263
- hasSiblings: siblings.length > 1,
263
+ hasSiblings: sibs.length > 1,
264
264
  isLeaf: !hasChildren,
265
- isLastNode: currentRowIndex === siblings[siblings.length - 1],
265
+ isLastNode: currentRowIndex === sibs[sibs.length - 1],
266
266
  };
267
267
  }
268
268
  function buildHorizontalAccountChildIndicesByParent(parentIndices) {