@odus/checkout 1.3.0 → 1.5.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/dist/checkout.es.js +1623 -2521
- package/dist/elements.es.js +1318 -1750
- package/dist/index.css +2 -1
- package/dist/package.json +1 -1
- package/dist/phone.js +10957 -3446
- package/dist/shared.js +7075 -7412
- package/package.json +1 -1
package/dist/elements.es.js
CHANGED
|
@@ -1,1751 +1,1319 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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
|
-
0 0 0 1px var(--odus-border-color, #e0e0e0),
|
|
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
|
-
|
|
570
|
-
|
|
571
|
-
}
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
focus: ()
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
font-size: var(--odus-input-font-size, 16px) !important;
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
}
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
};
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
}
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
}
|
|
1318
|
-
}), this.shadowRoot.appendChild(this._button.getElement());
|
|
1319
|
-
}
|
|
1320
|
-
getCss() {
|
|
1321
|
-
return super.getCss() + de + `
|
|
1322
|
-
:host { display: block; }
|
|
1323
|
-
.paypal {
|
|
1324
|
-
width: 100%;
|
|
1325
|
-
box-sizing: border-box;
|
|
1326
|
-
border-radius: var(--odus-button-border-radius, 6px);
|
|
1327
|
-
display: flex;
|
|
1328
|
-
align-items: center;
|
|
1329
|
-
justify-content: center;
|
|
1330
|
-
}
|
|
1331
|
-
`;
|
|
1332
|
-
}
|
|
1333
|
-
getValue() {
|
|
1334
|
-
return null;
|
|
1335
|
-
}
|
|
1336
|
-
getIsValid() {
|
|
1337
|
-
return !0;
|
|
1338
|
-
}
|
|
1339
|
-
getError() {
|
|
1340
|
-
return null;
|
|
1341
|
-
}
|
|
1342
|
-
}
|
|
1343
|
-
const he = ".country-dial-code-dropdown{position:relative;display:inline-block}.country-dial-code-trigger{display:flex;align-items:center;gap:6px;padding:var(--odus-input-padding, 8px 12px);padding-right:8px;background:#fff;border:none;cursor:pointer;font-weight:400;letter-spacing:.02em;line-height:var(--odus-input-line-height, 1.5);transition:all .1s ease-in;white-space:nowrap;border-right:1px solid #e0e0e0;box-sizing:border-box}.country-dial-code-trigger:hover{background:#f5f5f5}.country-dial-code-trigger:focus{outline:none}.country-dial-code-trigger .country-flag{font-size:14px;line-height:1}.country-dial-code-trigger .country-chevron{color:#717173;flex-shrink:0;transition:transform .15s ease}.country-dial-code-trigger[aria-expanded=true] .country-chevron{transform:rotate(180deg)}.country-dial-code-panel{position:fixed;top:0;left:0;z-index:10000;width:280px;background:#fff;border-radius:8px;box-shadow:0 0 0 1px #0000000d,0 4px 6px -1px #0000001a,0 2px 4px -1px #0000000f;max-height:360px;display:flex;flex-direction:column;overflow:hidden}.country-dial-code-panel.hidden{display:none}.country-search-wrapper{padding:12px;border-bottom:1px solid #e0e0e0;flex-shrink:0}.country-search{width:100%;padding:6px 12px;border:1px solid #e0e0e0;border-radius:6px;font-size:inherit;font-family:inherit;outline:none;transition:all .1s ease-in;box-sizing:border-box}.country-search:focus{border-color:#3297d3b3;box-shadow:0 0 0 3px #3297d31a}.country-search::placeholder{color:#717173;opacity:.6}.countries-list{overflow-y:auto;flex:1;min-height:0}.countries-list::-webkit-scrollbar{width:8px}.countries-list::-webkit-scrollbar-track{background:#f5f5f5}.countries-list::-webkit-scrollbar-thumb{background:#d0d0d0;border-radius:4px}.countries-list::-webkit-scrollbar-thumb:hover{background:#b0b0b0}.country-group-header{padding:8px 16px 4px;font-size:12px;font-weight:600;color:#717173;text-transform:uppercase;letter-spacing:.05em;background:#fafafa;position:sticky;top:0;z-index:1}.country-item{display:flex;align-items:center;gap:12px;padding:10px 16px;width:100%;border:none;background:#fff;cursor:pointer;transition:background .1s ease;text-align:left;font-size:14px;font-family:inherit;color:inherit}.country-item:hover{background:#f5f5f5}.country-item.selected{background:#3297d314;color:#3297d3}.country-item:focus{outline:none;background:#f0f0f0}.country-item .country-flag{font-size:20px;line-height:1;flex-shrink:0}.country-item .country-name{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.country-item .country-dial-code{color:#717173;font-size:.95em;flex-shrink:0}.country-item.selected .country-dial-code{color:#3297d3cc}.no-results{padding:24px 16px;text-align:center;color:#717173;font-size:14px}.phone-number-field-wrapper{display:flex;width:100%}.phone-number-field-container{display:flex;align-items:center;width:100%;border-radius:inherit;transition:box-shadow .1s ease-in,border-radius .2s ease-in;box-shadow:0 0 0 1px #e0e0e0,0 2px 4px #00000012,0 1px 1.5px #0000000d;background:#fff;position:relative}.phone-number-field-container.focused{box-shadow:0 0 0 1px #3297d3b3,0 1px 1px #00000012,0 0 0 4px #3297d34d;z-index:2}.phone-number-field-container.error{box-shadow:0 0 0 1px #dc2727,0 2px 4px #dc27271a}.phone-number-field-container.error.focused{box-shadow:0 0 0 1px #dc2727,0 1px 1px #00000012,0 0 0 4px #dc272733}.phone-number-field-container .country-select-wrapper{flex-shrink:0;position:relative;display:flex;align-items:center;gap:4px;padding:var(--odus-input-padding, 8px 12px);padding-right:6px;background:transparent;border-top-left-radius:var(--phone-border-radius, 0px);border-bottom-left-radius:var(--phone-border-radius, 0px);white-space:nowrap}.phone-number-field-container .country-select-wrapper .country-flag{font-size:14px;line-height:1;pointer-events:none}.phone-number-field-container .country-select-wrapper .country-chevron{display:flex;align-items:center;color:#717173;flex-shrink:0;pointer-events:none}.phone-number-field-container .country-select-wrapper .country-select{position:absolute;inset:0;border:none;outline:none;background:transparent;cursor:pointer;opacity:0;width:100%;height:100%}.phone-number-field-container .phone-input-wrapper{flex:1;min-width:0}.phone-number-field-container .phone-input-wrapper .form-input{border:none;box-shadow:none;border-radius:0;border-top-right-radius:var(--phone-border-radius, 0px);border-bottom-right-radius:var(--phone-border-radius, 0px);padding:var(--odus-input-padding, 8px 2px)}.phone-number-field-container .phone-input-wrapper .form-input:focus{box-shadow:none;z-index:auto}", ce = {
|
|
1344
|
-
name: "odus-elements",
|
|
1345
|
-
styles: {
|
|
1346
|
-
fontSize: 14,
|
|
1347
|
-
textColor: "#000000",
|
|
1348
|
-
buttonColor: "#0070f3",
|
|
1349
|
-
borderRadius: 4,
|
|
1350
|
-
fontFamily: "system-ui",
|
|
1351
|
-
buttonTextColor: "#ffffff",
|
|
1352
|
-
buttonFontSize: 16
|
|
1353
|
-
},
|
|
1354
|
-
layout: {
|
|
1355
|
-
actionButton: { translationKey: null },
|
|
1356
|
-
billingFields: {
|
|
1357
|
-
street: { enabled: !1 },
|
|
1358
|
-
city: { enabled: !1 },
|
|
1359
|
-
state: { enabled: !1 },
|
|
1360
|
-
zipCode: { enabled: !1 },
|
|
1361
|
-
firstName: { enabled: !1 },
|
|
1362
|
-
lastName: { enabled: !1 },
|
|
1363
|
-
country: { enabled: !1 }
|
|
1364
|
-
}
|
|
1365
|
-
},
|
|
1366
|
-
additionalPaymentMethods: {}
|
|
1367
|
-
};
|
|
1368
|
-
class pe extends u {
|
|
1369
|
-
_phone = "";
|
|
1370
|
-
_error = null;
|
|
1371
|
-
_field = null;
|
|
1372
|
-
_renderGeneration = 0;
|
|
1373
|
-
render() {
|
|
1374
|
-
if (!this.shadowRoot) return;
|
|
1375
|
-
this._field?.destroy(), this._field?.getElement().remove(), this._field = null, this.options.initialValue && !this._phone && (this._phone = String(this.options.initialValue));
|
|
1376
|
-
const e = ++this._renderGeneration;
|
|
1377
|
-
T().then(({ PhoneNumberField: t }) => {
|
|
1378
|
-
if (!this.shadowRoot || this._renderGeneration !== e) return;
|
|
1379
|
-
const { t: r, locale: s } = a();
|
|
1380
|
-
this._field = new t({
|
|
1381
|
-
value: this._phone,
|
|
1382
|
-
error: !1,
|
|
1383
|
-
checkoutProfile: ce,
|
|
1384
|
-
translationFunc: r,
|
|
1385
|
-
locale: s,
|
|
1386
|
-
onChange: () => {
|
|
1387
|
-
this._phone = this._field?.getValue() ?? "", this._error = null, this.emit("change", this._phone);
|
|
1388
|
-
},
|
|
1389
|
-
onBlur: () => {
|
|
1390
|
-
this._phone = this._field?.getValue() ?? "";
|
|
1391
|
-
const o = _(), i = this._field?.getCountry();
|
|
1392
|
-
this._error = o.phoneNumber(this._phone, i) ?? null, this._field?.setError(!!this._error, this._error ?? void 0), this.emit("blur", this._phone);
|
|
1393
|
-
}
|
|
1394
|
-
}), this.shadowRoot.appendChild(this._field.getElement());
|
|
1395
|
-
});
|
|
1396
|
-
}
|
|
1397
|
-
getCss() {
|
|
1398
|
-
return super.getCss() + [f, m, p, he].join(`
|
|
1399
|
-
`) + `
|
|
1400
|
-
:host { display: block; }
|
|
1401
|
-
.form-input,
|
|
1402
|
-
.country-select-wrapper {
|
|
1403
|
-
color: var(--odus-color-text, #1a1a1a) !important;
|
|
1404
|
-
font-family: var(--odus-font-family, system-ui, sans-serif) !important;
|
|
1405
|
-
font-size: var(--odus-input-font-size, 16px) !important;
|
|
1406
|
-
background: var(--odus-color-background, #ffffff) !important;
|
|
1407
|
-
border-radius: 0 !important;
|
|
1408
|
-
box-shadow: none !important;
|
|
1409
|
-
}
|
|
1410
|
-
.phone-number-field-container {
|
|
1411
|
-
min-height: calc(var(--odus-input-font-size, 16px) * 1.5 + 16px);
|
|
1412
|
-
box-shadow:
|
|
1413
|
-
0 0 0 1px var(--odus-border-color, #e0e0e0),
|
|
1414
|
-
0 2px 4px 0 rgba(0, 0, 0, 0.07),
|
|
1415
|
-
0 1px 1.5px 0 rgba(0, 0, 0, 0.05) !important;
|
|
1416
|
-
border-radius: var(--odus-border-radius, 6px) !important;
|
|
1417
|
-
overflow: hidden;
|
|
1418
|
-
}
|
|
1419
|
-
.phone-number-field-container:focus-within {
|
|
1420
|
-
box-shadow: var(
|
|
1421
|
-
--odus-input-focus-shadow,
|
|
1422
|
-
0 0 0 1px rgba(50, 151, 211, 0.7),
|
|
1423
|
-
0 1px 1px 0 rgba(0, 0, 0, 0.07),
|
|
1424
|
-
0 0 0 4px rgba(50, 151, 211, 0.3)
|
|
1425
|
-
) !important;
|
|
1426
|
-
}
|
|
1427
|
-
.phone-number-field-container.error {
|
|
1428
|
-
box-shadow: 0 0 0 1px var(--odus-color-error, #dc2727) !important;
|
|
1429
|
-
}
|
|
1430
|
-
.form-input:focus {
|
|
1431
|
-
box-shadow: none !important;
|
|
1432
|
-
outline: none !important;
|
|
1433
|
-
}
|
|
1434
|
-
.form-input-error {
|
|
1435
|
-
color: var(--odus-color-error, #dc2727) !important;
|
|
1436
|
-
}
|
|
1437
|
-
.form-helper-text {
|
|
1438
|
-
color: var(--odus-color-error, #dc2727) !important;
|
|
1439
|
-
}
|
|
1440
|
-
`;
|
|
1441
|
-
}
|
|
1442
|
-
getValue() {
|
|
1443
|
-
return this._phone;
|
|
1444
|
-
}
|
|
1445
|
-
getIsValid() {
|
|
1446
|
-
const e = _(), t = this._field?.getCountry();
|
|
1447
|
-
return !e.phoneNumber(this._phone, t);
|
|
1448
|
-
}
|
|
1449
|
-
getError() {
|
|
1450
|
-
return this._error;
|
|
1451
|
-
}
|
|
1452
|
-
}
|
|
1453
|
-
class fe {
|
|
1454
|
-
_config;
|
|
1455
|
-
_apiService;
|
|
1456
|
-
_changeListeners = [];
|
|
1457
|
-
_callbacks;
|
|
1458
|
-
_paymentState = {};
|
|
1459
|
-
_fontCleanup;
|
|
1460
|
-
_card;
|
|
1461
|
-
_email;
|
|
1462
|
-
_phone;
|
|
1463
|
-
_addressStreet;
|
|
1464
|
-
_addressFirstName;
|
|
1465
|
-
_addressLastName;
|
|
1466
|
-
_cardholderName;
|
|
1467
|
-
_addressCity;
|
|
1468
|
-
_addressState;
|
|
1469
|
-
_addressZipCode;
|
|
1470
|
-
_addressCountry;
|
|
1471
|
-
_applePay;
|
|
1472
|
-
_paypal;
|
|
1473
|
-
_error;
|
|
1474
|
-
elements;
|
|
1475
|
-
constructor(e) {
|
|
1476
|
-
this._config = e, this._callbacks = { ...e.callbacks }, e.locale && I.setLocale(e.locale), this._apiService = new B(
|
|
1477
|
-
e.apiKey,
|
|
1478
|
-
e.environment
|
|
1479
|
-
);
|
|
1480
|
-
const t = {};
|
|
1481
|
-
Object.defineProperty(t, "email", {
|
|
1482
|
-
get: () => (this._email || (this._email = new ie(), this._trackElement(this._email)), this._email),
|
|
1483
|
-
enumerable: !0
|
|
1484
|
-
}), Object.defineProperty(t, "phone", {
|
|
1485
|
-
get: () => (this._phone || (this._phone = new pe(), this._trackElement(this._phone)), this._phone),
|
|
1486
|
-
enumerable: !0
|
|
1487
|
-
});
|
|
1488
|
-
const r = {};
|
|
1489
|
-
Object.defineProperty(r, "applePay", {
|
|
1490
|
-
get: () => (this._applePay || (this._applePay = new H(), this._trackElement(this._applePay), this._paymentState.paymentId && this._paymentState.checkoutKey && this._applePay.setPaymentContext({
|
|
1491
|
-
paymentId: this._paymentState.paymentId,
|
|
1492
|
-
checkoutKey: this._paymentState.checkoutKey,
|
|
1493
|
-
environment: this._config.environment,
|
|
1494
|
-
checkoutDetails: this._paymentState.checkoutDetails,
|
|
1495
|
-
...this._config.additionalPaymentMethods?.applePay,
|
|
1496
|
-
onAuthorize: (i) => this._executeAuthorization({ formData: null, applePayData: i })
|
|
1497
|
-
})), this._applePay),
|
|
1498
|
-
enumerable: !0
|
|
1499
|
-
}), Object.defineProperty(r, "payPal", {
|
|
1500
|
-
get: () => (this._paypal || (this._paypal = new ue(), this._trackElement(this._paypal), this._paymentState.paymentId && this._paymentState.checkoutKey && this._paypal.setPaymentContext({
|
|
1501
|
-
paymentId: this._paymentState.paymentId,
|
|
1502
|
-
checkoutKey: this._paymentState.checkoutKey,
|
|
1503
|
-
onAuthorize: () => this._executeAuthorization({ formData: null })
|
|
1504
|
-
})), this._paypal),
|
|
1505
|
-
enumerable: !0
|
|
1506
|
-
});
|
|
1507
|
-
const s = {};
|
|
1508
|
-
Object.defineProperty(s, "street", {
|
|
1509
|
-
get: () => (this._addressStreet || (this._addressStreet = new G(), this._trackElement(this._addressStreet)), this._addressStreet),
|
|
1510
|
-
enumerable: !0
|
|
1511
|
-
}), Object.defineProperty(s, "firstName", {
|
|
1512
|
-
get: () => (this._addressFirstName || (this._addressFirstName = new J(), this._trackElement(this._addressFirstName)), this._addressFirstName),
|
|
1513
|
-
enumerable: !0
|
|
1514
|
-
}), Object.defineProperty(s, "lastName", {
|
|
1515
|
-
get: () => (this._addressLastName || (this._addressLastName = new K(), this._trackElement(this._addressLastName)), this._addressLastName),
|
|
1516
|
-
enumerable: !0
|
|
1517
|
-
}), Object.defineProperty(s, "city", {
|
|
1518
|
-
get: () => (this._addressCity || (this._addressCity = new q(), this._trackElement(this._addressCity)), this._addressCity),
|
|
1519
|
-
enumerable: !0
|
|
1520
|
-
}), Object.defineProperty(s, "state", {
|
|
1521
|
-
get: () => (this._addressState || (this._addressState = new Z(), this._trackElement(this._addressState)), this._addressState),
|
|
1522
|
-
enumerable: !0
|
|
1523
|
-
}), Object.defineProperty(s, "zipCode", {
|
|
1524
|
-
get: () => (this._addressZipCode || (this._addressZipCode = new U(), this._trackElement(this._addressZipCode)), this._addressZipCode),
|
|
1525
|
-
enumerable: !0
|
|
1526
|
-
}), Object.defineProperty(s, "country", {
|
|
1527
|
-
get: () => (this._addressCountry || (this._addressCountry = new D(), this._trackElement(this._addressCountry), this._addressCountry.on("change", (i) => {
|
|
1528
|
-
this._addressState?.setCountry(i);
|
|
1529
|
-
})), this._addressCountry),
|
|
1530
|
-
enumerable: !0
|
|
1531
|
-
});
|
|
1532
|
-
const o = { contact: t, express: r };
|
|
1533
|
-
Object.defineProperty(o, "card", {
|
|
1534
|
-
get: () => (this._card || (this._card = new re(), this._card.setEnvironment(this._config.environment), this._trackElement(this._card), this._paymentState.vgsJwt && this._card.setVgsJwt(this._paymentState.vgsJwt)), this._card),
|
|
1535
|
-
enumerable: !0
|
|
1536
|
-
}), Object.defineProperty(o, "cardholderName", {
|
|
1537
|
-
get: () => (this._cardholderName || (this._cardholderName = new se(), this._trackElement(this._cardholderName)), this._cardholderName),
|
|
1538
|
-
enumerable: !0
|
|
1539
|
-
}), Object.defineProperty(o, "address", {
|
|
1540
|
-
get: () => s,
|
|
1541
|
-
enumerable: !0
|
|
1542
|
-
}), Object.defineProperty(o, "error", {
|
|
1543
|
-
get: () => (this._error || (this._error = new ne(), this._trackElement(this._error)), this._error),
|
|
1544
|
-
enumerable: !0
|
|
1545
|
-
}), this.elements = o;
|
|
1546
|
-
}
|
|
1547
|
-
async associatePayment(e, t) {
|
|
1548
|
-
if (!e || !t)
|
|
1549
|
-
throw new Error("paymentId and checkoutKey are required");
|
|
1550
|
-
this._paymentState.paymentId = e, this._paymentState.checkoutKey = t;
|
|
1551
|
-
const r = await L({
|
|
1552
|
-
id: e,
|
|
1553
|
-
checkoutKey: t,
|
|
1554
|
-
environment: this._config.environment
|
|
1555
|
-
});
|
|
1556
|
-
this._paymentState.checkoutDetails = {
|
|
1557
|
-
amount: r.amount,
|
|
1558
|
-
currency: r.currency,
|
|
1559
|
-
countryCode: r.countryCode
|
|
1560
|
-
}, r.vgsJwt && (this._paymentState.vgsJwt = r.vgsJwt, this._card?.setVgsJwt(r.vgsJwt)), this._card?.setEnvironment(this._config.environment), this._applePay?.setPaymentContext({
|
|
1561
|
-
paymentId: e,
|
|
1562
|
-
checkoutKey: t,
|
|
1563
|
-
environment: this._config.environment,
|
|
1564
|
-
checkoutDetails: this._paymentState.checkoutDetails,
|
|
1565
|
-
...this._config.additionalPaymentMethods?.applePay,
|
|
1566
|
-
onAuthorize: (s) => this._executeAuthorization({ formData: null, applePayData: s })
|
|
1567
|
-
}), this._paypal?.setPaymentContext({
|
|
1568
|
-
paymentId: e,
|
|
1569
|
-
checkoutKey: t,
|
|
1570
|
-
onAuthorize: () => this._executeAuthorization({ formData: null })
|
|
1571
|
-
});
|
|
1572
|
-
}
|
|
1573
|
-
validate() {
|
|
1574
|
-
const e = {}, { t } = a();
|
|
1575
|
-
return this._card?.isMounted && !this._card.isValid && (e.card = this._card.error ?? "Card details are invalid"), this._email?.isMounted && !this._email.isValid && (e.email = this._email.error ?? t("validation.emailInvalid")), this._phone?.isMounted && !this._phone.isValid && (e.phone = this._phone.error ?? t("validation.phoneNumberInvalid")), this._addressStreet?.isMounted && !this._addressStreet.isValid && (e["address.street"] = this._addressStreet.error ?? t("validation.streetRequired")), this._addressCity?.isMounted && !this._addressCity.isValid && (e["address.city"] = this._addressCity.error ?? t("validation.cityRequired")), this._addressCountry?.isMounted && !this._addressCountry.isValid && (e["address.country"] = this._addressCountry.error ?? t("validation.countryRequired")), this._addressFirstName?.isMounted && !this._addressFirstName.isValid && (e["address.firstName"] = this._addressFirstName.error ?? t("validation.firstNameRequired")), this._addressLastName?.isMounted && !this._addressLastName.isValid && (e["address.lastName"] = this._addressLastName.error ?? t("validation.lastNameRequired")), this._cardholderName?.isMounted && !this._cardholderName.isValid && (e.cardholderName = this._cardholderName.error ?? t("validation.nameRequired")), this._addressState?.isMounted && !this._addressState.isValid && (e["address.state"] = this._addressState.error ?? t("validation.stateRequired")), this._addressZipCode?.isMounted && !this._addressZipCode.isValid && (e["address.zipCode"] = this._addressZipCode.error ?? t("validation.zipCodeRequired")), this._applePay?.isMounted && !this._applePay.isValid && (e.applePay = "Apple Pay authorization required"), this._paypal?.isMounted && !this._paypal.isValid && (e.paypal = "PayPal authorization required"), { valid: Object.keys(e).length === 0, errors: e };
|
|
1576
|
-
}
|
|
1577
|
-
async _getPayload() {
|
|
1578
|
-
if (this._applePay?.isMounted && this._applePay.isValid || this._paypal?.isMounted)
|
|
1579
|
-
return null;
|
|
1580
|
-
const e = this._email?.isMounted ? this._email.value : "", t = this._phone?.isMounted ? this._phone.value : void 0, s = this._addressStreet?.isMounted || this._addressCity?.isMounted || this._addressCountry?.isMounted || this._addressFirstName?.isMounted || this._addressLastName?.isMounted || this._cardholderName?.isMounted || this._addressState?.isMounted || this._addressZipCode?.isMounted ? {
|
|
1581
|
-
street: this._addressStreet?.isMounted ? this._addressStreet.value : "",
|
|
1582
|
-
city: this._addressCity?.isMounted ? this._addressCity.value : "",
|
|
1583
|
-
country: this._addressCountry?.isMounted ? this._addressCountry.value : "",
|
|
1584
|
-
firstName: this._addressFirstName?.isMounted ? this._addressFirstName.value : "",
|
|
1585
|
-
lastName: this._addressLastName?.isMounted ? this._addressLastName.value : "",
|
|
1586
|
-
state: this._addressState?.isMounted ? this._addressState.value : "",
|
|
1587
|
-
zipCode: this._addressZipCode?.isMounted ? this._addressZipCode.value : ""
|
|
1588
|
-
} : void 0, o = this._cardholderName?.isMounted ? this._cardholderName.value : "", i = [
|
|
1589
|
-
s?.firstName ?? "",
|
|
1590
|
-
s?.lastName ?? ""
|
|
1591
|
-
].filter(Boolean), n = o || i.join(" ");
|
|
1592
|
-
if (this._card?.isMounted && this._card.isVgsMode)
|
|
1593
|
-
try {
|
|
1594
|
-
const h = await this._card.getPayload();
|
|
1595
|
-
return {
|
|
1596
|
-
name: n,
|
|
1597
|
-
email: e,
|
|
1598
|
-
phoneNumber: t || void 0,
|
|
1599
|
-
cardNumber: "",
|
|
1600
|
-
cardExpiry: "",
|
|
1601
|
-
cardCvv: "",
|
|
1602
|
-
billingAddress: s,
|
|
1603
|
-
vgsCardData: h
|
|
1604
|
-
};
|
|
1605
|
-
} catch {
|
|
1606
|
-
return this._handleAuthorizationError({
|
|
1607
|
-
message: "We couldn't securely process your card details. Please check your card information and try again.",
|
|
1608
|
-
status: 0,
|
|
1609
|
-
statusText: "Card Tokenization Failed"
|
|
1610
|
-
}), null;
|
|
1611
|
-
}
|
|
1612
|
-
const l = this._card?.isMounted ? this._card.value : null;
|
|
1613
|
-
return l ? {
|
|
1614
|
-
name: n,
|
|
1615
|
-
email: e,
|
|
1616
|
-
phoneNumber: t || void 0,
|
|
1617
|
-
cardNumber: l.number,
|
|
1618
|
-
cardExpiry: l.expiry,
|
|
1619
|
-
cardCvv: l.cvv,
|
|
1620
|
-
billingAddress: s
|
|
1621
|
-
} : null;
|
|
1622
|
-
}
|
|
1623
|
-
async authorize(e) {
|
|
1624
|
-
if (!this._paymentState.paymentId || !this._paymentState.checkoutKey)
|
|
1625
|
-
throw new Error("Call associatePayment() before authorize()");
|
|
1626
|
-
if (this._applePay?.isMounted && this._applePay.isValid) {
|
|
1627
|
-
await this._executeAuthorization({
|
|
1628
|
-
formData: null,
|
|
1629
|
-
applePayData: this._applePay.value
|
|
1630
|
-
});
|
|
1631
|
-
return;
|
|
1632
|
-
}
|
|
1633
|
-
if (this._paypal?.isMounted) {
|
|
1634
|
-
await this._executeAuthorization({ formData: null });
|
|
1635
|
-
return;
|
|
1636
|
-
}
|
|
1637
|
-
const t = await this._getPayload();
|
|
1638
|
-
await this._executeAuthorization({
|
|
1639
|
-
formData: t,
|
|
1640
|
-
applePayData: void 0,
|
|
1641
|
-
customCustomerData: e?.customerData
|
|
1642
|
-
});
|
|
1643
|
-
}
|
|
1644
|
-
applyTheme(e) {
|
|
1645
|
-
const t = e["--odus-font-family"];
|
|
1646
|
-
if (t) {
|
|
1647
|
-
this._fontCleanup?.();
|
|
1648
|
-
const { cleanup: r } = j({ fontFamily: t });
|
|
1649
|
-
this._fontCleanup = r;
|
|
1650
|
-
}
|
|
1651
|
-
for (const r of this._allElements())
|
|
1652
|
-
r.setTheme(e);
|
|
1653
|
-
}
|
|
1654
|
-
resetTheme(e) {
|
|
1655
|
-
"--odus-font-family" in e && (this._fontCleanup?.(), this._fontCleanup = void 0);
|
|
1656
|
-
for (const t of this._allElements())
|
|
1657
|
-
t.resetTheme(e);
|
|
1658
|
-
}
|
|
1659
|
-
get isValid() {
|
|
1660
|
-
return this.validate().valid;
|
|
1661
|
-
}
|
|
1662
|
-
onChange(e) {
|
|
1663
|
-
this._changeListeners.push(e);
|
|
1664
|
-
}
|
|
1665
|
-
destroy() {
|
|
1666
|
-
this._fontCleanup?.(), this._card?.destroy(), this._email?.destroy(), this._phone?.destroy(), this._addressStreet?.destroy(), this._addressFirstName?.destroy(), this._addressLastName?.destroy(), this._cardholderName?.destroy(), this._addressCity?.destroy(), this._addressState?.destroy(), this._addressZipCode?.destroy(), this._addressCountry?.destroy(), this._applePay?.destroy(), this._paypal?.destroy(), this._error?.destroy(), this._changeListeners.length = 0;
|
|
1667
|
-
}
|
|
1668
|
-
setCallbacks(e) {
|
|
1669
|
-
Object.assign(this._callbacks, e);
|
|
1670
|
-
}
|
|
1671
|
-
_trackElement(e) {
|
|
1672
|
-
e.on("change", () => {
|
|
1673
|
-
for (const t of this._changeListeners)
|
|
1674
|
-
t();
|
|
1675
|
-
});
|
|
1676
|
-
}
|
|
1677
|
-
_allElements() {
|
|
1678
|
-
return [
|
|
1679
|
-
this._card,
|
|
1680
|
-
this._email,
|
|
1681
|
-
this._phone,
|
|
1682
|
-
this._addressStreet,
|
|
1683
|
-
this._addressFirstName,
|
|
1684
|
-
this._addressLastName,
|
|
1685
|
-
this._cardholderName,
|
|
1686
|
-
this._addressCity,
|
|
1687
|
-
this._addressState,
|
|
1688
|
-
this._addressZipCode,
|
|
1689
|
-
this._addressCountry,
|
|
1690
|
-
this._applePay,
|
|
1691
|
-
this._paypal,
|
|
1692
|
-
this._error
|
|
1693
|
-
].filter((e) => e !== void 0);
|
|
1694
|
-
}
|
|
1695
|
-
async _executeAuthorization({
|
|
1696
|
-
formData: e,
|
|
1697
|
-
applePayData: t,
|
|
1698
|
-
customCustomerData: r
|
|
1699
|
-
}) {
|
|
1700
|
-
try {
|
|
1701
|
-
const s = await this._apiService.authorizePayment({
|
|
1702
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
1703
|
-
paymentId: this._paymentState.paymentId,
|
|
1704
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
1705
|
-
checkoutKey: this._paymentState.checkoutKey,
|
|
1706
|
-
formData: e,
|
|
1707
|
-
returnUrl: this._config.returnUrl,
|
|
1708
|
-
applePayData: t,
|
|
1709
|
-
customCustomerData: r
|
|
1710
|
-
});
|
|
1711
|
-
this._handlePaymentResponse(s);
|
|
1712
|
-
} catch (s) {
|
|
1713
|
-
this._handleAuthorizationError(s);
|
|
1714
|
-
}
|
|
1715
|
-
}
|
|
1716
|
-
_handlePaymentResponse(e) {
|
|
1717
|
-
if (e.latestTransaction.status === "authorized") {
|
|
1718
|
-
this._callbacks.onPaymentSucceeded?.(
|
|
1719
|
-
e.latestTransaction.status
|
|
1720
|
-
);
|
|
1721
|
-
return;
|
|
1722
|
-
}
|
|
1723
|
-
if (e.latestTransaction.status === "failed") {
|
|
1724
|
-
this._callbacks.onPaymentFailed?.(e.latestTransaction.status);
|
|
1725
|
-
return;
|
|
1726
|
-
}
|
|
1727
|
-
e.status === "requires_action" && this._callbacks.onActionRequired?.(e.action.redirectUrl);
|
|
1728
|
-
}
|
|
1729
|
-
_handleAuthorizationError(e) {
|
|
1730
|
-
const t = e.details?.message ?? "Payment failed";
|
|
1731
|
-
this._callbacks.onPaymentFailed?.(t), this._error?.isMounted && this._error.setError(t);
|
|
1732
|
-
}
|
|
1733
|
-
}
|
|
1734
|
-
export {
|
|
1735
|
-
q as AddressCityElement,
|
|
1736
|
-
D as AddressCountryElement,
|
|
1737
|
-
J as AddressFirstNameElement,
|
|
1738
|
-
K as AddressLastNameElement,
|
|
1739
|
-
Z as AddressStateElement,
|
|
1740
|
-
G as AddressStreetElement,
|
|
1741
|
-
U as AddressZipCodeElement,
|
|
1742
|
-
H as ApplePayElement,
|
|
1743
|
-
u as BaseElement,
|
|
1744
|
-
re as CardElement,
|
|
1745
|
-
se as CardholderElement,
|
|
1746
|
-
ie as EmailElement,
|
|
1747
|
-
ne as ErrorElement,
|
|
1748
|
-
fe as OdusElements,
|
|
1749
|
-
ue as PayPalElement,
|
|
1750
|
-
pe as PhoneElement
|
|
1
|
+
import { C as e, I as t, L as n, N as r, P as i, R as a, S as o, a as s, c, i as l, l as u, m as d, n as f, p, q as m, r as h, s as g, t as _, v, x as ee, y, z as b } from "./shared.js";
|
|
2
|
+
//#region libs/checkout/src/assets/styles/helperText.css?inline
|
|
3
|
+
var x = ".form-helper-text{color:#dc2727;font-family:var(--odus-font-family,inherit);max-height:100px;margin-top:4px;font-size:12px;font-weight:500;transition:max-height .3s ease-in-out,opacity .3s ease-in-out,margin .3s ease-in-out;display:block;overflow:hidden}.form-helper-text-hidden{opacity:0;max-height:0;margin-top:0;overflow:hidden}", S = ".input-wrapper{box-sizing:border-box;flex-direction:column;align-items:stretch;width:100%;min-width:0;display:flex}.input-wrapper *{box-sizing:border-box}.form-input{opacity:1;font-size:var(--odus-input-font-size,16px);font-weight:var(--odus-input-font-weight,400);letter-spacing:var(--odus-input-letter-spacing,.02em);box-shadow:0 0 0 1px var(--odus-border-color,#e0e0e0), 0 2px 4px 0 #00000012, 0 1px 1.5px 0 #0000000d;background:var(--odus-color-background,#fff);padding:var(--odus-input-padding,8px 12px);line-height:var(--odus-input-line-height,1.5);z-index:0;box-sizing:border-box;border:none;outline:none;flex:1;width:100%;min-height:0;transition:box-shadow .1s ease-in,border-radius .2s ease-in}.form-input[name=cardNumber]{padding-right:100px}.form-input-error{color:#dc2727}.form-input::placeholder{color:var(--odus-input-placeholder-color,#717173);opacity:var(--odus-input-placeholder-opacity,.3)}.form-input:focus{z-index:2;position:relative;box-shadow:0 0 0 1px #3297d3b3,0 1px 1px #00000012,0 0 0 4px #3297d34d}", C = ".input-label{font-family:var(--odus-font-family,inherit);font-size:var(--odus-label-font-size,14px);font-weight:var(--odus-label-font-weight,400);color:var(--odus-label-color,var(--odus-color-text,#1a1a1a));letter-spacing:var(--odus-label-letter-spacing,normal);line-height:var(--odus-label-line-height,1.4);margin-bottom:var(--odus-label-margin-bottom,6px)}", w = ":host{--odus-font-family:system-ui, sans-serif;--odus-font-size:16px;--odus-color-error:#dc2727;--odus-color-text:#1a1a1a;--odus-color-background:#fff;--odus-border-color:#e0e0e0;--odus-border-radius:6px;--odus-spacing-sm:8px;--odus-spacing-md:16px;--odus-spacing-lg:24px;--odus-input-height:44px;--odus-input-padding:8px 12px;--odus-input-font-size:var(--odus-font-size);--odus-input-font-weight:400;--odus-input-letter-spacing:.02em;--odus-input-line-height:1.5;--odus-input-placeholder-color:#717173;--odus-input-placeholder-opacity:.3;--odus-input-focus-shadow:0 0 0 1px #3297d3b3, 0 1px 1px 0 #00000012, 0 0 0 4px #3297d34d;--odus-label-font-size:14px;--odus-label-font-weight:400;--odus-label-color:var(--odus-color-text);--odus-label-letter-spacing:normal;--odus-label-line-height:1.4;--odus-label-margin-bottom:6px;--odus-card-gap:12px;--odus-button-height:48px;--odus-button-border-radius:var(--odus-border-radius)}.form-input{opacity:1;font-weight:var(--odus-input-font-weight,400);letter-spacing:var(--odus-input-letter-spacing,.02em);box-shadow:0 0 0 1px var(--odus-border-color,#e0e0e0), 0 2px 4px 0 #00000012, 0 1px 1.5px 0 #0000000d;background:var(--odus-color-background,#fff);padding:var(--odus-input-padding,8px 12px);line-height:var(--odus-input-line-height,1.5);z-index:0;box-sizing:border-box;border:none;outline:none;flex:1;width:100%;min-height:0;transition:box-shadow .1s ease-in,border-radius .2s ease-in}.form-input::placeholder{color:var(--odus-input-placeholder-color,#717173);opacity:var(--odus-input-placeholder-opacity,.3)}.form-input:focus{box-shadow:var(--odus-input-focus-shadow,0 0 0 1px #3297d3b3, 0 1px 1px 0 #00000012, 0 0 0 4px #3297d34d);z-index:2;position:relative}.input-label{font-family:var(--odus-font-family,inherit)!important;font-size:var(--odus-label-font-size,14px)!important;font-weight:var(--odus-label-font-weight,400)!important;color:var(--odus-label-color,var(--odus-color-text,#1a1a1a))!important;letter-spacing:var(--odus-label-letter-spacing,normal)!important;line-height:var(--odus-label-line-height,1.4)!important;margin-bottom:var(--odus-label-margin-bottom,6px)!important}.form-helper-text{font-family:var(--odus-font-family,inherit)!important}", T = class {
|
|
4
|
+
shadowRoot = null;
|
|
5
|
+
host = null;
|
|
6
|
+
options = {};
|
|
7
|
+
listeners = /* @__PURE__ */ new Map();
|
|
8
|
+
get isMounted() {
|
|
9
|
+
return this.host !== null;
|
|
10
|
+
}
|
|
11
|
+
mount(e) {
|
|
12
|
+
this.isMounted && this.unmount();
|
|
13
|
+
let t = typeof e == "string" ? document.querySelector(e) : e;
|
|
14
|
+
if (!t) throw Error(`[BaseElement] mount target not found: ${String(e)}`);
|
|
15
|
+
this.host = document.createElement("div"), this.shadowRoot = this.host.attachShadow({ mode: "open" });
|
|
16
|
+
let n = document.createElement("style");
|
|
17
|
+
n.textContent = this.getCss(), this.shadowRoot.appendChild(n), t.appendChild(this.host), this.render(), this.emit("ready");
|
|
18
|
+
}
|
|
19
|
+
unmount() {
|
|
20
|
+
this.host?.parentElement?.removeChild(this.host), this.host = null, this.shadowRoot = null;
|
|
21
|
+
}
|
|
22
|
+
destroy() {
|
|
23
|
+
this.unmount(), this.listeners.clear();
|
|
24
|
+
}
|
|
25
|
+
on(e, t) {
|
|
26
|
+
let n = this.listeners.get(e) ?? [];
|
|
27
|
+
return n.push(t), this.listeners.set(e, n), this;
|
|
28
|
+
}
|
|
29
|
+
update(e) {
|
|
30
|
+
if (this.options = {
|
|
31
|
+
...this.options,
|
|
32
|
+
...e
|
|
33
|
+
}, this.shadowRoot) {
|
|
34
|
+
let e = this.shadowRoot.querySelector("style");
|
|
35
|
+
e && (e.textContent = this.getCss()), this.render();
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
setTheme(e) {
|
|
39
|
+
if (this.host) for (let [t, n] of Object.entries(e)) this.host.style.setProperty(t, n);
|
|
40
|
+
}
|
|
41
|
+
resetTheme(e) {
|
|
42
|
+
if (this.host) for (let t of Object.keys(e)) this.host.style.removeProperty(t);
|
|
43
|
+
}
|
|
44
|
+
get value() {
|
|
45
|
+
return this.getValue();
|
|
46
|
+
}
|
|
47
|
+
get isValid() {
|
|
48
|
+
return this.getIsValid();
|
|
49
|
+
}
|
|
50
|
+
get error() {
|
|
51
|
+
return this.getError();
|
|
52
|
+
}
|
|
53
|
+
emit(e, t) {
|
|
54
|
+
let n = this.listeners.get(e) ?? [];
|
|
55
|
+
for (let e of n) e(t);
|
|
56
|
+
this.options.callbacks?.[e]?.(t);
|
|
57
|
+
}
|
|
58
|
+
getCss() {
|
|
59
|
+
return w;
|
|
60
|
+
}
|
|
61
|
+
}, E = class extends T {
|
|
62
|
+
_value = "";
|
|
63
|
+
_error = null;
|
|
64
|
+
_input = null;
|
|
65
|
+
render() {
|
|
66
|
+
if (!this.shadowRoot) return;
|
|
67
|
+
this._input?.getElement().remove();
|
|
68
|
+
let { t: e } = o();
|
|
69
|
+
this._input = new u({
|
|
70
|
+
name: "billingAddress.city",
|
|
71
|
+
label: e("address.townCity"),
|
|
72
|
+
error: !1,
|
|
73
|
+
placeholder: e("address.placeholder.city"),
|
|
74
|
+
value: this._value,
|
|
75
|
+
autocomplete: "address-level2",
|
|
76
|
+
onChange: (e) => {
|
|
77
|
+
this._value = e.target.value, this._error = null, this.emit("change", this._value);
|
|
78
|
+
}
|
|
79
|
+
}), this._input.addEventListener("blur", () => {
|
|
80
|
+
let { t: e } = o();
|
|
81
|
+
this._error = this._value.trim() ? null : e("validation.townCityRequired"), this._input?.setError(!!this._error, this._error ?? void 0), this.emit("blur", this._value);
|
|
82
|
+
}), this.shadowRoot.appendChild(this._input.getElement());
|
|
83
|
+
}
|
|
84
|
+
getCss() {
|
|
85
|
+
return super.getCss() + [
|
|
86
|
+
S,
|
|
87
|
+
C,
|
|
88
|
+
x
|
|
89
|
+
].join("\n") + "\n :host { display: block; }\n .form-input {\n color: var(--odus-color-text, #1a1a1a) !important;\n font-family: var(--odus-font-family, system-ui, sans-serif) !important;\n font-size: var(--odus-input-font-size, 16px) !important;\n background: var(--odus-color-background, #ffffff) !important;\n border-radius: var(--odus-border-radius, 6px) !important;\n box-shadow:\n 0 0 0 1px var(--odus-border-color, #e0e0e0),\n 0 2px 4px 0 rgba(0, 0, 0, 0.07),\n 0 1px 1.5px 0 rgba(0, 0, 0, 0.05) !important;\n }\n .form-input:focus {\n box-shadow: var(\n --odus-input-focus-shadow,\n 0 0 0 1px rgba(50, 151, 211, 0.7),\n 0 1px 1px 0 rgba(0, 0, 0, 0.07),\n 0 0 0 4px rgba(50, 151, 211, 0.3)\n ) !important;\n outline: none !important;\n }\n .form-input-error {\n color: var(--odus-color-error, #dc2727) !important;\n }\n .form-helper-text {\n color: var(--odus-color-error, #dc2727) !important;\n }\n ";
|
|
90
|
+
}
|
|
91
|
+
getValue() {
|
|
92
|
+
return this._value;
|
|
93
|
+
}
|
|
94
|
+
getIsValid() {
|
|
95
|
+
return !!this._value.trim();
|
|
96
|
+
}
|
|
97
|
+
getError() {
|
|
98
|
+
return this._error;
|
|
99
|
+
}
|
|
100
|
+
}, D = ".form-select{opacity:1;letter-spacing:.02em;padding:var(--odus-input-padding,8px 12px);z-index:0;box-sizing:border-box;cursor:pointer;appearance:none;background:#fff url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10' fill='none'%3E%3Cpath d='M2 3.5L5 6.5L8 3.5' stroke='%23717173' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E\") right 12px center no-repeat;border:none;outline:none;flex:1;width:100%;min-height:0;padding-right:32px;font-weight:400;line-height:1.5;transition:box-shadow .1s ease-in,border-radius .2s ease-in;box-shadow:0 0 0 1px #e0e0e0,0 2px 4px #00000012,0 1px 1.5px #0000000d}.form-select-error{color:#dc2727}.form-select-placeholder{color:#d4d4d5}.form-select option[disabled]{color:#717173;opacity:.5}.form-select:focus{z-index:2;position:relative;box-shadow:0 0 0 1px #3297d3b3,0 1px 1px #00000012,0 0 0 4px #3297d34d}", O = class extends T {
|
|
101
|
+
_value = "";
|
|
102
|
+
_error = null;
|
|
103
|
+
_select = null;
|
|
104
|
+
_allowedCountries;
|
|
105
|
+
setCountries(e) {
|
|
106
|
+
this._allowedCountries = e.length > 0 ? e : void 0, this._value && this._allowedCountries && !this._allowedCountries.includes(this._value) && (this._value = "", this._error = null, this.emit("change", this._value)), this.shadowRoot && this.render();
|
|
107
|
+
}
|
|
108
|
+
render() {
|
|
109
|
+
if (!this.shadowRoot) return;
|
|
110
|
+
this._select?.getElement().remove(), this.options.initialValue && !this._value && (this._value = String(this.options.initialValue));
|
|
111
|
+
let { t: e, locale: t } = o();
|
|
112
|
+
this._select = new c({
|
|
113
|
+
name: "billingAddress.country",
|
|
114
|
+
label: e("address.chooseCountry"),
|
|
115
|
+
error: !1,
|
|
116
|
+
placeholder: e("address.chooseCountry"),
|
|
117
|
+
value: this._value,
|
|
118
|
+
options: d(this._allowedCountries, t),
|
|
119
|
+
autocomplete: "country",
|
|
120
|
+
onChange: (e) => {
|
|
121
|
+
this._value = e.target.value, this._error = null, this.emit("change", this._value);
|
|
122
|
+
}
|
|
123
|
+
}), this._select.addEventListener("blur", () => {
|
|
124
|
+
let { t: e } = o();
|
|
125
|
+
this._error = this._value ? null : e("validation.countryRequired"), this._select?.setError(!!this._error, this._error ?? void 0), this.emit("blur", this._value);
|
|
126
|
+
}), this.shadowRoot.appendChild(this._select.getElement());
|
|
127
|
+
}
|
|
128
|
+
getCss() {
|
|
129
|
+
return super.getCss() + [
|
|
130
|
+
C,
|
|
131
|
+
x,
|
|
132
|
+
D
|
|
133
|
+
].join("\n") + "\n :host { display: block; }\n .form-select {\n color: var(--odus-color-text, #1a1a1a) !important;\n font-family: var(--odus-font-family, system-ui, sans-serif) !important;\n font-size: var(--odus-input-font-size, 16px) !important;\n background-color: var(--odus-color-background, #ffffff) !important;\n border-radius: var(--odus-border-radius, 6px) !important;\n box-shadow:\n 0 0 0 1px var(--odus-border-color, #e0e0e0),\n 0 2px 4px 0 rgba(0, 0, 0, 0.07),\n 0 1px 1.5px 0 rgba(0, 0, 0, 0.05) !important;\n }\n .form-select:focus {\n box-shadow: var(\n --odus-input-focus-shadow,\n 0 0 0 1px rgba(50, 151, 211, 0.7),\n 0 1px 1px 0 rgba(0, 0, 0, 0.07),\n 0 0 0 4px rgba(50, 151, 211, 0.3)\n ) !important;\n outline: none !important;\n }\n .form-select-error {\n color: var(--odus-color-error, #dc2727) !important;\n }\n .form-helper-text {\n color: var(--odus-color-error, #dc2727) !important;\n }\n ";
|
|
134
|
+
}
|
|
135
|
+
getValue() {
|
|
136
|
+
return this._value;
|
|
137
|
+
}
|
|
138
|
+
getIsValid() {
|
|
139
|
+
return !!this._value;
|
|
140
|
+
}
|
|
141
|
+
getError() {
|
|
142
|
+
return this._error;
|
|
143
|
+
}
|
|
144
|
+
}, k = class extends T {
|
|
145
|
+
_value = "";
|
|
146
|
+
_error = null;
|
|
147
|
+
_input = null;
|
|
148
|
+
render() {
|
|
149
|
+
if (!this.shadowRoot) return;
|
|
150
|
+
this._input?.getElement().remove();
|
|
151
|
+
let { t: e } = o();
|
|
152
|
+
this._input = new u({
|
|
153
|
+
name: "billingAddress.firstName",
|
|
154
|
+
label: e("address.firstName"),
|
|
155
|
+
error: !1,
|
|
156
|
+
placeholder: e("address.placeholder.firstName"),
|
|
157
|
+
value: this._value,
|
|
158
|
+
autocomplete: "given-name",
|
|
159
|
+
onChange: (e) => {
|
|
160
|
+
this._value = e.target.value, this._error = null, this.emit("change", this._value);
|
|
161
|
+
}
|
|
162
|
+
}), this._input.addEventListener("blur", () => {
|
|
163
|
+
let { t: e } = o();
|
|
164
|
+
this._error = this._value.trim() ? null : e("validation.firstNameRequired"), this._input?.setError(!!this._error, this._error ?? void 0), this.emit("blur", this._value);
|
|
165
|
+
}), this.shadowRoot.appendChild(this._input.getElement());
|
|
166
|
+
}
|
|
167
|
+
getCss() {
|
|
168
|
+
return super.getCss() + [
|
|
169
|
+
S,
|
|
170
|
+
C,
|
|
171
|
+
x
|
|
172
|
+
].join("\n") + "\n :host { display: block; }\n .form-input {\n color: var(--odus-color-text, #1a1a1a) !important;\n font-family: var(--odus-font-family, system-ui, sans-serif) !important;\n font-size: var(--odus-input-font-size, 16px) !important;\n background: var(--odus-color-background, #ffffff) !important;\n border-radius: var(--odus-border-radius, 6px) !important;\n box-shadow:\n 0 0 0 1px var(--odus-border-color, #e0e0e0),\n 0 2px 4px 0 rgba(0, 0, 0, 0.07),\n 0 1px 1.5px 0 rgba(0, 0, 0, 0.05) !important;\n }\n .form-input:focus {\n box-shadow: var(\n --odus-input-focus-shadow,\n 0 0 0 1px rgba(50, 151, 211, 0.7),\n 0 1px 1px 0 rgba(0, 0, 0, 0.07),\n 0 0 0 4px rgba(50, 151, 211, 0.3)\n ) !important;\n outline: none !important;\n }\n .form-input-error {\n color: var(--odus-color-error, #dc2727) !important;\n }\n .form-helper-text {\n color: var(--odus-color-error, #dc2727) !important;\n }\n ";
|
|
173
|
+
}
|
|
174
|
+
getValue() {
|
|
175
|
+
return this._value;
|
|
176
|
+
}
|
|
177
|
+
getIsValid() {
|
|
178
|
+
return !!this._value.trim();
|
|
179
|
+
}
|
|
180
|
+
getError() {
|
|
181
|
+
return this._error;
|
|
182
|
+
}
|
|
183
|
+
}, A = class extends T {
|
|
184
|
+
_value = "";
|
|
185
|
+
_error = null;
|
|
186
|
+
_input = null;
|
|
187
|
+
render() {
|
|
188
|
+
if (!this.shadowRoot) return;
|
|
189
|
+
this._input?.getElement().remove();
|
|
190
|
+
let { t: e } = o();
|
|
191
|
+
this._input = new u({
|
|
192
|
+
name: "billingAddress.lastName",
|
|
193
|
+
label: e("address.lastName"),
|
|
194
|
+
error: !1,
|
|
195
|
+
placeholder: e("address.placeholder.lastName"),
|
|
196
|
+
value: this._value,
|
|
197
|
+
autocomplete: "family-name",
|
|
198
|
+
onChange: (e) => {
|
|
199
|
+
this._value = e.target.value, this._error = null, this.emit("change", this._value);
|
|
200
|
+
}
|
|
201
|
+
}), this._input.addEventListener("blur", () => {
|
|
202
|
+
let { t: e } = o();
|
|
203
|
+
this._error = this._value.trim() ? null : e("validation.lastNameRequired"), this._input?.setError(!!this._error, this._error ?? void 0), this.emit("blur", this._value);
|
|
204
|
+
}), this.shadowRoot.appendChild(this._input.getElement());
|
|
205
|
+
}
|
|
206
|
+
getCss() {
|
|
207
|
+
return super.getCss() + [
|
|
208
|
+
S,
|
|
209
|
+
C,
|
|
210
|
+
x
|
|
211
|
+
].join("\n") + "\n :host { display: block; }\n .form-input {\n color: var(--odus-color-text, #1a1a1a) !important;\n font-family: var(--odus-font-family, system-ui, sans-serif) !important;\n font-size: var(--odus-input-font-size, 16px) !important;\n background: var(--odus-color-background, #ffffff) !important;\n border-radius: var(--odus-border-radius, 6px) !important;\n box-shadow:\n 0 0 0 1px var(--odus-border-color, #e0e0e0),\n 0 2px 4px 0 rgba(0, 0, 0, 0.07),\n 0 1px 1.5px 0 rgba(0, 0, 0, 0.05) !important;\n }\n .form-input:focus {\n box-shadow: var(\n --odus-input-focus-shadow,\n 0 0 0 1px rgba(50, 151, 211, 0.7),\n 0 1px 1px 0 rgba(0, 0, 0, 0.07),\n 0 0 0 4px rgba(50, 151, 211, 0.3)\n ) !important;\n outline: none !important;\n }\n .form-input-error {\n color: var(--odus-color-error, #dc2727) !important;\n }\n .form-helper-text {\n color: var(--odus-color-error, #dc2727) !important;\n }\n ";
|
|
212
|
+
}
|
|
213
|
+
getValue() {
|
|
214
|
+
return this._value;
|
|
215
|
+
}
|
|
216
|
+
getIsValid() {
|
|
217
|
+
return !!this._value.trim();
|
|
218
|
+
}
|
|
219
|
+
getError() {
|
|
220
|
+
return this._error;
|
|
221
|
+
}
|
|
222
|
+
}, j = new Set(["US", "CA"]), M = class extends T {
|
|
223
|
+
_value = "";
|
|
224
|
+
_country = "";
|
|
225
|
+
_input = null;
|
|
226
|
+
_select = null;
|
|
227
|
+
setCountry(e) {
|
|
228
|
+
let t = this._country;
|
|
229
|
+
if (this._country = e, !this.shadowRoot) return;
|
|
230
|
+
let n = j.has(t), r = j.has(e);
|
|
231
|
+
if (n && r && t !== e) {
|
|
232
|
+
let { t } = o(), n = e, r = t(n === "US" ? "address.chooseState" : "address.chooseProvince");
|
|
233
|
+
this._select?.setOptions(p(n), r), this._value = "";
|
|
234
|
+
return;
|
|
235
|
+
}
|
|
236
|
+
n !== r && (this._value = "", this.render());
|
|
237
|
+
}
|
|
238
|
+
render() {
|
|
239
|
+
if (this.shadowRoot) if (this._input?.getElement().remove(), this._select?.getElement().remove(), this._input = null, this._select = null, j.has(this._country)) {
|
|
240
|
+
let e = this._country;
|
|
241
|
+
this._renderSelect(e);
|
|
242
|
+
} else this._renderInput();
|
|
243
|
+
}
|
|
244
|
+
_renderInput() {
|
|
245
|
+
let { t: e } = o();
|
|
246
|
+
this._input = new u({
|
|
247
|
+
name: "billingAddress.state",
|
|
248
|
+
label: e("address.state"),
|
|
249
|
+
error: !1,
|
|
250
|
+
placeholder: e("address.state"),
|
|
251
|
+
value: this._value,
|
|
252
|
+
autocomplete: "address-level1",
|
|
253
|
+
onChange: (e) => {
|
|
254
|
+
this._value = e.target.value, this.emit("change", this._value);
|
|
255
|
+
}
|
|
256
|
+
}), this._input.addEventListener("blur", () => {
|
|
257
|
+
this.emit("blur", this._value);
|
|
258
|
+
}), this.shadowRoot.appendChild(this._input.getElement());
|
|
259
|
+
}
|
|
260
|
+
_renderSelect(e) {
|
|
261
|
+
let { t } = o(), n = p(e), r = t(e === "US" ? "address.chooseState" : "address.chooseProvince");
|
|
262
|
+
this._select = new c({
|
|
263
|
+
name: "billingAddress.state",
|
|
264
|
+
label: t("address.state"),
|
|
265
|
+
error: !1,
|
|
266
|
+
placeholder: r,
|
|
267
|
+
value: this._value,
|
|
268
|
+
options: n,
|
|
269
|
+
autocomplete: "address-level1",
|
|
270
|
+
onChange: (e) => {
|
|
271
|
+
this._value = e.target.value, this.emit("change", this._value);
|
|
272
|
+
}
|
|
273
|
+
}), this._select.addEventListener("blur", () => {
|
|
274
|
+
this.emit("blur", this._value);
|
|
275
|
+
}), this.shadowRoot.appendChild(this._select.getElement());
|
|
276
|
+
}
|
|
277
|
+
getCss() {
|
|
278
|
+
return super.getCss() + [
|
|
279
|
+
S,
|
|
280
|
+
C,
|
|
281
|
+
x,
|
|
282
|
+
D
|
|
283
|
+
].join("\n") + "\n :host { display: block; }\n .form-input,\n .form-select {\n color: var(--odus-color-text, #1a1a1a) !important;\n font-family: var(--odus-font-family, system-ui, sans-serif) !important;\n font-size: var(--odus-input-font-size, 16px) !important;\n background: var(--odus-color-background, #ffffff) !important;\n border-radius: var(--odus-border-radius, 6px) !important;\n box-shadow:\n 0 0 0 1px var(--odus-border-color, #e0e0e0),\n 0 2px 4px 0 rgba(0, 0, 0, 0.07),\n 0 1px 1.5px 0 rgba(0, 0, 0, 0.05) !important;\n }\n .form-input:focus,\n .form-select:focus {\n box-shadow: var(\n --odus-input-focus-shadow,\n 0 0 0 1px rgba(50, 151, 211, 0.7),\n 0 1px 1px 0 rgba(0, 0, 0, 0.07),\n 0 0 0 4px rgba(50, 151, 211, 0.3)\n ) !important;\n outline: none !important;\n }\n .form-input-error,\n .form-select-error {\n color: var(--odus-color-error, #dc2727) !important;\n }\n .form-helper-text {\n color: var(--odus-color-error, #dc2727) !important;\n }\n ";
|
|
284
|
+
}
|
|
285
|
+
getValue() {
|
|
286
|
+
return this._value;
|
|
287
|
+
}
|
|
288
|
+
getIsValid() {
|
|
289
|
+
return !0;
|
|
290
|
+
}
|
|
291
|
+
getError() {
|
|
292
|
+
return null;
|
|
293
|
+
}
|
|
294
|
+
}, N = class extends T {
|
|
295
|
+
_value = "";
|
|
296
|
+
_error = null;
|
|
297
|
+
_input = null;
|
|
298
|
+
render() {
|
|
299
|
+
if (!this.shadowRoot) return;
|
|
300
|
+
this._input?.getElement().remove();
|
|
301
|
+
let { t: e } = o();
|
|
302
|
+
this._input = new u({
|
|
303
|
+
name: "billingAddress.street",
|
|
304
|
+
label: e("address.addressLine1"),
|
|
305
|
+
error: !1,
|
|
306
|
+
placeholder: e("address.placeholder.street"),
|
|
307
|
+
value: this._value,
|
|
308
|
+
autocomplete: "street-address",
|
|
309
|
+
maxLength: this.options.maxLength,
|
|
310
|
+
onChange: (t) => {
|
|
311
|
+
if (this._value = t.target.value, this._error = null, this.options.maxLength && this._value.length >= this.options.maxLength) {
|
|
312
|
+
let t = e("validation.maxLengthExceeded");
|
|
313
|
+
this._error = t.replace("{{max}}", String(this.options.maxLength)), this._input?.setError(!0, this._error);
|
|
314
|
+
} else this._input?.setError(!1);
|
|
315
|
+
this.emit("change", this._value);
|
|
316
|
+
}
|
|
317
|
+
}), this._input.addEventListener("blur", () => {
|
|
318
|
+
let { t: e } = o();
|
|
319
|
+
this._error = this._value.trim() ? null : e("validation.addressLine1Required"), this._input?.setError(!!this._error, this._error ?? void 0), this.emit("blur", this._value);
|
|
320
|
+
}), this.shadowRoot.appendChild(this._input.getElement());
|
|
321
|
+
}
|
|
322
|
+
getCss() {
|
|
323
|
+
return super.getCss() + [
|
|
324
|
+
S,
|
|
325
|
+
C,
|
|
326
|
+
x
|
|
327
|
+
].join("\n") + "\n :host { display: block; }\n .form-input {\n color: var(--odus-color-text, #1a1a1a) !important;\n font-family: var(--odus-font-family, system-ui, sans-serif) !important;\n font-size: var(--odus-input-font-size, 16px) !important;\n background: var(--odus-color-background, #ffffff) !important;\n border-radius: var(--odus-border-radius, 6px) !important;\n box-shadow:\n 0 0 0 1px var(--odus-border-color, #e0e0e0),\n 0 2px 4px 0 rgba(0, 0, 0, 0.07),\n 0 1px 1.5px 0 rgba(0, 0, 0, 0.05) !important;\n }\n .form-input:focus {\n box-shadow: var(\n --odus-input-focus-shadow,\n 0 0 0 1px rgba(50, 151, 211, 0.7),\n 0 1px 1px 0 rgba(0, 0, 0, 0.07),\n 0 0 0 4px rgba(50, 151, 211, 0.3)\n ) !important;\n outline: none !important;\n }\n .form-input-error {\n color: var(--odus-color-error, #dc2727) !important;\n }\n .form-helper-text {\n color: var(--odus-color-error, #dc2727) !important;\n }\n ";
|
|
328
|
+
}
|
|
329
|
+
getValue() {
|
|
330
|
+
return this._value;
|
|
331
|
+
}
|
|
332
|
+
getIsValid() {
|
|
333
|
+
return !!this._value.trim();
|
|
334
|
+
}
|
|
335
|
+
getError() {
|
|
336
|
+
return this._error;
|
|
337
|
+
}
|
|
338
|
+
}, P = class extends T {
|
|
339
|
+
_value = "";
|
|
340
|
+
_error = null;
|
|
341
|
+
_input = null;
|
|
342
|
+
render() {
|
|
343
|
+
if (!this.shadowRoot) return;
|
|
344
|
+
this._input?.getElement().remove();
|
|
345
|
+
let { t: e } = o();
|
|
346
|
+
this._input = new u({
|
|
347
|
+
name: "billingAddress.zipCode",
|
|
348
|
+
label: e("address.postalCode"),
|
|
349
|
+
error: !1,
|
|
350
|
+
placeholder: e("address.placeholder.zipCode"),
|
|
351
|
+
value: this._value,
|
|
352
|
+
autocomplete: "postal-code",
|
|
353
|
+
onChange: (e) => {
|
|
354
|
+
this._value = e.target.value, this._error = null, this.emit("change", this._value);
|
|
355
|
+
}
|
|
356
|
+
}), this._input.addEventListener("blur", () => {
|
|
357
|
+
let { t: e } = o();
|
|
358
|
+
this._error = this._value.trim() ? null : e("validation.postalCodeRequired"), this._input?.setError(!!this._error, this._error ?? void 0), this.emit("blur", this._value);
|
|
359
|
+
}), this.shadowRoot.appendChild(this._input.getElement());
|
|
360
|
+
}
|
|
361
|
+
getCss() {
|
|
362
|
+
return super.getCss() + [
|
|
363
|
+
S,
|
|
364
|
+
C,
|
|
365
|
+
x
|
|
366
|
+
].join("\n") + "\n :host { display: block; }\n .form-input {\n color: var(--odus-color-text, #1a1a1a) !important;\n font-family: var(--odus-font-family, system-ui, sans-serif) !important;\n font-size: var(--odus-input-font-size, 16px) !important;\n background: var(--odus-color-background, #ffffff) !important;\n border-radius: var(--odus-border-radius, 6px) !important;\n box-shadow:\n 0 0 0 1px var(--odus-border-color, #e0e0e0),\n 0 2px 4px 0 rgba(0, 0, 0, 0.07),\n 0 1px 1.5px 0 rgba(0, 0, 0, 0.05) !important;\n }\n .form-input:focus {\n box-shadow: var(\n --odus-input-focus-shadow,\n 0 0 0 1px rgba(50, 151, 211, 0.7),\n 0 1px 1px 0 rgba(0, 0, 0, 0.07),\n 0 0 0 4px rgba(50, 151, 211, 0.3)\n ) !important;\n outline: none !important;\n }\n .form-input-error {\n color: var(--odus-color-error, #dc2727) !important;\n }\n .form-helper-text {\n color: var(--odus-color-error, #dc2727) !important;\n }\n ";
|
|
367
|
+
}
|
|
368
|
+
getValue() {
|
|
369
|
+
return this._value;
|
|
370
|
+
}
|
|
371
|
+
getIsValid() {
|
|
372
|
+
return !!this._value.trim();
|
|
373
|
+
}
|
|
374
|
+
getError() {
|
|
375
|
+
return this._error;
|
|
376
|
+
}
|
|
377
|
+
}, F = "apple-pay-button{appearance:-apple-pay-button;-apple-pay-button-type:plain;-apple-pay-button-style:black;cursor:pointer;box-sizing:border-box;border-radius:4px;width:100%;height:40px;min-height:40px;display:inline-block}apple-pay-button:hover{filter:brightness(.9)}", I = {
|
|
378
|
+
name: "odus-elements",
|
|
379
|
+
styles: {
|
|
380
|
+
fontSize: 14,
|
|
381
|
+
textColor: "#000000",
|
|
382
|
+
buttonColor: "#0070f3",
|
|
383
|
+
borderRadius: 4,
|
|
384
|
+
fontFamily: "system-ui",
|
|
385
|
+
buttonTextColor: "#ffffff",
|
|
386
|
+
buttonFontSize: 16
|
|
387
|
+
},
|
|
388
|
+
layout: {
|
|
389
|
+
actionButton: { translationKey: null },
|
|
390
|
+
billingFields: {
|
|
391
|
+
street: { enabled: !1 },
|
|
392
|
+
city: { enabled: !1 },
|
|
393
|
+
state: { enabled: !1 },
|
|
394
|
+
zipCode: { enabled: !1 },
|
|
395
|
+
firstName: { enabled: !1 },
|
|
396
|
+
lastName: { enabled: !1 },
|
|
397
|
+
country: { enabled: !1 }
|
|
398
|
+
}
|
|
399
|
+
},
|
|
400
|
+
additionalPaymentMethods: {}
|
|
401
|
+
}, L = class extends T {
|
|
402
|
+
_paymentContext = null;
|
|
403
|
+
_applePayData = null;
|
|
404
|
+
_authorized = !1;
|
|
405
|
+
_button = null;
|
|
406
|
+
setPaymentContext(e) {
|
|
407
|
+
this._paymentContext = e, this.isMounted && this.render();
|
|
408
|
+
}
|
|
409
|
+
render() {
|
|
410
|
+
if (!this.shadowRoot || (this._button?.getElement().remove(), this._button = null, !this._paymentContext)) return;
|
|
411
|
+
let { paymentId: e, checkoutKey: t, environment: n, checkoutDetails: r, displayName: i, countries: a, requiredBillingContactFields: o, requiredShippingContactFields: s, onAuthorize: c } = this._paymentContext;
|
|
412
|
+
a?.length && r?.countryCode && !a.map((e) => e.toUpperCase()).includes(r.countryCode.toUpperCase()) || (this._button = new h({
|
|
413
|
+
checkoutProfile: I,
|
|
414
|
+
paymentId: e,
|
|
415
|
+
checkoutKey: t,
|
|
416
|
+
environment: n,
|
|
417
|
+
checkoutDetails: r,
|
|
418
|
+
displayName: i,
|
|
419
|
+
requiredBillingContactFields: o,
|
|
420
|
+
requiredShippingContactFields: s,
|
|
421
|
+
onSubmit: async ({ applePayData: e }) => {
|
|
422
|
+
e && (this._applePayData = e, this._authorized = !0, this.emit("change", e), await c(e));
|
|
423
|
+
}
|
|
424
|
+
}), this.shadowRoot.appendChild(this._button.getElement()));
|
|
425
|
+
}
|
|
426
|
+
getCss() {
|
|
427
|
+
return super.getCss() + F + "\n :host { display: block; }\n apple-pay-button {\n width: 100%;\n height: var(--odus-button-height, 48px);\n border-radius: var(--odus-button-border-radius, 6px);\n }\n ";
|
|
428
|
+
}
|
|
429
|
+
getValue() {
|
|
430
|
+
return this._applePayData;
|
|
431
|
+
}
|
|
432
|
+
getIsValid() {
|
|
433
|
+
return this._authorized;
|
|
434
|
+
}
|
|
435
|
+
getError() {
|
|
436
|
+
return null;
|
|
437
|
+
}
|
|
438
|
+
}, R = ".card-element{border-radius:inherit;box-sizing:border-box;background:#fff;border:none;height:38.5px;padding:0;transition:box-shadow .1s ease-in;position:relative;box-shadow:0 0 0 1px #e0e0e0,0 2px 4px #00000012,0 1px 1.5px #0000000d}.card-element iframe{width:100%;min-width:0;display:block}.card-element-focus{box-shadow:0 0 0 1px #3297d3b3,0 1px 1px #00000012,0 0 0 4px #3297d34d}.card-icon{opacity:1;width:18px;transition:opacity .6s ease-in}.card-icon img{max-width:100%;height:auto;display:block}.cards-position{z-index:10;pointer-events:none;align-items:center;gap:8px;display:flex;position:absolute;top:50%;right:12px;transform:translateY(-50%)}.loading{position:relative}.loading:after{content:\"\";border-radius:inherit;background-color:#fff;width:100%;height:100%;position:absolute;inset:0}@media only screen and (min-width:600px){.card-icon{width:20px}}.vgs-card-group iframe,.vgs-wrap iframe{width:100%;min-width:0;display:block}.fake-ph{color:#717173;opacity:.3;font-size:var(--odus-input-font-size,16px);letter-spacing:.02em;font-weight:400;line-height:1.5;font-family:var(--odus-font-family,inherit);pointer-events:none;-webkit-user-select:none;user-select:none;white-space:nowrap;z-index:0;background:#fff;align-items:center;padding:8px 12px;display:flex;position:absolute;inset:0}@keyframes vgs-shimmer{0%{background-position:-200% 0}to{background-position:200% 0}}.vgs-field-skeleton{pointer-events:none;z-index:11;border-radius:inherit;background:linear-gradient(90deg,#f7f7f7 25%,#fdfdfd 50%,#f7f7f7 75%) 0 0/200% 100%;animation:1.5s ease-in-out infinite vgs-shimmer;position:absolute;inset:0}", z = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvWpIQFjQQCPpaIlJKpegirp5kLkzLB1AxHmnLk73D3TJbAGqr1QmlsWDBtMPMRpdzzUM7ZwX3kzhIuATV4Pe7RKp3nZlVmcrT0YCQXBrTwqZNh775z58GP2kZs+gVfNqBampJPzSB/hB62KkByhECn6grrRjiAVwJyZVEvs/2vrxaEpO+aE16emtX12RgI5JdzdOiNyZEQteU6zRBRJEocPWVxExaOpVVVJ5+UnW0LcalzA+lRGRTrQJ5JguAPiAOzRPTK/lYFFpCAl/F8wtoAVG1c8zO2NcQ0Pko+fmeidRFxJ/did2btV+9Mkze3mBphwFmvnxa35LF+Cs/XJHDwIDAQAB", B = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA8gGPMwBRPuVyJReZGIkWH/+Bf5pnpDN1bSR2cLYLXVT8CaSnTw74qeboSnktgYCi1D9R3Bj2fYzTIwGGZb8KinLdxwbqZmHwrE9cFhCaHbG/E0PbqQGhXP2vbniZTT4M0i0Cbi7ES3Bw5zqNbIZZnX041QEpxLvIyWPKZCX+fBogNMhWfCF779aclChjHkwZMsufThVWE9xklWGxXiytx5aL4I5JPxq0I7cAkZGGs4aF/GxWwPaq7R3wPikJQ0YHnCMfcURzl2Hnw/inqyMy+JB6djTq2/BdzMAhWTh3cDWq9Xu+gEkb/QCd0n1yYIdKuDISlk/AfHdWe34IvzhVyQIDAQAB", V = {
|
|
439
|
+
name: "odus-elements",
|
|
440
|
+
styles: {
|
|
441
|
+
fontSize: 14,
|
|
442
|
+
textColor: "#000000",
|
|
443
|
+
buttonColor: "#0070f3",
|
|
444
|
+
borderRadius: 4,
|
|
445
|
+
fontFamily: "system-ui",
|
|
446
|
+
buttonTextColor: "#ffffff",
|
|
447
|
+
buttonFontSize: 16
|
|
448
|
+
},
|
|
449
|
+
layout: {
|
|
450
|
+
actionButton: { translationKey: null },
|
|
451
|
+
billingFields: {
|
|
452
|
+
street: { enabled: !0 },
|
|
453
|
+
city: { enabled: !0 },
|
|
454
|
+
state: { enabled: !0 },
|
|
455
|
+
zipCode: { enabled: !0 },
|
|
456
|
+
firstName: { enabled: !0 },
|
|
457
|
+
lastName: { enabled: !0 },
|
|
458
|
+
country: { enabled: !0 }
|
|
459
|
+
}
|
|
460
|
+
},
|
|
461
|
+
additionalPaymentMethods: {}
|
|
462
|
+
}, H = class {
|
|
463
|
+
_cardNumber = "";
|
|
464
|
+
_cardExpiry = "";
|
|
465
|
+
_cardCvv = "";
|
|
466
|
+
_section = null;
|
|
467
|
+
_focusManager = new v();
|
|
468
|
+
_touchedFields = /* @__PURE__ */ new Set();
|
|
469
|
+
_focusHandlers = [];
|
|
470
|
+
get section() {
|
|
471
|
+
return this._section;
|
|
472
|
+
}
|
|
473
|
+
renderSection(e, t, n) {
|
|
474
|
+
this._section?.getElement().remove();
|
|
475
|
+
let { t: a } = o();
|
|
476
|
+
this._section = new s({
|
|
477
|
+
checkoutProfile: V,
|
|
478
|
+
cardNumber: this._cardNumber,
|
|
479
|
+
cardNumberTouched: !1,
|
|
480
|
+
cardCvv: this._cardCvv,
|
|
481
|
+
cardCvvTouched: !1,
|
|
482
|
+
cardExpiry: this._cardExpiry,
|
|
483
|
+
cardExpiryTouched: !1,
|
|
484
|
+
translationFunc: a,
|
|
485
|
+
onChange: (e) => {
|
|
486
|
+
let n = e.target;
|
|
487
|
+
if (n.name === "cardNumber") this._cardNumber = n.value;
|
|
488
|
+
else if (n.name === "cardExpiry") {
|
|
489
|
+
let e = i.cardExpiry(n.value);
|
|
490
|
+
this._cardExpiry = e, this._section?.updateCardExpiry(e);
|
|
491
|
+
} else n.name === "cardCvv" && (this._cardCvv = n.value);
|
|
492
|
+
this._touchedFields.add(n.name), this._updateFocusManagerState(), t(this.getValue());
|
|
493
|
+
},
|
|
494
|
+
onBlur: (e) => {
|
|
495
|
+
let t = e.target, i = t.name ?? "cardExpiry", a = r();
|
|
496
|
+
if (this._touchedFields.add(i), t.name === "cardNumber") {
|
|
497
|
+
let e = a.cardNumber(this._cardNumber);
|
|
498
|
+
this._section?.updateCardNumber(this._cardNumber, e, !0);
|
|
499
|
+
} else if (t.name === "cardCvv") {
|
|
500
|
+
let e = a.cardCvv(this._cardCvv, this._cardNumber);
|
|
501
|
+
this._section?.updateCardCvv(this._cardCvv, e, !0);
|
|
502
|
+
} else {
|
|
503
|
+
let e = a.cardExpiry(this._cardExpiry);
|
|
504
|
+
this._section?.updateCardExpiry(this._cardExpiry, e, !0);
|
|
505
|
+
}
|
|
506
|
+
this._updateFocusManagerState(), n(this.getValue());
|
|
507
|
+
}
|
|
508
|
+
}), e.appendChild(this._section.getElement()), this._registerFocusFields();
|
|
509
|
+
}
|
|
510
|
+
getValue() {
|
|
511
|
+
return {
|
|
512
|
+
number: this._cardNumber,
|
|
513
|
+
expiry: this._cardExpiry,
|
|
514
|
+
cvv: this._cardCvv
|
|
515
|
+
};
|
|
516
|
+
}
|
|
517
|
+
async getPayload(e) {
|
|
518
|
+
let t = e === "live" ? B : z, n = new b();
|
|
519
|
+
n.setPublicKey(t);
|
|
520
|
+
let r = this._cardNumber.replace(/\s+/g, ""), i = this._cardExpiry.replace(/\s+/g, "").split("/"), a = i[0] ?? "", o = i[1] ?? "";
|
|
521
|
+
return o.length === 2 && (o = `20${o}`), {
|
|
522
|
+
encryptedCardNumber: n.encrypt(r),
|
|
523
|
+
encryptedCvv: n.encrypt(this._cardCvv),
|
|
524
|
+
expMonth: a,
|
|
525
|
+
expYear: o
|
|
526
|
+
};
|
|
527
|
+
}
|
|
528
|
+
isValid() {
|
|
529
|
+
let e = r(), t = this._cardCvv.length >= 3;
|
|
530
|
+
return !e.cardNumber(this._cardNumber) && !e.cardExpiry(this._cardExpiry) && t;
|
|
531
|
+
}
|
|
532
|
+
getError() {
|
|
533
|
+
let e = r();
|
|
534
|
+
return e.cardNumber(this._cardNumber) ?? e.cardExpiry(this._cardExpiry) ?? null;
|
|
535
|
+
}
|
|
536
|
+
destroy() {
|
|
537
|
+
this._cleanupFocusHandlers(), this._section = null;
|
|
538
|
+
}
|
|
539
|
+
_registerFocusFields() {
|
|
540
|
+
if (this._cleanupFocusHandlers(), !this._section) return;
|
|
541
|
+
let e = this._section.getElement();
|
|
542
|
+
this._focusManager.registerField("cardNumber", { focus: () => this._section?.focusField("cardNumber") }), this._focusManager.registerField("cardExpiry", { focus: () => this._section?.focusField("cardExpiry") }), this._focusManager.registerField("cardCvv", { focus: () => this._section?.focusField("cardCvv") });
|
|
543
|
+
for (let t of [
|
|
544
|
+
"cardNumber",
|
|
545
|
+
"cardExpiry",
|
|
546
|
+
"cardCvv"
|
|
547
|
+
]) {
|
|
548
|
+
let n = e.querySelector(`input[name="${t}"]`);
|
|
549
|
+
if (!n) continue;
|
|
550
|
+
let r = () => this._focusManager.handleFieldFocus(t);
|
|
551
|
+
n.addEventListener("focus", r), this._focusHandlers.push(() => n.removeEventListener("focus", r));
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
_cleanupFocusHandlers() {
|
|
555
|
+
for (let e of this._focusHandlers) e();
|
|
556
|
+
this._focusHandlers = [];
|
|
557
|
+
}
|
|
558
|
+
_updateFocusManagerState() {
|
|
559
|
+
let e = r(), t = {
|
|
560
|
+
cardNumber: this._cardNumber,
|
|
561
|
+
cardExpiry: this._cardExpiry,
|
|
562
|
+
cardCvv: this._cardCvv,
|
|
563
|
+
name: "",
|
|
564
|
+
email: ""
|
|
565
|
+
}, n = {}, i = e.cardNumber(this._cardNumber), a = e.cardExpiry(this._cardExpiry), o = e.cardCvv(this._cardCvv, this._cardNumber);
|
|
566
|
+
i && (n.cardNumber = i), a && (n.cardExpiry = a), o && (n.cardCvv = o);
|
|
567
|
+
let s = {};
|
|
568
|
+
for (let e of this._touchedFields) s[e] = !0;
|
|
569
|
+
this._focusManager.handleStateUpdate(t, n, s);
|
|
570
|
+
}
|
|
571
|
+
}, U = class {
|
|
572
|
+
_vgsService;
|
|
573
|
+
_vgsJwt;
|
|
574
|
+
_vgsState = {};
|
|
575
|
+
_vgsFieldsValid = !1;
|
|
576
|
+
_vgsReinitTimer = null;
|
|
577
|
+
_currentTheme = {};
|
|
578
|
+
_environment = "test";
|
|
579
|
+
_section = null;
|
|
580
|
+
constructor(e, n) {
|
|
581
|
+
this._vgsJwt = e, this._environment = n, this._vgsService = new t();
|
|
582
|
+
}
|
|
583
|
+
get section() {
|
|
584
|
+
return this._section;
|
|
585
|
+
}
|
|
586
|
+
renderSection(e, t) {
|
|
587
|
+
this._section?.getElement().remove();
|
|
588
|
+
let { t: n } = o();
|
|
589
|
+
this._section = new s({
|
|
590
|
+
checkoutProfile: V,
|
|
591
|
+
cardNumber: "",
|
|
592
|
+
cardNumberTouched: !1,
|
|
593
|
+
cardCvv: "",
|
|
594
|
+
cardCvvTouched: !1,
|
|
595
|
+
cardExpiry: "",
|
|
596
|
+
cardExpiryTouched: !1,
|
|
597
|
+
translationFunc: n,
|
|
598
|
+
onChange: () => {},
|
|
599
|
+
onBlur: () => {},
|
|
600
|
+
vgsService: this._vgsService
|
|
601
|
+
}), e.appendChild(this._section.getElement()), this._onChangeEmit = t;
|
|
602
|
+
}
|
|
603
|
+
_onChangeEmit = null;
|
|
604
|
+
initVgs() {
|
|
605
|
+
this._vgsService.init(this._environment).then((e) => {
|
|
606
|
+
this._vgsService.createForm(e, (e) => this._handleStateChange(e)), this._mountFields();
|
|
607
|
+
});
|
|
608
|
+
}
|
|
609
|
+
async getPayload() {
|
|
610
|
+
if (!this._vgsJwt) throw Error("VGS not initialized");
|
|
611
|
+
let e = await this._vgsService.createCard(this._vgsJwt);
|
|
612
|
+
return {
|
|
613
|
+
cardId: e.cardId,
|
|
614
|
+
expMonth: e.expMonth,
|
|
615
|
+
expYear: e.expYear,
|
|
616
|
+
name: e.name
|
|
617
|
+
};
|
|
618
|
+
}
|
|
619
|
+
isValid() {
|
|
620
|
+
return this._vgsFieldsValid;
|
|
621
|
+
}
|
|
622
|
+
getError() {
|
|
623
|
+
let { t: e } = o();
|
|
624
|
+
for (let [t, n] of Object.entries(this._vgsState)) {
|
|
625
|
+
if (!n?.isTouched || n.isFocused || n.isValid) continue;
|
|
626
|
+
let r = n.errors?.[0];
|
|
627
|
+
if (!r) continue;
|
|
628
|
+
let i = g(t, r.code);
|
|
629
|
+
if (i) return e(i);
|
|
630
|
+
}
|
|
631
|
+
return null;
|
|
632
|
+
}
|
|
633
|
+
applyTheme(e) {
|
|
634
|
+
if (this._currentTheme = {
|
|
635
|
+
...this._currentTheme,
|
|
636
|
+
...e
|
|
637
|
+
}, !this._section) return;
|
|
638
|
+
let t = this._buildProfileFromTheme(this._currentTheme), n = this._currentTheme["--odus-border-color"] ?? "#e0e0e0";
|
|
639
|
+
this._section.updateVgsWrapperStyles(n, t.styles.borderRadius), this._reinitWithTheme();
|
|
640
|
+
}
|
|
641
|
+
destroy() {
|
|
642
|
+
this._vgsReinitTimer &&= (clearTimeout(this._vgsReinitTimer), null), this._vgsService.destroy(), this._section = null;
|
|
643
|
+
}
|
|
644
|
+
_reinitWithTheme() {
|
|
645
|
+
this._vgsReinitTimer && clearTimeout(this._vgsReinitTimer), this._vgsReinitTimer = setTimeout(() => {
|
|
646
|
+
this._vgsReinitTimer = null, this._vgsService.destroy(), this._vgsService = new t(), this.initVgs();
|
|
647
|
+
}, 300);
|
|
648
|
+
}
|
|
649
|
+
_buildProfileFromTheme(e) {
|
|
650
|
+
let t = e["--odus-input-font-size"] ?? e["--odus-font-size"] ?? `${V.styles.fontSize}px`, n = e["--odus-font-family"] ?? V.styles.fontFamily, r = e["--odus-color-text"] ?? V.styles.textColor, i = e["--odus-border-radius"] ?? `${V.styles.borderRadius}px`;
|
|
651
|
+
return {
|
|
652
|
+
...V,
|
|
653
|
+
styles: {
|
|
654
|
+
...V.styles,
|
|
655
|
+
fontSize: parseInt(t, 10) || V.styles.fontSize,
|
|
656
|
+
fontFamily: n,
|
|
657
|
+
textColor: r,
|
|
658
|
+
borderRadius: parseInt(i, 10) || V.styles.borderRadius
|
|
659
|
+
}
|
|
660
|
+
};
|
|
661
|
+
}
|
|
662
|
+
async _mountFields() {
|
|
663
|
+
if (!this._section) return;
|
|
664
|
+
let e = Object.keys(this._currentTheme).length > 0 ? this._buildProfileFromTheme(this._currentTheme) : V, t = this._currentTheme["--odus-border-color"] ?? "#e0e0e0";
|
|
665
|
+
this._section.updateVgsWrapperStyles(t, e.styles.borderRadius);
|
|
666
|
+
let n = this._section.getVgsContainerIds();
|
|
667
|
+
for (let e of Object.values(n)) {
|
|
668
|
+
if (!e) continue;
|
|
669
|
+
let t = document.getElementById(e);
|
|
670
|
+
t && t.querySelectorAll("iframe").forEach((e) => e.remove());
|
|
671
|
+
}
|
|
672
|
+
let r = await y(e.styles.fontFamily), i = this._section.buildVgsFieldCss(e, r, {
|
|
673
|
+
borderColor: t,
|
|
674
|
+
backgroundColor: this._currentTheme["--odus-color-background"],
|
|
675
|
+
placeholderColor: this._currentTheme["--odus-input-placeholder-color"],
|
|
676
|
+
placeholderOpacity: this._currentTheme["--odus-input-placeholder-opacity"],
|
|
677
|
+
padding: this._currentTheme["--odus-input-padding"]
|
|
678
|
+
}), { t: a } = o();
|
|
679
|
+
this._vgsService.mountCardFields({
|
|
680
|
+
cardNumber: n.cardNumber ? `#${n.cardNumber}` : void 0,
|
|
681
|
+
cardExpiry: n.cardExpiry ? `#${n.cardExpiry}` : void 0,
|
|
682
|
+
cardCvv: n.cardCvv ? `#${n.cardCvv}` : void 0
|
|
683
|
+
}, i, {
|
|
684
|
+
cardNumber: "1234 5678 9012 3456",
|
|
685
|
+
cardExpiry: a("cardExpiry"),
|
|
686
|
+
cardCvv: "CVV",
|
|
687
|
+
cardholderName: a("cardholderName")
|
|
688
|
+
}, (e) => {
|
|
689
|
+
this._section?.updateVgsCardBrand(e);
|
|
690
|
+
}), this._vgsService.waitForFieldsReady().then(() => {
|
|
691
|
+
this._section?.hideFakePlaceholders();
|
|
692
|
+
});
|
|
693
|
+
}
|
|
694
|
+
_handleStateChange(e) {
|
|
695
|
+
this._vgsState = e, this._vgsFieldsValid = Object.values(e).every((e) => e?.isValid === !0);
|
|
696
|
+
let { t } = o(), n = this._deriveFieldErrors(t);
|
|
697
|
+
this._section?.handleVgsStateChange(e, n), this._onChangeEmit?.();
|
|
698
|
+
}
|
|
699
|
+
_deriveFieldErrors(e) {
|
|
700
|
+
let t = {};
|
|
701
|
+
for (let [n, r] of Object.entries(this._vgsState)) {
|
|
702
|
+
if (!r?.isTouched || r.isFocused || r.isValid) continue;
|
|
703
|
+
let i = r.errors?.[0];
|
|
704
|
+
if (!i) continue;
|
|
705
|
+
let a = g(n, i.code);
|
|
706
|
+
a && (t[n] = e(a));
|
|
707
|
+
}
|
|
708
|
+
return t;
|
|
709
|
+
}
|
|
710
|
+
}, W = class extends T {
|
|
711
|
+
_environment = "test";
|
|
712
|
+
_isVgsMode = !1;
|
|
713
|
+
_mountContainer = null;
|
|
714
|
+
_nativeAdapter = new H();
|
|
715
|
+
_vgsAdapter = null;
|
|
716
|
+
get isVgsMode() {
|
|
717
|
+
return this._isVgsMode;
|
|
718
|
+
}
|
|
719
|
+
setEnvironment(e) {
|
|
720
|
+
this._environment = e;
|
|
721
|
+
}
|
|
722
|
+
setVgsJwt(e) {
|
|
723
|
+
this._isVgsMode = !0, this._vgsAdapter = new U(e, this._environment), this.isMounted && this._mountContainer && (this.unmount(), this.mount(this._mountContainer));
|
|
724
|
+
}
|
|
725
|
+
mount(e) {
|
|
726
|
+
this.isMounted && this.unmount();
|
|
727
|
+
let t = typeof e == "string" ? document.querySelector(e) : e;
|
|
728
|
+
if (!t) throw Error(`[CardElement] mount target not found: ${String(e)}`);
|
|
729
|
+
if (this._mountContainer = e, this._isVgsMode) {
|
|
730
|
+
this.host = document.createElement("div");
|
|
731
|
+
let e = document.createElement("style");
|
|
732
|
+
e.textContent = this.getCss(), this.host.appendChild(e), t.appendChild(this.host), this.render(), this._vgsAdapter?.initVgs(), this.emit("ready");
|
|
733
|
+
} else super.mount(e);
|
|
734
|
+
}
|
|
735
|
+
unmount() {
|
|
736
|
+
this._isVgsMode ? (this.host?.parentElement?.removeChild(this.host), this.host = null, this.shadowRoot = null) : super.unmount();
|
|
737
|
+
}
|
|
738
|
+
render() {
|
|
739
|
+
if (this._isVgsMode) {
|
|
740
|
+
if (!this.host || !this._vgsAdapter) return;
|
|
741
|
+
this._vgsAdapter.renderSection(this.host, () => this.emit("change", this.getValue()));
|
|
742
|
+
} else {
|
|
743
|
+
if (!this.shadowRoot) return;
|
|
744
|
+
this._nativeAdapter.renderSection(this.shadowRoot, (e) => this.emit("change", e), (e) => this.emit("blur", e));
|
|
745
|
+
}
|
|
746
|
+
}
|
|
747
|
+
focus() {
|
|
748
|
+
(this._isVgsMode ? this._vgsAdapter?.section : this._nativeAdapter.section)?.focus();
|
|
749
|
+
}
|
|
750
|
+
focusField(e) {
|
|
751
|
+
(this._isVgsMode ? this._vgsAdapter?.section : this._nativeAdapter.section)?.focusField(e);
|
|
752
|
+
}
|
|
753
|
+
destroy() {
|
|
754
|
+
this._nativeAdapter.destroy(), this._vgsAdapter?.destroy(), this._vgsAdapter = null, super.destroy();
|
|
755
|
+
}
|
|
756
|
+
setTheme(e) {
|
|
757
|
+
super.setTheme(e), !(!this._isVgsMode || !this._vgsAdapter) && this._vgsAdapter.applyTheme(e);
|
|
758
|
+
}
|
|
759
|
+
getCss() {
|
|
760
|
+
return super.getCss() + [
|
|
761
|
+
S,
|
|
762
|
+
C,
|
|
763
|
+
x,
|
|
764
|
+
R
|
|
765
|
+
].join("\n") + "\n :host { display: block; }\n .card-grid {\n display: flex;\n flex-direction: column;\n gap: var(--odus-card-gap, 12px);\n }\n .card-details {\n display: flex;\n gap: var(--odus-card-gap, 12px);\n }\n .form-input,\n .form-select {\n color: var(--odus-color-text, #1a1a1a) !important;\n font-family: var(--odus-font-family, system-ui, sans-serif) !important;\n font-size: var(--odus-input-font-size, 16px) !important;\n background: var(--odus-color-background, #ffffff) !important;\n border-radius: var(--odus-border-radius, 6px) !important;\n box-shadow:\n 0 0 0 1px var(--odus-border-color, #e0e0e0),\n 0 2px 4px 0 rgba(0, 0, 0, 0.07),\n 0 1px 1.5px 0 rgba(0, 0, 0, 0.05) !important;\n }\n .form-input:focus,\n .form-select:focus {\n box-shadow: var(\n --odus-input-focus-shadow,\n 0 0 0 1px rgba(50, 151, 211, 0.7),\n 0 1px 1px 0 rgba(0, 0, 0, 0.07),\n 0 0 0 4px rgba(50, 151, 211, 0.3)\n ) !important;\n outline: none !important;\n }\n .form-input-error,\n .form-select-error {\n color: var(--odus-color-error, #dc2727) !important;\n }\n .form-helper-text {\n color: var(--odus-color-error, #dc2727) !important;\n }\n ";
|
|
766
|
+
}
|
|
767
|
+
getValue() {
|
|
768
|
+
return this._isVgsMode ? {
|
|
769
|
+
number: "",
|
|
770
|
+
expiry: "",
|
|
771
|
+
cvv: ""
|
|
772
|
+
} : this._nativeAdapter.getValue();
|
|
773
|
+
}
|
|
774
|
+
async getPayload() {
|
|
775
|
+
if (this._isVgsMode) {
|
|
776
|
+
if (!this._vgsAdapter) throw Error("VGS not initialized");
|
|
777
|
+
return this._vgsAdapter.getPayload();
|
|
778
|
+
}
|
|
779
|
+
return this._nativeAdapter.getPayload(this._environment);
|
|
780
|
+
}
|
|
781
|
+
getIsValid() {
|
|
782
|
+
return this._isVgsMode ? this._vgsAdapter?.isValid() ?? !1 : this._nativeAdapter.isValid();
|
|
783
|
+
}
|
|
784
|
+
getError() {
|
|
785
|
+
return this._isVgsMode ? this._vgsAdapter?.getError() ?? null : this._nativeAdapter.getError();
|
|
786
|
+
}
|
|
787
|
+
}, G = class extends T {
|
|
788
|
+
_value = "";
|
|
789
|
+
_error = null;
|
|
790
|
+
_input = null;
|
|
791
|
+
render() {
|
|
792
|
+
if (!this.shadowRoot) return;
|
|
793
|
+
this._input?.getElement().remove();
|
|
794
|
+
let { t: e } = o();
|
|
795
|
+
this._input = new u({
|
|
796
|
+
name: "billingAddress.cardholderName",
|
|
797
|
+
label: e("cardholderNameLabel"),
|
|
798
|
+
error: !1,
|
|
799
|
+
placeholder: e("cardholderNamePlaceholder"),
|
|
800
|
+
value: this._value,
|
|
801
|
+
autocomplete: "cc-name",
|
|
802
|
+
onChange: (e) => {
|
|
803
|
+
let t = e.target.value, n = t.replace(/[^a-zA-Z\s\-'.]/g, "");
|
|
804
|
+
t !== n && this._input?.setValue(n), this._value = n, this._error = null, this.emit("change", this._value);
|
|
805
|
+
}
|
|
806
|
+
}), this._input.addEventListener("blur", () => {
|
|
807
|
+
let { t: e } = o();
|
|
808
|
+
this._error = this._value.trim() ? null : e("validation.nameRequired"), this._input?.setError(!!this._error, this._error ?? void 0), this.emit("blur", this._value);
|
|
809
|
+
}), this.shadowRoot.appendChild(this._input.getElement());
|
|
810
|
+
}
|
|
811
|
+
getCss() {
|
|
812
|
+
return super.getCss() + [
|
|
813
|
+
S,
|
|
814
|
+
C,
|
|
815
|
+
x
|
|
816
|
+
].join("\n") + "\n :host { display: block; }\n .form-input {\n color: var(--odus-color-text, #1a1a1a) !important;\n font-family: var(--odus-font-family, system-ui, sans-serif) !important;\n font-size: var(--odus-input-font-size, 16px) !important;\n background: var(--odus-color-background, #ffffff) !important;\n border-radius: var(--odus-border-radius, 6px) !important;\n box-shadow:\n 0 0 0 1px var(--odus-border-color, #e0e0e0),\n 0 2px 4px 0 rgba(0, 0, 0, 0.07),\n 0 1px 1.5px 0 rgba(0, 0, 0, 0.05) !important;\n }\n .form-input:focus {\n box-shadow: var(\n --odus-input-focus-shadow,\n 0 0 0 1px rgba(50, 151, 211, 0.7),\n 0 1px 1px 0 rgba(0, 0, 0, 0.07),\n 0 0 0 4px rgba(50, 151, 211, 0.3)\n ) !important;\n outline: none !important;\n }\n .form-input-error {\n color: var(--odus-color-error, #dc2727) !important;\n }\n .form-helper-text {\n color: var(--odus-color-error, #dc2727) !important;\n }\n ";
|
|
817
|
+
}
|
|
818
|
+
getValue() {
|
|
819
|
+
return this._value;
|
|
820
|
+
}
|
|
821
|
+
getIsValid() {
|
|
822
|
+
return !!this._value.trim();
|
|
823
|
+
}
|
|
824
|
+
getError() {
|
|
825
|
+
return this._error;
|
|
826
|
+
}
|
|
827
|
+
}, K = {
|
|
828
|
+
name: "odus-elements",
|
|
829
|
+
styles: {
|
|
830
|
+
fontSize: 14,
|
|
831
|
+
textColor: "#000000",
|
|
832
|
+
buttonColor: "#0070f3",
|
|
833
|
+
borderRadius: 4,
|
|
834
|
+
fontFamily: "system-ui",
|
|
835
|
+
buttonTextColor: "#ffffff",
|
|
836
|
+
buttonFontSize: 16
|
|
837
|
+
},
|
|
838
|
+
layout: {
|
|
839
|
+
actionButton: { translationKey: null },
|
|
840
|
+
billingFields: {
|
|
841
|
+
street: { enabled: !1 },
|
|
842
|
+
city: { enabled: !1 },
|
|
843
|
+
state: { enabled: !1 },
|
|
844
|
+
zipCode: { enabled: !1 },
|
|
845
|
+
firstName: { enabled: !1 },
|
|
846
|
+
lastName: { enabled: !1 },
|
|
847
|
+
country: { enabled: !1 }
|
|
848
|
+
}
|
|
849
|
+
},
|
|
850
|
+
additionalPaymentMethods: {}
|
|
851
|
+
}, q = class extends T {
|
|
852
|
+
_email = "";
|
|
853
|
+
_error = null;
|
|
854
|
+
_field = null;
|
|
855
|
+
render() {
|
|
856
|
+
if (!this.shadowRoot) return;
|
|
857
|
+
this._field?.getElement().remove(), this.options.initialValue && !this._email && (this._email = String(this.options.initialValue));
|
|
858
|
+
let { t: e } = o();
|
|
859
|
+
this._field = new l({
|
|
860
|
+
value: this._email,
|
|
861
|
+
error: !1,
|
|
862
|
+
checkoutProfile: K,
|
|
863
|
+
translationFunc: e,
|
|
864
|
+
onChange: (e) => {
|
|
865
|
+
let t = e.target;
|
|
866
|
+
this._email = t.value ?? this._field?.getValue() ?? "", this._error = null, this.emit("change", this._email);
|
|
867
|
+
},
|
|
868
|
+
onBlur: () => {
|
|
869
|
+
let e = r();
|
|
870
|
+
this._error = e.email(this._email) ?? null, this._field?.setError(!!this._error, this._error ?? void 0), this.emit("blur", this._email);
|
|
871
|
+
}
|
|
872
|
+
}), this.shadowRoot.appendChild(this._field.getElement());
|
|
873
|
+
}
|
|
874
|
+
getCss() {
|
|
875
|
+
return super.getCss() + [
|
|
876
|
+
S,
|
|
877
|
+
C,
|
|
878
|
+
x
|
|
879
|
+
].join("\n") + "\n :host { display: block; }\n .form-input {\n color: var(--odus-color-text, #1a1a1a) !important;\n font-family: var(--odus-font-family, system-ui, sans-serif) !important;\n font-size: var(--odus-input-font-size, 16px) !important;\n background: var(--odus-color-background, #ffffff) !important;\n border-radius: var(--odus-border-radius, 6px) !important;\n box-shadow:\n 0 0 0 1px var(--odus-border-color, #e0e0e0),\n 0 2px 4px 0 rgba(0, 0, 0, 0.07),\n 0 1px 1.5px 0 rgba(0, 0, 0, 0.05) !important;\n }\n .form-input:focus {\n box-shadow: var(\n --odus-input-focus-shadow,\n 0 0 0 1px rgba(50, 151, 211, 0.7),\n 0 1px 1px 0 rgba(0, 0, 0, 0.07),\n 0 0 0 4px rgba(50, 151, 211, 0.3)\n ) !important;\n outline: none !important;\n }\n .form-input-error {\n color: var(--odus-color-error, #dc2727) !important;\n }\n .form-helper-text {\n color: var(--odus-color-error, #dc2727) !important;\n }\n ";
|
|
880
|
+
}
|
|
881
|
+
getValue() {
|
|
882
|
+
return this._email;
|
|
883
|
+
}
|
|
884
|
+
getIsValid() {
|
|
885
|
+
return !r().email(this._email);
|
|
886
|
+
}
|
|
887
|
+
getError() {
|
|
888
|
+
return this._error;
|
|
889
|
+
}
|
|
890
|
+
}, J = "@keyframes slideIn{0%{opacity:0;transform:translateY(-10px)}to{opacity:1;transform:translateY(0)}}.error-alert{background-color:#fef2f2;border:1px solid #fecaca;border-radius:8px;padding:16px;animation:.3s ease-out slideIn;box-shadow:0 1px 3px #0000001a,0 1px 2px #0000000f}.error-alert-content{align-items:flex-start;gap:12px;display:flex}.error-alert-icon-container{color:#dc2626;background-color:#fee2e2;border-radius:50%;flex-shrink:0;justify-content:center;align-items:center;width:32px;height:32px;display:flex}.error-alert-icon{color:#dc2626}.error-alert-text-container{flex:1;min-width:0}.error-alert-title{color:#991b1b;margin:0 0 4px;font-size:14px;font-weight:600;line-height:1.4}.error-alert-message{font-family:var(--odus-font-family,inherit);color:#7f1d1d;word-break:break-word;margin:0;font-size:14px;line-height:1.5}", Y = class extends T {
|
|
891
|
+
_alert = null;
|
|
892
|
+
_message = null;
|
|
893
|
+
render() {
|
|
894
|
+
this.shadowRoot && (this._alert?.getElement().remove(), this._alert = null, this._message && (this._alert = new _({ message: this._message }), this.shadowRoot.appendChild(this._alert.getElement())));
|
|
895
|
+
}
|
|
896
|
+
setError(e) {
|
|
897
|
+
if (this._message = e, !this.shadowRoot) {
|
|
898
|
+
this.emit("error", e);
|
|
899
|
+
return;
|
|
900
|
+
}
|
|
901
|
+
this._alert ? this._alert.setMessage(e) : (this._alert = new _({ message: e }), this.shadowRoot.appendChild(this._alert.getElement())), this.emit("error", e);
|
|
902
|
+
}
|
|
903
|
+
clearError() {
|
|
904
|
+
this._message = null, this._alert?.getElement().remove(), this._alert = null;
|
|
905
|
+
}
|
|
906
|
+
getCss() {
|
|
907
|
+
return super.getCss() + J + "\n :host { display: block; }\n .error-alert-icon,\n .error-alert-icon-container {\n color: var(--odus-color-error, #e53e3e) !important;\n }\n .error-alert-message {\n color: var(--odus-color-text, #1a1a1a) !important;\n }\n ";
|
|
908
|
+
}
|
|
909
|
+
getValue() {
|
|
910
|
+
return null;
|
|
911
|
+
}
|
|
912
|
+
getIsValid() {
|
|
913
|
+
return !0;
|
|
914
|
+
}
|
|
915
|
+
getError() {
|
|
916
|
+
return this._message;
|
|
917
|
+
}
|
|
918
|
+
}, X = ".paypal{color:#253b80;text-transform:none;cursor:pointer;background-color:#ffc439;border-radius:4px;padding:8px 16px;font-weight:700;box-shadow:0 2px 4px #0000001a}.paypal:hover{filter:brightness(.95);background-color:#ffc439}.paypal-icon-container{justify-content:center;align-items:center;display:flex}.paypal-icon-container img{width:69px;height:22px}", Z = {
|
|
919
|
+
name: "odus-elements",
|
|
920
|
+
styles: {
|
|
921
|
+
fontSize: 14,
|
|
922
|
+
textColor: "#000000",
|
|
923
|
+
buttonColor: "#0070f3",
|
|
924
|
+
borderRadius: 4,
|
|
925
|
+
fontFamily: "system-ui",
|
|
926
|
+
buttonTextColor: "#ffffff",
|
|
927
|
+
buttonFontSize: 16
|
|
928
|
+
},
|
|
929
|
+
layout: {
|
|
930
|
+
actionButton: { translationKey: null },
|
|
931
|
+
billingFields: {
|
|
932
|
+
street: { enabled: !1 },
|
|
933
|
+
city: { enabled: !1 },
|
|
934
|
+
state: { enabled: !1 },
|
|
935
|
+
zipCode: { enabled: !1 },
|
|
936
|
+
firstName: { enabled: !1 },
|
|
937
|
+
lastName: { enabled: !1 },
|
|
938
|
+
country: { enabled: !1 }
|
|
939
|
+
}
|
|
940
|
+
},
|
|
941
|
+
additionalPaymentMethods: {}
|
|
942
|
+
}, Q = class extends T {
|
|
943
|
+
_paymentContext = null;
|
|
944
|
+
_button = null;
|
|
945
|
+
setPaymentContext(e) {
|
|
946
|
+
this._paymentContext = e, this.isMounted && this.render();
|
|
947
|
+
}
|
|
948
|
+
render() {
|
|
949
|
+
if (!this.shadowRoot || (this._button?.getElement().remove(), this._button = null, !this._paymentContext)) return;
|
|
950
|
+
let { onAuthorize: e } = this._paymentContext;
|
|
951
|
+
this._button = new f({
|
|
952
|
+
checkoutProfile: Z,
|
|
953
|
+
onSubmit: async () => {
|
|
954
|
+
this._button?.setSubmitting(!0);
|
|
955
|
+
try {
|
|
956
|
+
await e();
|
|
957
|
+
} finally {
|
|
958
|
+
this._button?.setSubmitting(!1);
|
|
959
|
+
}
|
|
960
|
+
}
|
|
961
|
+
}), this.shadowRoot.appendChild(this._button.getElement());
|
|
962
|
+
}
|
|
963
|
+
getCss() {
|
|
964
|
+
return super.getCss() + X + "\n :host { display: block; }\n .paypal {\n width: 100%;\n box-sizing: border-box;\n border-radius: var(--odus-button-border-radius, 6px);\n display: flex;\n align-items: center;\n justify-content: center;\n }\n ";
|
|
965
|
+
}
|
|
966
|
+
getValue() {
|
|
967
|
+
return null;
|
|
968
|
+
}
|
|
969
|
+
getIsValid() {
|
|
970
|
+
return !0;
|
|
971
|
+
}
|
|
972
|
+
getError() {
|
|
973
|
+
return null;
|
|
974
|
+
}
|
|
975
|
+
}, te = ".country-dial-code-dropdown{display:inline-block;position:relative}.country-dial-code-trigger{padding:var(--odus-input-padding,8px 12px);cursor:pointer;letter-spacing:.02em;font-weight:400;line-height:var(--odus-input-line-height,1.5);white-space:nowrap;box-sizing:border-box;background:#fff;border:none;border-right:1px solid #e0e0e0;align-items:center;gap:6px;padding-right:8px;transition:all .1s ease-in;display:flex}.country-dial-code-trigger:hover{background:#f5f5f5}.country-dial-code-trigger:focus{outline:none}.country-dial-code-trigger .country-flag{font-size:14px;line-height:1}.country-dial-code-trigger .country-chevron{color:#717173;flex-shrink:0;transition:transform .15s}.country-dial-code-trigger[aria-expanded=true] .country-chevron{transform:rotate(180deg)}.country-dial-code-panel{z-index:10000;background:#fff;border-radius:8px;flex-direction:column;width:280px;max-height:360px;display:flex;position:fixed;top:0;left:0;overflow:hidden;box-shadow:0 0 0 1px #0000000d,0 4px 6px -1px #0000001a,0 2px 4px -1px #0000000f}.country-dial-code-panel.hidden{display:none}.country-search-wrapper{border-bottom:1px solid #e0e0e0;flex-shrink:0;padding:12px}.country-search{width:100%;font-size:inherit;box-sizing:border-box;border:1px solid #e0e0e0;border-radius:6px;outline:none;padding:6px 12px;font-family:inherit;transition:all .1s ease-in}.country-search:focus{border-color:#3297d3b3;box-shadow:0 0 0 3px #3297d31a}.country-search::placeholder{color:#717173;opacity:.6}.countries-list{flex:1;min-height:0;overflow-y:auto}.countries-list::-webkit-scrollbar{width:8px}.countries-list::-webkit-scrollbar-track{background:#f5f5f5}.countries-list::-webkit-scrollbar-thumb{background:#d0d0d0;border-radius:4px}.countries-list::-webkit-scrollbar-thumb:hover{background:#b0b0b0}.country-group-header{color:#717173;text-transform:uppercase;letter-spacing:.05em;z-index:1;background:#fafafa;padding:8px 16px 4px;font-size:12px;font-weight:600;position:sticky;top:0}.country-item{cursor:pointer;text-align:left;width:100%;color:inherit;background:#fff;border:none;align-items:center;gap:12px;padding:10px 16px;font-family:inherit;font-size:14px;transition:background .1s;display:flex}.country-item:hover{background:#f5f5f5}.country-item.selected{color:#3297d3;background:#3297d314}.country-item:focus{background:#f0f0f0;outline:none}.country-item .country-flag{flex-shrink:0;font-size:20px;line-height:1}.country-item .country-name{text-overflow:ellipsis;white-space:nowrap;flex:1;overflow:hidden}.country-item .country-dial-code{color:#717173;flex-shrink:0;font-size:.95em}.country-item.selected .country-dial-code{color:#3297d3cc}.no-results{text-align:center;color:#717173;padding:24px 16px;font-size:14px}.phone-number-field-wrapper{width:100%;display:flex}.phone-number-field-container{border-radius:inherit;background:#fff;align-items:center;width:100%;transition:box-shadow .1s ease-in,border-radius .2s ease-in;display:flex;position:relative;box-shadow:0 0 0 1px #e0e0e0,0 2px 4px #00000012,0 1px 1.5px #0000000d}.phone-number-field-container.focused{z-index:2;box-shadow:0 0 0 1px #3297d3b3,0 1px 1px #00000012,0 0 0 4px #3297d34d}.phone-number-field-container.error{box-shadow:0 0 0 1px #dc2727,0 2px 4px #dc27271a}.phone-number-field-container.error.focused{box-shadow:0 0 0 1px #dc2727,0 1px 1px #00000012,0 0 0 4px #dc272733}.phone-number-field-container .country-select-wrapper{padding:var(--odus-input-padding,8px 12px);border-top-left-radius:var(--phone-border-radius,0px);border-bottom-left-radius:var(--phone-border-radius,0px);white-space:nowrap;background:0 0;flex-shrink:0;align-items:center;gap:4px;padding-right:6px;display:flex;position:relative}.phone-number-field-container .country-select-wrapper .country-flag{pointer-events:none;font-size:14px;line-height:1}.phone-number-field-container .country-select-wrapper .country-chevron{color:#717173;pointer-events:none;flex-shrink:0;align-items:center;display:flex}.phone-number-field-container .country-select-wrapper .country-select{cursor:pointer;opacity:0;background:0 0;border:none;outline:none;width:100%;height:100%;position:absolute;inset:0}.phone-number-field-container .phone-input-wrapper{flex:1;min-width:0}.phone-number-field-container .phone-input-wrapper .form-input{box-shadow:none;border-radius:0;border-top-right-radius:var(--phone-border-radius,0px);border-bottom-right-radius:var(--phone-border-radius,0px);padding:var(--odus-input-padding,8px 2px);border:none}.phone-number-field-container .phone-input-wrapper .form-input:focus{box-shadow:none;z-index:auto}", ne = {
|
|
976
|
+
name: "odus-elements",
|
|
977
|
+
styles: {
|
|
978
|
+
fontSize: 14,
|
|
979
|
+
textColor: "#000000",
|
|
980
|
+
buttonColor: "#0070f3",
|
|
981
|
+
borderRadius: 4,
|
|
982
|
+
fontFamily: "system-ui",
|
|
983
|
+
buttonTextColor: "#ffffff",
|
|
984
|
+
buttonFontSize: 16
|
|
985
|
+
},
|
|
986
|
+
layout: {
|
|
987
|
+
actionButton: { translationKey: null },
|
|
988
|
+
billingFields: {
|
|
989
|
+
street: { enabled: !1 },
|
|
990
|
+
city: { enabled: !1 },
|
|
991
|
+
state: { enabled: !1 },
|
|
992
|
+
zipCode: { enabled: !1 },
|
|
993
|
+
firstName: { enabled: !1 },
|
|
994
|
+
lastName: { enabled: !1 },
|
|
995
|
+
country: { enabled: !1 }
|
|
996
|
+
}
|
|
997
|
+
},
|
|
998
|
+
additionalPaymentMethods: {}
|
|
999
|
+
}, $ = class extends T {
|
|
1000
|
+
_phone = "";
|
|
1001
|
+
_error = null;
|
|
1002
|
+
_field = null;
|
|
1003
|
+
_renderGeneration = 0;
|
|
1004
|
+
render() {
|
|
1005
|
+
if (!this.shadowRoot) return;
|
|
1006
|
+
this._field?.destroy(), this._field?.getElement().remove(), this._field = null, this.options.initialValue && !this._phone && (this._phone = String(this.options.initialValue));
|
|
1007
|
+
let e = ++this._renderGeneration;
|
|
1008
|
+
a().then(({ PhoneNumberField: t }) => {
|
|
1009
|
+
if (!this.shadowRoot || this._renderGeneration !== e) return;
|
|
1010
|
+
let { t: n, locale: i } = o();
|
|
1011
|
+
this._field = new t({
|
|
1012
|
+
value: this._phone,
|
|
1013
|
+
error: !1,
|
|
1014
|
+
checkoutProfile: ne,
|
|
1015
|
+
translationFunc: n,
|
|
1016
|
+
locale: i,
|
|
1017
|
+
onChange: () => {
|
|
1018
|
+
this._phone = this._field?.getValue() ?? "", this._error = null, this.emit("change", this._phone);
|
|
1019
|
+
},
|
|
1020
|
+
onBlur: () => {
|
|
1021
|
+
this._phone = this._field?.getValue() ?? "";
|
|
1022
|
+
let e = r(), t = this._field?.getCountry();
|
|
1023
|
+
this._error = e.phoneNumber(this._phone, t) ?? null, this._field?.setError(!!this._error, this._error ?? void 0), this.emit("blur", this._phone);
|
|
1024
|
+
}
|
|
1025
|
+
}), this.shadowRoot.appendChild(this._field.getElement());
|
|
1026
|
+
});
|
|
1027
|
+
}
|
|
1028
|
+
getCss() {
|
|
1029
|
+
return super.getCss() + [
|
|
1030
|
+
S,
|
|
1031
|
+
C,
|
|
1032
|
+
x,
|
|
1033
|
+
te
|
|
1034
|
+
].join("\n") + "\n :host { display: block; }\n .form-input,\n .country-select-wrapper {\n color: var(--odus-color-text, #1a1a1a) !important;\n font-family: var(--odus-font-family, system-ui, sans-serif) !important;\n font-size: var(--odus-input-font-size, 16px) !important;\n background: var(--odus-color-background, #ffffff) !important;\n border-radius: 0 !important;\n box-shadow: none !important;\n }\n .phone-number-field-container {\n min-height: calc(var(--odus-input-font-size, 16px) * 1.5 + 16px);\n box-shadow:\n 0 0 0 1px var(--odus-border-color, #e0e0e0),\n 0 2px 4px 0 rgba(0, 0, 0, 0.07),\n 0 1px 1.5px 0 rgba(0, 0, 0, 0.05) !important;\n border-radius: var(--odus-border-radius, 6px) !important;\n overflow: hidden;\n }\n .phone-number-field-container:focus-within {\n box-shadow: var(\n --odus-input-focus-shadow,\n 0 0 0 1px rgba(50, 151, 211, 0.7),\n 0 1px 1px 0 rgba(0, 0, 0, 0.07),\n 0 0 0 4px rgba(50, 151, 211, 0.3)\n ) !important;\n }\n .phone-number-field-container.error {\n box-shadow: 0 0 0 1px var(--odus-color-error, #dc2727) !important;\n }\n .form-input:focus {\n box-shadow: none !important;\n outline: none !important;\n }\n .form-input-error {\n color: var(--odus-color-error, #dc2727) !important;\n }\n .form-helper-text {\n color: var(--odus-color-error, #dc2727) !important;\n }\n ";
|
|
1035
|
+
}
|
|
1036
|
+
getValue() {
|
|
1037
|
+
return this._phone;
|
|
1038
|
+
}
|
|
1039
|
+
getIsValid() {
|
|
1040
|
+
let e = r(), t = this._field?.getCountry();
|
|
1041
|
+
return !e.phoneNumber(this._phone, t);
|
|
1042
|
+
}
|
|
1043
|
+
getError() {
|
|
1044
|
+
return this._error;
|
|
1045
|
+
}
|
|
1046
|
+
}, re = class {
|
|
1047
|
+
_config;
|
|
1048
|
+
_apiService;
|
|
1049
|
+
_changeListeners = [];
|
|
1050
|
+
_callbacks;
|
|
1051
|
+
_paymentState = {};
|
|
1052
|
+
_fontCleanup;
|
|
1053
|
+
_card;
|
|
1054
|
+
_email;
|
|
1055
|
+
_phone;
|
|
1056
|
+
_addressStreet;
|
|
1057
|
+
_addressFirstName;
|
|
1058
|
+
_addressLastName;
|
|
1059
|
+
_cardholderName;
|
|
1060
|
+
_addressCity;
|
|
1061
|
+
_addressState;
|
|
1062
|
+
_addressZipCode;
|
|
1063
|
+
_addressCountry;
|
|
1064
|
+
_applePay;
|
|
1065
|
+
_paypal;
|
|
1066
|
+
_error;
|
|
1067
|
+
elements;
|
|
1068
|
+
constructor(t) {
|
|
1069
|
+
this._config = t, this._callbacks = { ...t.callbacks }, t.locale && e.setLocale(t.locale), this._apiService = new n(t.apiKey, t.environment);
|
|
1070
|
+
let r = {};
|
|
1071
|
+
Object.defineProperty(r, "email", {
|
|
1072
|
+
get: () => (this._email || (this._email = new q(), this._trackElement(this._email)), this._email),
|
|
1073
|
+
enumerable: !0
|
|
1074
|
+
}), Object.defineProperty(r, "phone", {
|
|
1075
|
+
get: () => (this._phone || (this._phone = new $(), this._trackElement(this._phone)), this._phone),
|
|
1076
|
+
enumerable: !0
|
|
1077
|
+
});
|
|
1078
|
+
let i = {};
|
|
1079
|
+
Object.defineProperty(i, "applePay", {
|
|
1080
|
+
get: () => (this._applePay || (this._applePay = new L(), this._trackElement(this._applePay), this._paymentState.paymentId && this._paymentState.checkoutKey && this._applePay.setPaymentContext({
|
|
1081
|
+
paymentId: this._paymentState.paymentId,
|
|
1082
|
+
checkoutKey: this._paymentState.checkoutKey,
|
|
1083
|
+
environment: this._config.environment,
|
|
1084
|
+
checkoutDetails: this._paymentState.checkoutDetails,
|
|
1085
|
+
...this._config.additionalPaymentMethods?.applePay,
|
|
1086
|
+
onAuthorize: (e) => this._executeAuthorization({
|
|
1087
|
+
formData: null,
|
|
1088
|
+
applePayData: e
|
|
1089
|
+
})
|
|
1090
|
+
})), this._applePay),
|
|
1091
|
+
enumerable: !0
|
|
1092
|
+
}), Object.defineProperty(i, "payPal", {
|
|
1093
|
+
get: () => (this._paypal || (this._paypal = new Q(), this._trackElement(this._paypal), this._paymentState.paymentId && this._paymentState.checkoutKey && this._paypal.setPaymentContext({
|
|
1094
|
+
paymentId: this._paymentState.paymentId,
|
|
1095
|
+
checkoutKey: this._paymentState.checkoutKey,
|
|
1096
|
+
onAuthorize: () => this._executeAuthorization({ formData: null })
|
|
1097
|
+
})), this._paypal),
|
|
1098
|
+
enumerable: !0
|
|
1099
|
+
});
|
|
1100
|
+
let a = {};
|
|
1101
|
+
Object.defineProperty(a, "street", {
|
|
1102
|
+
get: () => (this._addressStreet || (this._addressStreet = new N(), this._trackElement(this._addressStreet)), this._addressStreet),
|
|
1103
|
+
enumerable: !0
|
|
1104
|
+
}), Object.defineProperty(a, "firstName", {
|
|
1105
|
+
get: () => (this._addressFirstName || (this._addressFirstName = new k(), this._trackElement(this._addressFirstName)), this._addressFirstName),
|
|
1106
|
+
enumerable: !0
|
|
1107
|
+
}), Object.defineProperty(a, "lastName", {
|
|
1108
|
+
get: () => (this._addressLastName || (this._addressLastName = new A(), this._trackElement(this._addressLastName)), this._addressLastName),
|
|
1109
|
+
enumerable: !0
|
|
1110
|
+
}), Object.defineProperty(a, "city", {
|
|
1111
|
+
get: () => (this._addressCity || (this._addressCity = new E(), this._trackElement(this._addressCity)), this._addressCity),
|
|
1112
|
+
enumerable: !0
|
|
1113
|
+
}), Object.defineProperty(a, "state", {
|
|
1114
|
+
get: () => (this._addressState || (this._addressState = new M(), this._trackElement(this._addressState)), this._addressState),
|
|
1115
|
+
enumerable: !0
|
|
1116
|
+
}), Object.defineProperty(a, "zipCode", {
|
|
1117
|
+
get: () => (this._addressZipCode || (this._addressZipCode = new P(), this._trackElement(this._addressZipCode)), this._addressZipCode),
|
|
1118
|
+
enumerable: !0
|
|
1119
|
+
}), Object.defineProperty(a, "country", {
|
|
1120
|
+
get: () => (this._addressCountry || (this._addressCountry = new O(), this._trackElement(this._addressCountry), this._addressCountry.on("change", (e) => {
|
|
1121
|
+
this._addressState?.setCountry(e);
|
|
1122
|
+
})), this._addressCountry),
|
|
1123
|
+
enumerable: !0
|
|
1124
|
+
});
|
|
1125
|
+
let o = {
|
|
1126
|
+
contact: r,
|
|
1127
|
+
express: i
|
|
1128
|
+
};
|
|
1129
|
+
Object.defineProperty(o, "card", {
|
|
1130
|
+
get: () => (this._card || (this._card = new W(), this._card.setEnvironment(this._config.environment), this._trackElement(this._card), this._paymentState.vgsJwt && this._card.setVgsJwt(this._paymentState.vgsJwt)), this._card),
|
|
1131
|
+
enumerable: !0
|
|
1132
|
+
}), Object.defineProperty(o, "cardholderName", {
|
|
1133
|
+
get: () => (this._cardholderName || (this._cardholderName = new G(), this._trackElement(this._cardholderName)), this._cardholderName),
|
|
1134
|
+
enumerable: !0
|
|
1135
|
+
}), Object.defineProperty(o, "address", {
|
|
1136
|
+
get: () => a,
|
|
1137
|
+
enumerable: !0
|
|
1138
|
+
}), Object.defineProperty(o, "error", {
|
|
1139
|
+
get: () => (this._error || (this._error = new Y(), this._trackElement(this._error)), this._error),
|
|
1140
|
+
enumerable: !0
|
|
1141
|
+
}), this.elements = o;
|
|
1142
|
+
}
|
|
1143
|
+
async associatePayment(e, t) {
|
|
1144
|
+
if (!e || !t) throw Error("paymentId and checkoutKey are required");
|
|
1145
|
+
this._paymentState.paymentId = e, this._paymentState.checkoutKey = t;
|
|
1146
|
+
let n = await m({
|
|
1147
|
+
id: e,
|
|
1148
|
+
checkoutKey: t,
|
|
1149
|
+
environment: this._config.environment
|
|
1150
|
+
});
|
|
1151
|
+
this._paymentState.checkoutDetails = {
|
|
1152
|
+
amount: n.amount,
|
|
1153
|
+
currency: n.currency,
|
|
1154
|
+
countryCode: n.countryCode
|
|
1155
|
+
}, n.vgsJwt && (this._paymentState.vgsJwt = n.vgsJwt, this._card?.setVgsJwt(n.vgsJwt)), this._card?.setEnvironment(this._config.environment), this._applePay?.setPaymentContext({
|
|
1156
|
+
paymentId: e,
|
|
1157
|
+
checkoutKey: t,
|
|
1158
|
+
environment: this._config.environment,
|
|
1159
|
+
checkoutDetails: this._paymentState.checkoutDetails,
|
|
1160
|
+
...this._config.additionalPaymentMethods?.applePay,
|
|
1161
|
+
onAuthorize: (e) => this._executeAuthorization({
|
|
1162
|
+
formData: null,
|
|
1163
|
+
applePayData: e
|
|
1164
|
+
})
|
|
1165
|
+
}), this._paypal?.setPaymentContext({
|
|
1166
|
+
paymentId: e,
|
|
1167
|
+
checkoutKey: t,
|
|
1168
|
+
onAuthorize: () => this._executeAuthorization({ formData: null })
|
|
1169
|
+
});
|
|
1170
|
+
}
|
|
1171
|
+
validate() {
|
|
1172
|
+
let e = {}, { t } = o();
|
|
1173
|
+
return this._card?.isMounted && !this._card.isValid && (e.card = this._card.error ?? t("validation.cardNumberInvalid")), this._email?.isMounted && !this._email.isValid && (e.email = this._email.error ?? t("validation.emailInvalid")), this._phone?.isMounted && !this._phone.isValid && (e.phone = this._phone.error ?? t("validation.phoneNumberInvalid")), this._addressStreet?.isMounted && !this._addressStreet.isValid && (e["address.street"] = this._addressStreet.error ?? t("validation.addressLine1Required")), this._addressCity?.isMounted && !this._addressCity.isValid && (e["address.city"] = this._addressCity.error ?? t("validation.townCityRequired")), this._addressCountry?.isMounted && !this._addressCountry.isValid && (e["address.country"] = this._addressCountry.error ?? t("validation.countryRequired")), this._addressFirstName?.isMounted && !this._addressFirstName.isValid && (e["address.firstName"] = this._addressFirstName.error ?? t("validation.firstNameRequired")), this._addressLastName?.isMounted && !this._addressLastName.isValid && (e["address.lastName"] = this._addressLastName.error ?? t("validation.lastNameRequired")), this._cardholderName?.isMounted && !this._cardholderName.isValid && (e.cardholderName = this._cardholderName.error ?? t("validation.nameRequired")), this._addressState?.isMounted && !this._addressState.isValid && (e["address.state"] = this._addressState.error ?? t("validation.stateRequired")), this._addressZipCode?.isMounted && !this._addressZipCode.isValid && (e["address.zipCode"] = this._addressZipCode.error ?? t("validation.postalCodeRequired")), this._applePay?.isMounted && !this._applePay.isValid && (e.applePay = "Apple Pay authorization required"), this._paypal?.isMounted && !this._paypal.isValid && (e.paypal = "PayPal authorization required"), {
|
|
1174
|
+
valid: Object.keys(e).length === 0,
|
|
1175
|
+
errors: e
|
|
1176
|
+
};
|
|
1177
|
+
}
|
|
1178
|
+
async _getPayload() {
|
|
1179
|
+
if (this._applePay?.isMounted && this._applePay.isValid || this._paypal?.isMounted) return null;
|
|
1180
|
+
let e = this._email?.isMounted ? this._email.value : "", t = this._phone?.isMounted ? this._phone.value : void 0, n = this._addressStreet?.isMounted || this._addressCity?.isMounted || this._addressCountry?.isMounted || this._addressFirstName?.isMounted || this._addressLastName?.isMounted || this._cardholderName?.isMounted || this._addressState?.isMounted || this._addressZipCode?.isMounted ? {
|
|
1181
|
+
street: this._addressStreet?.isMounted ? this._addressStreet.value : "",
|
|
1182
|
+
city: this._addressCity?.isMounted ? this._addressCity.value : "",
|
|
1183
|
+
country: this._addressCountry?.isMounted ? this._addressCountry.value : "",
|
|
1184
|
+
firstName: this._addressFirstName?.isMounted ? this._addressFirstName.value : "",
|
|
1185
|
+
lastName: this._addressLastName?.isMounted ? this._addressLastName.value : "",
|
|
1186
|
+
state: this._addressState?.isMounted ? this._addressState.value : "",
|
|
1187
|
+
zipCode: this._addressZipCode?.isMounted ? this._addressZipCode.value : ""
|
|
1188
|
+
} : void 0, r = this._cardholderName?.isMounted ? this._cardholderName.value : "", i = [n?.firstName ?? "", n?.lastName ?? ""].filter(Boolean), a = r || i.join(" ");
|
|
1189
|
+
if (this._card?.isMounted && this._card.isVgsMode) try {
|
|
1190
|
+
let r = await this._card.getPayload();
|
|
1191
|
+
return {
|
|
1192
|
+
name: a,
|
|
1193
|
+
email: e,
|
|
1194
|
+
phoneNumber: t || void 0,
|
|
1195
|
+
cardNumber: "",
|
|
1196
|
+
cardExpiry: "",
|
|
1197
|
+
cardCvv: "",
|
|
1198
|
+
billingAddress: n,
|
|
1199
|
+
vgsCardData: r
|
|
1200
|
+
};
|
|
1201
|
+
} catch {
|
|
1202
|
+
return this._handleAuthorizationError({
|
|
1203
|
+
message: "We couldn't securely process your card details. Please check your card information and try again.",
|
|
1204
|
+
status: 0,
|
|
1205
|
+
statusText: "Card Tokenization Failed"
|
|
1206
|
+
}), null;
|
|
1207
|
+
}
|
|
1208
|
+
let o = this._card?.isMounted ? this._card.value : null;
|
|
1209
|
+
return o ? {
|
|
1210
|
+
name: a,
|
|
1211
|
+
email: e,
|
|
1212
|
+
phoneNumber: t || void 0,
|
|
1213
|
+
cardNumber: o.number,
|
|
1214
|
+
cardExpiry: o.expiry,
|
|
1215
|
+
cardCvv: o.cvv,
|
|
1216
|
+
billingAddress: n
|
|
1217
|
+
} : null;
|
|
1218
|
+
}
|
|
1219
|
+
async authorize(e) {
|
|
1220
|
+
if (!this._paymentState.paymentId || !this._paymentState.checkoutKey) throw Error("Call associatePayment() before authorize()");
|
|
1221
|
+
if (this._applePay?.isMounted && this._applePay.isValid) {
|
|
1222
|
+
await this._executeAuthorization({
|
|
1223
|
+
formData: null,
|
|
1224
|
+
applePayData: this._applePay.value
|
|
1225
|
+
});
|
|
1226
|
+
return;
|
|
1227
|
+
}
|
|
1228
|
+
if (this._paypal?.isMounted) {
|
|
1229
|
+
await this._executeAuthorization({ formData: null });
|
|
1230
|
+
return;
|
|
1231
|
+
}
|
|
1232
|
+
let t = await this._getPayload();
|
|
1233
|
+
await this._executeAuthorization({
|
|
1234
|
+
formData: t,
|
|
1235
|
+
applePayData: void 0,
|
|
1236
|
+
customCustomerData: e?.customerData
|
|
1237
|
+
});
|
|
1238
|
+
}
|
|
1239
|
+
applyTheme(e) {
|
|
1240
|
+
let t = e["--odus-font-family"];
|
|
1241
|
+
if (t) {
|
|
1242
|
+
this._fontCleanup?.();
|
|
1243
|
+
let { cleanup: e } = ee({ fontFamily: t });
|
|
1244
|
+
this._fontCleanup = e;
|
|
1245
|
+
}
|
|
1246
|
+
for (let t of this._allElements()) t.setTheme(e);
|
|
1247
|
+
}
|
|
1248
|
+
resetTheme(e) {
|
|
1249
|
+
"--odus-font-family" in e && (this._fontCleanup?.(), this._fontCleanup = void 0);
|
|
1250
|
+
for (let t of this._allElements()) t.resetTheme(e);
|
|
1251
|
+
}
|
|
1252
|
+
get isValid() {
|
|
1253
|
+
return this.validate().valid;
|
|
1254
|
+
}
|
|
1255
|
+
onChange(e) {
|
|
1256
|
+
this._changeListeners.push(e);
|
|
1257
|
+
}
|
|
1258
|
+
destroy() {
|
|
1259
|
+
this._fontCleanup?.(), this._card?.destroy(), this._email?.destroy(), this._phone?.destroy(), this._addressStreet?.destroy(), this._addressFirstName?.destroy(), this._addressLastName?.destroy(), this._cardholderName?.destroy(), this._addressCity?.destroy(), this._addressState?.destroy(), this._addressZipCode?.destroy(), this._addressCountry?.destroy(), this._applePay?.destroy(), this._paypal?.destroy(), this._error?.destroy(), this._changeListeners.length = 0;
|
|
1260
|
+
}
|
|
1261
|
+
setCallbacks(e) {
|
|
1262
|
+
Object.assign(this._callbacks, e);
|
|
1263
|
+
}
|
|
1264
|
+
_trackElement(e) {
|
|
1265
|
+
e.on("change", () => {
|
|
1266
|
+
for (let e of this._changeListeners) e();
|
|
1267
|
+
});
|
|
1268
|
+
}
|
|
1269
|
+
_allElements() {
|
|
1270
|
+
return [
|
|
1271
|
+
this._card,
|
|
1272
|
+
this._email,
|
|
1273
|
+
this._phone,
|
|
1274
|
+
this._addressStreet,
|
|
1275
|
+
this._addressFirstName,
|
|
1276
|
+
this._addressLastName,
|
|
1277
|
+
this._cardholderName,
|
|
1278
|
+
this._addressCity,
|
|
1279
|
+
this._addressState,
|
|
1280
|
+
this._addressZipCode,
|
|
1281
|
+
this._addressCountry,
|
|
1282
|
+
this._applePay,
|
|
1283
|
+
this._paypal,
|
|
1284
|
+
this._error
|
|
1285
|
+
].filter((e) => e !== void 0);
|
|
1286
|
+
}
|
|
1287
|
+
async _executeAuthorization({ formData: e, applePayData: t, customCustomerData: n }) {
|
|
1288
|
+
try {
|
|
1289
|
+
let r = await this._apiService.authorizePayment({
|
|
1290
|
+
paymentId: this._paymentState.paymentId,
|
|
1291
|
+
checkoutKey: this._paymentState.checkoutKey,
|
|
1292
|
+
formData: e,
|
|
1293
|
+
returnUrl: this._config.returnUrl,
|
|
1294
|
+
applePayData: t,
|
|
1295
|
+
customCustomerData: n
|
|
1296
|
+
});
|
|
1297
|
+
this._handlePaymentResponse(r);
|
|
1298
|
+
} catch (e) {
|
|
1299
|
+
this._handleAuthorizationError(e);
|
|
1300
|
+
}
|
|
1301
|
+
}
|
|
1302
|
+
_handlePaymentResponse(e) {
|
|
1303
|
+
if (e.latestTransaction.status === "authorized") {
|
|
1304
|
+
this._callbacks.onPaymentSucceeded?.(e.latestTransaction.status);
|
|
1305
|
+
return;
|
|
1306
|
+
}
|
|
1307
|
+
if (e.latestTransaction.status === "failed") {
|
|
1308
|
+
this._callbacks.onPaymentFailed?.(e.latestTransaction.status);
|
|
1309
|
+
return;
|
|
1310
|
+
}
|
|
1311
|
+
e.status === "requires_action" && this._callbacks.onActionRequired?.(e.action.redirectUrl);
|
|
1312
|
+
}
|
|
1313
|
+
_handleAuthorizationError(e) {
|
|
1314
|
+
let t = e.details?.message ?? "Payment failed";
|
|
1315
|
+
this._callbacks.onPaymentFailed?.(t), this._error?.isMounted && this._error.setError(t);
|
|
1316
|
+
}
|
|
1751
1317
|
};
|
|
1318
|
+
//#endregion
|
|
1319
|
+
export { E as AddressCityElement, O as AddressCountryElement, k as AddressFirstNameElement, A as AddressLastNameElement, M as AddressStateElement, N as AddressStreetElement, P as AddressZipCodeElement, L as ApplePayElement, T as BaseElement, W as CardElement, G as CardholderElement, q as EmailElement, Y as ErrorElement, re as OdusElements, Q as PayPalElement, $ as PhoneElement };
|