@zeniai/client-epic-state 5.1.88-betaRD10 → 5.1.88-betaRD11

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.
@@ -76,7 +76,9 @@ export interface JEScheduledTransactionPayload {
76
76
  create_time?: string | null;
77
77
  created_by?: UserPayload;
78
78
  end_date?: string | null;
79
+ posted_count?: number | null;
79
80
  recommendations?: JEScheduleRecommendationsPayload;
81
+ recurring_amount?: number | null;
80
82
  updated_at?: string | null;
81
83
  }
82
84
  export interface JEAccruedScheduledTransactionPayload extends Omit<JEScheduledTransactionPayload, 'base_transaction' | 'je_schedule_id' | 'je_schedule_type'> {
@@ -261,6 +261,14 @@ function toJEScheduledTransaction(payload) {
261
261
  startDate: payload.start_date != null ? (0, zeniDayJS_1.date)(payload.start_date) : undefined,
262
262
  endDate: payload.end_date != null ? (0, zeniDayJS_1.date)(payload.end_date) : undefined,
263
263
  period: payload.period != null ? Number(payload.period) : undefined,
264
+ recurringAmount: payload.recurring_amount != null
265
+ ? {
266
+ amount: payload.recurring_amount,
267
+ currencyCode: payload.currency_code,
268
+ currencySymbol: payload.currency_symbol,
269
+ }
270
+ : undefined,
271
+ postedCount: payload.posted_count ?? undefined,
264
272
  updatedByUserID: payload.updated_by.user_id,
265
273
  balanceAsOfToday: payload.balance ?? undefined,
266
274
  updatedAt: payload.updated_at != null ? (0, zeniDayJS_1.date)(payload.updated_at) : undefined,
@@ -73,6 +73,7 @@ export interface JEScheduledTransaction {
73
73
  lastDayOfMonth?: boolean;
74
74
  period?: number;
75
75
  recommendations?: JEScheduleRecommendations;
76
+ recurringAmount?: Amount;
76
77
  startDate?: ZeniDate;
77
78
  updatedAt?: ZeniDate;
78
79
  updatedByUser?: User;
@@ -96,7 +96,7 @@ exports.getJEAccruedScheduleByJEScheduleKey = getJEAccruedScheduleByJEScheduleKe
96
96
  const getJEScheduledTransactionByJEScheduleTransactionKey = (jeScheduleTransactionKey, state) => {
97
97
  const { jeSchedulesState, vendorState, accountState, userState, classState, transactionState, } = state;
98
98
  const jeScheduleTransactionState = (0, get_1.default)(jeSchedulesState.schedulesByTransactionKey, jeScheduleTransactionKey);
99
- const { period, updatedByUserID: updatedBy, createdByUserID: createdBy, createTime, vendorId, jeCredit, jeDebit, currencyCode, currencySymbol, balanceAsOfToday, baseTransaction, startDate, endDate, status, updatedAt, jeScheduleId, scheduledJournalEntry, dayOfPostingDate: postingDate, lastDayOfMonth, otherAttributes, jeScheduleType, aiSummaries, confidenceScore, recommendations, } = jeScheduleTransactionState;
99
+ const { period, updatedByUserID: updatedBy, createdByUserID: createdBy, createTime, vendorId, jeCredit, jeDebit, currencyCode, currencySymbol, balanceAsOfToday, baseTransaction, startDate, endDate, status, updatedAt, jeScheduleId, scheduledJournalEntry, dayOfPostingDate: postingDate, lastDayOfMonth, otherAttributes, jeScheduleType, aiSummaries, confidenceScore, recommendations, recurringAmount, postedCount: postedCountFromServer, } = jeScheduleTransactionState;
100
100
  const vendorDetails = (0, vendorSelector_1.getVendorByVendorId)(vendorState, vendorId);
101
101
  if (vendorDetails == null) {
102
102
  throw new Error(`Vendor with ${vendorId} doesn't exist`);
@@ -125,11 +125,17 @@ const getJEScheduledTransactionByJEScheduleTransactionKey = (jeScheduleTransacti
125
125
  reportId: 'class_list',
126
126
  })
127
127
  : undefined;
128
- const postedCount = scheduledJournalEntry.filter((sje) => sje.status.code === 'posted' || sje.status.code === 'recorded').length;
128
+ // The expense-automation response carries no scheduled journal entries for these rows, so the
129
+ // filter below counts an empty array and every schedule reported 0 posted. Prefer the count the
130
+ // server derives, and keep the filter for callers that do have entries (the detail page, and
131
+ // failed postings, which come with theirs).
132
+ const postedCount = postedCountFromServer ??
133
+ scheduledJournalEntry.filter((sje) => sje.status.code === 'posted' || sje.status.code === 'recorded').length;
129
134
  const lifecycleTotal = period ?? scheduledJournalEntry.length;
130
135
  return {
131
136
  jeScheduleId,
132
137
  jeScheduleType,
138
+ recurringAmount,
133
139
  jeScheduleTransactionKey: jeScheduleTransactionKey,
134
140
  vendor: vendorDetails,
135
141
  updatedByUser: userDetails,
@@ -104,7 +104,9 @@ export interface JEScheduledTransactionState {
104
104
  jeScheduleType?: ScheduleTypes;
105
105
  lastDayOfMonth?: boolean;
106
106
  period?: number;
107
+ postedCount?: number;
107
108
  recommendations?: JEScheduleRecommendations;
109
+ recurringAmount?: Amount;
108
110
  startDate?: ZeniDate;
109
111
  updatedAt?: ZeniDate;
110
112
  updatedByUserID?: ID;
@@ -250,6 +250,14 @@ export function toJEScheduledTransaction(payload) {
250
250
  startDate: payload.start_date != null ? date(payload.start_date) : undefined,
251
251
  endDate: payload.end_date != null ? date(payload.end_date) : undefined,
252
252
  period: payload.period != null ? Number(payload.period) : undefined,
253
+ recurringAmount: payload.recurring_amount != null
254
+ ? {
255
+ amount: payload.recurring_amount,
256
+ currencyCode: payload.currency_code,
257
+ currencySymbol: payload.currency_symbol,
258
+ }
259
+ : undefined,
260
+ postedCount: payload.posted_count ?? undefined,
253
261
  updatedByUserID: payload.updated_by.user_id,
254
262
  balanceAsOfToday: payload.balance ?? undefined,
255
263
  updatedAt: payload.updated_at != null ? date(payload.updated_at) : undefined,
@@ -88,7 +88,7 @@ export const getJEAccruedScheduleByJEScheduleKey = (JEScheduleKey, state) => {
88
88
  export const getJEScheduledTransactionByJEScheduleTransactionKey = (jeScheduleTransactionKey, state) => {
89
89
  const { jeSchedulesState, vendorState, accountState, userState, classState, transactionState, } = state;
90
90
  const jeScheduleTransactionState = recordGet(jeSchedulesState.schedulesByTransactionKey, jeScheduleTransactionKey);
91
- const { period, updatedByUserID: updatedBy, createdByUserID: createdBy, createTime, vendorId, jeCredit, jeDebit, currencyCode, currencySymbol, balanceAsOfToday, baseTransaction, startDate, endDate, status, updatedAt, jeScheduleId, scheduledJournalEntry, dayOfPostingDate: postingDate, lastDayOfMonth, otherAttributes, jeScheduleType, aiSummaries, confidenceScore, recommendations, } = jeScheduleTransactionState;
91
+ const { period, updatedByUserID: updatedBy, createdByUserID: createdBy, createTime, vendorId, jeCredit, jeDebit, currencyCode, currencySymbol, balanceAsOfToday, baseTransaction, startDate, endDate, status, updatedAt, jeScheduleId, scheduledJournalEntry, dayOfPostingDate: postingDate, lastDayOfMonth, otherAttributes, jeScheduleType, aiSummaries, confidenceScore, recommendations, recurringAmount, postedCount: postedCountFromServer, } = jeScheduleTransactionState;
92
92
  const vendorDetails = getVendorByVendorId(vendorState, vendorId);
93
93
  if (vendorDetails == null) {
94
94
  throw new Error(`Vendor with ${vendorId} doesn't exist`);
@@ -117,11 +117,17 @@ export const getJEScheduledTransactionByJEScheduleTransactionKey = (jeScheduleTr
117
117
  reportId: 'class_list',
118
118
  })
119
119
  : undefined;
120
- const postedCount = scheduledJournalEntry.filter((sje) => sje.status.code === 'posted' || sje.status.code === 'recorded').length;
120
+ // The expense-automation response carries no scheduled journal entries for these rows, so the
121
+ // filter below counts an empty array and every schedule reported 0 posted. Prefer the count the
122
+ // server derives, and keep the filter for callers that do have entries (the detail page, and
123
+ // failed postings, which come with theirs).
124
+ const postedCount = postedCountFromServer ??
125
+ scheduledJournalEntry.filter((sje) => sje.status.code === 'posted' || sje.status.code === 'recorded').length;
121
126
  const lifecycleTotal = period ?? scheduledJournalEntry.length;
122
127
  return {
123
128
  jeScheduleId,
124
129
  jeScheduleType,
130
+ recurringAmount,
125
131
  jeScheduleTransactionKey: jeScheduleTransactionKey,
126
132
  vendor: vendorDetails,
127
133
  updatedByUser: userDetails,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "5.1.88-betaRD10",
3
+ "version": "5.1.88-betaRD11",
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",