@wf-financing/ui 1.1.2 → 1.3.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 +19 -0
- package/dist/index.es.js +56394 -56035
- package/global.d.ts +2 -2
- package/package.json +6 -4
- package/src/App.tsx +10 -2
- package/src/api/continueHostedApplication.ts +12 -0
- package/src/api/getHeadlessSdkInstance.ts +3 -3
- package/src/components/banner/BulletList.tsx +13 -15
- package/src/components/banner/CtaBanner.snapshot.stories.tsx +4 -0
- package/src/components/banner/CtaBanner.tsx +5 -5
- package/src/components/banner/CtaBannerContent.tsx +2 -2
- package/src/components/banner/ProceedFundingButton.tsx +14 -4
- package/src/components/modal/ConsentModal.snapshot.stories.tsx +31 -9
- package/src/components/modal/ConsentModal.tsx +11 -3
- package/src/components/modal/FundingSteps.tsx +1 -1
- package/src/components/modal/Modal.tsx +7 -2
- package/src/components/modal/ModalFooter.tsx +3 -2
- package/src/config/fontParameters.ts +18 -0
- package/src/config/index.ts +2 -0
- package/src/config/rootsParameters.ts +19 -0
- package/src/hooks/index.ts +2 -0
- package/src/hooks/useContinueHostedApplication.ts +12 -0
- package/src/hooks/useRemoveInerted.ts +24 -0
- package/src/main.tsx +25 -14
- package/src/utils/applyFont.ts +26 -0
- package/src/utils/createRoots.ts +27 -0
- package/src/utils/index.ts +2 -0
- package/src/utils/initializeHeadlessSdk.ts +2 -2
- package/src/utils/loadFont.ts +28 -0
- package/src/utils/loadScriptAndInitializeSdk.ts +3 -3
- package/src/utils/partnerContext.ts +1 -0
- package/src/components/banner/BannerContent.snapshot.stories.tsx +0 -31
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
type FontParamsType = {
|
|
2
|
+
fontFamily: string;
|
|
3
|
+
fontUrl: string;
|
|
4
|
+
};
|
|
5
|
+
|
|
6
|
+
type LoadFontType = (shadow: ShadowRoot, fontParams: FontParamsType) => Promise<void>;
|
|
7
|
+
|
|
8
|
+
export const loadFont: LoadFontType = async (shadow, fontParams) => {
|
|
9
|
+
const { fontFamily, fontUrl } = fontParams;
|
|
10
|
+
const fontStylesId = 'font-styles';
|
|
11
|
+
|
|
12
|
+
const font = new FontFace(fontFamily, `url(${fontUrl})`);
|
|
13
|
+
|
|
14
|
+
await font.load();
|
|
15
|
+
document.fonts.add(font);
|
|
16
|
+
|
|
17
|
+
let fontStyles = shadow.getElementById(fontStylesId);
|
|
18
|
+
if (!fontStyles) {
|
|
19
|
+
fontStyles = document.createElement('style');
|
|
20
|
+
fontStyles.id = fontStylesId;
|
|
21
|
+
fontStyles.textContent = `
|
|
22
|
+
:host { font-family: "${fontFamily}", sans-serif; }
|
|
23
|
+
::slotted(*) { font-family: inherit; }
|
|
24
|
+
`;
|
|
25
|
+
|
|
26
|
+
shadow.appendChild(fontStyles);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IHeadlessWayflyerSdk, MockedModeType } from '@wf-financing/embedded-types';
|
|
2
2
|
|
|
3
3
|
import { initializeHeadlessSdk } from './initializeHeadlessSdk';
|
|
4
4
|
|
|
@@ -6,8 +6,8 @@ export const loadScriptAndInitializeSdk = (
|
|
|
6
6
|
script: HTMLScriptElement,
|
|
7
7
|
companyToken: string,
|
|
8
8
|
mockedMode?: MockedModeType,
|
|
9
|
-
): Promise<
|
|
10
|
-
return new Promise<
|
|
9
|
+
): Promise<IHeadlessWayflyerSdk> => {
|
|
10
|
+
return new Promise<IHeadlessWayflyerSdk>((resolve, reject) => {
|
|
11
11
|
script.onload = () => {
|
|
12
12
|
try {
|
|
13
13
|
resolve(initializeHeadlessSdk(companyToken, mockedMode));
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
-
import { CtaBannerContent } from './CtaBannerContent';
|
|
3
|
-
|
|
4
|
-
const meta: Meta<typeof CtaBannerContent> = {
|
|
5
|
-
title: 'BannerContent',
|
|
6
|
-
component: CtaBannerContent,
|
|
7
|
-
argTypes: {
|
|
8
|
-
isMobile: {
|
|
9
|
-
control: 'boolean',
|
|
10
|
-
description: 'Render mobile version',
|
|
11
|
-
defaultValue: false,
|
|
12
|
-
},
|
|
13
|
-
isTablet: {
|
|
14
|
-
control: 'boolean',
|
|
15
|
-
description: 'Render tablet version',
|
|
16
|
-
defaultValue: false,
|
|
17
|
-
},
|
|
18
|
-
},
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
export default meta;
|
|
22
|
-
|
|
23
|
-
type Story = StoryObj<typeof CtaBannerContent>;
|
|
24
|
-
|
|
25
|
-
export const Default: Story = {
|
|
26
|
-
args: {
|
|
27
|
-
isMobile: false,
|
|
28
|
-
isTablet: false,
|
|
29
|
-
},
|
|
30
|
-
render: (args) => <CtaBannerContent {...args} />,
|
|
31
|
-
};
|