@redneckz/wildless-cms-uni-blocks 0.14.713 → 0.14.715

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 (233) hide show
  1. package/bundle/bundle.umd.js +47 -36
  2. package/bundle/bundle.umd.min.js +1 -1
  3. package/bundle/components/ApplicationLeadForm/renderSubmitButton.d.ts +1 -1
  4. package/bundle/components/ApplicationLeadForm/useApplicationLeadApi.d.ts +1 -0
  5. package/bundle/components/CreditCardForm/StepsNavigationButtons.d.ts +1 -0
  6. package/bundle/components/CreditCardForm/useCreditCardFormAPI.d.ts +1 -1
  7. package/bundle/components/CreditForm/StepsNavigationButtons.d.ts +1 -0
  8. package/bundle/components/CreditForm/useCreditFormAPI.d.ts +1 -1
  9. package/bundle/hooks/useAsyncEffect.d.ts +1 -0
  10. package/bundle/services/retail/mockLocalStorage.d.ts +1 -0
  11. package/bundle/ui-kit/Button/Button.d.ts +1 -0
  12. package/bundle/ui-kit/Loader/Loader.d.ts +1 -0
  13. package/dist/api/RetailAPI/sendCode.js +3 -4
  14. package/dist/api/RetailAPI/sendCode.js.map +1 -1
  15. package/dist/components/ApplicationLeadForm/ApplicationLeadForm.js +2 -2
  16. package/dist/components/ApplicationLeadForm/ApplicationLeadForm.js.map +1 -1
  17. package/dist/components/ApplicationLeadForm/renderSubmitButton.d.ts +1 -1
  18. package/dist/components/ApplicationLeadForm/renderSubmitButton.js +1 -1
  19. package/dist/components/ApplicationLeadForm/renderSubmitButton.js.map +1 -1
  20. package/dist/components/ApplicationLeadForm/useApplicationLeadApi.d.ts +1 -0
  21. package/dist/components/ApplicationLeadForm/useApplicationLeadApi.js +10 -7
  22. package/dist/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
  23. package/dist/components/CreditCardForm/CreditCardFormStep.js +2 -2
  24. package/dist/components/CreditCardForm/CreditCardFormStep.js.map +1 -1
  25. package/dist/components/CreditCardForm/StepsNavigationButtons.d.ts +1 -0
  26. package/dist/components/CreditCardForm/StepsNavigationButtons.js +2 -2
  27. package/dist/components/CreditCardForm/StepsNavigationButtons.js.map +1 -1
  28. package/dist/components/CreditCardForm/useCreditCardFormAPI.d.ts +1 -1
  29. package/dist/components/CreditCardForm/useCreditCardFormAPI.js +7 -1
  30. package/dist/components/CreditCardForm/useCreditCardFormAPI.js.map +1 -1
  31. package/dist/components/CreditForm/CreditFormStep.js +2 -2
  32. package/dist/components/CreditForm/CreditFormStep.js.map +1 -1
  33. package/dist/components/CreditForm/StepsNavigationButtons.d.ts +1 -0
  34. package/dist/components/CreditForm/StepsNavigationButtons.js +2 -2
  35. package/dist/components/CreditForm/StepsNavigationButtons.js.map +1 -1
  36. package/dist/components/CreditForm/useCreditFormAPI.d.ts +1 -1
  37. package/dist/components/CreditForm/useCreditFormAPI.js +7 -1
  38. package/dist/components/CreditForm/useCreditFormAPI.js.map +1 -1
  39. package/dist/hooks/useAsyncEffect.d.ts +1 -0
  40. package/dist/hooks/useAsyncEffect.js +15 -0
  41. package/dist/hooks/useAsyncEffect.js.map +1 -0
  42. package/dist/services/retail/mockLocalStorage.d.ts +1 -0
  43. package/dist/services/retail/mockLocalStorage.js +35 -0
  44. package/dist/services/retail/mockLocalStorage.js.map +1 -0
  45. package/dist/setup-fixture.js +11 -0
  46. package/dist/setup-fixture.js.map +1 -1
  47. package/dist/ui-kit/Button/Button.d.ts +1 -0
  48. package/dist/ui-kit/Button/Button.js +6 -5
  49. package/dist/ui-kit/Button/Button.js.map +1 -1
  50. package/dist/ui-kit/Loader/Loader.d.ts +1 -0
  51. package/dist/ui-kit/Loader/Loader.js +2 -2
  52. package/dist/ui-kit/Loader/Loader.js.map +1 -1
  53. package/dist/ui-kit/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.js +5 -4
  54. package/dist/ui-kit/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.js.map +1 -1
  55. package/lib/api/RetailAPI/sendCode.js +4 -5
  56. package/lib/api/RetailAPI/sendCode.js.map +1 -1
  57. package/lib/components/ApplicationLeadForm/ApplicationLeadForm.js +2 -2
  58. package/lib/components/ApplicationLeadForm/ApplicationLeadForm.js.map +1 -1
  59. package/lib/components/ApplicationLeadForm/renderSubmitButton.d.ts +1 -1
  60. package/lib/components/ApplicationLeadForm/renderSubmitButton.js +1 -1
  61. package/lib/components/ApplicationLeadForm/renderSubmitButton.js.map +1 -1
  62. package/lib/components/ApplicationLeadForm/useApplicationLeadApi.d.ts +1 -0
  63. package/lib/components/ApplicationLeadForm/useApplicationLeadApi.js +10 -7
  64. package/lib/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
  65. package/lib/components/CreditCardForm/CreditCardForm.fixture.d.ts +1 -1
  66. package/lib/components/CreditCardForm/CreditCardForm.fixture.mobile.d.ts +1 -1
  67. package/lib/components/CreditCardForm/CreditCardFormStep.js +2 -2
  68. package/lib/components/CreditCardForm/CreditCardFormStep.js.map +1 -1
  69. package/lib/components/CreditCardForm/StepsNavigationButtons.d.ts +1 -0
  70. package/lib/components/CreditCardForm/StepsNavigationButtons.js +2 -2
  71. package/lib/components/CreditCardForm/StepsNavigationButtons.js.map +1 -1
  72. package/lib/components/CreditCardForm/useCreditCardFormAPI.d.ts +1 -1
  73. package/lib/components/CreditCardForm/useCreditCardFormAPI.js +7 -1
  74. package/lib/components/CreditCardForm/useCreditCardFormAPI.js.map +1 -1
  75. package/lib/components/CreditForm/CreditForm.fixture.d.ts +1 -1
  76. package/lib/components/CreditForm/CreditForm.fixture.mobile.d.ts +1 -1
  77. package/lib/components/CreditForm/CreditFormStep.js +2 -2
  78. package/lib/components/CreditForm/CreditFormStep.js.map +1 -1
  79. package/lib/components/CreditForm/StepsNavigationButtons.d.ts +1 -0
  80. package/lib/components/CreditForm/StepsNavigationButtons.js +2 -2
  81. package/lib/components/CreditForm/StepsNavigationButtons.js.map +1 -1
  82. package/lib/components/CreditForm/useCreditFormAPI.d.ts +1 -1
  83. package/lib/components/CreditForm/useCreditFormAPI.js +7 -1
  84. package/lib/components/CreditForm/useCreditFormAPI.js.map +1 -1
  85. package/lib/hooks/useAsyncEffect.d.ts +1 -0
  86. package/lib/hooks/useAsyncEffect.js +12 -0
  87. package/lib/hooks/useAsyncEffect.js.map +1 -0
  88. package/lib/services/retail/mockLocalStorage.d.ts +1 -0
  89. package/lib/services/retail/mockLocalStorage.js +32 -0
  90. package/lib/services/retail/mockLocalStorage.js.map +1 -0
  91. package/lib/setup-fixture.js +11 -0
  92. package/lib/setup-fixture.js.map +1 -1
  93. package/lib/ui-kit/Button/Button.d.ts +1 -0
  94. package/lib/ui-kit/Button/Button.js +7 -6
  95. package/lib/ui-kit/Button/Button.js.map +1 -1
  96. package/lib/ui-kit/Loader/Loader.d.ts +1 -0
  97. package/lib/ui-kit/Loader/Loader.js +2 -2
  98. package/lib/ui-kit/Loader/Loader.js.map +1 -1
  99. package/lib/ui-kit/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.js +5 -4
  100. package/lib/ui-kit/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.js.map +1 -1
  101. package/mobile/bundle/bundle.umd.js +47 -36
  102. package/mobile/bundle/bundle.umd.min.js +1 -1
  103. package/mobile/bundle/components/ApplicationLeadForm/renderSubmitButton.d.ts +1 -1
  104. package/mobile/bundle/components/ApplicationLeadForm/useApplicationLeadApi.d.ts +1 -0
  105. package/mobile/bundle/components/CreditCardForm/StepsNavigationButtons.d.ts +1 -0
  106. package/mobile/bundle/components/CreditCardForm/useCreditCardFormAPI.d.ts +1 -1
  107. package/mobile/bundle/components/CreditForm/StepsNavigationButtons.d.ts +1 -0
  108. package/mobile/bundle/components/CreditForm/useCreditFormAPI.d.ts +1 -1
  109. package/mobile/bundle/hooks/useAsyncEffect.d.ts +1 -0
  110. package/mobile/bundle/services/retail/mockLocalStorage.d.ts +1 -0
  111. package/mobile/bundle/ui-kit/Button/Button.d.ts +1 -0
  112. package/mobile/bundle/ui-kit/Loader/Loader.d.ts +1 -0
  113. package/mobile/dist/api/RetailAPI/sendCode.js +3 -4
  114. package/mobile/dist/api/RetailAPI/sendCode.js.map +1 -1
  115. package/mobile/dist/components/ApplicationLeadForm/ApplicationLeadForm.js +2 -2
  116. package/mobile/dist/components/ApplicationLeadForm/ApplicationLeadForm.js.map +1 -1
  117. package/mobile/dist/components/ApplicationLeadForm/renderSubmitButton.d.ts +1 -1
  118. package/mobile/dist/components/ApplicationLeadForm/renderSubmitButton.js +1 -1
  119. package/mobile/dist/components/ApplicationLeadForm/renderSubmitButton.js.map +1 -1
  120. package/mobile/dist/components/ApplicationLeadForm/useApplicationLeadApi.d.ts +1 -0
  121. package/mobile/dist/components/ApplicationLeadForm/useApplicationLeadApi.js +10 -7
  122. package/mobile/dist/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
  123. package/mobile/dist/components/CreditCardForm/CreditCardFormStep.js +2 -2
  124. package/mobile/dist/components/CreditCardForm/CreditCardFormStep.js.map +1 -1
  125. package/mobile/dist/components/CreditCardForm/StepsNavigationButtons.d.ts +1 -0
  126. package/mobile/dist/components/CreditCardForm/StepsNavigationButtons.js +2 -2
  127. package/mobile/dist/components/CreditCardForm/StepsNavigationButtons.js.map +1 -1
  128. package/mobile/dist/components/CreditCardForm/useCreditCardFormAPI.d.ts +1 -1
  129. package/mobile/dist/components/CreditCardForm/useCreditCardFormAPI.js +7 -1
  130. package/mobile/dist/components/CreditCardForm/useCreditCardFormAPI.js.map +1 -1
  131. package/mobile/dist/components/CreditForm/CreditFormStep.js +2 -2
  132. package/mobile/dist/components/CreditForm/CreditFormStep.js.map +1 -1
  133. package/mobile/dist/components/CreditForm/StepsNavigationButtons.d.ts +1 -0
  134. package/mobile/dist/components/CreditForm/StepsNavigationButtons.js +2 -2
  135. package/mobile/dist/components/CreditForm/StepsNavigationButtons.js.map +1 -1
  136. package/mobile/dist/components/CreditForm/useCreditFormAPI.d.ts +1 -1
  137. package/mobile/dist/components/CreditForm/useCreditFormAPI.js +7 -1
  138. package/mobile/dist/components/CreditForm/useCreditFormAPI.js.map +1 -1
  139. package/mobile/dist/hooks/useAsyncEffect.d.ts +1 -0
  140. package/mobile/dist/hooks/useAsyncEffect.js +15 -0
  141. package/mobile/dist/hooks/useAsyncEffect.js.map +1 -0
  142. package/mobile/dist/services/retail/mockLocalStorage.d.ts +1 -0
  143. package/mobile/dist/services/retail/mockLocalStorage.js +35 -0
  144. package/mobile/dist/services/retail/mockLocalStorage.js.map +1 -0
  145. package/mobile/dist/setup-fixture.js +11 -0
  146. package/mobile/dist/setup-fixture.js.map +1 -1
  147. package/mobile/dist/ui-kit/Button/Button.d.ts +1 -0
  148. package/mobile/dist/ui-kit/Button/Button.js +6 -5
  149. package/mobile/dist/ui-kit/Button/Button.js.map +1 -1
  150. package/mobile/dist/ui-kit/Loader/Loader.d.ts +1 -0
  151. package/mobile/dist/ui-kit/Loader/Loader.js +2 -2
  152. package/mobile/dist/ui-kit/Loader/Loader.js.map +1 -1
  153. package/mobile/dist/ui-kit/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.js +5 -4
  154. package/mobile/dist/ui-kit/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.js.map +1 -1
  155. package/mobile/lib/api/RetailAPI/sendCode.js +4 -5
  156. package/mobile/lib/api/RetailAPI/sendCode.js.map +1 -1
  157. package/mobile/lib/components/ApplicationLeadForm/ApplicationLeadForm.js +2 -2
  158. package/mobile/lib/components/ApplicationLeadForm/ApplicationLeadForm.js.map +1 -1
  159. package/mobile/lib/components/ApplicationLeadForm/renderSubmitButton.d.ts +1 -1
  160. package/mobile/lib/components/ApplicationLeadForm/renderSubmitButton.js +1 -1
  161. package/mobile/lib/components/ApplicationLeadForm/renderSubmitButton.js.map +1 -1
  162. package/mobile/lib/components/ApplicationLeadForm/useApplicationLeadApi.d.ts +1 -0
  163. package/mobile/lib/components/ApplicationLeadForm/useApplicationLeadApi.js +10 -7
  164. package/mobile/lib/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
  165. package/mobile/lib/components/CreditCardForm/CreditCardFormStep.js +2 -2
  166. package/mobile/lib/components/CreditCardForm/CreditCardFormStep.js.map +1 -1
  167. package/mobile/lib/components/CreditCardForm/StepsNavigationButtons.d.ts +1 -0
  168. package/mobile/lib/components/CreditCardForm/StepsNavigationButtons.js +2 -2
  169. package/mobile/lib/components/CreditCardForm/StepsNavigationButtons.js.map +1 -1
  170. package/mobile/lib/components/CreditCardForm/useCreditCardFormAPI.d.ts +1 -1
  171. package/mobile/lib/components/CreditCardForm/useCreditCardFormAPI.js +7 -1
  172. package/mobile/lib/components/CreditCardForm/useCreditCardFormAPI.js.map +1 -1
  173. package/mobile/lib/components/CreditForm/CreditFormStep.js +2 -2
  174. package/mobile/lib/components/CreditForm/CreditFormStep.js.map +1 -1
  175. package/mobile/lib/components/CreditForm/StepsNavigationButtons.d.ts +1 -0
  176. package/mobile/lib/components/CreditForm/StepsNavigationButtons.js +2 -2
  177. package/mobile/lib/components/CreditForm/StepsNavigationButtons.js.map +1 -1
  178. package/mobile/lib/components/CreditForm/useCreditFormAPI.d.ts +1 -1
  179. package/mobile/lib/components/CreditForm/useCreditFormAPI.js +7 -1
  180. package/mobile/lib/components/CreditForm/useCreditFormAPI.js.map +1 -1
  181. package/mobile/lib/hooks/useAsyncEffect.d.ts +1 -0
  182. package/mobile/lib/hooks/useAsyncEffect.js +12 -0
  183. package/mobile/lib/hooks/useAsyncEffect.js.map +1 -0
  184. package/mobile/lib/services/retail/mockLocalStorage.d.ts +1 -0
  185. package/mobile/lib/services/retail/mockLocalStorage.js +32 -0
  186. package/mobile/lib/services/retail/mockLocalStorage.js.map +1 -0
  187. package/mobile/lib/setup-fixture.js +11 -0
  188. package/mobile/lib/setup-fixture.js.map +1 -1
  189. package/mobile/lib/ui-kit/Button/Button.d.ts +1 -0
  190. package/mobile/lib/ui-kit/Button/Button.js +7 -6
  191. package/mobile/lib/ui-kit/Button/Button.js.map +1 -1
  192. package/mobile/lib/ui-kit/Loader/Loader.d.ts +1 -0
  193. package/mobile/lib/ui-kit/Loader/Loader.js +2 -2
  194. package/mobile/lib/ui-kit/Loader/Loader.js.map +1 -1
  195. package/mobile/lib/ui-kit/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.js +5 -4
  196. package/mobile/lib/ui-kit/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.js.map +1 -1
  197. package/mobile/src/api/RetailAPI/sendCode.ts +4 -15
  198. package/mobile/src/components/ApplicationLeadForm/ApplicationLeadForm.tsx +2 -2
  199. package/mobile/src/components/ApplicationLeadForm/renderSubmitButton.tsx +2 -2
  200. package/mobile/src/components/ApplicationLeadForm/useApplicationLeadApi.tsx +12 -7
  201. package/mobile/src/components/CreditCardForm/CreditCardFormStep.tsx +2 -2
  202. package/mobile/src/components/CreditCardForm/StepsNavigationButtons.tsx +17 -12
  203. package/mobile/src/components/CreditCardForm/useCreditCardFormAPI.tsx +7 -2
  204. package/mobile/src/components/CreditForm/CreditFormStep.tsx +2 -2
  205. package/mobile/src/components/CreditForm/StepsNavigationButtons.tsx +17 -12
  206. package/mobile/src/components/CreditForm/useCreditFormAPI.tsx +7 -2
  207. package/mobile/src/hooks/useAsyncEffect.ts +16 -0
  208. package/mobile/src/services/retail/mockLocalStorage.ts +40 -0
  209. package/mobile/src/setup-fixture.ts +12 -0
  210. package/mobile/src/ui-kit/Button/Button.tsx +7 -3
  211. package/mobile/src/ui-kit/Loader/Loader.tsx +5 -3
  212. package/mobile/src/ui-kit/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.tsx +5 -4
  213. package/package.json +1 -1
  214. package/src/api/RetailAPI/sendCode.ts +4 -15
  215. package/src/components/ApplicationLeadForm/ApplicationLeadForm.tsx +2 -2
  216. package/src/components/ApplicationLeadForm/renderSubmitButton.tsx +2 -2
  217. package/src/components/ApplicationLeadForm/useApplicationLeadApi.tsx +12 -7
  218. package/src/components/CreditCardForm/CreditCardForm.fixture.mobile.tsx +14 -18
  219. package/src/components/CreditCardForm/CreditCardForm.fixture.tsx +14 -18
  220. package/src/components/CreditCardForm/CreditCardFormStep.tsx +2 -2
  221. package/src/components/CreditCardForm/StepsNavigationButtons.tsx +17 -12
  222. package/src/components/CreditCardForm/useCreditCardFormAPI.tsx +7 -2
  223. package/src/components/CreditForm/CreditForm.fixture.mobile.tsx +19 -23
  224. package/src/components/CreditForm/CreditForm.fixture.tsx +19 -23
  225. package/src/components/CreditForm/CreditFormStep.tsx +2 -2
  226. package/src/components/CreditForm/StepsNavigationButtons.tsx +17 -12
  227. package/src/components/CreditForm/useCreditFormAPI.tsx +7 -2
  228. package/src/hooks/useAsyncEffect.ts +16 -0
  229. package/src/services/retail/mockLocalStorage.ts +40 -0
  230. package/src/setup-fixture.ts +12 -0
  231. package/src/ui-kit/Button/Button.tsx +7 -3
  232. package/src/ui-kit/Loader/Loader.tsx +5 -3
  233. package/src/ui-kit/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.tsx +5 -4
@@ -1,8 +1,10 @@
1
1
  import '@redneckz/uni-jsx/lib/setup.react';
2
2
  import { useEffect, useState } from 'react';
3
3
  import { handlerDecorator } from './external/handlerDecorator.js';
4
+ import { locationNavigator } from './external/locationNavigator.js';
4
5
  import { useRouter } from './external/useRouter.js';
5
6
  import { projectSettings } from './ProjectSettings.js';
7
+ import { noop } from './utils/noop.js';
6
8
  import { joinPath } from './utils/url.js';
7
9
  import wlc from './wlc.json.js';
8
10
  projectSettings.setup(wlc);
@@ -40,4 +42,13 @@ handlerDecorator.setup((handler) => (ev) => {
40
42
  }
41
43
  handler(ev);
42
44
  });
45
+ locationNavigator.setup(() => ({
46
+ assign: noop,
47
+ get href() {
48
+ return globalThis.location.href;
49
+ },
50
+ get origin() {
51
+ return globalThis.location.origin;
52
+ },
53
+ }));
43
54
  //# sourceMappingURL=setup-fixture.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"setup-fixture.js","sourceRoot":"","sources":["../src/setup-fixture.ts"],"names":[],"mappings":"AAAA,OAAO,mCAAmC,CAAC;AAC3C,OAAO,EAAE,SA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C;KACtB;IAED,OAAO,CAAC,EAAE,CAAC,CAAC;AACd,CAAC,CAAC,CAAC;AAEH,iBAAiB,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC;IAC7B,MAAM,EAAE,IAAI;IACZ,IAAI,IAAI;QACN,OAAO,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC;IAClC,CAAC;IACD,IAAI,MAAM;QACR,OAAO,UAAU,CAAC,QAAQ,CAAC,MAAM,CAAC;IACpC,CAAC;CACF,CAAC,CAAC,CAAC"}
@@ -7,6 +7,7 @@ export interface ButtonProps extends ControlStateProps, ARIAProps {
7
7
  version?: ButtonVersion;
8
8
  type?: 'button' | 'submit' | 'reset';
9
9
  rounded?: boolean;
10
+ isLoading?: boolean;
10
11
  role?: string;
11
12
  onClick?: (ev?: PreventableEvent) => void;
12
13
  }
@@ -1,6 +1,7 @@
1
- import { jsx as _jsx } from "@redneckz/uni-jsx/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs } from "@redneckz/uni-jsx/jsx-runtime";
2
2
  import { JSX } from '@redneckz/uni-jsx';
3
3
  import { style } from '../../utils/style.js';
4
+ import { Loader } from '../Loader/Loader.js';
4
5
  import { useButton } from './useButton.js';
5
6
  const buttonStyleMap = {
6
7
  primary: 'text-white bg-primary-main hover:bg-primary-hover active:bg-primary-active',
@@ -12,13 +13,13 @@ const secondaryButtonStyleMap = {
12
13
  };
13
14
  export const Button = JSX(({ children, ...props }) => {
14
15
  const button = useButton();
15
- const { className, version = 'primary', active, disabled, type = 'button', rounded = true, role, onClick, } = button(props);
16
- return (_jsx("button", { className: style('font-sans px-9 py-4', 'flex justify-center items-center gap-xs', {
16
+ const { className, version = 'primary', active, disabled, isLoading, type = 'button', rounded = true, role, onClick, } = button(props);
17
+ return (_jsxs("button", { className: style('font-sans px-9 py-4', 'flex justify-center items-center gap-xs relative', {
17
18
  'text-white bg-primary-active': active,
18
- 'bg-main-gray text-main-disabled cursor-not-allowed': disabled,
19
+ 'bg-main-gray text-main-disabled cursor-not-allowed': disabled || isLoading,
19
20
  'rounded-md': rounded,
20
- }, !active && !disabled
21
+ }, !active && !disabled && !isLoading
21
22
  ? style(buttonStyleMap[version], secondaryButtonStyleMap[version])
22
- : '', className), type: type, role: role, onClick: onClick, children: children }));
23
+ : '', className), type: type, role: role, onClick: onClick, children: [isLoading ? _jsx(Loader, { blur: true, size: "small" }) : null, children] }));
23
24
  });
24
25
  //# sourceMappingURL=Button.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Button.js","sourceRoot":"","sources":["../../../src/ui-kit/Button/Button.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAExC,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAI1C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,MAAM,cAAc,GAAkC;IACpD,OAAO,EAAE,4EAA4E;IACrF,SAAS,EACP,oGAAoG;CACvG,CAAC;AAEF,MAAM,uBAAuB,GAAkC;IAC7D,OAAO,EAAE,KAAK,CACZ,sEAAsE,EACtE,mFAAmF,EACnF,+CAA+C,CAChD;IACD,SAAS,EAAE,KAAK,CACd,kEAAkE,EAClE,6CAA6C,EAC7C,+CAA+C,CAChD;CACF,CAAC;AAWF,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAc,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,EAAE;IAChE,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;IAE3B,MAAM,EACJ,SAAS,EACT,OAAO,GAAG,SAAS,EACnB,MAAM,EACN,QAAQ,EACR,IAAI,GAAG,QAAQ,EACf,OAAO,GAAG,IAAI,EACd,IAAI,EACJ,OAAO,GACR,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IAElB,OAAO,CACL,iBACE,SAAS,EAAE,KAAK,CACd,qBAAqB,EACrB,yCAAyC,EACzC;YACE,8BAA8B,EAAE,MA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AAK,CAAC,CAAC;IAElB,OAAO,CACL,kBACE,SAAS,EAAE,KAAK,CACd,qBAAqB,EACrB,kDAAkD,EAClD;YACE,8BAA8B,EAAE,MAAM;YACtC,oDAAoD,EAAE,QAAQ,IAAI,SAAS;YAC3E,YAAY,EAAE,OAAO;SACtB,EACD,CAAC,MAAM,IAAI,CAAC,QAAQ,IAAI,CAAC,SAAS;YAChC,CAAC,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE,uBAAuB,CAAC,OAAO,CAAC,CAAC;YAClE,CAAC,CAAC,EAAE,EACN,SAAS,CACV,EACD,IAAI,EAAE,IAAI,EACV,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,OAAO,aAEf,SAAS,CAAC,CAAC,CAAC,KAAC,MAAM,IAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAC,OAAO,GAAG,CAAC,CAAC,CAAC,IAAI,EACtD,QAAQ,IACF,CACV,CAAC;AACJ,CAAC,CAAC,CAAC"}
@@ -3,6 +3,7 @@ interface LoaderProps {
3
3
  color?: TextColor;
4
4
  position?: 'static' | 'absolute';
5
5
  blur?: boolean;
6
+ size?: 'small' | 'big';
6
7
  }
7
8
  export declare const Loader: import("@redneckz/uni-jsx").UNIComponent<LoaderProps, any, any>;
8
9
  export {};
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx } from "@redneckz/uni-jsx/jsx-runtime";
2
2
  import { JSX } from '@redneckz/uni-jsx';
3
3
  import { style } from '../../utils/style.js';
4
- export const Loader = JSX(({ color = 'text-primary-main', position = 'absolute', blur = true }) => (_jsx("div", { className: style('flex justify-center items-center h-full w-full z-50', position, {
4
+ export const Loader = JSX(({ color = 'text-primary-main', position = 'absolute', blur = true, size = 'big' }) => (_jsx("div", { className: style('flex justify-center items-center h-full w-full z-50', position, {
5
5
  'backdrop-blur': blur,
6
- }), children: _jsx("div", { className: style('inline-block h-28 w-28', 'animate-spin rounded-full', 'border-8 border-solid border-current', 'border-r-transparent', color), role: "status" }) })));
6
+ }), children: _jsx("div", { className: style('inline-block ', 'animate-spin rounded-full', 'border-solid border-current', 'border-r-transparent', size === 'small' ? 'border-4 h-8 w-8' : 'border-8 h-28 w-28', color), role: "status" }) })));
7
7
  //# sourceMappingURL=Loader.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Loader.js","sourceRoot":"","sources":["../../../src/ui-kit/Loader/Loader.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAExC,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAQ1C,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CACvB,CAAC,EAAE,KAAK,GAAG,mBAAmB,EAAE,QAAQ,GAAG,UAAU,EAAE,IAAI,GAAG,IAAI,EAAE,EAAE,EAAE,CAAC,CACvE,cACE,SAAS,EAAE,KAAK,CAAC,qDAAqD,EAAE,QAAQ,EAAE;QAChF,eAAe,EAAE,IAAI;KACtB,CAAC,YAEF,cACE,SAAS,EAAE,KAAK,CACd,wBAAwB,EACxB,2BAA2B,EAC3B,sCAAsC,EACtC,sBAAsB,EACtB,KAAK,CACN,EACD,IAAI,EAAC,QAAQ,GACb,GACE,CACP,CACF,CAAC"}
1
+ {"version":3,"file":"Loader.js","sourceRoot":"","sources":["../../../src/ui-kit/Loader/Loader.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAExC,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAS1C,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CACvB,CAAC,EAAE,KAAK,GAAG,mBAAmB,EAAE,QAAQ,GAAG,UAAU,EAAE,IAAI,GAAG,IAAI,EAAE,IAAI,GAAG,KAAK,EAAE,EAAE,EAAE,CAAC,CACrF,cACE,SAAS,EAAE,KAAK,CAAC,qDAAqD,EAAE,QAAQ,EAAE;QAChF,eAAe,EAAE,IAAI;KACtB,CAAC,YAEF,cACE,SAAS,EAAE,KAAK,CACd,eAAe,EACf,2BAA2B,EAC3B,6BAA6B,EAC7B,sBAAsB,EACtB,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,oBAAoB,EAC5D,KAAK,CACN,EACD,IAAI,EAAC,QAAQ,GACb,GACE,CACP,CACF,CAAC"}
@@ -1,8 +1,9 @@
1
1
  import { useCallback, useEffect, useState } from '@redneckz/uni-jsx/lib/hooks';
2
+ import { useBool } from '@redneckz/uni-jsx/lib/hooks/useBool';
2
3
  import { checkCode } from '../../api/RetailAPI/checkCode.js';
3
4
  export const useVerifyPhoneDialogSubmit = ({ values, onSuccess, }) => {
4
5
  const [errorText, setErrorText] = useState('');
5
- const [isLoading, setIsLoading] = useState(false);
6
+ const [isLoading, { setTrue: startLoading, setFalse: endLoading }] = useBool(false);
6
7
  const [timeNextReq, setTimeNextReq] = useState(0);
7
8
  const [isTimerStarted, setIsTimerStarted] = useState(false);
8
9
  const [attempts, setAttempts] = useState(0);
@@ -14,19 +15,19 @@ export const useVerifyPhoneDialogSubmit = ({ values, onSuccess, }) => {
14
15
  setIsTimerStarted(false);
15
16
  setTimeNextReq(0);
16
17
  setAttempts((_) => _ + 1);
17
- setIsLoading(true);
18
+ startLoading();
18
19
  await checkCode({
19
20
  smsText: values.join(''),
20
21
  smsCodesSetName: { key: 'AUTHENTICATION' },
21
22
  });
22
23
  resetError();
23
- onSuccess?.(values.join(''));
24
+ await onSuccess?.(values.join(''));
24
25
  }
25
26
  catch {
26
27
  setErrorText(attempts > 1 ? 'Исчерпан лимит ввода смс-кода' : 'Неверный код');
27
28
  }
28
29
  finally {
29
- setIsLoading(false);
30
+ endLoading();
30
31
  }
31
32
  }, [values, attempts]);
32
33
  useEffect(() => {
@@ -1 +1 @@
1
- {"version":3,"file":"useVerifyPhoneDialogSubmit.js","sourceRoot":"","sources":["../../../src/ui-kit/VerifyPhoneDialog/useVerifyPhoneDialogSubmit.ts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C,CAAC,CAAC,+BAA+B,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC;SAC/E;gBAAS;YACR,UAAU,EAAE,CAAC;SACd;IACH,CAAC,EAAE,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC;IAEvB,SAAS,CAAC,GAAG,EAAE;QACb,YAAY,CAAC,aAAa,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IACrD,CAAC,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC;IAEpB,OAAO;QACL,YAAY;QACZ,QAAQ,EAAE,OAAO,CAAC,SAAS,CAAC;QAC5B,SAAS;QACT,SAAS;QACT,WAAW;QACX,sBAAsB;QACtB,cAAc;QACd,iBAAiB;QACjB,WAAW;KACZ,CAAC;AACJ,CAAC,CAAC"}
@@ -1,5 +1,4 @@
1
- import { fetchRetailJSON } from './doRequest';
2
- import { type StatusType } from './StatusType';
1
+ import { doRequest } from './doRequest';
3
2
 
4
3
  export type SendCodeBody = {
5
4
  phoneNumber: string;
@@ -8,17 +7,7 @@ export type SendCodeBody = {
8
7
  };
9
8
  };
10
9
 
11
- type SendCodeErrorResult = { errorMessage: string };
12
-
13
10
  export const sendCode = (body: SendCodeBody) =>
14
- fetchRetailJSON<StatusType | SendCodeErrorResult>('/sms/sendCode', 'POST', body).then(
15
- (res) => !isErrorResult(res, body.phoneNumber),
16
- );
17
-
18
- const isErrorResult = (
19
- res: StatusType | SendCodeErrorResult | null,
20
- phoneNumber: string,
21
- ): res is SendCodeErrorResult =>
22
- Boolean(res) &&
23
- typeof res !== 'string' &&
24
- Boolean(res?.errorMessage?.startsWith(`Too many request for phoneNumber [${phoneNumber}]`));
11
+ doRequest('/sms/sendCode', 'POST', body)
12
+ .then((res) => res.text())
13
+ .then((text) => text === 'OK');
@@ -26,7 +26,7 @@ export const ApplicationLeadForm = JSX<ApplicationLeadFormProps>(
26
26
  );
27
27
 
28
28
  const [initialFormState, { isLoading }] = useInitApplicationLead(inputs, nextStepLink);
29
- const { handleSubmit, responseStatus } = useApplicationLeadApi({
29
+ const { handleSubmit, responseStatus, isSending } = useApplicationLeadApi({
30
30
  inputs,
31
31
  programId,
32
32
  nextStepLink,
@@ -58,7 +58,7 @@ export const ApplicationLeadForm = JSX<ApplicationLeadFormProps>(
58
58
  {renderInputs({ field, inputs: _?.inputs })}
59
59
  </div>
60
60
  ))}
61
- {renderSubmitButton(button)}
61
+ {renderSubmitButton(button, isSending)}
62
62
  </form>
63
63
  </ApplicationFormLayout>
64
64
  );
@@ -2,8 +2,8 @@ import { Button } from '../../ui-kit/Button/Button';
2
2
  import { style } from '../../utils/style';
3
3
  import { type SubmitButtonProps } from './ApplicationLeadFormContent';
4
4
 
5
- export const renderSubmitButton = (button?: SubmitButtonProps, className?: string) => (
6
- <Button className={style('w-full @xl:w-auto', className)} type="submit">
5
+ export const renderSubmitButton = (button?: SubmitButtonProps, isSending?: boolean) => (
6
+ <Button className={style('w-full @xl:w-auto')} type="submit" isLoading={isSending}>
7
7
  {button?.text ? button.text : 'Отправить заявку'}
8
8
  </Button>
9
9
  );
@@ -1,4 +1,5 @@
1
1
  import { useCallback, useState } from '@redneckz/uni-jsx/lib/hooks';
2
+ import { useBool } from '@redneckz/uni-jsx/lib/hooks/useBool';
2
3
  import { createDraftTask } from '../../api/RetailAPI/createDraftTask';
3
4
  import { createUserProfile } from '../../api/RetailAPI/createUserProfile';
4
5
  import { getLastTaskStatus } from '../../api/RetailAPI/getLastTaskStatus';
@@ -33,6 +34,7 @@ export const useApplicationLeadApi = ({
33
34
  nextStepLink,
34
35
  }: ApplicationLeadApiProps) => {
35
36
  const [responseStatus, setResponseStatus] = useState<'OK' | 'Fail' | ''>('');
37
+ const [isSending, { setTrue: startSending, setFalse: endSending }] = useBool(false);
36
38
  const saveUserData = useSaveUserData();
37
39
 
38
40
  const openEsiaLoginDialog = useEsiaLoginDialog(nextStepLink);
@@ -47,6 +49,7 @@ export const useApplicationLeadApi = ({
47
49
  }
48
50
 
49
51
  try {
52
+ startSending();
50
53
  const profileId = await createUserProfile({
51
54
  profile: { phone: formatPhone(formData.phone as string) },
52
55
  });
@@ -64,10 +67,7 @@ export const useApplicationLeadApi = ({
64
67
  };
65
68
  const handleSuccessVerify = async () => {
66
69
  try {
67
- const lastTaskId = await getLastTaskStatus({
68
- profileId,
69
- programId,
70
- });
70
+ const lastTaskId = await getLastTaskStatus({ profileId, programId });
71
71
 
72
72
  if (lastTaskId) {
73
73
  const task = await getTaskById({ taskId: lastTaskId });
@@ -85,15 +85,14 @@ export const useApplicationLeadApi = ({
85
85
  }
86
86
  };
87
87
 
88
- const acceptedConsents: string[] = Object.keys(CONSENTS)
89
- .filter((_) => formData[_])
90
- .map((_) => CONSENTS[_]?.text);
88
+ const acceptedConsents = getAcceptedConsents(formData);
91
89
 
92
90
  verifyPhoneDialog.open({
93
91
  phone: formData?.phone,
94
92
  consents: acceptedConsents,
95
93
  onSuccess: handleSuccessVerify,
96
94
  });
95
+ endSending();
97
96
  }
98
97
  } catch {
99
98
  setResponseStatus('Fail');
@@ -103,9 +102,15 @@ export const useApplicationLeadApi = ({
103
102
  return {
104
103
  handleSubmit,
105
104
  responseStatus,
105
+ isSending,
106
106
  };
107
107
  };
108
108
 
109
+ const getAcceptedConsents = (formData: LeadFormState): string[] =>
110
+ Object.keys(CONSENTS)
111
+ .filter((_) => formData[_])
112
+ .map((_) => CONSENTS[_]?.text);
113
+
109
114
  const updateUserData = async ({
110
115
  programId,
111
116
  profileId,
@@ -24,7 +24,7 @@ export const CreditCardFormStep = JSX<CreditCardFormStepProps>(
24
24
  [sections],
25
25
  );
26
26
 
27
- const [initialState, onSubmit] = useCreditCardFormAPI({
27
+ const [initialState, onSubmit, isSending] = useCreditCardFormAPI({
28
28
  step,
29
29
  inputs,
30
30
  onNextStep,
@@ -38,7 +38,7 @@ export const CreditCardFormStep = JSX<CreditCardFormStepProps>(
38
38
  ) : (
39
39
  <form onSubmit={handleSubmit} className="space-y-m">
40
40
  {renderStep({ sections, field, step })}
41
- <StepsNavigationButtons step={step} onPrevStep={onPrevStep} />
41
+ <StepsNavigationButtons isSending={isSending} step={step} onPrevStep={onPrevStep} />
42
42
  </form>
43
43
  );
44
44
  },
@@ -3,19 +3,24 @@ import { Button } from '../../ui-kit/Button/Button';
3
3
 
4
4
  export interface StepsNavigationButtonsProps {
5
5
  step: number;
6
+ isSending: boolean;
6
7
  onPrevStep?: () => void;
7
8
  }
8
9
 
9
- export const StepsNavigationButtons = JSX<StepsNavigationButtonsProps>(({ step, onPrevStep }) => {
10
- const isFirstStep = step === 0;
11
- const isFinalStep = step === 5;
10
+ export const StepsNavigationButtons = JSX<StepsNavigationButtonsProps>(
11
+ ({ step, isSending, onPrevStep }) => {
12
+ const isFirstStep = step === 0;
13
+ const isFinalStep = step === 5;
12
14
 
13
- return (
14
- <div className="flex justify-between gap-m">
15
- <Button onClick={onPrevStep} type="button" version="secondary" disabled={isFirstStep}>
16
- Назад
17
- </Button>
18
- <Button type="submit">{isFinalStep ? 'Отправить заявку' : 'Далее'}</Button>
19
- </div>
20
- );
21
- });
15
+ return (
16
+ <div className="flex justify-between gap-m">
17
+ <Button onClick={onPrevStep} type="button" version="secondary" disabled={isFirstStep}>
18
+ Назад
19
+ </Button>
20
+ <Button isLoading={isSending} type="submit">
21
+ {isFinalStep ? 'Отправить заявку' : 'Далее'}
22
+ </Button>
23
+ </div>
24
+ );
25
+ },
26
+ );
@@ -1,4 +1,5 @@
1
1
  import { useCallback, useMemo } from '@redneckz/uni-jsx/lib/hooks';
2
+ import { useBool } from '@redneckz/uni-jsx/lib/hooks/useBool';
2
3
  import { updateUserTask } from '../../api/RetailAPI/updateUserTask';
3
4
  import { useRetailFormStore } from '../../hooks/useRetailFormStore';
4
5
  import { getObjectValidator } from '../../ui-kit/FormField/getObjectValidator';
@@ -22,7 +23,8 @@ export const useCreditCardFormAPI = ({
22
23
  inputs,
23
24
  onNextStep,
24
25
  onFinish,
25
- }: CreditFormApiProps): [LeadFormState, (formData: LeadFormState) => void] => {
26
+ }: CreditFormApiProps): [LeadFormState, (formData: LeadFormState) => void, boolean] => {
27
+ const [isSending, { setTrue: startSending, setFalse: endSending }] = useBool(false);
26
28
  const isFinalStep = step === 5;
27
29
 
28
30
  const retailFormStore = useRetailFormStore();
@@ -61,6 +63,7 @@ export const useCreditCardFormAPI = ({
61
63
  return;
62
64
  }
63
65
 
66
+ startSending();
64
67
  retailFormStore.leadForm = formData;
65
68
 
66
69
  try {
@@ -84,12 +87,14 @@ export const useCreditCardFormAPI = ({
84
87
  }
85
88
  } catch (ex) {
86
89
  // Do nothing
90
+ } finally {
91
+ endSending();
87
92
  }
88
93
  },
89
94
  [isFinalStep, resetForm],
90
95
  );
91
96
 
92
- return [initialState, handleSubmit];
97
+ return [initialState, handleSubmit, isSending];
93
98
  };
94
99
 
95
100
  const getValue =
@@ -30,7 +30,7 @@ export const CreditFormStep = JSX<CreditFormStepProps>(
30
30
  [sections],
31
31
  );
32
32
 
33
- const [initialState, onSubmit] = useCreditFormAPI({
33
+ const [initialState, onSubmit, isSending] = useCreditFormAPI({
34
34
  step,
35
35
  inputs,
36
36
  onNextStep,
@@ -44,7 +44,7 @@ export const CreditFormStep = JSX<CreditFormStepProps>(
44
44
  ) : (
45
45
  <form onSubmit={handleSubmit} className="space-y-m">
46
46
  {renderStep({ sections, field, step, params: { calcData } })}
47
- <StepsNavigationButtons step={step} onPrevStep={onPrevStep} />
47
+ <StepsNavigationButtons step={step} isSending={isSending} onPrevStep={onPrevStep} />
48
48
  </form>
49
49
  );
50
50
  },
@@ -3,19 +3,24 @@ import { Button } from '../../ui-kit/Button/Button';
3
3
 
4
4
  export interface StepsNavigationButtonsProps {
5
5
  step: number;
6
+ isSending: boolean;
6
7
  onPrevStep?: () => void;
7
8
  }
8
9
 
9
- export const StepsNavigationButtons = JSX<StepsNavigationButtonsProps>(({ step, onPrevStep }) => {
10
- const isFirstStep = step === 0;
11
- const isFinalStep = step === 5;
10
+ export const StepsNavigationButtons = JSX<StepsNavigationButtonsProps>(
11
+ ({ step, onPrevStep, isSending }) => {
12
+ const isFirstStep = step === 0;
13
+ const isFinalStep = step === 5;
12
14
 
13
- return (
14
- <div className={'flex justify-between gap-m'}>
15
- <Button onClick={onPrevStep} type="button" version="secondary" disabled={isFirstStep}>
16
- Назад
17
- </Button>
18
- <Button type="submit">{isFinalStep ? 'Отправить заявку' : 'Далее'}</Button>
19
- </div>
20
- );
21
- });
15
+ return (
16
+ <div className={'flex justify-between gap-m'}>
17
+ <Button onClick={onPrevStep} type="button" version="secondary" disabled={isFirstStep}>
18
+ Назад
19
+ </Button>
20
+ <Button type="submit" isLoading={isSending}>
21
+ {isFinalStep ? 'Отправить заявку' : 'Далее'}
22
+ </Button>
23
+ </div>
24
+ );
25
+ },
26
+ );
@@ -1,4 +1,5 @@
1
1
  import { useCallback, useMemo } from '@redneckz/uni-jsx/lib/hooks';
2
+ import { useBool } from '@redneckz/uni-jsx/lib/hooks/useBool';
2
3
  import { updateUserTask } from '../../api/RetailAPI/updateUserTask';
3
4
  import { useRetailFormStore } from '../../hooks/useRetailFormStore';
4
5
  import { getCreditFormTaskData } from '../../services/retail/adaptors/getCreditFormTaskData';
@@ -22,7 +23,8 @@ export const useCreditFormAPI = ({
22
23
  inputs,
23
24
  onNextStep,
24
25
  onFinish,
25
- }: CreditFormApiProps): [LeadFormState, (formData: LeadFormState) => void] => {
26
+ }: CreditFormApiProps): [LeadFormState, (formData: LeadFormState) => void, boolean] => {
27
+ const [isSending, { setTrue: startSending, setFalse: endSending }] = useBool(false);
26
28
  const isFinalStep = step === 5;
27
29
 
28
30
  const retailFormStore = useRetailFormStore();
@@ -62,6 +64,7 @@ export const useCreditFormAPI = ({
62
64
  return;
63
65
  }
64
66
 
67
+ startSending();
65
68
  retailFormStore.leadForm = formData;
66
69
 
67
70
  try {
@@ -85,12 +88,14 @@ export const useCreditFormAPI = ({
85
88
  }
86
89
  } catch (ex) {
87
90
  // Do nothing
91
+ } finally {
92
+ endSending();
88
93
  }
89
94
  },
90
95
  [isFinalStep, resetForm],
91
96
  );
92
97
 
93
- return [initialState, handleSubmit];
98
+ return [initialState, handleSubmit, isSending];
94
99
  };
95
100
 
96
101
  const getValue =
@@ -0,0 +1,16 @@
1
+ import { useEffect } from '@redneckz/uni-jsx/lib/hooks';
2
+
3
+ export function useAsyncEffect<Deps extends any[], R>(
4
+ effect: () => Promise<R | (() => void)>,
5
+ deps: Deps,
6
+ ): void {
7
+ useEffect(() => {
8
+ const free = effect();
9
+
10
+ return () => {
11
+ free.then((_) => {
12
+ _ instanceof Function && _();
13
+ });
14
+ };
15
+ }, deps);
16
+ }
@@ -0,0 +1,40 @@
1
+ import { checkCode } from '../../api/RetailAPI/checkCode';
2
+ import { createDraftTask } from '../../api/RetailAPI/createDraftTask';
3
+ import { createUserProfile } from '../../api/RetailAPI/createUserProfile';
4
+ import { sendCode } from '../../api/RetailAPI/sendCode';
5
+
6
+ const PHONE = '+11111111111';
7
+ const PROGRAM_ID = '13';
8
+
9
+ export const mockLocalStorage = async () => {
10
+ const programId = globalThis.localStorage.getItem('programId') ?? PROGRAM_ID;
11
+
12
+ const profileId =
13
+ globalThis.localStorage.getItem('profileId') ??
14
+ (await createUserProfile({ profile: { phone: PHONE } }));
15
+
16
+ await sendCode({
17
+ phoneNumber: PHONE,
18
+ smsCodesSetName: { key: 'AUTHENTICATION' },
19
+ });
20
+
21
+ await checkCode({
22
+ smsCodesSetName: { key: 'AUTHENTICATION' },
23
+ smsText: '1234',
24
+ });
25
+
26
+ const task = {
27
+ taskId: globalThis.localStorage.getItem('taskId'),
28
+ participantId: globalThis.localStorage.getItem('participantId'),
29
+ };
30
+
31
+ if (!task.taskId || !task.participantId) {
32
+ const draft = await createDraftTask({ profileId: Number(profileId), programId });
33
+ Object.assign(task, draft);
34
+ }
35
+
36
+ globalThis.localStorage.setItem('programId', programId);
37
+ globalThis.localStorage.setItem('profileId', String(profileId));
38
+ globalThis.localStorage.setItem('taskId', String(task.taskId));
39
+ globalThis.localStorage.setItem('participantId', String(task.participantId));
40
+ };
@@ -1,8 +1,10 @@
1
1
  import '@redneckz/uni-jsx/lib/setup.react';
2
2
  import { useEffect, useState } from 'react';
3
3
  import { handlerDecorator } from './external/handlerDecorator';
4
+ import { locationNavigator } from './external/locationNavigator';
4
5
  import { useRouter } from './external/useRouter';
5
6
  import { projectSettings } from './ProjectSettings';
7
+ import { noop } from './utils/noop';
6
8
  import { joinPath } from './utils/url';
7
9
  import wlc from './wlc.json';
8
10
 
@@ -49,3 +51,13 @@ handlerDecorator.setup((handler): any => (ev) => {
49
51
 
50
52
  handler(ev);
51
53
  });
54
+
55
+ locationNavigator.setup(() => ({
56
+ assign: noop,
57
+ get href() {
58
+ return globalThis.location.href;
59
+ },
60
+ get origin() {
61
+ return globalThis.location.origin;
62
+ },
63
+ }));
@@ -3,6 +3,7 @@ import { type ButtonVersion } from '../../model/ButtonVersion';
3
3
  import { style } from '../../utils/style';
4
4
  import { type ARIAProps } from '../ARIAProps';
5
5
  import { type ControlStateProps } from '../ControlStateProps';
6
+ import { Loader } from '../Loader/Loader';
6
7
  import { type PreventableEvent } from '../PreventableEvent';
7
8
  import { useButton } from './useButton';
8
9
 
@@ -30,6 +31,7 @@ export interface ButtonProps extends ControlStateProps, ARIAProps {
30
31
  version?: ButtonVersion;
31
32
  type?: 'button' | 'submit' | 'reset';
32
33
  rounded?: boolean;
34
+ isLoading?: boolean;
33
35
  role?: string;
34
36
  onClick?: (ev?: PreventableEvent) => void;
35
37
  }
@@ -42,6 +44,7 @@ export const Button = JSX<ButtonProps>(({ children, ...props }) => {
42
44
  version = 'primary',
43
45
  active,
44
46
  disabled,
47
+ isLoading,
45
48
  type = 'button',
46
49
  rounded = true,
47
50
  role,
@@ -52,13 +55,13 @@ export const Button = JSX<ButtonProps>(({ children, ...props }) => {
52
55
  <button
53
56
  className={style(
54
57
  'font-sans px-9 py-4',
55
- 'flex justify-center items-center gap-xs',
58
+ 'flex justify-center items-center gap-xs relative',
56
59
  {
57
60
  'text-white bg-primary-active': active,
58
- 'bg-main-gray text-main-disabled cursor-not-allowed': disabled,
61
+ 'bg-main-gray text-main-disabled cursor-not-allowed': disabled || isLoading,
59
62
  'rounded-md': rounded,
60
63
  },
61
- !active && !disabled
64
+ !active && !disabled && !isLoading
62
65
  ? style(buttonStyleMap[version], secondaryButtonStyleMap[version])
63
66
  : '',
64
67
  className,
@@ -67,6 +70,7 @@ export const Button = JSX<ButtonProps>(({ children, ...props }) => {
67
70
  role={role}
68
71
  onClick={onClick}
69
72
  >
73
+ {isLoading ? <Loader blur={true} size="small" /> : null}
70
74
  {children}
71
75
  </button>
72
76
  );
@@ -6,10 +6,11 @@ interface LoaderProps {
6
6
  color?: TextColor;
7
7
  position?: 'static' | 'absolute';
8
8
  blur?: boolean;
9
+ size?: 'small' | 'big';
9
10
  }
10
11
 
11
12
  export const Loader = JSX<LoaderProps>(
12
- ({ color = 'text-primary-main', position = 'absolute', blur = true }) => (
13
+ ({ color = 'text-primary-main', position = 'absolute', blur = true, size = 'big' }) => (
13
14
  <div
14
15
  className={style('flex justify-center items-center h-full w-full z-50', position, {
15
16
  'backdrop-blur': blur,
@@ -17,10 +18,11 @@ export const Loader = JSX<LoaderProps>(
17
18
  >
18
19
  <div
19
20
  className={style(
20
- 'inline-block h-28 w-28',
21
+ 'inline-block ',
21
22
  'animate-spin rounded-full',
22
- 'border-8 border-solid border-current',
23
+ 'border-solid border-current',
23
24
  'border-r-transparent',
25
+ size === 'small' ? 'border-4 h-8 w-8' : 'border-8 h-28 w-28',
24
26
  color,
25
27
  )}
26
28
  role="status"