@wf-financing/ui 3.3.1 → 3.4.0
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 +6 -0
- package/dist/index.es.js +1533 -1524
- package/package.json +1 -1
- package/sdk/index.ts +2 -2
- package/src/components/banner/ProceedFundingButton.tsx +8 -3
- package/src/components/modal/ModalFooter.tsx +4 -4
package/package.json
CHANGED
package/sdk/index.ts
CHANGED
|
@@ -8,8 +8,8 @@ export class WayflyerUiSdk {
|
|
|
8
8
|
private readonly partnerTheme: PartnerTheme;
|
|
9
9
|
|
|
10
10
|
constructor(
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
readonly companyToken: string,
|
|
12
|
+
readonly options?: SdkOptionsType,
|
|
13
13
|
) {
|
|
14
14
|
const partnerId = getPartnerIdFromToken(companyToken);
|
|
15
15
|
this.partnerTheme = getPartnerThemeById(partnerId);
|
|
@@ -17,7 +17,7 @@ export const ProceedFundingButton = ({ isOnDarkTheme }: { isOnDarkTheme: boolean
|
|
|
17
17
|
const [isModalOpen, setIsModalOpen] = useState(false);
|
|
18
18
|
const sdkResponse = useCtaBanner();
|
|
19
19
|
const sdk = sdkResponse.data as CtaResponseType;
|
|
20
|
-
const
|
|
20
|
+
const { mutate, isPending: isLoading } = useContinueHostedApplication();
|
|
21
21
|
const invalidateCta = useInvalidateCta();
|
|
22
22
|
|
|
23
23
|
if (!sdk) return null;
|
|
@@ -30,7 +30,7 @@ export const ProceedFundingButton = ({ isOnDarkTheme }: { isOnDarkTheme: boolean
|
|
|
30
30
|
const handleContinueHostedApplication = () => {
|
|
31
31
|
switch (state) {
|
|
32
32
|
case CtaStateType.CONTINUE_APPLICATION:
|
|
33
|
-
|
|
33
|
+
mutate(undefined, {
|
|
34
34
|
onSuccess: (nextUrl: ContinueHostedApplicationResponseType) => {
|
|
35
35
|
const { next } = nextUrl;
|
|
36
36
|
window.open(next);
|
|
@@ -49,7 +49,12 @@ export const ProceedFundingButton = ({ isOnDarkTheme }: { isOnDarkTheme: boolean
|
|
|
49
49
|
|
|
50
50
|
return (
|
|
51
51
|
<>
|
|
52
|
-
<Button
|
|
52
|
+
<Button
|
|
53
|
+
variant={isOnDarkTheme ? 'PrimaryOnDark' : 'Primary'}
|
|
54
|
+
fullWidth
|
|
55
|
+
onClick={handleContinueHostedApplication}
|
|
56
|
+
loading={isLoading}
|
|
57
|
+
>
|
|
53
58
|
{config?.button_label}
|
|
54
59
|
</Button>
|
|
55
60
|
<ConsentModal isModalOpen={isModalOpen} setIsModalOpen={setIsModalOpen} />
|
|
@@ -11,12 +11,12 @@ type ModalFooterType = {
|
|
|
11
11
|
|
|
12
12
|
export const ModalFooter = ({ setOpen }: ModalFooterType) => {
|
|
13
13
|
const { isMobile } = useDetectDeviceSize();
|
|
14
|
-
const
|
|
14
|
+
const { mutate, isPending: isLoading } = useStartHostedApplication();
|
|
15
15
|
const isSmallScreen = useDetectSmallScreen();
|
|
16
16
|
const invalidateCta = useInvalidateCta();
|
|
17
17
|
|
|
18
18
|
const handleStartApplication = () => {
|
|
19
|
-
|
|
19
|
+
mutate(undefined, {
|
|
20
20
|
onSuccess: (nextUrl: StartHostedApplicationResponseType) => {
|
|
21
21
|
const { next } = nextUrl;
|
|
22
22
|
setOpen(false);
|
|
@@ -36,9 +36,9 @@ export const ModalFooter = ({ setOpen }: ModalFooterType) => {
|
|
|
36
36
|
return (
|
|
37
37
|
<Flex direction="column" gap="3">
|
|
38
38
|
<Flex gap="2" direction={isSmallScreen || isMobile ? 'column' : 'row'}>
|
|
39
|
-
<Button fullWidth onClick={handleStartApplication} variant="Primary" external>
|
|
39
|
+
<Button fullWidth onClick={handleStartApplication} loading={isLoading} variant="Primary" external>
|
|
40
40
|
<FormattedMessage id="ctaModal.action" />
|
|
41
|
-
<IconArrowOnSquareUpRight16Line />
|
|
41
|
+
{!isLoading && <IconArrowOnSquareUpRight16Line />}
|
|
42
42
|
</Button>
|
|
43
43
|
<Button fullWidth variant="Secondary" onClick={() => setOpen(false)}>
|
|
44
44
|
<FormattedMessage id="common.cancel" />
|