@redneckz/wildless-cms-uni-blocks 0.14.871 → 0.14.873

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 (61) hide show
  1. package/bundle/bundle.umd.js +34 -5
  2. package/bundle/bundle.umd.min.js +1 -1
  3. package/bundle/retail/components/NoConsentDialog/NoConsentDialog.d.ts +6 -0
  4. package/bundle/ui-kit/Foldable/FoldableSection.d.ts +1 -0
  5. package/dist/components/ApplicationLeadForm/ApplicationLeadForm.js +14 -1
  6. package/dist/components/ApplicationLeadForm/ApplicationLeadForm.js.map +1 -1
  7. package/dist/components/TariffsTable/TariffsTable.js +1 -1
  8. package/dist/components/TariffsTable/TariffsTable.js.map +1 -1
  9. package/dist/retail/components/NoConsentDialog/NoConsentDialog.d.ts +6 -0
  10. package/dist/retail/components/NoConsentDialog/NoConsentDialog.js +27 -0
  11. package/dist/retail/components/NoConsentDialog/NoConsentDialog.js.map +1 -0
  12. package/dist/ui-kit/Foldable/FoldableSection.d.ts +1 -0
  13. package/dist/ui-kit/Foldable/FoldableSection.js +2 -2
  14. package/dist/ui-kit/Foldable/FoldableSection.js.map +1 -1
  15. package/lib/common.css +1 -1
  16. package/lib/components/ApplicationLeadForm/ApplicationLeadForm.js +14 -1
  17. package/lib/components/ApplicationLeadForm/ApplicationLeadForm.js.map +1 -1
  18. package/lib/components/TariffsTable/TariffsTable.js +1 -1
  19. package/lib/components/TariffsTable/TariffsTable.js.map +1 -1
  20. package/lib/retail/components/NoConsentDialog/NoConsentDialog.d.ts +6 -0
  21. package/lib/retail/components/NoConsentDialog/NoConsentDialog.fixture.d.ts +5 -0
  22. package/lib/retail/components/NoConsentDialog/NoConsentDialog.js +25 -0
  23. package/lib/retail/components/NoConsentDialog/NoConsentDialog.js.map +1 -0
  24. package/lib/ui-kit/Foldable/FoldableSection.d.ts +1 -0
  25. package/lib/ui-kit/Foldable/FoldableSection.js +2 -2
  26. package/lib/ui-kit/Foldable/FoldableSection.js.map +1 -1
  27. package/mobile/bundle/bundle.umd.js +34 -5
  28. package/mobile/bundle/bundle.umd.min.js +1 -1
  29. package/mobile/bundle/retail/components/NoConsentDialog/NoConsentDialog.d.ts +6 -0
  30. package/mobile/bundle/ui-kit/Foldable/FoldableSection.d.ts +1 -0
  31. package/mobile/dist/components/ApplicationLeadForm/ApplicationLeadForm.js +14 -1
  32. package/mobile/dist/components/ApplicationLeadForm/ApplicationLeadForm.js.map +1 -1
  33. package/mobile/dist/components/TariffsTable/TariffsTable.js +1 -1
  34. package/mobile/dist/components/TariffsTable/TariffsTable.js.map +1 -1
  35. package/mobile/dist/retail/components/NoConsentDialog/NoConsentDialog.d.ts +6 -0
  36. package/mobile/dist/retail/components/NoConsentDialog/NoConsentDialog.js +27 -0
  37. package/mobile/dist/retail/components/NoConsentDialog/NoConsentDialog.js.map +1 -0
  38. package/mobile/dist/ui-kit/Foldable/FoldableSection.d.ts +1 -0
  39. package/mobile/dist/ui-kit/Foldable/FoldableSection.js +2 -2
  40. package/mobile/dist/ui-kit/Foldable/FoldableSection.js.map +1 -1
  41. package/mobile/lib/common.css +1 -1
  42. package/mobile/lib/components/ApplicationLeadForm/ApplicationLeadForm.js +14 -1
  43. package/mobile/lib/components/ApplicationLeadForm/ApplicationLeadForm.js.map +1 -1
  44. package/mobile/lib/components/TariffsTable/TariffsTable.js +1 -1
  45. package/mobile/lib/components/TariffsTable/TariffsTable.js.map +1 -1
  46. package/mobile/lib/retail/components/NoConsentDialog/NoConsentDialog.d.ts +6 -0
  47. package/mobile/lib/retail/components/NoConsentDialog/NoConsentDialog.js +25 -0
  48. package/mobile/lib/retail/components/NoConsentDialog/NoConsentDialog.js.map +1 -0
  49. package/mobile/lib/ui-kit/Foldable/FoldableSection.d.ts +1 -0
  50. package/mobile/lib/ui-kit/Foldable/FoldableSection.js +2 -2
  51. package/mobile/lib/ui-kit/Foldable/FoldableSection.js.map +1 -1
  52. package/mobile/src/components/ApplicationLeadForm/ApplicationLeadForm.tsx +16 -1
  53. package/mobile/src/components/TariffsTable/TariffsTable.tsx +3 -1
  54. package/mobile/src/retail/components/NoConsentDialog/NoConsentDialog.tsx +55 -0
  55. package/mobile/src/ui-kit/Foldable/FoldableSection.tsx +33 -26
  56. package/package.json +1 -1
  57. package/src/components/ApplicationLeadForm/ApplicationLeadForm.tsx +16 -1
  58. package/src/components/TariffsTable/TariffsTable.tsx +3 -1
  59. package/src/retail/components/NoConsentDialog/NoConsentDialog.fixture.tsx +7 -0
  60. package/src/retail/components/NoConsentDialog/NoConsentDialog.tsx +55 -0
  61. package/src/ui-kit/Foldable/FoldableSection.tsx +33 -26
@@ -2436,6 +2436,23 @@
2436
2436
  return (jsxs(ApplicationFormLayout, { className: style('container space-y-m', className), title: title, ...rest, children: [jsxs("form", { onSubmit: onSubmit, children: [sections.map((_, i) => (jsxs("div", { className: style(inputColumnStyles(_.columns), 'grid gap-x-m'), children: [renderTitle(_.title), (_?.inputs || [])?.map(getField(field, { typeForm }))] }, `section-${i}`))), renderAgreementSubmit(fieldName ? field('consentDataProcessing') : undefined, link, button)] }), isContacts ? renderContacts() : null] }));
2437
2437
  });
2438
2438
 
2439
+ const NoConsentDialog = JSX(({ attempts, onClose = noop }) => {
2440
+ const navigator = locationNavigator();
2441
+ const isMaxAttempts = attempts > 1;
2442
+ const returnToMainPage = useCallback(() => {
2443
+ navigator.assign('/natural');
2444
+ }, []);
2445
+ const handleClose = useCallback(() => {
2446
+ if (isMaxAttempts) {
2447
+ returnToMainPage();
2448
+ }
2449
+ else {
2450
+ onClose();
2451
+ }
2452
+ }, [isMaxAttempts]);
2453
+ return (jsx(Dialog, { className: "my-6xl max-w-3xl w-full min-h-fit mx-auto rounded-lg px-5xl", 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" }))] })] }) }));
2454
+ });
2455
+
2439
2456
  const ERROR_MESSAGE = 'Некорректно заполненное поле';
2440
2457
  const ADDRESS_ERROR_MESSAGE = 'Укажите регион, город/населенный пункт, улицу, дом';
2441
2458
  const retailCyrillicPattern = /^[\u0400-\u04FF-\s]+$/u;
@@ -3135,7 +3152,7 @@
3135
3152
  return ref;
3136
3153
  }
3137
3154
 
3138
- const FoldableSection = JSX(({ className, isUnfolded, children }) => {
3155
+ const FoldableSection = JSX(({ className, isUnfolded, isOverflowVisible = false, children }) => {
3139
3156
  const containerRef = useRef(null);
3140
3157
  const childrenWrapperRef = useResizeObserver((childrenWrapperEl) => {
3141
3158
  if (containerRef.current) {
@@ -3144,7 +3161,7 @@
3144
3161
  : '';
3145
3162
  }
3146
3163
  }, [isUnfolded]);
3147
- return (jsx("div", { ref: containerRef, className: style('transition-max-h duration-300 overflow-hidden', {
3164
+ return (jsx("div", { ref: containerRef, className: style('transition-max-h duration-300', isOverflowVisible && isUnfolded ? 'overflow-clip' : 'overflow-hidden', {
3148
3165
  'max-h-0': Boolean(containerRef.current || !isUnfolded),
3149
3166
  }), role: "tabpanel", "aria-label": "\u0421\u0432\u043E\u0440\u0430\u0447\u0438\u0432\u0430\u044E\u0449\u0430\u044F\u0441\u044F \u0441\u0435\u043A\u0446\u0438\u044F", children: jsx("div", { className: className, ref: childrenWrapperRef, children: children }) }));
3150
3167
  });
@@ -6266,9 +6283,11 @@
6266
6283
 
6267
6284
  const ApplicationLeadForm = JSX(({ className, title, programId = '', nextStepLink = '/credit-lead', button, productType = 'credit', data, ...rest }) => {
6268
6285
  const [esiaStatus, setEsiaStatus] = useState();
6286
+ const [attemptsWithoutConsents, setAttemptsWithoutConsents] = useState(0);
6269
6287
  const leadForm = useRef(null);
6270
6288
  const applicationFormData = useMemo(() => getApplicationFormData(productType), [productType]);
6271
6289
  const inputs = useMemo(() => getInputs(applicationFormData), [applicationFormData]);
6290
+ const noConsentDialog = useDialog(NoConsentDialog);
6272
6291
  const extendedValidatorObj = useMemo(() => getExtendedValidatorObj(productType), [productType]);
6273
6292
  const formValidator = useMemo(() => getFormValidator(inputs, extendedValidatorObj), [inputs, extendedValidatorObj]);
6274
6293
  const initialFormState = useInitApplicationLead({
@@ -6288,6 +6307,16 @@
6288
6307
  formValidator,
6289
6308
  onSubmit: handleSubmit,
6290
6309
  });
6310
+ const onSubmitWithPrecondition = (ev) => {
6311
+ if (!field('processPersonalDataFlg')?.value) {
6312
+ setAttemptsWithoutConsents((prev) => prev + 1);
6313
+ attemptsWithoutConsents > 0 &&
6314
+ noConsentDialog.open({
6315
+ attempts: attemptsWithoutConsents,
6316
+ });
6317
+ }
6318
+ onSubmit?.(ev);
6319
+ };
6291
6320
  const responseTypeDialog = useDialog(ResponseTypeDialog);
6292
6321
  useEffect(() => {
6293
6322
  if (ok !== undefined) {
@@ -6304,7 +6333,7 @@
6304
6333
  reset();
6305
6334
  }
6306
6335
  }, [leadForm?.current, esiaStatus]);
6307
- return (jsxs(ApplicationFormLayout, { className: style('container space-y-m', className), title: title, ...rest, children: [!esiaStatus ? jsx(EsiaLoginBanner, { onChangeEsiaStatus: setEsiaStatus }) : null, jsxs("form", { onSubmit: onSubmit, className: "space-y-m relative", ref: leadForm, children: [esiaStatus === EsiaStatuses.Pending ? jsx(Loader, { blur: false }) : null, applicationFormData.map((_, i) => (jsxs("div", { className: style(inputColumnStyles(_.columns), 'grid gap-x-m'), children: [renderTitle(_.title), renderInputs$1({ field, inputs: _?.inputs }, productType)] }, `section-${i}`))), renderSubmitButton(button, isSending), esiaStatus === EsiaStatuses.Error ? (jsx(Text, { size: "text-m", font: "font-medium", color: "text-error", children: "\u0418\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u044C \u0413\u043E\u0441\u0443\u0441\u043B\u0443\u0433\u0438 \u0434\u043B\u044F \u043E\u0444\u043E\u0440\u043C\u043B\u0435\u043D\u0438\u044F \u0437\u0430\u044F\u0432\u043A\u0438 \u043D\u0435\u0432\u043E\u0437\u043C\u043E\u0436\u043D\u043E, \u043D\u0435\u043E\u0431\u0445\u043E\u0434\u0438\u043C\u043E \u0437\u0430\u043F\u043E\u043B\u043D\u0438\u0442\u044C \u043F\u043E\u043B\u044F \u0432\u0440\u0443\u0447\u043D\u0443\u044E." })) : null] })] }));
6336
+ return (jsxs(ApplicationFormLayout, { className: style('container space-y-m', className), title: title, ...rest, children: [!esiaStatus ? jsx(EsiaLoginBanner, { onChangeEsiaStatus: setEsiaStatus }) : null, jsxs("form", { onSubmit: onSubmitWithPrecondition, className: "space-y-m relative", ref: leadForm, children: [esiaStatus === EsiaStatuses.Pending ? jsx(Loader, { blur: false }) : null, applicationFormData.map((_, i) => (jsxs("div", { className: style(inputColumnStyles(_.columns), 'grid gap-x-m'), children: [renderTitle(_.title), renderInputs$1({ field, inputs: _?.inputs }, productType)] }, `section-${i}`))), renderSubmitButton(button, isSending), esiaStatus === EsiaStatuses.Error ? (jsx(Text, { size: "text-m", font: "font-medium", color: "text-error", children: "\u0418\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u044C \u0413\u043E\u0441\u0443\u0441\u043B\u0443\u0433\u0438 \u0434\u043B\u044F \u043E\u0444\u043E\u0440\u043C\u043B\u0435\u043D\u0438\u044F \u0437\u0430\u044F\u0432\u043A\u0438 \u043D\u0435\u0432\u043E\u0437\u043C\u043E\u0436\u043D\u043E, \u043D\u0435\u043E\u0431\u0445\u043E\u0434\u0438\u043C\u043E \u0437\u0430\u043F\u043E\u043B\u043D\u0438\u0442\u044C \u043F\u043E\u043B\u044F \u0432\u0440\u0443\u0447\u043D\u0443\u044E." })) : null] })] }));
6308
6337
  });
6309
6338
  const getInputs = (applicationFormData) => (applicationFormData?.flatMap((_) => _?.inputs) || []);
6310
6339
  const getExtendedValidatorObj = (productType) => ({
@@ -10929,7 +10958,7 @@
10929
10958
  const rows = (rowData || []).map((row, i) => (jsx(TariffsTableRow, { row: row, ...rest }, String(i))));
10930
10959
  const [visibleRows, hiddenRows] = hiddenRowsNum > 0 ? [rows.slice(0, -hiddenRowsNum), rows.slice(-hiddenRowsNum)] : [rows, []];
10931
10960
  const [isUnfolded, { toggle }] = useBool(false);
10932
- return (jsxs(BlockWrapper, { className: style('relative space-y-xl', className), defaultPadding: "p-6xl", ...rest, children: [jsx(Headline, { title: title, description: description, headlineVersion: "M", isEmbedded: true, align: "text-center" }), jsx("div", { className: "space-y-m overflow-hidden", children: hiddenRowsNum > 0 ? (jsxs(Foldable, { children: [jsxs(TariffsTableWrapper, { children: [visibleRows, jsx(FoldableSection, { isUnfolded: isUnfolded, children: hiddenRows })] }), jsx(DefaultFoldButton, { className: "text-h4", isUnfolded: isUnfolded, onClick: toggle })] })) : (jsx(TariffsTableWrapper, { children: rows })) })] }));
10961
+ return (jsxs(BlockWrapper, { className: style('relative space-y-xl', className), defaultPadding: "p-6xl", ...rest, children: [jsx(Headline, { title: title, description: description, headlineVersion: "M", isEmbedded: true, align: "text-center" }), jsx("div", { className: "space-y-m overflow-hidden", children: hiddenRowsNum > 0 ? (jsxs(Foldable, { children: [jsxs(TariffsTableWrapper, { children: [visibleRows, jsx(FoldableSection, { isUnfolded: isUnfolded, isOverflowVisible: true, children: hiddenRows })] }), jsx(DefaultFoldButton, { className: "text-h4", isUnfolded: isUnfolded, onClick: toggle })] })) : (jsx(TariffsTableWrapper, { children: rows })) })] }));
10933
10962
  });
10934
10963
 
10935
10964
  const TextBlock = JSX(({ className = '', title, description, iconVersion, __html, richVersion, ...rest }) => (jsxs(BlockWrapper, { className: style('flex gap-s sm:gap-m group-data-secondary:bg-primary-main/10', className), ...rest, children: [iconVersion === 'small' ? renderIcon() : null, jsxs("div", { className: "flex flex-col w-fit gap-2xs sm:gap-xs", children: [title ? (jsx(Text, { size: "text-l", font: "font-normal", color: "text-primary-text group-data-secondary:text-white", children: title })) : null, description ? renderDescription(description) : null, __html ? jsx(RichText, { richVersion: richVersion, __html: __html }) : null] })] })));
@@ -11148,7 +11177,7 @@
11148
11177
  slots: () => [HEADER_SLOT, FOOTER_SLOT, STICKY_FOOTER_SLOT],
11149
11178
  });
11150
11179
 
11151
- const packageVersion = "0.14.870";
11180
+ const packageVersion = "0.14.872";
11152
11181
 
11153
11182
  exports.Blocks = Blocks;
11154
11183
  exports.ContentPage = ContentPage;