@tesouro/embedded-components-react 0.5.266 → 0.5.267

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.
package/dist/index.d.ts CHANGED
@@ -5065,6 +5065,8 @@ interface ReceivableBillingSectionLabels {
5065
5065
  paymentTermsPlaceholder: string;
5066
5066
  paymentTermsReceiptDue: string;
5067
5067
  paymentTermsCustomDate: string;
5068
+ purchaseOrderLabel: string;
5069
+ purchaseOrderOptional: string;
5068
5070
  }
5069
5071
 
5070
5072
  interface ReceivableRecurrenceSectionLabels {
@@ -5355,6 +5357,7 @@ interface ReceivablePreviewLabels {
5355
5357
  invoiceDateLabel: string;
5356
5358
  dueDateLabel: string;
5357
5359
  paymentTermsLabel: string;
5360
+ purchaseOrderLabel: string;
5358
5361
  pending: string;
5359
5362
  descriptionColumn: string;
5360
5363
  quantityColumn: string;
@@ -1004,6 +1004,8 @@ interface ReceivableBillingSectionLabels {
1004
1004
  paymentTermsPlaceholder: string;
1005
1005
  paymentTermsReceiptDue: string;
1006
1006
  paymentTermsCustomDate: string;
1007
+ purchaseOrderLabel: string;
1008
+ purchaseOrderOptional: string;
1007
1009
  }
1008
1010
 
1009
1011
  interface ReceivableRecurrenceSectionLabels {
@@ -1294,6 +1296,7 @@ interface ReceivablePreviewLabels {
1294
1296
  invoiceDateLabel: string;
1295
1297
  dueDateLabel: string;
1296
1298
  paymentTermsLabel: string;
1299
+ purchaseOrderLabel: string;
1297
1300
  pending: string;
1298
1301
  descriptionColumn: string;
1299
1302
  quantityColumn: string;
@@ -132,6 +132,8 @@ function A({ auditHistoryLabels: i, bankAttribution: c, counterpartFormLabels: A
132
132
  disabled: Z.form.isSubmitting,
133
133
  onPaymentTermsChange: Z.form.paymentTerms.select,
134
134
  onCustomDatePickerOpenChange: Z.form.paymentTerms.changeCustomDatePickerOpen,
135
+ purchaseOrder: Z.form.purchaseOrder,
136
+ onPurchaseOrderChange: (e) => Z.form.updateValues({ purchaseOrder: e }),
135
137
  customDateCalendar: /* @__PURE__ */ O(e, {
136
138
  mode: "single",
137
139
  captionLayout: "dropdown",
@@ -23,6 +23,7 @@ var e = {
23
23
  payment_terms_id: "paymentTermsId",
24
24
  "payment_terms.term_final.end_date": "paymentTermsId",
25
25
  "payment_terms.term_final.number_of_days": "paymentTermsId",
26
+ purchase_order: "purchaseOrder",
26
27
  memo: "openingNote",
27
28
  footer: "closingNote",
28
29
  "discount.amount": "discount"
@@ -36,6 +36,7 @@ function w() {
36
36
  shippingAddressId: "",
37
37
  paymentReminderId: "",
38
38
  overdueReminderId: "",
39
+ purchaseOrder: "",
39
40
  attachments: [],
40
41
  ...m()
41
42
  };
@@ -174,6 +175,7 @@ function B({ values: e, billingAddressId: t, shippingAddressId: n, unitNamesById
174
175
  ...h(e),
175
176
  payment_reminder_id: e.paymentReminderId || void 0,
176
177
  overdue_reminder_id: e.overdueReminderId || void 0,
178
+ purchase_order: e.purchaseOrder || void 0,
177
179
  attachments: f(e.attachments),
178
180
  type: "invoice"
179
181
  };
@@ -204,6 +206,7 @@ function V(e, t) {
204
206
  shippingAddressId: e.counterpart_shipping_address?.id ?? "",
205
207
  paymentReminderId: a?.payment_reminder_id ?? "",
206
208
  overdueReminderId: a?.overdue_reminder_id ?? "",
209
+ purchaseOrder: a?.purchase_order ?? "",
207
210
  attachments: p(e)
208
211
  };
209
212
  }
@@ -220,6 +220,7 @@ function P({ values: e, totals: t, entity: n, counterpart: r, billingAddress: i,
220
220
  issueDate: g,
221
221
  messages: d
222
222
  }),
223
+ purchaseOrder: e.purchaseOrder || void 0,
223
224
  openingNote: e.openingNote || void 0,
224
225
  lineItems: p.length > 0 ? {
225
226
  kind: "rows",
@@ -48,56 +48,56 @@ function st(e, t) {
48
48
  });
49
49
  }
50
50
  function ct({ messages: l, counterpartMessageLabels: ct, embeddedBankName: lt, onCreated: ut }) {
51
- let dt = Ue(), ft = Ge(), pt = Ke(), mt = Je(), ht = We(), g = m("draft"), gt = m(!1), [_t, vt] = h(), _ = m(!1), v = m(!1), yt = m(null), y = m(void 0), b = m([]), bt = m(""), [x, S] = h(!1), [C, xt] = h("create"), [St, Ct] = h(), [wt, Tt] = h(), [w, T] = h(() => Me()), E = m(w), [Et, D] = h(!1), [Dt, O] = h({}), [Ot, kt] = h("none"), At = ge(), k = he(), A = k.data?.data, { unitNamesById: j } = At, [jt, Mt] = h(), [M, Nt] = h(!1), Pt = m(!1), N = m(!1), P = m(!1), F = m({
51
+ let dt = Ue(), ft = Ge(), pt = Ke(), mt = Je(), ht = We(), g = m("draft"), gt = m(!1), [_t, vt] = h(), _ = m(!1), v = m(!1), yt = m(null), y = m(void 0), b = m([]), bt = m(""), [x, S] = h(!1), [C, xt] = h("create"), [St, Ct] = h(), [wt, Tt] = h(), [w, T] = h(() => Me()), E = m(w), [Et, D] = h(!1), [Dt, O] = h({}), [Ot, kt] = h("none"), At = ge(), k = he(), A = k.data?.data, { unitNamesById: j } = At, [jt, Mt] = h(), [M, Nt] = h(!1), Pt = m(!1), Ft = m(!1), N = m(!1), P = m({
52
52
  lines: !1,
53
53
  discount: !1
54
- }), [Ft, I] = h(!1), It = p(() => t(), []), Lt = p(() => ({
54
+ }), [It, F] = h(!1), Lt = p(() => t(), []), Rt = p(() => ({
55
55
  ...n,
56
56
  ...ct
57
- }), [ct]), Rt = a(w.customerId), zt = i(w.customerId || void 0), Bt = Rt.data?.data?.[0], { billingAddressId: L, billingAddress: Vt, shippingAddressId: Ht } = Re({
57
+ }), [ct]), zt = a(w.customerId), Bt = i(w.customerId || void 0), Vt = zt.data?.data?.[0], { billingAddressId: I, billingAddress: Ht, shippingAddressId: Ut } = Re({
58
58
  values: w,
59
- counterpart: zt.data,
60
- addresses: Rt.data?.data
61
- }), R = !!w.customerId && (Rt.isLoading || zt.isLoading), z = Ye({
59
+ counterpart: Bt.data,
60
+ addresses: zt.data?.data
61
+ }), L = !!w.customerId && (zt.isLoading || Bt.isLoading), R = Ye({
62
62
  counterpartId: w.customerId,
63
- billingAddressId: L,
64
- billingCountry: Vt?.country
65
- }), Ut = z.isLoading || R, Wt = d((e) => {
63
+ billingAddressId: I,
64
+ billingCountry: Ht?.country
65
+ }), Wt = R.isLoading || L, Gt = d((e) => {
66
66
  T((t) => ({
67
67
  ...t,
68
68
  attachments: e(t.attachments)
69
69
  }));
70
- }, []), B = et({
70
+ }, []), z = et({
71
71
  attachments: w.attachments,
72
- setAttachments: Wt,
72
+ setAttachments: Gt,
73
73
  receivableId: St
74
- }), { reset: V, discardUploads: Gt, commitRemovals: Kt } = B, qt = w.type === "invoice" ? me({
74
+ }), { reset: B, discardUploads: Kt, commitRemovals: qt } = z, Jt = w.type === "invoice" ? me({
75
75
  attachments: w.attachments,
76
- pendingUploads: B.pendingUploads,
77
- isCountLimitReached: B.isCountLimitReached,
76
+ pendingUploads: z.pendingUploads,
77
+ isCountLimitReached: z.isCountLimitReached,
78
78
  isRecurring: u(w),
79
79
  messages: l
80
- }) : void 0, Jt = d((e) => {
80
+ }) : void 0, Yt = d((e) => {
81
81
  T((t) => st(t, e ?? ""));
82
- }, []), Yt = o({
82
+ }, []), Xt = o({
83
83
  view: Ot,
84
84
  setView: kt,
85
85
  selectedId: w.customerId || void 0,
86
- setSelectedId: Jt,
87
- messages: Lt,
86
+ setSelectedId: Yt,
87
+ messages: Rt,
88
88
  counterpartType: "customer",
89
89
  counterpart: void 0,
90
- primaryAddress: Bt
91
- }), { openCreate: Xt, setValues: Zt } = Yt, Qt = d(() => {
92
- Xt(), Zt((e) => ({
90
+ primaryAddress: Vt
91
+ }), { openCreate: Zt, setValues: Qt } = Xt, $t = d(() => {
92
+ Zt(), Qt((e) => ({
93
93
  ...e,
94
94
  email: w.customerEmail.trim()
95
95
  }));
96
96
  }, [
97
- Xt,
98
97
  Zt,
98
+ Qt,
99
99
  w.customerEmail
100
- ]), $t = d((e) => T((t) => {
100
+ ]), en = d((e) => T((t) => {
101
101
  let n = e({
102
102
  paymentTermsId: t.paymentTermsId,
103
103
  paymentTermsCustomDate: t.paymentTermsCustomDate
@@ -107,14 +107,14 @@ function ct({ messages: l, counterpartMessageLabels: ct, embeddedBankName: lt, o
107
107
  ...n,
108
108
  ...n.paymentTermsId === "receipt_due" ? { paymentReminderId: "" } : {}
109
109
  };
110
- }), []), en = tt({
110
+ }), []), tn = tt({
111
111
  paymentTermsId: w.paymentTermsId,
112
112
  paymentTermsCustomDate: w.paymentTermsCustomDate,
113
113
  issueDate: w.issueDate,
114
114
  isRecurring: w.type === "invoice" && u(w),
115
115
  messages: l,
116
- onChange: $t
117
- }), tn = en.reset, nn = d((e, { automatic: t = !1 } = {}) => {
116
+ onChange: en
117
+ }), nn = tn.reset, rn = d((e, { automatic: t = !1 } = {}) => {
118
118
  t && (E.current = {
119
119
  ...E.current,
120
120
  ...e
@@ -122,18 +122,18 @@ function ct({ messages: l, counterpartMessageLabels: ct, embeddedBankName: lt, o
122
122
  ...t,
123
123
  ...e
124
124
  }));
125
- }, []), H = rt({
125
+ }, []), V = rt({
126
126
  open: x,
127
127
  bankAccountId: w.bankAccountId,
128
128
  bankAccountType: w.bankAccountType,
129
129
  embeddedBankName: lt,
130
130
  messages: l,
131
- onSelect: nn
132
- }), rn = H.reset, an = qe(wt), U = wt ? an.data : void 0, W = be(U), on = W > 0, G = !!wt && an.isLoading, K = m(void 0);
131
+ onSelect: rn
132
+ }), an = V.reset, on = qe(wt), H = wt ? on.data : void 0, U = be(H), sn = U > 0, W = !!wt && on.isLoading, G = m(void 0);
133
133
  f(() => {
134
- if (!U || K.current === U.id) return;
135
- K.current = U.id;
136
- let e = xe(U);
134
+ if (!H || G.current === H.id) return;
135
+ G.current = H.id;
136
+ let e = xe(H);
137
137
  E.current = {
138
138
  ...E.current,
139
139
  ...e
@@ -141,25 +141,25 @@ function ct({ messages: l, counterpartMessageLabels: ct, embeddedBankName: lt, o
141
141
  ...t,
142
142
  ...e
143
143
  }));
144
- }, [U]);
145
- let sn = d((e) => T(e), []), cn = d((e) => O((t) => {
144
+ }, [H]);
145
+ let cn = d((e) => T(e), []), ln = d((e) => O((t) => {
146
146
  if (!e.some((e) => e in t)) return t;
147
147
  let n = { ...t };
148
148
  return e.forEach((e) => delete n[e]), n;
149
- }), []), ln = m([]), un = d((e) => {
149
+ }), []), un = m([]), dn = d((e) => {
150
150
  if (!M) {
151
- cn(e);
151
+ ln(e);
152
152
  return;
153
153
  }
154
- ln.current.push(...e);
155
- }, [cn, M]);
154
+ un.current.push(...e);
155
+ }, [ln, M]);
156
156
  f(() => {
157
- let e = ln.current;
157
+ let e = un.current;
158
158
  if (!e.length) return;
159
- ln.current = [];
159
+ un.current = [];
160
160
  let t = Se({
161
161
  fields: w,
162
- issuedCount: W,
162
+ issuedCount: U,
163
163
  messages: l
164
164
  });
165
165
  O((n) => {
@@ -169,67 +169,67 @@ function ct({ messages: l, counterpartMessageLabels: ct, embeddedBankName: lt, o
169
169
  }), r;
170
170
  });
171
171
  }, [
172
- W,
172
+ U,
173
173
  l,
174
174
  w
175
175
  ]);
176
- let dn = nt({
176
+ let fn = nt({
177
177
  values: w,
178
178
  errors: Dt,
179
- lockSchedule: on,
179
+ lockSchedule: sn,
180
180
  messages: l,
181
- onChange: sn,
182
- onClearErrors: cn,
183
- onRevalidateErrors: un
184
- }), q = dn.reset, fn = d((e) => T((t) => ({
181
+ onChange: cn,
182
+ onClearErrors: ln,
183
+ onRevalidateErrors: dn
184
+ }), K = fn.reset, pn = d((e) => T((t) => ({
185
185
  ...t,
186
186
  ...e
187
- })), []), J = dt.isPending || ft.isPending || pt.isPending || mt.isPending || ht.isPending, pn = it({
187
+ })), []), q = dt.isPending || ft.isPending || pt.isPending || mt.isPending || ht.isPending, mn = it({
188
188
  open: x,
189
189
  isInvoice: w.type === "invoice",
190
- disabled: J,
190
+ disabled: q,
191
191
  paymentTermsId: w.paymentTermsId,
192
192
  paymentTermsCustomDate: w.paymentTermsCustomDate,
193
193
  paymentReminderId: w.paymentReminderId,
194
194
  overdueReminderId: w.overdueReminderId,
195
195
  messages: l,
196
- onSelect: fn
197
- }), mn = pn.reset, hn = d(() => {
198
- b.current = [], Mt(void 0), xt("create"), Ct(void 0), Tt(void 0), K.current = void 0, y.current = void 0, g.current = "draft", _.current = !1, v.current = !1, T(Me()), D(!1), O({}), Nt(!1), I(!1), F.current = {
196
+ onSelect: pn
197
+ }), hn = mn.reset, gn = d(() => {
198
+ b.current = [], Mt(void 0), xt("create"), Ct(void 0), Tt(void 0), G.current = void 0, y.current = void 0, g.current = "draft", _.current = !1, v.current = !1, T(Me()), D(!1), O({}), Nt(!1), F(!1), P.current = {
199
199
  lines: !1,
200
200
  discount: !1
201
- }, V(), q();
202
- }, [V, q]), gn = d((e = "invoice", { customerId: t = "" } = {}) => {
203
- tn(), rn(), q();
201
+ }, B(), K();
202
+ }, [B, K]), _n = d((e = "invoice", { customerId: t = "" } = {}) => {
203
+ nn(), an(), K();
204
204
  let n = {
205
205
  ...Me(),
206
206
  type: e,
207
207
  customerId: t
208
208
  };
209
- mn(He(n)), b.current = [], y.current = void 0, g.current = "draft", _.current = !1, v.current = !1, K.current = void 0, Mt(void 0), xt("create"), Ct(void 0), Tt(void 0), E.current = n, T(n), D(!1), O({}), V(), Nt(!1), I(!1), F.current = {
209
+ hn(He(n)), b.current = [], y.current = void 0, g.current = "draft", _.current = !1, v.current = !1, G.current = void 0, Mt(void 0), xt("create"), Ct(void 0), Tt(void 0), E.current = n, T(n), D(!1), O({}), B(), Nt(!1), F(!1), P.current = {
210
210
  lines: !1,
211
211
  discount: !1
212
212
  }, S(!0);
213
213
  }, [
214
- V,
215
- tn,
216
- rn,
217
- q,
218
- mn
219
- ]), _n = d((e, { highlightForIssue: t = !1 } = {}) => {
214
+ B,
215
+ nn,
216
+ an,
217
+ K,
218
+ hn
219
+ ]), vn = d((e, { highlightForIssue: t = !1 } = {}) => {
220
220
  if (e.type === "credit_note") return;
221
- tn(), rn(), q();
221
+ nn(), an(), K();
222
222
  let n = Le(e, A);
223
- mn(He(n)), b.current = e.line_items, bt.current = e.currency, y.current = void 0, g.current = t ? "issue" : "draft", _.current = !1, v.current = t, K.current = void 0, Mt(void 0), xt("edit"), Ct(e.id), Tt(e.type === "invoice" ? e.recurrence_id ?? void 0 : void 0), E.current = n, T(n), D(!1), O({}), Nt(!1), I(!1), F.current = {
223
+ hn(He(n)), b.current = e.line_items, bt.current = e.currency, y.current = void 0, g.current = t ? "issue" : "draft", _.current = !1, v.current = t, G.current = void 0, Mt(void 0), xt("edit"), Ct(e.id), Tt(e.type === "invoice" ? e.recurrence_id ?? void 0 : void 0), E.current = n, T(n), D(!1), O({}), Nt(!1), F(!1), P.current = {
224
224
  lines: !1,
225
225
  discount: !1
226
- }, V(), S(!0);
226
+ }, B(), S(!0);
227
227
  }, [
228
- V,
229
- tn,
230
- rn,
231
- q,
232
- mn,
228
+ B,
229
+ nn,
230
+ an,
231
+ K,
232
+ hn,
233
233
  A
234
234
  ]);
235
235
  f(() => {
@@ -244,14 +244,14 @@ function ct({ messages: l, counterpartMessageLabels: ct, embeddedBankName: lt, o
244
244
  };
245
245
  }));
246
246
  }, [A]);
247
- let Y = B.isUploading, X = d(() => {
248
- Y || (Gt(), D(!1), S(!1), O({}));
249
- }, [Gt, Y]), vn = d(() => {
247
+ let J = z.isUploading, Y = d(() => {
248
+ J || (Kt(), D(!1), S(!1), O({}));
249
+ }, [Kt, J]), yn = d(() => {
250
250
  if (Et) {
251
251
  D(!1);
252
252
  return;
253
253
  }
254
- if (Y) {
254
+ if (J) {
255
255
  e.error(l.attachmentsUploading);
256
256
  return;
257
257
  }
@@ -259,16 +259,16 @@ function ct({ messages: l, counterpartMessageLabels: ct, embeddedBankName: lt, o
259
259
  D(!0);
260
260
  return;
261
261
  }
262
- X();
262
+ Y();
263
263
  }, [
264
- X,
265
264
  Y,
265
+ J,
266
266
  l.attachmentsUploading,
267
267
  Et,
268
268
  w
269
- ]), yn = d((e) => {
269
+ ]), bn = d((e) => {
270
270
  let t = { ...e };
271
- t.taxRate !== void 0 && (t.taxRate = ce(t.taxRate), P.current = !0), t.type !== void 0 && t.type !== "invoice" && Gt(), t.type !== void 0 && (g.current = "draft"), t.discount !== void 0 && M && (N.current = !0), t.discountType !== void 0 && (N.current = !0), t.currency !== void 0 && (Pt.current = !0), T((e) => {
271
+ t.taxRate !== void 0 && (t.taxRate = ce(t.taxRate), N.current = !0), t.type !== void 0 && t.type !== "invoice" && Kt(), t.type !== void 0 && (g.current = "draft"), t.discount !== void 0 && M && (Ft.current = !0), t.discountType !== void 0 && (Ft.current = !0), t.currency !== void 0 && (Pt.current = !0), T((e) => {
272
272
  let n = {
273
273
  ...t.customerId === void 0 ? e : st(e, t.customerId),
274
274
  ...t
@@ -282,8 +282,8 @@ function ct({ messages: l, counterpartMessageLabels: ct, embeddedBankName: lt, o
282
282
  currency: n.currency
283
283
  })), n;
284
284
  });
285
- }, [Gt, M]), bn = d(() => I(!0), []), xn = d(() => {
286
- I(!1), N.current = !0, T((e) => ({
285
+ }, [Kt, M]), xn = d(() => F(!0), []), Sn = d(() => {
286
+ F(!1), Ft.current = !0, T((e) => ({
287
287
  ...e,
288
288
  discount: we({
289
289
  value: e.discount,
@@ -291,46 +291,46 @@ function ct({ messages: l, counterpartMessageLabels: ct, embeddedBankName: lt, o
291
291
  currency: e.currency
292
292
  })
293
293
  }));
294
- }, []), Sn = d(() => {
295
- P.current = !0, T((e) => {
294
+ }, []), Cn = d(() => {
295
+ N.current = !0, T((e) => {
296
296
  let t = c(e.taxRate);
297
297
  return t === e.taxRate ? e : {
298
298
  ...e,
299
299
  taxRate: t
300
300
  };
301
301
  });
302
- }, []), Z = d((e, { validate: t }) => {
302
+ }, []), X = d((e, { validate: t }) => {
303
303
  t && (Pt.current = !0), T((t) => ({
304
304
  ...t,
305
305
  lineItems: e(t.lineItems)
306
306
  }));
307
307
  }, []);
308
308
  f(() => {
309
- let e = Pt.current, t = N.current;
310
- if (!e && !t && !P.current) return;
311
- Pt.current = !1, N.current = !1, P.current = !1, e && (F.current.lines = !0), t && (F.current.discount = !0);
312
- let n = _.current || W > 0, r = e ? pe(w.lineItems, {
309
+ let e = Pt.current, t = Ft.current;
310
+ if (!e && !t && !N.current) return;
311
+ Pt.current = !1, Ft.current = !1, N.current = !1, e && (P.current.lines = !0), t && (P.current.discount = !0);
312
+ let n = _.current || U > 0, r = e ? pe(w.lineItems, {
313
313
  currency: w.currency,
314
314
  messages: l,
315
315
  requireComplete: n
316
316
  }) : void 0;
317
317
  O((t) => {
318
318
  let i = { ...t };
319
- return F.current.lines && (i.lineItems = e ? r : t.lineItems, i.lineItemsSummary = de(i.lineItems, je(w, l), n && w.lineItems.length === 0 ? l.lineItemsRequired : void 0)), F.current.discount && (i.discount = Ae(w, l)), i;
319
+ return P.current.lines && (i.lineItems = e ? r : t.lineItems, i.lineItemsSummary = de(i.lineItems, je(w, l), n && w.lineItems.length === 0 ? l.lineItemsRequired : void 0)), P.current.discount && (i.discount = Ae(w, l)), i;
320
320
  });
321
321
  }, [
322
- W,
322
+ U,
323
323
  l,
324
324
  w
325
325
  ]);
326
- let Cn = d((e, t) => {
326
+ let wn = d((e, t) => {
327
327
  let { unit: n, ...r } = t, i = se(r);
328
- i.name !== void 0 && (i.productId = ""), n !== void 0 && (i.measureUnitId = n, i.measureUnitName = ""), i.taxable !== void 0 && (P.current = !0), Z((t) => t.map((t) => t.id === e ? {
328
+ i.name !== void 0 && (i.productId = ""), n !== void 0 && (i.measureUnitId = n, i.measureUnitName = ""), i.taxable !== void 0 && (N.current = !0), X((t) => t.map((t) => t.id === e ? {
329
329
  ...t,
330
330
  ...i
331
331
  } : t), { validate: M });
332
- }, [Z, M]), wn = d((e, t) => {
333
- Z((n) => n.map((n) => n.id === e ? {
332
+ }, [X, M]), Tn = d((e, t) => {
333
+ X((n) => n.map((n) => n.id === e ? {
334
334
  ...n,
335
335
  ...ie({
336
336
  product: t,
@@ -339,57 +339,57 @@ function ct({ messages: l, counterpartMessageLabels: ct, embeddedBankName: lt, o
339
339
  })
340
340
  } : n), { validate: !0 });
341
341
  }, [
342
- Z,
342
+ X,
343
343
  j,
344
344
  w.currency
345
- ]), Tn = d((e, t) => {
346
- t && Z((n) => t.kind === "remove" ? n.filter((t) => t.id !== e) : n.map((n) => n.id === e ? {
345
+ ]), En = d((e, t) => {
346
+ t && X((n) => t.kind === "remove" ? n.filter((t) => t.id !== e) : n.map((n) => n.id === e ? {
347
347
  ...n,
348
348
  ...t.patch
349
349
  } : n), { validate: !0 });
350
- }, [Z]), En = d((e, t) => {
350
+ }, [X]), Dn = d((e, t) => {
351
351
  let n = w.lineItems.find((t) => t.id === e);
352
- n && Tn(e, s({
352
+ n && En(e, s({
353
353
  lineItem: n,
354
354
  field: t,
355
355
  rowCount: w.lineItems.length,
356
356
  currency: w.currency
357
357
  }));
358
358
  }, [
359
- Tn,
359
+ En,
360
360
  w.currency,
361
361
  w.lineItems
362
- ]), Dn = d((e, t) => {
362
+ ]), On = d((e, t) => {
363
363
  let n = w.lineItems.find((t) => t.id === e);
364
- n && Tn(e, le({
364
+ n && En(e, le({
365
365
  lineItem: n,
366
366
  step: t,
367
367
  rowCount: w.lineItems.length
368
368
  }));
369
- }, [Tn, w.lineItems]), On = d(() => {
369
+ }, [En, w.lineItems]), kn = d(() => {
370
370
  let e = ne(w.currency);
371
371
  Mt(e.id), T((t) => ({
372
372
  ...t,
373
373
  lineItems: [...t.lineItems, e]
374
374
  }));
375
- }, [w.currency]), kn = d((e) => {
376
- Z((t) => t.length <= 1 ? t : t.filter((t) => t.id !== e), { validate: !0 });
377
- }, [Z]), An = d((e, t) => e.type === "invoice" && (t === "issue" || Ce(e) && W === 0), [W]), jn = d((e, t) => ({
375
+ }, [w.currency]), An = d((e) => {
376
+ X((t) => t.length <= 1 ? t : t.filter((t) => t.id !== e), { validate: !0 });
377
+ }, [X]), Z = d((e, t) => e.type === "invoice" && (t === "issue" || Ce(e) && U === 0), [U]), jn = d((e, t) => ({
378
378
  ...Be({
379
379
  values: e,
380
- billingAddressId: L,
380
+ billingAddressId: I,
381
381
  messages: l,
382
382
  willIssue: t,
383
- hasStartedRecurrence: W > 0
383
+ hasStartedRecurrence: U > 0
384
384
  }),
385
385
  ...e.type === "invoice" && u(e) ? Se({
386
386
  fields: e,
387
- issuedCount: W,
387
+ issuedCount: U,
388
388
  messages: l
389
389
  }) : {}
390
390
  }), [
391
- L,
392
- W,
391
+ I,
392
+ U,
393
393
  l
394
394
  ]), Mn = d(() => {
395
395
  requestAnimationFrame(() => {
@@ -402,49 +402,50 @@ function ct({ messages: l, counterpartMessageLabels: ct, embeddedBankName: lt, o
402
402
  });
403
403
  });
404
404
  }, []), Nn = d((e, t) => {
405
- O(e), Nt(!0), _.current = t, F.current = {
405
+ O(e), Nt(!0), _.current = t, P.current = {
406
406
  lines: !0,
407
407
  discount: !0
408
408
  }, Mn();
409
- }, [Mn]), Pn = !wt || w.frequency !== "once" || an.isError;
409
+ }, [Mn]), Pn = !wt || w.frequency !== "once" || on.isError;
410
410
  f(() => {
411
- if (!x || !v.current || R || G || !Pn) return;
411
+ if (!x || !v.current || L || W || !Pn) return;
412
412
  v.current = !1;
413
- let e = An(w, "issue");
413
+ let e = Z(w, "issue");
414
414
  Nn(jn(w, e), e);
415
415
  }, [
416
- R,
416
+ L,
417
417
  x,
418
418
  Pn,
419
- G,
419
+ W,
420
420
  Nn,
421
421
  jn,
422
422
  w,
423
- An
423
+ Z
424
424
  ]);
425
425
  let Fn = m({
426
426
  values: w,
427
- billingAddressId: L
427
+ billingAddressId: I
428
428
  });
429
429
  f(() => {
430
430
  let e = Fn.current;
431
431
  if (Fn.current = {
432
432
  values: w,
433
- billingAddressId: L
433
+ billingAddressId: I
434
434
  }, !M) return;
435
435
  let t = [
436
436
  "customerId",
437
437
  "customerEmail",
438
438
  "paymentTermsId",
439
+ "purchaseOrder",
439
440
  "bankAccountId",
440
441
  "openingNote",
441
442
  "closingNote",
442
443
  "taxRate"
443
- ].filter((t) => e.values[t] !== w[t] || t === "customerId" && e.billingAddressId !== L || t === "paymentTermsId" && e.values.paymentTermsCustomDate !== w.paymentTermsCustomDate);
444
+ ].filter((t) => e.values[t] !== w[t] || t === "customerId" && e.billingAddressId !== I || t === "paymentTermsId" && e.values.paymentTermsCustomDate !== w.paymentTermsCustomDate);
444
445
  if (!t.length) return;
445
446
  let n = Be({
446
447
  values: w,
447
- billingAddressId: L,
448
+ billingAddressId: I,
448
449
  messages: l,
449
450
  willIssue: _.current
450
451
  });
@@ -455,18 +456,18 @@ function ct({ messages: l, counterpartMessageLabels: ct, embeddedBankName: lt, o
455
456
  }), r;
456
457
  });
457
458
  }, [
458
- L,
459
+ I,
459
460
  l,
460
461
  M,
461
462
  w
462
463
  ]);
463
464
  let In = d(async (t) => {
464
- if (g.current = t, G) return;
465
- if (Y) {
465
+ if (g.current = t, W) return;
466
+ if (J) {
466
467
  e.error(l.attachmentsUploading);
467
468
  return;
468
469
  }
469
- if (k.isLoading || R) {
470
+ if (k.isLoading || L) {
470
471
  e.error(l.lineItemsLoading);
471
472
  return;
472
473
  }
@@ -475,12 +476,12 @@ function ct({ messages: l, counterpartMessageLabels: ct, embeddedBankName: lt, o
475
476
  lineItems: n
476
477
  };
477
478
  i !== w && T(i);
478
- let a = i.type === "invoice" && u(i), o = An(i, t);
479
- if (o && (Ut || H.isLoading)) {
479
+ let a = i.type === "invoice" && u(i), o = Z(i, t);
480
+ if (o && (Wt || V.isLoading)) {
480
481
  e.error(l.issueChecksLoading);
481
482
  return;
482
483
  }
483
- if (o && !H.canAddAccount && !i.bankAccountId && !H.hasAccounts) {
484
+ if (o && !V.canAddAccount && !i.bankAccountId && !V.hasAccounts) {
484
485
  e.error(l.issueBankAccountUnavailable);
485
486
  return;
486
487
  }
@@ -489,12 +490,12 @@ function ct({ messages: l, counterpartMessageLabels: ct, embeddedBankName: lt, o
489
490
  Nn(ee, o);
490
491
  return;
491
492
  }
492
- if (O({}), o && z.isTaxIdMissing) {
493
+ if (O({}), o && R.isTaxIdMissing) {
493
494
  e.error(l.issueTaxIdRequired);
494
495
  return;
495
496
  }
496
497
  if (o && (i.paymentReminderId || i.overdueReminderId)) {
497
- let t = Ve(z.counterpart, l);
498
+ let t = Ve(R.counterpart, l);
498
499
  if (t) {
499
500
  e.error(t);
500
501
  return;
@@ -519,12 +520,12 @@ function ct({ messages: l, counterpartMessageLabels: ct, embeddedBankName: lt, o
519
520
  path: { receivable_id: s },
520
521
  body: Ie({
521
522
  values: i,
522
- billingAddressId: L,
523
- shippingAddressId: Ht,
523
+ billingAddressId: I,
524
+ shippingAddressId: Ut,
524
525
  lineItemChanges: e
525
526
  })
526
527
  });
527
- Kt(), c = s, te = t?.type ?? i.type, a && t && (b.current = t.line_items, bt.current = t.currency, i = {
528
+ qt(), c = s, te = t?.type ?? i.type, a && t && (b.current = t.line_items, bt.current = t.currency, i = {
528
529
  ...i,
529
530
  lineItems: ae(i.lineItems, t.line_items)
530
531
  }, T(i));
@@ -532,12 +533,12 @@ function ct({ messages: l, counterpartMessageLabels: ct, embeddedBankName: lt, o
532
533
  ne = ze({ values: i });
533
534
  let e = await dt.mutateAsync({ body: Pe({
534
535
  values: i,
535
- billingAddressId: L,
536
- shippingAddressId: Ht,
536
+ billingAddressId: I,
537
+ shippingAddressId: Ut,
537
538
  unitNamesById: j
538
539
  }) });
539
540
  if (!e?.id) {
540
- S(!1), hn();
541
+ S(!1), gn();
541
542
  return;
542
543
  }
543
544
  c = e.id, te = e.type, a && (y.current = e.id, b.current = e.line_items, bt.current = e.currency, i = {
@@ -560,9 +561,9 @@ function ct({ messages: l, counterpartMessageLabels: ct, embeddedBankName: lt, o
560
561
  }
561
562
  let re = a ? "recurrence" : "draft";
562
563
  if (a) try {
563
- U ? await mt.mutateAsync({
564
- path: { recurrence_id: U.id },
565
- body: ye(i, { lockSchedule: on })
564
+ H ? await mt.mutateAsync({
565
+ path: { recurrence_id: H.id },
566
+ body: ye(i, { lockSchedule: sn })
566
567
  }) : await pt.mutateAsync({ body: ve(i, c) });
567
568
  } catch (t) {
568
569
  e.error(Qe(t, { messages: l }));
@@ -574,35 +575,35 @@ function ct({ messages: l, counterpartMessageLabels: ct, embeddedBankName: lt, o
574
575
  e.error(l.issueFailedAfterSave);
575
576
  }
576
577
  let ie = C === "create";
577
- S(!1), hn(), ie && ut?.(c, te, {
578
+ S(!1), gn(), ie && ut?.(c, te, {
578
579
  mode: re,
579
580
  counterpartId: i.customerId,
580
581
  inlineItems: _e(i.lineItems, i.currency),
581
- hasCustomerEmail: !!(z.counterpart && r(z.counterpart).trim())
582
+ hasCustomerEmail: !!(R.counterpart && r(R.counterpart).trim())
582
583
  });
583
584
  }, [
584
- H.canAddAccount,
585
- H.hasAccounts,
586
- H.isLoading,
587
- L,
588
- Kt,
585
+ V.canAddAccount,
586
+ V.hasAccounts,
587
+ V.isLoading,
588
+ I,
589
+ qt,
589
590
  dt,
590
591
  pt,
591
592
  St,
592
- U,
593
- R,
594
- Y,
595
- Ut,
593
+ H,
594
+ L,
595
+ J,
596
+ Wt,
596
597
  ht,
597
- on,
598
+ sn,
598
599
  l,
599
600
  C,
600
601
  ut,
601
- z.counterpart,
602
- z.isTaxIdMissing,
603
- G,
604
- hn,
605
- Ht,
602
+ R.counterpart,
603
+ R.isTaxIdMissing,
604
+ W,
605
+ gn,
606
+ Ut,
606
607
  Nn,
607
608
  A,
608
609
  j,
@@ -611,7 +612,7 @@ function ct({ messages: l, counterpartMessageLabels: ct, embeddedBankName: lt, o
611
612
  mt,
612
613
  jn,
613
614
  w,
614
- An
615
+ Z
615
616
  ]), Q = d(async (e = g.current) => {
616
617
  if (!gt.current) {
617
618
  gt.current = !0, vt(e);
@@ -623,9 +624,9 @@ function ct({ messages: l, counterpartMessageLabels: ct, embeddedBankName: lt, o
623
624
  }
624
625
  }, [In]), Ln = p(() => ({
625
626
  ...w,
626
- discount: Ft ? w.discount : Te(Ee(w.discount, w.discountType, w.currency), w.discountType, w.currency),
627
+ discount: It ? w.discount : Te(Ee(w.discount, w.discountType, w.currency), w.discountType, w.currency),
627
628
  lineItems: w.lineItems.map(fe)
628
- }), [Ft, w]), Rn = p(() => ee(w.lineItems), [w.lineItems]), zn = p(() => ke(w), [w]), Bn = w.type === "invoice", Vn = Bn && u(w), Hn = J || k.isLoading || R || B.isUploading || G, Un = C === "edit" ? l.updateDraftButton : l.saveDraftButton, Wn = Vn ? U ? l.recurrenceUpdateButton : l.recurrenceActivateButton : Bn ? l.issueButton : Un, $ = Bn && !Vn ? "issue" : "draft", Gn = d(() => Q("draft"), [Q]), Kn = d(() => Q($), [$, Q]), qn = d(() => Q(), [Q]), Jn = d(() => {
629
+ }), [It, w]), Rn = p(() => ee(w.lineItems), [w.lineItems]), zn = p(() => ke(w), [w]), Bn = w.type === "invoice", Vn = Bn && u(w), Hn = q || k.isLoading || L || z.isUploading || W, Un = C === "edit" ? l.updateDraftButton : l.saveDraftButton, Wn = Vn ? H ? l.recurrenceUpdateButton : l.recurrenceActivateButton : Bn ? l.issueButton : Un, $ = Bn && !Vn ? "issue" : "draft", Gn = d(() => Q("draft"), [Q]), Kn = d(() => Q($), [$, Q]), qn = d(() => Q(), [Q]), Jn = d(() => {
629
630
  g.current = "draft";
630
631
  }, []), Yn = d(() => {
631
632
  g.current = $;
@@ -638,22 +639,22 @@ function ct({ messages: l, counterpartMessageLabels: ct, embeddedBankName: lt, o
638
639
  }, [Xn, Q]), Qn = d(() => D(!1), []), $n = p(() => ({
639
640
  open: Et,
640
641
  onSaveDraft: () => void Zn(),
641
- onDiscard: X,
642
+ onDiscard: Y,
642
643
  onCancel: Qn,
643
- isSaving: J,
644
+ isSaving: q,
644
645
  isSaveDraftDisabled: Xn
645
646
  }), [
646
647
  Qn,
647
- X,
648
- J,
648
+ Y,
649
+ q,
649
650
  Xn,
650
651
  Zn,
651
652
  Et
652
653
  ]), er = p(() => Oe(zn, w.currency), [zn, w.currency]), tr = at({
653
654
  values: w,
654
655
  totals: zn,
655
- billingAddress: Vt,
656
- bankAccount: H.selectedAccount,
656
+ billingAddress: Ht,
657
+ bankAccount: V.selectedAccount,
657
658
  unitNamesById: j,
658
659
  messages: l,
659
660
  enabled: x
@@ -666,28 +667,28 @@ function ct({ messages: l, counterpartMessageLabels: ct, embeddedBankName: lt, o
666
667
  sheetValues: Ln,
667
668
  errors: Dt,
668
669
  setValues: T,
669
- updateValues: yn,
670
- commitTaxRate: Sn,
671
- focusDiscount: bn,
672
- commitDiscount: xn,
673
- updateLineItem: Cn,
674
- selectProduct: wn,
675
- commitLineItem: En,
676
- stepLineItem: Dn,
677
- addLineItem: On,
678
- removeLineItem: kn,
679
- attachmentsView: qt,
680
- attachmentsUploading: B.isUploading,
670
+ updateValues: bn,
671
+ commitTaxRate: Cn,
672
+ focusDiscount: xn,
673
+ commitDiscount: Sn,
674
+ updateLineItem: wn,
675
+ selectProduct: Tn,
676
+ commitLineItem: Dn,
677
+ stepLineItem: On,
678
+ addLineItem: kn,
679
+ removeLineItem: An,
680
+ attachmentsView: Jt,
681
+ attachmentsUploading: z.isUploading,
681
682
  draftButtonLabel: Bn && !Vn ? Un : void 0,
682
683
  draftDisabled: Hn,
683
- draftLoading: J && _t === "draft",
684
+ draftLoading: q && _t === "draft",
684
685
  primaryButtonLabel: Wn,
685
- primaryLoading: J && _t === $,
686
- primaryDisabled: Hn || H.isLoading && An(w, $) || Bn && (Ut || !Vn && z.isCounterpartLoading),
686
+ primaryLoading: q && _t === $,
687
+ primaryDisabled: Hn || V.isLoading && Z(w, $) || Bn && (Wt || !Vn && R.isCounterpartLoading),
687
688
  scrollContainerRef: yt,
688
- selectAttachmentFiles: B.selectFiles,
689
- setAttachmentIncludeInEmail: B.setIncludeInEmail,
690
- removeAttachment: B.remove,
689
+ selectAttachmentFiles: z.selectFiles,
690
+ setAttachmentIncludeInEmail: z.setIncludeInEmail,
691
+ removeAttachment: z.remove,
691
692
  autoFocusLineItemId: jt,
692
693
  lineItemUnitOptions: At.unitOptions,
693
694
  lineItemsLoading: k.isLoading,
@@ -696,17 +697,21 @@ function ct({ messages: l, counterpartMessageLabels: ct, embeddedBankName: lt, o
696
697
  preview: tr,
697
698
  totalsView: er,
698
699
  currencySymbol: re(w.currency),
699
- isSubmitting: J,
700
- paymentTerms: en,
700
+ isSubmitting: q,
701
+ paymentTerms: tn,
701
702
  showBillingSection: w.type === "invoice" || C === "edit",
702
- recurrence: dn,
703
+ purchaseOrder: C === "create" ? {
704
+ value: w.purchaseOrder,
705
+ error: Dt.purchaseOrder
706
+ } : void 0,
707
+ recurrence: fn,
703
708
  showRecurrenceSection: w.type === "invoice",
704
- recurrenceLoading: G,
709
+ recurrenceLoading: W,
705
710
  showDueDateField: w.type === "quote",
706
- openCreate: gn,
707
- openEdit: _n,
708
- close: X,
709
- requestClose: vn,
711
+ openCreate: _n,
712
+ openEdit: vn,
713
+ close: Y,
714
+ requestClose: yn,
710
715
  unsavedPrompt: $n,
711
716
  submit: qn,
712
717
  submitDraft: Gn,
@@ -715,11 +720,11 @@ function ct({ messages: l, counterpartMessageLabels: ct, embeddedBankName: lt, o
715
720
  selectPrimaryMode: Yn,
716
721
  units: At,
717
722
  counterpartView: Ot,
718
- counterpartForm: Yt,
719
- stateOptions: It,
720
- openCounterpartCreate: Qt,
721
- bankAccount: H,
722
- reminders: pn
723
+ counterpartForm: Xt,
724
+ stateOptions: Lt,
725
+ openCounterpartCreate: $t,
726
+ bankAccount: V,
727
+ reminders: mn
723
728
  };
724
729
  }
725
730
  //#endregion
@@ -5,7 +5,9 @@ var e = {
5
5
  paymentTermsLabel: "Payment terms",
6
6
  paymentTermsPlaceholder: "Select payment terms",
7
7
  paymentTermsReceiptDue: "Due on receipt",
8
- paymentTermsCustomDate: "Custom date"
8
+ paymentTermsCustomDate: "Custom date",
9
+ purchaseOrderLabel: "PO Number",
10
+ purchaseOrderOptional: "(optional)"
9
11
  };
10
12
  //#endregion
11
13
  export { e as RECEIVABLE_BILLING_SECTION_LABELS_EN };
@@ -1,99 +1,118 @@
1
- import { Field as e, FieldContent as t, FieldDescription as n, FieldError as r, FieldLabel as i, Popover as a, PopoverAnchor as o, PopoverContent as s, Select as c, SelectContent as l, SelectItem as u, SelectSeparator as d, SelectTrigger as f, SelectValue as p, Skeleton as m, Typography as h } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
2
- import { RECEIVABLE_BILLING_SECTION_LABELS_EN as g } from "./index11.js";
3
- import { RECEIVABLE_PAYMENT_TERMS_RECEIPT_DUE as _ } from "./index19.js";
4
- import { OptionRow as v } from "./index17.js";
5
- import { SelectionValue as y } from "./index18.js";
6
- import { jsx as b, jsxs as x } from "react/jsx-runtime";
1
+ import { Field as e, FieldContent as t, FieldDescription as n, FieldError as r, FieldLabel as i, Input as a, Popover as o, PopoverAnchor as s, PopoverContent as c, Select as l, SelectContent as u, SelectItem as d, SelectSeparator as f, SelectTrigger as p, SelectValue as m, Skeleton as h, Typography as g } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
2
+ import { RECEIVABLE_BILLING_SECTION_LABELS_EN as _ } from "./index11.js";
3
+ import { RECEIVABLE_PAYMENT_TERMS_RECEIPT_DUE as v } from "./index19.js";
4
+ import { OptionRow as y } from "./index17.js";
5
+ import { SelectionValue as b } from "./index18.js";
6
+ import { jsx as x, jsxs as S } from "react/jsx-runtime";
7
7
  //#region ../../libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index20.js
8
- function S({ idPrefix: S, paymentTerms: C, paymentTermsError: w, disabled: T, onPaymentTermsChange: E, onCustomDatePickerOpenChange: D, customDateCalendar: O, recurrenceSection: k, remindersSection: A, labels: j }) {
9
- let M = {
10
- ...g,
11
- ...j
12
- }, N = `${S}-payment-terms`, P = () => {
13
- window.setTimeout(() => D(!0), 0);
8
+ function C({ idPrefix: C, paymentTerms: w, paymentTermsError: T, disabled: E, onPaymentTermsChange: D, onCustomDatePickerOpenChange: O, customDateCalendar: k, purchaseOrder: A, onPurchaseOrderChange: j, recurrenceSection: M, remindersSection: N, labels: P }) {
9
+ let F = {
10
+ ..._,
11
+ ...P
12
+ }, I = `${C}-payment-terms`, L = `${C}-purchase-order`, R = () => {
13
+ window.setTimeout(() => O(!0), 0);
14
14
  };
15
- return /* @__PURE__ */ x("div", {
15
+ return /* @__PURE__ */ S("div", {
16
16
  className: "ttw:flex ttw:flex-col ttw:gap-2.5 ttw:rounded-xl ttw:border ttw:border-border ttw:p-6",
17
- children: [/* @__PURE__ */ x("div", {
17
+ children: [/* @__PURE__ */ S("div", {
18
18
  className: "ttw:flex ttw:flex-col ttw:gap-2.5 ttw:pb-4",
19
- children: [/* @__PURE__ */ b(h, {
19
+ children: [/* @__PURE__ */ x(g, {
20
20
  variant: "h4",
21
- children: M.billingHeading
22
- }), /* @__PURE__ */ b(h, {
21
+ children: F.billingHeading
22
+ }), /* @__PURE__ */ x(g, {
23
23
  variant: "body2",
24
24
  color: "muted",
25
25
  className: "ttw:font-medium",
26
- children: M.billingDescription
26
+ children: F.billingDescription
27
27
  })]
28
- }), /* @__PURE__ */ x("div", {
28
+ }), /* @__PURE__ */ S("div", {
29
29
  className: "ttw:flex ttw:flex-col ttw:gap-6",
30
30
  children: [
31
- k,
32
- /* @__PURE__ */ b("div", {
31
+ M,
32
+ /* @__PURE__ */ S("div", {
33
33
  className: "ttw:flex ttw:w-full ttw:items-start ttw:gap-2.5",
34
- children: C.kind === "loading" ? /* @__PURE__ */ b(m, { className: "ttw:h-9 ttw:w-full" }) : /* @__PURE__ */ b(e, { children: /* @__PURE__ */ x(t, { children: [
35
- /* @__PURE__ */ b(i, {
36
- htmlFor: N,
37
- children: M.paymentTermsLabel
34
+ children: [w.kind === "loading" ? /* @__PURE__ */ x(h, { className: "ttw:h-9 ttw:w-full" }) : /* @__PURE__ */ x(e, { children: /* @__PURE__ */ S(t, { children: [
35
+ /* @__PURE__ */ x(i, {
36
+ htmlFor: I,
37
+ children: F.paymentTermsLabel
38
38
  }),
39
- /* @__PURE__ */ x(a, {
40
- open: C.customDatePicker.open,
41
- onOpenChange: D,
42
- children: [/* @__PURE__ */ x(c, {
43
- disabled: T,
44
- value: C.value,
39
+ /* @__PURE__ */ S(o, {
40
+ open: w.customDatePicker.open,
41
+ onOpenChange: O,
42
+ children: [/* @__PURE__ */ S(l, {
43
+ disabled: E,
44
+ value: w.value,
45
45
  onValueChange: (e) => {
46
- E(e), e === "custom" && P();
46
+ D(e), e === "custom" && R();
47
47
  },
48
- children: [/* @__PURE__ */ b(o, {
48
+ children: [/* @__PURE__ */ x(s, {
49
49
  className: "ttw:w-full",
50
- children: /* @__PURE__ */ b(f, {
51
- id: N,
50
+ children: /* @__PURE__ */ x(p, {
51
+ id: I,
52
52
  className: "ttw:w-full",
53
- "aria-invalid": !!w,
54
- children: /* @__PURE__ */ b(p, {
55
- placeholder: M.paymentTermsPlaceholder,
56
- children: /* @__PURE__ */ b(y, {
57
- selection: C.selection,
58
- labels: M
53
+ "aria-invalid": !!T,
54
+ children: /* @__PURE__ */ x(m, {
55
+ placeholder: F.paymentTermsPlaceholder,
56
+ children: /* @__PURE__ */ x(b, {
57
+ selection: w.selection,
58
+ labels: F
59
59
  })
60
60
  })
61
61
  })
62
- }), /* @__PURE__ */ x(l, { children: [
63
- /* @__PURE__ */ b(u, {
64
- value: _,
65
- children: M.paymentTermsReceiptDue
62
+ }), /* @__PURE__ */ S(u, { children: [
63
+ /* @__PURE__ */ x(d, {
64
+ value: v,
65
+ children: F.paymentTermsReceiptDue
66
66
  }),
67
- C.showCustomDate && /* @__PURE__ */ b(u, {
67
+ w.showCustomDate && /* @__PURE__ */ x(d, {
68
68
  value: "custom",
69
- onPointerUp: P,
70
- onClick: P,
69
+ onPointerUp: R,
70
+ onClick: R,
71
71
  onKeyDown: (e) => {
72
- (e.key === "Enter" || e.key === " ") && P();
72
+ (e.key === "Enter" || e.key === " ") && R();
73
73
  },
74
- children: M.paymentTermsCustomDate
74
+ children: F.paymentTermsCustomDate
75
75
  }),
76
- /* @__PURE__ */ b(d, {}),
77
- C.options.map((e) => /* @__PURE__ */ b(u, {
76
+ /* @__PURE__ */ x(f, {}),
77
+ w.options.map((e) => /* @__PURE__ */ x(d, {
78
78
  value: e.value,
79
- children: /* @__PURE__ */ b(v, { option: e })
79
+ children: /* @__PURE__ */ x(y, { option: e })
80
80
  }, e.value))
81
81
  ] })]
82
- }), /* @__PURE__ */ b(s, {
82
+ }), /* @__PURE__ */ x(c, {
83
83
  className: "ttw:w-auto ttw:overflow-hidden ttw:p-0",
84
84
  align: "start",
85
85
  onFocusOutside: (e) => e.preventDefault(),
86
- children: O
86
+ children: k
87
+ })]
88
+ }),
89
+ w.description && /* @__PURE__ */ x(n, { children: w.description }),
90
+ /* @__PURE__ */ x(r, { errors: T ? [{ message: T }] : [] })
91
+ ] }) }), A && /* @__PURE__ */ x(e, { children: /* @__PURE__ */ S(t, { children: [
92
+ /* @__PURE__ */ S(i, {
93
+ htmlFor: L,
94
+ className: "ttw:text-nowrap",
95
+ children: [F.purchaseOrderLabel, /* @__PURE__ */ x(g, {
96
+ variant: "body2",
97
+ color: "muted",
98
+ className: "ttw:leading-snug",
99
+ children: F.purchaseOrderOptional
87
100
  })]
88
101
  }),
89
- C.description && /* @__PURE__ */ b(n, { children: C.description }),
90
- /* @__PURE__ */ b(r, { errors: w ? [{ message: w }] : [] })
91
- ] }) })
102
+ /* @__PURE__ */ x(a, {
103
+ id: L,
104
+ value: A.value,
105
+ disabled: E,
106
+ "aria-invalid": !!A.error,
107
+ onChange: (e) => j?.(e.target.value)
108
+ }),
109
+ /* @__PURE__ */ x(r, { errors: A.error ? [{ message: A.error }] : [] })
110
+ ] }) })]
92
111
  }),
93
- A
112
+ N
94
113
  ]
95
114
  })]
96
115
  });
97
116
  }
98
117
  //#endregion
99
- export { S as ReceivableBillingSection, S as default };
118
+ export { C as ReceivableBillingSection, C as default };
@@ -8,6 +8,7 @@ var e = {
8
8
  invoiceDateLabel: "Invoice date",
9
9
  dueDateLabel: "Due date",
10
10
  paymentTermsLabel: "Payment terms",
11
+ purchaseOrderLabel: "PO number",
11
12
  pending: "Pending",
12
13
  descriptionColumn: "Description",
13
14
  quantityColumn: "Qty",
@@ -37,7 +37,14 @@ function p({ view: p, labels: m }) {
37
37
  {
38
38
  label: h.paymentTermsLabel,
39
39
  value: p.paymentTerms
40
- }
40
+ },
41
+ ...p.purchaseOrder ? [{
42
+ label: h.purchaseOrderLabel,
43
+ value: {
44
+ kind: "text",
45
+ lines: [p.purchaseOrder]
46
+ }
47
+ }] : []
41
48
  ];
42
49
  return /* @__PURE__ */ i("div", {
43
50
  className: "ttw:relative ttw:flex ttw:h-full ttw:min-h-0 ttw:w-full ttw:overflow-auto ttw:bg-linear-to-br ttw:from-[#f8fafc] ttw:to-[#e2e8f0] ttw:p-12 ttw:[align-items:safe_center] ttw:[justify-content:safe_center] ttw:[transform:translateZ(0)]",
@@ -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.5.266", n = "e8c910c6d5780e6cd407cafb3ee5ac62be3bf151", r = Object.freeze({
2
+ var e = "@tesouro/embedded-components-react", t = "0.5.267", n = "4e79513224c1bbb2748034f67f0d182b5597cb34", 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.5.266",
3
+ "version": "0.5.267",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "packageDepSync": {