@wf-financing/ui 1.4.1 → 1.4.3

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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @wf-financing/ui
2
2
 
3
+ ## 1.4.3
4
+
5
+ ### Patch Changes
6
+
7
+ - Optimize bundle configuration
8
+
9
+ ## 1.4.2
10
+
11
+ ### Patch Changes
12
+
13
+ - Add fallback url for fonts loading
14
+
3
15
  ## 1.4.1
4
16
 
5
17
  ### Patch Changes
@@ -0,0 +1,161 @@
1
+ import { r as i, u as p, _ as b, s as v, g as I, a as w, b as _, c as H, j as t, P as d, R as m, m as k, d as W, S as L, e as S, L as T, f as q, A as D, $ as P, I as $, l as A, h as y, F as N, W as O, i as U } from "./index-Gn-_ZM3g.mjs";
2
+ function B(e, s) {
3
+ var r = e.values, a = b(e, ["values"]), n = s.values, o = b(s, ["values"]);
4
+ return v(n, r) && v(a, o);
5
+ }
6
+ function C(e) {
7
+ var s = p(), r = s.formatMessage, a = s.textComponent, n = a === void 0 ? i.Fragment : a, o = e.id, l = e.description, h = e.defaultMessage, F = e.values, x = e.children, g = e.tagName, f = g === void 0 ? n : g, R = e.ignoreTag, z = { id: o, description: l, defaultMessage: h }, c = r(z, F, {
8
+ ignoreTag: R
9
+ });
10
+ return typeof x == "function" ? x(Array.isArray(c) ? c : [c]) : f ? i.createElement(f, null, i.Children.toArray(c)) : i.createElement(i.Fragment, null, c);
11
+ }
12
+ C.displayName = "FormattedMessage";
13
+ var u = i.memo(C, B);
14
+ u.displayName = "MemoizedFormattedMessage";
15
+ const V = async (e, s, r) => {
16
+ let a = await s();
17
+ const n = await I(e, r);
18
+ return a || (a = {}), await n.startHostedApplication(a);
19
+ }, G = () => {
20
+ const { companyToken: e, mockedMode: s, partnerCallback: r } = w();
21
+ return _({
22
+ mutationFn: () => V(e, r, s)
23
+ });
24
+ }, E = () => H()("xxs").windowLte, J = (e, s) => {
25
+ const r = i.useRef([]);
26
+ i.useEffect(() => {
27
+ var n, o;
28
+ if (!e || !s) return;
29
+ r.current = [];
30
+ let a = (n = s.getRootNode()) == null ? void 0 : n.host;
31
+ for (; a; )
32
+ (o = a.hasAttribute) != null && o.call(a, "inert") && (r.current.push(a), a.removeAttribute("inert")), a = a.parentElement;
33
+ return () => {
34
+ r.current.forEach((l) => l.setAttribute("inert", "")), r.current = [];
35
+ };
36
+ }, [e, s]);
37
+ }, K = [
38
+ {
39
+ id: "step1",
40
+ title: { id: "ctaModal.step1.title" },
41
+ subtitle: { id: "ctaModal.step1.subtitle" }
42
+ },
43
+ {
44
+ id: "step2",
45
+ title: { id: "ctaModal.step2.title" },
46
+ subtitle: { id: "ctaModal.step2.subtitle" }
47
+ },
48
+ {
49
+ id: "step3",
50
+ title: { id: "ctaModal.step3.title" },
51
+ subtitle: { id: "ctaModal.step3.subtitle" }
52
+ }
53
+ ], Q = () => {
54
+ const { formatMessage: e } = p();
55
+ return /* @__PURE__ */ t.jsx(d, { direction: "column", gap: "2", children: K.map(({ id: s, title: r, subtitle: a }) => /* @__PURE__ */ t.jsxs(d, { direction: "column", children: [
56
+ /* @__PURE__ */ t.jsx(m, { fontWeight: "medium", children: e(r) }),
57
+ /* @__PURE__ */ t.jsx(m, { color: "placeholder", children: e(a) })
58
+ ] }, s)) });
59
+ }, X = k(L), Y = k(W), M = { transform: "scale(0.7)", opacity: 0 }, Z = { transform: "scale(1)", opacity: 1 }, j = { backgroundColor: "rgba(0, 0, 0, 0)" }, ee = {
60
+ backgroundColor: "var(--palette-utility-overlay)",
61
+ backdropFilter: "blur(var(--effects-blur))",
62
+ opacity: 0.6
63
+ }, te = S.div`
64
+ scrollbar-width: thin;
65
+ scrollbar-color: var(--palette-modal-border);
66
+ flex-shrink: 1;
67
+ overflow-y: auto;
68
+ background-color: var(--palette-modal-surface);
69
+ border-radius: var(--sizes-radius-md);
70
+ max-height: 80vh;
71
+ padding-bottom: 10px;
72
+
73
+ &::-webkit-scrollbar {
74
+ width: 12px;
75
+ }
76
+
77
+ &::-webkit-scrollbar-track {
78
+ background-color: transparent;
79
+ }
80
+
81
+ &::-webkit-scrollbar-thumb {
82
+ background-color: var(--palette-modal-border);
83
+ border-radius: var(--sizes-radius-xs);
84
+ }
85
+ `, ae = ({ isModalOpen: e, setIsModalOpen: s, children: r }) => {
86
+ const a = i.useId(), { portalContainer: n } = w(), o = i.useRef(null);
87
+ return J(e, n), /* @__PURE__ */ t.jsx(T, { features: q, children: /* @__PURE__ */ t.jsx(D, { children: e && /* @__PURE__ */ t.jsx(P, { getContainer: () => n, children: /* @__PURE__ */ t.jsxs(
88
+ Y,
89
+ {
90
+ isDismissable: !0,
91
+ shouldCloseOnInteractOutside: (l) => l.getAttribute("data-id") === "modal-mask",
92
+ isOpen: e,
93
+ onOpenChange: () => s(!1),
94
+ $size: "normal",
95
+ initial: M,
96
+ animate: Z,
97
+ exit: M,
98
+ transition: { duration: 0.2 },
99
+ style: { width: "438px", border: "none", maxWidth: "90vw", maxHeight: "100vh" },
100
+ children: [
101
+ /* @__PURE__ */ t.jsx(
102
+ X,
103
+ {
104
+ "data-id": "modal-mask",
105
+ "data-testid": "modal-mask",
106
+ initial: j,
107
+ animate: ee,
108
+ exit: j,
109
+ transition: { duration: 0.2 }
110
+ }
111
+ ),
112
+ /* @__PURE__ */ t.jsx($, { role: "dialog", "aria-labelledby": a, children: /* @__PURE__ */ t.jsx(te, { ref: o, "data-testid": "modal-body", children: r }) })
113
+ ]
114
+ }
115
+ ) }) }) });
116
+ }, se = ({ setOpen: e }) => {
117
+ const { isMobile: s } = A(), r = G(), a = E(), n = () => {
118
+ r.mutate(void 0, {
119
+ onSuccess: (l) => {
120
+ const { next: h } = l;
121
+ e(!1), window.open(h);
122
+ },
123
+ onError: (l) => {
124
+ console.error("Failed to start application", l);
125
+ }
126
+ });
127
+ }, o = () => {
128
+ window.open("https://wayflyer.com/en/privacy-notice", "_blank", "noopener,noreferrer");
129
+ };
130
+ return /* @__PURE__ */ t.jsxs(d, { direction: "column", gap: "3", children: [
131
+ /* @__PURE__ */ t.jsxs(d, { gap: "2", direction: a || s ? "column" : "row", children: [
132
+ /* @__PURE__ */ t.jsxs(y, { fullWidth: !0, onClick: n, variant: "Primary", external: !0, children: [
133
+ /* @__PURE__ */ t.jsx(u, { id: "ctaModal.action" }),
134
+ /* @__PURE__ */ t.jsx(N, {})
135
+ ] }),
136
+ /* @__PURE__ */ t.jsx(y, { fullWidth: !0, variant: "Secondary", onClick: () => e(!1), children: /* @__PURE__ */ t.jsx(u, { id: "common.cancel" }) })
137
+ ] }),
138
+ /* @__PURE__ */ t.jsxs(m, { size: "sm", lineHeight: "normal", children: [
139
+ /* @__PURE__ */ t.jsx(u, { id: "ctaModal.consent" }),
140
+ /* @__PURE__ */ t.jsx(O, { onClick: o, children: /* @__PURE__ */ t.jsx(u, { id: "ctaModal.consent.privacy_policy" }) })
141
+ ] })
142
+ ] });
143
+ }, re = S(U)`
144
+ width: 100%;
145
+ max-width: none;
146
+ `, oe = ({ isModalOpen: e, setIsModalOpen: s }) => {
147
+ const { formatMessage: r } = p(), a = E(), { isMobile: n } = A(), o = a || n;
148
+ return /* @__PURE__ */ t.jsxs(ae, { isModalOpen: e, setIsModalOpen: s, children: [
149
+ !a && /* @__PURE__ */ t.jsx(re, { src: "https://static.wayflyer.com/flyui-assets/logos/wayflyer-ef.png" }),
150
+ /* @__PURE__ */ t.jsxs(d, { direction: "column", gap: "8", padding: o ? "4" : "6", children: [
151
+ /* @__PURE__ */ t.jsxs(d, { direction: "column", gap: "6", children: [
152
+ /* @__PURE__ */ t.jsx(m, { fontStyle: "regular", fontWeight: "medium", lineHeight: "tight", size: "2xl", children: r({ id: "ctaModal.title" }) }),
153
+ /* @__PURE__ */ t.jsx(Q, {})
154
+ ] }),
155
+ /* @__PURE__ */ t.jsx(se, { setOpen: s })
156
+ ] })
157
+ ] });
158
+ };
159
+ export {
160
+ oe as default
161
+ };