@afosto/checkout-ui 0.0.18 → 0.0.19
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/CheckoutAgreementOptionCondition/CheckoutAgreementOptionCondition.d.ts.map +1 -1
- package/dist/CheckoutAgreementOptionCondition/CheckoutAgreementOptionCondition.js +26 -22
- package/dist/CheckoutCurrency/CheckoutCurrency.d.ts.map +1 -1
- package/dist/CheckoutCurrency/CheckoutCurrency.js +11 -11
- package/dist/CheckoutSummary/components/CheckoutSummaryAgreements/CheckoutSummaryAgreements.js +12 -12
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckoutAgreementOptionCondition.d.ts","sourceRoot":"","sources":["../../src/CheckoutAgreementOptionCondition/CheckoutAgreementOptionCondition.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,oCAAoC,EACpC,WAAW,EACZ,MAAM,UAAU,CAAC;AAOlB,QAAA,MAAM,mBAAmB;;;;CAIxB,CAAC;AAEF,MAAM,WAAW,qCAAqC;IACpD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,oCAAoC,CAAC;IAChD,YAAY,CAAC,EAAE,WAAW,CAAC,OAAO,mBAAmB,CAAC,CAAC;CACxD;AAED,eAAO,MAAM,gCAAgC,GAC3C,OAAO,qCAAqC,
|
|
1
|
+
{"version":3,"file":"CheckoutAgreementOptionCondition.d.ts","sourceRoot":"","sources":["../../src/CheckoutAgreementOptionCondition/CheckoutAgreementOptionCondition.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,oCAAoC,EACpC,WAAW,EACZ,MAAM,UAAU,CAAC;AAOlB,QAAA,MAAM,mBAAmB;;;;CAIxB,CAAC;AAEF,MAAM,WAAW,qCAAqC;IACpD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,oCAAoC,CAAC;IAChD,YAAY,CAAC,EAAE,WAAW,CAAC,OAAO,mBAAmB,CAAC,CAAC;CACxD;AAED,eAAO,MAAM,gCAAgC,GAC3C,OAAO,qCAAqC,qDA+E7C,CAAC"}
|
|
@@ -1,28 +1,32 @@
|
|
|
1
1
|
import { jsxs as s, jsx as i } from "react/jsx-runtime";
|
|
2
2
|
import { Box as m, Typography as c } from "@afosto/components";
|
|
3
|
-
import { TurnDownRightSolid as
|
|
4
|
-
import { CheckoutCurrency as
|
|
5
|
-
import { camelize as
|
|
6
|
-
import { useCheckout as
|
|
7
|
-
import { formatCurrency as
|
|
8
|
-
const
|
|
3
|
+
import { TurnDownRightSolid as C } from "../icons/TurnDownRightSolid.js";
|
|
4
|
+
import { CheckoutCurrency as D } from "../CheckoutCurrency/CheckoutCurrency.js";
|
|
5
|
+
import { camelize as x } from "@afosto/utils";
|
|
6
|
+
import { useCheckout as v } from "../CheckoutStateProvider/CheckoutStateProvider.js";
|
|
7
|
+
import { formatCurrency as w } from "../utils/formatCurrency.js";
|
|
8
|
+
const I = {
|
|
9
9
|
payImmediately: "Pay immediately",
|
|
10
10
|
remainingAmountDueBeforeDelivery: "Remaining amount due before delivery",
|
|
11
11
|
withinDaysOfTheInvoiceDate: "Within {days} days of the invoice date"
|
|
12
|
-
},
|
|
12
|
+
}, j = (l) => {
|
|
13
13
|
const {
|
|
14
14
|
condition: e,
|
|
15
|
-
currency:
|
|
16
|
-
locale:
|
|
15
|
+
currency: r,
|
|
16
|
+
locale: a,
|
|
17
17
|
translations: y = {}
|
|
18
|
-
} = l, {
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
} = l, {
|
|
19
|
+
settings: u,
|
|
20
|
+
summary: p,
|
|
21
|
+
translations: d
|
|
22
|
+
} = v(), f = p?.currency || u?.currency, n = {
|
|
23
|
+
...I,
|
|
24
|
+
...d.agreementOptionConditions || {},
|
|
21
25
|
...y || {}
|
|
22
|
-
}, o =
|
|
26
|
+
}, o = x(e.type?.toLowerCase() || ""), h = e.outcome?.amount || 0;
|
|
23
27
|
let t = e.type;
|
|
24
|
-
return o === "downPayment" && e.isPercentage && (t = `${n.payImmediately}${e.amount > 0 && e.amount < 100 ? ` (${e.amount}%)` : ""}`), o === "downPayment" && !e.isPercentage && (t = `${n.payImmediately}${e.amount > 0 ? ` (${
|
|
25
|
-
currency:
|
|
28
|
+
return o === "downPayment" && e.isPercentage && (t = `${n.payImmediately}${e.amount > 0 && e.amount < 100 ? ` (${e.amount}%)` : ""}`), o === "downPayment" && !e.isPercentage && (t = `${n.payImmediately}${e.amount > 0 ? ` (${w(e.amount / 100, a, {
|
|
29
|
+
currency: r || f
|
|
26
30
|
})})` : ""}`), o === "postPaid" && (t = n.withinDaysOfTheInvoiceDate.replace(
|
|
27
31
|
"{days}",
|
|
28
32
|
e.pastDueAfter.toString()
|
|
@@ -38,19 +42,19 @@ const w = {
|
|
|
38
42
|
children: [
|
|
39
43
|
/* @__PURE__ */ s(m, { sx: { display: "flex", alignItems: "center", gap: 2.5 }, children: [
|
|
40
44
|
/* @__PURE__ */ i(
|
|
41
|
-
|
|
45
|
+
C,
|
|
42
46
|
{
|
|
43
|
-
sx: { color: (
|
|
47
|
+
sx: { color: (g) => g.palette.gray[400], fontSize: 16 }
|
|
44
48
|
}
|
|
45
49
|
),
|
|
46
50
|
/* @__PURE__ */ i(c, { children: t })
|
|
47
51
|
] }),
|
|
48
52
|
/* @__PURE__ */ i(c, { fontWeight: 500, children: /* @__PURE__ */ i(
|
|
49
|
-
|
|
53
|
+
D,
|
|
50
54
|
{
|
|
51
|
-
currency:
|
|
52
|
-
locale:
|
|
53
|
-
value:
|
|
55
|
+
currency: r,
|
|
56
|
+
locale: a,
|
|
57
|
+
value: h / 100
|
|
54
58
|
}
|
|
55
59
|
) })
|
|
56
60
|
]
|
|
@@ -58,5 +62,5 @@ const w = {
|
|
|
58
62
|
);
|
|
59
63
|
};
|
|
60
64
|
export {
|
|
61
|
-
|
|
65
|
+
j as CheckoutAgreementOptionCondition
|
|
62
66
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckoutCurrency.d.ts","sourceRoot":"","sources":["../../src/CheckoutCurrency/CheckoutCurrency.tsx"],"names":[],"mappings":"AAIA,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,IAAI,CAAC,mBAAmB,CAAC;CACpC;AAED,eAAO,MAAM,gBAAgB,GAAI,OAAO,qBAAqB,
|
|
1
|
+
{"version":3,"file":"CheckoutCurrency.d.ts","sourceRoot":"","sources":["../../src/CheckoutCurrency/CheckoutCurrency.tsx"],"names":[],"mappings":"AAIA,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,IAAI,CAAC,mBAAmB,CAAC;CACpC;AAED,eAAO,MAAM,gBAAgB,GAAI,OAAO,qBAAqB,WAqB5D,CAAC"}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { useCheckout as
|
|
2
|
-
const
|
|
1
|
+
import { useCheckout as m } from "../CheckoutStateProvider/CheckoutStateProvider.js";
|
|
2
|
+
const p = (e) => {
|
|
3
3
|
const {
|
|
4
|
-
currency:
|
|
5
|
-
value:
|
|
6
|
-
locale:
|
|
4
|
+
currency: c,
|
|
5
|
+
value: r,
|
|
6
|
+
locale: o,
|
|
7
7
|
options: t
|
|
8
|
-
} =
|
|
8
|
+
} = e, { locale: n, settings: u, summary: s } = m(), { currency: l } = u || {}, a = {
|
|
9
9
|
style: "currency",
|
|
10
|
-
currency:
|
|
11
|
-
},
|
|
12
|
-
return new Intl.NumberFormat(
|
|
13
|
-
|
|
10
|
+
currency: c || s?.currency || l || "EUR"
|
|
11
|
+
}, y = o || n;
|
|
12
|
+
return new Intl.NumberFormat(y, t || a).format(
|
|
13
|
+
r
|
|
14
14
|
);
|
|
15
15
|
};
|
|
16
16
|
export {
|
|
17
|
-
|
|
17
|
+
p as CheckoutCurrency
|
|
18
18
|
};
|
package/dist/CheckoutSummary/components/CheckoutSummaryAgreements/CheckoutSummaryAgreements.js
CHANGED
|
@@ -9,22 +9,22 @@ const P = {
|
|
|
9
9
|
const {
|
|
10
10
|
agreementTemplate: n,
|
|
11
11
|
agreements: s,
|
|
12
|
-
currency:
|
|
12
|
+
currency: r,
|
|
13
13
|
disablePadding: u = !0,
|
|
14
14
|
divider: c = !1,
|
|
15
15
|
hideDefaultAgreementOption: i = !0,
|
|
16
|
-
locale:
|
|
16
|
+
locale: o,
|
|
17
17
|
translations: l = {},
|
|
18
18
|
...p
|
|
19
19
|
} = m, {
|
|
20
|
-
settings:
|
|
21
|
-
summary:
|
|
22
|
-
translations:
|
|
23
|
-
} = v(),
|
|
20
|
+
settings: y,
|
|
21
|
+
summary: t,
|
|
22
|
+
translations: d
|
|
23
|
+
} = v(), f = t?.currency || y?.currency, h = {
|
|
24
24
|
...P,
|
|
25
|
-
...
|
|
25
|
+
...d?.summary || {},
|
|
26
26
|
...l || {}
|
|
27
|
-
}, g = n ??
|
|
27
|
+
}, g = n ?? t?.agreementTemplate, k = s || t?.agreements || [];
|
|
28
28
|
return i && g?.type?.toLowerCase() === "default" ? null : /* @__PURE__ */ a(
|
|
29
29
|
C,
|
|
30
30
|
{
|
|
@@ -34,10 +34,10 @@ const P = {
|
|
|
34
34
|
children: k.map((e) => /* @__PURE__ */ a(
|
|
35
35
|
T,
|
|
36
36
|
{
|
|
37
|
-
currency:
|
|
38
|
-
locale:
|
|
39
|
-
description: `${h.payImmediately} (${e.isPercentage ? `${e.amount}%` : A(e.amount / 100,
|
|
40
|
-
currency:
|
|
37
|
+
currency: r,
|
|
38
|
+
locale: o,
|
|
39
|
+
description: `${h.payImmediately} (${e.isPercentage ? `${e.amount}%` : A(e.amount / 100, o, {
|
|
40
|
+
currency: r || f
|
|
41
41
|
})})`,
|
|
42
42
|
value: e.outcome?.amount || 0
|
|
43
43
|
},
|