@tesouro/embedded-components-react 0.7.0 → 0.7.1

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.
@@ -2,84 +2,93 @@
2
2
  "use client";
3
3
  "use client";
4
4
  "use client";
5
- import { Alert as e, AlertDescription as t, Button as n, Dialog as r, DialogClose as ee, DialogContent as te, DialogDescription as ne, DialogFooter as i, DialogHeader as a, DialogTitle as o, Separator as s, Skeleton as c, Typography as l } from "../../../../../../../packages/shared-ui-shadcn/dist/index.js";
5
+ import { Alert as e, AlertDescription as t, Badge as n, Button as r, Dialog as ee, DialogClose as te, DialogContent as ne, DialogDescription as re, DialogFooter as i, DialogHeader as a, DialogTitle as o, Separator as s, Skeleton as c, Typography as l } from "../../../../../../../packages/shared-ui-shadcn/dist/index.js";
6
6
  import { ExpenseStatusBadge as u } from "../ExpenseStatusBadge/ExpenseStatusBadge.js";
7
7
  import { FileViewer as d } from "../FileViewer/FileViewer.js";
8
8
  import { AccordionItemCard as f } from "../AccordionItemCard/AccordionItemCard.js";
9
- import { TRANSACTION_DETAILS_LABELS_EN as p } from "./labels.js";
10
- import { Fragment as m, jsx as h, jsxs as g } from "react/jsx-runtime";
11
- import { CloudUpload as re, DollarSign as ie, Loader as ae, Receipt as oe, X as se } from "lucide-react";
9
+ import { TRANSACTION_DETAILS_LABELS_EN as ie } from "./labels.js";
10
+ import { Fragment as p, jsx as m, jsxs as h } from "react/jsx-runtime";
11
+ import { CloudUpload as ae, DollarSign as oe, Loader as g, Receipt as se, X as ce } from "lucide-react";
12
12
  //#region ../../libs/tesouro-embedded-components-react/expense-management-widget/ui/dist/lib/TransactionDetails/TransactionDetails.js
13
13
  var _ = 3, v = () => void 0;
14
- function y({ open: y, onClose: b, transactionId: x, transactionDate: S, statusLabel: C, statusTone: w, isRejected: T, isPendingReview: E, amount: D, merchant: O, receiptUrl: k, isLoading: A, isError: j, isClosingDisabled: M, cardLabel: N, cardName: P, cardholder: F, showCardholder: I, showPhysicalPill: L, isDescriptionRequired: R, isReceiptRequired: z, isReceiptAutoMatched: B, isReceiptActionDisabled: V, receiptButtonLabel: H, receiptButtonIcon: U, receiptButtonVariant: W, showNoReceiptWarning: G, onDeleteReceiptClick: K, onUploadClick: q, onOpenReceiptInbox: J, onSubmitWithoutReceipt: ce, onFileDrop: Y, isUploading: X, descriptionValue: Z, initialDescriptionValue: le, onDescriptionChange: ue, onSaveDescription: de, onCancelDescription: fe, isSavingDescription: pe, isMemoEditable: me, memoBadgeLabel: he, showApprovalCard: ge, hasAppliedPolicy: _e, greaterThanValue: ve, lessThanValue: ye, ruleLabel: be, rejectionReason: xe, approverName: Se, isAutoApproved: Ce, isManuallyApproved: we, showAccountingCard: Te, glCategory: Ee = "", initialGlCategory: De = "", glCategoryOptions: Oe = [], onGlCategoryChange: ke, department: Ae = "", initialDepartment: je = "", departmentOptions: Me = [], onDepartmentChange: Ne, location: Pe = "", initialLocation: Fe = "", locationOptions: Ie = [], onLocationChange: Le, onSaveAccounting: Re, onCancelAccounting: ze, isSavingAccounting: Be, isGlCategoryDisabled: Ve, glCategoryHighlight: He, departmentHighlight: Ue, locationHighlight: We, showAuditHistoryCard: Ge, auditHistoryRows: Ke, isLoadingAuditHistory: qe, isAuditHistoryError: Je, children: Ye, labels: Xe, cardLabels: Q, fileViewerLabels: Ze, historyLabels: Qe }) {
14
+ function y({ open: y, onClose: b, transactionId: x, transactionDate: S, statusLabel: C, statusTone: w, isRejected: T, isPendingReview: E, amount: D, merchant: O, receiptUrl: k, isLoading: A, isError: j, isClosingDisabled: M, cardLabel: N, cardName: P, cardholder: F, showCardholder: I, showPhysicalPill: L, isDescriptionRequired: R, isReceiptRequired: z, isReceiptAutoMatched: B, isReceiptActionDisabled: V, receiptButtonLabel: H, receiptButtonIcon: U, receiptButtonVariant: W, showNoReceiptWarning: G, onDeleteReceiptClick: K, onUploadClick: q, onOpenReceiptInbox: le, onSubmitWithoutReceipt: ue, onFileDrop: J, isUploading: Y, descriptionValue: X, initialDescriptionValue: de, onDescriptionChange: fe, onSaveDescription: pe, onCancelDescription: me, isSavingDescription: he, isMemoEditable: ge, memoBadgeLabel: _e, isReadingReceipt: ve, showApprovalCard: ye, hasAppliedPolicy: be, greaterThanValue: xe, lessThanValue: Se, ruleLabel: Ce, rejectionReason: we, approverName: Te, isAutoApproved: Ee, isManuallyApproved: De, showAccountingCard: Oe, glCategory: ke = "", initialGlCategory: Ae = "", glCategoryOptions: je = [], onGlCategoryChange: Me, department: Ne = "", initialDepartment: Pe = "", departmentOptions: Fe = [], onDepartmentChange: Ie, location: Le = "", initialLocation: Re = "", locationOptions: ze = [], onLocationChange: Be, onSaveAccounting: Ve, onCancelAccounting: He, isSavingAccounting: Ue, isGlCategoryDisabled: Z, isAccountingDisabled: We, glCategoryHighlight: Ge, departmentHighlight: Ke, locationHighlight: qe, showAuditHistoryCard: Je, auditHistoryRows: Ye, isLoadingAuditHistory: Xe, isAuditHistoryError: Ze, children: Qe, labels: $e, cardLabels: Q, fileViewerLabels: et, historyLabels: tt }) {
15
15
  let $ = {
16
- ...p,
17
- ...Xe
16
+ ...ie,
17
+ ...$e
18
18
  };
19
- return /* @__PURE__ */ h(r, {
19
+ return /* @__PURE__ */ m(ee, {
20
20
  open: y,
21
21
  onOpenChange: (e) => {
22
22
  !e && !M && b();
23
23
  },
24
- children: /* @__PURE__ */ g(te, {
24
+ children: /* @__PURE__ */ h(ne, {
25
25
  fullScreen: !0,
26
26
  showCloseButton: !1,
27
27
  className: "ttw:flex ttw:p-0",
28
- children: [/* @__PURE__ */ g("div", {
28
+ children: [/* @__PURE__ */ h("div", {
29
29
  className: "ttw:flex ttw:flex-1/2 ttw:flex-col ttw:overflow-hidden ttw:border-r ttw:border-border",
30
30
  children: [
31
- /* @__PURE__ */ g(a, {
31
+ /* @__PURE__ */ h(a, {
32
32
  className: "ttw:h-20 ttw:flex-row ttw:items-center ttw:gap-3 ttw:px-8 ttw:py-6",
33
33
  children: [
34
- /* @__PURE__ */ h(o, {
34
+ /* @__PURE__ */ m(o, {
35
35
  className: "ttw:sr-only",
36
36
  children: $.screenReaderTitle
37
37
  }),
38
- /* @__PURE__ */ h(ne, {
38
+ /* @__PURE__ */ m(re, {
39
39
  className: "ttw:sr-only",
40
40
  children: $.screenReaderDescription
41
41
  }),
42
- /* @__PURE__ */ h("div", {
42
+ /* @__PURE__ */ m("div", {
43
43
  className: "ttw:mr-3 ttw:flex ttw:size-15 ttw:items-center ttw:justify-center ttw:rounded-full ttw:bg-emerald-700/25 ttw:shadow-[0_0_40px_8px] ttw:shadow-emerald-700/25",
44
- children: /* @__PURE__ */ h("div", {
44
+ children: /* @__PURE__ */ m("div", {
45
45
  className: "ttw:flex ttw:size-11 ttw:items-center ttw:justify-center ttw:rounded-full ttw:bg-emerald-700 ttw:text-white",
46
- children: /* @__PURE__ */ h(ie, {
46
+ children: /* @__PURE__ */ m(oe, {
47
47
  className: "ttw:size-5",
48
48
  "aria-hidden": !0
49
49
  })
50
50
  })
51
51
  }),
52
- /* @__PURE__ */ h(l, {
52
+ /* @__PURE__ */ m(l, {
53
53
  variant: "h4",
54
54
  children: $.contentTitle
55
55
  }),
56
- /* @__PURE__ */ h(s, { orientation: "vertical" }),
57
- !A && /* @__PURE__ */ h(l, {
56
+ /* @__PURE__ */ m(s, { orientation: "vertical" }),
57
+ !A && /* @__PURE__ */ m(l, {
58
58
  variant: "h5",
59
59
  className: "ttw:whitespace-nowrap",
60
60
  children: S
61
61
  }),
62
- !A && /* @__PURE__ */ h(u, {
62
+ !A && /* @__PURE__ */ m(u, {
63
63
  label: C,
64
64
  tone: w
65
+ }),
66
+ !A && ve && /* @__PURE__ */ h(n, {
67
+ role: "status",
68
+ variant: "outline",
69
+ className: "ttw:border-purple-100 ttw:bg-purple-100 ttw:text-purple-700 ttw:hover:bg-purple-100",
70
+ children: [/* @__PURE__ */ m(g, {
71
+ className: "ttw:animate-spin",
72
+ "aria-hidden": !0
73
+ }), $.readingReceipt]
65
74
  })
66
75
  ]
67
76
  }),
68
- /* @__PURE__ */ h("div", {
77
+ /* @__PURE__ */ m("div", {
69
78
  className: "ttw:mx-auto ttw:flex ttw:w-140 ttw:flex-1 ttw:flex-col ttw:gap-4 ttw:overflow-y-auto ttw:px-6 ttw:py-12",
70
- children: j ? /* @__PURE__ */ h(e, {
79
+ children: j ? /* @__PURE__ */ m(e, {
71
80
  variant: "destructive",
72
- children: /* @__PURE__ */ h(t, { children: $.loadFailed })
73
- }) : A ? Array.from({ length: _ }, (e, t) => /* @__PURE__ */ h(c, {
81
+ children: /* @__PURE__ */ m(t, { children: $.loadFailed })
82
+ }) : A ? Array.from({ length: _ }, (e, t) => /* @__PURE__ */ m(c, {
74
83
  width: "100%",
75
84
  height: 290
76
- }, t)) : /* @__PURE__ */ g(m, { children: [
77
- /* @__PURE__ */ h(l, {
85
+ }, t)) : /* @__PURE__ */ h(p, { children: [
86
+ /* @__PURE__ */ m(l, {
78
87
  variant: "h2",
79
88
  className: "ttw:font-bold",
80
89
  children: $.amountAtMerchant(D, O)
81
90
  }),
82
- /* @__PURE__ */ h(f, {
91
+ /* @__PURE__ */ m(f, {
83
92
  type: "requirements",
84
93
  title: $.requirementsCardTitle,
85
94
  cardLabel: N,
@@ -88,7 +97,7 @@ function y({ open: y, onClose: b, transactionId: x, transactionDate: S, statusLa
88
97
  showCardholder: I,
89
98
  showPhysicalPill: L,
90
99
  receiptFileUrl: k,
91
- hasMissingInfo: !!(R && !Z || z && !k),
100
+ hasMissingInfo: !!(R && !X || z && !k),
92
101
  showNoReceiptWarning: !!G,
93
102
  isDescriptionRequired: R,
94
103
  isReceiptRequired: z,
@@ -98,162 +107,163 @@ function y({ open: y, onClose: b, transactionId: x, transactionDate: S, statusLa
98
107
  receiptButtonIcon: U,
99
108
  receiptButtonVariant: W,
100
109
  onUploadClick: q,
101
- onOpenReceiptInbox: J,
102
- onSubmitWithoutReceipt: ce,
110
+ onOpenReceiptInbox: le,
111
+ onSubmitWithoutReceipt: ue,
103
112
  onDeleteReceipt: K,
104
- descriptionValue: Z,
105
- initialDescriptionValue: le,
106
- onDescriptionChange: ue,
107
- onSaveDescription: de,
108
- onCancelDescription: fe,
109
- isSavingDescription: pe,
110
- isMemoEditable: me,
111
- memoBadgeLabel: he,
113
+ descriptionValue: X,
114
+ initialDescriptionValue: de,
115
+ onDescriptionChange: fe,
116
+ onSaveDescription: pe,
117
+ onCancelDescription: me,
118
+ isSavingDescription: he,
119
+ isMemoEditable: ge,
120
+ memoBadgeLabel: _e,
112
121
  labels: Q
113
122
  }, `requirements-${x}`),
114
- ge && /* @__PURE__ */ h(f, {
123
+ ye && /* @__PURE__ */ m(f, {
115
124
  type: "approvals",
116
125
  title: $.approvalsCardTitle,
117
- hasAppliedPolicy: !!_e,
126
+ hasAppliedPolicy: !!be,
118
127
  isRejected: T,
119
- isAutoApproved: !!Ce,
120
- isManuallyApproved: !!we,
128
+ isAutoApproved: !!Ee,
129
+ isManuallyApproved: !!De,
121
130
  isPendingReview: E,
122
- rejectionReason: xe,
123
- greaterThanValue: ve,
124
- lessThanValue: ye,
125
- ruleLabel: be,
126
- approverName: Se,
131
+ rejectionReason: we,
132
+ greaterThanValue: xe,
133
+ lessThanValue: Se,
134
+ ruleLabel: Ce,
135
+ approverName: Te,
127
136
  labels: Q
128
137
  }, `approvals-${x}`),
129
- Te && /* @__PURE__ */ h(f, {
138
+ Oe && /* @__PURE__ */ m(f, {
130
139
  type: "accounting",
131
140
  title: $.accountingCardTitle,
132
- glCategory: Ee,
133
- initialGlCategory: De,
134
- glCategoryOptions: Oe,
135
- onGlCategoryChange: ke ?? v,
136
- department: Ae,
137
- initialDepartment: je,
138
- departmentOptions: Me,
139
- onDepartmentChange: Ne ?? v,
140
- location: Pe,
141
- initialLocation: Fe,
142
- locationOptions: Ie,
143
- onLocationChange: Le ?? v,
144
- onSave: Re ?? v,
145
- onCancel: ze ?? v,
146
- isSaving: !!Be,
147
- isGlCategoryDisabled: Ve,
148
- glCategoryHighlight: He,
149
- departmentHighlight: Ue,
150
- locationHighlight: We,
141
+ glCategory: ke,
142
+ initialGlCategory: Ae,
143
+ glCategoryOptions: je,
144
+ onGlCategoryChange: Me ?? v,
145
+ department: Ne,
146
+ initialDepartment: Pe,
147
+ departmentOptions: Fe,
148
+ onDepartmentChange: Ie ?? v,
149
+ location: Le,
150
+ initialLocation: Re,
151
+ locationOptions: ze,
152
+ onLocationChange: Be ?? v,
153
+ onSave: Ve ?? v,
154
+ onCancel: He ?? v,
155
+ isSaving: !!Ue,
156
+ isGlCategoryDisabled: Z,
157
+ isDisabled: We,
158
+ glCategoryHighlight: Ge,
159
+ departmentHighlight: Ke,
160
+ locationHighlight: qe,
151
161
  labels: Q
152
162
  }, `accounting-${x}`),
153
- Ge && /* @__PURE__ */ h(f, {
163
+ Je && /* @__PURE__ */ m(f, {
154
164
  type: "auditHistory",
155
165
  title: $.auditHistoryCardTitle,
156
- rows: Ke ?? [],
157
- isLoading: qe,
158
- isError: Je,
159
- historyLabels: Qe
166
+ rows: Ye ?? [],
167
+ isLoading: Xe,
168
+ isError: Ze,
169
+ historyLabels: tt
160
170
  }, `auditHistory-${x}`)
161
171
  ] })
162
172
  }),
163
- /* @__PURE__ */ h(i, {
173
+ /* @__PURE__ */ m(i, {
164
174
  className: "ttw:flex-row ttw:items-center ttw:justify-center ttw:border-t ttw:border-border ttw:p-6 ttw:sm:justify-center",
165
- children: A || j ? null : Ye
175
+ children: A || j ? null : Qe
166
176
  })
167
177
  ]
168
- }), /* @__PURE__ */ g("div", {
178
+ }), /* @__PURE__ */ h("div", {
169
179
  className: "ttw:relative ttw:flex ttw:flex-1/2 ttw:bg-muted ttw:px-6 ttw:py-20",
170
- children: [/* @__PURE__ */ h(ee, {
180
+ children: [/* @__PURE__ */ m(te, {
171
181
  asChild: !0,
172
182
  className: "ttw:absolute ttw:right-4 ttw:top-4",
173
- children: /* @__PURE__ */ h(n, {
183
+ children: /* @__PURE__ */ m(r, {
174
184
  type: "button",
175
185
  variant: "outline",
176
186
  size: "icon",
177
187
  "aria-label": $.closeDialog,
178
188
  disabled: M,
179
- children: /* @__PURE__ */ h(se, {
189
+ children: /* @__PURE__ */ m(ce, {
180
190
  className: "ttw:size-4",
181
191
  "aria-hidden": !0
182
192
  })
183
193
  })
184
- }), k ? /* @__PURE__ */ h(d, {
194
+ }), k ? /* @__PURE__ */ m(d, {
185
195
  url: k,
186
196
  className: "ttw:h-full ttw:min-h-0 ttw:w-full",
187
197
  showDeleteOption: !!K,
188
198
  onDeleteClick: K,
189
- labels: Ze
190
- }) : q || Y ? /* @__PURE__ */ h("button", {
199
+ labels: et
200
+ }) : q || J ? /* @__PURE__ */ m("button", {
191
201
  type: "button",
192
- disabled: A || X,
193
- "aria-label": X ? $.uploadingReceipt : `${$.dropFilesHere} ${$.clickToBrowse}`,
202
+ disabled: A || Y,
203
+ "aria-label": Y ? $.uploadingReceipt : `${$.dropFilesHere} ${$.clickToBrowse}`,
194
204
  onClick: () => {
195
- A || X || q?.();
205
+ A || Y || q?.();
196
206
  },
197
207
  onDragOver: (e) => e.preventDefault(),
198
208
  onDrop: (e) => {
199
- if (A || X) return;
209
+ if (A || Y) return;
200
210
  e.preventDefault();
201
211
  let t = e.dataTransfer.files[0];
202
- t && Y?.(t);
212
+ t && J?.(t);
203
213
  },
204
214
  className: "ttw:flex ttw:h-full ttw:w-full ttw:cursor-pointer ttw:flex-col ttw:items-center ttw:justify-center ttw:gap-2 ttw:rounded-md ttw:border ttw:border-dashed ttw:border-border ttw:bg-background ttw:px-6 ttw:disabled:cursor-default",
205
- children: X ? /* @__PURE__ */ g(m, { children: [
206
- /* @__PURE__ */ h(ae, {
215
+ children: Y ? /* @__PURE__ */ h(p, { children: [
216
+ /* @__PURE__ */ m(g, {
207
217
  className: "ttw:size-5 ttw:animate-spin ttw:text-primary",
208
218
  "aria-hidden": !0
209
219
  }),
210
- /* @__PURE__ */ h(l, {
220
+ /* @__PURE__ */ m(l, {
211
221
  variant: "body2",
212
222
  component: "span",
213
223
  className: "ttw:font-semibold",
214
224
  children: $.uploadingReceipt
215
225
  }),
216
- /* @__PURE__ */ h(l, {
226
+ /* @__PURE__ */ m(l, {
217
227
  variant: "body2",
218
228
  component: "span",
219
229
  color: "muted",
220
230
  children: $.uploadingReceiptBody
221
231
  })
222
- ] }) : !A && /* @__PURE__ */ g(m, { children: [
223
- /* @__PURE__ */ h("div", {
232
+ ] }) : !A && /* @__PURE__ */ h(p, { children: [
233
+ /* @__PURE__ */ m("div", {
224
234
  className: "ttw:flex ttw:size-11 ttw:items-center ttw:justify-center ttw:rounded-full ttw:bg-primary",
225
- children: /* @__PURE__ */ h(re, {
235
+ children: /* @__PURE__ */ m(ae, {
226
236
  className: "ttw:size-5 ttw:text-primary-foreground",
227
237
  "aria-hidden": !0
228
238
  })
229
239
  }),
230
- /* @__PURE__ */ g(l, {
240
+ /* @__PURE__ */ h(l, {
231
241
  variant: "body2",
232
242
  component: "span",
233
243
  children: [
234
244
  $.dropFilesHere,
235
245
  " ",
236
- /* @__PURE__ */ h("span", {
246
+ /* @__PURE__ */ m("span", {
237
247
  className: "ttw:text-primary ttw:underline",
238
248
  children: $.clickToBrowse
239
249
  })
240
250
  ]
241
251
  }),
242
- /* @__PURE__ */ h(l, {
252
+ /* @__PURE__ */ m(l, {
243
253
  variant: "caption",
244
254
  color: "muted",
245
255
  children: $.acceptedFileTypes
246
256
  })
247
257
  ] })
248
- }) : /* @__PURE__ */ h("div", {
258
+ }) : /* @__PURE__ */ m("div", {
249
259
  className: "ttw:flex ttw:size-full ttw:flex-col ttw:items-center ttw:justify-center ttw:gap-2 ttw:rounded-md ttw:border ttw:border-dashed ttw:border-border ttw:bg-background",
250
- children: !A && /* @__PURE__ */ g(m, { children: [/* @__PURE__ */ h("div", {
260
+ children: !A && /* @__PURE__ */ h(p, { children: [/* @__PURE__ */ m("div", {
251
261
  className: "ttw:flex ttw:size-11 ttw:items-center ttw:justify-center ttw:rounded-full ttw:bg-muted",
252
- children: /* @__PURE__ */ h(oe, {
262
+ children: /* @__PURE__ */ m(se, {
253
263
  className: "ttw:size-5 ttw:text-muted-foreground",
254
264
  "aria-hidden": !0
255
265
  })
256
- }), /* @__PURE__ */ h(l, {
266
+ }), /* @__PURE__ */ m(l, {
257
267
  variant: "body2",
258
268
  color: "muted",
259
269
  children: $.noReceiptAttached
@@ -15,6 +15,7 @@ var e = {
15
15
  acceptedFileTypes: "SVG, PNG, JPG or GIF (max. 3MB)",
16
16
  uploadingReceipt: "Processing receipts...",
17
17
  uploadingReceiptBody: "Give us a few seconds to process your attachment.",
18
+ readingReceipt: "Reading receipt…",
18
19
  loadFailed: "This transaction could not be loaded. Please try again."
19
20
  };
20
21
  //#endregion
@@ -1,5 +1,5 @@
1
1
  //#region ../../libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js
2
- var e = "@tesouro/embedded-components-react", t = "0.7.0", n = "72322e581dc64f93e281c2e19cc22d6683d79a6a", r = Object.freeze({
2
+ var e = "@tesouro/embedded-components-react", t = "0.7.1", n = "d85210973d9434812a992830457a63870b1bb361", 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.7.0",
3
+ "version": "0.7.1",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "sideEffects": [