@infosoftas/s4-orders-js-sdk 0.1.19 → 0.1.21-0
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/README.md +471 -426
- package/build/postcss-scope-tailwind.cjs +66 -0
- package/components.json +21 -0
- package/package.json +59 -43
- package/src/App.css +409 -0
- package/src/App.tsx +639 -569
- package/src/api/OrdersApi.ts +2 -2
- package/src/components/Alert/Alert.tsx +23 -22
- package/src/components/Button/Button.tsx +18 -22
- package/src/components/EHFForm/EHFForm.tsx +253 -235
- package/src/components/FormFields/AddressField.tsx +55 -62
- package/src/components/FormFields/EmailField.tsx +53 -58
- package/src/components/FormFields/InputField.tsx +52 -53
- package/src/components/FormFields/NameField.tsx +52 -53
- package/src/components/FormFields/PhoneField.tsx +53 -58
- package/src/components/FormFields/TermsCheckbox.tsx +70 -58
- package/src/components/FormFields/ToggleFiled.tsx +52 -63
- package/src/components/FormFields/fieldValidators.ts +71 -0
- package/src/components/OIOForm/OIOForm.tsx +132 -71
- package/src/components/OrderDenialModal/OrderDenialModal.tsx +102 -89
- package/src/components/OrderForm/ContactDetailsSection.tsx +71 -0
- package/src/components/OrderForm/OrderForm.tsx +177 -224
- package/src/components/OrderForm/PaymentMethodContent.tsx +62 -0
- package/src/components/OrderForm/PaymentMethodSection.tsx +79 -0
- package/src/components/OrderForm/SubmitConfirmationDialog.tsx +55 -0
- package/src/components/OrderForm/orderFormState.ts +171 -0
- package/src/components/OrderForm/useSlotElement.tsx +89 -0
- package/src/components/ui/alert-dialog.tsx +185 -0
- package/src/components/ui/alert.tsx +75 -0
- package/src/components/ui/button.tsx +55 -0
- package/src/components/ui/card.tsx +99 -0
- package/src/components/ui/checkbox.tsx +28 -0
- package/src/components/ui/field.tsx +238 -0
- package/src/components/ui/input.tsx +19 -0
- package/src/components/ui/label.tsx +19 -0
- package/src/components/ui/radio-group.tsx +37 -0
- package/src/components/ui/separator.tsx +24 -0
- package/src/components/ui/skeleton.tsx +13 -0
- package/src/components/ui/spinner.tsx +10 -0
- package/src/components/ui/switch.tsx +29 -0
- package/src/components/ui/textarea.tsx +17 -0
- package/src/constants/index.ts +0 -2
- package/src/custom.d.ts +4 -4
- package/src/enums/general.ts +1 -0
- package/src/hooks/useMessageEvent.tsx +54 -3
- package/src/hooks/useOrderForm.tsx +9 -2
- package/src/index.tsx +2 -0
- package/src/lib/utils.ts +1 -0
- package/src/types/general.ts +136 -111
- package/src/types/order.ts +8 -0
- package/src/utils/order.helper.ts +14 -3
- package/tsconfig.json +37 -38
- package/src/App.scss +0 -23
- package/src/assets/styles/forms.scss +0 -164
- package/src/assets/styles/general.scss +0 -46
- package/src/assets/styles/variables.scss +0 -29
- package/src/components/Alert/alert.scss +0 -21
- package/src/components/Button/button.scss +0 -48
- package/src/components/Loader/Loader.tsx +0 -22
- package/src/components/Loader/loader.scss +0 -37
- package/src/components/OrderDenialModal/orderDenialModal.scss +0 -42
- package/src/components/OrderForm/orderForm.scss +0 -10
package/src/api/OrdersApi.ts
CHANGED
|
@@ -1,22 +1,23 @@
|
|
|
1
|
-
import { FC } from 'react';
|
|
2
|
-
|
|
3
|
-
import '
|
|
4
|
-
|
|
5
|
-
type Props = {
|
|
6
|
-
msg?: string;
|
|
7
|
-
type?: 'danger' | 'success';
|
|
8
|
-
className?: string;
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
const Alert: FC<Props> = ({ msg, type = 'danger', className
|
|
12
|
-
return msg ? (
|
|
13
|
-
<
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
|
|
3
|
+
import { Alert as UIAlert, AlertDescription } from '../ui/alert';
|
|
4
|
+
|
|
5
|
+
type Props = {
|
|
6
|
+
msg?: string;
|
|
7
|
+
type?: 'danger' | 'success';
|
|
8
|
+
className?: string;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
const Alert: FC<Props> = ({ msg, type = 'danger', className }) => {
|
|
12
|
+
return msg ? (
|
|
13
|
+
<UIAlert
|
|
14
|
+
variant={type === 'danger' ? 'destructive' : 'default'}
|
|
15
|
+
className={className}
|
|
16
|
+
data-testid="sdk-alert-id"
|
|
17
|
+
>
|
|
18
|
+
<AlertDescription>{msg}</AlertDescription>
|
|
19
|
+
</UIAlert>
|
|
20
|
+
) : null;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export default Alert;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { FC, MouseEvent } from 'react';
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
import './button.scss';
|
|
3
|
+
import { Button as UIButton } from '../ui/button';
|
|
4
|
+
import { Spinner } from '../ui/spinner';
|
|
6
5
|
|
|
7
6
|
type Props = {
|
|
8
7
|
onClick?: (e: MouseEvent<HTMLButtonElement>) => void;
|
|
@@ -11,6 +10,7 @@ type Props = {
|
|
|
11
10
|
buttonText?: string;
|
|
12
11
|
loading?: boolean;
|
|
13
12
|
disable?: boolean;
|
|
13
|
+
className?: string;
|
|
14
14
|
};
|
|
15
15
|
|
|
16
16
|
const Button: FC<Props> = ({
|
|
@@ -20,24 +20,20 @@ const Button: FC<Props> = ({
|
|
|
20
20
|
buttonText = 'Start',
|
|
21
21
|
loading = false,
|
|
22
22
|
disable = false,
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
{loading ? <Loader className="btn-loader" /> : buttonText}
|
|
39
|
-
</button>
|
|
40
|
-
);
|
|
41
|
-
};
|
|
23
|
+
className,
|
|
24
|
+
}) => (
|
|
25
|
+
<UIButton
|
|
26
|
+
data-testid="sdk-button-id"
|
|
27
|
+
type={type}
|
|
28
|
+
variant={btnType === 'primary' ? 'default' : 'ghost'}
|
|
29
|
+
disabled={loading || disable}
|
|
30
|
+
aria-busy={loading || undefined}
|
|
31
|
+
className={className}
|
|
32
|
+
onClick={onClick}
|
|
33
|
+
>
|
|
34
|
+
{loading && <Spinner data-icon="inline-start" />}
|
|
35
|
+
{buttonText}
|
|
36
|
+
</UIButton>
|
|
37
|
+
);
|
|
42
38
|
|
|
43
39
|
export default Button;
|
|
@@ -1,235 +1,253 @@
|
|
|
1
|
-
import { FC } from 'react';
|
|
2
|
-
import { FormProvider, useForm, SubmitHandler } from 'react-hook-form';
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
import {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
|
|
1
|
+
import { FC, useMemo } from 'react';
|
|
2
|
+
import { FormProvider, useForm, SubmitHandler } from 'react-hook-form';
|
|
3
|
+
import { zodResolver } from '@hookform/resolvers/zod';
|
|
4
|
+
import z from 'zod';
|
|
5
|
+
|
|
6
|
+
import Alert from '../Alert/Alert';
|
|
7
|
+
import Button from '../Button/Button';
|
|
8
|
+
import OrderDenialModal from '../OrderDenialModal/OrderDenialModal';
|
|
9
|
+
import InputField from '../FormFields/InputField';
|
|
10
|
+
import { FieldGroup } from '../ui/field';
|
|
11
|
+
import { PaymentMethodEnum, UserActionEnum } from '../../enums/general';
|
|
12
|
+
import {
|
|
13
|
+
OrderFormFieldType,
|
|
14
|
+
PaymentMethodSettingsType,
|
|
15
|
+
ContactRequestType,
|
|
16
|
+
OrderDenialFallbackOfferType,
|
|
17
|
+
} from '../../types/general';
|
|
18
|
+
import { OrderFormInputsType, OrderInfoType } from '../../types/order';
|
|
19
|
+
import { orderInvoiceContactFields } from '../../utils/order.helper';
|
|
20
|
+
import useOrderForm from '../../hooks/useOrderForm';
|
|
21
|
+
import { DEFAULT_ORDER_FORM_FIELDS } from '../FormFields/FormFields.helper';
|
|
22
|
+
|
|
23
|
+
type Props = {
|
|
24
|
+
callback: (url: string | null, orderInfo?: OrderInfoType | null) => void;
|
|
25
|
+
onBack: () => void;
|
|
26
|
+
submitStartCallback?: (id: string) => void;
|
|
27
|
+
userActionCallback?: (
|
|
28
|
+
action: UserActionEnum,
|
|
29
|
+
args: object | null | undefined
|
|
30
|
+
) => void;
|
|
31
|
+
setContactCallback?: (contactInfo: ContactRequestType) => void;
|
|
32
|
+
className?: string;
|
|
33
|
+
backButtonText?: string;
|
|
34
|
+
verifyButtonText?: string;
|
|
35
|
+
orderDenialCloseButtonText?: string;
|
|
36
|
+
orderDenialContinueButtonText?: string;
|
|
37
|
+
organizationNumberLabel?: string;
|
|
38
|
+
organizationNumber?: string;
|
|
39
|
+
glnLabel?: string;
|
|
40
|
+
templatePackageId: string;
|
|
41
|
+
subscriberId?: string;
|
|
42
|
+
userId?: string;
|
|
43
|
+
identityProviderId?: string;
|
|
44
|
+
organizationId: string;
|
|
45
|
+
redirectUrl?: string;
|
|
46
|
+
showIframe?: boolean;
|
|
47
|
+
language: string;
|
|
48
|
+
merchantAgreementUrl: string;
|
|
49
|
+
orderValues?: OrderFormInputsType;
|
|
50
|
+
paymentMethodsOptions?: PaymentMethodSettingsType;
|
|
51
|
+
invoiceAddressSelection?: {
|
|
52
|
+
enabled?: boolean;
|
|
53
|
+
label?: string;
|
|
54
|
+
fields?: OrderFormFieldType[];
|
|
55
|
+
paymentMethods?: PaymentMethodEnum[];
|
|
56
|
+
};
|
|
57
|
+
invoiceLookupNotFoundText?: string;
|
|
58
|
+
errorReqMsg?: string;
|
|
59
|
+
errorValidationTitleMsg?: string;
|
|
60
|
+
errorValidationDenialOrderBlockingMsg?: string;
|
|
61
|
+
errorValidationBlockingOffersMsg?: string;
|
|
62
|
+
orderDenialOfferBaseText?: string;
|
|
63
|
+
orderDenialOfferWithFallbackText?: string;
|
|
64
|
+
orderDenialAmountText?: string;
|
|
65
|
+
fetchDenialFallbackOffer?: (
|
|
66
|
+
organizationId: string
|
|
67
|
+
) => Promise<OrderDenialFallbackOfferType | undefined>;
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
const buildFormSchema = (errorReqMsg?: string) => {
|
|
71
|
+
const message = errorReqMsg || 'This field is required!';
|
|
72
|
+
|
|
73
|
+
return z.object({
|
|
74
|
+
organizationNumber: z.string().min(1, message).regex(/\S/, message),
|
|
75
|
+
});
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
type EHFFormInputsType = { organizationNumber: string };
|
|
79
|
+
|
|
80
|
+
const initialData = {
|
|
81
|
+
organizationNumber: '',
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
const EHFForm: FC<Props> = ({
|
|
85
|
+
callback,
|
|
86
|
+
onBack,
|
|
87
|
+
submitStartCallback,
|
|
88
|
+
userActionCallback,
|
|
89
|
+
setContactCallback,
|
|
90
|
+
className = '',
|
|
91
|
+
backButtonText = '',
|
|
92
|
+
verifyButtonText = '',
|
|
93
|
+
orderDenialCloseButtonText = 'Close',
|
|
94
|
+
orderDenialContinueButtonText = 'Continue',
|
|
95
|
+
organizationNumberLabel = '',
|
|
96
|
+
organizationNumber = '',
|
|
97
|
+
templatePackageId,
|
|
98
|
+
subscriberId,
|
|
99
|
+
userId,
|
|
100
|
+
identityProviderId,
|
|
101
|
+
organizationId,
|
|
102
|
+
redirectUrl,
|
|
103
|
+
showIframe,
|
|
104
|
+
language,
|
|
105
|
+
merchantAgreementUrl,
|
|
106
|
+
orderValues,
|
|
107
|
+
paymentMethodsOptions,
|
|
108
|
+
invoiceAddressSelection,
|
|
109
|
+
invoiceLookupNotFoundText,
|
|
110
|
+
errorReqMsg,
|
|
111
|
+
errorValidationTitleMsg,
|
|
112
|
+
errorValidationDenialOrderBlockingMsg,
|
|
113
|
+
errorValidationBlockingOffersMsg,
|
|
114
|
+
orderDenialOfferBaseText,
|
|
115
|
+
orderDenialOfferWithFallbackText,
|
|
116
|
+
orderDenialAmountText,
|
|
117
|
+
fetchDenialFallbackOffer,
|
|
118
|
+
}) => {
|
|
119
|
+
const formSchema = useMemo(
|
|
120
|
+
() => buildFormSchema(errorReqMsg),
|
|
121
|
+
[errorReqMsg]
|
|
122
|
+
);
|
|
123
|
+
|
|
124
|
+
const methods = useForm<EHFFormInputsType>({
|
|
125
|
+
resolver: zodResolver(formSchema),
|
|
126
|
+
defaultValues: {
|
|
127
|
+
...initialData,
|
|
128
|
+
organizationNumber,
|
|
129
|
+
},
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
const { handleSubmit } = methods;
|
|
133
|
+
|
|
134
|
+
const invoiceOrderFields =
|
|
135
|
+
invoiceAddressSelection?.fields || orderInvoiceContactFields;
|
|
136
|
+
|
|
137
|
+
const orderFields =
|
|
138
|
+
paymentMethodsOptions?.[orderValues?.paymentMethod as PaymentMethodEnum]
|
|
139
|
+
?.orderFormFields ?? DEFAULT_ORDER_FORM_FIELDS;
|
|
140
|
+
|
|
141
|
+
const {
|
|
142
|
+
orderSubmit,
|
|
143
|
+
continueWithFallbackOffer,
|
|
144
|
+
loading,
|
|
145
|
+
apiErrorMsg,
|
|
146
|
+
errorsMsg,
|
|
147
|
+
orderDenialType,
|
|
148
|
+
orderDenialMessage,
|
|
149
|
+
orderDenialFallbackOffer,
|
|
150
|
+
dismissOrderDenial,
|
|
151
|
+
} = useOrderForm({
|
|
152
|
+
callback,
|
|
153
|
+
submitStartCallback,
|
|
154
|
+
userActionCallback,
|
|
155
|
+
setContactCallback,
|
|
156
|
+
organizationId,
|
|
157
|
+
subscriberId,
|
|
158
|
+
userId,
|
|
159
|
+
identityProviderId,
|
|
160
|
+
orderFields,
|
|
161
|
+
redirectUrl,
|
|
162
|
+
showIframe,
|
|
163
|
+
language,
|
|
164
|
+
merchantAgreementUrl,
|
|
165
|
+
paymentMethodsOptions,
|
|
166
|
+
templatePackageId,
|
|
167
|
+
invoiceAddressToggle: orderValues?.invoiceAddressSelection,
|
|
168
|
+
invoiceOrderFields,
|
|
169
|
+
invoiceLookupNotFoundText,
|
|
170
|
+
errorValidationTitleMsg,
|
|
171
|
+
errorValidationDenialOrderBlockingMsg,
|
|
172
|
+
errorValidationBlockingOffersMsg,
|
|
173
|
+
orderDenialOfferBaseText,
|
|
174
|
+
orderDenialOfferWithFallbackText,
|
|
175
|
+
orderDenialAmountText,
|
|
176
|
+
fetchDenialFallbackOffer,
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
const onSubmit: SubmitHandler<EHFFormInputsType> = async (
|
|
180
|
+
data
|
|
181
|
+
): Promise<void> => {
|
|
182
|
+
orderSubmit({
|
|
183
|
+
...orderValues,
|
|
184
|
+
organizationNumber: data.organizationNumber,
|
|
185
|
+
});
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
const handleBack = () => {
|
|
189
|
+
userActionCallback?.(UserActionEnum.RETURN_TO_MAIN, null);
|
|
190
|
+
onBack?.();
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
return (
|
|
194
|
+
<FormProvider {...methods}>
|
|
195
|
+
<form
|
|
196
|
+
className={`${className}`}
|
|
197
|
+
noValidate
|
|
198
|
+
onSubmit={handleSubmit(onSubmit)}
|
|
199
|
+
data-testid="ehf-form-id"
|
|
200
|
+
>
|
|
201
|
+
<FieldGroup className="mb-5">
|
|
202
|
+
<InputField
|
|
203
|
+
name="organizationNumber"
|
|
204
|
+
label={organizationNumberLabel}
|
|
205
|
+
required
|
|
206
|
+
readOnly={false}
|
|
207
|
+
/>
|
|
208
|
+
</FieldGroup>
|
|
209
|
+
<div className="flex justify-center flex-wrap gap-2">
|
|
210
|
+
<Button
|
|
211
|
+
type="button"
|
|
212
|
+
btnType="default"
|
|
213
|
+
disable={loading}
|
|
214
|
+
buttonText={backButtonText}
|
|
215
|
+
onClick={handleBack}
|
|
216
|
+
/>
|
|
217
|
+
|
|
218
|
+
<Button
|
|
219
|
+
type="submit"
|
|
220
|
+
loading={loading}
|
|
221
|
+
buttonText={verifyButtonText}
|
|
222
|
+
/>
|
|
223
|
+
</div>
|
|
224
|
+
|
|
225
|
+
{apiErrorMsg && <Alert className="mt-2" msg={apiErrorMsg} />}
|
|
226
|
+
{errorsMsg?.length > 0 &&
|
|
227
|
+
errorsMsg.map((i, index) => (
|
|
228
|
+
<Alert key={index} className="mt-2" msg={i} />
|
|
229
|
+
))}
|
|
230
|
+
<OrderDenialModal
|
|
231
|
+
isOpen={!!orderDenialType}
|
|
232
|
+
message={orderDenialMessage}
|
|
233
|
+
closeButtonText={orderDenialCloseButtonText}
|
|
234
|
+
continueButtonText={orderDenialContinueButtonText}
|
|
235
|
+
canContinue={
|
|
236
|
+
orderDenialType === 'offer' &&
|
|
237
|
+
!!orderDenialFallbackOffer?.templatePackageId
|
|
238
|
+
}
|
|
239
|
+
offer={
|
|
240
|
+
orderDenialType === 'offer' &&
|
|
241
|
+
!!orderDenialFallbackOffer?.templatePackageId
|
|
242
|
+
? orderDenialFallbackOffer
|
|
243
|
+
: undefined
|
|
244
|
+
}
|
|
245
|
+
onClose={dismissOrderDenial}
|
|
246
|
+
onContinue={continueWithFallbackOffer}
|
|
247
|
+
/>
|
|
248
|
+
</form>
|
|
249
|
+
</FormProvider>
|
|
250
|
+
);
|
|
251
|
+
};
|
|
252
|
+
|
|
253
|
+
export default EHFForm;
|