@infosoftas/s4-orders-js-sdk 0.1.21 → 0.2.1

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 (72) hide show
  1. package/.editorconfig +0 -0
  2. package/.release-it.json +0 -0
  3. package/README.md +572 -471
  4. package/build/postcss-scope-tailwind.cjs +0 -0
  5. package/components.json +0 -0
  6. package/package.json +62 -58
  7. package/src/App.completion.test.tsx +677 -0
  8. package/src/App.css +0 -14
  9. package/src/App.paymentReturn.test.tsx +341 -0
  10. package/src/App.tsx +722 -639
  11. package/src/ErrorBoundary.tsx +0 -0
  12. package/src/api/InvoiceApi.ts +0 -0
  13. package/src/api/OrdersApi.ts +74 -59
  14. package/src/api/SubscribeApi.ts +0 -0
  15. package/src/bundle.ts +0 -0
  16. package/src/components/Alert/Alert.tsx +0 -0
  17. package/src/components/Button/Button.tsx +0 -0
  18. package/src/components/EHFForm/EHFForm.tsx +250 -253
  19. package/src/components/FormFields/AddressField.tsx +0 -0
  20. package/src/components/FormFields/EmailField.tsx +0 -0
  21. package/src/components/FormFields/FormFields.helper.ts +0 -0
  22. package/src/components/FormFields/FormFieldsMapper.ts +0 -0
  23. package/src/components/FormFields/InputField.tsx +0 -0
  24. package/src/components/FormFields/NameField.tsx +0 -0
  25. package/src/components/FormFields/PhoneField.tsx +0 -0
  26. package/src/components/FormFields/TermsCheckbox.tsx +0 -0
  27. package/src/components/FormFields/ToggleFiled.tsx +0 -0
  28. package/src/components/FormFields/fieldValidators.ts +0 -0
  29. package/src/components/OIOForm/OIOForm.tsx +304 -307
  30. package/src/components/OrderDenialModal/OrderDenialModal.tsx +0 -0
  31. package/src/components/OrderForm/ContactDetailsSection.tsx +0 -0
  32. package/src/components/OrderForm/OrderForm.tsx +417 -420
  33. package/src/components/OrderForm/PaymentMethodContent.tsx +0 -0
  34. package/src/components/OrderForm/PaymentMethodSection.tsx +0 -0
  35. package/src/components/OrderForm/SubmitConfirmationDialog.tsx +0 -0
  36. package/src/components/OrderForm/orderFormState.ts +0 -0
  37. package/src/components/OrderForm/useSlotElement.tsx +0 -0
  38. package/src/components/ui/alert-dialog.tsx +0 -0
  39. package/src/components/ui/alert.tsx +0 -0
  40. package/src/components/ui/button.tsx +0 -0
  41. package/src/components/ui/card.tsx +0 -0
  42. package/src/components/ui/checkbox.tsx +0 -0
  43. package/src/components/ui/field.tsx +0 -0
  44. package/src/components/ui/input.tsx +0 -0
  45. package/src/components/ui/label.tsx +0 -0
  46. package/src/components/ui/radio-group.tsx +0 -0
  47. package/src/components/ui/separator.tsx +0 -0
  48. package/src/components/ui/skeleton.tsx +0 -0
  49. package/src/components/ui/spinner.tsx +0 -0
  50. package/src/components/ui/switch.tsx +0 -0
  51. package/src/components/ui/textarea.tsx +0 -0
  52. package/src/constants/index.ts +0 -0
  53. package/src/custom.d.ts +0 -0
  54. package/src/enums/api.ts +0 -0
  55. package/src/enums/general.ts +42 -40
  56. package/src/hooks/useOrderForm.tsx +400 -403
  57. package/src/hooks/usePaymentReturn.tsx +139 -0
  58. package/src/hooks/useQueryParams.ts +0 -0
  59. package/src/index.tsx +0 -0
  60. package/src/lib/utils.ts +0 -0
  61. package/src/types/api.ts +0 -0
  62. package/src/types/general.ts +153 -136
  63. package/src/types/order.ts +91 -70
  64. package/src/utils/fetcher.ts +131 -113
  65. package/src/utils/helper.ts +0 -0
  66. package/src/utils/order.helper.test.ts +81 -0
  67. package/src/utils/order.helper.ts +285 -272
  68. package/src/utils/waitForOrderCompletion.ts +125 -0
  69. package/tsconfig.json +39 -38
  70. package/src/components/MainIframe/MainIframe.tsx +0 -42
  71. package/src/hooks/useIframe.tsx +0 -59
  72. package/src/hooks/useMessageEvent.tsx +0 -194
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -1,307 +1,304 @@
1
- import { type FC, useId, useMemo } from 'react';
2
- import { useForm, type SubmitHandler, Controller } from 'react-hook-form';
3
-
4
- import Alert from '../Alert/Alert';
5
- import Button from '../Button/Button';
6
- import OrderDenialModal from '../OrderDenialModal/OrderDenialModal';
7
- import { DEFAULT_ORDER_FORM_FIELDS } from '../FormFields/FormFields.helper';
8
-
9
- import { PaymentMethodEnum, UserActionEnum } from '../../enums/general';
10
- import type {
11
- OrderFormFieldType,
12
- PaymentMethodSettingsType,
13
- ContactRequestType,
14
- OrderDenialFallbackOfferType,
15
- } from '../../types/general';
16
- import useOrderForm from '../../hooks/useOrderForm';
17
- import { orderInvoiceContactFields } from '../../utils/order.helper';
18
- import type { OrderFormInputsType, OrderInfoType } from '../../types/order';
19
- import z from 'zod';
20
- import { zodResolver } from '@hookform/resolvers/zod';
21
- import { Field, FieldGroup, FieldLabel, FieldError } from '../ui/field';
22
- import { Input } from '../ui/input';
23
-
24
- type Props = {
25
- callback: (url: string | null, orderInfo?: OrderInfoType | null) => void;
26
- onBack: () => void;
27
- submitStartCallback?: (id: string) => void;
28
- userActionCallback?: (
29
- action: UserActionEnum,
30
- args: object | null | undefined
31
- ) => void;
32
- setContactCallback?: (contactInfo: ContactRequestType) => void;
33
- className?: string;
34
- backButtonText?: string;
35
- verifyButtonText?: string;
36
- orderDenialCloseButtonText?: string;
37
- orderDenialContinueButtonText?: string;
38
- organizationNumberLabel?: string;
39
- organizationNumber?: string;
40
- glnLabel?: string;
41
- templatePackageId: string;
42
- subscriberId?: string;
43
- userId?: string;
44
- identityProviderId?: string;
45
- organizationId: string;
46
- redirectUrl?: string;
47
- showIframe?: boolean;
48
- language: string;
49
- merchantAgreementUrl: string;
50
- orderValues?: OrderFormInputsType;
51
- paymentMethodsOptions?: PaymentMethodSettingsType;
52
- invoiceAddressSelection?: {
53
- enabled?: boolean;
54
- label?: string;
55
- fields?: OrderFormFieldType[];
56
- paymentMethods?: PaymentMethodEnum[];
57
- };
58
- invoiceLookupNotFoundText?: string;
59
- errorReqMsg?: string;
60
- errorValidationTitleMsg?: string;
61
- errorValidationDenialOrderBlockingMsg?: string;
62
- errorValidationBlockingOffersMsg?: string;
63
- orderDenialOfferBaseText?: string;
64
- orderDenialOfferWithFallbackText?: string;
65
- orderDenialAmountText?: string;
66
- fetchDenialFallbackOffer?: (
67
- organizationId: string
68
- ) => Promise<OrderDenialFallbackOfferType | undefined>;
69
- };
70
-
71
- type OIOFormInputsType = {
72
- cvr: string;
73
- gln: string;
74
- };
75
-
76
- const initialData = {
77
- cvr: '',
78
- gln: '',
79
- };
80
-
81
- const buildFormSchema = (errorReqMsg?: string) =>
82
- z
83
- .object({
84
- cvr: z.string().trim(),
85
- gln: z.string().trim(),
86
- })
87
- .superRefine((data, ctx) => {
88
- if (!data.cvr && !data.gln) {
89
- const message = errorReqMsg || 'This field is required!';
90
- ctx.addIssue({
91
- code: z.ZodIssueCode.custom,
92
- message,
93
- path: ['cvr'],
94
- });
95
- ctx.addIssue({
96
- code: z.ZodIssueCode.custom,
97
- message,
98
- path: ['gln'],
99
- });
100
- }
101
- });
102
-
103
- const OIOForm: FC<Props> = ({
104
- callback,
105
- onBack,
106
- submitStartCallback,
107
- userActionCallback,
108
- setContactCallback,
109
- className = '',
110
- backButtonText = '',
111
- verifyButtonText = '',
112
- orderDenialCloseButtonText = 'Close',
113
- orderDenialContinueButtonText = 'Continue',
114
- organizationNumberLabel = '',
115
- organizationNumber = '',
116
- glnLabel = '',
117
- templatePackageId,
118
- subscriberId,
119
- userId,
120
- identityProviderId,
121
- organizationId,
122
- redirectUrl,
123
- showIframe,
124
- language,
125
- merchantAgreementUrl,
126
- orderValues,
127
- paymentMethodsOptions,
128
- invoiceAddressSelection,
129
- invoiceLookupNotFoundText,
130
- errorReqMsg,
131
- errorValidationTitleMsg,
132
- errorValidationDenialOrderBlockingMsg,
133
- errorValidationBlockingOffersMsg,
134
- orderDenialOfferBaseText,
135
- orderDenialOfferWithFallbackText,
136
- orderDenialAmountText,
137
- fetchDenialFallbackOffer,
138
- }) => {
139
- const cvrId = useId();
140
- const glnId = useId();
141
-
142
- const formSchema = useMemo(
143
- () => buildFormSchema(errorReqMsg),
144
- [errorReqMsg]
145
- );
146
-
147
- const form = useForm<OIOFormInputsType>({
148
- resolver: zodResolver(formSchema),
149
- defaultValues: {
150
- ...initialData,
151
- cvr: organizationNumber,
152
- },
153
- });
154
-
155
- const { handleSubmit } = form;
156
-
157
- const invoiceOrderFields =
158
- invoiceAddressSelection?.fields || orderInvoiceContactFields;
159
-
160
- const orderFields =
161
- paymentMethodsOptions?.[orderValues?.paymentMethod as PaymentMethodEnum]
162
- ?.orderFormFields ?? DEFAULT_ORDER_FORM_FIELDS;
163
-
164
- const {
165
- orderSubmit,
166
- continueWithFallbackOffer,
167
- loading,
168
- apiErrorMsg,
169
- errorsMsg,
170
- orderDenialType,
171
- orderDenialMessage,
172
- orderDenialFallbackOffer,
173
- dismissOrderDenial,
174
- } = useOrderForm({
175
- callback,
176
- submitStartCallback,
177
- userActionCallback,
178
- setContactCallback,
179
- organizationId,
180
- subscriberId,
181
- userId,
182
- identityProviderId,
183
- orderFields,
184
- redirectUrl,
185
- showIframe,
186
- language,
187
- merchantAgreementUrl,
188
- paymentMethodsOptions,
189
- templatePackageId,
190
- invoiceAddressToggle: orderValues?.invoiceAddressSelection,
191
- invoiceOrderFields,
192
- invoiceLookupNotFoundText,
193
- errorValidationTitleMsg,
194
- errorValidationDenialOrderBlockingMsg,
195
- errorValidationBlockingOffersMsg,
196
- orderDenialOfferBaseText,
197
- orderDenialOfferWithFallbackText,
198
- orderDenialAmountText,
199
- fetchDenialFallbackOffer,
200
- });
201
-
202
- const onSubmit: SubmitHandler<OIOFormInputsType> = async (
203
- data
204
- ): Promise<void> => {
205
- await orderSubmit({ ...orderValues, gln: data.gln, cvr: data.cvr });
206
- };
207
-
208
- const handleBack = () => {
209
- userActionCallback?.(UserActionEnum.RETURN_TO_MAIN, null);
210
- onBack?.();
211
- };
212
-
213
- return (
214
- <form
215
- className={`${className}`}
216
- noValidate
217
- onSubmit={handleSubmit(onSubmit)}
218
- data-testid="oio-form-id"
219
- >
220
- <FieldGroup>
221
- <Controller
222
- name="cvr"
223
- control={form.control}
224
- render={({ field, fieldState }) => (
225
- <Field data-invalid={fieldState.invalid}>
226
- <FieldLabel htmlFor={cvrId}>
227
- {organizationNumberLabel}
228
- </FieldLabel>
229
- <Input
230
- {...field}
231
- id={cvrId}
232
- aria-invalid={fieldState.invalid}
233
- autoComplete="off"
234
- />
235
- {fieldState.error && (
236
- <FieldError>
237
- {fieldState.error.message}
238
- </FieldError>
239
- )}
240
- </Field>
241
- )}
242
- />
243
-
244
- <Controller
245
- name="gln"
246
- control={form.control}
247
- render={({ field, fieldState }) => (
248
- <Field data-invalid={fieldState.invalid}>
249
- <FieldLabel htmlFor={glnId}>{glnLabel}</FieldLabel>
250
- <Input
251
- {...field}
252
- id={glnId}
253
- aria-invalid={fieldState.invalid}
254
- autoComplete="off"
255
- />
256
- {fieldState.error && (
257
- <FieldError>
258
- {fieldState.error.message}
259
- </FieldError>
260
- )}
261
- </Field>
262
- )}
263
- />
264
- </FieldGroup>
265
- <div className="flex justify-center flex-wrap gap-2">
266
- <Button
267
- type="button"
268
- btnType="default"
269
- disable={loading}
270
- buttonText={backButtonText}
271
- onClick={handleBack}
272
- />
273
-
274
- <Button
275
- type="submit"
276
- loading={loading}
277
- buttonText={verifyButtonText}
278
- />
279
- </div>
280
- {apiErrorMsg && <Alert className="mt-2" msg={apiErrorMsg} />}
281
- {errorsMsg?.length > 0 &&
282
- errorsMsg.map((i, index) => (
283
- <Alert key={`${i}-${index}`} className="mt-2" msg={i} />
284
- ))}
285
- <OrderDenialModal
286
- isOpen={!!orderDenialType}
287
- message={orderDenialMessage}
288
- closeButtonText={orderDenialCloseButtonText}
289
- continueButtonText={orderDenialContinueButtonText}
290
- canContinue={
291
- orderDenialType === 'offer' &&
292
- !!orderDenialFallbackOffer?.templatePackageId
293
- }
294
- offer={
295
- orderDenialType === 'offer' &&
296
- !!orderDenialFallbackOffer?.templatePackageId
297
- ? orderDenialFallbackOffer
298
- : undefined
299
- }
300
- onClose={dismissOrderDenial}
301
- onContinue={continueWithFallbackOffer}
302
- />
303
- </form>
304
- );
305
- };
306
-
307
- export default OIOForm;
1
+ import { type FC, useId, useMemo } from 'react';
2
+ import { useForm, type SubmitHandler, Controller } from 'react-hook-form';
3
+
4
+ import Alert from '../Alert/Alert';
5
+ import Button from '../Button/Button';
6
+ import OrderDenialModal from '../OrderDenialModal/OrderDenialModal';
7
+ import { DEFAULT_ORDER_FORM_FIELDS } from '../FormFields/FormFields.helper';
8
+
9
+ import { PaymentMethodEnum, UserActionEnum } from '../../enums/general';
10
+ import type {
11
+ OrderFormFieldType,
12
+ PaymentMethodSettingsType,
13
+ ContactRequestType,
14
+ OrderDenialFallbackOfferType,
15
+ } from '../../types/general';
16
+ import useOrderForm from '../../hooks/useOrderForm';
17
+ import { orderInvoiceContactFields } from '../../utils/order.helper';
18
+ import type { OrderFormInputsType, OrderInfoType } from '../../types/order';
19
+ import z from 'zod';
20
+ import { zodResolver } from '@hookform/resolvers/zod';
21
+ import { Field, FieldGroup, FieldLabel, FieldError } from '../ui/field';
22
+ import { Input } from '../ui/input';
23
+
24
+ type Props = {
25
+ callback: (url: string | null, orderInfo?: OrderInfoType | null) => void;
26
+ onBack: () => void;
27
+ submitStartCallback?: (id: string) => void;
28
+ userActionCallback?: (
29
+ action: UserActionEnum,
30
+ args: object | null | undefined
31
+ ) => void;
32
+ setContactCallback?: (contactInfo: ContactRequestType) => void;
33
+ className?: string;
34
+ backButtonText?: string;
35
+ verifyButtonText?: string;
36
+ orderDenialCloseButtonText?: string;
37
+ orderDenialContinueButtonText?: string;
38
+ organizationNumberLabel?: string;
39
+ organizationNumber?: string;
40
+ glnLabel?: string;
41
+ templatePackageId: string;
42
+ subscriberId?: string;
43
+ userId?: string;
44
+ identityProviderId?: string;
45
+ organizationId: string;
46
+ redirectUrl?: string;
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
+ type OIOFormInputsType = {
71
+ cvr: string;
72
+ gln: string;
73
+ };
74
+
75
+ const initialData = {
76
+ cvr: '',
77
+ gln: '',
78
+ };
79
+
80
+ const buildFormSchema = (errorReqMsg?: string) =>
81
+ z
82
+ .object({
83
+ cvr: z.string().trim(),
84
+ gln: z.string().trim(),
85
+ })
86
+ .superRefine((data, ctx) => {
87
+ if (!data.cvr && !data.gln) {
88
+ const message = errorReqMsg || 'This field is required!';
89
+ ctx.addIssue({
90
+ code: z.ZodIssueCode.custom,
91
+ message,
92
+ path: ['cvr'],
93
+ });
94
+ ctx.addIssue({
95
+ code: z.ZodIssueCode.custom,
96
+ message,
97
+ path: ['gln'],
98
+ });
99
+ }
100
+ });
101
+
102
+ const OIOForm: FC<Props> = ({
103
+ callback,
104
+ onBack,
105
+ submitStartCallback,
106
+ userActionCallback,
107
+ setContactCallback,
108
+ className = '',
109
+ backButtonText = '',
110
+ verifyButtonText = '',
111
+ orderDenialCloseButtonText = 'Close',
112
+ orderDenialContinueButtonText = 'Continue',
113
+ organizationNumberLabel = '',
114
+ organizationNumber = '',
115
+ glnLabel = '',
116
+ templatePackageId,
117
+ subscriberId,
118
+ userId,
119
+ identityProviderId,
120
+ organizationId,
121
+ redirectUrl,
122
+ language,
123
+ merchantAgreementUrl,
124
+ orderValues,
125
+ paymentMethodsOptions,
126
+ invoiceAddressSelection,
127
+ invoiceLookupNotFoundText,
128
+ errorReqMsg,
129
+ errorValidationTitleMsg,
130
+ errorValidationDenialOrderBlockingMsg,
131
+ errorValidationBlockingOffersMsg,
132
+ orderDenialOfferBaseText,
133
+ orderDenialOfferWithFallbackText,
134
+ orderDenialAmountText,
135
+ fetchDenialFallbackOffer,
136
+ }) => {
137
+ const cvrId = useId();
138
+ const glnId = useId();
139
+
140
+ const formSchema = useMemo(
141
+ () => buildFormSchema(errorReqMsg),
142
+ [errorReqMsg]
143
+ );
144
+
145
+ const form = useForm<OIOFormInputsType>({
146
+ resolver: zodResolver(formSchema),
147
+ defaultValues: {
148
+ ...initialData,
149
+ cvr: organizationNumber,
150
+ },
151
+ });
152
+
153
+ const { handleSubmit } = form;
154
+
155
+ const invoiceOrderFields =
156
+ invoiceAddressSelection?.fields || orderInvoiceContactFields;
157
+
158
+ const orderFields =
159
+ paymentMethodsOptions?.[orderValues?.paymentMethod as PaymentMethodEnum]
160
+ ?.orderFormFields ?? DEFAULT_ORDER_FORM_FIELDS;
161
+
162
+ const {
163
+ orderSubmit,
164
+ continueWithFallbackOffer,
165
+ loading,
166
+ apiErrorMsg,
167
+ errorsMsg,
168
+ orderDenialType,
169
+ orderDenialMessage,
170
+ orderDenialFallbackOffer,
171
+ dismissOrderDenial,
172
+ } = useOrderForm({
173
+ callback,
174
+ submitStartCallback,
175
+ userActionCallback,
176
+ setContactCallback,
177
+ organizationId,
178
+ subscriberId,
179
+ userId,
180
+ identityProviderId,
181
+ orderFields,
182
+ redirectUrl,
183
+ language,
184
+ merchantAgreementUrl,
185
+ paymentMethodsOptions,
186
+ templatePackageId,
187
+ invoiceAddressToggle: orderValues?.invoiceAddressSelection,
188
+ invoiceOrderFields,
189
+ invoiceLookupNotFoundText,
190
+ errorValidationTitleMsg,
191
+ errorValidationDenialOrderBlockingMsg,
192
+ errorValidationBlockingOffersMsg,
193
+ orderDenialOfferBaseText,
194
+ orderDenialOfferWithFallbackText,
195
+ orderDenialAmountText,
196
+ fetchDenialFallbackOffer,
197
+ });
198
+
199
+ const onSubmit: SubmitHandler<OIOFormInputsType> = async (
200
+ data
201
+ ): Promise<void> => {
202
+ await orderSubmit({ ...orderValues, gln: data.gln, cvr: data.cvr });
203
+ };
204
+
205
+ const handleBack = () => {
206
+ userActionCallback?.(UserActionEnum.RETURN_TO_MAIN, null);
207
+ onBack?.();
208
+ };
209
+
210
+ return (
211
+ <form
212
+ className={`${className}`}
213
+ noValidate
214
+ onSubmit={handleSubmit(onSubmit)}
215
+ data-testid="oio-form-id"
216
+ >
217
+ <FieldGroup>
218
+ <Controller
219
+ name="cvr"
220
+ control={form.control}
221
+ render={({ field, fieldState }) => (
222
+ <Field data-invalid={fieldState.invalid}>
223
+ <FieldLabel htmlFor={cvrId}>
224
+ {organizationNumberLabel}
225
+ </FieldLabel>
226
+ <Input
227
+ {...field}
228
+ id={cvrId}
229
+ aria-invalid={fieldState.invalid}
230
+ autoComplete="off"
231
+ />
232
+ {fieldState.error && (
233
+ <FieldError>
234
+ {fieldState.error.message}
235
+ </FieldError>
236
+ )}
237
+ </Field>
238
+ )}
239
+ />
240
+
241
+ <Controller
242
+ name="gln"
243
+ control={form.control}
244
+ render={({ field, fieldState }) => (
245
+ <Field data-invalid={fieldState.invalid}>
246
+ <FieldLabel htmlFor={glnId}>{glnLabel}</FieldLabel>
247
+ <Input
248
+ {...field}
249
+ id={glnId}
250
+ aria-invalid={fieldState.invalid}
251
+ autoComplete="off"
252
+ />
253
+ {fieldState.error && (
254
+ <FieldError>
255
+ {fieldState.error.message}
256
+ </FieldError>
257
+ )}
258
+ </Field>
259
+ )}
260
+ />
261
+ </FieldGroup>
262
+ <div className="flex justify-center flex-wrap gap-2">
263
+ <Button
264
+ type="button"
265
+ btnType="default"
266
+ disable={loading}
267
+ buttonText={backButtonText}
268
+ onClick={handleBack}
269
+ />
270
+
271
+ <Button
272
+ type="submit"
273
+ loading={loading}
274
+ buttonText={verifyButtonText}
275
+ />
276
+ </div>
277
+ {apiErrorMsg && <Alert className="mt-2" msg={apiErrorMsg} />}
278
+ {errorsMsg?.length > 0 &&
279
+ errorsMsg.map((i, index) => (
280
+ <Alert key={`${i}-${index}`} className="mt-2" msg={i} />
281
+ ))}
282
+ <OrderDenialModal
283
+ isOpen={!!orderDenialType}
284
+ message={orderDenialMessage}
285
+ closeButtonText={orderDenialCloseButtonText}
286
+ continueButtonText={orderDenialContinueButtonText}
287
+ canContinue={
288
+ orderDenialType === 'offer' &&
289
+ !!orderDenialFallbackOffer?.templatePackageId
290
+ }
291
+ offer={
292
+ orderDenialType === 'offer' &&
293
+ !!orderDenialFallbackOffer?.templatePackageId
294
+ ? orderDenialFallbackOffer
295
+ : undefined
296
+ }
297
+ onClose={dismissOrderDenial}
298
+ onContinue={continueWithFallbackOffer}
299
+ />
300
+ </form>
301
+ );
302
+ };
303
+
304
+ export default OIOForm;