@redneckz/wildless-cms-uni-blocks 0.14.990 → 0.14.992

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 (87) hide show
  1. package/bundle/api/LeadServiceAPI.d.ts +2 -1
  2. package/bundle/bundle.umd.js +67 -10
  3. package/bundle/bundle.umd.min.js +1 -1
  4. package/bundle/retail/utils/autoLayoutKeyboard.d.ts +1 -0
  5. package/dist/api/LeadServiceAPI.d.ts +2 -1
  6. package/dist/api/LeadServiceAPI.js +3 -2
  7. package/dist/api/LeadServiceAPI.js.map +1 -1
  8. package/dist/components/ApplicationForm/useVerifyPhoneDialogSubmit.js +3 -0
  9. package/dist/components/ApplicationForm/useVerifyPhoneDialogSubmit.js.map +1 -1
  10. package/dist/retail/components/CaptchaDialog/CaptchaDialog.js +1 -1
  11. package/dist/retail/components/CaptchaDialog/CaptchaDialog.js.map +1 -1
  12. package/dist/retail/components/Fields/MiddleNameField.js +4 -2
  13. package/dist/retail/components/Fields/MiddleNameField.js.map +1 -1
  14. package/dist/retail/components/Fields/NameField.js +4 -2
  15. package/dist/retail/components/Fields/NameField.js.map +1 -1
  16. package/dist/retail/components/Fields/SurnameField.js +4 -2
  17. package/dist/retail/components/Fields/SurnameField.js.map +1 -1
  18. package/dist/retail/utils/autoLayoutKeyboard.d.ts +1 -0
  19. package/dist/retail/utils/autoLayoutKeyboard.js +54 -0
  20. package/dist/retail/utils/autoLayoutKeyboard.js.map +1 -0
  21. package/lib/api/LeadServiceAPI.d.ts +2 -1
  22. package/lib/api/LeadServiceAPI.js +3 -2
  23. package/lib/api/LeadServiceAPI.js.map +1 -1
  24. package/lib/components/ApplicationForm/useVerifyPhoneDialogSubmit.js +3 -0
  25. package/lib/components/ApplicationForm/useVerifyPhoneDialogSubmit.js.map +1 -1
  26. package/lib/retail/components/CaptchaDialog/CaptchaDialog.js +1 -1
  27. package/lib/retail/components/CaptchaDialog/CaptchaDialog.js.map +1 -1
  28. package/lib/retail/components/Fields/MiddleNameField.js +4 -2
  29. package/lib/retail/components/Fields/MiddleNameField.js.map +1 -1
  30. package/lib/retail/components/Fields/NameField.js +4 -2
  31. package/lib/retail/components/Fields/NameField.js.map +1 -1
  32. package/lib/retail/components/Fields/SurnameField.js +4 -2
  33. package/lib/retail/components/Fields/SurnameField.js.map +1 -1
  34. package/lib/retail/utils/autoLayoutKeyboard.d.ts +1 -0
  35. package/lib/retail/utils/autoLayoutKeyboard.js +51 -0
  36. package/lib/retail/utils/autoLayoutKeyboard.js.map +1 -0
  37. package/mobile/bundle/api/LeadServiceAPI.d.ts +2 -1
  38. package/mobile/bundle/bundle.umd.js +67 -10
  39. package/mobile/bundle/bundle.umd.min.js +1 -1
  40. package/mobile/bundle/retail/utils/autoLayoutKeyboard.d.ts +1 -0
  41. package/mobile/dist/api/LeadServiceAPI.d.ts +2 -1
  42. package/mobile/dist/api/LeadServiceAPI.js +3 -2
  43. package/mobile/dist/api/LeadServiceAPI.js.map +1 -1
  44. package/mobile/dist/components/ApplicationForm/useVerifyPhoneDialogSubmit.js +3 -0
  45. package/mobile/dist/components/ApplicationForm/useVerifyPhoneDialogSubmit.js.map +1 -1
  46. package/mobile/dist/retail/components/CaptchaDialog/CaptchaDialog.js +1 -1
  47. package/mobile/dist/retail/components/CaptchaDialog/CaptchaDialog.js.map +1 -1
  48. package/mobile/dist/retail/components/Fields/MiddleNameField.js +4 -2
  49. package/mobile/dist/retail/components/Fields/MiddleNameField.js.map +1 -1
  50. package/mobile/dist/retail/components/Fields/NameField.js +4 -2
  51. package/mobile/dist/retail/components/Fields/NameField.js.map +1 -1
  52. package/mobile/dist/retail/components/Fields/SurnameField.js +4 -2
  53. package/mobile/dist/retail/components/Fields/SurnameField.js.map +1 -1
  54. package/mobile/dist/retail/utils/autoLayoutKeyboard.d.ts +1 -0
  55. package/mobile/dist/retail/utils/autoLayoutKeyboard.js +54 -0
  56. package/mobile/dist/retail/utils/autoLayoutKeyboard.js.map +1 -0
  57. package/mobile/lib/api/LeadServiceAPI.d.ts +2 -1
  58. package/mobile/lib/api/LeadServiceAPI.js +3 -2
  59. package/mobile/lib/api/LeadServiceAPI.js.map +1 -1
  60. package/mobile/lib/components/ApplicationForm/useVerifyPhoneDialogSubmit.js +3 -0
  61. package/mobile/lib/components/ApplicationForm/useVerifyPhoneDialogSubmit.js.map +1 -1
  62. package/mobile/lib/retail/components/CaptchaDialog/CaptchaDialog.js +1 -1
  63. package/mobile/lib/retail/components/CaptchaDialog/CaptchaDialog.js.map +1 -1
  64. package/mobile/lib/retail/components/Fields/MiddleNameField.js +4 -2
  65. package/mobile/lib/retail/components/Fields/MiddleNameField.js.map +1 -1
  66. package/mobile/lib/retail/components/Fields/NameField.js +4 -2
  67. package/mobile/lib/retail/components/Fields/NameField.js.map +1 -1
  68. package/mobile/lib/retail/components/Fields/SurnameField.js +4 -2
  69. package/mobile/lib/retail/components/Fields/SurnameField.js.map +1 -1
  70. package/mobile/lib/retail/utils/autoLayoutKeyboard.d.ts +1 -0
  71. package/mobile/lib/retail/utils/autoLayoutKeyboard.js +51 -0
  72. package/mobile/lib/retail/utils/autoLayoutKeyboard.js.map +1 -0
  73. package/mobile/src/api/LeadServiceAPI.ts +9 -2
  74. package/mobile/src/components/ApplicationForm/useVerifyPhoneDialogSubmit.tsx +3 -0
  75. package/mobile/src/retail/components/CaptchaDialog/CaptchaDialog.tsx +1 -1
  76. package/mobile/src/retail/components/Fields/MiddleNameField.tsx +4 -2
  77. package/mobile/src/retail/components/Fields/NameField.tsx +4 -2
  78. package/mobile/src/retail/components/Fields/SurnameField.tsx +5 -2
  79. package/mobile/src/retail/utils/autoLayoutKeyboard.ts +57 -0
  80. package/package.json +1 -1
  81. package/src/api/LeadServiceAPI.ts +9 -2
  82. package/src/components/ApplicationForm/useVerifyPhoneDialogSubmit.tsx +3 -0
  83. package/src/retail/components/CaptchaDialog/CaptchaDialog.tsx +1 -1
  84. package/src/retail/components/Fields/MiddleNameField.tsx +4 -2
  85. package/src/retail/components/Fields/NameField.tsx +4 -2
  86. package/src/retail/components/Fields/SurnameField.tsx +5 -2
  87. package/src/retail/utils/autoLayoutKeyboard.ts +57 -0
@@ -1,6 +1,7 @@
1
1
  import { JSX } from '@redneckz/uni-jsx';
2
2
  import { useCallback } from '@redneckz/uni-jsx/lib/hooks';
3
3
  import { type CustomFieldProps } from '../../../ui-kit/FormField/CustomFieldProps';
4
+ import { autoLayoutKeyboard } from '../../utils/autoLayoutKeyboard';
4
5
  import { isEsiaAuthorize } from '../../utils/isEsiaAuthorize';
5
6
  import { retailCyrillicPattern } from '../../validator/validators';
6
7
  import { DaDataInputControl } from '../DaDataInputControl/DaDataInputControl';
@@ -8,8 +9,9 @@ import { DaDataInputControl } from '../DaDataInputControl/DaDataInputControl';
8
9
  export const MiddleNameField = JSX<CustomFieldProps>(({ field, input }) => {
9
10
  const onChange = useCallback(
10
11
  (value: string) => {
11
- if (retailCyrillicPattern.test(value) || value.length === 0) {
12
- field('middleName')?.onChange?.(value);
12
+ const translatedValue = autoLayoutKeyboard(value);
13
+ if (retailCyrillicPattern.test(translatedValue) || translatedValue.length === 0) {
14
+ field('middleName')?.onChange?.(translatedValue);
13
15
  }
14
16
  },
15
17
  [field],
@@ -1,6 +1,7 @@
1
1
  import { JSX } from '@redneckz/uni-jsx';
2
2
  import { useCallback } from '@redneckz/uni-jsx/lib/hooks';
3
3
  import { type CustomFieldProps } from '../../../ui-kit/FormField/CustomFieldProps';
4
+ import { autoLayoutKeyboard } from '../../utils/autoLayoutKeyboard';
4
5
  import { isEsiaAuthorize } from '../../utils/isEsiaAuthorize';
5
6
  import { retailCyrillicPattern } from '../../validator/validators';
6
7
  import { DaDataInputControl } from '../DaDataInputControl/DaDataInputControl';
@@ -8,8 +9,9 @@ import { DaDataInputControl } from '../DaDataInputControl/DaDataInputControl';
8
9
  export const NameField = JSX<CustomFieldProps>(({ field, input }) => {
9
10
  const onChange = useCallback(
10
11
  (value: string) => {
11
- if (retailCyrillicPattern.test(value) || value.length === 0) {
12
- field('name')?.onChange?.(value);
12
+ const translatedValue = autoLayoutKeyboard(value);
13
+ if (retailCyrillicPattern.test(translatedValue) || translatedValue.length === 0) {
14
+ field('name')?.onChange?.(translatedValue);
13
15
  }
14
16
  },
15
17
  [field],
@@ -1,6 +1,7 @@
1
1
  import { JSX } from '@redneckz/uni-jsx';
2
2
  import { useCallback } from '@redneckz/uni-jsx/lib/hooks';
3
3
  import { type CustomFieldProps } from '../../../ui-kit/FormField/CustomFieldProps';
4
+ import { autoLayoutKeyboard } from '../../utils/autoLayoutKeyboard';
4
5
  import { isEsiaAuthorize } from '../../utils/isEsiaAuthorize';
5
6
  import { retailCyrillicPattern } from '../../validator/validators';
6
7
  import { DaDataInputControl } from '../DaDataInputControl/DaDataInputControl';
@@ -8,8 +9,10 @@ import { DaDataInputControl } from '../DaDataInputControl/DaDataInputControl';
8
9
  export const SurnameField = JSX<CustomFieldProps>(({ field, input }) => {
9
10
  const onChange = useCallback(
10
11
  (value: string) => {
11
- if (retailCyrillicPattern.test(value) || value.length === 0) {
12
- field('surname')?.onChange?.(value);
12
+ const translatedValue = autoLayoutKeyboard(value);
13
+
14
+ if (retailCyrillicPattern.test(translatedValue) || translatedValue.length === 0) {
15
+ field('surname')?.onChange?.(translatedValue);
13
16
  }
14
17
  },
15
18
  [field],
@@ -0,0 +1,57 @@
1
+ export const autoLayoutKeyboard = (str: string): string => {
2
+ const replacer = {
3
+ q: 'й',
4
+ w: 'ц',
5
+ e: 'у',
6
+ r: 'к',
7
+ t: 'е',
8
+ y: 'н',
9
+ u: 'г',
10
+
11
+ i: 'ш',
12
+ o: 'щ',
13
+ p: 'з',
14
+ '[': 'х',
15
+ ']': 'ъ',
16
+ a: 'ф',
17
+ s: 'ы',
18
+
19
+ d: 'в',
20
+ f: 'а',
21
+ g: 'п',
22
+ h: 'р',
23
+ j: 'о',
24
+ k: 'л',
25
+ l: 'д',
26
+
27
+ ';': 'ж',
28
+ "'": 'э',
29
+ z: 'я',
30
+ x: 'ч',
31
+ c: 'с',
32
+ v: 'м',
33
+ b: 'и',
34
+
35
+ n: 'т',
36
+ m: 'ь',
37
+ ',': 'б',
38
+ '.': 'ю',
39
+ '`': 'ё',
40
+
41
+ '{': 'Х',
42
+ '}': 'Ъ',
43
+ ':': 'Ж',
44
+ '~': 'Ё',
45
+ '"': 'Э',
46
+ '<': 'Б',
47
+ '>': 'Ю',
48
+
49
+ '\\': '\\',
50
+ '^': '^',
51
+ _: '_',
52
+ };
53
+
54
+ return str.replace(/[A-z,`~<.>;:\\'"[{\]}]/g, (x: string) => {
55
+ return x === x.toLowerCase() ? replacer[x] : replacer[x.toLowerCase()].toUpperCase();
56
+ });
57
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redneckz/wildless-cms-uni-blocks",
3
- "version": "0.14.990",
3
+ "version": "0.14.992",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "author": "ЦК",
@@ -24,6 +24,7 @@ export type CheckCodeProps = {
24
24
  reqId: string;
25
25
  code: string;
26
26
  body: LeadRequest;
27
+ router: Router;
27
28
  };
28
29
 
29
30
  type CheckCodeResponse = {
@@ -51,6 +52,7 @@ export type sendProps = {
51
52
 
52
53
  type SubmitBody = PhoneOnly | LeadRequest | CheckCodeProps | VerifiedLeadRequest;
53
54
 
55
+ // eslint-disable-next-line max-lines-per-function
54
56
  export function LeadServiceAPI() {
55
57
  async function send({ body, router, endpoint }: sendProps) {
56
58
  const calculatedEndpoint = endpoint && getEndpoint(endpoint, body);
@@ -95,11 +97,16 @@ export function LeadServiceAPI() {
95
97
  }
96
98
  }
97
99
 
98
- async function checkCode({ reqId, code, body }: CheckCodeProps): Promise<CheckCodeResponse> {
100
+ async function checkCode({
101
+ reqId,
102
+ code,
103
+ body,
104
+ router,
105
+ }: CheckCodeProps): Promise<CheckCodeResponse> {
99
106
  const submitBody = {
100
107
  requestId: reqId,
101
108
  confimationCode: code, // не исправлять опечатку!
102
- leadRequest: getSubmitBody({ body }),
109
+ leadRequest: getSubmitBody({ body, router }),
103
110
  };
104
111
  try {
105
112
  const response = await LeadServiceFetch(`${API_BASE_URI}/confirmCorporateLead`, submitBody);
@@ -1,6 +1,7 @@
1
1
  import { useCallback, useState } from '@redneckz/uni-jsx/lib/hooks';
2
2
  import { useBool } from '@redneckz/uni-jsx/lib/hooks/useBool';
3
3
  import { LeadServiceAPI, type LeadRequest } from '../../api/LeadServiceAPI';
4
+ import { useRouter } from '../../external/useRouter';
4
5
  import { getTimer } from '../../utils/getTimer';
5
6
  const API = LeadServiceAPI();
6
7
 
@@ -18,6 +19,7 @@ export const useVerifyPhoneDialogSubmit = ({
18
19
  reqId,
19
20
  }: useVerifyPhoneDialogSubmitProps) => {
20
21
  const timer = Math.max(getTimer(Date.now()), 0);
22
+ const router = useRouter();
21
23
 
22
24
  const [errorText, setErrorText] = useState('');
23
25
  const [isLoading, { setTrue: startLoading, setFalse: endLoading }] = useBool(false);
@@ -34,6 +36,7 @@ export const useVerifyPhoneDialogSubmit = ({
34
36
  code: values.join(''),
35
37
  body: formatData,
36
38
  reqId,
39
+ router,
37
40
  });
38
41
  if (response?.errorDesc) {
39
42
  setErrorText(response?.errorDesc);
@@ -46,7 +46,7 @@ export const CaptchaDialog = JSX<CaptchaDialogProps>(({ phoneNumber, sendCode, o
46
46
  useEffect(handleCreateCaptcha, []);
47
47
 
48
48
  return (
49
- <Dialog head={<Logo />} onClose={onClose}>
49
+ <Dialog head={<Logo />} onClose={closeAll}>
50
50
  <div className="flex flex-col gap-lg items-center">
51
51
  <div className="flex">
52
52
  <img className="grow" src={captcha}></img>
@@ -1,6 +1,7 @@
1
1
  import { JSX } from '@redneckz/uni-jsx';
2
2
  import { useCallback } from '@redneckz/uni-jsx/lib/hooks';
3
3
  import { type CustomFieldProps } from '../../../ui-kit/FormField/CustomFieldProps';
4
+ import { autoLayoutKeyboard } from '../../utils/autoLayoutKeyboard';
4
5
  import { isEsiaAuthorize } from '../../utils/isEsiaAuthorize';
5
6
  import { retailCyrillicPattern } from '../../validator/validators';
6
7
  import { DaDataInputControl } from '../DaDataInputControl/DaDataInputControl';
@@ -8,8 +9,9 @@ import { DaDataInputControl } from '../DaDataInputControl/DaDataInputControl';
8
9
  export const MiddleNameField = JSX<CustomFieldProps>(({ field, input }) => {
9
10
  const onChange = useCallback(
10
11
  (value: string) => {
11
- if (retailCyrillicPattern.test(value) || value.length === 0) {
12
- field('middleName')?.onChange?.(value);
12
+ const translatedValue = autoLayoutKeyboard(value);
13
+ if (retailCyrillicPattern.test(translatedValue) || translatedValue.length === 0) {
14
+ field('middleName')?.onChange?.(translatedValue);
13
15
  }
14
16
  },
15
17
  [field],
@@ -1,6 +1,7 @@
1
1
  import { JSX } from '@redneckz/uni-jsx';
2
2
  import { useCallback } from '@redneckz/uni-jsx/lib/hooks';
3
3
  import { type CustomFieldProps } from '../../../ui-kit/FormField/CustomFieldProps';
4
+ import { autoLayoutKeyboard } from '../../utils/autoLayoutKeyboard';
4
5
  import { isEsiaAuthorize } from '../../utils/isEsiaAuthorize';
5
6
  import { retailCyrillicPattern } from '../../validator/validators';
6
7
  import { DaDataInputControl } from '../DaDataInputControl/DaDataInputControl';
@@ -8,8 +9,9 @@ import { DaDataInputControl } from '../DaDataInputControl/DaDataInputControl';
8
9
  export const NameField = JSX<CustomFieldProps>(({ field, input }) => {
9
10
  const onChange = useCallback(
10
11
  (value: string) => {
11
- if (retailCyrillicPattern.test(value) || value.length === 0) {
12
- field('name')?.onChange?.(value);
12
+ const translatedValue = autoLayoutKeyboard(value);
13
+ if (retailCyrillicPattern.test(translatedValue) || translatedValue.length === 0) {
14
+ field('name')?.onChange?.(translatedValue);
13
15
  }
14
16
  },
15
17
  [field],
@@ -1,6 +1,7 @@
1
1
  import { JSX } from '@redneckz/uni-jsx';
2
2
  import { useCallback } from '@redneckz/uni-jsx/lib/hooks';
3
3
  import { type CustomFieldProps } from '../../../ui-kit/FormField/CustomFieldProps';
4
+ import { autoLayoutKeyboard } from '../../utils/autoLayoutKeyboard';
4
5
  import { isEsiaAuthorize } from '../../utils/isEsiaAuthorize';
5
6
  import { retailCyrillicPattern } from '../../validator/validators';
6
7
  import { DaDataInputControl } from '../DaDataInputControl/DaDataInputControl';
@@ -8,8 +9,10 @@ import { DaDataInputControl } from '../DaDataInputControl/DaDataInputControl';
8
9
  export const SurnameField = JSX<CustomFieldProps>(({ field, input }) => {
9
10
  const onChange = useCallback(
10
11
  (value: string) => {
11
- if (retailCyrillicPattern.test(value) || value.length === 0) {
12
- field('surname')?.onChange?.(value);
12
+ const translatedValue = autoLayoutKeyboard(value);
13
+
14
+ if (retailCyrillicPattern.test(translatedValue) || translatedValue.length === 0) {
15
+ field('surname')?.onChange?.(translatedValue);
13
16
  }
14
17
  },
15
18
  [field],
@@ -0,0 +1,57 @@
1
+ export const autoLayoutKeyboard = (str: string): string => {
2
+ const replacer = {
3
+ q: 'й',
4
+ w: 'ц',
5
+ e: 'у',
6
+ r: 'к',
7
+ t: 'е',
8
+ y: 'н',
9
+ u: 'г',
10
+
11
+ i: 'ш',
12
+ o: 'щ',
13
+ p: 'з',
14
+ '[': 'х',
15
+ ']': 'ъ',
16
+ a: 'ф',
17
+ s: 'ы',
18
+
19
+ d: 'в',
20
+ f: 'а',
21
+ g: 'п',
22
+ h: 'р',
23
+ j: 'о',
24
+ k: 'л',
25
+ l: 'д',
26
+
27
+ ';': 'ж',
28
+ "'": 'э',
29
+ z: 'я',
30
+ x: 'ч',
31
+ c: 'с',
32
+ v: 'м',
33
+ b: 'и',
34
+
35
+ n: 'т',
36
+ m: 'ь',
37
+ ',': 'б',
38
+ '.': 'ю',
39
+ '`': 'ё',
40
+
41
+ '{': 'Х',
42
+ '}': 'Ъ',
43
+ ':': 'Ж',
44
+ '~': 'Ё',
45
+ '"': 'Э',
46
+ '<': 'Б',
47
+ '>': 'Ю',
48
+
49
+ '\\': '\\',
50
+ '^': '^',
51
+ _: '_',
52
+ };
53
+
54
+ return str.replace(/[A-z,`~<.>;:\\'"[{\]}]/g, (x: string) => {
55
+ return x === x.toLowerCase() ? replacer[x] : replacer[x.toLowerCase()].toUpperCase();
56
+ });
57
+ };