@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/App.tsx
CHANGED
|
@@ -1,569 +1,639 @@
|
|
|
1
|
-
import { FC, useEffect, useState } from 'react';
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
FormTypeEnum,
|
|
5
|
-
MessageEventTypeEnum,
|
|
6
|
-
PaymentMethodEnum,
|
|
7
|
-
UserActionEnum,
|
|
8
|
-
} from './enums/general';
|
|
9
|
-
import useMessageEvent from './hooks/useMessageEvent';
|
|
10
|
-
import OrderForm from './components/OrderForm/OrderForm';
|
|
11
|
-
import OIOForm from './components/OIOForm/OIOForm';
|
|
12
|
-
import EHFForm from './components/EHFForm/EHFForm';
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
import {
|
|
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
|
-
glnLabel: 'GLN',
|
|
61
|
-
cvrLabel: 'CVR',
|
|
62
|
-
orderDefaultValues: undefined,
|
|
63
|
-
errorReqMsg: '',
|
|
64
|
-
errorInvalidEmailMsg: '',
|
|
65
|
-
errorInvalidPhoneMsg: '',
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
const [
|
|
87
|
-
const [
|
|
88
|
-
|
|
89
|
-
);
|
|
90
|
-
const [
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
const [
|
|
94
|
-
const [
|
|
95
|
-
const [
|
|
96
|
-
const [
|
|
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
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
}
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
}
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
}
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
}
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
}
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
}
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
1
|
+
import { FC, useEffect, useState } from 'react';
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
FormTypeEnum,
|
|
5
|
+
MessageEventTypeEnum,
|
|
6
|
+
PaymentMethodEnum,
|
|
7
|
+
UserActionEnum,
|
|
8
|
+
} from './enums/general';
|
|
9
|
+
import useMessageEvent from './hooks/useMessageEvent';
|
|
10
|
+
import OrderForm from './components/OrderForm/OrderForm';
|
|
11
|
+
import OIOForm from './components/OIOForm/OIOForm';
|
|
12
|
+
import EHFForm from './components/EHFForm/EHFForm';
|
|
13
|
+
import MainIframe from './components/MainIframe/MainIframe';
|
|
14
|
+
import Alert from './components/Alert/Alert';
|
|
15
|
+
import { Skeleton } from './components/ui/skeleton';
|
|
16
|
+
import { Card, CardContent } from './components/ui/card';
|
|
17
|
+
import { ConfigType, ErrorsMsg } from './types/general';
|
|
18
|
+
import {
|
|
19
|
+
CompleteOrderParamsType,
|
|
20
|
+
OrderInfoType,
|
|
21
|
+
OrderFormInputsType,
|
|
22
|
+
} from './types/order';
|
|
23
|
+
import { orderComplete, orderDelete } from './api/OrdersApi';
|
|
24
|
+
import { prepareErrorMessage, prepareErrorsArrayMessage } from './utils/helper';
|
|
25
|
+
|
|
26
|
+
import ErrorBoundary from './ErrorBoundary';
|
|
27
|
+
|
|
28
|
+
const App: FC<ConfigType> = ({
|
|
29
|
+
submitStartCallback,
|
|
30
|
+
userActionCallback,
|
|
31
|
+
setContactCallback,
|
|
32
|
+
cancelVippsCallback,
|
|
33
|
+
moduleTitle,
|
|
34
|
+
apiKey,
|
|
35
|
+
apiUrl,
|
|
36
|
+
templatePackageId,
|
|
37
|
+
subscriberId,
|
|
38
|
+
userId,
|
|
39
|
+
identityProviderId,
|
|
40
|
+
organizationId,
|
|
41
|
+
redirectUrl,
|
|
42
|
+
showIframe,
|
|
43
|
+
paymentMethodsOptions,
|
|
44
|
+
invoiceAddressSelection,
|
|
45
|
+
availablePaymentMethods = [],
|
|
46
|
+
allowedPaymentMethods,
|
|
47
|
+
requireTermsAcceptance,
|
|
48
|
+
language = 'en-US',
|
|
49
|
+
merchantAgreementUrl = '',
|
|
50
|
+
settings = {
|
|
51
|
+
successText: 'Order successful completed!',
|
|
52
|
+
failureText: 'Something went wrong!',
|
|
53
|
+
buttonText: 'Start',
|
|
54
|
+
submitButtonText: 'Start',
|
|
55
|
+
backButtonText: 'Back',
|
|
56
|
+
verifyButtonText: 'Verify',
|
|
57
|
+
organizationNumberLabel: 'Organization Number',
|
|
58
|
+
paymentMethodLabel: '',
|
|
59
|
+
contactDetailsLabel: '',
|
|
60
|
+
glnLabel: 'GLN',
|
|
61
|
+
cvrLabel: 'CVR',
|
|
62
|
+
orderDefaultValues: undefined,
|
|
63
|
+
errorReqMsg: '',
|
|
64
|
+
errorInvalidEmailMsg: '',
|
|
65
|
+
errorInvalidPhoneMsg: '',
|
|
66
|
+
errorTermsMsg: '',
|
|
67
|
+
errorValidationTitleMsg: 'One or more validation errors occurred.',
|
|
68
|
+
errorValidationDenialOrderBlockingMsg:
|
|
69
|
+
'The order/subscription will not be created because the subscriber has a denial order blocking all.',
|
|
70
|
+
errorValidationBlockingOffersMsg:
|
|
71
|
+
'The order/subscription will not be created because the subscriber has a denial order blocking offers.',
|
|
72
|
+
orderDenialOfferBaseText:
|
|
73
|
+
'Hello again!\n\nLooks like you already tried this offer.',
|
|
74
|
+
orderDenialOfferWithFallbackText:
|
|
75
|
+
'Hello again!\n\nLooks like you already tried this offer, but we would like to keep you with us.\n\nTherefore we got a new great offer for you:',
|
|
76
|
+
orderDenialAmountText:
|
|
77
|
+
'We are sorry, but you do not meet the requirements for this offer. Please contact customer service for more information.',
|
|
78
|
+
paymentMethodNotAllowedMsg: '',
|
|
79
|
+
invoiceLookupNotFoundText:
|
|
80
|
+
'There was no recipient found for the given information',
|
|
81
|
+
termsAndConditionsText: '',
|
|
82
|
+
orderDenialCloseButtonText: 'Close',
|
|
83
|
+
orderDenialContinueButtonText: 'Continue',
|
|
84
|
+
},
|
|
85
|
+
}) => {
|
|
86
|
+
const [loading, setLoading] = useState<boolean>(false);
|
|
87
|
+
const [showOrderForm, setShowOrderForm] = useState<boolean>(true);
|
|
88
|
+
const [iframeSrc, setIframeSrc] = useState<string | null>(null);
|
|
89
|
+
const [orderId, setOrderId] = useState<string | null>(null);
|
|
90
|
+
const [subscriberSdkId, setSubscriberSdkId] = useState<string | undefined>(
|
|
91
|
+
subscriberId || undefined
|
|
92
|
+
);
|
|
93
|
+
const [isConfirmed, setIsConfirmed] = useState<boolean>(false);
|
|
94
|
+
const [isFailed, setIsFailed] = useState<boolean>(false);
|
|
95
|
+
const [failedMsg, setFailedMsg] = useState<string>('');
|
|
96
|
+
const [errorsMsg, setErrorsMsg] = useState<string[]>([]);
|
|
97
|
+
const [orderInfo, setOrderInfo] = useState<OrderInfoType | null>(null);
|
|
98
|
+
const [formType, setFormType] = useState(FormTypeEnum.ORDER);
|
|
99
|
+
const [orderFormValues, setOrderFormValues] = useState(
|
|
100
|
+
settings?.orderDefaultValues
|
|
101
|
+
);
|
|
102
|
+
|
|
103
|
+
useEffect(() => {
|
|
104
|
+
if (apiKey) {
|
|
105
|
+
sessionStorage.setItem('sdk_api_key', apiKey);
|
|
106
|
+
localStorage.setItem('sdk_api_key', apiKey);
|
|
107
|
+
}
|
|
108
|
+
}, [apiKey]);
|
|
109
|
+
|
|
110
|
+
useEffect(() => {
|
|
111
|
+
if (apiUrl) {
|
|
112
|
+
sessionStorage.setItem('sdk_api_url', apiUrl);
|
|
113
|
+
}
|
|
114
|
+
}, [apiUrl]);
|
|
115
|
+
|
|
116
|
+
const messageCallback = async (
|
|
117
|
+
data: CompleteOrderParamsType
|
|
118
|
+
): Promise<void> => {
|
|
119
|
+
setLoading(true);
|
|
120
|
+
setIframeSrc(null);
|
|
121
|
+
setShowOrderForm(false);
|
|
122
|
+
setIsFailed(false);
|
|
123
|
+
setFailedMsg('');
|
|
124
|
+
setErrorsMsg([]);
|
|
125
|
+
try {
|
|
126
|
+
// There is no way to detect the difference between "cancelled" and "accepted" payment for Vipps via UI
|
|
127
|
+
// Completing an order for cancelled payment is fine. The backend handles it correctly.
|
|
128
|
+
await orderComplete(
|
|
129
|
+
orderId || data.orderId || '',
|
|
130
|
+
userId && identityProviderId
|
|
131
|
+
? {
|
|
132
|
+
userId,
|
|
133
|
+
identityProviderId,
|
|
134
|
+
}
|
|
135
|
+
: undefined
|
|
136
|
+
);
|
|
137
|
+
setIsConfirmed(true);
|
|
138
|
+
setLoading(false);
|
|
139
|
+
if (window === top) {
|
|
140
|
+
top.postMessage(
|
|
141
|
+
{
|
|
142
|
+
type: MessageEventTypeEnum.ORDER_FLOW_COMPLETE,
|
|
143
|
+
isCompleted: true,
|
|
144
|
+
orderInfo: orderInfo,
|
|
145
|
+
},
|
|
146
|
+
top?.location?.origin || '*'
|
|
147
|
+
);
|
|
148
|
+
}
|
|
149
|
+
} catch (error) {
|
|
150
|
+
console.log(error);
|
|
151
|
+
if (
|
|
152
|
+
(error as { status: number }).status === 409 &&
|
|
153
|
+
(data.paymentMethod === PaymentMethodEnum.Vipps ||
|
|
154
|
+
data.paymentMethod === PaymentMethodEnum.MobilePay)
|
|
155
|
+
) {
|
|
156
|
+
cancelVippsCallback?.();
|
|
157
|
+
handleOrderDelete(orderId || data.orderId);
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
setFailedMsg(
|
|
162
|
+
prepareErrorMessage(error as Error, settings?.failureText)
|
|
163
|
+
);
|
|
164
|
+
setErrorsMsg(
|
|
165
|
+
prepareErrorsArrayMessage(
|
|
166
|
+
(
|
|
167
|
+
error as {
|
|
168
|
+
errors: ErrorsMsg;
|
|
169
|
+
}
|
|
170
|
+
)?.errors
|
|
171
|
+
)
|
|
172
|
+
);
|
|
173
|
+
setIsFailed(true);
|
|
174
|
+
setLoading(false);
|
|
175
|
+
setShowOrderForm(true);
|
|
176
|
+
setFormType(FormTypeEnum.ORDER);
|
|
177
|
+
userActionCallback?.(UserActionEnum.SELECT_FORM, {
|
|
178
|
+
form: FormTypeEnum.ORDER,
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
const handleOrderDelete = async (id: string) => {
|
|
184
|
+
try {
|
|
185
|
+
await orderDelete(id);
|
|
186
|
+
if (window === top) {
|
|
187
|
+
top.postMessage(
|
|
188
|
+
{
|
|
189
|
+
type: MessageEventTypeEnum.ORDER_FLOW_CANCEL,
|
|
190
|
+
isCanceled: true,
|
|
191
|
+
orderInfo: orderInfo,
|
|
192
|
+
},
|
|
193
|
+
top?.location?.origin || '*'
|
|
194
|
+
);
|
|
195
|
+
}
|
|
196
|
+
setIsFailed(false);
|
|
197
|
+
} catch (error) {
|
|
198
|
+
console.log(error);
|
|
199
|
+
setFailedMsg(
|
|
200
|
+
prepareErrorMessage(error as Error, settings?.failureText)
|
|
201
|
+
);
|
|
202
|
+
setErrorsMsg(
|
|
203
|
+
prepareErrorsArrayMessage(
|
|
204
|
+
(
|
|
205
|
+
error as {
|
|
206
|
+
errors: ErrorsMsg;
|
|
207
|
+
}
|
|
208
|
+
)?.errors
|
|
209
|
+
)
|
|
210
|
+
);
|
|
211
|
+
setIsFailed(true);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
setLoading(false);
|
|
215
|
+
setShowOrderForm(true);
|
|
216
|
+
};
|
|
217
|
+
|
|
218
|
+
const handleMessageEvent = async (
|
|
219
|
+
type: MessageEventTypeEnum,
|
|
220
|
+
canceledOrderId?: string
|
|
221
|
+
) => {
|
|
222
|
+
if (type === MessageEventTypeEnum.CANCEL) {
|
|
223
|
+
try {
|
|
224
|
+
const orderIdToCancel = canceledOrderId || orderId;
|
|
225
|
+
if (orderIdToCancel) {
|
|
226
|
+
await handleOrderDelete(orderIdToCancel);
|
|
227
|
+
}
|
|
228
|
+
} catch (error) {
|
|
229
|
+
console.log(error);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
setLoading(false);
|
|
233
|
+
setOrderId(null);
|
|
234
|
+
setOrderInfo(null);
|
|
235
|
+
setIframeSrc(null);
|
|
236
|
+
setIsConfirmed(false);
|
|
237
|
+
setShowOrderForm(true);
|
|
238
|
+
}
|
|
239
|
+
};
|
|
240
|
+
|
|
241
|
+
useMessageEvent(
|
|
242
|
+
messageCallback,
|
|
243
|
+
handleMessageEvent,
|
|
244
|
+
!!showIframe,
|
|
245
|
+
orderInfo
|
|
246
|
+
);
|
|
247
|
+
|
|
248
|
+
const handleForm = (url: string | null, data?: OrderInfoType | null) => {
|
|
249
|
+
setIsConfirmed(false);
|
|
250
|
+
setIsFailed(false);
|
|
251
|
+
setOrderId(data?.orderId || null);
|
|
252
|
+
setOrderInfo(data || null);
|
|
253
|
+
if (data) {
|
|
254
|
+
setOrderFormValues(data as unknown as OrderFormInputsType);
|
|
255
|
+
}
|
|
256
|
+
if (window === top) {
|
|
257
|
+
top.postMessage(
|
|
258
|
+
{
|
|
259
|
+
type: MessageEventTypeEnum.ORDER_UPDATE_INFO,
|
|
260
|
+
isUpdate: true,
|
|
261
|
+
orderInfo: data || null,
|
|
262
|
+
},
|
|
263
|
+
top?.location?.origin || '*'
|
|
264
|
+
);
|
|
265
|
+
}
|
|
266
|
+
if (
|
|
267
|
+
data?.paymentMethod === PaymentMethodEnum.Email ||
|
|
268
|
+
data?.paymentMethod === PaymentMethodEnum.Invoice
|
|
269
|
+
) {
|
|
270
|
+
messageCallback({
|
|
271
|
+
orderId: data.orderId || orderId || '',
|
|
272
|
+
agreementId: '',
|
|
273
|
+
orderInfo: data || orderInfo || null,
|
|
274
|
+
});
|
|
275
|
+
} else if (data?.paymentMethod === PaymentMethodEnum.EHF) {
|
|
276
|
+
setFormType(FormTypeEnum.EHF);
|
|
277
|
+
userActionCallback?.(UserActionEnum.SELECT_FORM, {
|
|
278
|
+
form: FormTypeEnum.EHF,
|
|
279
|
+
});
|
|
280
|
+
} else if (data?.paymentMethod === PaymentMethodEnum.OIO) {
|
|
281
|
+
setFormType(FormTypeEnum.OIO);
|
|
282
|
+
userActionCallback?.(UserActionEnum.SELECT_FORM, {
|
|
283
|
+
form: FormTypeEnum.OIO,
|
|
284
|
+
});
|
|
285
|
+
} else if (url) {
|
|
286
|
+
if (
|
|
287
|
+
showIframe &&
|
|
288
|
+
data?.paymentMethod === PaymentMethodEnum.SwedbankPay
|
|
289
|
+
) {
|
|
290
|
+
setIframeSrc(url);
|
|
291
|
+
return;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
if (
|
|
295
|
+
data?.paymentMethod === PaymentMethodEnum.Mollie &&
|
|
296
|
+
data?.orderId
|
|
297
|
+
) {
|
|
298
|
+
try {
|
|
299
|
+
sessionStorage.setItem(
|
|
300
|
+
'mollieOrderId',
|
|
301
|
+
JSON.stringify({ id: data.orderId, ts: Date.now() })
|
|
302
|
+
);
|
|
303
|
+
} catch (e) {
|
|
304
|
+
console.warn(
|
|
305
|
+
'Could not persist mollieOrderId; return leg will rely on the S4OrderId param.',
|
|
306
|
+
e
|
|
307
|
+
);
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
setTimeout(() => {
|
|
312
|
+
window.location.href = url;
|
|
313
|
+
}, 300);
|
|
314
|
+
|
|
315
|
+
return;
|
|
316
|
+
} else if (data?.paymentMethod) {
|
|
317
|
+
setIsFailed(true);
|
|
318
|
+
setShowOrderForm(true);
|
|
319
|
+
setFormType(FormTypeEnum.ORDER);
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
setIframeSrc(null);
|
|
323
|
+
};
|
|
324
|
+
|
|
325
|
+
const handleInvoiceBack = () => {
|
|
326
|
+
setFormType(FormTypeEnum.ORDER);
|
|
327
|
+
userActionCallback?.(UserActionEnum.SELECT_FORM, {
|
|
328
|
+
form: FormTypeEnum.ORDER,
|
|
329
|
+
});
|
|
330
|
+
};
|
|
331
|
+
|
|
332
|
+
const updateFormData = (data: OrderFormInputsType) => {
|
|
333
|
+
setOrderFormValues(data);
|
|
334
|
+
setFormType(data.paymentMethod as unknown as FormTypeEnum);
|
|
335
|
+
userActionCallback?.(UserActionEnum.SELECT_FORM, {
|
|
336
|
+
form: data.paymentMethod,
|
|
337
|
+
});
|
|
338
|
+
};
|
|
339
|
+
|
|
340
|
+
const handleInvoiceForm = async (
|
|
341
|
+
_: string | null,
|
|
342
|
+
data?: OrderInfoType | null
|
|
343
|
+
) => {
|
|
344
|
+
await messageCallback({
|
|
345
|
+
orderId: data?.orderId || orderId || '',
|
|
346
|
+
agreementId: '',
|
|
347
|
+
orderInfo: data || orderInfo || null,
|
|
348
|
+
});
|
|
349
|
+
};
|
|
350
|
+
|
|
351
|
+
const onSubmitStart = (id: string) => {
|
|
352
|
+
setSubscriberSdkId(id);
|
|
353
|
+
submitStartCallback?.(id);
|
|
354
|
+
};
|
|
355
|
+
|
|
356
|
+
if (window !== top) {
|
|
357
|
+
return null;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
if (loading) {
|
|
361
|
+
return (
|
|
362
|
+
<div
|
|
363
|
+
className="sdk-order-container sdk-scope"
|
|
364
|
+
data-testid="sdk-order-loading-skeleton"
|
|
365
|
+
aria-busy="true"
|
|
366
|
+
>
|
|
367
|
+
<Card>
|
|
368
|
+
<CardContent className="flex flex-col gap-4">
|
|
369
|
+
<div className="flex flex-col gap-1.5">
|
|
370
|
+
<Skeleton className="h-3 w-16" />
|
|
371
|
+
<Skeleton className="h-9 w-full rounded-3xl" />
|
|
372
|
+
</div>
|
|
373
|
+
<div className="flex flex-col gap-1.5">
|
|
374
|
+
<Skeleton className="h-3 w-16" />
|
|
375
|
+
<Skeleton className="h-9 w-full rounded-3xl" />
|
|
376
|
+
</div>
|
|
377
|
+
<div className="flex flex-col gap-1.5">
|
|
378
|
+
<Skeleton className="h-3 w-16" />
|
|
379
|
+
<Skeleton className="h-9 w-full rounded-3xl" />
|
|
380
|
+
</div>
|
|
381
|
+
<div className="flex items-center gap-2">
|
|
382
|
+
<Skeleton className="size-4 shrink-0 rounded-[5px]" />
|
|
383
|
+
<Skeleton className="h-4 w-2/3" />
|
|
384
|
+
</div>
|
|
385
|
+
<Skeleton className="h-9 w-full rounded-4xl" />
|
|
386
|
+
</CardContent>
|
|
387
|
+
</Card>
|
|
388
|
+
</div>
|
|
389
|
+
);
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
return (
|
|
393
|
+
<ErrorBoundary>
|
|
394
|
+
<div
|
|
395
|
+
className={`sdk-order-container sdk-scope ${
|
|
396
|
+
iframeSrc ? 'show-iframe' : ''
|
|
397
|
+
}`}
|
|
398
|
+
data-testid="sdk-order-module-id"
|
|
399
|
+
>
|
|
400
|
+
{moduleTitle && <h1 className="text-center">{moduleTitle}</h1>}
|
|
401
|
+
{!iframeSrc && showOrderForm && (
|
|
402
|
+
<>
|
|
403
|
+
{formType === FormTypeEnum.OIO && (
|
|
404
|
+
<OIOForm
|
|
405
|
+
onBack={handleInvoiceBack}
|
|
406
|
+
callback={handleInvoiceForm}
|
|
407
|
+
backButtonText={settings?.backButtonText}
|
|
408
|
+
verifyButtonText={settings?.verifyButtonText}
|
|
409
|
+
orderDenialCloseButtonText={
|
|
410
|
+
settings?.orderDenialCloseButtonText
|
|
411
|
+
}
|
|
412
|
+
orderDenialContinueButtonText={
|
|
413
|
+
settings?.orderDenialContinueButtonText
|
|
414
|
+
}
|
|
415
|
+
organizationNumberLabel={settings?.cvrLabel}
|
|
416
|
+
glnLabel={settings?.glnLabel}
|
|
417
|
+
organizationNumber={
|
|
418
|
+
orderFormValues?.organizationNumber
|
|
419
|
+
}
|
|
420
|
+
orderValues={orderFormValues}
|
|
421
|
+
templatePackageId={templatePackageId}
|
|
422
|
+
subscriberId={subscriberSdkId}
|
|
423
|
+
userId={userId}
|
|
424
|
+
identityProviderId={identityProviderId}
|
|
425
|
+
organizationId={organizationId}
|
|
426
|
+
redirectUrl={redirectUrl}
|
|
427
|
+
showIframe={showIframe}
|
|
428
|
+
paymentMethodsOptions={paymentMethodsOptions}
|
|
429
|
+
language={language}
|
|
430
|
+
merchantAgreementUrl={merchantAgreementUrl}
|
|
431
|
+
invoiceAddressSelection={
|
|
432
|
+
invoiceAddressSelection
|
|
433
|
+
}
|
|
434
|
+
invoiceLookupNotFoundText={
|
|
435
|
+
settings?.invoiceLookupNotFoundText
|
|
436
|
+
}
|
|
437
|
+
errorReqMsg={settings?.errorReqMsg}
|
|
438
|
+
userActionCallback={userActionCallback}
|
|
439
|
+
setContactCallback={setContactCallback}
|
|
440
|
+
errorValidationTitleMsg={
|
|
441
|
+
settings?.errorValidationTitleMsg
|
|
442
|
+
}
|
|
443
|
+
errorValidationDenialOrderBlockingMsg={
|
|
444
|
+
settings?.errorValidationDenialOrderBlockingMsg
|
|
445
|
+
}
|
|
446
|
+
errorValidationBlockingOffersMsg={
|
|
447
|
+
settings?.errorValidationBlockingOffersMsg
|
|
448
|
+
}
|
|
449
|
+
orderDenialOfferBaseText={
|
|
450
|
+
settings?.orderDenialOfferBaseText
|
|
451
|
+
}
|
|
452
|
+
orderDenialOfferWithFallbackText={
|
|
453
|
+
settings?.orderDenialOfferWithFallbackText
|
|
454
|
+
}
|
|
455
|
+
orderDenialAmountText={
|
|
456
|
+
settings?.orderDenialAmountText
|
|
457
|
+
}
|
|
458
|
+
fetchDenialFallbackOffer={
|
|
459
|
+
settings?.fetchDenialFallbackOffer
|
|
460
|
+
}
|
|
461
|
+
/>
|
|
462
|
+
)}
|
|
463
|
+
{formType === FormTypeEnum.EHF && (
|
|
464
|
+
<EHFForm
|
|
465
|
+
onBack={handleInvoiceBack}
|
|
466
|
+
callback={handleInvoiceForm}
|
|
467
|
+
backButtonText={settings?.backButtonText}
|
|
468
|
+
verifyButtonText={settings?.verifyButtonText}
|
|
469
|
+
orderDenialCloseButtonText={
|
|
470
|
+
settings?.orderDenialCloseButtonText
|
|
471
|
+
}
|
|
472
|
+
orderDenialContinueButtonText={
|
|
473
|
+
settings?.orderDenialContinueButtonText
|
|
474
|
+
}
|
|
475
|
+
organizationNumberLabel={
|
|
476
|
+
settings?.organizationNumberLabel
|
|
477
|
+
}
|
|
478
|
+
organizationNumber={
|
|
479
|
+
orderFormValues?.organizationNumber
|
|
480
|
+
}
|
|
481
|
+
orderValues={orderFormValues}
|
|
482
|
+
templatePackageId={templatePackageId}
|
|
483
|
+
subscriberId={subscriberSdkId}
|
|
484
|
+
userId={userId}
|
|
485
|
+
identityProviderId={identityProviderId}
|
|
486
|
+
organizationId={organizationId}
|
|
487
|
+
redirectUrl={redirectUrl}
|
|
488
|
+
showIframe={showIframe}
|
|
489
|
+
paymentMethodsOptions={paymentMethodsOptions}
|
|
490
|
+
language={language}
|
|
491
|
+
merchantAgreementUrl={merchantAgreementUrl}
|
|
492
|
+
invoiceAddressSelection={
|
|
493
|
+
invoiceAddressSelection
|
|
494
|
+
}
|
|
495
|
+
invoiceLookupNotFoundText={
|
|
496
|
+
settings?.invoiceLookupNotFoundText
|
|
497
|
+
}
|
|
498
|
+
errorReqMsg={settings?.errorReqMsg}
|
|
499
|
+
userActionCallback={userActionCallback}
|
|
500
|
+
setContactCallback={setContactCallback}
|
|
501
|
+
errorValidationTitleMsg={
|
|
502
|
+
settings?.errorValidationTitleMsg
|
|
503
|
+
}
|
|
504
|
+
errorValidationDenialOrderBlockingMsg={
|
|
505
|
+
settings?.errorValidationDenialOrderBlockingMsg
|
|
506
|
+
}
|
|
507
|
+
errorValidationBlockingOffersMsg={
|
|
508
|
+
settings?.errorValidationBlockingOffersMsg
|
|
509
|
+
}
|
|
510
|
+
orderDenialOfferBaseText={
|
|
511
|
+
settings?.orderDenialOfferBaseText
|
|
512
|
+
}
|
|
513
|
+
orderDenialOfferWithFallbackText={
|
|
514
|
+
settings?.orderDenialOfferWithFallbackText
|
|
515
|
+
}
|
|
516
|
+
orderDenialAmountText={
|
|
517
|
+
settings?.orderDenialAmountText
|
|
518
|
+
}
|
|
519
|
+
fetchDenialFallbackOffer={
|
|
520
|
+
settings?.fetchDenialFallbackOffer
|
|
521
|
+
}
|
|
522
|
+
/>
|
|
523
|
+
)}
|
|
524
|
+
{formType !== FormTypeEnum.OIO &&
|
|
525
|
+
formType !== FormTypeEnum.EHF &&
|
|
526
|
+
templatePackageId && (
|
|
527
|
+
<OrderForm
|
|
528
|
+
callback={handleForm}
|
|
529
|
+
updateFormData={updateFormData}
|
|
530
|
+
submitStartCallback={onSubmitStart}
|
|
531
|
+
templatePackageId={templatePackageId}
|
|
532
|
+
subscriberId={subscriberSdkId}
|
|
533
|
+
userId={userId}
|
|
534
|
+
identityProviderId={identityProviderId}
|
|
535
|
+
organizationId={organizationId}
|
|
536
|
+
paymentMethods={availablePaymentMethods}
|
|
537
|
+
allowedPaymentMethods={
|
|
538
|
+
allowedPaymentMethods
|
|
539
|
+
}
|
|
540
|
+
submitButtonText={
|
|
541
|
+
settings?.submitButtonText
|
|
542
|
+
}
|
|
543
|
+
orderDenialCloseButtonText={
|
|
544
|
+
settings?.orderDenialCloseButtonText
|
|
545
|
+
}
|
|
546
|
+
orderDenialContinueButtonText={
|
|
547
|
+
settings?.orderDenialContinueButtonText
|
|
548
|
+
}
|
|
549
|
+
paymentMethodLabel={
|
|
550
|
+
settings?.paymentMethodLabel
|
|
551
|
+
}
|
|
552
|
+
contactDetailsLabel={
|
|
553
|
+
settings?.contactDetailsLabel
|
|
554
|
+
}
|
|
555
|
+
paymentMethodElementId={
|
|
556
|
+
settings?.paymentMethodElementId
|
|
557
|
+
}
|
|
558
|
+
contactDetailsElementId={
|
|
559
|
+
settings?.contactDetailsElementId
|
|
560
|
+
}
|
|
561
|
+
paymentMethodNotAllowedMsg={
|
|
562
|
+
settings?.paymentMethodNotAllowedMsg
|
|
563
|
+
}
|
|
564
|
+
errorReqMsg={settings?.errorReqMsg}
|
|
565
|
+
errorTermsMsg={settings?.errorTermsMsg}
|
|
566
|
+
errorInvalidEmailMsg={
|
|
567
|
+
settings?.errorInvalidEmailMsg
|
|
568
|
+
}
|
|
569
|
+
errorInvalidPhoneMsg={
|
|
570
|
+
settings?.errorInvalidPhoneMsg
|
|
571
|
+
}
|
|
572
|
+
defaultValues={orderFormValues}
|
|
573
|
+
redirectUrl={redirectUrl}
|
|
574
|
+
showIframe={showIframe}
|
|
575
|
+
paymentMethodsOptions={
|
|
576
|
+
paymentMethodsOptions
|
|
577
|
+
}
|
|
578
|
+
language={language}
|
|
579
|
+
merchantAgreementUrl={merchantAgreementUrl}
|
|
580
|
+
invoiceAddressSelection={
|
|
581
|
+
invoiceAddressSelection
|
|
582
|
+
}
|
|
583
|
+
userActionCallback={userActionCallback}
|
|
584
|
+
setContactCallback={setContactCallback}
|
|
585
|
+
errorValidationTitleMsg={
|
|
586
|
+
settings?.errorValidationTitleMsg
|
|
587
|
+
}
|
|
588
|
+
errorValidationDenialOrderBlockingMsg={
|
|
589
|
+
settings?.errorValidationDenialOrderBlockingMsg
|
|
590
|
+
}
|
|
591
|
+
errorValidationBlockingOffersMsg={
|
|
592
|
+
settings?.errorValidationBlockingOffersMsg
|
|
593
|
+
}
|
|
594
|
+
orderDenialOfferBaseText={
|
|
595
|
+
settings?.orderDenialOfferBaseText
|
|
596
|
+
}
|
|
597
|
+
orderDenialOfferWithFallbackText={
|
|
598
|
+
settings?.orderDenialOfferWithFallbackText
|
|
599
|
+
}
|
|
600
|
+
orderDenialAmountText={
|
|
601
|
+
settings?.orderDenialAmountText
|
|
602
|
+
}
|
|
603
|
+
fetchDenialFallbackOffer={
|
|
604
|
+
settings?.fetchDenialFallbackOffer
|
|
605
|
+
}
|
|
606
|
+
termsAndConditionsText={
|
|
607
|
+
settings?.termsAndConditionsText
|
|
608
|
+
}
|
|
609
|
+
submitConfirmation={
|
|
610
|
+
settings?.submitConfirmation
|
|
611
|
+
}
|
|
612
|
+
requireTermsAcceptance={
|
|
613
|
+
requireTermsAcceptance
|
|
614
|
+
}
|
|
615
|
+
/>
|
|
616
|
+
)}
|
|
617
|
+
</>
|
|
618
|
+
)}
|
|
619
|
+
{showIframe && <MainIframe iframeSrc={iframeSrc} />}
|
|
620
|
+
{isConfirmed && (
|
|
621
|
+
<Alert
|
|
622
|
+
className="mt-2"
|
|
623
|
+
type="success"
|
|
624
|
+
msg={settings?.successText}
|
|
625
|
+
/>
|
|
626
|
+
)}
|
|
627
|
+
|
|
628
|
+
{isFailed && <Alert className="mt-2" msg={failedMsg} />}
|
|
629
|
+
{isFailed &&
|
|
630
|
+
errorsMsg?.length > 0 &&
|
|
631
|
+
errorsMsg.map((i, index) => (
|
|
632
|
+
<Alert key={`${i}-${index}`} className="mt-2" msg={i} />
|
|
633
|
+
))}
|
|
634
|
+
</div>
|
|
635
|
+
</ErrorBoundary>
|
|
636
|
+
);
|
|
637
|
+
};
|
|
638
|
+
|
|
639
|
+
export default App;
|