@redneckz/wildless-cms-uni-blocks 0.14.1033 → 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 (77) hide show
  1. package/bundle/bundle.umd.js +20 -16
  2. package/bundle/bundle.umd.min.js +1 -1
  3. package/bundle/components/ApplicationForm/renderAgreementSubmit.d.ts +10 -7
  4. package/bundle/retail/components/ConsentBkiDialog/useConsentBkiDialog.d.ts +1 -2
  5. package/dist/components/ApplicationForm/ApplicationForm.js +5 -0
  6. package/dist/components/ApplicationForm/ApplicationForm.js.map +1 -1
  7. package/dist/components/ApplicationForm/renderAgreementSubmit.d.ts +10 -7
  8. package/dist/components/ApplicationForm/renderAgreementSubmit.js +1 -1
  9. package/dist/components/ApplicationForm/renderAgreementSubmit.js.map +1 -1
  10. package/dist/components/ApplicationLeadForm/useApplicationLeadApi.js +0 -1
  11. package/dist/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
  12. package/dist/hooks/useForm/useForm.js +2 -2
  13. package/dist/hooks/useForm/useForm.js.map +1 -1
  14. package/dist/retail/api/getLastTaskStatus.js +4 -1
  15. package/dist/retail/api/getLastTaskStatus.js.map +1 -1
  16. package/dist/retail/components/ConsentBkiDialog/useConsentBkiDialog.d.ts +1 -2
  17. package/dist/retail/components/ConsentBkiDialog/useConsentBkiDialog.js +1 -2
  18. package/dist/retail/components/ConsentBkiDialog/useConsentBkiDialog.js.map +1 -1
  19. package/lib/components/ApplicationForm/ApplicationForm.js +5 -0
  20. package/lib/components/ApplicationForm/ApplicationForm.js.map +1 -1
  21. package/lib/components/ApplicationForm/renderAgreementSubmit.d.ts +10 -7
  22. package/lib/components/ApplicationForm/renderAgreementSubmit.js +1 -1
  23. package/lib/components/ApplicationForm/renderAgreementSubmit.js.map +1 -1
  24. package/lib/components/ApplicationLeadForm/useApplicationLeadApi.js +0 -1
  25. package/lib/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
  26. package/lib/hooks/useForm/useForm.js +2 -2
  27. package/lib/hooks/useForm/useForm.js.map +1 -1
  28. package/lib/retail/api/getLastTaskStatus.js +4 -1
  29. package/lib/retail/api/getLastTaskStatus.js.map +1 -1
  30. package/lib/retail/components/ConsentBkiDialog/useConsentBkiDialog.d.ts +1 -2
  31. package/lib/retail/components/ConsentBkiDialog/useConsentBkiDialog.js +1 -2
  32. package/lib/retail/components/ConsentBkiDialog/useConsentBkiDialog.js.map +1 -1
  33. package/mobile/bundle/bundle.umd.js +20 -16
  34. package/mobile/bundle/bundle.umd.min.js +1 -1
  35. package/mobile/bundle/components/ApplicationForm/renderAgreementSubmit.d.ts +10 -7
  36. package/mobile/bundle/retail/components/ConsentBkiDialog/useConsentBkiDialog.d.ts +1 -2
  37. package/mobile/dist/components/ApplicationForm/ApplicationForm.js +5 -0
  38. package/mobile/dist/components/ApplicationForm/ApplicationForm.js.map +1 -1
  39. package/mobile/dist/components/ApplicationForm/renderAgreementSubmit.d.ts +10 -7
  40. package/mobile/dist/components/ApplicationForm/renderAgreementSubmit.js +1 -1
  41. package/mobile/dist/components/ApplicationForm/renderAgreementSubmit.js.map +1 -1
  42. package/mobile/dist/components/ApplicationLeadForm/useApplicationLeadApi.js +0 -1
  43. package/mobile/dist/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
  44. package/mobile/dist/hooks/useForm/useForm.js +2 -2
  45. package/mobile/dist/hooks/useForm/useForm.js.map +1 -1
  46. package/mobile/dist/retail/api/getLastTaskStatus.js +4 -1
  47. package/mobile/dist/retail/api/getLastTaskStatus.js.map +1 -1
  48. package/mobile/dist/retail/components/ConsentBkiDialog/useConsentBkiDialog.d.ts +1 -2
  49. package/mobile/dist/retail/components/ConsentBkiDialog/useConsentBkiDialog.js +1 -2
  50. package/mobile/dist/retail/components/ConsentBkiDialog/useConsentBkiDialog.js.map +1 -1
  51. package/mobile/lib/components/ApplicationForm/ApplicationForm.js +5 -0
  52. package/mobile/lib/components/ApplicationForm/ApplicationForm.js.map +1 -1
  53. package/mobile/lib/components/ApplicationForm/renderAgreementSubmit.d.ts +10 -7
  54. package/mobile/lib/components/ApplicationForm/renderAgreementSubmit.js +1 -1
  55. package/mobile/lib/components/ApplicationForm/renderAgreementSubmit.js.map +1 -1
  56. package/mobile/lib/components/ApplicationLeadForm/useApplicationLeadApi.js +0 -1
  57. package/mobile/lib/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
  58. package/mobile/lib/hooks/useForm/useForm.js +2 -2
  59. package/mobile/lib/hooks/useForm/useForm.js.map +1 -1
  60. package/mobile/lib/retail/api/getLastTaskStatus.js +4 -1
  61. package/mobile/lib/retail/api/getLastTaskStatus.js.map +1 -1
  62. package/mobile/lib/retail/components/ConsentBkiDialog/useConsentBkiDialog.d.ts +1 -2
  63. package/mobile/lib/retail/components/ConsentBkiDialog/useConsentBkiDialog.js +1 -2
  64. package/mobile/lib/retail/components/ConsentBkiDialog/useConsentBkiDialog.js.map +1 -1
  65. package/mobile/src/components/ApplicationForm/ApplicationForm.tsx +5 -0
  66. package/mobile/src/components/ApplicationForm/renderAgreementSubmit.tsx +12 -8
  67. package/mobile/src/components/ApplicationLeadForm/useApplicationLeadApi.tsx +0 -1
  68. package/mobile/src/hooks/useForm/useForm.ts +2 -2
  69. package/mobile/src/retail/api/getLastTaskStatus.ts +6 -5
  70. package/mobile/src/retail/components/ConsentBkiDialog/useConsentBkiDialog.tsx +1 -3
  71. package/package.json +1 -1
  72. package/src/components/ApplicationForm/ApplicationForm.tsx +5 -0
  73. package/src/components/ApplicationForm/renderAgreementSubmit.tsx +12 -8
  74. package/src/components/ApplicationLeadForm/useApplicationLeadApi.tsx +0 -1
  75. package/src/hooks/useForm/useForm.ts +2 -2
  76. package/src/retail/api/getLastTaskStatus.ts +6 -5
  77. package/src/retail/components/ConsentBkiDialog/useConsentBkiDialog.tsx +1 -3
@@ -1206,6 +1206,14 @@
1206
1206
  });
1207
1207
  const randomNumber = (min = 0, max = 0) => Math.floor(Math.random() * (max - min) + min);
1208
1208
 
1209
+ function useBool(defaultValue = false) {
1210
+ const [value, setValue] = useState(defaultValue);
1211
+ const setTrue = useCallback(() => setValue(true), []);
1212
+ const setFalse = useCallback(() => setValue(false), []);
1213
+ const toggle = useCallback(() => setValue(_ => !_), []);
1214
+ return [value, { setValue, setTrue, setFalse, toggle }];
1215
+ }
1216
+
1209
1217
  function locationNavigator() {
1210
1218
  return locationNavigator._impl();
1211
1219
  }
@@ -1259,14 +1267,6 @@
1259
1267
  useAspects._impl = impl;
1260
1268
  };
1261
1269
 
1262
- function useBool(defaultValue = false) {
1263
- const [value, setValue] = useState(defaultValue);
1264
- const setTrue = useCallback(() => setValue(true), []);
1265
- const setFalse = useCallback(() => setValue(false), []);
1266
- const toggle = useCallback(() => setValue(_ => !_), []);
1267
- return [value, { setValue, setTrue, setFalse, toggle }];
1268
- }
1269
-
1270
1270
  const objectValidator = (validatorsMap) => (o) => (o &&
1271
1271
  Object.entries(validatorsMap ?? {}).flatMap(([key, validator]) => validator ? validator(o[key]) : [])) ||
1272
1272
  [];
@@ -1347,11 +1347,11 @@
1347
1347
  markAsClean();
1348
1348
  setFormState(initialState);
1349
1349
  }, [initialState, setFormState]);
1350
- const handleSubmit = useCallback((ev) => {
1350
+ const handleSubmit = useCallback(async (ev) => {
1351
1351
  ev.preventDefault();
1352
1352
  if (isValid) {
1353
+ await onSubmit?.(formState, ev);
1353
1354
  resetOnSubmit && reset();
1354
- onSubmit?.(formState, ev);
1355
1355
  }
1356
1356
  else {
1357
1357
  const errorFieldName = getErrorFieldName(formState, fieldValidatorsMap);
@@ -2552,7 +2552,7 @@
2552
2552
 
2553
2553
  const agreementText = 'Нажимая кнопку, вы подтверждаете согласие с ';
2554
2554
  const agreementTextPF = 'Нажимая на кнопку, вы подтверждаете, что клиент дал согласие на ';
2555
- 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 : 'Отправить заявку' })] }));
2555
+ 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 : 'Отправить заявку' })] }));
2556
2556
 
2557
2557
  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" })] })] })] }));
2558
2558
 
@@ -4026,7 +4026,9 @@
4026
4026
  const responseTypeDialog = useDialog(ResponseTypeDialog);
4027
4027
  const verifyPhoneDialog = useDialog(VerifyPhoneDialog$1);
4028
4028
  const openUserSurvey = useUserSurveyDialog(true);
4029
+ const [isSending, { setTrue: startSending, setFalse: endSending }] = useBool(false);
4029
4030
  const handleSubmit = useCallback(async (formData, ev) => {
4031
+ startSending();
4030
4032
  const formatData = getFormatData({ ...formData, ...additionalParams });
4031
4033
  await executeHandler({
4032
4034
  formatData,
@@ -4041,6 +4043,7 @@
4041
4043
  withSnowplow,
4042
4044
  openUserSurvey,
4043
4045
  }, endpoint);
4046
+ endSending();
4044
4047
  }, [typeForm]);
4045
4048
  const [, { field, onSubmit }] = useForm(initialFormState, {
4046
4049
  resetOnSubmit: true,
@@ -4055,6 +4058,7 @@
4055
4058
  additionalLink,
4056
4059
  button,
4057
4060
  typeForm,
4061
+ isSending,
4058
4062
  })] }), isContacts ? renderContacts() : null] }));
4059
4063
  });
4060
4064
  const executeHandler = async (context, endpoint) => {
@@ -6894,7 +6898,9 @@
6894
6898
  };
6895
6899
 
6896
6900
  const getLastTaskStatus = async (body) => {
6897
- const res = await fetchRetailJSON('/user-data/getLastStatus', 'POST', body);
6901
+ const isNewMicroservice = checkNewMicroservice();
6902
+ const endpoint = isNewMicroservice ? '/public-data/getLastStatus' : '/user-data/getLastStatus';
6903
+ const res = await fetchRetailJSON(endpoint, 'POST', body);
6898
6904
  return res?.statusCd === 'DRAFT' ? res?.taskId : null;
6899
6905
  };
6900
6906
 
@@ -7180,11 +7186,10 @@
7180
7186
  }
7181
7187
  };
7182
7188
  return {
7183
- open: ({ phone, profileId, userId, onFail, taskId, participantId }) => open({
7189
+ open: ({ phone, profileId, onFail, taskId, participantId }) => open({
7184
7190
  onSubmit: handleSubmitBkiConsent({
7185
7191
  phone,
7186
7192
  profileId,
7187
- userId,
7188
7193
  onFail,
7189
7194
  taskId,
7190
7195
  participantId,
@@ -7835,7 +7840,6 @@
7835
7840
  try {
7836
7841
  const lastTaskId = await getLastTaskStatus({
7837
7842
  userId,
7838
- profileId: userId,
7839
7843
  programId,
7840
7844
  });
7841
7845
  if (lastTaskId) {
@@ -14390,7 +14394,7 @@
14390
14394
  slots: () => [HEADER_SLOT, FOOTER_SLOT, STICKY_FOOTER_SLOT],
14391
14395
  });
14392
14396
 
14393
- const packageVersion = "0.14.1032";
14397
+ const packageVersion = "0.14.1034";
14394
14398
 
14395
14399
  exports.Blocks = Blocks;
14396
14400
  exports.ContentPage = ContentPage;