@redneckz/wildless-cms-uni-blocks 0.14.1034 → 0.14.1035

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 (42) hide show
  1. package/bundle/bundle.umd.js +16 -12
  2. package/bundle/bundle.umd.min.js +1 -1
  3. package/bundle/components/ApplicationForm/renderAgreementSubmit.d.ts +10 -7
  4. package/dist/components/ApplicationForm/ApplicationForm.js +5 -0
  5. package/dist/components/ApplicationForm/ApplicationForm.js.map +1 -1
  6. package/dist/components/ApplicationForm/renderAgreementSubmit.d.ts +10 -7
  7. package/dist/components/ApplicationForm/renderAgreementSubmit.js +1 -1
  8. package/dist/components/ApplicationForm/renderAgreementSubmit.js.map +1 -1
  9. package/dist/hooks/useForm/useForm.js +2 -2
  10. package/dist/hooks/useForm/useForm.js.map +1 -1
  11. package/lib/components/ApplicationForm/ApplicationForm.js +5 -0
  12. package/lib/components/ApplicationForm/ApplicationForm.js.map +1 -1
  13. package/lib/components/ApplicationForm/renderAgreementSubmit.d.ts +10 -7
  14. package/lib/components/ApplicationForm/renderAgreementSubmit.js +1 -1
  15. package/lib/components/ApplicationForm/renderAgreementSubmit.js.map +1 -1
  16. package/lib/components/OfficesAtmsMap/OfficesAtmsMapLayout.d.ts +1 -1
  17. package/lib/hooks/useForm/useForm.js +2 -2
  18. package/lib/hooks/useForm/useForm.js.map +1 -1
  19. package/mobile/bundle/bundle.umd.js +16 -12
  20. package/mobile/bundle/bundle.umd.min.js +1 -1
  21. package/mobile/bundle/components/ApplicationForm/renderAgreementSubmit.d.ts +10 -7
  22. package/mobile/dist/components/ApplicationForm/ApplicationForm.js +5 -0
  23. package/mobile/dist/components/ApplicationForm/ApplicationForm.js.map +1 -1
  24. package/mobile/dist/components/ApplicationForm/renderAgreementSubmit.d.ts +10 -7
  25. package/mobile/dist/components/ApplicationForm/renderAgreementSubmit.js +1 -1
  26. package/mobile/dist/components/ApplicationForm/renderAgreementSubmit.js.map +1 -1
  27. package/mobile/dist/hooks/useForm/useForm.js +2 -2
  28. package/mobile/dist/hooks/useForm/useForm.js.map +1 -1
  29. package/mobile/lib/components/ApplicationForm/ApplicationForm.js +5 -0
  30. package/mobile/lib/components/ApplicationForm/ApplicationForm.js.map +1 -1
  31. package/mobile/lib/components/ApplicationForm/renderAgreementSubmit.d.ts +10 -7
  32. package/mobile/lib/components/ApplicationForm/renderAgreementSubmit.js +1 -1
  33. package/mobile/lib/components/ApplicationForm/renderAgreementSubmit.js.map +1 -1
  34. package/mobile/lib/hooks/useForm/useForm.js +2 -2
  35. package/mobile/lib/hooks/useForm/useForm.js.map +1 -1
  36. package/mobile/src/components/ApplicationForm/ApplicationForm.tsx +5 -0
  37. package/mobile/src/components/ApplicationForm/renderAgreementSubmit.tsx +12 -8
  38. package/mobile/src/hooks/useForm/useForm.ts +2 -2
  39. package/package.json +1 -1
  40. package/src/components/ApplicationForm/ApplicationForm.tsx +5 -0
  41. package/src/components/ApplicationForm/renderAgreementSubmit.tsx +12 -8
  42. package/src/hooks/useForm/useForm.ts +2 -2
@@ -1198,6 +1198,14 @@
1198
1198
  });
1199
1199
  const randomNumber = (min = 0, max = 0) => Math.floor(Math.random() * (max - min) + min);
1200
1200
 
1201
+ function useBool(defaultValue = false) {
1202
+ const [value, setValue] = useState(defaultValue);
1203
+ const setTrue = useCallback(() => setValue(true), []);
1204
+ const setFalse = useCallback(() => setValue(false), []);
1205
+ const toggle = useCallback(() => setValue(_ => !_), []);
1206
+ return [value, { setValue, setTrue, setFalse, toggle }];
1207
+ }
1208
+
1201
1209
  function locationNavigator() {
1202
1210
  return locationNavigator._impl();
1203
1211
  }
@@ -1251,14 +1259,6 @@
1251
1259
  useAspects._impl = impl;
1252
1260
  };
1253
1261
 
1254
- function useBool(defaultValue = false) {
1255
- const [value, setValue] = useState(defaultValue);
1256
- const setTrue = useCallback(() => setValue(true), []);
1257
- const setFalse = useCallback(() => setValue(false), []);
1258
- const toggle = useCallback(() => setValue(_ => !_), []);
1259
- return [value, { setValue, setTrue, setFalse, toggle }];
1260
- }
1261
-
1262
1262
  const objectValidator = (validatorsMap) => (o) => (o &&
1263
1263
  Object.entries(validatorsMap ?? {}).flatMap(([key, validator]) => validator ? validator(o[key]) : [])) ||
1264
1264
  [];
@@ -1339,11 +1339,11 @@
1339
1339
  markAsClean();
1340
1340
  setFormState(initialState);
1341
1341
  }, [initialState, setFormState]);
1342
- const handleSubmit = useCallback((ev) => {
1342
+ const handleSubmit = useCallback(async (ev) => {
1343
1343
  ev.preventDefault();
1344
1344
  if (isValid) {
1345
+ await onSubmit?.(formState, ev);
1345
1346
  resetOnSubmit && reset();
1346
- onSubmit?.(formState, ev);
1347
1347
  }
1348
1348
  else {
1349
1349
  const errorFieldName = getErrorFieldName(formState, fieldValidatorsMap);
@@ -2544,7 +2544,7 @@
2544
2544
 
2545
2545
  const agreementText = 'Нажимая кнопку, вы подтверждаете согласие с ';
2546
2546
  const agreementTextPF = 'Нажимая на кнопку, вы подтверждаете, что клиент дал согласие на ';
2547
- const renderAgreementSubmit = ({ consentDataProcessing, link, additionalLink, 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, additionalLink: additionalLink })), jsx(SubmitButton$1, { className: "w-full @xl:w-auto", children: button?.text ? button.text : 'Отправить заявку' })] }));
2547
+ const renderAgreementSubmit = ({ consentDataProcessing, link, additionalLink, button, typeForm, isSending = false, }) => (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, additionalLink: additionalLink })), jsx(SubmitButton$1, { className: "w-full @xl:w-auto", isLoading: isSending, children: button?.text ? button.text : 'Отправить заявку' })] }));
2548
2548
 
2549
2549
  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" })] })] })] }));
2550
2550
 
@@ -4018,7 +4018,9 @@
4018
4018
  const responseTypeDialog = useDialog(ResponseTypeDialog);
4019
4019
  const verifyPhoneDialog = useDialog(VerifyPhoneDialog$1);
4020
4020
  const openUserSurvey = useUserSurveyDialog(true);
4021
+ const [isSending, { setTrue: startSending, setFalse: endSending }] = useBool(false);
4021
4022
  const handleSubmit = useCallback(async (formData, ev) => {
4023
+ startSending();
4022
4024
  const formatData = getFormatData({ ...formData, ...additionalParams });
4023
4025
  await executeHandler({
4024
4026
  formatData,
@@ -4033,6 +4035,7 @@
4033
4035
  withSnowplow,
4034
4036
  openUserSurvey,
4035
4037
  }, endpoint);
4038
+ endSending();
4036
4039
  }, [typeForm]);
4037
4040
  const [, { field, onSubmit }] = useForm(initialFormState, {
4038
4041
  resetOnSubmit: true,
@@ -4047,6 +4050,7 @@
4047
4050
  additionalLink,
4048
4051
  button,
4049
4052
  typeForm,
4053
+ isSending,
4050
4054
  })] }), isContacts ? renderContacts() : null] }));
4051
4055
  });
4052
4056
  const executeHandler = async (context, endpoint) => {
@@ -14620,7 +14624,7 @@
14620
14624
  slots: () => [HEADER_SLOT, FOOTER_SLOT, STICKY_FOOTER_SLOT],
14621
14625
  });
14622
14626
 
14623
- const packageVersion = "0.14.1033";
14627
+ const packageVersion = "0.14.1034";
14624
14628
 
14625
14629
  exports.Blocks = Blocks;
14626
14630
  exports.ContentPage = ContentPage;