@tesouro/embedded-components-react 0.7.66 → 0.7.68
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/README.md +1 -1
- package/dist/index.css +3 -0
- package/dist/index.d.ts +10 -10
- package/dist/lib/ProductsWidget.d.ts +40 -10
- package/dist/lib/ReceivablesWidget.d.ts +9 -9
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/apiValidationErrors.js +34 -63
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableForm.js +458 -457
- package/dist/libs/tesouro-embedded-components-react/products-widget/feature/dist/lib/ProductsWidget/ProductsWidget.js +0 -2
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/feature/dist/lib/helpers.js +33 -41
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/feature/dist/lib/labels.js +3 -4
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/feature/dist/lib/useProductForm.js +42 -44
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/ui/dist/index2.js +14 -13
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/ui/dist/index3.js +128 -147
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/ui/dist/index4.js +109 -92
- package/dist/libs/tesouro-embedded-components-react/shared/util/dist/lib/apiValidationErrors.js +33 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -570,7 +570,7 @@ Manages an organization's products and services: a filterable, sortable table wi
|
|
|
570
570
|
| ------------------------- | ---------------------------------------- | ------------------- | ------------------------------------------------------------ |
|
|
571
571
|
| `pageSizeOptions` | `number[]` | `[10, 25, 50, 100]` | Rows-per-page choices. |
|
|
572
572
|
| `screenLabels` | `PartialDeep<ProductsScreenLabels>` | English labels | Table/header/filter/empty/error copy. |
|
|
573
|
-
| `formLabels` | `
|
|
573
|
+
| `formLabels` | `PartialDeep<ProductFormSheetLabels>` | English labels | Create/edit form copy. |
|
|
574
574
|
| `detailsLabels` | `PartialDeep<ProductDetailsSheetLabels>` | English labels | Details sheet copy. |
|
|
575
575
|
| `deleteLabels` | `Partial<ProductDeleteDialogLabels>` | English labels | Product delete confirmation copy. |
|
|
576
576
|
| `measureUnitsLabels` | `Partial<MeasureUnitsManagerLabels>` | English labels | Measure-units manager copy. |
|
package/dist/index.css
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -4980,28 +4980,29 @@ interface ProductFormSheetLabels {
|
|
|
4980
4980
|
nameLabel: string;
|
|
4981
4981
|
namePlaceholder: string;
|
|
4982
4982
|
descriptionLabel: string;
|
|
4983
|
-
/** Appended to the description label to indicate it is optional. */
|
|
4984
|
-
descriptionOptional: string;
|
|
4985
4983
|
descriptionPlaceholder: string;
|
|
4986
4984
|
/** `{count}` is replaced with the current character count. */
|
|
4987
4985
|
descriptionCount: string;
|
|
4988
4986
|
typeLabel: string;
|
|
4989
4987
|
typeProduct: string;
|
|
4990
|
-
typeProductDescription: string;
|
|
4991
4988
|
typeService: string;
|
|
4992
|
-
typeServiceDescription: string;
|
|
4993
4989
|
unitLabel: string;
|
|
4994
4990
|
unitPlaceholder: string;
|
|
4995
|
-
/**
|
|
4991
|
+
/** First option in the unit picker; choosing it leaves the unit blank. */
|
|
4996
4992
|
noUnit: string;
|
|
4997
|
-
|
|
4993
|
+
unitEmpty: string;
|
|
4994
|
+
unitClearAriaLabel: string;
|
|
4998
4995
|
priceLabel: string;
|
|
4999
|
-
|
|
5000
|
-
|
|
4996
|
+
/** Shown before the price input; products are priced in USD only. */
|
|
4997
|
+
pricePrefix: string;
|
|
4998
|
+
pricePlaceholder: string;
|
|
5001
4999
|
cancelButton: string;
|
|
5002
5000
|
/** `{type}` is replaced with the product/service word. */
|
|
5003
5001
|
createButton: string;
|
|
5004
5002
|
saveButton: string;
|
|
5003
|
+
/** The required asterisk and "(optional)" note on each field label. */
|
|
5004
|
+
fieldMarkers: LabelLabels;
|
|
5005
|
+
requiredFieldsLegend: RequiredFieldsLegendLabels;
|
|
5005
5006
|
}
|
|
5006
5007
|
interface MeasureUnitsManagerLabels {
|
|
5007
5008
|
title: string;
|
|
@@ -5047,7 +5048,6 @@ interface ProductMessageLabels {
|
|
|
5047
5048
|
nameTooLong: string;
|
|
5048
5049
|
typeRequired: string;
|
|
5049
5050
|
priceInvalid: string;
|
|
5050
|
-
currencyRequired: string;
|
|
5051
5051
|
/** Shown when a description exceeds the 255-character limit. */
|
|
5052
5052
|
descriptionTooLong: string;
|
|
5053
5053
|
unitNameRequired: string;
|
|
@@ -5153,7 +5153,7 @@ interface ProductDeleteDialogLabels {
|
|
|
5153
5153
|
interface ProductsWidgetOwnProps {
|
|
5154
5154
|
pageSizeOptions?: number[];
|
|
5155
5155
|
screenLabels?: PartialDeep<ProductsScreenLabels>;
|
|
5156
|
-
formLabels?:
|
|
5156
|
+
formLabels?: PartialDeep<ProductFormSheetLabels>;
|
|
5157
5157
|
detailsLabels?: PartialDeep<ProductDetailsSheetLabels>;
|
|
5158
5158
|
deleteLabels?: Partial<ProductDeleteDialogLabels>;
|
|
5159
5159
|
measureUnitsLabels?: Partial<MeasureUnitsManagerLabels>;
|
|
@@ -332,6 +332,36 @@ type EmbeddedClient = Client;
|
|
|
332
332
|
type ExtractLiterals<T> = T extends string ? string extends T ? never : T : never;
|
|
333
333
|
type BaseUrl = ExtractLiterals<ClientOptions['baseUrl']>;
|
|
334
334
|
|
|
335
|
+
interface LabelLabels {
|
|
336
|
+
/**
|
|
337
|
+
* How the field name and its requirement fragment compose. `{label}` is the
|
|
338
|
+
* name, `{marker}` the asterisk or the note — reorder them freely, and note
|
|
339
|
+
* that the space between them is part of this string.
|
|
340
|
+
*/
|
|
341
|
+
composition: string;
|
|
342
|
+
/** In the label's own colour, deliberately not `destructive`. */
|
|
343
|
+
requiredMarker: string;
|
|
344
|
+
/**
|
|
345
|
+
* Screen-reader-only stand-in for the marker, for a control whose role does
|
|
346
|
+
* not take `aria-required` — a popover trigger is a `button`, which does
|
|
347
|
+
* not. Render it hidden and name it from the control's `aria-labelledby`.
|
|
348
|
+
*/
|
|
349
|
+
requiredAccessibleText: string;
|
|
350
|
+
optionalNote: string;
|
|
351
|
+
/** "This has no meaning here", as against `optionalNote`'s "may be blank". */
|
|
352
|
+
notApplicableNote: string;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
interface RequiredFieldsLegendLabels {
|
|
356
|
+
/**
|
|
357
|
+
* One string, so a translator can move the marker into whatever clause the
|
|
358
|
+
* language wants. `{marker}` is substituted with `marker`, rendered
|
|
359
|
+
* semi-bold; keep the placeholder when overriding.
|
|
360
|
+
*/
|
|
361
|
+
instruction: string;
|
|
362
|
+
marker: string;
|
|
363
|
+
}
|
|
364
|
+
|
|
335
365
|
type LinkComponentProps = AnchorHTMLAttributes<HTMLAnchorElement> & {
|
|
336
366
|
children?: ReactNode;
|
|
337
367
|
};
|
|
@@ -608,28 +638,29 @@ interface ProductFormSheetLabels {
|
|
|
608
638
|
nameLabel: string;
|
|
609
639
|
namePlaceholder: string;
|
|
610
640
|
descriptionLabel: string;
|
|
611
|
-
/** Appended to the description label to indicate it is optional. */
|
|
612
|
-
descriptionOptional: string;
|
|
613
641
|
descriptionPlaceholder: string;
|
|
614
642
|
/** `{count}` is replaced with the current character count. */
|
|
615
643
|
descriptionCount: string;
|
|
616
644
|
typeLabel: string;
|
|
617
645
|
typeProduct: string;
|
|
618
|
-
typeProductDescription: string;
|
|
619
646
|
typeService: string;
|
|
620
|
-
typeServiceDescription: string;
|
|
621
647
|
unitLabel: string;
|
|
622
648
|
unitPlaceholder: string;
|
|
623
|
-
/**
|
|
649
|
+
/** First option in the unit picker; choosing it leaves the unit blank. */
|
|
624
650
|
noUnit: string;
|
|
625
|
-
|
|
651
|
+
unitEmpty: string;
|
|
652
|
+
unitClearAriaLabel: string;
|
|
626
653
|
priceLabel: string;
|
|
627
|
-
|
|
628
|
-
|
|
654
|
+
/** Shown before the price input; products are priced in USD only. */
|
|
655
|
+
pricePrefix: string;
|
|
656
|
+
pricePlaceholder: string;
|
|
629
657
|
cancelButton: string;
|
|
630
658
|
/** `{type}` is replaced with the product/service word. */
|
|
631
659
|
createButton: string;
|
|
632
660
|
saveButton: string;
|
|
661
|
+
/** The required asterisk and "(optional)" note on each field label. */
|
|
662
|
+
fieldMarkers: LabelLabels;
|
|
663
|
+
requiredFieldsLegend: RequiredFieldsLegendLabels;
|
|
633
664
|
}
|
|
634
665
|
interface MeasureUnitsManagerLabels {
|
|
635
666
|
title: string;
|
|
@@ -675,7 +706,6 @@ interface ProductMessageLabels {
|
|
|
675
706
|
nameTooLong: string;
|
|
676
707
|
typeRequired: string;
|
|
677
708
|
priceInvalid: string;
|
|
678
|
-
currencyRequired: string;
|
|
679
709
|
/** Shown when a description exceeds the 255-character limit. */
|
|
680
710
|
descriptionTooLong: string;
|
|
681
711
|
unitNameRequired: string;
|
|
@@ -781,7 +811,7 @@ interface ProductDeleteDialogLabels {
|
|
|
781
811
|
interface ProductsWidgetOwnProps {
|
|
782
812
|
pageSizeOptions?: number[];
|
|
783
813
|
screenLabels?: PartialDeep<ProductsScreenLabels>;
|
|
784
|
-
formLabels?:
|
|
814
|
+
formLabels?: PartialDeep<ProductFormSheetLabels>;
|
|
785
815
|
detailsLabels?: PartialDeep<ProductDetailsSheetLabels>;
|
|
786
816
|
deleteLabels?: Partial<ProductDeleteDialogLabels>;
|
|
787
817
|
measureUnitsLabels?: Partial<MeasureUnitsManagerLabels>;
|
|
@@ -860,28 +860,29 @@ interface ProductFormSheetLabels {
|
|
|
860
860
|
nameLabel: string;
|
|
861
861
|
namePlaceholder: string;
|
|
862
862
|
descriptionLabel: string;
|
|
863
|
-
/** Appended to the description label to indicate it is optional. */
|
|
864
|
-
descriptionOptional: string;
|
|
865
863
|
descriptionPlaceholder: string;
|
|
866
864
|
/** `{count}` is replaced with the current character count. */
|
|
867
865
|
descriptionCount: string;
|
|
868
866
|
typeLabel: string;
|
|
869
867
|
typeProduct: string;
|
|
870
|
-
typeProductDescription: string;
|
|
871
868
|
typeService: string;
|
|
872
|
-
typeServiceDescription: string;
|
|
873
869
|
unitLabel: string;
|
|
874
870
|
unitPlaceholder: string;
|
|
875
|
-
/**
|
|
871
|
+
/** First option in the unit picker; choosing it leaves the unit blank. */
|
|
876
872
|
noUnit: string;
|
|
877
|
-
|
|
873
|
+
unitEmpty: string;
|
|
874
|
+
unitClearAriaLabel: string;
|
|
878
875
|
priceLabel: string;
|
|
879
|
-
|
|
880
|
-
|
|
876
|
+
/** Shown before the price input; products are priced in USD only. */
|
|
877
|
+
pricePrefix: string;
|
|
878
|
+
pricePlaceholder: string;
|
|
881
879
|
cancelButton: string;
|
|
882
880
|
/** `{type}` is replaced with the product/service word. */
|
|
883
881
|
createButton: string;
|
|
884
882
|
saveButton: string;
|
|
883
|
+
/** The required asterisk and "(optional)" note on each field label. */
|
|
884
|
+
fieldMarkers: LabelLabels;
|
|
885
|
+
requiredFieldsLegend: RequiredFieldsLegendLabels;
|
|
885
886
|
}
|
|
886
887
|
interface MeasureUnitsManagerLabels {
|
|
887
888
|
title: string;
|
|
@@ -927,7 +928,6 @@ interface ProductMessageLabels {
|
|
|
927
928
|
nameTooLong: string;
|
|
928
929
|
typeRequired: string;
|
|
929
930
|
priceInvalid: string;
|
|
930
|
-
currencyRequired: string;
|
|
931
931
|
/** Shown when a description exceeds the 255-character limit. */
|
|
932
932
|
descriptionTooLong: string;
|
|
933
933
|
unitNameRequired: string;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { parseApiValidationErrors as e } from "../../../../../shared/util/dist/lib/apiValidationErrors.js";
|
|
1
2
|
//#region ../../libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/apiValidationErrors.js
|
|
2
|
-
var
|
|
3
|
+
var t = {
|
|
3
4
|
invoice: [
|
|
4
5
|
"ReceivableFacadeCreateQuotePayload",
|
|
5
6
|
"ReceivableCreateBasedOnPayload",
|
|
@@ -14,7 +15,7 @@ var e = {
|
|
|
14
15
|
"UpdateCreditNotePayload",
|
|
15
16
|
"UpdateIssuedInvoicePayload"
|
|
16
17
|
]
|
|
17
|
-
},
|
|
18
|
+
}, n = {
|
|
18
19
|
counterpart_id: "customerId",
|
|
19
20
|
counterpart_billing_address_id: "customerId",
|
|
20
21
|
counterpart_shipping_address_id: "customerId",
|
|
@@ -27,99 +28,69 @@ var e = {
|
|
|
27
28
|
memo: "openingNote",
|
|
28
29
|
footer: "closingNote",
|
|
29
30
|
"discount.amount": "discount"
|
|
30
|
-
},
|
|
31
|
+
}, r = {
|
|
31
32
|
quantity: "quantity",
|
|
32
33
|
"product.name": "name",
|
|
33
34
|
"product.price.value": "price",
|
|
34
35
|
"product.price.currency": "price",
|
|
35
36
|
"product.measure_unit.name": "measureUnit"
|
|
36
|
-
},
|
|
37
|
-
function
|
|
38
|
-
if (typeof e == "string") return e.trim() ? {
|
|
39
|
-
path: "",
|
|
40
|
-
loc: [],
|
|
41
|
-
msg: e,
|
|
42
|
-
type: ""
|
|
43
|
-
} : null;
|
|
44
|
-
if (!c(e)) return null;
|
|
45
|
-
let { loc: t, msg: n, type: r } = e;
|
|
46
|
-
if (typeof n != "string" || !n.trim()) return null;
|
|
47
|
-
let i = Array.isArray(t) ? t.filter(o) : [];
|
|
48
|
-
return {
|
|
49
|
-
path: a(i),
|
|
50
|
-
loc: i,
|
|
51
|
-
msg: n,
|
|
52
|
-
type: typeof r == "string" ? r : ""
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
function u(e, t = []) {
|
|
56
|
-
if (!c(e) || !Array.isArray(e.detail)) return [];
|
|
57
|
-
let n = [], r = /* @__PURE__ */ new Set();
|
|
58
|
-
for (let i of e.detail) {
|
|
59
|
-
let e = l(i);
|
|
60
|
-
if (!e || e.loc.some((e) => typeof e == "string" && t.some((t) => s(e, t)))) continue;
|
|
61
|
-
let a = `${e.path}:${e.msg}`;
|
|
62
|
-
r.has(a) || (r.add(a), n.push(e));
|
|
63
|
-
}
|
|
64
|
-
return n;
|
|
65
|
-
}
|
|
66
|
-
var d = 3;
|
|
67
|
-
function f(e, t) {
|
|
37
|
+
}, i = (e) => typeof e == "object" && !!e, a = 3;
|
|
38
|
+
function o(e, t) {
|
|
68
39
|
let n = [...new Set(e.map(({ msg: e }) => e))];
|
|
69
40
|
if (!n.length) return "";
|
|
70
|
-
let r = n.slice(0,
|
|
41
|
+
let r = n.slice(0, a).join("; "), i = n.length - a;
|
|
71
42
|
return i > 0 ? t.apiErrorsSummary.replace("{message}", r).replace("{count}", String(i)) : r;
|
|
72
43
|
}
|
|
73
|
-
var
|
|
74
|
-
function
|
|
44
|
+
var s = 200;
|
|
45
|
+
function c(e) {
|
|
75
46
|
let t = e.trim();
|
|
76
|
-
if (!(!t || t.length >
|
|
47
|
+
if (!(!t || t.length > s) && !t.includes("<")) return t;
|
|
77
48
|
}
|
|
78
|
-
function
|
|
79
|
-
if (
|
|
80
|
-
if (typeof
|
|
81
|
-
if (!
|
|
82
|
-
if (
|
|
83
|
-
if (Array.isArray(
|
|
84
|
-
let
|
|
85
|
-
if (
|
|
49
|
+
function l(t, { irrelevantVariants: n, messages: r }) {
|
|
50
|
+
if (t instanceof Error) return t.message;
|
|
51
|
+
if (typeof t == "string") return c(t) ?? r.unknownError;
|
|
52
|
+
if (!i(t)) return r.unknownError;
|
|
53
|
+
if (i(t.error) && typeof t.error.message == "string") return t.error.message;
|
|
54
|
+
if (Array.isArray(t.detail)) {
|
|
55
|
+
let i = o(e(t, n), r);
|
|
56
|
+
if (i) return i;
|
|
86
57
|
}
|
|
87
|
-
return
|
|
58
|
+
return r.unknownError;
|
|
88
59
|
}
|
|
89
|
-
function
|
|
60
|
+
function u(e) {
|
|
90
61
|
return e.replace(/^(invoice|quote)\./, "");
|
|
91
62
|
}
|
|
92
|
-
var
|
|
93
|
-
function
|
|
63
|
+
var d = /^line_items\.(?:(add|replace)\.)?(\d+)\.(?:data\.)?(.+)$/;
|
|
64
|
+
function f(e, t, n) {
|
|
94
65
|
return e === "add" ? n.added?.[t] : e === "replace" ? n.replaced?.[t] : n.created?.[t];
|
|
95
66
|
}
|
|
96
|
-
function
|
|
67
|
+
function p(e, t) {
|
|
97
68
|
let i = {}, a;
|
|
98
69
|
for (let { path: o, msg: s } of e) {
|
|
99
70
|
if (!o) continue;
|
|
100
|
-
let e =
|
|
71
|
+
let e = u(o);
|
|
101
72
|
if (e === "line_items") {
|
|
102
73
|
a = s;
|
|
103
74
|
continue;
|
|
104
75
|
}
|
|
105
|
-
let c =
|
|
76
|
+
let c = n[e];
|
|
106
77
|
if (c) {
|
|
107
78
|
i[c] = s;
|
|
108
79
|
continue;
|
|
109
80
|
}
|
|
110
|
-
let l = e.match(
|
|
81
|
+
let l = e.match(d);
|
|
111
82
|
if (!l) continue;
|
|
112
|
-
let [,
|
|
113
|
-
if (
|
|
83
|
+
let [, p, m, h] = l;
|
|
84
|
+
if (h === "tax_rate_value") {
|
|
114
85
|
i.taxRate = s;
|
|
115
86
|
continue;
|
|
116
87
|
}
|
|
117
|
-
let
|
|
118
|
-
|
|
88
|
+
let g = r[h], _ = f(p, Number(m), t);
|
|
89
|
+
g && _ && (i.lineItems = {
|
|
119
90
|
...i.lineItems,
|
|
120
|
-
[
|
|
121
|
-
...i.lineItems?.[
|
|
122
|
-
[
|
|
91
|
+
[_]: {
|
|
92
|
+
...i.lineItems?.[_],
|
|
93
|
+
[g]: s
|
|
123
94
|
}
|
|
124
95
|
});
|
|
125
96
|
}
|
|
@@ -129,4 +100,4 @@ function y(e, r) {
|
|
|
129
100
|
};
|
|
130
101
|
}
|
|
131
102
|
//#endregion
|
|
132
|
-
export {
|
|
103
|
+
export { t as UNSUBMITTED_PAYLOAD_VARIANTS, p as apiValidationErrorsToFormErrors, l as getApiErrorMessage, o as summarizeApiValidationErrors, u as toCreatePayloadPath };
|