@redneckz/wildless-cms-uni-blocks 0.14.885 → 0.14.887

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 (78) hide show
  1. package/bundle/api/LeadServiceAPI.d.ts +2 -1
  2. package/bundle/bundle.umd.js +18 -5
  3. package/bundle/bundle.umd.min.js +1 -1
  4. package/bundle/components/ApplicationForm/renderAgreementSubmit.d.ts +6 -1
  5. package/bundle/components/ApplicationLeadForm/renderAgreementSubmit.d.ts +5 -1
  6. package/bundle/model/FormTypeFieldDef.d.ts +1 -1
  7. package/dist/api/LeadServiceAPI.d.ts +2 -1
  8. package/dist/api/LeadServiceAPI.js +7 -1
  9. package/dist/api/LeadServiceAPI.js.map +1 -1
  10. package/dist/components/ApplicationForm/ApplicationForm.js +9 -2
  11. package/dist/components/ApplicationForm/ApplicationForm.js.map +1 -1
  12. package/dist/components/ApplicationForm/renderAgreementSubmit.d.ts +6 -1
  13. package/dist/components/ApplicationForm/renderAgreementSubmit.js +2 -1
  14. package/dist/components/ApplicationForm/renderAgreementSubmit.js.map +1 -1
  15. package/dist/components/ApplicationLeadForm/renderAgreementSubmit.d.ts +5 -1
  16. package/dist/components/ApplicationLeadForm/renderAgreementSubmit.js +1 -1
  17. package/dist/components/ApplicationLeadForm/renderAgreementSubmit.js.map +1 -1
  18. package/dist/model/FormTypeFieldDef.d.ts +1 -1
  19. package/lib/api/LeadServiceAPI.d.ts +2 -1
  20. package/lib/api/LeadServiceAPI.js +7 -1
  21. package/lib/api/LeadServiceAPI.js.map +1 -1
  22. package/lib/components/ApplicationForm/ApplicationForm.fixture.d.ts +1 -0
  23. package/lib/components/ApplicationForm/ApplicationForm.fixture.mobile.d.ts +1 -0
  24. package/lib/components/ApplicationForm/ApplicationForm.js +9 -2
  25. package/lib/components/ApplicationForm/ApplicationForm.js.map +1 -1
  26. package/lib/components/ApplicationForm/renderAgreementSubmit.d.ts +6 -1
  27. package/lib/components/ApplicationForm/renderAgreementSubmit.js +2 -1
  28. package/lib/components/ApplicationForm/renderAgreementSubmit.js.map +1 -1
  29. package/lib/components/ApplicationLeadForm/renderAgreementSubmit.d.ts +5 -1
  30. package/lib/components/ApplicationLeadForm/renderAgreementSubmit.js +1 -1
  31. package/lib/components/ApplicationLeadForm/renderAgreementSubmit.js.map +1 -1
  32. package/lib/model/FormTypeFieldDef.d.ts +1 -1
  33. package/mobile/bundle/api/LeadServiceAPI.d.ts +2 -1
  34. package/mobile/bundle/bundle.umd.js +18 -5
  35. package/mobile/bundle/bundle.umd.min.js +1 -1
  36. package/mobile/bundle/components/ApplicationForm/renderAgreementSubmit.d.ts +6 -1
  37. package/mobile/bundle/components/ApplicationLeadForm/renderAgreementSubmit.d.ts +5 -1
  38. package/mobile/bundle/model/FormTypeFieldDef.d.ts +1 -1
  39. package/mobile/dist/api/LeadServiceAPI.d.ts +2 -1
  40. package/mobile/dist/api/LeadServiceAPI.js +7 -1
  41. package/mobile/dist/api/LeadServiceAPI.js.map +1 -1
  42. package/mobile/dist/components/ApplicationForm/ApplicationForm.js +9 -2
  43. package/mobile/dist/components/ApplicationForm/ApplicationForm.js.map +1 -1
  44. package/mobile/dist/components/ApplicationForm/renderAgreementSubmit.d.ts +6 -1
  45. package/mobile/dist/components/ApplicationForm/renderAgreementSubmit.js +2 -1
  46. package/mobile/dist/components/ApplicationForm/renderAgreementSubmit.js.map +1 -1
  47. package/mobile/dist/components/ApplicationLeadForm/renderAgreementSubmit.d.ts +5 -1
  48. package/mobile/dist/components/ApplicationLeadForm/renderAgreementSubmit.js +1 -1
  49. package/mobile/dist/components/ApplicationLeadForm/renderAgreementSubmit.js.map +1 -1
  50. package/mobile/dist/model/FormTypeFieldDef.d.ts +1 -1
  51. package/mobile/lib/api/LeadServiceAPI.d.ts +2 -1
  52. package/mobile/lib/api/LeadServiceAPI.js +7 -1
  53. package/mobile/lib/api/LeadServiceAPI.js.map +1 -1
  54. package/mobile/lib/components/ApplicationForm/ApplicationForm.js +9 -2
  55. package/mobile/lib/components/ApplicationForm/ApplicationForm.js.map +1 -1
  56. package/mobile/lib/components/ApplicationForm/renderAgreementSubmit.d.ts +6 -1
  57. package/mobile/lib/components/ApplicationForm/renderAgreementSubmit.js +2 -1
  58. package/mobile/lib/components/ApplicationForm/renderAgreementSubmit.js.map +1 -1
  59. package/mobile/lib/components/ApplicationLeadForm/renderAgreementSubmit.d.ts +5 -1
  60. package/mobile/lib/components/ApplicationLeadForm/renderAgreementSubmit.js +1 -1
  61. package/mobile/lib/components/ApplicationLeadForm/renderAgreementSubmit.js.map +1 -1
  62. package/mobile/lib/model/FormTypeFieldDef.d.ts +1 -1
  63. package/mobile/src/api/LeadServiceAPI.ts +10 -1
  64. package/mobile/src/components/ApplicationForm/ApplicationForm.example.json +31 -1
  65. package/mobile/src/components/ApplicationForm/ApplicationForm.tsx +7 -4
  66. package/mobile/src/components/ApplicationForm/renderAgreementSubmit.tsx +13 -6
  67. package/mobile/src/components/ApplicationLeadForm/renderAgreementSubmit.tsx +9 -5
  68. package/mobile/src/model/FormTypeFieldDef.ts +2 -1
  69. package/package.json +2 -2
  70. package/src/api/LeadServiceAPI.ts +10 -1
  71. package/src/components/ApplicationForm/ApplicationForm.example.json +31 -1
  72. package/src/components/ApplicationForm/ApplicationForm.fixture.mobile.tsx +24 -1
  73. package/src/components/ApplicationForm/ApplicationForm.fixture.tsx +24 -1
  74. package/src/components/ApplicationForm/ApplicationForm.tsx +7 -4
  75. package/src/components/ApplicationForm/renderAgreementSubmit.tsx +13 -6
  76. package/src/components/ApplicationLeadForm/renderAgreementSubmit.tsx +9 -5
  77. package/src/icons/IconName.ts +4 -4
  78. package/src/model/FormTypeFieldDef.ts +2 -1
@@ -1,4 +1,5 @@
1
1
  import { type JSONRecord, type JSONScalar } from '@redneckz/json-op';
2
+ import { type Router } from '../external/useRouter';
2
3
  export declare type LeadRequest = Record<string, JSONRecord | JSONScalar | null> & {
3
4
  typeForm?: string;
4
5
  addressBranch?: string;
@@ -12,5 +13,5 @@ export declare type LeadRequest = Record<string, JSONRecord | JSONScalar | null>
12
13
  companyNameByInn?: string;
13
14
  };
14
15
  export declare function LeadServiceAPI(): {
15
- send: (body: LeadRequest, isIndividualType?: boolean) => Promise<any>;
16
+ send: (body: LeadRequest, router: Router, isIndividualType?: boolean) => Promise<any>;
16
17
  };
@@ -1005,7 +1005,7 @@
1005
1005
  const RETAIL_API_BASE_URI = '/light-api-cash/v1';
1006
1006
 
1007
1007
  function LeadServiceAPI() {
1008
- async function send(body, isIndividualType = false) {
1008
+ async function send(body, router, isIndividualType = false) {
1009
1009
  const { typeForm, region, phone = '', email, birthday, desiredMeetingDate, inn, innDadata, fullRegion, addressBranch, secondaryPhone = '', bankEmpolee, applicationDate, serviceDirection, partnerSymbolCode, companyNameByInn, ...staticBody } = body;
1010
1010
  const isNaturalPerson = isIndividualType && serviceDirection !== 'Юридическое лицо / ИП';
1011
1011
  const url = `${API_BASE_URI$1}${isNaturalPerson ? '/lead' : '/sendcorporatelead'}`;
@@ -1024,6 +1024,7 @@
1024
1024
  applicationDate,
1025
1025
  ...getSecondaryPhone(secondaryPhone),
1026
1026
  }),
1027
+ ...addPageSlug(typeForm, router),
1027
1028
  ...formatPFForm(typeForm, { innDadata, fullRegion, partnerSymbolCode, companyNameByInn }),
1028
1029
  ...staticBody,
1029
1030
  };
@@ -1066,6 +1067,11 @@
1066
1067
  fullname: data?.companyNameByInn,
1067
1068
  }
1068
1069
  : {};
1070
+ const addPageSlug = (typeForm, router) => typeForm === 'UNIVERSAL'
1071
+ ? {
1072
+ typeForm: router?.pathname?.split('/')?.at(-1) || '/',
1073
+ }
1074
+ : {};
1069
1075
 
1070
1076
  const handleAspects = async ({ aspectsAttributes, aspects, ev }) => {
1071
1077
  for (const { aspectName, params } of aspectsAttributes ?? []) {
@@ -2570,7 +2576,8 @@
2570
2576
  const Footnote = JSX(({ text, link }) => (jsxs(Paragraph, { size: "text-l", font: "font-light", color: "text-secondary-text", children: [text ? jsx(Text, { children: text }) : null, link ? (jsx(Link, { ...link, ariaLabel: "\u0443\u0441\u043B\u043E\u0432\u0438\u044F \u043F\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0434\u0430\u043D\u043D\u044B\u0445", children: link.text })) : null] })));
2571
2577
 
2572
2578
  const agreementText = 'Нажимая кнопку, вы подтверждаете согласие с ';
2573
- const renderAgreementSubmit = (consentDataProcessing, link, button) => (jsxs("div", { className: "flex col-span-2 gap-xs flex-col w-full items-baseline", children: [consentDataProcessing ? (jsxs("div", { children: [jsxs("div", { className: "flex gap-3 items-center", children: [jsx(Checkbox, { ...consentDataProcessing }), jsx(Footnote, { link: link })] }), renderErrorText(withValidator(consentDataProcessing, agreementValidator).error)] })) : (jsx(Footnote, { text: agreementText, link: link })), jsx(SubmitButton$1, { className: "w-full @xl:w-auto", children: button?.text ? button.text : 'Отправить заявку' })] }));
2579
+ const agreementTextPF = 'Нажимая на кнопку, вы подтверждаете, что клиент дал согласие на ';
2580
+ const renderAgreementSubmit = ({ consentDataProcessing, link, button, typeForm, }) => (jsxs("div", { className: "flex col-span-2 gap-xs flex-col w-full items-baseline", children: [consentDataProcessing ? (jsxs("div", { children: [jsxs("div", { className: "flex gap-3 items-center", children: [jsx(Checkbox, { ...consentDataProcessing }), jsx(Footnote, { link: link })] }), renderErrorText(withValidator(consentDataProcessing, agreementValidator).error)] })) : (jsx(Footnote, { text: typeForm === 'PF' ? agreementTextPF : agreementText, link: link })), jsx(SubmitButton$1, { className: "w-full @xl:w-auto", children: button?.text ? button.text : 'Отправить заявку' })] }));
2574
2581
 
2575
2582
  const renderContacts = () => (jsxs("div", { className: "space-y-m", children: [jsx(Heading, { headingType: "h6", title: "\u0418\u043B\u0438 \u0441\u0432\u044F\u0436\u0438\u0442\u0435\u0441\u044C \u0441 \u043D\u0430\u043C\u0438 \u0443\u0434\u043E\u0431\u043D\u044B\u043C \u0441\u043F\u043E\u0441\u043E\u0431\u043E\u043C", className: "@xl:text-center" }), jsxs("div", { className: "flex sm:justify-center gap-xl", children: [jsxs("a", { className: "flex gap-s items-center text-primary-text no-underline", href: `tel:8 (800) 200-78-70`, "aria-label": "\u0442\u0435\u043B\u0435\u0444\u043E\u043D 8 (800) 200-78-70", children: [jsx(Img, { image: { icon: 'PhoneIcon' }, width: "24", height: "24" }), jsx("span", { children: "8 (800) 200-78-70" })] }), jsxs("a", { className: "flex gap-s items-center text-primary-text no-underline", "aria-label": "\u043F\u043E\u0447\u0442\u0430 ved@rshb.ru", href: `mailto:ved@rshb.ru`, children: [jsx(Img, { image: { icon: 'MailIcon' }, width: "24", height: "24" }), jsx("span", { children: "ved@rshb.ru" })] })] })] }));
2576
2583
 
@@ -2578,12 +2585,13 @@
2578
2585
  const ApplicationForm = UniBlock(({ className, title, typeForm = '', sections = [], button, link, endpoint, additionalParams, isContacts, data, ...rest }) => {
2579
2586
  const inputs = useMemo(() => (sections?.flatMap((_) => _?.inputs) || []), [sections]);
2580
2587
  const initialFormState = useMemo(() => getInitialFormState$2(inputs, typeForm), [inputs, typeForm]);
2588
+ const router = useRouter();
2581
2589
  const formValidator = useMemo(() => getFormValidator(inputs), [inputs]);
2582
2590
  const responseTypeDialog = useDialog(ResponseTypeDialog);
2583
2591
  const aspects = useAspects();
2584
2592
  const handleSubmit = useCallback(async (formData, ev) => {
2585
2593
  const formatData = getFormatData({ ...formData, ...additionalParams });
2586
- const ok = Boolean(await API.send(formatData, endpoint === 'lead'));
2594
+ const ok = Boolean(await API.send(formatData, router, endpoint === 'lead'));
2587
2595
  responseTypeDialog.open({ ok, typeForm });
2588
2596
  if (ok) {
2589
2597
  handleAspects({ aspectsAttributes: data, aspects, ev });
@@ -2595,7 +2603,12 @@
2595
2603
  onSubmit: handleSubmit,
2596
2604
  });
2597
2605
  const fieldName = getConsentDataProcessing(inputs)?.name;
2598
- return (jsxs(ApplicationFormLayout, { className: style('container space-y-m', className), title: title, ...rest, children: [jsxs("form", { onSubmit: onSubmit, children: [renderSections(sections, field, { typeForm, additionalParams }), renderAgreementSubmit(fieldName ? field('consentDataProcessing') : undefined, link, button)] }), isContacts ? renderContacts() : null] }));
2606
+ return (jsxs(ApplicationFormLayout, { className: style('container space-y-m', className), title: title, ...rest, children: [jsxs("form", { onSubmit: onSubmit, children: [renderSections(sections, field, { typeForm, additionalParams }), renderAgreementSubmit({
2607
+ consentDataProcessing: fieldName ? field('consentDataProcessing') : undefined,
2608
+ link,
2609
+ button,
2610
+ typeForm,
2611
+ })] }), isContacts ? renderContacts() : null] }));
2599
2612
  });
2600
2613
  const renderSections = (sections, field, { typeForm, additionalParams }) => sections.map((_, i) => (jsxs("div", { className: style(inputColumnStyles(_.columns), 'grid gap-x-m'), children: [renderTitle(_.title), (_?.inputs || [])?.map(getField(field, { typeForm, ...additionalParams }))] }, `section-${i}`)));
2601
2614
 
@@ -11524,7 +11537,7 @@
11524
11537
  slots: () => [HEADER_SLOT, FOOTER_SLOT, STICKY_FOOTER_SLOT],
11525
11538
  });
11526
11539
 
11527
- const packageVersion = "0.14.884";
11540
+ const packageVersion = "0.14.886";
11528
11541
 
11529
11542
  exports.Blocks = Blocks;
11530
11543
  exports.ContentPage = ContentPage;