@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.
Files changed (122) hide show
  1. package/bundle/bundle.umd.js +268 -214
  2. package/bundle/bundle.umd.min.js +1 -1
  3. package/bundle/retail/hooks/useIFrameMode.d.ts +4 -0
  4. package/bundle/utils/isIFrame.d.ts +1 -0
  5. package/dist/components/ApplicationLeadForm/ApplicationLeadForm.js +2 -0
  6. package/dist/components/ApplicationLeadForm/ApplicationLeadForm.js.map +1 -1
  7. package/dist/components/ApplicationLeadForm/EsiaLoginBanner.js +8 -3
  8. package/dist/components/ApplicationLeadForm/EsiaLoginBanner.js.map +1 -1
  9. package/dist/components/ContentPage/ContentPage.js +5 -2
  10. package/dist/components/ContentPage/ContentPage.js.map +1 -1
  11. package/dist/components/CreditCardForm/CreditCardFormStep.js +2 -0
  12. package/dist/components/CreditCardForm/CreditCardFormStep.js.map +1 -1
  13. package/dist/components/CreditForm/CreditFormStep.js +2 -0
  14. package/dist/components/CreditForm/CreditFormStep.js.map +1 -1
  15. package/dist/components/DebitForm/DebitFormStep.js +2 -0
  16. package/dist/components/DebitForm/DebitFormStep.js.map +1 -1
  17. package/dist/retail/hooks/useIFrameMode.d.ts +4 -0
  18. package/dist/retail/hooks/useIFrameMode.js +39 -0
  19. package/dist/retail/hooks/useIFrameMode.js.map +1 -0
  20. package/dist/ui-kit/DatePicker/DatePickerInput.js +1 -1
  21. package/dist/ui-kit/DatePicker/DatePickerInput.js.map +1 -1
  22. package/dist/ui-kit/TabsControl/TabItemInner.js +1 -1
  23. package/dist/ui-kit/TabsControl/TabItemInner.js.map +1 -1
  24. package/dist/utils/isIFrame.d.ts +1 -0
  25. package/dist/utils/isIFrame.js +5 -0
  26. package/dist/utils/isIFrame.js.map +1 -0
  27. package/lib/common.css +1 -1
  28. package/lib/components/ApplicationLeadForm/ApplicationLeadForm.js +2 -0
  29. package/lib/components/ApplicationLeadForm/ApplicationLeadForm.js.map +1 -1
  30. package/lib/components/ApplicationLeadForm/EsiaLoginBanner.js +8 -3
  31. package/lib/components/ApplicationLeadForm/EsiaLoginBanner.js.map +1 -1
  32. package/lib/components/ContentPage/ContentPage.js +5 -2
  33. package/lib/components/ContentPage/ContentPage.js.map +1 -1
  34. package/lib/components/CreditCardForm/CreditCardFormStep.js +2 -0
  35. package/lib/components/CreditCardForm/CreditCardFormStep.js.map +1 -1
  36. package/lib/components/CreditForm/CreditFormStep.js +2 -0
  37. package/lib/components/CreditForm/CreditFormStep.js.map +1 -1
  38. package/lib/components/DebitForm/DebitFormStep.js +2 -0
  39. package/lib/components/DebitForm/DebitFormStep.js.map +1 -1
  40. package/lib/retail/hooks/useIFrameMode.d.ts +4 -0
  41. package/lib/retail/hooks/useIFrameMode.js +36 -0
  42. package/lib/retail/hooks/useIFrameMode.js.map +1 -0
  43. package/lib/ui-kit/DatePicker/DatePickerInput.js +1 -1
  44. package/lib/ui-kit/DatePicker/DatePickerInput.js.map +1 -1
  45. package/lib/ui-kit/TabsControl/TabItemInner.js +1 -1
  46. package/lib/ui-kit/TabsControl/TabItemInner.js.map +1 -1
  47. package/lib/utils/isIFrame.d.ts +1 -0
  48. package/lib/utils/isIFrame.js +2 -0
  49. package/lib/utils/isIFrame.js.map +1 -0
  50. package/mobile/bundle/bundle.umd.js +268 -214
  51. package/mobile/bundle/bundle.umd.min.js +1 -1
  52. package/mobile/bundle/retail/hooks/useIFrameMode.d.ts +4 -0
  53. package/mobile/bundle/utils/isIFrame.d.ts +1 -0
  54. package/mobile/dist/components/ApplicationLeadForm/ApplicationLeadForm.js +2 -0
  55. package/mobile/dist/components/ApplicationLeadForm/ApplicationLeadForm.js.map +1 -1
  56. package/mobile/dist/components/ApplicationLeadForm/EsiaLoginBanner.js +8 -3
  57. package/mobile/dist/components/ApplicationLeadForm/EsiaLoginBanner.js.map +1 -1
  58. package/mobile/dist/components/ContentPage/ContentPage.js +5 -2
  59. package/mobile/dist/components/ContentPage/ContentPage.js.map +1 -1
  60. package/mobile/dist/components/CreditCardForm/CreditCardFormStep.js +2 -0
  61. package/mobile/dist/components/CreditCardForm/CreditCardFormStep.js.map +1 -1
  62. package/mobile/dist/components/CreditForm/CreditFormStep.js +2 -0
  63. package/mobile/dist/components/CreditForm/CreditFormStep.js.map +1 -1
  64. package/mobile/dist/components/DebitForm/DebitFormStep.js +2 -0
  65. package/mobile/dist/components/DebitForm/DebitFormStep.js.map +1 -1
  66. package/mobile/dist/retail/hooks/useIFrameMode.d.ts +4 -0
  67. package/mobile/dist/retail/hooks/useIFrameMode.js +39 -0
  68. package/mobile/dist/retail/hooks/useIFrameMode.js.map +1 -0
  69. package/mobile/dist/ui-kit/DatePicker/DatePickerInput.js +1 -1
  70. package/mobile/dist/ui-kit/DatePicker/DatePickerInput.js.map +1 -1
  71. package/mobile/dist/ui-kit/TabsControl/TabItemInner.js +1 -1
  72. package/mobile/dist/ui-kit/TabsControl/TabItemInner.js.map +1 -1
  73. package/mobile/dist/utils/isIFrame.d.ts +1 -0
  74. package/mobile/dist/utils/isIFrame.js +5 -0
  75. package/mobile/dist/utils/isIFrame.js.map +1 -0
  76. package/mobile/lib/common.css +1 -1
  77. package/mobile/lib/components/ApplicationLeadForm/ApplicationLeadForm.js +2 -0
  78. package/mobile/lib/components/ApplicationLeadForm/ApplicationLeadForm.js.map +1 -1
  79. package/mobile/lib/components/ApplicationLeadForm/EsiaLoginBanner.js +8 -3
  80. package/mobile/lib/components/ApplicationLeadForm/EsiaLoginBanner.js.map +1 -1
  81. package/mobile/lib/components/ContentPage/ContentPage.js +5 -2
  82. package/mobile/lib/components/ContentPage/ContentPage.js.map +1 -1
  83. package/mobile/lib/components/CreditCardForm/CreditCardFormStep.js +2 -0
  84. package/mobile/lib/components/CreditCardForm/CreditCardFormStep.js.map +1 -1
  85. package/mobile/lib/components/CreditForm/CreditFormStep.js +2 -0
  86. package/mobile/lib/components/CreditForm/CreditFormStep.js.map +1 -1
  87. package/mobile/lib/components/DebitForm/DebitFormStep.js +2 -0
  88. package/mobile/lib/components/DebitForm/DebitFormStep.js.map +1 -1
  89. package/mobile/lib/retail/hooks/useIFrameMode.d.ts +4 -0
  90. package/mobile/lib/retail/hooks/useIFrameMode.js +36 -0
  91. package/mobile/lib/retail/hooks/useIFrameMode.js.map +1 -0
  92. package/mobile/lib/ui-kit/DatePicker/DatePickerInput.js +1 -1
  93. package/mobile/lib/ui-kit/DatePicker/DatePickerInput.js.map +1 -1
  94. package/mobile/lib/ui-kit/TabsControl/TabItemInner.js +1 -1
  95. package/mobile/lib/ui-kit/TabsControl/TabItemInner.js.map +1 -1
  96. package/mobile/lib/utils/isIFrame.d.ts +1 -0
  97. package/mobile/lib/utils/isIFrame.js +2 -0
  98. package/mobile/lib/utils/isIFrame.js.map +1 -0
  99. package/mobile/src/common.css +3 -0
  100. package/mobile/src/components/ApplicationLeadForm/ApplicationLeadForm.tsx +2 -1
  101. package/mobile/src/components/ApplicationLeadForm/EsiaLoginBanner.tsx +9 -4
  102. package/mobile/src/components/ContentPage/ContentPage.tsx +6 -4
  103. package/mobile/src/components/CreditCardForm/CreditCardFormStep.tsx +2 -0
  104. package/mobile/src/components/CreditForm/CreditFormStep.tsx +2 -0
  105. package/mobile/src/components/DebitForm/DebitFormStep.tsx +2 -0
  106. package/mobile/src/retail/hooks/useIFrameMode.ts +45 -0
  107. package/mobile/src/ui-kit/DatePicker/DatePickerInput.tsx +1 -1
  108. package/mobile/src/ui-kit/TabsControl/TabItemInner.tsx +1 -0
  109. package/mobile/src/utils/isIFrame.ts +1 -0
  110. package/package.json +1 -1
  111. package/src/common.css +3 -0
  112. package/src/components/ApplicationLeadForm/ApplicationLeadForm.tsx +2 -1
  113. package/src/components/ApplicationLeadForm/EsiaLoginBanner.tsx +9 -4
  114. package/src/components/ContentPage/ContentPage.tsx +6 -4
  115. package/src/components/CreditCardForm/CreditCardFormStep.tsx +2 -0
  116. package/src/components/CreditForm/CreditFormStep.tsx +2 -0
  117. package/src/components/DebitForm/DebitFormStep.tsx +2 -0
  118. package/src/retail/hooks/useIFrameMode.ts +45 -0
  119. package/src/ui-kit/DatePicker/DatePickerInput.tsx +1 -1
  120. package/src/ui-kit/TabsControl/TabItemInner.tsx +1 -0
  121. package/src/utils/isIFrame.ts +1 -0
  122. package/tailwind.config.cjs +3 -0
@@ -1882,7 +1882,7 @@
1882
1882
  useEffect(() => {
1883
1883
  updateSelectedDate({ inputValue, setSelectedMonth, setSelectedYear, onChange });
1884
1884
  }, [inputValue]);
1885
- 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 })] }));
1885
+ 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 })] }));
1886
1886
  });
1887
1887
  const isValidYear = (year) => Number(year) >= START_YEAR && Number(year) <= new Date().getFullYear();
1888
1888
  const isValidMonth = (month) => Number(month) > 0 && Number(month) < 13;
@@ -2978,6 +2978,256 @@
2978
2978
  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" }))] })] }) }));
2979
2979
  });
2980
2980
 
2981
+ function copy(source, target) {
2982
+ for (const [k, v] of source.entries()) {
2983
+ if (v !== null && v !== undefined) {
2984
+ target.setItem(k, v);
2985
+ }
2986
+ else {
2987
+ target.removeItem(k);
2988
+ }
2989
+ }
2990
+ }
2991
+
2992
+ function replicate(primary, secondary) {
2993
+ copy(primary, secondary);
2994
+ copy(secondary, primary);
2995
+ return primary.bus.watch(({ type, event }) => {
2996
+ if (event !== null && event !== undefined) {
2997
+ secondary.setItem(type, event);
2998
+ }
2999
+ else {
3000
+ secondary.removeItem(type);
3001
+ }
3002
+ });
3003
+ }
3004
+
3005
+ class StorageAdapter {
3006
+ storage;
3007
+ bus;
3008
+ get size() {
3009
+ return this.storage?.length ?? 0;
3010
+ }
3011
+ constructor(storage, bus = new EventBus()) {
3012
+ this.storage = storage;
3013
+ this.bus = bus;
3014
+ }
3015
+ hasItem(key) {
3016
+ return Boolean(this.storage?.getItem(String(key)));
3017
+ }
3018
+ getItem(key) {
3019
+ const _ = this.storage?.getItem(String(key)) ?? null;
3020
+ try {
3021
+ return JSON.parse(String(_));
3022
+ }
3023
+ catch (ex) {
3024
+ return null;
3025
+ }
3026
+ }
3027
+ entries() {
3028
+ return Array.from({ length: this.size }, (_, i) => {
3029
+ const k = String(this.storage?.key(i));
3030
+ return [k, this.getItem(k)];
3031
+ });
3032
+ }
3033
+ setItem(key, value) {
3034
+ if (value !== null) {
3035
+ this.storage?.setItem(String(key), JSON.stringify(value));
3036
+ }
3037
+ else {
3038
+ this.storage?.removeItem(String(key));
3039
+ }
3040
+ this.bus?.subject(key, value);
3041
+ }
3042
+ removeItem(key) {
3043
+ this.storage?.removeItem(String(key));
3044
+ this.bus?.subject(key, null);
3045
+ }
3046
+ }
3047
+
3048
+ class Store {
3049
+ bus;
3050
+ store = new Map();
3051
+ get size() {
3052
+ return this.store.size;
3053
+ }
3054
+ constructor(bus = new EventBus()) {
3055
+ this.bus = bus;
3056
+ }
3057
+ hasItem(key) {
3058
+ return this.store.has(key);
3059
+ }
3060
+ getItem(key) {
3061
+ return this.store.get(key);
3062
+ }
3063
+ entries() {
3064
+ return this.store.entries();
3065
+ }
3066
+ setItem(key, value) {
3067
+ this.store.set(key, value);
3068
+ this.bus.subject(key, value);
3069
+ }
3070
+ removeItem(key) {
3071
+ this.store.delete(key);
3072
+ this.bus.subject(key, null);
3073
+ }
3074
+ }
3075
+
3076
+ function useRerender() {
3077
+ const [, setCount] = useState(0);
3078
+ return useCallback(() => setCount(_ => (_ + 1) % (1 << 16)), []);
3079
+ }
3080
+
3081
+ const DEFAULT_METHODS = {};
3082
+ /**
3083
+ * MobX like reactivity (simplified).
3084
+ * Can be used to migrate from Redux/MobX or something else
3085
+ *
3086
+ * @param store
3087
+ * @returns reactive proxy backed by store
3088
+ */
3089
+ function useStore(store, methods = DEFAULT_METHODS) {
3090
+ const deps = useRef(null);
3091
+ const render = useRerender();
3092
+ useEffect(() => store.bus.watch(ev => {
3093
+ if (deps.current?.has(String(ev.type))) {
3094
+ render();
3095
+ }
3096
+ }), [store, render]);
3097
+ return useMemo(() => new Proxy(methods, {
3098
+ get(_, key) {
3099
+ deps.current ||= new Set();
3100
+ deps.current.add(key);
3101
+ return store.getItem(key);
3102
+ },
3103
+ has(_, key) {
3104
+ deps.current ||= new Set();
3105
+ deps.current.add(key);
3106
+ return store.hasItem(key);
3107
+ },
3108
+ set(_, key, value) {
3109
+ store.setItem(key, value);
3110
+ return true;
3111
+ },
3112
+ deleteProperty(_, key) {
3113
+ store.removeItem(key);
3114
+ return true;
3115
+ }
3116
+ }), [store]);
3117
+ }
3118
+
3119
+ const sessionStore = new Store(); // sessionStorage cache
3120
+ replicate(sessionStore, new StorageAdapter(globalThis?.sessionStorage));
3121
+ function useSessionStore() {
3122
+ return useStore(sessionStore);
3123
+ }
3124
+
3125
+ const getNS = (_) => globalThis[_];
3126
+ const initializeExternalNS = (namespaceName, url, isModule = false) => {
3127
+ const script = globalThis.document.getElementById(url);
3128
+ if (script) {
3129
+ const ns = getNS(namespaceName);
3130
+ if (ns) {
3131
+ return Promise.resolve(ns);
3132
+ }
3133
+ else {
3134
+ return new Promise((resolve) => {
3135
+ script.addEventListener('load', () => {
3136
+ resolve(getNS(namespaceName));
3137
+ });
3138
+ });
3139
+ }
3140
+ }
3141
+ else {
3142
+ return new Promise((resolve, reject) => {
3143
+ const newScript = globalThis.document.createElement('script');
3144
+ newScript.src = url;
3145
+ newScript.async = true;
3146
+ newScript.id = url;
3147
+ if (isModule) {
3148
+ newScript.type = 'module';
3149
+ }
3150
+ newScript.addEventListener('load', () => {
3151
+ resolve(getNS(namespaceName));
3152
+ });
3153
+ newScript.addEventListener('error', (error) => {
3154
+ reject(error);
3155
+ });
3156
+ globalThis.document.head.appendChild(newScript);
3157
+ });
3158
+ }
3159
+ };
3160
+ const initializeExternalStylesheet = (url = '') => {
3161
+ const link = globalThis.document.getElementById(url);
3162
+ if (!link) {
3163
+ const newLink = globalThis.document.createElement('link');
3164
+ newLink.href = url;
3165
+ newLink.id = url;
3166
+ newLink.rel = 'stylesheet';
3167
+ globalThis.document.head.appendChild(newLink);
3168
+ }
3169
+ };
3170
+ function useExternalNS(namespaceName, url, unmountNS = true) {
3171
+ const [externalNS, setExternalNS] = useState(undefined);
3172
+ useEffect(() => {
3173
+ let isMounted = true;
3174
+ initializeExternalNS(namespaceName, url)
3175
+ .then((ns) => {
3176
+ if (isMounted) {
3177
+ setExternalNS(ns);
3178
+ }
3179
+ })
3180
+ .catch((error) => {
3181
+ console.error(`Failed to initialize external namespace: ${error}`);
3182
+ });
3183
+ return () => {
3184
+ isMounted = false;
3185
+ if (unmountNS) {
3186
+ const script = globalThis.document.getElementById(url);
3187
+ if (script) {
3188
+ globalThis.document.head.removeChild(script);
3189
+ }
3190
+ setExternalNS(undefined);
3191
+ }
3192
+ };
3193
+ }, [namespaceName, url, unmountNS]);
3194
+ return externalNS;
3195
+ }
3196
+
3197
+ const isIFrame = () => globalThis.location !== globalThis?.top?.location;
3198
+
3199
+ const useIFrameMode = () => {
3200
+ const isFrame = isIFrame();
3201
+ const height = globalThis.document?.body?.scrollHeight;
3202
+ const sessionStore = useSessionStore();
3203
+ const params = new URLSearchParams(decodeURIComponent(globalThis.location?.search));
3204
+ const styles = params.get('styles');
3205
+ if (styles) {
3206
+ initializeExternalStylesheet(styles);
3207
+ }
3208
+ useEffect(() => {
3209
+ if (isFrame) {
3210
+ globalThis.parent.postMessage({ height: document.body.scrollHeight }, '*');
3211
+ }
3212
+ }, [height, isFrame]);
3213
+ useEffect(() => {
3214
+ const handlePostMessage = (event) => {
3215
+ if (!event.data?.location) {
3216
+ return;
3217
+ }
3218
+ sessionStore.frameLocation = event.data?.location;
3219
+ };
3220
+ if (isFrame) {
3221
+ globalThis.addEventListener('message', handlePostMessage);
3222
+ }
3223
+ return () => {
3224
+ if (isFrame) {
3225
+ globalThis.removeEventListener('message', handlePostMessage);
3226
+ }
3227
+ };
3228
+ }, [isFrame]);
3229
+ };
3230
+
2981
3231
  const ERROR_MESSAGE = 'Некорректно заполненное поле';
2982
3232
  const ADDRESS_ERROR_MESSAGE = 'Укажите регион, город/населенный пункт, улицу, дом';
2983
3233
  const retailCyrillicPattern = /^[\u0400-\u04FF-\s]+$/u;
@@ -3277,19 +3527,23 @@
3277
3527
 
3278
3528
  const EsiaLoginBanner = JSX(({ onChangeEsiaStatus, productType }) => {
3279
3529
  const navigator = locationNavigator();
3530
+ const sessionStore = useSessionStore();
3531
+ const frameLocation = sessionStore.frameLocation;
3280
3532
  const handleAuth = useCallback(async () => {
3281
3533
  try {
3282
3534
  const resp = await getLink({
3283
- redirectUri: globalThis.location.origin + globalThis.location.pathname,
3535
+ redirectUri: frameLocation || globalThis.location.origin + globalThis.location.pathname,
3284
3536
  });
3285
3537
  if (resp?.link) {
3286
- navigator.assign(resp.link);
3538
+ frameLocation
3539
+ ? window.parent.postMessage({ redirectUri: resp?.link }, '*')
3540
+ : navigator.assign(resp.link);
3287
3541
  }
3288
3542
  }
3289
3543
  catch {
3290
3544
  onChangeEsiaStatus(EsiaStatuses.Error);
3291
3545
  }
3292
- }, []);
3546
+ }, [frameLocation]);
3293
3547
  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" })] }));
3294
3548
  });
3295
3549
 
@@ -4055,68 +4309,6 @@
4055
4309
  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" }) }));
4056
4310
  };
4057
4311
 
4058
- const getNS = (_) => globalThis[_];
4059
- const initializeExternalNS = (namespaceName, url, isModule = false) => {
4060
- const script = globalThis.document.getElementById(url);
4061
- if (script) {
4062
- const ns = getNS(namespaceName);
4063
- if (ns) {
4064
- return Promise.resolve(ns);
4065
- }
4066
- else {
4067
- return new Promise((resolve) => {
4068
- script.addEventListener('load', () => {
4069
- resolve(getNS(namespaceName));
4070
- });
4071
- });
4072
- }
4073
- }
4074
- else {
4075
- return new Promise((resolve, reject) => {
4076
- const newScript = globalThis.document.createElement('script');
4077
- newScript.src = url;
4078
- newScript.async = true;
4079
- newScript.id = url;
4080
- if (isModule) {
4081
- newScript.type = 'module';
4082
- }
4083
- newScript.addEventListener('load', () => {
4084
- resolve(getNS(namespaceName));
4085
- });
4086
- newScript.addEventListener('error', (error) => {
4087
- reject(error);
4088
- });
4089
- globalThis.document.head.appendChild(newScript);
4090
- });
4091
- }
4092
- };
4093
- function useExternalNS(namespaceName, url, unmountNS = true) {
4094
- const [externalNS, setExternalNS] = useState(undefined);
4095
- useEffect(() => {
4096
- let isMounted = true;
4097
- initializeExternalNS(namespaceName, url)
4098
- .then((ns) => {
4099
- if (isMounted) {
4100
- setExternalNS(ns);
4101
- }
4102
- })
4103
- .catch((error) => {
4104
- console.error(`Failed to initialize external namespace: ${error}`);
4105
- });
4106
- return () => {
4107
- isMounted = false;
4108
- if (unmountNS) {
4109
- const script = globalThis.document.getElementById(url);
4110
- if (script) {
4111
- globalThis.document.head.removeChild(script);
4112
- }
4113
- setExternalNS(undefined);
4114
- }
4115
- };
4116
- }, [namespaceName, url, unmountNS]);
4117
- return externalNS;
4118
- }
4119
-
4120
4312
  const YMAPS_NAMESPACE = 'ymaps';
4121
4313
  const useYandexMaps = () => {
4122
4314
  const url = `https://api-maps.yandex.ru/2.1/?apikey=${projectSettings.YANDEX_MAP_API_KEY || ''}&lang=ru_RU`;
@@ -4248,144 +4440,6 @@
4248
4440
  })), ...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 }) }) })] }));
4249
4441
  });
4250
4442
 
4251
- function copy(source, target) {
4252
- for (const [k, v] of source.entries()) {
4253
- if (v !== null && v !== undefined) {
4254
- target.setItem(k, v);
4255
- }
4256
- else {
4257
- target.removeItem(k);
4258
- }
4259
- }
4260
- }
4261
-
4262
- function replicate(primary, secondary) {
4263
- copy(primary, secondary);
4264
- copy(secondary, primary);
4265
- return primary.bus.watch(({ type, event }) => {
4266
- if (event !== null && event !== undefined) {
4267
- secondary.setItem(type, event);
4268
- }
4269
- else {
4270
- secondary.removeItem(type);
4271
- }
4272
- });
4273
- }
4274
-
4275
- class StorageAdapter {
4276
- storage;
4277
- bus;
4278
- get size() {
4279
- return this.storage?.length ?? 0;
4280
- }
4281
- constructor(storage, bus = new EventBus()) {
4282
- this.storage = storage;
4283
- this.bus = bus;
4284
- }
4285
- hasItem(key) {
4286
- return Boolean(this.storage?.getItem(String(key)));
4287
- }
4288
- getItem(key) {
4289
- const _ = this.storage?.getItem(String(key)) ?? null;
4290
- try {
4291
- return JSON.parse(String(_));
4292
- }
4293
- catch (ex) {
4294
- return null;
4295
- }
4296
- }
4297
- entries() {
4298
- return Array.from({ length: this.size }, (_, i) => {
4299
- const k = String(this.storage?.key(i));
4300
- return [k, this.getItem(k)];
4301
- });
4302
- }
4303
- setItem(key, value) {
4304
- if (value !== null) {
4305
- this.storage?.setItem(String(key), JSON.stringify(value));
4306
- }
4307
- else {
4308
- this.storage?.removeItem(String(key));
4309
- }
4310
- this.bus?.subject(key, value);
4311
- }
4312
- removeItem(key) {
4313
- this.storage?.removeItem(String(key));
4314
- this.bus?.subject(key, null);
4315
- }
4316
- }
4317
-
4318
- class Store {
4319
- bus;
4320
- store = new Map();
4321
- get size() {
4322
- return this.store.size;
4323
- }
4324
- constructor(bus = new EventBus()) {
4325
- this.bus = bus;
4326
- }
4327
- hasItem(key) {
4328
- return this.store.has(key);
4329
- }
4330
- getItem(key) {
4331
- return this.store.get(key);
4332
- }
4333
- entries() {
4334
- return this.store.entries();
4335
- }
4336
- setItem(key, value) {
4337
- this.store.set(key, value);
4338
- this.bus.subject(key, value);
4339
- }
4340
- removeItem(key) {
4341
- this.store.delete(key);
4342
- this.bus.subject(key, null);
4343
- }
4344
- }
4345
-
4346
- function useRerender() {
4347
- const [, setCount] = useState(0);
4348
- return useCallback(() => setCount(_ => (_ + 1) % (1 << 16)), []);
4349
- }
4350
-
4351
- const DEFAULT_METHODS = {};
4352
- /**
4353
- * MobX like reactivity (simplified).
4354
- * Can be used to migrate from Redux/MobX or something else
4355
- *
4356
- * @param store
4357
- * @returns reactive proxy backed by store
4358
- */
4359
- function useStore(store, methods = DEFAULT_METHODS) {
4360
- const deps = useRef(null);
4361
- const render = useRerender();
4362
- useEffect(() => store.bus.watch(ev => {
4363
- if (deps.current?.has(String(ev.type))) {
4364
- render();
4365
- }
4366
- }), [store, render]);
4367
- return useMemo(() => new Proxy(methods, {
4368
- get(_, key) {
4369
- deps.current ||= new Set();
4370
- deps.current.add(key);
4371
- return store.getItem(key);
4372
- },
4373
- has(_, key) {
4374
- deps.current ||= new Set();
4375
- deps.current.add(key);
4376
- return store.hasItem(key);
4377
- },
4378
- set(_, key, value) {
4379
- store.setItem(key, value);
4380
- return true;
4381
- },
4382
- deleteProperty(_, key) {
4383
- store.removeItem(key);
4384
- return true;
4385
- }
4386
- }), [store]);
4387
- }
4388
-
4389
4443
  const localStore = new Store(); // localStorage cache
4390
4444
  replicate(localStore, new StorageAdapter(globalThis?.localStorage));
4391
4445
  function useLocalStore(methods) {
@@ -5640,12 +5694,6 @@
5640
5694
 
5641
5695
  const renderSubmitButton = (button, isSending = false) => (jsx(SubmitButton$1, { className: "w-full @xl:w-auto", isLoading: isSending, children: button?.text ? button.text : 'Отправить заявку' }));
5642
5696
 
5643
- const sessionStore = new Store(); // sessionStorage cache
5644
- replicate(sessionStore, new StorageAdapter(globalThis?.sessionStorage));
5645
- function useSessionStore() {
5646
- return useStore(sessionStore);
5647
- }
5648
-
5649
5697
  const createDraftTask = async (body) => {
5650
5698
  const res = await fetchRetailJSON('/user-data/createDraftTask', 'POST', body);
5651
5699
  return res || {};
@@ -6881,6 +6929,7 @@
6881
6929
  const applicationFormData = useMemo(() => getApplicationFormData(productType), [productType]);
6882
6930
  const inputs = useMemo(() => getInputs(applicationFormData), [applicationFormData]);
6883
6931
  const noConsentDialog = useDialog(NoConsentDialog);
6932
+ useIFrameMode();
6884
6933
  const extendedValidatorObj = useMemo(() => getExtendedValidatorObj(productType), [productType]);
6885
6934
  const formValidator = useMemo(() => getFormValidator(inputs, extendedValidatorObj), [inputs, extendedValidatorObj]);
6886
6935
  const initialFormState = useInitApplicationLead({
@@ -8828,6 +8877,7 @@
8828
8877
 
8829
8878
  const PRODUCT_TYPE$2 = 'creditCard';
8830
8879
  const CreditCardFormStep = JSX(({ step, sections, onPrevStep, onNextStep, onFinish }) => {
8880
+ useIFrameMode();
8831
8881
  const inputs = useMemo(() => sections?.flatMap((_) => _?.inputs || []), [sections]);
8832
8882
  const formValidator = useCallback((formState) => getRetailFormValidator({
8833
8883
  formState,
@@ -9541,6 +9591,7 @@
9541
9591
  const PRODUCT_TYPE$1 = 'credit';
9542
9592
  const CreditFormStep = JSX(({ step, sections, programsSource, onPrevStep, onNextStep, onFinish }) => {
9543
9593
  const { programId } = useRetailFormStore();
9594
+ useIFrameMode();
9544
9595
  const calcData = programsSource?.[programId ?? '']; // Need normalizator useForm, to be save defaultParams
9545
9596
  const inputs = useMemo(() => sections?.flatMap((_) => _?.inputs ?? []), [sections]);
9546
9597
  const formValidator = useCallback((formState) => getRetailFormValidator({
@@ -10044,6 +10095,7 @@
10044
10095
 
10045
10096
  const PRODUCT_TYPE = 'debitCard';
10046
10097
  const DebitFormStep = JSX(({ step, sections, onPrevStep, onNextStep, onFinish }) => {
10098
+ useIFrameMode();
10047
10099
  const inputs = useMemo(() => sections?.flatMap((_) => _?.inputs ?? []), [sections]);
10048
10100
  const formValidator = useCallback((formState) => getRetailFormValidator({
10049
10101
  formState,
@@ -11647,7 +11699,7 @@
11647
11699
  const Tag = tag;
11648
11700
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
11649
11701
  const { text, description, icon, count, tabName, ...link } = item;
11650
- 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({
11702
+ 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({
11651
11703
  text,
11652
11704
  description,
11653
11705
  icon,
@@ -12120,6 +12172,7 @@
12120
12172
  const ContentPage = JSX(({ className, data = EMPTY_DATA, blocksRegistry, blockDecorator }) => {
12121
12173
  const { slots, blocks, fallback, ...pageContent } = data;
12122
12174
  const resolvedPageContent = useJSONRef(pageContent, fallback);
12175
+ const isFrame = isIFrame();
12123
12176
  useClickHandler();
12124
12177
  useDefaultLocation();
12125
12178
  const options = {
@@ -12129,11 +12182,12 @@
12129
12182
  blockDecorator,
12130
12183
  parent: data,
12131
12184
  };
12132
- 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({
12185
+ 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({
12133
12186
  block: data,
12134
12187
  options,
12135
12188
  extraProps: { className: 'scroll-mt-12' },
12136
- }), renderBlocksList(slots?.[FOOTER_SLOT], { ...options, slotName: FOOTER_SLOT })] })] }), slots?.[STICKY_FOOTER_SLOT]?.length ? (jsx("div", { className: "fixed w-full bottom-0 left-0 z-[100]", children: renderBlocksList(slots?.[STICKY_FOOTER_SLOT], {
12189
+ }), !isFrame &&
12190
+ 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], {
12137
12191
  ...options,
12138
12192
  slotName: STICKY_FOOTER_SLOT,
12139
12193
  }) })) : null, jsx(DialogManager, {}), jsx(PopupManager, {}), jsx(CookiePopup, { __html: resolvedPageContent?.cookieContent?.__html })] }));
@@ -12143,7 +12197,7 @@
12143
12197
  slots: () => [HEADER_SLOT, FOOTER_SLOT, STICKY_FOOTER_SLOT],
12144
12198
  });
12145
12199
 
12146
- const packageVersion = "0.14.917";
12200
+ const packageVersion = "0.14.918";
12147
12201
 
12148
12202
  exports.Blocks = Blocks;
12149
12203
  exports.ContentPage = ContentPage;