@zeniai/client-epic-state 5.0.78 → 5.0.80

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.
@@ -1,9 +1,14 @@
1
- import { dateLocal } from '../../../zeniDayJS';
1
+ import { dateInUTC, dateLocal } from '../../../zeniDayJS';
2
2
  import { toHistoricEventUpdateDisplayType, toHistoricEventUpdateType, } from './commonHistory';
3
- export const toHistoricEvent = (payload) => ({
3
+ export const toHistoricEvent = (payload, keepTimeInUTC = false) => ({
4
4
  eventText: payload.event_text,
5
5
  eventSubText: payload.event_sub_text ?? [],
6
- timestamp: payload.timestamp != null ? dateLocal(payload.timestamp) : undefined,
6
+ // Bills: parse as UTC (dateInUTC). Other entities: convert to local (dateLocal).
7
+ timestamp: payload.timestamp != null
8
+ ? keepTimeInUTC
9
+ ? dateInUTC(payload.timestamp)
10
+ : dateLocal(payload.timestamp)
11
+ : undefined,
7
12
  updates: payload.updates.map((eventUpdatePayload) => toHistoricEventUpdate(eventUpdatePayload)),
8
13
  paymentTraceId: payload.metadata?.payment_trace_id ?? null,
9
14
  });
@@ -29,9 +29,10 @@ const commonHistory = createSlice({
29
29
  },
30
30
  },
31
31
  updateCommonHistory(draft, action) {
32
- const { entityId, entityType, historicEventsPayload } = action.payload;
32
+ const { entityId, entityType, historicEventsPayload, keepTimeInUTC } = action.payload;
33
33
  const key = getEntityHistoryDetailKey(entityId, entityType);
34
- const historicEvents = historicEventsPayload.map((historicEventPayload) => toHistoricEvent(historicEventPayload));
34
+ // Bills: keepTimeInUTC true → dateInUTC. Other entities: undefined → dateLocal.
35
+ const historicEvents = historicEventsPayload.map((historicEventPayload) => toHistoricEvent(historicEventPayload, keepTimeInUTC));
35
36
  draft.historyById[key] = {
36
37
  ...initialCommonHistory,
37
38
  fetchState: 'Completed',
@@ -27,6 +27,8 @@ export const fetchEntityHistoryEpic = (actions$, state$, zeniAPI) => actions$.pi
27
27
  entityId,
28
28
  entityType,
29
29
  historicEventsPayload: response.data.activities,
30
+ // Bills: parse timestamps as UTC. Other entities: convert to local.
31
+ keepTimeInUTC: entityType === 'bill_pay',
30
32
  }));
31
33
  }
32
34
  else {