@redneckz/wildless-cms-uni-blocks 0.14.918 → 0.14.919
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/bundle/bundle.umd.js +268 -214
- package/bundle/bundle.umd.min.js +1 -1
- package/bundle/retail/hooks/useIFrameMode.d.ts +4 -0
- package/bundle/utils/isIFrame.d.ts +1 -0
- package/dist/components/ApplicationLeadForm/ApplicationLeadForm.js +2 -0
- package/dist/components/ApplicationLeadForm/ApplicationLeadForm.js.map +1 -1
- package/dist/components/ApplicationLeadForm/EsiaLoginBanner.js +8 -3
- package/dist/components/ApplicationLeadForm/EsiaLoginBanner.js.map +1 -1
- package/dist/components/ContentPage/ContentPage.js +5 -2
- package/dist/components/ContentPage/ContentPage.js.map +1 -1
- package/dist/components/CreditCardForm/CreditCardFormStep.js +2 -0
- package/dist/components/CreditCardForm/CreditCardFormStep.js.map +1 -1
- package/dist/components/CreditForm/CreditFormStep.js +2 -0
- package/dist/components/CreditForm/CreditFormStep.js.map +1 -1
- package/dist/components/DebitForm/DebitFormStep.js +2 -0
- package/dist/components/DebitForm/DebitFormStep.js.map +1 -1
- package/dist/retail/hooks/useIFrameMode.d.ts +4 -0
- package/dist/retail/hooks/useIFrameMode.js +39 -0
- package/dist/retail/hooks/useIFrameMode.js.map +1 -0
- package/dist/ui-kit/DatePicker/DatePickerInput.js +1 -1
- package/dist/ui-kit/DatePicker/DatePickerInput.js.map +1 -1
- package/dist/ui-kit/TabsControl/TabItemInner.js +1 -1
- package/dist/ui-kit/TabsControl/TabItemInner.js.map +1 -1
- package/dist/utils/isIFrame.d.ts +1 -0
- package/dist/utils/isIFrame.js +5 -0
- package/dist/utils/isIFrame.js.map +1 -0
- package/lib/common.css +1 -1
- package/lib/components/ApplicationLeadForm/ApplicationLeadForm.js +2 -0
- package/lib/components/ApplicationLeadForm/ApplicationLeadForm.js.map +1 -1
- package/lib/components/ApplicationLeadForm/EsiaLoginBanner.js +8 -3
- package/lib/components/ApplicationLeadForm/EsiaLoginBanner.js.map +1 -1
- package/lib/components/ContentPage/ContentPage.js +5 -2
- package/lib/components/ContentPage/ContentPage.js.map +1 -1
- package/lib/components/CreditCardForm/CreditCardFormStep.js +2 -0
- package/lib/components/CreditCardForm/CreditCardFormStep.js.map +1 -1
- package/lib/components/CreditForm/CreditFormStep.js +2 -0
- package/lib/components/CreditForm/CreditFormStep.js.map +1 -1
- package/lib/components/DebitForm/DebitFormStep.js +2 -0
- package/lib/components/DebitForm/DebitFormStep.js.map +1 -1
- package/lib/retail/hooks/useIFrameMode.d.ts +4 -0
- package/lib/retail/hooks/useIFrameMode.js +36 -0
- package/lib/retail/hooks/useIFrameMode.js.map +1 -0
- package/lib/ui-kit/DatePicker/DatePickerInput.js +1 -1
- package/lib/ui-kit/DatePicker/DatePickerInput.js.map +1 -1
- package/lib/ui-kit/TabsControl/TabItemInner.js +1 -1
- package/lib/ui-kit/TabsControl/TabItemInner.js.map +1 -1
- package/lib/utils/isIFrame.d.ts +1 -0
- package/lib/utils/isIFrame.js +2 -0
- package/lib/utils/isIFrame.js.map +1 -0
- package/mobile/bundle/bundle.umd.js +268 -214
- package/mobile/bundle/bundle.umd.min.js +1 -1
- package/mobile/bundle/retail/hooks/useIFrameMode.d.ts +4 -0
- package/mobile/bundle/utils/isIFrame.d.ts +1 -0
- package/mobile/dist/components/ApplicationLeadForm/ApplicationLeadForm.js +2 -0
- package/mobile/dist/components/ApplicationLeadForm/ApplicationLeadForm.js.map +1 -1
- package/mobile/dist/components/ApplicationLeadForm/EsiaLoginBanner.js +8 -3
- package/mobile/dist/components/ApplicationLeadForm/EsiaLoginBanner.js.map +1 -1
- package/mobile/dist/components/ContentPage/ContentPage.js +5 -2
- package/mobile/dist/components/ContentPage/ContentPage.js.map +1 -1
- package/mobile/dist/components/CreditCardForm/CreditCardFormStep.js +2 -0
- package/mobile/dist/components/CreditCardForm/CreditCardFormStep.js.map +1 -1
- package/mobile/dist/components/CreditForm/CreditFormStep.js +2 -0
- package/mobile/dist/components/CreditForm/CreditFormStep.js.map +1 -1
- package/mobile/dist/components/DebitForm/DebitFormStep.js +2 -0
- package/mobile/dist/components/DebitForm/DebitFormStep.js.map +1 -1
- package/mobile/dist/retail/hooks/useIFrameMode.d.ts +4 -0
- package/mobile/dist/retail/hooks/useIFrameMode.js +39 -0
- package/mobile/dist/retail/hooks/useIFrameMode.js.map +1 -0
- package/mobile/dist/ui-kit/DatePicker/DatePickerInput.js +1 -1
- package/mobile/dist/ui-kit/DatePicker/DatePickerInput.js.map +1 -1
- package/mobile/dist/ui-kit/TabsControl/TabItemInner.js +1 -1
- package/mobile/dist/ui-kit/TabsControl/TabItemInner.js.map +1 -1
- package/mobile/dist/utils/isIFrame.d.ts +1 -0
- package/mobile/dist/utils/isIFrame.js +5 -0
- package/mobile/dist/utils/isIFrame.js.map +1 -0
- package/mobile/lib/common.css +1 -1
- package/mobile/lib/components/ApplicationLeadForm/ApplicationLeadForm.js +2 -0
- package/mobile/lib/components/ApplicationLeadForm/ApplicationLeadForm.js.map +1 -1
- package/mobile/lib/components/ApplicationLeadForm/EsiaLoginBanner.js +8 -3
- package/mobile/lib/components/ApplicationLeadForm/EsiaLoginBanner.js.map +1 -1
- package/mobile/lib/components/ContentPage/ContentPage.js +5 -2
- package/mobile/lib/components/ContentPage/ContentPage.js.map +1 -1
- package/mobile/lib/components/CreditCardForm/CreditCardFormStep.js +2 -0
- package/mobile/lib/components/CreditCardForm/CreditCardFormStep.js.map +1 -1
- package/mobile/lib/components/CreditForm/CreditFormStep.js +2 -0
- package/mobile/lib/components/CreditForm/CreditFormStep.js.map +1 -1
- package/mobile/lib/components/DebitForm/DebitFormStep.js +2 -0
- package/mobile/lib/components/DebitForm/DebitFormStep.js.map +1 -1
- package/mobile/lib/retail/hooks/useIFrameMode.d.ts +4 -0
- package/mobile/lib/retail/hooks/useIFrameMode.js +36 -0
- package/mobile/lib/retail/hooks/useIFrameMode.js.map +1 -0
- package/mobile/lib/ui-kit/DatePicker/DatePickerInput.js +1 -1
- package/mobile/lib/ui-kit/DatePicker/DatePickerInput.js.map +1 -1
- package/mobile/lib/ui-kit/TabsControl/TabItemInner.js +1 -1
- package/mobile/lib/ui-kit/TabsControl/TabItemInner.js.map +1 -1
- package/mobile/lib/utils/isIFrame.d.ts +1 -0
- package/mobile/lib/utils/isIFrame.js +2 -0
- package/mobile/lib/utils/isIFrame.js.map +1 -0
- package/mobile/src/common.css +3 -0
- package/mobile/src/components/ApplicationLeadForm/ApplicationLeadForm.tsx +2 -1
- package/mobile/src/components/ApplicationLeadForm/EsiaLoginBanner.tsx +9 -4
- package/mobile/src/components/ContentPage/ContentPage.tsx +6 -4
- package/mobile/src/components/CreditCardForm/CreditCardFormStep.tsx +2 -0
- package/mobile/src/components/CreditForm/CreditFormStep.tsx +2 -0
- package/mobile/src/components/DebitForm/DebitFormStep.tsx +2 -0
- package/mobile/src/retail/hooks/useIFrameMode.ts +45 -0
- package/mobile/src/ui-kit/DatePicker/DatePickerInput.tsx +1 -1
- package/mobile/src/ui-kit/TabsControl/TabItemInner.tsx +1 -0
- package/mobile/src/utils/isIFrame.ts +1 -0
- package/package.json +1 -1
- package/src/common.css +3 -0
- package/src/components/ApplicationLeadForm/ApplicationLeadForm.tsx +2 -1
- package/src/components/ApplicationLeadForm/EsiaLoginBanner.tsx +9 -4
- package/src/components/ContentPage/ContentPage.tsx +6 -4
- package/src/components/CreditCardForm/CreditCardFormStep.tsx +2 -0
- package/src/components/CreditForm/CreditFormStep.tsx +2 -0
- package/src/components/DebitForm/DebitFormStep.tsx +2 -0
- package/src/retail/hooks/useIFrameMode.ts +45 -0
- package/src/ui-kit/DatePicker/DatePickerInput.tsx +1 -1
- package/src/ui-kit/TabsControl/TabItemInner.tsx +1 -0
- package/src/utils/isIFrame.ts +1 -0
- package/tailwind.config.cjs +3 -0
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { JSX } from '@redneckz/uni-jsx';
|
|
2
2
|
import { useCallback } from '@redneckz/uni-jsx/lib/hooks';
|
|
3
|
+
import { useSessionStore } from '@redneckz/uni-jsx/lib/Store/useSessionStore';
|
|
3
4
|
import { locationNavigator } from '../../external/locationNavigator';
|
|
4
5
|
import { getLink } from '../../retail/api/getLink';
|
|
6
|
+
import { type IFrameStore } from '../../retail/hooks/useIFrameMode';
|
|
5
7
|
import { Button } from '../../ui-kit/Button/Button';
|
|
6
8
|
import { Img } from '../../ui-kit/Img/Img';
|
|
7
9
|
import { EsiaStatuses, type ProductType } from './ApplicationLeadFormContent';
|
|
@@ -13,20 +15,23 @@ export interface EsiaLoginBannerProps {
|
|
|
13
15
|
|
|
14
16
|
export const EsiaLoginBanner = JSX<EsiaLoginBannerProps>(({ onChangeEsiaStatus, productType }) => {
|
|
15
17
|
const navigator = locationNavigator();
|
|
18
|
+
const sessionStore = useSessionStore<IFrameStore>();
|
|
19
|
+
const frameLocation = sessionStore.frameLocation;
|
|
16
20
|
|
|
17
21
|
const handleAuth = useCallback(async () => {
|
|
18
22
|
try {
|
|
19
23
|
const resp = await getLink({
|
|
20
|
-
redirectUri: globalThis.location.origin + globalThis.location.pathname,
|
|
24
|
+
redirectUri: frameLocation || globalThis.location.origin + globalThis.location.pathname,
|
|
21
25
|
});
|
|
22
|
-
|
|
23
26
|
if (resp?.link) {
|
|
24
|
-
|
|
27
|
+
frameLocation
|
|
28
|
+
? window.parent.postMessage({ redirectUri: resp?.link }, '*')
|
|
29
|
+
: navigator.assign(resp.link);
|
|
25
30
|
}
|
|
26
31
|
} catch {
|
|
27
32
|
onChangeEsiaStatus(EsiaStatuses.Error);
|
|
28
33
|
}
|
|
29
|
-
}, []);
|
|
34
|
+
}, [frameLocation]);
|
|
30
35
|
|
|
31
36
|
return (
|
|
32
37
|
<div className="flex items-center rounded-md bg-main-gray p-4xl">
|
|
@@ -13,6 +13,7 @@ import { CookiePopup } from '../../ui-kit/CookiePopup/CookiePopup';
|
|
|
13
13
|
import { DialogManager } from '../../ui-kit/DialogManager/DialogManager';
|
|
14
14
|
import { PopupManager } from '../../ui-kit/PopupManager/PopupManager';
|
|
15
15
|
import { type UniBlockMeta } from '../../UniBlock/UniBlock';
|
|
16
|
+
import { isIFrame } from '../../utils/isIFrame';
|
|
16
17
|
import { style } from '../../utils/style';
|
|
17
18
|
|
|
18
19
|
interface ContentPageProps extends ComponentType {
|
|
@@ -30,7 +31,7 @@ export const ContentPage = JSX<ContentPageProps>(
|
|
|
30
31
|
({ className, data = EMPTY_DATA, blocksRegistry, blockDecorator }) => {
|
|
31
32
|
const { slots, blocks, fallback, ...pageContent } = data;
|
|
32
33
|
const resolvedPageContent = useJSONRef(pageContent, fallback);
|
|
33
|
-
|
|
34
|
+
const isFrame = isIFrame();
|
|
34
35
|
useClickHandler();
|
|
35
36
|
useDefaultLocation();
|
|
36
37
|
|
|
@@ -45,7 +46,7 @@ export const ContentPage = JSX<ContentPageProps>(
|
|
|
45
46
|
return (
|
|
46
47
|
<div data-theme={data.colorPalette || 'pc'}>
|
|
47
48
|
<section className={style('@container relative', data.style, className)}>
|
|
48
|
-
{slots?.[HEADER_SLOT]?.length ? (
|
|
49
|
+
{!isFrame && slots?.[HEADER_SLOT]?.length ? (
|
|
49
50
|
<div className="relative z-10 mb-lg shadow-[0_8px_32px_0px_#00000014]">
|
|
50
51
|
{renderBlocksList(slots?.[HEADER_SLOT], { ...options, slotName: HEADER_SLOT })}
|
|
51
52
|
</div>
|
|
@@ -56,10 +57,11 @@ export const ContentPage = JSX<ContentPageProps>(
|
|
|
56
57
|
options,
|
|
57
58
|
extraProps: { className: 'scroll-mt-12' },
|
|
58
59
|
})}
|
|
59
|
-
{
|
|
60
|
+
{!isFrame &&
|
|
61
|
+
renderBlocksList(slots?.[FOOTER_SLOT], { ...options, slotName: FOOTER_SLOT })}
|
|
60
62
|
</div>
|
|
61
63
|
</section>
|
|
62
|
-
{slots?.[STICKY_FOOTER_SLOT]?.length ? (
|
|
64
|
+
{!isFrame && slots?.[STICKY_FOOTER_SLOT]?.length ? (
|
|
63
65
|
<div className="fixed w-full bottom-0 left-0 z-[100]">
|
|
64
66
|
{renderBlocksList(slots?.[STICKY_FOOTER_SLOT], {
|
|
65
67
|
...options,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { JSX } from '@redneckz/uni-jsx';
|
|
2
2
|
import { useCallback, useMemo } from '@redneckz/uni-jsx/lib/hooks';
|
|
3
3
|
import { useForm } from '../../hooks/useForm/useForm';
|
|
4
|
+
import { useIFrameMode } from '../../retail/hooks/useIFrameMode';
|
|
4
5
|
import { type SectionsRetailProps } from '../../retail/model/InputSectionsType';
|
|
5
6
|
import { type LeadFormState } from '../../retail/model/LeadFormState';
|
|
6
7
|
import { renderStep } from '../../retail/utils/renderStep';
|
|
@@ -20,6 +21,7 @@ const PRODUCT_TYPE = 'creditCard';
|
|
|
20
21
|
|
|
21
22
|
export const CreditCardFormStep = JSX<CreditCardFormStepProps>(
|
|
22
23
|
({ step, sections, onPrevStep, onNextStep, onFinish }) => {
|
|
24
|
+
useIFrameMode();
|
|
23
25
|
const inputs = useMemo(
|
|
24
26
|
() => sections?.flatMap((_: SectionsRetailProps) => _?.inputs || []),
|
|
25
27
|
[sections],
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { JSX } from '@redneckz/uni-jsx';
|
|
2
2
|
import { useCallback, useMemo } from '@redneckz/uni-jsx/lib/hooks';
|
|
3
3
|
import { useForm } from '../../hooks/useForm/useForm';
|
|
4
|
+
import { useIFrameMode } from '../../retail/hooks/useIFrameMode';
|
|
4
5
|
import { useRetailFormStore } from '../../retail/hooks/useRetailFormStore';
|
|
5
6
|
import { type SectionsRetailProps } from '../../retail/model/InputSectionsType';
|
|
6
7
|
import { type LeadFormState } from '../../retail/model/LeadFormState';
|
|
@@ -24,6 +25,7 @@ const PRODUCT_TYPE = 'credit';
|
|
|
24
25
|
export const CreditFormStep = JSX<CreditFormStepProps>(
|
|
25
26
|
({ step, sections, programsSource, onPrevStep, onNextStep, onFinish }) => {
|
|
26
27
|
const { programId } = useRetailFormStore();
|
|
28
|
+
useIFrameMode();
|
|
27
29
|
const calcData = programsSource?.[programId ?? '']; // Need normalizator useForm, to be save defaultParams
|
|
28
30
|
|
|
29
31
|
const inputs = useMemo(
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { JSX } from '@redneckz/uni-jsx';
|
|
2
2
|
import { useCallback, useMemo } from '@redneckz/uni-jsx/lib/hooks';
|
|
3
3
|
import { useForm } from '../../hooks/useForm/useForm';
|
|
4
|
+
import { useIFrameMode } from '../../retail/hooks/useIFrameMode';
|
|
4
5
|
import { type SectionsRetailProps } from '../../retail/model/InputSectionsType';
|
|
5
6
|
import type { LeadFormState } from '../../retail/model/LeadFormState';
|
|
6
7
|
import { renderStep } from '../../retail/utils/renderStep';
|
|
@@ -20,6 +21,7 @@ const PRODUCT_TYPE = 'debitCard';
|
|
|
20
21
|
|
|
21
22
|
export const DebitFormStep = JSX<DebitFormStepProps>(
|
|
22
23
|
({ step, sections, onPrevStep, onNextStep, onFinish }) => {
|
|
24
|
+
useIFrameMode();
|
|
23
25
|
const inputs = useMemo(
|
|
24
26
|
() => sections?.flatMap((_: SectionsRetailProps) => _?.inputs ?? []),
|
|
25
27
|
[sections],
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { useEffect } from '@redneckz/uni-jsx/lib/hooks';
|
|
2
|
+
import { useSessionStore } from '@redneckz/uni-jsx/lib/Store/useSessionStore';
|
|
3
|
+
import { initializeExternalStylesheet } from '../../hooks/useExternalNS';
|
|
4
|
+
import { isIFrame } from '../../utils/isIFrame';
|
|
5
|
+
|
|
6
|
+
export type IFrameStore = {
|
|
7
|
+
frameLocation: string;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export const useIFrameMode = () => {
|
|
11
|
+
const isFrame = isIFrame();
|
|
12
|
+
const height = globalThis.document?.body?.scrollHeight;
|
|
13
|
+
const sessionStore = useSessionStore<IFrameStore>();
|
|
14
|
+
const params = new URLSearchParams(decodeURIComponent(globalThis.location?.search));
|
|
15
|
+
|
|
16
|
+
const styles = params.get('styles');
|
|
17
|
+
if (styles) {
|
|
18
|
+
initializeExternalStylesheet(styles);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
useEffect(() => {
|
|
22
|
+
if (isFrame) {
|
|
23
|
+
globalThis.parent.postMessage({ height: document.body.scrollHeight }, '*');
|
|
24
|
+
}
|
|
25
|
+
}, [height, isFrame]);
|
|
26
|
+
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
const handlePostMessage = (event: MessageEvent<{ location: string }>) => {
|
|
29
|
+
if (!event.data?.location) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
sessionStore.frameLocation = event.data?.location;
|
|
34
|
+
};
|
|
35
|
+
if (isFrame) {
|
|
36
|
+
globalThis.addEventListener('message', handlePostMessage);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return () => {
|
|
40
|
+
if (isFrame) {
|
|
41
|
+
globalThis.removeEventListener('message', handlePostMessage);
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
}, [isFrame]);
|
|
45
|
+
};
|
|
@@ -70,7 +70,7 @@ export const DatePickerInput = JSX<DatePickerInputProps>(
|
|
|
70
70
|
<div onClick={onInputClick} className={style('relative', className)}>
|
|
71
71
|
<input
|
|
72
72
|
ref={ref}
|
|
73
|
-
className="h-full w-full px-m text-l text-black focus-visible:outline-none"
|
|
73
|
+
className="h-full w-full px-m text-l text-black focus-visible:outline-none rounded-none"
|
|
74
74
|
value={inputValue}
|
|
75
75
|
type="text"
|
|
76
76
|
onChange={handleChange}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const isIFrame = () => globalThis.location !== globalThis?.top?.location;
|