@tesouro/embedded-components-react 0.7.64 → 0.7.67

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.
Files changed (23) hide show
  1. package/README.md +1 -1
  2. package/dist/index.css +3 -0
  3. package/dist/index.d.ts +10 -10
  4. package/dist/lib/ProductsWidget.d.ts +40 -10
  5. package/dist/lib/ReceivablesWidget.d.ts +9 -9
  6. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/apiValidationErrors.js +34 -63
  7. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/currencyDisplay.js +6 -0
  8. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/discount.js +31 -30
  9. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/helpers.js +89 -87
  10. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/lineItems.js +84 -82
  11. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/preview.js +77 -75
  12. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/totals.js +54 -53
  13. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableForm.js +458 -457
  14. package/dist/libs/tesouro-embedded-components-react/products-widget/feature/dist/lib/ProductsWidget/ProductsWidget.js +0 -2
  15. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  16. package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/feature/dist/lib/helpers.js +33 -41
  17. package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/feature/dist/lib/labels.js +3 -4
  18. package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/feature/dist/lib/useProductForm.js +42 -44
  19. package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/ui/dist/index2.js +14 -13
  20. package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/ui/dist/index3.js +128 -147
  21. package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/ui/dist/index4.js +109 -92
  22. package/dist/libs/tesouro-embedded-components-react/shared/util/dist/lib/apiValidationErrors.js +33 -0
  23. 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` | `Partial<ProductFormSheetLabels>` | English labels | Create/edit form copy. |
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
@@ -823,6 +823,9 @@
823
823
  .ttw\:h-\[214px\] {
824
824
  height: 214px;
825
825
  }
826
+ .ttw\:h-\[240px\] {
827
+ height: 240px;
828
+ }
826
829
  .ttw\:h-\[300px\] {
827
830
  height: 300px;
828
831
  }
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
- /** Shown as the first option in the unit select to clear/leave blank. */
4991
+ /** First option in the unit picker; choosing it leaves the unit blank. */
4996
4992
  noUnit: string;
4997
- manageUnits: string;
4993
+ unitEmpty: string;
4994
+ unitClearAriaLabel: string;
4998
4995
  priceLabel: string;
4999
- currencyLabel: string;
5000
- currencyPlaceholder: string;
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?: Partial<ProductFormSheetLabels>;
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
- /** Shown as the first option in the unit select to clear/leave blank. */
649
+ /** First option in the unit picker; choosing it leaves the unit blank. */
624
650
  noUnit: string;
625
- manageUnits: string;
651
+ unitEmpty: string;
652
+ unitClearAriaLabel: string;
626
653
  priceLabel: string;
627
- currencyLabel: string;
628
- currencyPlaceholder: string;
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?: Partial<ProductFormSheetLabels>;
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
- /** Shown as the first option in the unit select to clear/leave blank. */
871
+ /** First option in the unit picker; choosing it leaves the unit blank. */
876
872
  noUnit: string;
877
- manageUnits: string;
873
+ unitEmpty: string;
874
+ unitClearAriaLabel: string;
878
875
  priceLabel: string;
879
- currencyLabel: string;
880
- currencyPlaceholder: string;
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 e = {
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
- }, t = {
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
- }, n = {
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
- }, r = (e) => typeof e == "number" || /^\d+$/.test(e), i = (e) => /^[A-Z]/.test(e) || e.includes("[") || e.includes("-"), a = (e) => e.filter((e, t) => t !== 0 || e !== "body").filter((e) => r(e) || !i(String(e))).join("."), o = (e) => typeof e == "string" || typeof e == "number", s = (e, t) => e === t || RegExp(`(^|[^A-Za-z0-9_])${t}([^A-Za-z0-9_]|$)`).test(e), c = (e) => typeof e == "object" && !!e;
37
- function l(e) {
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, d).join("; "), i = n.length - d;
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 p = 200;
74
- function m(e) {
44
+ var s = 200;
45
+ function c(e) {
75
46
  let t = e.trim();
76
- if (!(!t || t.length > p) && !t.includes("<")) return t;
47
+ if (!(!t || t.length > s) && !t.includes("<")) return t;
77
48
  }
78
- function h(e, { irrelevantVariants: t, messages: n }) {
79
- if (e instanceof Error) return e.message;
80
- if (typeof e == "string") return m(e) ?? n.unknownError;
81
- if (!c(e)) return n.unknownError;
82
- if (c(e.error) && typeof e.error.message == "string") return e.error.message;
83
- if (Array.isArray(e.detail)) {
84
- let r = f(u(e, t), n);
85
- if (r) return r;
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 n.unknownError;
58
+ return r.unknownError;
88
59
  }
89
- function g(e) {
60
+ function u(e) {
90
61
  return e.replace(/^(invoice|quote)\./, "");
91
62
  }
92
- var _ = /^line_items\.(?:(add|replace)\.)?(\d+)\.(?:data\.)?(.+)$/;
93
- function v(e, t, n) {
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 y(e, r) {
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 = g(o);
71
+ let e = u(o);
101
72
  if (e === "line_items") {
102
73
  a = s;
103
74
  continue;
104
75
  }
105
- let c = t[e];
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 [, u, d, f] = l;
113
- if (f === "tax_rate_value") {
83
+ let [, p, m, h] = l;
84
+ if (h === "tax_rate_value") {
114
85
  i.taxRate = s;
115
86
  continue;
116
87
  }
117
- let p = n[f], m = v(u, Number(d), r);
118
- p && m && (i.lineItems = {
88
+ let g = r[h], _ = f(p, Number(m), t);
89
+ g && _ && (i.lineItems = {
119
90
  ...i.lineItems,
120
- [m]: {
121
- ...i.lineItems?.[m],
122
- [p]: s
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 { e as UNSUBMITTED_PAYLOAD_VARIANTS, y as apiValidationErrorsToFormErrors, h as getApiErrorMessage, u as parseApiValidationErrors, f as summarizeApiValidationErrors, g as toCreatePayloadPath };
103
+ export { t as UNSUBMITTED_PAYLOAD_VARIANTS, p as apiValidationErrorsToFormErrors, l as getApiErrorMessage, o as summarizeApiValidationErrors, u as toCreatePayloadPath };
@@ -0,0 +1,6 @@
1
+ //#region ../../libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/currencyDisplay.js
2
+ function e(e) {
3
+ return e.toUpperCase() === "USD" ? "narrowSymbol" : "symbol";
4
+ }
5
+ //#endregion
6
+ export { e as currencyDisplayFor };
@@ -1,59 +1,60 @@
1
1
  import { minorExponentForCurrency as e } from "../../../../../shared/util/dist/lib/amountOutputToMajorUnits.js";
2
- import { escapeRegex as t, getNumberSeparators as n, parseLocaleDecimal as r } from "./lineItems.js";
2
+ import { currencyDisplayFor as t } from "./currencyDisplay.js";
3
+ import { escapeRegex as n, getNumberSeparators as r, parseLocaleDecimal as i } from "./lineItems.js";
3
4
  //#region ../../libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/discount.js
4
- function i(t, n) {
5
+ function a(t, n) {
5
6
  return t === "percentage" ? 2 : e(n);
6
7
  }
7
- function a(e, r, a, o = n()) {
8
- let s = `0-9${t(o.digits.join(""))}${t(o.decimal)}${o.group ? t(o.group) : ""}`, c = e.replace(RegExp(`[^${s}]`, "gu"), ""), l = c.indexOf(o.decimal);
9
- return l === -1 ? c : c.slice(0, l + o.decimal.length) + Array.from(c.slice(l + o.decimal.length).split(o.decimal).join("")).slice(0, i(r, a)).join("");
8
+ function o(e, t, i, o = r()) {
9
+ let s = `0-9${n(o.digits.join(""))}${n(o.decimal)}${o.group ? n(o.group) : ""}`, c = e.replace(RegExp(`[^${s}]`, "gu"), ""), l = c.indexOf(o.decimal);
10
+ return l === -1 ? c : c.slice(0, l + o.decimal.length) + Array.from(c.slice(l + o.decimal.length).split(o.decimal).join("")).slice(0, a(t, i)).join("");
10
11
  }
11
- function o(e, t, a, o = n()) {
12
- return Math.round(r(e, o) * 10 ** i(t, a));
12
+ function s(e, t, n, o = r()) {
13
+ return Math.round(i(e, o) * 10 ** a(t, n));
13
14
  }
14
- function s(e, t, n) {
15
- let r = i(t, n);
15
+ function c(e, t, n) {
16
+ let r = a(t, n);
16
17
  return new Intl.NumberFormat(void 0, {
17
18
  minimumFractionDigits: r,
18
19
  maximumFractionDigits: r
19
20
  }).format(e / 10 ** r);
20
21
  }
21
- function c(e, t, n) {
22
- let r = i(t, n), a = {
23
- minimumFractionDigits: r,
24
- maximumFractionDigits: r
22
+ function l(e, n, r) {
23
+ let i = a(n, r), o = {
24
+ minimumFractionDigits: i,
25
+ maximumFractionDigits: i
25
26
  };
26
- return t === "percentage" ? new Intl.NumberFormat(void 0, {
27
- ...a,
27
+ return n === "percentage" ? new Intl.NumberFormat(void 0, {
28
+ ...o,
28
29
  style: "percent"
29
- }).format(e / 10 ** (r + 2)) : new Intl.NumberFormat(void 0, {
30
- ...a,
30
+ }).format(e / 10 ** (i + 2)) : new Intl.NumberFormat(void 0, {
31
+ ...o,
31
32
  style: "currency",
32
- currency: n,
33
- currencyDisplay: "narrowSymbol"
34
- }).format(e / 10 ** r);
33
+ currency: r,
34
+ currencyDisplay: t(r)
35
+ }).format(e / 10 ** i);
35
36
  }
36
- function l({ value: e, type: t, currency: n }) {
37
- return s(o(e, t, n), t, n);
37
+ function u({ value: e, type: t, currency: n }) {
38
+ return c(s(e, t, n), t, n);
38
39
  }
39
- function u(e) {
40
+ function d(e) {
40
41
  return {
41
42
  discountType: "amount",
42
- discount: s(0, "amount", e)
43
+ discount: c(0, "amount", e)
43
44
  };
44
45
  }
45
- function d(e) {
46
- let t = o(e.discount, e.discountType, e.currency);
46
+ function f(e) {
47
+ let t = s(e.discount, e.discountType, e.currency);
47
48
  return t > 0 ? {
48
49
  type: e.discountType,
49
50
  amount: t
50
51
  } : null;
51
52
  }
52
- function f(e, t) {
53
+ function p(e, t) {
53
54
  return e ? {
54
55
  discountType: e.type,
55
- discount: s(e.amount, e.type, t)
56
- } : u(t);
56
+ discount: c(e.amount, e.type, t)
57
+ } : d(t);
57
58
  }
58
59
  //#endregion
59
- export { l as convertDiscountInput, u as createEmptyDiscount, c as decorateDiscountInput, d as discountFromDraft, o as discountInputToMinorUnits, f as discountToDraft, s as formatDiscountInput, a as sanitizeDiscountInput };
60
+ export { u as convertDiscountInput, d as createEmptyDiscount, l as decorateDiscountInput, f as discountFromDraft, s as discountInputToMinorUnits, p as discountToDraft, c as formatDiscountInput, o as sanitizeDiscountInput };