@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
|
@@ -1890,7 +1890,7 @@
|
|
|
1890
1890
|
useEffect(() => {
|
|
1891
1891
|
updateSelectedDate({ inputValue, setSelectedMonth, setSelectedYear, onChange });
|
|
1892
1892
|
}, [inputValue]);
|
|
1893
|
-
return (jsxs("div", { onClick: onInputClick, className: style('relative', className), children: [jsx("input", { ref: ref, className: "h-full w-full px-m text-l text-black focus-visible:outline-none", value: inputValue, type: "text", onChange: handleChange, onBlur: onBlur, disabled: disabled }), disabled ? null : jsx(Icon, { className: "mr-s", ...ICON_PROPS$1 })] }));
|
|
1893
|
+
return (jsxs("div", { onClick: onInputClick, className: style('relative', className), children: [jsx("input", { ref: ref, className: "h-full w-full px-m text-l text-black focus-visible:outline-none rounded-none", value: inputValue, type: "text", onChange: handleChange, onBlur: onBlur, disabled: disabled }), disabled ? null : jsx(Icon, { className: "mr-s", ...ICON_PROPS$1 })] }));
|
|
1894
1894
|
});
|
|
1895
1895
|
const isValidYear = (year) => Number(year) >= START_YEAR && Number(year) <= new Date().getFullYear();
|
|
1896
1896
|
const isValidMonth = (month) => Number(month) > 0 && Number(month) < 13;
|
|
@@ -2986,6 +2986,256 @@
|
|
|
2986
2986
|
return (jsx(Dialog, { onClose: handleClose, children: jsxs("div", { className: "flex flex-col gap-xl items-center", children: [jsx(Paragraph, { align: "text-center", children: "\u0423\u0432\u0430\u0436\u0430\u0435\u043C\u044B\u0439 \u043A\u043B\u0438\u0435\u043D\u0442!" }), jsx(Paragraph, { align: "text-center", children: "\u0414\u043B\u044F \u043F\u043E\u043B\u0443\u0447\u0435\u043D\u0438\u044F \u043A\u0440\u0435\u0434\u0438\u0442\u0430 \u0412\u0430\u043C \u043D\u0435\u043E\u0431\u0445\u043E\u0434\u0438\u043C\u043E \u043E\u0431\u0440\u0430\u0442\u0438\u0442\u044C\u0441\u044F \u0432 \u043E\u0444\u0438\u0441 \u0411\u0430\u043D\u043A\u0430" }), jsxs("div", { className: "flex flex-col sm:flex-row gap-xl items-center", children: [jsx(Button, { type: "button", version: "secondary", onClick: returnToMainPage, children: "\u0417\u0430\u0432\u0435\u0440\u0448\u0438\u0442\u044C" }), isMaxAttempts ? null : (jsx(Button, { type: "button", onClick: onClose, children: "\u041F\u0440\u043E\u0434\u043E\u043B\u0436\u0438\u0442\u044C" }))] })] }) }));
|
|
2987
2987
|
});
|
|
2988
2988
|
|
|
2989
|
+
function copy(source, target) {
|
|
2990
|
+
for (const [k, v] of source.entries()) {
|
|
2991
|
+
if (v !== null && v !== undefined) {
|
|
2992
|
+
target.setItem(k, v);
|
|
2993
|
+
}
|
|
2994
|
+
else {
|
|
2995
|
+
target.removeItem(k);
|
|
2996
|
+
}
|
|
2997
|
+
}
|
|
2998
|
+
}
|
|
2999
|
+
|
|
3000
|
+
function replicate(primary, secondary) {
|
|
3001
|
+
copy(primary, secondary);
|
|
3002
|
+
copy(secondary, primary);
|
|
3003
|
+
return primary.bus.watch(({ type, event }) => {
|
|
3004
|
+
if (event !== null && event !== undefined) {
|
|
3005
|
+
secondary.setItem(type, event);
|
|
3006
|
+
}
|
|
3007
|
+
else {
|
|
3008
|
+
secondary.removeItem(type);
|
|
3009
|
+
}
|
|
3010
|
+
});
|
|
3011
|
+
}
|
|
3012
|
+
|
|
3013
|
+
class StorageAdapter {
|
|
3014
|
+
storage;
|
|
3015
|
+
bus;
|
|
3016
|
+
get size() {
|
|
3017
|
+
return this.storage?.length ?? 0;
|
|
3018
|
+
}
|
|
3019
|
+
constructor(storage, bus = new EventBus()) {
|
|
3020
|
+
this.storage = storage;
|
|
3021
|
+
this.bus = bus;
|
|
3022
|
+
}
|
|
3023
|
+
hasItem(key) {
|
|
3024
|
+
return Boolean(this.storage?.getItem(String(key)));
|
|
3025
|
+
}
|
|
3026
|
+
getItem(key) {
|
|
3027
|
+
const _ = this.storage?.getItem(String(key)) ?? null;
|
|
3028
|
+
try {
|
|
3029
|
+
return JSON.parse(String(_));
|
|
3030
|
+
}
|
|
3031
|
+
catch (ex) {
|
|
3032
|
+
return null;
|
|
3033
|
+
}
|
|
3034
|
+
}
|
|
3035
|
+
entries() {
|
|
3036
|
+
return Array.from({ length: this.size }, (_, i) => {
|
|
3037
|
+
const k = String(this.storage?.key(i));
|
|
3038
|
+
return [k, this.getItem(k)];
|
|
3039
|
+
});
|
|
3040
|
+
}
|
|
3041
|
+
setItem(key, value) {
|
|
3042
|
+
if (value !== null) {
|
|
3043
|
+
this.storage?.setItem(String(key), JSON.stringify(value));
|
|
3044
|
+
}
|
|
3045
|
+
else {
|
|
3046
|
+
this.storage?.removeItem(String(key));
|
|
3047
|
+
}
|
|
3048
|
+
this.bus?.subject(key, value);
|
|
3049
|
+
}
|
|
3050
|
+
removeItem(key) {
|
|
3051
|
+
this.storage?.removeItem(String(key));
|
|
3052
|
+
this.bus?.subject(key, null);
|
|
3053
|
+
}
|
|
3054
|
+
}
|
|
3055
|
+
|
|
3056
|
+
class Store {
|
|
3057
|
+
bus;
|
|
3058
|
+
store = new Map();
|
|
3059
|
+
get size() {
|
|
3060
|
+
return this.store.size;
|
|
3061
|
+
}
|
|
3062
|
+
constructor(bus = new EventBus()) {
|
|
3063
|
+
this.bus = bus;
|
|
3064
|
+
}
|
|
3065
|
+
hasItem(key) {
|
|
3066
|
+
return this.store.has(key);
|
|
3067
|
+
}
|
|
3068
|
+
getItem(key) {
|
|
3069
|
+
return this.store.get(key);
|
|
3070
|
+
}
|
|
3071
|
+
entries() {
|
|
3072
|
+
return this.store.entries();
|
|
3073
|
+
}
|
|
3074
|
+
setItem(key, value) {
|
|
3075
|
+
this.store.set(key, value);
|
|
3076
|
+
this.bus.subject(key, value);
|
|
3077
|
+
}
|
|
3078
|
+
removeItem(key) {
|
|
3079
|
+
this.store.delete(key);
|
|
3080
|
+
this.bus.subject(key, null);
|
|
3081
|
+
}
|
|
3082
|
+
}
|
|
3083
|
+
|
|
3084
|
+
function useRerender() {
|
|
3085
|
+
const [, setCount] = useState(0);
|
|
3086
|
+
return useCallback(() => setCount(_ => (_ + 1) % (1 << 16)), []);
|
|
3087
|
+
}
|
|
3088
|
+
|
|
3089
|
+
const DEFAULT_METHODS = {};
|
|
3090
|
+
/**
|
|
3091
|
+
* MobX like reactivity (simplified).
|
|
3092
|
+
* Can be used to migrate from Redux/MobX or something else
|
|
3093
|
+
*
|
|
3094
|
+
* @param store
|
|
3095
|
+
* @returns reactive proxy backed by store
|
|
3096
|
+
*/
|
|
3097
|
+
function useStore(store, methods = DEFAULT_METHODS) {
|
|
3098
|
+
const deps = useRef(null);
|
|
3099
|
+
const render = useRerender();
|
|
3100
|
+
useEffect(() => store.bus.watch(ev => {
|
|
3101
|
+
if (deps.current?.has(String(ev.type))) {
|
|
3102
|
+
render();
|
|
3103
|
+
}
|
|
3104
|
+
}), [store, render]);
|
|
3105
|
+
return useMemo(() => new Proxy(methods, {
|
|
3106
|
+
get(_, key) {
|
|
3107
|
+
deps.current ||= new Set();
|
|
3108
|
+
deps.current.add(key);
|
|
3109
|
+
return store.getItem(key);
|
|
3110
|
+
},
|
|
3111
|
+
has(_, key) {
|
|
3112
|
+
deps.current ||= new Set();
|
|
3113
|
+
deps.current.add(key);
|
|
3114
|
+
return store.hasItem(key);
|
|
3115
|
+
},
|
|
3116
|
+
set(_, key, value) {
|
|
3117
|
+
store.setItem(key, value);
|
|
3118
|
+
return true;
|
|
3119
|
+
},
|
|
3120
|
+
deleteProperty(_, key) {
|
|
3121
|
+
store.removeItem(key);
|
|
3122
|
+
return true;
|
|
3123
|
+
}
|
|
3124
|
+
}), [store]);
|
|
3125
|
+
}
|
|
3126
|
+
|
|
3127
|
+
const sessionStore = new Store(); // sessionStorage cache
|
|
3128
|
+
replicate(sessionStore, new StorageAdapter(globalThis?.sessionStorage));
|
|
3129
|
+
function useSessionStore() {
|
|
3130
|
+
return useStore(sessionStore);
|
|
3131
|
+
}
|
|
3132
|
+
|
|
3133
|
+
const getNS = (_) => globalThis[_];
|
|
3134
|
+
const initializeExternalNS = (namespaceName, url, isModule = false) => {
|
|
3135
|
+
const script = globalThis.document.getElementById(url);
|
|
3136
|
+
if (script) {
|
|
3137
|
+
const ns = getNS(namespaceName);
|
|
3138
|
+
if (ns) {
|
|
3139
|
+
return Promise.resolve(ns);
|
|
3140
|
+
}
|
|
3141
|
+
else {
|
|
3142
|
+
return new Promise((resolve) => {
|
|
3143
|
+
script.addEventListener('load', () => {
|
|
3144
|
+
resolve(getNS(namespaceName));
|
|
3145
|
+
});
|
|
3146
|
+
});
|
|
3147
|
+
}
|
|
3148
|
+
}
|
|
3149
|
+
else {
|
|
3150
|
+
return new Promise((resolve, reject) => {
|
|
3151
|
+
const newScript = globalThis.document.createElement('script');
|
|
3152
|
+
newScript.src = url;
|
|
3153
|
+
newScript.async = true;
|
|
3154
|
+
newScript.id = url;
|
|
3155
|
+
if (isModule) {
|
|
3156
|
+
newScript.type = 'module';
|
|
3157
|
+
}
|
|
3158
|
+
newScript.addEventListener('load', () => {
|
|
3159
|
+
resolve(getNS(namespaceName));
|
|
3160
|
+
});
|
|
3161
|
+
newScript.addEventListener('error', (error) => {
|
|
3162
|
+
reject(error);
|
|
3163
|
+
});
|
|
3164
|
+
globalThis.document.head.appendChild(newScript);
|
|
3165
|
+
});
|
|
3166
|
+
}
|
|
3167
|
+
};
|
|
3168
|
+
const initializeExternalStylesheet = (url = '') => {
|
|
3169
|
+
const link = globalThis.document.getElementById(url);
|
|
3170
|
+
if (!link) {
|
|
3171
|
+
const newLink = globalThis.document.createElement('link');
|
|
3172
|
+
newLink.href = url;
|
|
3173
|
+
newLink.id = url;
|
|
3174
|
+
newLink.rel = 'stylesheet';
|
|
3175
|
+
globalThis.document.head.appendChild(newLink);
|
|
3176
|
+
}
|
|
3177
|
+
};
|
|
3178
|
+
function useExternalNS(namespaceName, url, unmountNS = true) {
|
|
3179
|
+
const [externalNS, setExternalNS] = useState(undefined);
|
|
3180
|
+
useEffect(() => {
|
|
3181
|
+
let isMounted = true;
|
|
3182
|
+
initializeExternalNS(namespaceName, url)
|
|
3183
|
+
.then((ns) => {
|
|
3184
|
+
if (isMounted) {
|
|
3185
|
+
setExternalNS(ns);
|
|
3186
|
+
}
|
|
3187
|
+
})
|
|
3188
|
+
.catch((error) => {
|
|
3189
|
+
console.error(`Failed to initialize external namespace: ${error}`);
|
|
3190
|
+
});
|
|
3191
|
+
return () => {
|
|
3192
|
+
isMounted = false;
|
|
3193
|
+
if (unmountNS) {
|
|
3194
|
+
const script = globalThis.document.getElementById(url);
|
|
3195
|
+
if (script) {
|
|
3196
|
+
globalThis.document.head.removeChild(script);
|
|
3197
|
+
}
|
|
3198
|
+
setExternalNS(undefined);
|
|
3199
|
+
}
|
|
3200
|
+
};
|
|
3201
|
+
}, [namespaceName, url, unmountNS]);
|
|
3202
|
+
return externalNS;
|
|
3203
|
+
}
|
|
3204
|
+
|
|
3205
|
+
const isIFrame = () => globalThis.location !== globalThis?.top?.location;
|
|
3206
|
+
|
|
3207
|
+
const useIFrameMode = () => {
|
|
3208
|
+
const isFrame = isIFrame();
|
|
3209
|
+
const height = globalThis.document?.body?.scrollHeight;
|
|
3210
|
+
const sessionStore = useSessionStore();
|
|
3211
|
+
const params = new URLSearchParams(decodeURIComponent(globalThis.location?.search));
|
|
3212
|
+
const styles = params.get('styles');
|
|
3213
|
+
if (styles) {
|
|
3214
|
+
initializeExternalStylesheet(styles);
|
|
3215
|
+
}
|
|
3216
|
+
useEffect(() => {
|
|
3217
|
+
if (isFrame) {
|
|
3218
|
+
globalThis.parent.postMessage({ height: document.body.scrollHeight }, '*');
|
|
3219
|
+
}
|
|
3220
|
+
}, [height, isFrame]);
|
|
3221
|
+
useEffect(() => {
|
|
3222
|
+
const handlePostMessage = (event) => {
|
|
3223
|
+
if (!event.data?.location) {
|
|
3224
|
+
return;
|
|
3225
|
+
}
|
|
3226
|
+
sessionStore.frameLocation = event.data?.location;
|
|
3227
|
+
};
|
|
3228
|
+
if (isFrame) {
|
|
3229
|
+
globalThis.addEventListener('message', handlePostMessage);
|
|
3230
|
+
}
|
|
3231
|
+
return () => {
|
|
3232
|
+
if (isFrame) {
|
|
3233
|
+
globalThis.removeEventListener('message', handlePostMessage);
|
|
3234
|
+
}
|
|
3235
|
+
};
|
|
3236
|
+
}, [isFrame]);
|
|
3237
|
+
};
|
|
3238
|
+
|
|
2989
3239
|
const ERROR_MESSAGE = 'Некорректно заполненное поле';
|
|
2990
3240
|
const ADDRESS_ERROR_MESSAGE = 'Укажите регион, город/населенный пункт, улицу, дом';
|
|
2991
3241
|
const retailCyrillicPattern = /^[\u0400-\u04FF-\s]+$/u;
|
|
@@ -3285,19 +3535,23 @@
|
|
|
3285
3535
|
|
|
3286
3536
|
const EsiaLoginBanner = JSX(({ onChangeEsiaStatus, productType }) => {
|
|
3287
3537
|
const navigator = locationNavigator();
|
|
3538
|
+
const sessionStore = useSessionStore();
|
|
3539
|
+
const frameLocation = sessionStore.frameLocation;
|
|
3288
3540
|
const handleAuth = useCallback(async () => {
|
|
3289
3541
|
try {
|
|
3290
3542
|
const resp = await getLink({
|
|
3291
|
-
redirectUri: globalThis.location.origin + globalThis.location.pathname,
|
|
3543
|
+
redirectUri: frameLocation || globalThis.location.origin + globalThis.location.pathname,
|
|
3292
3544
|
});
|
|
3293
3545
|
if (resp?.link) {
|
|
3294
|
-
|
|
3546
|
+
frameLocation
|
|
3547
|
+
? window.parent.postMessage({ redirectUri: resp?.link }, '*')
|
|
3548
|
+
: navigator.assign(resp.link);
|
|
3295
3549
|
}
|
|
3296
3550
|
}
|
|
3297
3551
|
catch {
|
|
3298
3552
|
onChangeEsiaStatus(EsiaStatuses.Error);
|
|
3299
3553
|
}
|
|
3300
|
-
}, []);
|
|
3554
|
+
}, [frameLocation]);
|
|
3301
3555
|
return (jsxs("div", { className: "flex items-center rounded-md bg-main-gray p-4xl", children: [jsxs("div", { className: "flex gap-m flex-col justify-around w-full", children: [jsx("p", { className: "text-xl", children: `Заполните данные через Госуслуги${productType === 'debitCard' ? ' - это значительно сократит время оформления заявки' : ''}` }), productType === 'debitCard' ? null : (jsxs("ul", { className: "list-disc list-inside", children: [jsx("li", { children: "\u0412\u0435\u0440\u043E\u044F\u0442\u043D\u043E\u0441\u0442\u044C \u043E\u0434\u043E\u0431\u0440\u0435\u043D\u0438\u044F \u0432\u044B\u0448\u0435" }), jsx("li", { children: "\u0411\u0435\u0437 \u0441\u043F\u0440\u0430\u0432\u043E\u043A \u043E \u0434\u043E\u0445\u043E\u0434\u0430\u0445 \u0438 \u0442\u0440\u0443\u0434\u043E\u0443\u0441\u0442\u0440\u043E\u0439\u0441\u0442\u0432\u0435" }), jsx("li", { children: "\u0421 \u0437\u0430\u0449\u0438\u0442\u043E\u0439 \u0412\u0430\u0448\u0438\u0445 \u0434\u0430\u043D\u043D\u044B\u0445" })] })), jsx(Img, { className: "block self-center @md:hidden", image: { icon: 'GosUslugiIcon', iconVersion: 'normal' }, height: "80", width: "80" }), jsx(Button, { type: "button", onClick: handleAuth, className: "w-full @md:w-fit", children: "\u0417\u0430\u043F\u043E\u043B\u043D\u0438\u0442\u044C" })] }), jsx(Img, { className: "hidden @md:block", image: { icon: 'GosUslugiIcon', iconVersion: 'normal' }, height: "164" })] }));
|
|
3302
3556
|
});
|
|
3303
3557
|
|
|
@@ -4063,68 +4317,6 @@
|
|
|
4063
4317
|
return (jsx("div", { className: `select-none cursor-pointer py-m w-12 bg-white ${Object.values(styles$1).join(' ')} ${className}`, onClick: setUserGeoLocation, children: jsx(Icon, { name: "UserGeoLocationIcon", width: "20", height: "16" }) }));
|
|
4064
4318
|
};
|
|
4065
4319
|
|
|
4066
|
-
const getNS = (_) => globalThis[_];
|
|
4067
|
-
const initializeExternalNS = (namespaceName, url, isModule = false) => {
|
|
4068
|
-
const script = globalThis.document.getElementById(url);
|
|
4069
|
-
if (script) {
|
|
4070
|
-
const ns = getNS(namespaceName);
|
|
4071
|
-
if (ns) {
|
|
4072
|
-
return Promise.resolve(ns);
|
|
4073
|
-
}
|
|
4074
|
-
else {
|
|
4075
|
-
return new Promise((resolve) => {
|
|
4076
|
-
script.addEventListener('load', () => {
|
|
4077
|
-
resolve(getNS(namespaceName));
|
|
4078
|
-
});
|
|
4079
|
-
});
|
|
4080
|
-
}
|
|
4081
|
-
}
|
|
4082
|
-
else {
|
|
4083
|
-
return new Promise((resolve, reject) => {
|
|
4084
|
-
const newScript = globalThis.document.createElement('script');
|
|
4085
|
-
newScript.src = url;
|
|
4086
|
-
newScript.async = true;
|
|
4087
|
-
newScript.id = url;
|
|
4088
|
-
if (isModule) {
|
|
4089
|
-
newScript.type = 'module';
|
|
4090
|
-
}
|
|
4091
|
-
newScript.addEventListener('load', () => {
|
|
4092
|
-
resolve(getNS(namespaceName));
|
|
4093
|
-
});
|
|
4094
|
-
newScript.addEventListener('error', (error) => {
|
|
4095
|
-
reject(error);
|
|
4096
|
-
});
|
|
4097
|
-
globalThis.document.head.appendChild(newScript);
|
|
4098
|
-
});
|
|
4099
|
-
}
|
|
4100
|
-
};
|
|
4101
|
-
function useExternalNS(namespaceName, url, unmountNS = true) {
|
|
4102
|
-
const [externalNS, setExternalNS] = useState(undefined);
|
|
4103
|
-
useEffect(() => {
|
|
4104
|
-
let isMounted = true;
|
|
4105
|
-
initializeExternalNS(namespaceName, url)
|
|
4106
|
-
.then((ns) => {
|
|
4107
|
-
if (isMounted) {
|
|
4108
|
-
setExternalNS(ns);
|
|
4109
|
-
}
|
|
4110
|
-
})
|
|
4111
|
-
.catch((error) => {
|
|
4112
|
-
console.error(`Failed to initialize external namespace: ${error}`);
|
|
4113
|
-
});
|
|
4114
|
-
return () => {
|
|
4115
|
-
isMounted = false;
|
|
4116
|
-
if (unmountNS) {
|
|
4117
|
-
const script = globalThis.document.getElementById(url);
|
|
4118
|
-
if (script) {
|
|
4119
|
-
globalThis.document.head.removeChild(script);
|
|
4120
|
-
}
|
|
4121
|
-
setExternalNS(undefined);
|
|
4122
|
-
}
|
|
4123
|
-
};
|
|
4124
|
-
}, [namespaceName, url, unmountNS]);
|
|
4125
|
-
return externalNS;
|
|
4126
|
-
}
|
|
4127
|
-
|
|
4128
4320
|
const YMAPS_NAMESPACE = 'ymaps';
|
|
4129
4321
|
const useYandexMaps = () => {
|
|
4130
4322
|
const url = `https://api-maps.yandex.ru/2.1/?apikey=${projectSettings.YANDEX_MAP_API_KEY || ''}&lang=ru_RU`;
|
|
@@ -4256,144 +4448,6 @@
|
|
|
4256
4448
|
})), ...addressField, isSearch: true }), jsx("div", { className: "h-[600px]", children: jsx(ClientOnly, { children: jsx(YandexMap, { points: points, isLoad: !data, className: "h-full", selectedAddress: addressField?.value?.text }) }) })] }));
|
|
4257
4449
|
});
|
|
4258
4450
|
|
|
4259
|
-
function copy(source, target) {
|
|
4260
|
-
for (const [k, v] of source.entries()) {
|
|
4261
|
-
if (v !== null && v !== undefined) {
|
|
4262
|
-
target.setItem(k, v);
|
|
4263
|
-
}
|
|
4264
|
-
else {
|
|
4265
|
-
target.removeItem(k);
|
|
4266
|
-
}
|
|
4267
|
-
}
|
|
4268
|
-
}
|
|
4269
|
-
|
|
4270
|
-
function replicate(primary, secondary) {
|
|
4271
|
-
copy(primary, secondary);
|
|
4272
|
-
copy(secondary, primary);
|
|
4273
|
-
return primary.bus.watch(({ type, event }) => {
|
|
4274
|
-
if (event !== null && event !== undefined) {
|
|
4275
|
-
secondary.setItem(type, event);
|
|
4276
|
-
}
|
|
4277
|
-
else {
|
|
4278
|
-
secondary.removeItem(type);
|
|
4279
|
-
}
|
|
4280
|
-
});
|
|
4281
|
-
}
|
|
4282
|
-
|
|
4283
|
-
class StorageAdapter {
|
|
4284
|
-
storage;
|
|
4285
|
-
bus;
|
|
4286
|
-
get size() {
|
|
4287
|
-
return this.storage?.length ?? 0;
|
|
4288
|
-
}
|
|
4289
|
-
constructor(storage, bus = new EventBus()) {
|
|
4290
|
-
this.storage = storage;
|
|
4291
|
-
this.bus = bus;
|
|
4292
|
-
}
|
|
4293
|
-
hasItem(key) {
|
|
4294
|
-
return Boolean(this.storage?.getItem(String(key)));
|
|
4295
|
-
}
|
|
4296
|
-
getItem(key) {
|
|
4297
|
-
const _ = this.storage?.getItem(String(key)) ?? null;
|
|
4298
|
-
try {
|
|
4299
|
-
return JSON.parse(String(_));
|
|
4300
|
-
}
|
|
4301
|
-
catch (ex) {
|
|
4302
|
-
return null;
|
|
4303
|
-
}
|
|
4304
|
-
}
|
|
4305
|
-
entries() {
|
|
4306
|
-
return Array.from({ length: this.size }, (_, i) => {
|
|
4307
|
-
const k = String(this.storage?.key(i));
|
|
4308
|
-
return [k, this.getItem(k)];
|
|
4309
|
-
});
|
|
4310
|
-
}
|
|
4311
|
-
setItem(key, value) {
|
|
4312
|
-
if (value !== null) {
|
|
4313
|
-
this.storage?.setItem(String(key), JSON.stringify(value));
|
|
4314
|
-
}
|
|
4315
|
-
else {
|
|
4316
|
-
this.storage?.removeItem(String(key));
|
|
4317
|
-
}
|
|
4318
|
-
this.bus?.subject(key, value);
|
|
4319
|
-
}
|
|
4320
|
-
removeItem(key) {
|
|
4321
|
-
this.storage?.removeItem(String(key));
|
|
4322
|
-
this.bus?.subject(key, null);
|
|
4323
|
-
}
|
|
4324
|
-
}
|
|
4325
|
-
|
|
4326
|
-
class Store {
|
|
4327
|
-
bus;
|
|
4328
|
-
store = new Map();
|
|
4329
|
-
get size() {
|
|
4330
|
-
return this.store.size;
|
|
4331
|
-
}
|
|
4332
|
-
constructor(bus = new EventBus()) {
|
|
4333
|
-
this.bus = bus;
|
|
4334
|
-
}
|
|
4335
|
-
hasItem(key) {
|
|
4336
|
-
return this.store.has(key);
|
|
4337
|
-
}
|
|
4338
|
-
getItem(key) {
|
|
4339
|
-
return this.store.get(key);
|
|
4340
|
-
}
|
|
4341
|
-
entries() {
|
|
4342
|
-
return this.store.entries();
|
|
4343
|
-
}
|
|
4344
|
-
setItem(key, value) {
|
|
4345
|
-
this.store.set(key, value);
|
|
4346
|
-
this.bus.subject(key, value);
|
|
4347
|
-
}
|
|
4348
|
-
removeItem(key) {
|
|
4349
|
-
this.store.delete(key);
|
|
4350
|
-
this.bus.subject(key, null);
|
|
4351
|
-
}
|
|
4352
|
-
}
|
|
4353
|
-
|
|
4354
|
-
function useRerender() {
|
|
4355
|
-
const [, setCount] = useState(0);
|
|
4356
|
-
return useCallback(() => setCount(_ => (_ + 1) % (1 << 16)), []);
|
|
4357
|
-
}
|
|
4358
|
-
|
|
4359
|
-
const DEFAULT_METHODS = {};
|
|
4360
|
-
/**
|
|
4361
|
-
* MobX like reactivity (simplified).
|
|
4362
|
-
* Can be used to migrate from Redux/MobX or something else
|
|
4363
|
-
*
|
|
4364
|
-
* @param store
|
|
4365
|
-
* @returns reactive proxy backed by store
|
|
4366
|
-
*/
|
|
4367
|
-
function useStore(store, methods = DEFAULT_METHODS) {
|
|
4368
|
-
const deps = useRef(null);
|
|
4369
|
-
const render = useRerender();
|
|
4370
|
-
useEffect(() => store.bus.watch(ev => {
|
|
4371
|
-
if (deps.current?.has(String(ev.type))) {
|
|
4372
|
-
render();
|
|
4373
|
-
}
|
|
4374
|
-
}), [store, render]);
|
|
4375
|
-
return useMemo(() => new Proxy(methods, {
|
|
4376
|
-
get(_, key) {
|
|
4377
|
-
deps.current ||= new Set();
|
|
4378
|
-
deps.current.add(key);
|
|
4379
|
-
return store.getItem(key);
|
|
4380
|
-
},
|
|
4381
|
-
has(_, key) {
|
|
4382
|
-
deps.current ||= new Set();
|
|
4383
|
-
deps.current.add(key);
|
|
4384
|
-
return store.hasItem(key);
|
|
4385
|
-
},
|
|
4386
|
-
set(_, key, value) {
|
|
4387
|
-
store.setItem(key, value);
|
|
4388
|
-
return true;
|
|
4389
|
-
},
|
|
4390
|
-
deleteProperty(_, key) {
|
|
4391
|
-
store.removeItem(key);
|
|
4392
|
-
return true;
|
|
4393
|
-
}
|
|
4394
|
-
}), [store]);
|
|
4395
|
-
}
|
|
4396
|
-
|
|
4397
4451
|
const localStore = new Store(); // localStorage cache
|
|
4398
4452
|
replicate(localStore, new StorageAdapter(globalThis?.localStorage));
|
|
4399
4453
|
function useLocalStore(methods) {
|
|
@@ -5648,12 +5702,6 @@
|
|
|
5648
5702
|
|
|
5649
5703
|
const renderSubmitButton = (button, isSending = false) => (jsx(SubmitButton$1, { className: "w-full @xl:w-auto", isLoading: isSending, children: button?.text ? button.text : 'Отправить заявку' }));
|
|
5650
5704
|
|
|
5651
|
-
const sessionStore = new Store(); // sessionStorage cache
|
|
5652
|
-
replicate(sessionStore, new StorageAdapter(globalThis?.sessionStorage));
|
|
5653
|
-
function useSessionStore() {
|
|
5654
|
-
return useStore(sessionStore);
|
|
5655
|
-
}
|
|
5656
|
-
|
|
5657
5705
|
const createDraftTask = async (body) => {
|
|
5658
5706
|
const res = await fetchRetailJSON('/user-data/createDraftTask', 'POST', body);
|
|
5659
5707
|
return res || {};
|
|
@@ -6889,6 +6937,7 @@
|
|
|
6889
6937
|
const applicationFormData = useMemo(() => getApplicationFormData(productType), [productType]);
|
|
6890
6938
|
const inputs = useMemo(() => getInputs(applicationFormData), [applicationFormData]);
|
|
6891
6939
|
const noConsentDialog = useDialog(NoConsentDialog);
|
|
6940
|
+
useIFrameMode();
|
|
6892
6941
|
const extendedValidatorObj = useMemo(() => getExtendedValidatorObj(productType), [productType]);
|
|
6893
6942
|
const formValidator = useMemo(() => getFormValidator(inputs, extendedValidatorObj), [inputs, extendedValidatorObj]);
|
|
6894
6943
|
const initialFormState = useInitApplicationLead({
|
|
@@ -8820,6 +8869,7 @@
|
|
|
8820
8869
|
|
|
8821
8870
|
const PRODUCT_TYPE$2 = 'creditCard';
|
|
8822
8871
|
const CreditCardFormStep = JSX(({ step, sections, onPrevStep, onNextStep, onFinish }) => {
|
|
8872
|
+
useIFrameMode();
|
|
8823
8873
|
const inputs = useMemo(() => sections?.flatMap((_) => _?.inputs || []), [sections]);
|
|
8824
8874
|
const formValidator = useCallback((formState) => getRetailFormValidator({
|
|
8825
8875
|
formState,
|
|
@@ -9533,6 +9583,7 @@
|
|
|
9533
9583
|
const PRODUCT_TYPE$1 = 'credit';
|
|
9534
9584
|
const CreditFormStep = JSX(({ step, sections, programsSource, onPrevStep, onNextStep, onFinish }) => {
|
|
9535
9585
|
const { programId } = useRetailFormStore();
|
|
9586
|
+
useIFrameMode();
|
|
9536
9587
|
const calcData = programsSource?.[programId ?? '']; // Need normalizator useForm, to be save defaultParams
|
|
9537
9588
|
const inputs = useMemo(() => sections?.flatMap((_) => _?.inputs ?? []), [sections]);
|
|
9538
9589
|
const formValidator = useCallback((formState) => getRetailFormValidator({
|
|
@@ -10036,6 +10087,7 @@
|
|
|
10036
10087
|
|
|
10037
10088
|
const PRODUCT_TYPE = 'debitCard';
|
|
10038
10089
|
const DebitFormStep = JSX(({ step, sections, onPrevStep, onNextStep, onFinish }) => {
|
|
10090
|
+
useIFrameMode();
|
|
10039
10091
|
const inputs = useMemo(() => sections?.flatMap((_) => _?.inputs ?? []), [sections]);
|
|
10040
10092
|
const formValidator = useCallback((formState) => getRetailFormValidator({
|
|
10041
10093
|
formState,
|
|
@@ -11462,7 +11514,7 @@
|
|
|
11462
11514
|
const Tag = tag;
|
|
11463
11515
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
11464
11516
|
const { text, description, icon, count, tabName, ...link } = item;
|
|
11465
|
-
return (jsx(Tag, { className: style('h-12', 'block flex-1', 'cursor-pointer', tabPaddingStyleMap[type], isActive ? activeTabBgStyleMap[type] : tabBgStyleMap[type]), "aria-label": "\u0421\u043F\u0438\u0441\u043E\u043A \u0442\u0430\u0431\u043E\u0432", onClick: onClick, ...link, children: jsxs("div", { className: style('h-full', 'flex justify-center items-center', 'text-center whitespace-nowrap', isActive ? activeTabTextStyleMap[type] : tabTextStyle), role: "tab", "aria-label": `Таб ${text}`, children: [renderTabItemInner({
|
|
11517
|
+
return (jsx(Tag, { className: style('h-12', 'block flex-1', 'cursor-pointer', 'rounded-none', tabPaddingStyleMap[type], isActive ? activeTabBgStyleMap[type] : tabBgStyleMap[type]), "aria-label": "\u0421\u043F\u0438\u0441\u043E\u043A \u0442\u0430\u0431\u043E\u0432", onClick: onClick, ...link, children: jsxs("div", { className: style('h-full', 'flex justify-center items-center', 'text-center whitespace-nowrap', isActive ? activeTabTextStyleMap[type] : tabTextStyle), role: "tab", "aria-label": `Таб ${text}`, children: [renderTabItemInner({
|
|
11466
11518
|
text,
|
|
11467
11519
|
description,
|
|
11468
11520
|
icon,
|
|
@@ -11851,6 +11903,7 @@
|
|
|
11851
11903
|
const ContentPage = JSX(({ className, data = EMPTY_DATA, blocksRegistry, blockDecorator }) => {
|
|
11852
11904
|
const { slots, blocks, fallback, ...pageContent } = data;
|
|
11853
11905
|
const resolvedPageContent = useJSONRef(pageContent, fallback);
|
|
11906
|
+
const isFrame = isIFrame();
|
|
11854
11907
|
useClickHandler();
|
|
11855
11908
|
useDefaultLocation();
|
|
11856
11909
|
const options = {
|
|
@@ -11860,11 +11913,12 @@
|
|
|
11860
11913
|
blockDecorator,
|
|
11861
11914
|
parent: data,
|
|
11862
11915
|
};
|
|
11863
|
-
return (jsxs("div", { "data-theme": data.colorPalette || 'pc', children: [jsxs("section", { className: style('@container relative', data.style, className), children: [slots?.[HEADER_SLOT]?.length ? (jsx("div", { className: "relative z-10 mb-lg shadow-[0_8px_32px_0px_#00000014]", children: renderBlocksList(slots?.[HEADER_SLOT], { ...options, slotName: HEADER_SLOT }) })) : null, jsxs("div", { className: "container space-y-px @5xl:space-y-0 @5xl:grid @5xl:grid-cols-12 @5xl:gap-2xs", children: [renderChildren({
|
|
11916
|
+
return (jsxs("div", { "data-theme": data.colorPalette || 'pc', children: [jsxs("section", { className: style('@container relative', data.style, className), children: [!isFrame && slots?.[HEADER_SLOT]?.length ? (jsx("div", { className: "relative z-10 mb-lg shadow-[0_8px_32px_0px_#00000014]", children: renderBlocksList(slots?.[HEADER_SLOT], { ...options, slotName: HEADER_SLOT }) })) : null, jsxs("div", { className: "container space-y-px @5xl:space-y-0 @5xl:grid @5xl:grid-cols-12 @5xl:gap-2xs", children: [renderChildren({
|
|
11864
11917
|
block: data,
|
|
11865
11918
|
options,
|
|
11866
11919
|
extraProps: { className: 'scroll-mt-12' },
|
|
11867
|
-
}),
|
|
11920
|
+
}), !isFrame &&
|
|
11921
|
+
renderBlocksList(slots?.[FOOTER_SLOT], { ...options, slotName: FOOTER_SLOT })] })] }), !isFrame && slots?.[STICKY_FOOTER_SLOT]?.length ? (jsx("div", { className: "fixed w-full bottom-0 left-0 z-[100]", children: renderBlocksList(slots?.[STICKY_FOOTER_SLOT], {
|
|
11868
11922
|
...options,
|
|
11869
11923
|
slotName: STICKY_FOOTER_SLOT,
|
|
11870
11924
|
}) })) : null, jsx(DialogManager, {}), jsx(PopupManager, {}), jsx(CookiePopup, { __html: resolvedPageContent?.cookieContent?.__html })] }));
|
|
@@ -11874,7 +11928,7 @@
|
|
|
11874
11928
|
slots: () => [HEADER_SLOT, FOOTER_SLOT, STICKY_FOOTER_SLOT],
|
|
11875
11929
|
});
|
|
11876
11930
|
|
|
11877
|
-
const packageVersion = "0.14.
|
|
11931
|
+
const packageVersion = "0.14.918";
|
|
11878
11932
|
|
|
11879
11933
|
exports.Blocks = Blocks;
|
|
11880
11934
|
exports.ContentPage = ContentPage;
|