@wf-financing/ui 1.4.2 → 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 +6 -0
- package/dist/ConsentModal-vhnjWxOz.mjs +161 -0
- package/dist/index-Gn-_ZM3g.mjs +75671 -0
- package/dist/index.es.js +1 -94090
- package/package.json +1 -1
- package/src/components/banner/ProceedFundingButton.tsx +8 -5
- package/src/components/modal/ConsentModal.snapshot.stories.tsx +2 -2
- package/src/components/modal/ConsentModal.tsx +3 -1
- package/src/components/modal/ModalFooter.tsx +2 -1
- package/vite.config.ts +3 -6
package/package.json
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { Button } from '@wayflyer/flyui';
|
|
2
2
|
import {
|
|
3
|
+
ContinueHostedApplicationResponseType,
|
|
3
4
|
CtaContinueFundingType,
|
|
4
5
|
CtaGenericOfferType,
|
|
5
6
|
CtaIndicativeOfferType,
|
|
6
7
|
CtaStateType,
|
|
7
|
-
ContinueHostedApplicationResponseType,
|
|
8
8
|
} from '@wf-financing/embedded-types';
|
|
9
|
-
import { useState } from 'react';
|
|
9
|
+
import { lazy, Suspense, useState } from 'react';
|
|
10
|
+
|
|
11
|
+
import { useContinueHostedApplication, useCtaBanner } from '../../hooks';
|
|
10
12
|
|
|
11
|
-
|
|
12
|
-
import { ConsentModal } from '../modal/ConsentModal';
|
|
13
|
+
const ConsentModal = lazy(() => import('../modal/ConsentModal'));
|
|
13
14
|
|
|
14
15
|
type CtaResponseType = CtaGenericOfferType | CtaIndicativeOfferType | CtaContinueFundingType;
|
|
15
16
|
|
|
@@ -50,7 +51,9 @@ export const ProceedFundingButton = () => {
|
|
|
50
51
|
<Button variant="Primary" fullWidth onClick={handleContinueHostedApplication}>
|
|
51
52
|
{config?.button_label}
|
|
52
53
|
</Button>
|
|
53
|
-
<
|
|
54
|
+
<Suspense>
|
|
55
|
+
<ConsentModal isModalOpen={isModalOpen} setIsModalOpen={setIsModalOpen} />
|
|
56
|
+
</Suspense>
|
|
54
57
|
</>
|
|
55
58
|
);
|
|
56
59
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
2
|
|
|
3
|
-
import { ConsentModal } from './ConsentModal';
|
|
4
|
-
import { PartnerContext } from '../../utils';
|
|
5
3
|
import { Themes } from '@wayflyer/flyui';
|
|
4
|
+
import { PartnerContext } from '../../utils';
|
|
5
|
+
import ConsentModal from './ConsentModal';
|
|
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
|
-
|
|
20
|
+
const ConsentModal = ({ isModalOpen, setIsModalOpen }: ConsentModalProps) => {
|
|
21
21
|
const { formatMessage } = useIntl();
|
|
22
22
|
const isSmallScreen = useDetectSmallScreen();
|
|
23
23
|
const { isMobile } = useDetectDeviceSize();
|
|
@@ -39,3 +39,5 @@ export const ConsentModal = ({ isModalOpen, setIsModalOpen }: ConsentModalProps)
|
|
|
39
39
|
</Modal>
|
|
40
40
|
);
|
|
41
41
|
};
|
|
42
|
+
|
|
43
|
+
export default ConsentModal;
|
|
@@ -3,7 +3,7 @@ import { IconArrowOnSquareUpRight16Line } from '@wayflyer/flyui-icons/16/line';
|
|
|
3
3
|
import { StartHostedApplicationResponseType } from '@wf-financing/embedded-types';
|
|
4
4
|
import { FormattedMessage } from 'react-intl';
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import { useDetectSmallScreen, useStartHostedApplication } from '../../hooks';
|
|
7
7
|
|
|
8
8
|
type ModalFooterType = {
|
|
9
9
|
setOpen: (isOpen: boolean) => void;
|
|
@@ -18,6 +18,7 @@ export const ModalFooter = ({ setOpen }: ModalFooterType) => {
|
|
|
18
18
|
startHostedAppMutation.mutate(undefined, {
|
|
19
19
|
onSuccess: (nextUrl: StartHostedApplicationResponseType) => {
|
|
20
20
|
const { next } = nextUrl;
|
|
21
|
+
setOpen(false);
|
|
21
22
|
window.open(next);
|
|
22
23
|
},
|
|
23
24
|
onError: (error) => {
|
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(({ mode }) => ({
|
|
7
7
|
plugins: [react()],
|
|
8
8
|
define: {
|
|
9
|
-
'process.env':
|
|
9
|
+
'process.env.NODE_ENV': JSON.stringify(mode === 'production' ? 'production' : 'development'),
|
|
10
10
|
},
|
|
11
11
|
server: {
|
|
12
12
|
host: true,
|
|
@@ -20,8 +20,5 @@ export default defineConfig({
|
|
|
20
20
|
fileName: (format) => `index.${format}.js`,
|
|
21
21
|
formats: ['es'],
|
|
22
22
|
},
|
|
23
|
-
rollupOptions: {
|
|
24
|
-
external: [],
|
|
25
|
-
},
|
|
26
23
|
},
|
|
27
|
-
});
|
|
24
|
+
}));
|