@wf-financing/ui 1.4.3 → 1.4.4
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 +2 -2
- package/dist/index.es.js +94090 -1
- package/package.json +1 -1
- package/src/components/banner/ProceedFundingButton.tsx +5 -8
- package/src/components/modal/ConsentModal.snapshot.stories.tsx +2 -2
- package/src/components/modal/ConsentModal.tsx +1 -3
- package/vite.config.ts +6 -3
- package/dist/ConsentModal-vhnjWxOz.mjs +0 -161
- package/dist/index-Gn-_ZM3g.mjs +0 -75671
package/package.json
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import { Button } from '@wayflyer/flyui';
|
|
2
2
|
import {
|
|
3
|
-
ContinueHostedApplicationResponseType,
|
|
4
3
|
CtaContinueFundingType,
|
|
5
4
|
CtaGenericOfferType,
|
|
6
5
|
CtaIndicativeOfferType,
|
|
7
6
|
CtaStateType,
|
|
7
|
+
ContinueHostedApplicationResponseType,
|
|
8
8
|
} from '@wf-financing/embedded-types';
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
import { useContinueHostedApplication, useCtaBanner } from '../../hooks';
|
|
9
|
+
import { useState } from 'react';
|
|
12
10
|
|
|
13
|
-
|
|
11
|
+
import { useCtaBanner, useContinueHostedApplication } from '../../hooks';
|
|
12
|
+
import { ConsentModal } from '../modal/ConsentModal';
|
|
14
13
|
|
|
15
14
|
type CtaResponseType = CtaGenericOfferType | CtaIndicativeOfferType | CtaContinueFundingType;
|
|
16
15
|
|
|
@@ -51,9 +50,7 @@ export const ProceedFundingButton = () => {
|
|
|
51
50
|
<Button variant="Primary" fullWidth onClick={handleContinueHostedApplication}>
|
|
52
51
|
{config?.button_label}
|
|
53
52
|
</Button>
|
|
54
|
-
<
|
|
55
|
-
<ConsentModal isModalOpen={isModalOpen} setIsModalOpen={setIsModalOpen} />
|
|
56
|
-
</Suspense>
|
|
53
|
+
<ConsentModal isModalOpen={isModalOpen} setIsModalOpen={setIsModalOpen} />
|
|
57
54
|
</>
|
|
58
55
|
);
|
|
59
56
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { ConsentModal } from './ConsentModal';
|
|
4
4
|
import { PartnerContext } from '../../utils';
|
|
5
|
-
import
|
|
5
|
+
import { Themes } from '@wayflyer/flyui';
|
|
6
6
|
|
|
7
7
|
const portalContainer = document.createElement('div');
|
|
8
8
|
document.body.append(portalContainer);
|
|
@@ -17,7 +17,7 @@ const ImageContainer = styled(Image)`
|
|
|
17
17
|
max-width: none;
|
|
18
18
|
`;
|
|
19
19
|
|
|
20
|
-
const ConsentModal = ({ isModalOpen, setIsModalOpen }: ConsentModalProps) => {
|
|
20
|
+
export const ConsentModal = ({ isModalOpen, setIsModalOpen }: ConsentModalProps) => {
|
|
21
21
|
const { formatMessage } = useIntl();
|
|
22
22
|
const isSmallScreen = useDetectSmallScreen();
|
|
23
23
|
const { isMobile } = useDetectDeviceSize();
|
|
@@ -39,5 +39,3 @@ const ConsentModal = ({ isModalOpen, setIsModalOpen }: ConsentModalProps) => {
|
|
|
39
39
|
</Modal>
|
|
40
40
|
);
|
|
41
41
|
};
|
|
42
|
-
|
|
43
|
-
export default ConsentModal;
|
package/vite.config.ts
CHANGED
|
@@ -3,10 +3,10 @@ import react from '@vitejs/plugin-react';
|
|
|
3
3
|
import path from 'path';
|
|
4
4
|
import { defineConfig } from 'vite';
|
|
5
5
|
|
|
6
|
-
export default defineConfig(
|
|
6
|
+
export default defineConfig({
|
|
7
7
|
plugins: [react()],
|
|
8
8
|
define: {
|
|
9
|
-
'process.env
|
|
9
|
+
'process.env': {},
|
|
10
10
|
},
|
|
11
11
|
server: {
|
|
12
12
|
host: true,
|
|
@@ -20,5 +20,8 @@ export default defineConfig(({ mode }) => ({
|
|
|
20
20
|
fileName: (format) => `index.${format}.js`,
|
|
21
21
|
formats: ['es'],
|
|
22
22
|
},
|
|
23
|
+
rollupOptions: {
|
|
24
|
+
external: [],
|
|
25
|
+
},
|
|
23
26
|
},
|
|
24
|
-
})
|
|
27
|
+
});
|
|
@@ -1,161 +0,0 @@
|
|
|
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
|
-
};
|