@redneckz/wildless-cms-uni-blocks 0.14.1033 → 0.14.1035
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundle/bundle.umd.js +20 -16
- package/bundle/bundle.umd.min.js +1 -1
- package/bundle/components/ApplicationForm/renderAgreementSubmit.d.ts +10 -7
- package/bundle/retail/components/ConsentBkiDialog/useConsentBkiDialog.d.ts +1 -2
- package/dist/components/ApplicationForm/ApplicationForm.js +5 -0
- package/dist/components/ApplicationForm/ApplicationForm.js.map +1 -1
- package/dist/components/ApplicationForm/renderAgreementSubmit.d.ts +10 -7
- package/dist/components/ApplicationForm/renderAgreementSubmit.js +1 -1
- package/dist/components/ApplicationForm/renderAgreementSubmit.js.map +1 -1
- package/dist/components/ApplicationLeadForm/useApplicationLeadApi.js +0 -1
- package/dist/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
- package/dist/hooks/useForm/useForm.js +2 -2
- package/dist/hooks/useForm/useForm.js.map +1 -1
- package/dist/retail/api/getLastTaskStatus.js +4 -1
- package/dist/retail/api/getLastTaskStatus.js.map +1 -1
- package/dist/retail/components/ConsentBkiDialog/useConsentBkiDialog.d.ts +1 -2
- package/dist/retail/components/ConsentBkiDialog/useConsentBkiDialog.js +1 -2
- package/dist/retail/components/ConsentBkiDialog/useConsentBkiDialog.js.map +1 -1
- package/lib/components/ApplicationForm/ApplicationForm.js +5 -0
- package/lib/components/ApplicationForm/ApplicationForm.js.map +1 -1
- package/lib/components/ApplicationForm/renderAgreementSubmit.d.ts +10 -7
- package/lib/components/ApplicationForm/renderAgreementSubmit.js +1 -1
- package/lib/components/ApplicationForm/renderAgreementSubmit.js.map +1 -1
- package/lib/components/ApplicationLeadForm/useApplicationLeadApi.js +0 -1
- package/lib/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
- package/lib/hooks/useForm/useForm.js +2 -2
- package/lib/hooks/useForm/useForm.js.map +1 -1
- package/lib/retail/api/getLastTaskStatus.js +4 -1
- package/lib/retail/api/getLastTaskStatus.js.map +1 -1
- package/lib/retail/components/ConsentBkiDialog/useConsentBkiDialog.d.ts +1 -2
- package/lib/retail/components/ConsentBkiDialog/useConsentBkiDialog.js +1 -2
- package/lib/retail/components/ConsentBkiDialog/useConsentBkiDialog.js.map +1 -1
- package/mobile/bundle/bundle.umd.js +20 -16
- package/mobile/bundle/bundle.umd.min.js +1 -1
- package/mobile/bundle/components/ApplicationForm/renderAgreementSubmit.d.ts +10 -7
- package/mobile/bundle/retail/components/ConsentBkiDialog/useConsentBkiDialog.d.ts +1 -2
- package/mobile/dist/components/ApplicationForm/ApplicationForm.js +5 -0
- package/mobile/dist/components/ApplicationForm/ApplicationForm.js.map +1 -1
- package/mobile/dist/components/ApplicationForm/renderAgreementSubmit.d.ts +10 -7
- package/mobile/dist/components/ApplicationForm/renderAgreementSubmit.js +1 -1
- package/mobile/dist/components/ApplicationForm/renderAgreementSubmit.js.map +1 -1
- package/mobile/dist/components/ApplicationLeadForm/useApplicationLeadApi.js +0 -1
- package/mobile/dist/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
- package/mobile/dist/hooks/useForm/useForm.js +2 -2
- package/mobile/dist/hooks/useForm/useForm.js.map +1 -1
- package/mobile/dist/retail/api/getLastTaskStatus.js +4 -1
- package/mobile/dist/retail/api/getLastTaskStatus.js.map +1 -1
- package/mobile/dist/retail/components/ConsentBkiDialog/useConsentBkiDialog.d.ts +1 -2
- package/mobile/dist/retail/components/ConsentBkiDialog/useConsentBkiDialog.js +1 -2
- package/mobile/dist/retail/components/ConsentBkiDialog/useConsentBkiDialog.js.map +1 -1
- package/mobile/lib/components/ApplicationForm/ApplicationForm.js +5 -0
- package/mobile/lib/components/ApplicationForm/ApplicationForm.js.map +1 -1
- package/mobile/lib/components/ApplicationForm/renderAgreementSubmit.d.ts +10 -7
- package/mobile/lib/components/ApplicationForm/renderAgreementSubmit.js +1 -1
- package/mobile/lib/components/ApplicationForm/renderAgreementSubmit.js.map +1 -1
- package/mobile/lib/components/ApplicationLeadForm/useApplicationLeadApi.js +0 -1
- package/mobile/lib/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
- package/mobile/lib/hooks/useForm/useForm.js +2 -2
- package/mobile/lib/hooks/useForm/useForm.js.map +1 -1
- package/mobile/lib/retail/api/getLastTaskStatus.js +4 -1
- package/mobile/lib/retail/api/getLastTaskStatus.js.map +1 -1
- package/mobile/lib/retail/components/ConsentBkiDialog/useConsentBkiDialog.d.ts +1 -2
- package/mobile/lib/retail/components/ConsentBkiDialog/useConsentBkiDialog.js +1 -2
- package/mobile/lib/retail/components/ConsentBkiDialog/useConsentBkiDialog.js.map +1 -1
- package/mobile/src/components/ApplicationForm/ApplicationForm.tsx +5 -0
- package/mobile/src/components/ApplicationForm/renderAgreementSubmit.tsx +12 -8
- package/mobile/src/components/ApplicationLeadForm/useApplicationLeadApi.tsx +0 -1
- package/mobile/src/hooks/useForm/useForm.ts +2 -2
- package/mobile/src/retail/api/getLastTaskStatus.ts +6 -5
- package/mobile/src/retail/components/ConsentBkiDialog/useConsentBkiDialog.tsx +1 -3
- package/package.json +1 -1
- package/src/components/ApplicationForm/ApplicationForm.tsx +5 -0
- package/src/components/ApplicationForm/renderAgreementSubmit.tsx +12 -8
- package/src/components/ApplicationLeadForm/useApplicationLeadApi.tsx +0 -1
- package/src/hooks/useForm/useForm.ts +2 -2
- package/src/retail/api/getLastTaskStatus.ts +6 -5
- package/src/retail/components/ConsentBkiDialog/useConsentBkiDialog.tsx +1 -3
|
@@ -90,11 +90,11 @@ export function useForm<FormState extends Record<string, any>>(
|
|
|
90
90
|
}, [initialState, setFormState]);
|
|
91
91
|
|
|
92
92
|
const handleSubmit = useCallback(
|
|
93
|
-
(ev: PreventableEvent) => {
|
|
93
|
+
async (ev: PreventableEvent) => {
|
|
94
94
|
ev.preventDefault();
|
|
95
95
|
if (isValid) {
|
|
96
|
+
await onSubmit?.(formState, ev);
|
|
96
97
|
resetOnSubmit && reset();
|
|
97
|
-
onSubmit?.(formState, ev);
|
|
98
98
|
} else {
|
|
99
99
|
const errorFieldName = getErrorFieldName(formState, fieldValidatorsMap);
|
|
100
100
|
markAsDirty();
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { checkNewMicroservice } from '../utils/checkNewMicroservice';
|
|
1
2
|
import { fetchRetailJSON } from './doRequest';
|
|
2
3
|
|
|
3
4
|
type GetLastTaskStatusBody = {
|
|
@@ -12,11 +13,11 @@ type GetLastTaskStatusResponse = {
|
|
|
12
13
|
};
|
|
13
14
|
|
|
14
15
|
export const getLastTaskStatus = async (body: GetLastTaskStatusBody): Promise<number | null> => {
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
);
|
|
16
|
+
const isNewMicroservice = checkNewMicroservice();
|
|
17
|
+
|
|
18
|
+
const endpoint = isNewMicroservice ? '/public-data/getLastStatus' : '/user-data/getLastStatus';
|
|
19
|
+
|
|
20
|
+
const res = await fetchRetailJSON<GetLastTaskStatusResponse>(endpoint, 'POST', body);
|
|
20
21
|
|
|
21
22
|
return res?.statusCd === 'DRAFT' ? res?.taskId : null;
|
|
22
23
|
};
|
|
@@ -7,7 +7,6 @@ import { ConsentBkiDialog } from './ConsentBkiDialog';
|
|
|
7
7
|
type SubmitBkiConsentProps = {
|
|
8
8
|
phone?: string;
|
|
9
9
|
profileId?: number;
|
|
10
|
-
userId?: string | number;
|
|
11
10
|
onFail?: () => void;
|
|
12
11
|
taskId?: number;
|
|
13
12
|
participantId?: string | number;
|
|
@@ -66,12 +65,11 @@ export const useConsentBkiDialog = (onClose: () => void) => {
|
|
|
66
65
|
};
|
|
67
66
|
|
|
68
67
|
return {
|
|
69
|
-
open: ({ phone, profileId,
|
|
68
|
+
open: ({ phone, profileId, onFail, taskId, participantId }: SubmitBkiConsentProps) =>
|
|
70
69
|
open({
|
|
71
70
|
onSubmit: handleSubmitBkiConsent({
|
|
72
71
|
phone,
|
|
73
72
|
profileId,
|
|
74
|
-
userId,
|
|
75
73
|
onFail,
|
|
76
74
|
taskId,
|
|
77
75
|
participantId,
|
package/package.json
CHANGED
|
@@ -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 { useRouter } from '../../external/useRouter';
|
|
3
4
|
import { useAspects } from '../../hooks/useAspects/useAspects';
|
|
4
5
|
import { useForm } from '../../hooks/useForm/useForm';
|
|
@@ -74,9 +75,11 @@ export const ApplicationForm = UniBlock<ApplicationFormProps>(
|
|
|
74
75
|
const responseTypeDialog = useDialog(ResponseTypeDialog);
|
|
75
76
|
const verifyPhoneDialog = useDialog(VerifyPhoneDialog);
|
|
76
77
|
const openUserSurvey = useUserSurveyDialog(true);
|
|
78
|
+
const [isSending, { setTrue: startSending, setFalse: endSending }] = useBool(false);
|
|
77
79
|
|
|
78
80
|
const handleSubmit = useCallback(
|
|
79
81
|
async (formData: FormState, ev: PreventableEventWithTarget) => {
|
|
82
|
+
startSending();
|
|
80
83
|
const formatData = getFormatData({ ...formData, ...additionalParams });
|
|
81
84
|
|
|
82
85
|
await executeHandler(
|
|
@@ -95,6 +98,7 @@ export const ApplicationForm = UniBlock<ApplicationFormProps>(
|
|
|
95
98
|
},
|
|
96
99
|
endpoint,
|
|
97
100
|
);
|
|
101
|
+
endSending();
|
|
98
102
|
},
|
|
99
103
|
[typeForm],
|
|
100
104
|
);
|
|
@@ -121,6 +125,7 @@ export const ApplicationForm = UniBlock<ApplicationFormProps>(
|
|
|
121
125
|
additionalLink,
|
|
122
126
|
button,
|
|
123
127
|
typeForm,
|
|
128
|
+
isSending,
|
|
124
129
|
})}
|
|
125
130
|
</form>
|
|
126
131
|
{isContacts ? renderContacts() : null}
|
|
@@ -11,19 +11,23 @@ import { Footnote } from './Footnote';
|
|
|
11
11
|
const agreementText = 'Нажимая кнопку, вы подтверждаете согласие с ';
|
|
12
12
|
const agreementTextPF = 'Нажимая на кнопку, вы подтверждаете, что клиент дал согласие на ';
|
|
13
13
|
|
|
14
|
+
type renderAgreementSubmitProps = {
|
|
15
|
+
consentDataProcessing?: FieldProps<boolean>;
|
|
16
|
+
link?: LinkProps;
|
|
17
|
+
additionalLink?: LinkProps;
|
|
18
|
+
button?: SubmitButtonProps;
|
|
19
|
+
typeForm?: string;
|
|
20
|
+
isSending?: boolean;
|
|
21
|
+
};
|
|
22
|
+
|
|
14
23
|
export const renderAgreementSubmit = ({
|
|
15
24
|
consentDataProcessing,
|
|
16
25
|
link,
|
|
17
26
|
additionalLink,
|
|
18
27
|
button,
|
|
19
28
|
typeForm,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
link?: LinkProps;
|
|
23
|
-
additionalLink?: LinkProps;
|
|
24
|
-
button?: SubmitButtonProps;
|
|
25
|
-
typeForm?: string;
|
|
26
|
-
}) => (
|
|
29
|
+
isSending = false,
|
|
30
|
+
}: renderAgreementSubmitProps) => (
|
|
27
31
|
<div className="flex col-span-2 gap-xs flex-col w-full items-baseline">
|
|
28
32
|
{consentDataProcessing ? (
|
|
29
33
|
<div>
|
|
@@ -40,7 +44,7 @@ export const renderAgreementSubmit = ({
|
|
|
40
44
|
additionalLink={additionalLink}
|
|
41
45
|
/>
|
|
42
46
|
)}
|
|
43
|
-
<SubmitButton className="w-full @xl:w-auto">
|
|
47
|
+
<SubmitButton className="w-full @xl:w-auto" isLoading={isSending}>
|
|
44
48
|
{button?.text ? button.text : 'Отправить заявку'}
|
|
45
49
|
</SubmitButton>
|
|
46
50
|
</div>
|
|
@@ -90,11 +90,11 @@ export function useForm<FormState extends Record<string, any>>(
|
|
|
90
90
|
}, [initialState, setFormState]);
|
|
91
91
|
|
|
92
92
|
const handleSubmit = useCallback(
|
|
93
|
-
(ev: PreventableEvent) => {
|
|
93
|
+
async (ev: PreventableEvent) => {
|
|
94
94
|
ev.preventDefault();
|
|
95
95
|
if (isValid) {
|
|
96
|
+
await onSubmit?.(formState, ev);
|
|
96
97
|
resetOnSubmit && reset();
|
|
97
|
-
onSubmit?.(formState, ev);
|
|
98
98
|
} else {
|
|
99
99
|
const errorFieldName = getErrorFieldName(formState, fieldValidatorsMap);
|
|
100
100
|
markAsDirty();
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { checkNewMicroservice } from '../utils/checkNewMicroservice';
|
|
1
2
|
import { fetchRetailJSON } from './doRequest';
|
|
2
3
|
|
|
3
4
|
type GetLastTaskStatusBody = {
|
|
@@ -12,11 +13,11 @@ type GetLastTaskStatusResponse = {
|
|
|
12
13
|
};
|
|
13
14
|
|
|
14
15
|
export const getLastTaskStatus = async (body: GetLastTaskStatusBody): Promise<number | null> => {
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
);
|
|
16
|
+
const isNewMicroservice = checkNewMicroservice();
|
|
17
|
+
|
|
18
|
+
const endpoint = isNewMicroservice ? '/public-data/getLastStatus' : '/user-data/getLastStatus';
|
|
19
|
+
|
|
20
|
+
const res = await fetchRetailJSON<GetLastTaskStatusResponse>(endpoint, 'POST', body);
|
|
20
21
|
|
|
21
22
|
return res?.statusCd === 'DRAFT' ? res?.taskId : null;
|
|
22
23
|
};
|
|
@@ -7,7 +7,6 @@ import { ConsentBkiDialog } from './ConsentBkiDialog';
|
|
|
7
7
|
type SubmitBkiConsentProps = {
|
|
8
8
|
phone?: string;
|
|
9
9
|
profileId?: number;
|
|
10
|
-
userId?: string | number;
|
|
11
10
|
onFail?: () => void;
|
|
12
11
|
taskId?: number;
|
|
13
12
|
participantId?: string | number;
|
|
@@ -66,12 +65,11 @@ export const useConsentBkiDialog = (onClose: () => void) => {
|
|
|
66
65
|
};
|
|
67
66
|
|
|
68
67
|
return {
|
|
69
|
-
open: ({ phone, profileId,
|
|
68
|
+
open: ({ phone, profileId, onFail, taskId, participantId }: SubmitBkiConsentProps) =>
|
|
70
69
|
open({
|
|
71
70
|
onSubmit: handleSubmitBkiConsent({
|
|
72
71
|
phone,
|
|
73
72
|
profileId,
|
|
74
|
-
userId,
|
|
75
73
|
onFail,
|
|
76
74
|
taskId,
|
|
77
75
|
participantId,
|