@tesouro/embedded-components-react 0.11.193 → 0.11.197

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.
@@ -163,11 +163,10 @@ function x({ payable: o, canManage: x = !0, onRemoved: S, onOpenPayable: C, labe
163
163
  loadingRowCount: Math.min(k.length + 1, y),
164
164
  collapse: u({
165
165
  statuses: G.map((e) => e.status),
166
- statusLabels: T.statusLabels,
167
166
  labels: {
168
167
  showMore: T.showMoreRows,
169
168
  showLess: T.showLessRows,
170
- statusSummary: T.statusSummary
169
+ statusSummary: (e) => T.statusSummary(e.map(({ status: e }) => T.statusLabels[e] ?? T.statusLabels.unknown ?? e))
171
170
  }
172
171
  })
173
172
  };
@@ -40,7 +40,8 @@ var n = {
40
40
  attachmentChipNone: "No attachment",
41
41
  pastDue: "Past due",
42
42
  scheduledStatus: "Scheduled",
43
- moreSelected: (e, t) => `${e} + ${t} more`,
43
+ valueList: (e) => e.join(", "),
44
+ moreValues: (e) => `+${e}`,
44
45
  amountAtLeast: (e) => `${e} or more`,
45
46
  amountAtMost: (e) => `${e} or less`,
46
47
  amountBetween: (e, t) => `${e} - ${t}`,
@@ -24,11 +24,11 @@ var _ = {
24
24
  Amount: "amount",
25
25
  Vendor: "vendor",
26
26
  Attachment: "attachment"
27
- }, v = [], y = 50, b = 300, x = "MMM d, yyyy", S = 864e5, C = {
27
+ }, v = [], y = 50, b = 300, x = "MMM d, yyyy", S = 2, C = 864e5, ee = {
28
28
  [n.IssueDate]: "issued_at",
29
29
  [n.DueDate]: "due_date",
30
30
  [n.AddedOn]: "created_at"
31
- }, w = {
31
+ }, te = {
32
32
  [a.Today]: "current",
33
33
  [a.ThisWeek]: "current",
34
34
  [a.ThisMonth]: "current",
@@ -42,7 +42,7 @@ var _ = {
42
42
  [a.LastQuarter]: "past",
43
43
  [a.LastYear]: "past"
44
44
  };
45
- function T(e = null) {
45
+ function w(e = null) {
46
46
  return {
47
47
  summaryCard: e,
48
48
  dateField: n.DueDate,
@@ -53,250 +53,251 @@ function T(e = null) {
53
53
  vendorIds: []
54
54
  };
55
55
  }
56
- function E(e) {
56
+ function T(e) {
57
57
  let t = Number.parseFloat(e);
58
58
  return Number.isFinite(t) ? Math.round(t * 100) : void 0;
59
59
  }
60
- function D({ statusOptions: a = v, offersVendorFilter: D = !0, isVendorFilterPaused: O = !1, onFiltersChange: k, initialSummaryCard: ee = null, onSummaryCardChange: A, today: j, labels: M } = {}) {
61
- let N = f(() => ({
60
+ function E({ statusOptions: a = v, offersVendorFilter: E = !0, isVendorFilterPaused: D = !1, onFiltersChange: O, initialSummaryCard: ne = null, onSummaryCardChange: k, today: A, labels: j } = {}) {
61
+ let M = f(() => ({
62
62
  ...s,
63
- ...M,
63
+ ...j,
64
64
  presets: {
65
65
  ...s.presets,
66
- ...M?.presets
66
+ ...j?.presets
67
67
  },
68
68
  statuses: {
69
69
  ...s.statuses,
70
- ...M?.statuses
70
+ ...j?.statuses
71
71
  },
72
72
  dateFieldNames: {
73
73
  ...s.dateFieldNames,
74
- ...M?.dateFieldNames
74
+ ...j?.dateFieldNames
75
75
  }
76
- }), [M]), [P, F] = m(() => T(ee)), I = a.length > 0 && !P.summaryCard, L = I ? a : v, R = u((e) => {
77
- e !== P.summaryCard && A?.(e);
78
- }, [A, P.summaryCard]), [z, B] = m({}), [V, H] = m(""), [U, W] = m(""), G = u((e) => {
79
- F((t) => ({
76
+ }), [j]), [N, P] = m(() => w(ne)), F = a.length > 0 && !N.summaryCard, I = F ? a : v, L = u((e) => {
77
+ e !== N.summaryCard && k?.(e);
78
+ }, [k, N.summaryCard]), [R, z] = m({}), [B, V] = m(""), [H, U] = m(""), W = u((e) => {
79
+ P((t) => ({
80
80
  ...t,
81
81
  ...e
82
- })), k?.();
83
- }, [k]);
82
+ })), O?.();
83
+ }, [O]);
84
84
  d(() => {
85
- D || F((e) => e.vendorIds.length === 0 ? e : (k?.(), {
85
+ E || P((e) => e.vendorIds.length === 0 ? e : (O?.(), {
86
86
  ...e,
87
87
  vendorIds: []
88
88
  }));
89
- }, [D, k]), d(() => {
90
- F((e) => {
91
- let t = e.statuses.filter((e) => L.includes(e));
92
- return t.length === e.statuses.length ? e : (k?.(), {
89
+ }, [E, O]), d(() => {
90
+ P((e) => {
91
+ let t = e.statuses.filter((e) => I.includes(e));
92
+ return t.length === e.statuses.length ? e : (O?.(), {
93
93
  ...e,
94
94
  statuses: t
95
95
  });
96
96
  });
97
- }, [L, k]);
98
- let K = f(() => P.statuses.filter((e) => L.includes(e)), [P.statuses, L]), q = P.summaryCard === r.Overdue ? j : void 0, J = p(q);
97
+ }, [I, O]);
98
+ let G = f(() => N.statuses.filter((e) => I.includes(e)), [N.statuses, I]), K = N.summaryCard === r.Overdue ? A : void 0, q = p(K);
99
99
  d(() => {
100
- let e = J.current;
101
- J.current = q, e && q && e !== q && k?.();
102
- }, [q, k]), d(() => {
103
- let e = setTimeout(() => W(V.trim()), b);
100
+ let e = q.current;
101
+ q.current = K, e && K && e !== K && O?.();
102
+ }, [K, O]), d(() => {
103
+ let e = setTimeout(() => U(B.trim()), b);
104
104
  return () => clearTimeout(e);
105
- }, [V]);
106
- let Y = l({
107
- enabled: D && !O,
105
+ }, [B]);
106
+ let J = l({
107
+ enabled: E && !D,
108
108
  is_vendor: !0,
109
109
  sort: "counterpart_name",
110
110
  order: "asc",
111
111
  limit: y,
112
- counterpart_name__icontains: U || void 0
113
- }), X = f(() => (Y.data?.data ?? []).map((e) => ({
112
+ counterpart_name__icontains: H || void 0
113
+ }), Y = f(() => (J.data?.data ?? []).map((e) => ({
114
114
  value: e.id,
115
115
  label: c(e)
116
- })), [Y.data?.data]), te = f(() => a.map((e) => ({
116
+ })), [J.data?.data]), X = f(() => a.map((e) => ({
117
117
  value: e,
118
- label: N.statuses[e]
119
- })), [a, N.statuses]), ne = f(() => Object.entries(w).map(([e, t]) => ({
118
+ label: M.statuses[e]
119
+ })), [a, M.statuses]), re = f(() => Object.entries(te).map(([e, t]) => ({
120
120
  value: e,
121
- label: N.presets[e],
122
- group: t === "current" ? N.presetGroupCurrent : N.presetGroupPast
121
+ label: M.presets[e],
122
+ group: t === "current" ? M.presetGroupCurrent : M.presetGroupPast
123
123
  })), [
124
- N.presetGroupCurrent,
125
- N.presetGroupPast,
126
- N.presets
127
- ]), re = f(() => {
128
- let e = {}, n = C[P.dateField], r = (e) => Date.UTC(e.getFullYear(), e.getMonth(), e.getDate());
129
- if (P.dateFrom && (e[`${n}__gte`] = n === "created_at" ? new Date(r(P.dateFrom)).toISOString() : g(P.dateFrom, { representation: "date" })), P.dateTo && (n === "created_at" ? e.created_at__lt = new Date(r(P.dateTo) + S).toISOString() : e[`${n}__lte`] = g(P.dateTo, { representation: "date" })), K.length > 0 && (e.status__in = t(K)), P.amountMode !== "any") {
130
- let t = "total_amount__gte", n = "total_amount__lte", r = E(P.amountMin), i = E(P.amountMax);
131
- P.amountMode === "exact" ? r !== void 0 && (e[t] = r, e[n] = r) : (r !== void 0 && (e[t] = r), i !== void 0 && (e[n] = i));
124
+ M.presetGroupCurrent,
125
+ M.presetGroupPast,
126
+ M.presets
127
+ ]), ie = f(() => {
128
+ let e = {}, n = ee[N.dateField], r = (e) => Date.UTC(e.getFullYear(), e.getMonth(), e.getDate());
129
+ if (N.dateFrom && (e[`${n}__gte`] = n === "created_at" ? new Date(r(N.dateFrom)).toISOString() : g(N.dateFrom, { representation: "date" })), N.dateTo && (n === "created_at" ? e.created_at__lt = new Date(r(N.dateTo) + C).toISOString() : e[`${n}__lte`] = g(N.dateTo, { representation: "date" })), G.length > 0 && (e.status__in = t(G)), N.amountMode !== "any") {
130
+ let t = "total_amount__gte", n = "total_amount__lte", r = T(N.amountMin), i = T(N.amountMax);
131
+ N.amountMode === "exact" ? r !== void 0 && (e[t] = r, e[n] = r) : (r !== void 0 && (e[t] = r), i !== void 0 && (e[n] = i));
132
132
  }
133
- return P.vendorIds.length > 0 && (e.counterpart_id__in = [...P.vendorIds]), P.hasFile !== void 0 && (e.has_file = P.hasFile), P.summaryCard && Object.assign(e, i(P.summaryCard, j).query), e;
133
+ return N.vendorIds.length > 0 && (e.counterpart_id__in = [...N.vendorIds]), N.hasFile !== void 0 && (e.has_file = N.hasFile), N.summaryCard && Object.assign(e, i(N.summaryCard, A).query), e;
134
134
  }, [
135
- P,
136
- K,
137
- j
135
+ N,
136
+ G,
137
+ A
138
138
  ]), Z = f(() => {
139
- let t = [], a = (e) => h(e, x), o = (e) => {
140
- let [t, ...n] = e;
141
- return t ? n.length === 0 ? t : N.moreSelected(t, n.length) : "";
139
+ let t = [], a = (e) => h(e, x), o = (e, t, n) => {
140
+ let r = t(M.valueList(n));
141
+ return n.length <= S ? {
142
+ key: e,
143
+ label: r
144
+ } : {
145
+ key: e,
146
+ label: t(M.valueList([...n.slice(0, S), M.moreValues(n.length - S)])),
147
+ fullLabel: r
148
+ };
142
149
  };
143
- if (P.summaryCard) {
144
- let { statuses: e } = i(P.summaryCard, j);
145
- t.push({
150
+ if (N.summaryCard) {
151
+ let { statuses: e } = i(N.summaryCard, A);
152
+ t.push(N.summaryCard === r.Overdue ? {
146
153
  key: _.SummaryCard,
147
- label: P.summaryCard === r.Overdue ? N.dateChip(N.dateFieldNames[n.DueDate], N.pastDue) : N.statusChip(e ? o(e.map((e) => N.statuses[e])) : N.scheduledStatus)
148
- });
154
+ label: M.dateChip(M.dateFieldNames[n.DueDate], M.pastDue)
155
+ } : o(_.SummaryCard, M.statusChip, e ? e.map((e) => M.statuses[e]) : [M.scheduledStatus]));
149
156
  }
150
- if (P.dateFrom || P.dateTo) {
151
- let e = (P.datePreset ? N.presets[P.datePreset] : void 0) ?? (P.dateFrom && P.dateTo ? N.dateRange(a(P.dateFrom), a(P.dateTo)) : P.dateFrom ? N.dateFrom(a(P.dateFrom)) : N.dateTo(a(P.dateTo)));
157
+ if (N.dateFrom || N.dateTo) {
158
+ let e = (N.datePreset ? M.presets[N.datePreset] : void 0) ?? (N.dateFrom && N.dateTo ? M.dateRange(a(N.dateFrom), a(N.dateTo)) : N.dateFrom ? M.dateFrom(a(N.dateFrom)) : M.dateTo(a(N.dateTo)));
152
159
  t.push({
153
160
  key: _.Date,
154
- label: N.dateChip(N.dateFieldNames[P.dateField], e)
161
+ label: M.dateChip(M.dateFieldNames[N.dateField], e)
155
162
  });
156
163
  }
157
- if (K.length > 0 && t.push({
158
- key: _.Status,
159
- label: N.statusChip(o(K.map((e) => N.statuses[e] ?? e)))
160
- }), P.vendorIds.length > 0 && t.push({
161
- key: _.Vendor,
162
- label: N.vendorChip(o(P.vendorIds.map((e) => z[e] ?? e)))
163
- }), P.amountMode !== "any") {
164
+ if (G.length > 0 && t.push(o(_.Status, M.statusChip, G.map((e) => M.statuses[e] ?? e))), N.vendorIds.length > 0 && t.push(o(_.Vendor, M.vendorChip, N.vendorIds.map((e) => R[e] ?? e))), N.amountMode !== "any") {
164
165
  let n = (t) => {
165
166
  let n = Number.parseFloat(t);
166
167
  return Number.isFinite(n) ? e(n, { currencyCode: "USD" }) : "";
167
- }, r = n(P.amountMin), i = n(P.amountMax), a = P.amountMode === "exact" ? r : r && i ? N.amountBetween(r, i) : r ? N.amountAtLeast(r) : i ? N.amountAtMost(i) : "";
168
+ }, r = n(N.amountMin), i = n(N.amountMax), a = N.amountMode === "exact" ? r : r && i ? M.amountBetween(r, i) : r ? M.amountAtLeast(r) : i ? M.amountAtMost(i) : "";
168
169
  a && t.push({
169
170
  key: _.Amount,
170
- label: N.amountChip(a)
171
+ label: M.amountChip(a)
171
172
  });
172
173
  }
173
- return P.hasFile !== void 0 && t.push({
174
+ return N.hasFile !== void 0 && t.push({
174
175
  key: _.Attachment,
175
- label: P.hasFile ? N.attachmentChipHas : N.attachmentChipNone
176
+ label: N.hasFile ? M.attachmentChipHas : M.attachmentChipNone
176
177
  }), t;
177
178
  }, [
179
+ M,
178
180
  N,
179
- P,
180
- K,
181
- j,
182
- z
183
- ]), ie = u((e) => {
181
+ G,
182
+ A,
183
+ R
184
+ ]), ae = u((e) => {
184
185
  switch (e) {
185
186
  case _.SummaryCard:
186
- R(null), G({ summaryCard: null });
187
+ L(null), W({ summaryCard: null });
187
188
  break;
188
189
  case _.Date:
189
- G({
190
+ W({
190
191
  datePreset: void 0,
191
192
  dateFrom: void 0,
192
193
  dateTo: void 0
193
194
  });
194
195
  break;
195
196
  case _.Status:
196
- G({ statuses: [] });
197
+ W({ statuses: [] });
197
198
  break;
198
199
  case _.Vendor:
199
- G({ vendorIds: [] });
200
+ W({ vendorIds: [] });
200
201
  break;
201
202
  case _.Amount:
202
- G({
203
+ W({
203
204
  amountMode: "any",
204
205
  amountMin: "",
205
206
  amountMax: ""
206
207
  });
207
208
  break;
208
- case _.Attachment: G({ hasFile: void 0 });
209
+ case _.Attachment: W({ hasFile: void 0 });
209
210
  }
210
- }, [R, G]), Q = u(() => {
211
- R(null), F(T()), k?.();
212
- }, [k, R]), $ = u((e) => {
213
- F((t) => t.summaryCard === e ? t : {
211
+ }, [L, W]), Q = u(() => {
212
+ L(null), P(w()), O?.();
213
+ }, [O, L]), $ = u((e) => {
214
+ P((t) => t.summaryCard === e ? t : {
214
215
  ...t,
215
216
  summaryCard: e
216
- }), k?.();
217
- }, [k]), ae = u((e) => {
218
- R(e), $(e);
219
- }, [$, R]), oe = u((e) => {
220
- B((t) => ({
217
+ }), O?.();
218
+ }, [O]), oe = u((e) => {
219
+ L(e), $(e);
220
+ }, [$, L]), se = u((e) => {
221
+ z((t) => ({
221
222
  ...t,
222
223
  [e.id]: e.name
223
- })), R(null), F({
224
- ...T(),
224
+ })), L(null), P({
225
+ ...w(),
225
226
  vendorIds: [e.id]
226
- }), k?.();
227
- }, [k, R]), se = u((e) => {
228
- B((t) => {
227
+ }), O?.();
228
+ }, [O, L]), ce = u((e) => {
229
+ z((t) => {
229
230
  let n = { ...t };
230
- for (let t of X) e.includes(t.value) && (n[t.value] = t.label);
231
+ for (let t of Y) e.includes(t.value) && (n[t.value] = t.label);
231
232
  return n;
232
- }), G({ vendorIds: e });
233
- }, [G, X]);
233
+ }), W({ vendorIds: e });
234
+ }, [W, Y]);
234
235
  return {
235
236
  filterBarProps: {
236
237
  fields: [...f(() => [
237
- ...D ? [n.Vendor] : [],
238
+ ...E ? [n.Vendor] : [],
238
239
  n.IssueDate,
239
240
  n.DueDate,
240
- ...I ? [n.Status] : [],
241
+ ...F ? [n.Status] : [],
241
242
  n.TotalAmount,
242
243
  n.AddedOn,
243
244
  n.Attachment
244
- ], [I, D])],
245
+ ], [F, E])],
245
246
  activeFilterCount: Z.length,
246
247
  chips: Z,
247
- onRemoveChip: ie,
248
+ onRemoveChip: ae,
248
249
  onClearAll: Q,
249
- dateField: P.dateField,
250
+ dateField: N.dateField,
250
251
  onDateFieldChange: (e) => {
251
- let t = !!(P.dateFrom || P.dateTo);
252
- F((t) => ({
252
+ let t = !!(N.dateFrom || N.dateTo);
253
+ P((t) => ({
253
254
  ...t,
254
255
  dateField: e
255
- })), t && k?.();
256
+ })), t && O?.();
256
257
  },
257
- datePresets: ne,
258
- selectedDatePreset: P.datePreset,
259
- dateFrom: P.dateFrom,
260
- dateTo: P.dateTo,
261
- onDateRangeChange: ({ from: e, to: t }) => G({
258
+ datePresets: re,
259
+ selectedDatePreset: N.datePreset,
260
+ dateFrom: N.dateFrom,
261
+ dateTo: N.dateTo,
262
+ onDateRangeChange: ({ from: e, to: t }) => W({
262
263
  datePreset: void 0,
263
264
  dateFrom: e,
264
265
  dateTo: t
265
266
  }),
266
267
  onDatePresetChange: (e) => {
267
- let t = /* @__PURE__ */ new Date(), r = P.dateField === n.AddedOn ? new Date(t.getUTCFullYear(), t.getUTCMonth(), t.getUTCDate()) : t, { from: i, to: a } = o(e, r);
268
- G({
268
+ let t = /* @__PURE__ */ new Date(), r = N.dateField === n.AddedOn ? new Date(t.getUTCFullYear(), t.getUTCMonth(), t.getUTCDate()) : t, { from: i, to: a } = o(e, r);
269
+ W({
269
270
  datePreset: e,
270
271
  dateFrom: i,
271
272
  dateTo: a
272
273
  });
273
274
  },
274
- statusOptions: te,
275
- selectedStatuses: K,
276
- onStatusChange: (e) => G({ statuses: e }),
277
- amountMode: P.amountMode,
278
- onAmountModeChange: (e) => G({ amountMode: e }),
279
- amountMin: P.amountMin,
280
- amountMax: P.amountMax,
281
- onAmountMinChange: (e) => G({ amountMin: e }),
282
- onAmountMaxChange: (e) => G({ amountMax: e }),
283
- vendorOptions: X,
284
- selectedVendors: P.vendorIds,
285
- onVendorChange: se,
286
- vendorSearchValue: V,
287
- onVendorSearchChange: H,
288
- isVendorLoading: Y.isLoading || O,
289
- isVendorError: Y.isError,
290
- hasAttachment: P.hasFile,
291
- onHasAttachmentChange: (e) => G({ hasFile: e })
275
+ statusOptions: X,
276
+ selectedStatuses: G,
277
+ onStatusChange: (e) => W({ statuses: e }),
278
+ amountMode: N.amountMode,
279
+ onAmountModeChange: (e) => W({ amountMode: e }),
280
+ amountMin: N.amountMin,
281
+ amountMax: N.amountMax,
282
+ onAmountMinChange: (e) => W({ amountMin: e }),
283
+ onAmountMaxChange: (e) => W({ amountMax: e }),
284
+ vendorOptions: Y,
285
+ selectedVendors: N.vendorIds,
286
+ onVendorChange: ce,
287
+ vendorSearchValue: B,
288
+ onVendorSearchChange: V,
289
+ isVendorLoading: J.isLoading || D,
290
+ isVendorError: J.isError,
291
+ hasAttachment: N.hasFile,
292
+ onHasAttachmentChange: (e) => W({ hasFile: e })
292
293
  },
293
- query: re,
294
+ query: ie,
294
295
  isFilterActive: Z.length > 0,
295
296
  clearAll: Q,
296
- filterByVendor: oe,
297
- summaryCard: P.summaryCard,
298
- selectSummaryCard: ae,
297
+ filterByVendor: se,
298
+ summaryCard: N.summaryCard,
299
+ selectSummaryCard: oe,
299
300
  applySummaryCard: $
300
301
  };
301
302
  }
302
- export { _ as BillsFilterChipKey, D as useBillsFilters };
303
+ export { _ as BillsFilterChipKey, E as useBillsFilters };
@@ -376,14 +376,14 @@ function Te({ enabled: c = !0, canPay: d, canReadVendors: h = !0, isVendorFilter
376
376
  Q,
377
377
  L,
378
378
  H.data?.prev_pagination_token
379
- ]), kt = y(() => {
380
- W.refetch();
381
- }, [W.refetch]);
379
+ ]), kt = W.refetch, At = y(() => {
380
+ kt();
381
+ }, [kt]);
382
382
  return {
383
383
  rows: bt,
384
384
  isLoading: W.isLoading || !L && j === void 0 || et || V !== ut || pt && mt.isLoading || (ft ?? 0) > 0 && bt.length === 0,
385
385
  isError: W.isError,
386
- onRetry: kt,
386
+ onRetry: At,
387
387
  selectedFilterTabId: k,
388
388
  onFilterTabChange: $,
389
389
  showVendorBills: Ct,
@@ -405,7 +405,7 @@ function Te({ enabled: c = !0, canPay: d, canReadVendors: h = !0, isVendorFilter
405
405
  isSortable: !L,
406
406
  pageInfo: L ? T.pageInfo({
407
407
  billCount: Z.length,
408
- invoiceCount: new Set(Z.map((e) => e.group?.key ?? e.rowKey)).size
408
+ groupCount: new Set(Z.map((e) => e.group?.key ?? e.rowKey)).size
409
409
  }) : void 0,
410
410
  showAddPanelWhenEmpty: !L,
411
411
  sorting: Le,
@@ -455,11 +455,10 @@ function Ee(e, t) {
455
455
  if (!e.group) return e;
456
456
  let r = h({
457
457
  statuses: n.get(e.group.key) ?? [],
458
- statusLabels: t.statusLabels,
459
458
  labels: {
460
459
  showMore: t.showMore,
461
460
  showLess: t.showLess,
462
- statusSummary: t.statusSummary
461
+ statusSummary: (e) => t.statusSummary(e.map(({ status: e, count: n }) => (t.statusCount[e] ?? t.statusCount.unknown)(n)))
463
462
  }
464
463
  });
465
464
  return r ? {
@@ -8,30 +8,28 @@ import { useMailboxAddress as ee } from "../../../../shared/data-access/dist/lib
8
8
  import { Scope as n } from "../../../../shared/data-access/dist/lib/scopes.js";
9
9
  import "../../../../shared/data-access/dist/index.js";
10
10
  import "../../../../shared/ui/dist/index.js";
11
- import { useWidgetConfig as te, useWidgetInitStaleForToken as ne } from "../../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
11
+ import { useWidgetConfig as r, useWidgetInitStaleForToken as te } from "../../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
12
12
  import "../../../../shared/feature/dist/index.js";
13
- import { BillDecisionDialog as r } from "../../../ui/dist/index4.js";
14
- import { BillDuplicateIcon as re } from "../../../ui/dist/index6.js";
13
+ import { BillDecisionDialog as i } from "../../../ui/dist/index4.js";
14
+ import { BillDuplicateIcon as ne } from "../../../ui/dist/index6.js";
15
15
  import "../../../ui/dist/index.js";
16
- import { AddBillDialog as i } from "../../ui/dist/index6.js";
17
- import { BILL_STATUS_BADGE_LABELS_EN as a } from "../../../../shared/document-status/ui/dist/index2.js";
18
- import "../../../../shared/document-status/ui/dist/index.js";
16
+ import { AddBillDialog as a } from "../../ui/dist/index6.js";
19
17
  import { BillsScreen as o } from "../../ui/dist/index23.js";
20
18
  import "../../ui/dist/index.js";
21
19
  import { BILL_QUEUE_ORDER as s, BillQueue as c } from "./index5.js";
22
20
  import { BILLS_TAB_LABELS_EN as l } from "./index7.js";
23
- import { BillDuplicateView as u, useBillsTable as ie } from "./index17.js";
24
- import { useDuplicateBillsCount as ae } from "./index2.js";
25
- import { formatBillQueueBadge as oe } from "./index3.js";
21
+ import { BillDuplicateView as u, useBillsTable as re } from "./index17.js";
22
+ import { useDuplicateBillsCount as ie } from "./index2.js";
23
+ import { formatBillQueueBadge as ae } from "./index3.js";
26
24
  import { copyTextToClipboard as d } from "./index6.js";
27
25
  import { billsTableCellTestIds as f } from "./index8.js";
28
26
  import { useAssignedToMeCount as p } from "./index9.js";
29
27
  import { useBillSummaryCards as m } from "./index11.js";
30
28
  import { useCallback as h, useImperativeHandle as g, useMemo as _, useState as v } from "react";
31
- import { Fragment as se, jsx as y, jsxs as ce } from "react/jsx-runtime";
29
+ import { Fragment as oe, jsx as y, jsxs as se } from "react/jsx-runtime";
32
30
  // ../../libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index18.js
33
- var le = () => void 0;
34
- function b({ labels: b, onOpenBill: ue, onEnterManually: de, onFilesSelected: fe, maxFiles: x, headerActionContainer: pe, selectedSummaryCard: me, onSummaryCardChange: he, ref: ge }) {
31
+ var ce = () => void 0;
32
+ function b({ labels: b, onOpenBill: le, onEnterManually: ue, onFilesSelected: de, maxFiles: x, headerActionContainer: fe, selectedSummaryCard: pe, onSummaryCardChange: me, ref: he }) {
35
33
  let S = _(() => ({
36
34
  ...l,
37
35
  ...b,
@@ -83,6 +81,10 @@ function b({ labels: b, onOpenBill: ue, onEnterManually: de, onFilesSelected: fe
83
81
  ...l.duplicatesEmptyState,
84
82
  ...b?.duplicatesEmptyState
85
83
  },
84
+ duplicateStatusCount: {
85
+ ...l.duplicateStatusCount,
86
+ ...b?.duplicateStatusCount
87
+ },
86
88
  queueEmptyStates: s.reduce((e, t) => ({
87
89
  ...e,
88
90
  [t]: {
@@ -90,10 +92,7 @@ function b({ labels: b, onOpenBill: ue, onEnterManually: de, onFilesSelected: fe
90
92
  ...b?.queueEmptyStates?.[t]
91
93
  }
92
94
  }), {})
93
- }), [b]), [_e, C] = v(!1), [w, T] = v(u.AllBills), { initResponse: E } = te(), D = ne(), O = t(E?.scopes, [n.PayableReadOrg]), k = t(E?.scopes, [n.PayableWriteOrg]), A = !E || O, j = !E || k, M = E && !D ? t(E.scopes, [n.PayablePayOrg]) : void 0, N = t(E?.scopes, [n.CounterpartReadOrg]), P = b?.screen?.statusBadge, F = _(() => ({
94
- ...a,
95
- ...P
96
- }), [P]), I = _(() => ({
95
+ }), [b]), [ge, C] = v(!1), [w, T] = v(u.AllBills), { initResponse: E } = r(), D = te(), O = t(E?.scopes, [n.PayableReadOrg]), k = t(E?.scopes, [n.PayableWriteOrg]), A = !E || O, j = !E || k, M = E && !D ? t(E.scopes, [n.PayablePayOrg]) : void 0, N = t(E?.scopes, [n.CounterpartReadOrg]), P = _(() => ({
97
96
  menuTrigger: S.duplicateMenuTrigger,
98
97
  notDuplicateAction: S.duplicateNotDuplicateAction,
99
98
  notDuplicateConfirmTitle: S.duplicateNotDuplicateConfirmTitle,
@@ -123,7 +122,7 @@ function b({ labels: b, onOpenBill: ue, onEnterManually: de, onFilesSelected: fe
123
122
  showMore: S.duplicateShowMore,
124
123
  showLess: S.duplicateShowLess,
125
124
  statusSummary: S.duplicateStatusSummary,
126
- statusLabels: F,
125
+ statusCount: S.duplicateStatusCount,
127
126
  pageInfo: S.duplicatePageInfo
128
127
  }), [
129
128
  S.duplicateMenuTrigger,
@@ -155,167 +154,167 @@ function b({ labels: b, onOpenBill: ue, onEnterManually: de, onFilesSelected: fe
155
154
  S.duplicateShowMore,
156
155
  S.duplicateShowLess,
157
156
  S.duplicateStatusSummary,
158
- F,
157
+ S.duplicateStatusCount,
159
158
  S.duplicatePageInfo
160
- ]), L = t(E?.scopes, [n.MailboxReadOrg]), { mailboxAddress: ve } = ee({
159
+ ]), F = t(E?.scopes, [n.MailboxReadOrg]), { mailboxAddress: I } = ee({
161
160
  relatedObjectType: "payable",
162
- enabled: L && !D
163
- }), R = L ? ve : void 0, z = ie({
161
+ enabled: F && !D
162
+ }), L = F ? I : void 0, R = re({
164
163
  enabled: A,
165
164
  canPay: M,
166
165
  canReadVendors: N,
167
166
  isVendorFilterPaused: D,
168
167
  filterLabels: S.filters,
169
- onOpenBill: ue ?? le,
168
+ onOpenBill: le ?? ce,
170
169
  duplicateRowNote: S.duplicateRowNote,
171
170
  attachmentLabel: S.attachmentIndicator,
172
- duplicateGroupLabels: I,
171
+ duplicateGroupLabels: P,
173
172
  canManageDuplicates: j,
174
173
  duplicateView: w,
175
174
  scheduledRelativeDayLabels: S.scheduledRelativeDay,
176
175
  dueDateLabels: S.dueDate,
177
- selectedSummaryCard: me,
178
- onSummaryCardChange: he
179
- }), B = ae({ enabled: A }), V = w === u.PossibleDuplicates, H = p({
176
+ selectedSummaryCard: pe,
177
+ onSummaryCardChange: me
178
+ }), z = ie({ enabled: A }), B = w === u.PossibleDuplicates, V = p({
180
179
  enabled: A,
181
180
  canPay: M
182
- }), U = m({
181
+ }), H = m({
183
182
  enabled: A,
184
183
  labels: S.summaryCards,
185
- selectedCard: z.summaryCard
186
- }), ye = _(() => s.map((e) => ({
184
+ selectedCard: R.summaryCard
185
+ }), _e = _(() => s.map((e) => ({
187
186
  id: e,
188
187
  label: S.queues[e],
189
- badge: e === c.AssignedToMe ? oe(H) : void 0
190
- })), [S.queues, H]), { clearQueryConstraints: W, onFilterTabChange: G } = z, be = h(() => {
191
- W(), T(u.PossibleDuplicates);
192
- }, [W]), K = h(() => {
193
- T(u.AllBills), G(c.All);
194
- }, [G]), xe = h((e) => {
195
- T(u.AllBills), G(e);
196
- }, [G]), Se = !B.isError && B.groupCount > 0, Ce = j && Se, we = !B.isLoading && !B.isError && B.count === 0;
197
- V && (we || z.summaryCard) && K();
198
- let Te = Ce ? [{
188
+ badge: e === c.AssignedToMe ? ae(V) : void 0
189
+ })), [S.queues, V]), { clearQueryConstraints: U, onFilterTabChange: W } = R, ve = h(() => {
190
+ U(), T(u.PossibleDuplicates);
191
+ }, [U]), G = h(() => {
192
+ T(u.AllBills), W(c.All);
193
+ }, [W]), ye = h((e) => {
194
+ T(u.AllBills), W(e);
195
+ }, [W]), be = !z.isError && z.groupCount > 0, K = j && be, xe = !z.isLoading && !z.isError && z.count === 0;
196
+ B && (xe || R.summaryCard) && G();
197
+ let Se = K ? [{
199
198
  id: "duplicates",
200
- label: S.attentionDuplicates(B.groupCount, B.isCapped),
199
+ label: S.attentionDuplicates(z.groupCount, z.isCapped),
201
200
  tone: "warning",
202
- icon: /* @__PURE__ */ y(re, {}),
203
- pressed: V,
204
- onToggle: V ? K : be
205
- }] : [], q = b?.screen, Ee = _(() => ({
201
+ icon: /* @__PURE__ */ y(ne, {}),
202
+ pressed: B,
203
+ onToggle: B ? G : ve
204
+ }] : [], q = b?.screen, Ce = _(() => ({
206
205
  ...q,
207
206
  createButton: S.createButton,
208
207
  addBill: {
209
208
  ...q?.addBill,
210
209
  heading: S.nonEmptyHeading
211
210
  },
212
- ...V ? {
211
+ ...B ? {
213
212
  columnAddedOn: S.duplicateColumnCreated,
214
213
  columnAmountDue: S.duplicateColumnAmount
215
214
  } : {}
216
215
  }), [
217
- V,
216
+ B,
218
217
  S.duplicateColumnCreated,
219
218
  S.duplicateColumnAmount,
220
219
  q,
221
220
  S.createButton,
222
221
  S.nonEmptyHeading
223
- ]), De = _(() => ({
224
- ...z.filterBarProps,
222
+ ]), we = _(() => ({
223
+ ...R.filterBarProps,
225
224
  labels: S.filterBar
226
- }), [z.filterBarProps, S.filterBar]), J = () => {
227
- C(!1), de?.();
225
+ }), [R.filterBarProps, S.filterBar]), J = () => {
226
+ C(!1), ue?.();
228
227
  }, Y = (e) => {
229
- C(!1), fe?.(e);
230
- }, X = R ? {
231
- emailAddress: R,
228
+ C(!1), de?.(e);
229
+ }, X = L ? {
230
+ emailAddress: L,
232
231
  onCopyEmail: async () => {
233
- R && (await d(R) ? e.success(S.emailCopiedToast) : e.error(S.emailCopyFailedToast));
232
+ L && (await d(L) ? e.success(S.emailCopiedToast) : e.error(S.emailCopyFailedToast));
234
233
  }
235
234
  } : {
236
235
  emailAddress: void 0,
237
236
  onCopyEmail: void 0
238
- }, { showVendorBills: Z } = z, Q = h((e) => {
237
+ }, { showVendorBills: Z } = R, Q = h((e) => {
239
238
  T(u.AllBills), Z(e);
240
239
  }, [Z]), $ = h(() => C(!0), []);
241
- return g(ge, () => ({
240
+ return g(he, () => ({
242
241
  showVendorBills: Q,
243
242
  openAddBill: $
244
- }), [Q, $]), /* @__PURE__ */ ce(se, { children: [
243
+ }), [Q, $]), /* @__PURE__ */ se(oe, { children: [
245
244
  /* @__PURE__ */ y(o, {
246
- rows: z.rows,
247
- isLoading: z.isLoading || !E,
248
- isError: z.isError,
249
- onRetry: z.onRetry,
250
- sorting: z.sorting,
251
- onSortingChange: z.onSortingChange,
252
- pageSize: z.pageSize,
253
- onPageSizeChange: z.onPageSizeChange,
254
- pageSizeOptions: z.pageSizeOptions,
255
- hasNextPage: z.hasNextPage,
256
- hasPrevPage: z.hasPrevPage,
257
- onNextPage: z.onNextPage,
258
- onPrevPage: z.onPrevPage,
259
- filterTabs: ye,
260
- selectedFilterTabId: z.selectedFilterTabId,
261
- onFilterTabChange: xe,
262
- searchValue: z.searchValue,
263
- onSearchChange: z.onSearchChange,
264
- filters: De,
265
- visibleColumns: z.visibleColumns,
266
- keepsColumnOrder: z.keepsColumnOrder,
267
- isSortable: z.isSortable,
268
- pageInfo: z.pageInfo,
245
+ rows: R.rows,
246
+ isLoading: R.isLoading || !E,
247
+ isError: R.isError,
248
+ onRetry: R.onRetry,
249
+ sorting: R.sorting,
250
+ onSortingChange: R.onSortingChange,
251
+ pageSize: R.pageSize,
252
+ onPageSizeChange: R.onPageSizeChange,
253
+ pageSizeOptions: R.pageSizeOptions,
254
+ hasNextPage: R.hasNextPage,
255
+ hasPrevPage: R.hasPrevPage,
256
+ onNextPage: R.onNextPage,
257
+ onPrevPage: R.onPrevPage,
258
+ filterTabs: _e,
259
+ selectedFilterTabId: R.selectedFilterTabId,
260
+ onFilterTabChange: ye,
261
+ searchValue: R.searchValue,
262
+ onSearchChange: R.onSearchChange,
263
+ filters: we,
264
+ visibleColumns: R.visibleColumns,
265
+ keepsColumnOrder: R.keepsColumnOrder,
266
+ isSortable: R.isSortable,
267
+ pageInfo: R.pageInfo,
269
268
  cellTestIds: f,
270
- isSearchActive: z.isSearchActive,
271
- showAddPanelWhenEmpty: z.showAddPanelWhenEmpty,
272
- emptyState: V ? S.duplicatesEmptyState : S.queueEmptyStates[z.selectedFilterTabId],
269
+ isSearchActive: R.isSearchActive,
270
+ showAddPanelWhenEmpty: R.showAddPanelWhenEmpty,
271
+ emptyState: B ? S.duplicatesEmptyState : S.queueEmptyStates[R.selectedFilterTabId],
273
272
  onCreateClick: j ? () => C(!0) : void 0,
274
- headerActionContainer: pe,
273
+ headerActionContainer: fe,
275
274
  onEnterManually: j ? J : void 0,
276
275
  onFilesSelected: j ? Y : void 0,
277
276
  maxFiles: x,
278
277
  ...X,
279
- summaryCards: U ? {
280
- view: U,
278
+ summaryCards: H ? {
279
+ view: H,
281
280
  labels: {
282
281
  group: S.summaryCards.group,
283
282
  loading: S.summaryCards.loading,
284
283
  info: S.summaryCards.info
285
284
  },
286
- onSelect: z.onSummaryCardSelect
285
+ onSelect: R.onSummaryCardSelect
287
286
  } : void 0,
288
287
  attentionStrip: {
289
288
  label: S.attentionStripLabel,
290
- items: Te
289
+ items: Se
291
290
  },
292
- attentionView: V ? {
291
+ attentionView: B ? {
293
292
  backLabel: S.queues[c.All],
294
293
  backAccessibleLabel: S.attentionBackAccessible,
295
294
  title: S.duplicatesViewTitle,
296
295
  tone: "warning",
297
- onBack: K
296
+ onBack: G
298
297
  } : void 0,
299
- labels: Ee
298
+ labels: Ce
300
299
  }),
301
- /* @__PURE__ */ y(r, {
302
- open: z.cancelConfirmation.open,
303
- copy: z.cancelConfirmation.copy,
304
- onConfirm: z.cancelConfirmation.onConfirm,
305
- onCancel: z.cancelConfirmation.onCancel,
306
- isPending: z.cancelConfirmation.isPending,
307
- labels: { cancelButton: z.cancelConfirmation.cancelButtonLabel }
300
+ /* @__PURE__ */ y(i, {
301
+ open: R.cancelConfirmation.open,
302
+ copy: R.cancelConfirmation.copy,
303
+ onConfirm: R.cancelConfirmation.onConfirm,
304
+ onCancel: R.cancelConfirmation.onCancel,
305
+ isPending: R.cancelConfirmation.isPending,
306
+ labels: { cancelButton: R.cancelConfirmation.cancelButtonLabel }
308
307
  }),
309
- /* @__PURE__ */ y(r, {
310
- open: z.keepConfirmation.open,
311
- copy: z.keepConfirmation.copy,
312
- onConfirm: z.keepConfirmation.onConfirm,
313
- onCancel: z.keepConfirmation.onCancel,
314
- isPending: z.keepConfirmation.isPending,
315
- labels: { cancelButton: z.keepConfirmation.cancelButtonLabel }
308
+ /* @__PURE__ */ y(i, {
309
+ open: R.keepConfirmation.open,
310
+ copy: R.keepConfirmation.copy,
311
+ onConfirm: R.keepConfirmation.onConfirm,
312
+ onCancel: R.keepConfirmation.onCancel,
313
+ isPending: R.keepConfirmation.isPending,
314
+ labels: { cancelButton: R.keepConfirmation.cancelButtonLabel }
316
315
  }),
317
- j ? /* @__PURE__ */ y(i, {
318
- open: _e,
316
+ j ? /* @__PURE__ */ y(a, {
317
+ open: ge,
319
318
  onOpenChange: C,
320
319
  onFilesSelected: Y,
321
320
  maxFiles: x,
@@ -324,7 +323,7 @@ function b({ labels: b, onOpenBill: ue, onEnterManually: de, onFilesSelected: fe
324
323
  dialogLabels: b?.addBillDialog?.dialog,
325
324
  labels: {
326
325
  ...b?.addBillDialog?.panel,
327
- heading: z.hasAnyBills ? S.nonEmptyHeading : S.emptyHeading
326
+ heading: R.hasAnyBills ? S.nonEmptyHeading : S.emptyHeading
328
327
  }
329
328
  }) : null
330
329
  ] });
@@ -81,9 +81,20 @@ var n = {
81
81
  duplicateColumnCreated: "Created",
82
82
  duplicateShowMore: (e) => `Show ${e} more`,
83
83
  duplicateShowLess: "Show less",
84
+ duplicateStatusCount: {
85
+ draft: (e) => i(e, "Draft", "Drafts"),
86
+ ready_to_submit: (e) => `${e} Ready to submit`,
87
+ pending_approval: (e) => `${e} Pending review`,
88
+ ready_to_pay: (e) => `${e} Ready to pay`,
89
+ scheduled: (e) => `${e} Scheduled`,
90
+ paid: (e) => `${e} Paid`,
91
+ canceled: (e) => `${e} Cancelled`,
92
+ rejected: (e) => `${e} Rejected`,
93
+ unknown: (e) => `${e} Unknown`
94
+ },
84
95
  duplicateStatusSummary: (e) => e.join(", "),
85
96
  duplicateColumnAmount: "Amount",
86
- duplicatePageInfo: ({ billCount: e, invoiceCount: t }) => `${e} ${e === 1 ? "bill" : "bills"} across ${t} ${t === 1 ? "invoice" : "invoices"}`,
97
+ duplicatePageInfo: ({ billCount: e, groupCount: t }) => `${i(e, "bill", "bills")} across ${i(t, "duplicate group", "duplicate groups")}`,
87
98
  attachmentIndicator: "Has an attachment",
88
99
  scheduledRelativeDay: {
89
100
  today: "Today",
@@ -183,6 +183,7 @@ function v({ fields: d, activeFilterCount: v, chips: y, onRemoveChip: b, onClear
183
183
  "data-testid": Y?.chips,
184
184
  children: [y.map((e) => /* @__PURE__ */ f(ee, {
185
185
  label: e.label,
186
+ fullLabel: e.fullLabel,
186
187
  labels: Z.filterTag,
187
188
  onDismiss: () => b(e.key)
188
189
  }, e.key)), /* @__PURE__ */ f("button", {
@@ -4,19 +4,28 @@ var e = [
4
4
  "scheduled",
5
5
  "ready_to_pay",
6
6
  "pending_approval",
7
+ "ready_to_submit",
7
8
  "draft"
8
9
  ];
9
- function t({ statuses: t, statusLabels: n, labels: r }) {
10
- if (t.length <= 5) return;
11
- let i = t.slice(4), a = [...new Set(i.map((e) => e ?? "unknown"))], o = (t) => {
10
+ function t({ statuses: t, labels: n }) {
11
+ if (t.length <= 4) return;
12
+ let r = t.slice(3), i = /* @__PURE__ */ new Map();
13
+ for (let e of r) {
14
+ let t = e ?? "unknown";
15
+ i.set(t, (i.get(t) ?? 0) + 1);
16
+ }
17
+ let a = (t) => {
12
18
  let n = e.indexOf(t);
13
19
  return n === -1 ? e.length : n;
14
- }, s = [...a].sort((e, t) => o(e) - o(t));
20
+ }, o = [...i.keys()].sort((e, t) => a(e) - a(t));
15
21
  return {
16
- visibleCount: 4,
17
- showMoreLabel: r.showMore(i.length),
18
- summary: r.statusSummary(s.map((e) => n[e] ?? n.unknown ?? e)),
19
- showLessLabel: r.showLess
22
+ visibleCount: 3,
23
+ showMoreLabel: n.showMore(r.length),
24
+ summary: n.statusSummary(o.map((e) => ({
25
+ status: e,
26
+ count: i.get(e) ?? 0
27
+ }))),
28
+ showLessLabel: n.showLess
20
29
  };
21
30
  }
22
31
  export { e as GROUP_SUMMARY_STATUS_ORDER, t as buildGroupCollapse };
@@ -1,5 +1,5 @@
1
1
  // ../../libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js
2
- var e = "@tesouro/embedded-components-react", t = "0.11.193", n = "3417754da814af73a60faf0700defa733977a352", r = Object.freeze({
2
+ var e = "@tesouro/embedded-components-react", t = "0.11.197", n = "91c2d16805b212581b2ff35a5e016262f605288f", r = Object.freeze({
3
3
  library_name: e,
4
4
  library_version: t,
5
5
  library_sha: n
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tesouro/embedded-components-react",
3
- "version": "0.11.193",
3
+ "version": "0.11.197",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "sideEffects": [