@redneckz/wildless-cms-uni-blocks 0.14.1014 → 0.14.1015

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 (193) hide show
  1. package/bundle/api/LeadServiceAPI.d.ts +7 -0
  2. package/bundle/api/sendUserSurvey.d.ts +8 -0
  3. package/bundle/bundle.umd.js +135 -11
  4. package/bundle/bundle.umd.min.js +1 -1
  5. package/bundle/ui-kit/DialogManager/Dialog.d.ts +1 -1
  6. package/bundle/ui-kit/RadioButtonGroup/RadioButtonGroup.d.ts +1 -1
  7. package/bundle/ui-kit/UserSurveyDialog/FinalStep.d.ts +2 -0
  8. package/bundle/ui-kit/UserSurveyDialog/FirstStep.d.ts +2 -0
  9. package/bundle/ui-kit/UserSurveyDialog/SecondStep.d.ts +2 -0
  10. package/bundle/ui-kit/UserSurveyDialog/Star.d.ts +11 -0
  11. package/bundle/ui-kit/UserSurveyDialog/UserSurveyDialog.d.ts +3 -0
  12. package/bundle/ui-kit/UserSurveyDialog/UserSurveyDialogContent.d.ts +29 -0
  13. package/bundle/ui-kit/UserSurveyDialog/useUserSurveyDialog.d.ts +1 -0
  14. package/dist/api/LeadServiceAPI.d.ts +7 -0
  15. package/dist/api/LeadServiceAPI.js +6 -5
  16. package/dist/api/LeadServiceAPI.js.map +1 -1
  17. package/dist/api/sendUserSurvey.d.ts +8 -0
  18. package/dist/api/sendUserSurvey.js +15 -0
  19. package/dist/api/sendUserSurvey.js.map +1 -0
  20. package/dist/components/ContentPage/ContentPage.js +2 -0
  21. package/dist/components/ContentPage/ContentPage.js.map +1 -1
  22. package/dist/ui-kit/DialogManager/Dialog.d.ts +1 -1
  23. package/dist/ui-kit/DialogManager/Dialog.js +1 -0
  24. package/dist/ui-kit/DialogManager/Dialog.js.map +1 -1
  25. package/dist/ui-kit/RadioButtonGroup/RadioButtonGroup.d.ts +1 -1
  26. package/dist/ui-kit/RadioButtonGroup/RadioButtonGroup.js +1 -1
  27. package/dist/ui-kit/RadioButtonGroup/RadioButtonGroup.js.map +1 -1
  28. package/dist/ui-kit/UserSurveyDialog/FinalStep.d.ts +2 -0
  29. package/dist/ui-kit/UserSurveyDialog/FinalStep.js +10 -0
  30. package/dist/ui-kit/UserSurveyDialog/FinalStep.js.map +1 -0
  31. package/dist/ui-kit/UserSurveyDialog/FirstStep.d.ts +2 -0
  32. package/dist/ui-kit/UserSurveyDialog/FirstStep.js +24 -0
  33. package/dist/ui-kit/UserSurveyDialog/FirstStep.js.map +1 -0
  34. package/dist/ui-kit/UserSurveyDialog/SecondStep.d.ts +2 -0
  35. package/dist/ui-kit/UserSurveyDialog/SecondStep.js +23 -0
  36. package/dist/ui-kit/UserSurveyDialog/SecondStep.js.map +1 -0
  37. package/dist/ui-kit/UserSurveyDialog/Star.d.ts +11 -0
  38. package/dist/ui-kit/UserSurveyDialog/Star.js +9 -0
  39. package/dist/ui-kit/UserSurveyDialog/Star.js.map +1 -0
  40. package/dist/ui-kit/UserSurveyDialog/UserSurveyDialog.d.ts +3 -0
  41. package/dist/ui-kit/UserSurveyDialog/UserSurveyDialog.js +48 -0
  42. package/dist/ui-kit/UserSurveyDialog/UserSurveyDialog.js.map +1 -0
  43. package/dist/ui-kit/UserSurveyDialog/UserSurveyDialogContent.d.ts +29 -0
  44. package/dist/ui-kit/UserSurveyDialog/UserSurveyDialogContent.js +2 -0
  45. package/dist/ui-kit/UserSurveyDialog/UserSurveyDialogContent.js.map +1 -0
  46. package/dist/ui-kit/UserSurveyDialog/useUserSurveyDialog.d.ts +1 -0
  47. package/dist/ui-kit/UserSurveyDialog/useUserSurveyDialog.js +48 -0
  48. package/dist/ui-kit/UserSurveyDialog/useUserSurveyDialog.js.map +1 -0
  49. package/lib/api/LeadServiceAPI.d.ts +7 -0
  50. package/lib/api/LeadServiceAPI.js +1 -1
  51. package/lib/api/LeadServiceAPI.js.map +1 -1
  52. package/lib/api/sendUserSurvey.d.ts +8 -0
  53. package/lib/api/sendUserSurvey.js +12 -0
  54. package/lib/api/sendUserSurvey.js.map +1 -0
  55. package/lib/common.css +1 -1
  56. package/lib/components/ContentPage/ContentPage.js +2 -0
  57. package/lib/components/ContentPage/ContentPage.js.map +1 -1
  58. package/lib/ui-kit/DialogManager/Dialog.d.ts +1 -1
  59. package/lib/ui-kit/DialogManager/Dialog.js +1 -0
  60. package/lib/ui-kit/DialogManager/Dialog.js.map +1 -1
  61. package/lib/ui-kit/RadioButtonGroup/RadioButtonGroup.d.ts +1 -1
  62. package/lib/ui-kit/RadioButtonGroup/RadioButtonGroup.js +1 -1
  63. package/lib/ui-kit/RadioButtonGroup/RadioButtonGroup.js.map +1 -1
  64. package/lib/ui-kit/UserSurveyDialog/FinalStep.d.ts +2 -0
  65. package/lib/ui-kit/UserSurveyDialog/FinalStep.js +8 -0
  66. package/lib/ui-kit/UserSurveyDialog/FinalStep.js.map +1 -0
  67. package/lib/ui-kit/UserSurveyDialog/FirstStep.d.ts +2 -0
  68. package/lib/ui-kit/UserSurveyDialog/FirstStep.js +22 -0
  69. package/lib/ui-kit/UserSurveyDialog/FirstStep.js.map +1 -0
  70. package/lib/ui-kit/UserSurveyDialog/SecondStep.d.ts +2 -0
  71. package/lib/ui-kit/UserSurveyDialog/SecondStep.js +21 -0
  72. package/lib/ui-kit/UserSurveyDialog/SecondStep.js.map +1 -0
  73. package/lib/ui-kit/UserSurveyDialog/Star.d.ts +11 -0
  74. package/lib/ui-kit/UserSurveyDialog/Star.js +7 -0
  75. package/lib/ui-kit/UserSurveyDialog/Star.js.map +1 -0
  76. package/lib/ui-kit/UserSurveyDialog/UserSurveyDialog.d.ts +3 -0
  77. package/lib/ui-kit/UserSurveyDialog/UserSurveyDialog.js +46 -0
  78. package/lib/ui-kit/UserSurveyDialog/UserSurveyDialog.js.map +1 -0
  79. package/lib/ui-kit/UserSurveyDialog/UserSurveyDialogContent.d.ts +29 -0
  80. package/lib/ui-kit/UserSurveyDialog/UserSurveyDialogContent.js +2 -0
  81. package/lib/ui-kit/UserSurveyDialog/UserSurveyDialogContent.js.map +1 -0
  82. package/lib/ui-kit/UserSurveyDialog/useUserSurveyDialog.d.ts +1 -0
  83. package/lib/ui-kit/UserSurveyDialog/useUserSurveyDialog.js +45 -0
  84. package/lib/ui-kit/UserSurveyDialog/useUserSurveyDialog.js.map +1 -0
  85. package/mobile/bundle/api/LeadServiceAPI.d.ts +7 -0
  86. package/mobile/bundle/api/sendUserSurvey.d.ts +8 -0
  87. package/mobile/bundle/bundle.umd.js +135 -11
  88. package/mobile/bundle/bundle.umd.min.js +1 -1
  89. package/mobile/bundle/ui-kit/DialogManager/Dialog.d.ts +1 -1
  90. package/mobile/bundle/ui-kit/RadioButtonGroup/RadioButtonGroup.d.ts +1 -1
  91. package/mobile/bundle/ui-kit/UserSurveyDialog/FinalStep.d.ts +2 -0
  92. package/mobile/bundle/ui-kit/UserSurveyDialog/FirstStep.d.ts +2 -0
  93. package/mobile/bundle/ui-kit/UserSurveyDialog/SecondStep.d.ts +2 -0
  94. package/mobile/bundle/ui-kit/UserSurveyDialog/Star.d.ts +11 -0
  95. package/mobile/bundle/ui-kit/UserSurveyDialog/UserSurveyDialog.d.ts +3 -0
  96. package/mobile/bundle/ui-kit/UserSurveyDialog/UserSurveyDialogContent.d.ts +29 -0
  97. package/mobile/bundle/ui-kit/UserSurveyDialog/useUserSurveyDialog.d.ts +1 -0
  98. package/mobile/dist/api/LeadServiceAPI.d.ts +7 -0
  99. package/mobile/dist/api/LeadServiceAPI.js +6 -5
  100. package/mobile/dist/api/LeadServiceAPI.js.map +1 -1
  101. package/mobile/dist/api/sendUserSurvey.d.ts +8 -0
  102. package/mobile/dist/api/sendUserSurvey.js +15 -0
  103. package/mobile/dist/api/sendUserSurvey.js.map +1 -0
  104. package/mobile/dist/components/ContentPage/ContentPage.js +2 -0
  105. package/mobile/dist/components/ContentPage/ContentPage.js.map +1 -1
  106. package/mobile/dist/ui-kit/DialogManager/Dialog.d.ts +1 -1
  107. package/mobile/dist/ui-kit/DialogManager/Dialog.js +1 -0
  108. package/mobile/dist/ui-kit/DialogManager/Dialog.js.map +1 -1
  109. package/mobile/dist/ui-kit/RadioButtonGroup/RadioButtonGroup.d.ts +1 -1
  110. package/mobile/dist/ui-kit/RadioButtonGroup/RadioButtonGroup.js +1 -1
  111. package/mobile/dist/ui-kit/RadioButtonGroup/RadioButtonGroup.js.map +1 -1
  112. package/mobile/dist/ui-kit/UserSurveyDialog/FinalStep.d.ts +2 -0
  113. package/mobile/dist/ui-kit/UserSurveyDialog/FinalStep.js +10 -0
  114. package/mobile/dist/ui-kit/UserSurveyDialog/FinalStep.js.map +1 -0
  115. package/mobile/dist/ui-kit/UserSurveyDialog/FirstStep.d.ts +2 -0
  116. package/mobile/dist/ui-kit/UserSurveyDialog/FirstStep.js +24 -0
  117. package/mobile/dist/ui-kit/UserSurveyDialog/FirstStep.js.map +1 -0
  118. package/mobile/dist/ui-kit/UserSurveyDialog/SecondStep.d.ts +2 -0
  119. package/mobile/dist/ui-kit/UserSurveyDialog/SecondStep.js +23 -0
  120. package/mobile/dist/ui-kit/UserSurveyDialog/SecondStep.js.map +1 -0
  121. package/mobile/dist/ui-kit/UserSurveyDialog/Star.d.ts +11 -0
  122. package/mobile/dist/ui-kit/UserSurveyDialog/Star.js +9 -0
  123. package/mobile/dist/ui-kit/UserSurveyDialog/Star.js.map +1 -0
  124. package/mobile/dist/ui-kit/UserSurveyDialog/UserSurveyDialog.d.ts +3 -0
  125. package/mobile/dist/ui-kit/UserSurveyDialog/UserSurveyDialog.js +48 -0
  126. package/mobile/dist/ui-kit/UserSurveyDialog/UserSurveyDialog.js.map +1 -0
  127. package/mobile/dist/ui-kit/UserSurveyDialog/UserSurveyDialogContent.d.ts +29 -0
  128. package/mobile/dist/ui-kit/UserSurveyDialog/UserSurveyDialogContent.js +2 -0
  129. package/mobile/dist/ui-kit/UserSurveyDialog/UserSurveyDialogContent.js.map +1 -0
  130. package/mobile/dist/ui-kit/UserSurveyDialog/useUserSurveyDialog.d.ts +1 -0
  131. package/mobile/dist/ui-kit/UserSurveyDialog/useUserSurveyDialog.js +48 -0
  132. package/mobile/dist/ui-kit/UserSurveyDialog/useUserSurveyDialog.js.map +1 -0
  133. package/mobile/lib/api/LeadServiceAPI.d.ts +7 -0
  134. package/mobile/lib/api/LeadServiceAPI.js +1 -1
  135. package/mobile/lib/api/LeadServiceAPI.js.map +1 -1
  136. package/mobile/lib/api/sendUserSurvey.d.ts +8 -0
  137. package/mobile/lib/api/sendUserSurvey.js +12 -0
  138. package/mobile/lib/api/sendUserSurvey.js.map +1 -0
  139. package/mobile/lib/common.css +1 -1
  140. package/mobile/lib/components/ContentPage/ContentPage.js +2 -0
  141. package/mobile/lib/components/ContentPage/ContentPage.js.map +1 -1
  142. package/mobile/lib/ui-kit/DialogManager/Dialog.d.ts +1 -1
  143. package/mobile/lib/ui-kit/DialogManager/Dialog.js +1 -0
  144. package/mobile/lib/ui-kit/DialogManager/Dialog.js.map +1 -1
  145. package/mobile/lib/ui-kit/RadioButtonGroup/RadioButtonGroup.d.ts +1 -1
  146. package/mobile/lib/ui-kit/RadioButtonGroup/RadioButtonGroup.js +1 -1
  147. package/mobile/lib/ui-kit/RadioButtonGroup/RadioButtonGroup.js.map +1 -1
  148. package/mobile/lib/ui-kit/UserSurveyDialog/FinalStep.d.ts +2 -0
  149. package/mobile/lib/ui-kit/UserSurveyDialog/FinalStep.js +8 -0
  150. package/mobile/lib/ui-kit/UserSurveyDialog/FinalStep.js.map +1 -0
  151. package/mobile/lib/ui-kit/UserSurveyDialog/FirstStep.d.ts +2 -0
  152. package/mobile/lib/ui-kit/UserSurveyDialog/FirstStep.js +22 -0
  153. package/mobile/lib/ui-kit/UserSurveyDialog/FirstStep.js.map +1 -0
  154. package/mobile/lib/ui-kit/UserSurveyDialog/SecondStep.d.ts +2 -0
  155. package/mobile/lib/ui-kit/UserSurveyDialog/SecondStep.js +21 -0
  156. package/mobile/lib/ui-kit/UserSurveyDialog/SecondStep.js.map +1 -0
  157. package/mobile/lib/ui-kit/UserSurveyDialog/Star.d.ts +11 -0
  158. package/mobile/lib/ui-kit/UserSurveyDialog/Star.js +7 -0
  159. package/mobile/lib/ui-kit/UserSurveyDialog/Star.js.map +1 -0
  160. package/mobile/lib/ui-kit/UserSurveyDialog/UserSurveyDialog.d.ts +3 -0
  161. package/mobile/lib/ui-kit/UserSurveyDialog/UserSurveyDialog.js +46 -0
  162. package/mobile/lib/ui-kit/UserSurveyDialog/UserSurveyDialog.js.map +1 -0
  163. package/mobile/lib/ui-kit/UserSurveyDialog/UserSurveyDialogContent.d.ts +29 -0
  164. package/mobile/lib/ui-kit/UserSurveyDialog/UserSurveyDialogContent.js +2 -0
  165. package/mobile/lib/ui-kit/UserSurveyDialog/UserSurveyDialogContent.js.map +1 -0
  166. package/mobile/lib/ui-kit/UserSurveyDialog/useUserSurveyDialog.d.ts +1 -0
  167. package/mobile/lib/ui-kit/UserSurveyDialog/useUserSurveyDialog.js +45 -0
  168. package/mobile/lib/ui-kit/UserSurveyDialog/useUserSurveyDialog.js.map +1 -0
  169. package/mobile/src/api/LeadServiceAPI.ts +1 -1
  170. package/mobile/src/api/sendUserSurvey.ts +20 -0
  171. package/mobile/src/components/ContentPage/ContentPage.tsx +2 -0
  172. package/mobile/src/ui-kit/DialogManager/Dialog.tsx +2 -1
  173. package/mobile/src/ui-kit/RadioButtonGroup/RadioButtonGroup.tsx +2 -2
  174. package/mobile/src/ui-kit/UserSurveyDialog/FinalStep.tsx +14 -0
  175. package/mobile/src/ui-kit/UserSurveyDialog/FirstStep.tsx +50 -0
  176. package/mobile/src/ui-kit/UserSurveyDialog/SecondStep.tsx +57 -0
  177. package/mobile/src/ui-kit/UserSurveyDialog/Star.tsx +28 -0
  178. package/mobile/src/ui-kit/UserSurveyDialog/UserSurveyDialog.tsx +80 -0
  179. package/mobile/src/ui-kit/UserSurveyDialog/UserSurveyDialogContent.ts +31 -0
  180. package/mobile/src/ui-kit/UserSurveyDialog/useUserSurveyDialog.ts +56 -0
  181. package/package.json +1 -1
  182. package/src/api/LeadServiceAPI.ts +1 -1
  183. package/src/api/sendUserSurvey.ts +20 -0
  184. package/src/components/ContentPage/ContentPage.tsx +2 -0
  185. package/src/ui-kit/DialogManager/Dialog.tsx +2 -1
  186. package/src/ui-kit/RadioButtonGroup/RadioButtonGroup.tsx +2 -2
  187. package/src/ui-kit/UserSurveyDialog/FinalStep.tsx +14 -0
  188. package/src/ui-kit/UserSurveyDialog/FirstStep.tsx +50 -0
  189. package/src/ui-kit/UserSurveyDialog/SecondStep.tsx +57 -0
  190. package/src/ui-kit/UserSurveyDialog/Star.tsx +28 -0
  191. package/src/ui-kit/UserSurveyDialog/UserSurveyDialog.tsx +80 -0
  192. package/src/ui-kit/UserSurveyDialog/UserSurveyDialogContent.ts +31 -0
  193. package/src/ui-kit/UserSurveyDialog/useUserSurveyDialog.ts +56 -0
@@ -28,6 +28,11 @@ declare type CheckCodeResponse = {
28
28
  reqId?: string;
29
29
  status?: string;
30
30
  } | null;
31
+ declare type VerifiedLeadRequest = {
32
+ requestId: string;
33
+ confirmationCode: string;
34
+ leadRequest: LeadRequest;
35
+ };
31
36
  declare type PhoneOnly = {
32
37
  phone?: string;
33
38
  };
@@ -36,10 +41,12 @@ export declare type sendProps = {
36
41
  router: Router;
37
42
  endpoint?: EndpointType;
38
43
  };
44
+ declare type SubmitBody = PhoneOnly | LeadRequest | CheckCodeProps | VerifiedLeadRequest;
39
45
  export declare function LeadServiceAPI(): {
40
46
  send: ({ body, router, endpoint }: sendProps) => Promise<any>;
41
47
  sendCode: ({ phone }: PhoneOnly) => Promise<string | null>;
42
48
  checkCode: ({ reqId, code, body, router, endpoint, }: CheckCodeProps) => Promise<CheckCodeResponse>;
43
49
  sendPhoneCallRequest: (body: LeadRequest, endpoint?: EndpointType) => Promise<any>;
44
50
  };
51
+ export declare const LeadServiceFetch: (url: string, submitBody: SubmitBody) => Promise<Response>;
45
52
  export {};
@@ -0,0 +1,8 @@
1
+ export declare type UserSurveyRequest = {
2
+ rate: number;
3
+ reason?: string;
4
+ message?: string;
5
+ url: string;
6
+ type: string;
7
+ };
8
+ export declare const sendUserSurvey: (body: UserSurveyRequest) => Promise<Response | null>;
@@ -1345,6 +1345,7 @@
1345
1345
  const DIALOG_STYLE = {
1346
1346
  sm: 'max-w-sm top-1/3',
1347
1347
  lg: 'max-w-lg',
1348
+ xl: 'max-w-xl',
1348
1349
  '4xl': 'max-w-4xl',
1349
1350
  none: 'mt-0',
1350
1351
  };
@@ -3322,7 +3323,7 @@
3322
3323
  horizontal: '@lg:flex-row',
3323
3324
  vertical: '',
3324
3325
  };
3325
- const RadioButtonGroup = JSX(({ label, items, value, className, disabled = false, orientation = 'horizontal', onChange: onChangeCheckedItem, }) => (jsxs("div", { className: "grid gap-xs whitespace-nowrap", children: [label ? (jsx("div", { role: "radiogroup", "aria-label": label, children: jsx(Text, { color: "text-secondary-text", font: "font-light", children: label }) })) : null, jsx("div", { className: style('flex flex-col gap-s', orientationStyleMap[orientation], className), role: "radiogroup", "aria-label": "\u0413\u0440\u0443\u043F\u043F\u0430 \u043A\u043D\u043E\u043F\u043E\u043A", children: items?.map(({ id, text }) => (jsx(Checkbox, { isRadio: true, text: text, value: value === id, onChange: () => onChangeCheckedItem?.(id), disabled: disabled, name: id }, String(id)))) })] })));
3326
+ const RadioButtonGroup = JSX(({ label, items, value, className, disabled = false, orientation = 'horizontal', onChange: onChangeCheckedItem, }) => (jsxs("div", { className: "grid gap-xs whitespace-nowrap", children: [label ? (jsx("div", { role: "radiogroup", "aria-label": label, children: jsx(Text, { color: "text-secondary-text", font: "font-light", children: label }) })) : null, jsx("div", { className: style('flex flex-col gap-s', orientationStyleMap[orientation], className), role: "radiogroup", "aria-label": "\u0413\u0440\u0443\u043F\u043F\u0430 \u043A\u043D\u043E\u043F\u043E\u043A", children: items?.map(({ id, text }) => (jsx(Checkbox, { isRadio: true, text: text, value: value === id, onChange: () => onChangeCheckedItem?.(id, text), disabled: disabled, name: id }, String(id)))) })] })));
3326
3327
 
3327
3328
  const VedField = JSX(({ field, input }) => {
3328
3329
  const handleChange = useCallback((_) => {
@@ -11021,7 +11022,7 @@
11021
11022
  DELIVERY_CREDIT_CARD_CONTENT,
11022
11023
  ];
11023
11024
 
11024
- const STEPS$2 = 6;
11025
+ const STEPS$3 = 6;
11025
11026
  const TITLES = [
11026
11027
  'Параметры карты',
11027
11028
  'Персональные данные',
@@ -11036,7 +11037,7 @@
11036
11037
  const scrollToTop = useCallback(() => formContainerRef?.current?.scrollIntoView({ behavior: 'smooth' }), [formContainerRef]);
11037
11038
  useEffect(updateRefreshToken, []);
11038
11039
  const handleNextStep = useCallback(() => {
11039
- setStep((_) => Math.min(_ + 1, STEPS$2));
11040
+ setStep((_) => Math.min(_ + 1, STEPS$3));
11040
11041
  scrollToTop();
11041
11042
  }, []);
11042
11043
  const handlePrevStep = useCallback(() => {
@@ -11046,7 +11047,7 @@
11046
11047
  }, []);
11047
11048
  const sections = stepsSectionsMap$2[step];
11048
11049
  const [isFormFinished, { setTrue: handleFinish }] = useBool(false);
11049
- return (jsx(BlockWrapper, { className: className, ...rest, children: jsxs("div", { ref: formContainerRef, className: "container grid grid-cols-12", children: [isFormFinished ? null : (jsx(CreditCardFormProgress, { stepsTitles: TITLES, step: step, totalSteps: STEPS$2 })), jsx("div", { className: "py-lg px-5xl mt-2xs bg-white col-span-12", children: isFormFinished ? (jsx(CreditCardFormStatusTracker, {})) : (jsx(CreditCardFormStep, { step: step, sections: sections, onNextStep: handleNextStep, onPrevStep: handlePrevStep, onFinish: handleFinish }, String(step))) })] }) }));
11050
+ return (jsx(BlockWrapper, { className: className, ...rest, children: jsxs("div", { ref: formContainerRef, className: "container grid grid-cols-12", children: [isFormFinished ? null : (jsx(CreditCardFormProgress, { stepsTitles: TITLES, step: step, totalSteps: STEPS$3 })), jsx("div", { className: "py-lg px-5xl mt-2xs bg-white col-span-12", children: isFormFinished ? (jsx(CreditCardFormStatusTracker, {})) : (jsx(CreditCardFormStep, { step: step, sections: sections, onNextStep: handleNextStep, onPrevStep: handlePrevStep, onFinish: handleFinish }, String(step))) })] }) }));
11050
11051
  });
11051
11052
 
11052
11053
  const CreditFormProgress = JSX(({ step = 1, totalSteps = 5, stepsTitles = [] }) => {
@@ -11607,7 +11608,7 @@
11607
11608
  DELIVERY_CREDIT_CONTENT,
11608
11609
  ];
11609
11610
 
11610
- const STEPS$1 = 4;
11611
+ const STEPS$2 = 4;
11611
11612
  const STEP_TITLES$1 = [
11612
11613
  '',
11613
11614
  'Персональные данные',
@@ -11621,7 +11622,7 @@
11621
11622
  const scrollToTop = useCallback(() => formContainerRef?.current?.scrollIntoView({ behavior: 'smooth' }), [formContainerRef]);
11622
11623
  useEffect(updateRefreshToken, []);
11623
11624
  const handleNextStep = useCallback(() => {
11624
- setStep((_) => Math.min(_ + 1, STEPS$1));
11625
+ setStep((_) => Math.min(_ + 1, STEPS$2));
11625
11626
  scrollToTop();
11626
11627
  }, []);
11627
11628
  const handlePrevStep = useCallback(() => {
@@ -11632,7 +11633,7 @@
11632
11633
  const sections = stepsSectionsMap$1[step];
11633
11634
  const isStartStep = step === 0;
11634
11635
  const [isFormFinished, { setTrue: handleFinish }] = useBool(false);
11635
- return (jsx(BlockWrapper, { className: className, ...rest, children: jsxs("div", { ref: formContainerRef, className: "container grid grid-cols-12", children: [isStartStep || isFormFinished ? null : (jsx(CreditFormProgress, { stepsTitles: STEP_TITLES$1, step: step, totalSteps: STEPS$1 })), jsx("div", { className: "py-lg px-5xl mt-2xs bg-white col-span-12", children: isFormFinished ? (jsx(CreditFormStatusTracker, {})) : (jsx(CreditFormStep, { step: step, sections: sections, programsSource: programsSource, onNextStep: handleNextStep, onPrevStep: handlePrevStep, onFinish: handleFinish }, String(step))) })] }) }));
11636
+ return (jsx(BlockWrapper, { className: className, ...rest, children: jsxs("div", { ref: formContainerRef, className: "container grid grid-cols-12", children: [isStartStep || isFormFinished ? null : (jsx(CreditFormProgress, { stepsTitles: STEP_TITLES$1, step: step, totalSteps: STEPS$2 })), jsx("div", { className: "py-lg px-5xl mt-2xs bg-white col-span-12", children: isFormFinished ? (jsx(CreditFormStatusTracker, {})) : (jsx(CreditFormStep, { step: step, sections: sections, programsSource: programsSource, onNextStep: handleNextStep, onPrevStep: handlePrevStep, onFinish: handleFinish }, String(step))) })] }) }));
11636
11637
  });
11637
11638
 
11638
11639
  const DebitFormProgress = JSX(({ step = 1, totalSteps = 2, stepsTitles = [] }) => {
@@ -12175,7 +12176,7 @@
12175
12176
  DEBIT_CARD_CONTENT,
12176
12177
  ];
12177
12178
 
12178
- const STEPS = 2;
12179
+ const STEPS$1 = 2;
12179
12180
  const STEP_TITLES = ['', 'Персональные данные', 'Платежная система'];
12180
12181
  const DebitForm = UniBlock(({ className, ...rest }) => {
12181
12182
  const [step, setStep] = useState(0);
@@ -12183,7 +12184,7 @@
12183
12184
  const scrollToTop = useCallback(() => formContainerRef?.current?.scrollIntoView({ behavior: 'smooth' }), [formContainerRef]);
12184
12185
  useEffect(updateRefreshToken, []);
12185
12186
  const handleNextStep = useCallback(() => {
12186
- setStep((_) => Math.min(_ + 1, STEPS));
12187
+ setStep((_) => Math.min(_ + 1, STEPS$1));
12187
12188
  scrollToTop();
12188
12189
  }, []);
12189
12190
  const handlePrevStep = useCallback(() => {
@@ -12198,7 +12199,7 @@
12198
12199
  setIsFormFinished();
12199
12200
  scrollToTop();
12200
12201
  }, []);
12201
- return (jsx(BlockWrapper, { className: className, ...rest, children: jsxs("div", { ref: formContainerRef, className: "container grid grid-cols-12", children: [isStartStep || isFormFinished ? null : (jsx(DebitFormProgress, { stepsTitles: STEP_TITLES, step: step, totalSteps: STEPS })), jsx("div", { className: "py-lg px-5xl mt-2xs bg-white col-span-12", children: isFormFinished ? (jsx(DebitFormStatusTracker, {})) : (jsx(DebitFormStep, { step: step, sections: sections, onNextStep: handleNextStep, onPrevStep: handlePrevStep, onFinish: handleFinish }, String(step))) })] }) }));
12202
+ return (jsx(BlockWrapper, { className: className, ...rest, children: jsxs("div", { ref: formContainerRef, className: "container grid grid-cols-12", children: [isStartStep || isFormFinished ? null : (jsx(DebitFormProgress, { stepsTitles: STEP_TITLES, step: step, totalSteps: STEPS$1 })), jsx("div", { className: "py-lg px-5xl mt-2xs bg-white col-span-12", children: isFormFinished ? (jsx(DebitFormStatusTracker, {})) : (jsx(DebitFormStep, { step: step, sections: sections, onNextStep: handleNextStep, onPrevStep: handlePrevStep, onFinish: handleFinish }, String(step))) })] }) }));
12202
12203
  });
12203
12204
 
12204
12205
  const isRateRow = (rateRow) => typeof rateRow?.minMonths === 'number' && typeof rateRow?.maxMonths === 'number';
@@ -14131,6 +14132,128 @@
14131
14132
  }, role: "dialog", title: "\u0412\u0441\u043F\u043B\u044B\u0432\u0430\u044E\u0449\u0435\u0435 \u043E\u043A\u043D\u043E", children: popup.popup })) : null;
14132
14133
  });
14133
14134
 
14135
+ const sendUserSurvey = async (body) => {
14136
+ try {
14137
+ const response = await LeadServiceFetch(`${API_BASE_URI}/survey`, body);
14138
+ return await response;
14139
+ }
14140
+ catch (e) {
14141
+ return null;
14142
+ }
14143
+ };
14144
+
14145
+ const FinalStep = JSX(() => {
14146
+ return (jsxs("div", { className: "flex flex-col items-center", children: [jsx(Heading, { className: "text-center", headingType: "h5", title: "\u0421\u043F\u0430\u0441\u0438\u0431\u043E \u0437\u0430 \u0443\u0447\u0430\u0441\u0442\u0438\u0435!" }), jsx(Paragraph, { children: "\u0412\u0430\u0448\u0435 \u043C\u043D\u0435\u043D\u0438\u0435 \u043E\u0447\u0435\u043D\u044C \u0432\u0430\u0436\u043D\u043E \u0434\u043B\u044F \u043D\u0430\u0441" })] }));
14147
+ });
14148
+
14149
+ const Star = JSX(({ value, hover, rating, setHover, setRating }) => {
14150
+ const fillColor = value <= (hover || rating) ? '#42AB44' : '#C9CACC';
14151
+ return (jsx("div", { onClick: () => setRating?.(value), onMouseEnter: () => setHover?.(value), onMouseLeave: () => setHover?.(null), children: jsx("svg", { "data-rating": value, fill: fillColor, width: "57", height: "57", viewBox: "0 0 57 57", children: jsx("path", { d: "M47.7803 18.2879L47.7836 18.2884C50.566 18.7521 53.0867 20.1374 53.9176 22.7226C54.7498 25.3116 53.5025 27.9027 51.4977 29.8954L51.4942 29.8989L45.7132 35.6799C45.5729 35.8202 45.3591 36.1532 45.2186 36.6438C45.0796 37.1295 45.0808 37.5314 45.1257 37.7381L45.1268 37.743L46.78 44.8909C47.4787 47.9228 47.3175 51.2217 44.8924 52.9896C42.4714 54.7546 39.2808 53.9093 36.5999 52.3257L29.6214 48.1946C29.4392 48.0866 29.0426 47.96 28.5087 47.96C27.9816 47.96 27.5736 48.0831 27.3687 48.2004L27.3634 48.2035L20.4041 52.3232L20.4019 52.3246C17.7218 53.9145 14.5351 54.7459 12.1155 52.9803C9.69339 51.213 9.51826 47.9236 10.22 44.8909L11.8731 37.743L11.8743 37.7379C11.9191 37.5311 11.9203 37.1293 11.7813 36.6438C11.6409 36.1532 11.4271 35.8202 11.2867 35.6799L5.50006 29.8932C3.50738 27.9006 2.26429 25.3118 3.08972 22.7269C3.91586 20.1398 6.43161 18.7525 9.21638 18.2884L16.6527 17.0529L16.6552 17.0525C16.8169 17.0243 17.1619 16.8935 17.5523 16.604C17.945 16.3128 18.1668 16.022 18.2378 15.877L18.2462 15.8598L22.3508 7.65087L22.352 7.6485C23.629 5.08222 25.7146 3.01416 28.4796 3.01416C31.2412 3.01416 33.3328 5.07832 34.6215 7.64213L34.6236 7.64649L38.7303 15.8598L38.75 15.9001C38.7884 15.9807 38.8225 16.0591 38.8511 16.1283C38.9197 16.1891 39.0148 16.2702 39.1464 16.3781C39.1829 16.394 39.242 16.4185 39.3288 16.4505C39.5779 16.5424 39.9286 16.6512 40.3732 16.7719C41.2573 17.0121 42.3688 17.2611 43.4823 17.4894C44.5886 17.7163 45.6648 17.9163 46.4667 18.0598C46.8669 18.1315 47.1972 18.1888 47.4266 18.2281L47.6909 18.2729L47.7589 18.2843L47.7803 18.2879Z" }) }) }));
14152
+ });
14153
+
14154
+ const stars$1 = new Array(5).fill(Star);
14155
+ const TITLE$1 = {
14156
+ NPS: 'Оцените, пожалуйста, от 1 до 5 насколько вероятно, что вы порекомендуете Россельхозбанк коллегам, друзьям и знакомым?',
14157
+ CSI: 'Оцените, пожалуйста, удовлетворённость пользования сайтом',
14158
+ };
14159
+ const FirstStep = JSX(({ currentRating, surveyType, isSending, setCurrentRating, onNextStep, onSubmit }) => {
14160
+ const [currentHover, setCurrentHover] = useState();
14161
+ const setRatingFn = (value) => {
14162
+ setCurrentRating(value);
14163
+ if (value < 5) {
14164
+ onNextStep();
14165
+ }
14166
+ };
14167
+ return (jsxs("div", { className: "flex flex-col gap-xl items-center", children: [jsx(Heading, { className: "text-center", headingType: "h5", title: TITLE$1[surveyType] }), jsx("div", { className: "flex justify-center", children: stars$1.map((StarItem, index) => (jsx(StarItem, { value: index + 1, rating: currentRating, hover: currentHover, setRating: setRatingFn, setHover: setCurrentHover, className: "modal-feedback__star" }, index))) }), currentRating === 5 ? (jsx(SubmitButton$1, { onClick: () => onSubmit(), isLoading: isSending, children: "\u041E\u0442\u043F\u0440\u0430\u0432\u0438\u0442\u044C" })) : null] }));
14168
+ });
14169
+
14170
+ const stars = new Array(5).fill(Star);
14171
+ const TITLE = 'Что бы мы могли улучшить?';
14172
+ const SecondStep = JSX(({ currentRating, currentReason, reasons = [], isSending, setCurrentReason, onSubmit }) => {
14173
+ const [comment, setComment] = useState();
14174
+ const handleReasonChange = (id, text) => {
14175
+ setCurrentReason?.({
14176
+ id,
14177
+ text,
14178
+ });
14179
+ };
14180
+ return (jsxs("div", { className: "flex flex-col gap-xl items-center", children: [jsx(Heading, { className: "text-center", headingType: "h5", title: TITLE }), jsx("div", { className: "flex justify-center", children: stars.map((StarItem, index) => (jsx(StarItem, { value: index + 1, rating: currentRating }, index))) }), jsx(RadioButtonGroup, { className: "w-full text-wrap", orientation: "vertical", items: reasons, value: currentReason?.id, onChange: handleReasonChange }), currentReason?.text === 'Другое' ? (jsx(Input, { className: "w-full", placeholder: "\u041D\u0430\u043F\u0438\u0448\u0438\u0442\u0435, \u043F\u043E\u0436\u0430\u043B\u0443\u0439\u0441\u0442\u0430, \u0441\u0432\u043E\u0439 \u0432\u0430\u0440\u0438\u0430\u043D\u0442 \u043E\u0442\u0432\u0435\u0442\u0430", isTextarea: true, value: comment, onChange: setComment, maxLength: 255 })) : null, currentReason ? (jsx(SubmitButton$1, { onClick: () => onSubmit(comment), isLoading: isSending, children: "\u041E\u0442\u043F\u0440\u0430\u0432\u0438\u0442\u044C" })) : null] }));
14181
+ });
14182
+
14183
+ const STEPS = [FirstStep, SecondStep, FinalStep];
14184
+ const LAST_STEP_INDEX = 2;
14185
+ const UserSurveyDialog = UniBlock(({ onClose = noop, reasonsSource = {} }) => {
14186
+ const [isSending, { setTrue: startSending, setFalse: endSending }] = useBool(false);
14187
+ const [currentRating, setCurrentRating] = useState(0);
14188
+ const [currentReason, setCurrentReason] = useState();
14189
+ const [step, setStep] = useState(0);
14190
+ const userSurveyStore = useLocalStore();
14191
+ const surveyType = userSurveyStore.userSurvey?.lastShownType ?? 'NPS';
14192
+ const { reasons } = reasonsSource;
14193
+ const ActiveStep = STEPS[step];
14194
+ const handleNextStep = useCallback(() => {
14195
+ setStep((_) => _ + 1);
14196
+ }, []);
14197
+ const handleSubmit = useCallback(async (message) => {
14198
+ startSending();
14199
+ await sendUserSurvey({
14200
+ rate: currentRating,
14201
+ reason: currentReason?.text,
14202
+ message: getMessage(currentReason, message),
14203
+ url: globalThis.location.href,
14204
+ type: surveyType,
14205
+ });
14206
+ endSending();
14207
+ setStep(LAST_STEP_INDEX);
14208
+ }, [currentRating, currentReason]);
14209
+ return (jsx(Dialog, { maxWidth: "xl", onClose: onClose, children: jsx(ActiveStep, { currentRating: currentRating, currentReason: currentReason, reasons: reasons, surveyType: surveyType, isSending: isSending, setCurrentReason: setCurrentReason, setCurrentRating: setCurrentRating, onSubmit: handleSubmit, onNextStep: handleNextStep }) }));
14210
+ });
14211
+ const getMessage = (currentReason, message) => {
14212
+ if (currentReason?.text !== 'Другое') {
14213
+ return undefined;
14214
+ }
14215
+ return message?.length ? message : 'Другое. Клиент не оставил комментариев';
14216
+ };
14217
+
14218
+ const DELAY = 5 * 60 * 1000;
14219
+ // Хук отвечает за показ пользователю опроса
14220
+ const useUserSurveyDialog = () => {
14221
+ const userSurveyDialog = useDialog(UserSurveyDialog);
14222
+ const userSurveyStore = useLocalStore();
14223
+ const sessionStore = useSessionStore();
14224
+ const elapsedTime = sessionStore.surveyTimerStart
14225
+ ? Date.now() - Number.parseInt(sessionStore.surveyTimerStart)
14226
+ : 0;
14227
+ const openUserSurveyDialog = () => {
14228
+ userSurveyStore.userSurvey = {
14229
+ lastShownType: userSurveyStore.userSurvey?.lastShownType === 'NPS' ? 'CSI' : 'NPS',
14230
+ nextDueAt: getTimeAfter30days(),
14231
+ };
14232
+ userSurveyDialog.open({
14233
+ reasonsSource: {
14234
+ $ref: '/wcms-resources/user-survey-reasons.json',
14235
+ },
14236
+ });
14237
+ };
14238
+ useEffect(() => {
14239
+ // Опрос показывается только если ранее пользоваютелю не показывался опрос или с того момента прошел месяц
14240
+ if (!userSurveyStore.userSurvey || userSurveyStore.userSurvey?.nextDueAt <= Date.now()) {
14241
+ // начинаем отсчитывать время от первого захода на сайт
14242
+ if (!sessionStore.surveyTimerStart) {
14243
+ sessionStore.surveyTimerStart = Date.now().toString();
14244
+ }
14245
+ // Опрос показывается спустя 5 минут нахождения на сайте
14246
+ const timeout = setTimeout(openUserSurveyDialog, DELAY - elapsedTime);
14247
+ return () => {
14248
+ clearTimeout(timeout);
14249
+ };
14250
+ }
14251
+ return noop;
14252
+ }, []);
14253
+ };
14254
+ // Отсчитываем месяц с текущей даты
14255
+ const getTimeAfter30days = () => Date.now() + 30 * 24 * 60 * 60 * 1000;
14256
+
14134
14257
  const HEADER_SLOT = 'header';
14135
14258
  const FOOTER_SLOT = 'footer';
14136
14259
  const STICKY_FOOTER_SLOT = 'sticky-footer';
@@ -14141,6 +14264,7 @@
14141
14264
  const isFrame = isIFrame();
14142
14265
  useClickHandler();
14143
14266
  useDefaultLocation();
14267
+ useUserSurveyDialog();
14144
14268
  const options = {
14145
14269
  key: '',
14146
14270
  page: { slots, blocks, fallback, ...resolvedPageContent },
@@ -14163,7 +14287,7 @@
14163
14287
  slots: () => [HEADER_SLOT, FOOTER_SLOT, STICKY_FOOTER_SLOT],
14164
14288
  });
14165
14289
 
14166
- const packageVersion = "0.14.1013";
14290
+ const packageVersion = "0.14.1014";
14167
14291
 
14168
14292
  exports.Blocks = Blocks;
14169
14293
  exports.ContentPage = ContentPage;