astrogators-shared-ui 0.5.0 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +137 -203
- package/dist/index.css +2 -0
- package/dist/index.js +744 -805
- package/dist/{components → src/components}/display/Badge.d.ts +0 -1
- package/dist/{components → src/components}/display/Card.d.ts +0 -1
- package/dist/{components → src/components}/display/Modal.d.ts +0 -1
- package/dist/{components → src/components}/feedback/Loader.d.ts +0 -1
- package/dist/{components → src/components}/forms/AllyCodeDropdown.d.ts +0 -1
- package/dist/{components → src/components}/forms/Button.d.ts +0 -1
- package/dist/{components → src/components}/forms/Input.d.ts +0 -1
- package/dist/{components → src/components}/forms/Select.d.ts +0 -1
- package/dist/{components → src/components}/layout/Container.d.ts +0 -1
- package/dist/{components → src/components}/layout/Footer.d.ts +0 -1
- package/dist/{components → src/components}/layout/TopBar.d.ts +0 -1
- package/dist/{contexts → src/contexts}/AuthContext.d.ts +0 -1
- package/dist/{index.d.ts → src/index.d.ts} +0 -1
- package/package.json +18 -13
- package/dist/style.css +0 -1
- /package/dist/{components → src/components}/display/index.d.ts +0 -0
- /package/dist/{components → src/components}/feedback/index.d.ts +0 -0
- /package/dist/{components → src/components}/forms/index.d.ts +0 -0
- /package/dist/{components → src/components}/layout/index.d.ts +0 -0
- /package/dist/{services → src/services}/allyCodeStorage.d.ts +0 -0
- /package/dist/{services → src/services}/api.d.ts +0 -0
- /package/dist/{services → src/services}/auth.d.ts +0 -0
- /package/dist/{types → src/types}/api.d.ts +0 -0
- /package/dist/{types → src/types}/index.d.ts +0 -0
- /package/dist/{types → src/types}/mod.d.ts +0 -0
- /package/dist/{types → src/types}/user.d.ts +0 -0
- /package/dist/{utils → src/utils}/formatAllyCode.d.ts +0 -0
package/dist/index.js
CHANGED
|
@@ -1,805 +1,744 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
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
|
-
|
|
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
|
-
s && /* @__PURE__ */ m("div", { className: E.header, children: [
|
|
746
|
-
/* @__PURE__ */ a("h2", { className: E.title, children: s }),
|
|
747
|
-
/* @__PURE__ */ a("button", { className: E.closeButton, onClick: t, "aria-label": "Close modal", children: "✕" })
|
|
748
|
-
] }),
|
|
749
|
-
/* @__PURE__ */ a("div", { className: E.content, children: o })
|
|
750
|
-
] }) });
|
|
751
|
-
}, _s = "_spinner_1uhnh_2", ms = "_spin_1uhnh_2", us = "_sm_1uhnh_9", hs = "_md_1uhnh_15", gs = "_lg_1uhnh_21", fs = "_dots_1uhnh_34", ys = "_dot_1uhnh_34", ps = "_bounce_1uhnh_1", vs = "_visuallyHidden_1uhnh_91", C = {
|
|
752
|
-
spinner: _s,
|
|
753
|
-
spin: ms,
|
|
754
|
-
sm: us,
|
|
755
|
-
md: hs,
|
|
756
|
-
lg: gs,
|
|
757
|
-
dots: fs,
|
|
758
|
-
dot: ys,
|
|
759
|
-
bounce: ps,
|
|
760
|
-
visuallyHidden: vs
|
|
761
|
-
}, Ws = ({
|
|
762
|
-
size: e = "md",
|
|
763
|
-
variant: t = "spinner",
|
|
764
|
-
className: s = ""
|
|
765
|
-
}) => t === "dots" ? /* @__PURE__ */ m("div", { className: `${C.dots} ${C[e]} ${s}`, children: [
|
|
766
|
-
/* @__PURE__ */ a("span", { className: C.dot }),
|
|
767
|
-
/* @__PURE__ */ a("span", { className: C.dot }),
|
|
768
|
-
/* @__PURE__ */ a("span", { className: C.dot })
|
|
769
|
-
] }) : /* @__PURE__ */ a("div", { className: `${C.spinner} ${C[e]} ${s}`, role: "status", children: /* @__PURE__ */ a("span", { className: C.visuallyHidden, children: "Loading..." }) });
|
|
770
|
-
export {
|
|
771
|
-
Cs as AllyCodeDropdown,
|
|
772
|
-
vt as ApiClient,
|
|
773
|
-
xs as AuthProvider,
|
|
774
|
-
Es as Badge,
|
|
775
|
-
H as Button,
|
|
776
|
-
ks as Card,
|
|
777
|
-
Ns as Container,
|
|
778
|
-
Ss as Footer,
|
|
779
|
-
ce as Input,
|
|
780
|
-
Ws as Loader,
|
|
781
|
-
Ls as Modal,
|
|
782
|
-
ie as Select,
|
|
783
|
-
As as TopBar,
|
|
784
|
-
v as apiClient,
|
|
785
|
-
St as clearAllyCodes,
|
|
786
|
-
se as clearTokens,
|
|
787
|
-
Y as formatAllyCode,
|
|
788
|
-
de as getAccessToken,
|
|
789
|
-
A as getAllyCodesFromStorage,
|
|
790
|
-
gt as getRefreshToken,
|
|
791
|
-
Nt as getSelectedAllyCode,
|
|
792
|
-
bt as initializeApiClient,
|
|
793
|
-
pt as isAuthenticated,
|
|
794
|
-
ht as removeAccessToken,
|
|
795
|
-
wt as removeAllyCodeFromStorage,
|
|
796
|
-
yt as removeRefreshToken,
|
|
797
|
-
$t as saveAllyCodeToStorage,
|
|
798
|
-
ut as setAccessToken,
|
|
799
|
-
ft as setRefreshToken,
|
|
800
|
-
At as setSelectedAllyCode,
|
|
801
|
-
_e as setTokens,
|
|
802
|
-
Ts as unformatAllyCode,
|
|
803
|
-
ne as updateAllyCodeLastUsed,
|
|
804
|
-
xt as useAuth
|
|
805
|
-
};
|
|
1
|
+
import e, { createContext as t, useCallback as n, useContext as r, useEffect as i, useState as a } from "react";
|
|
2
|
+
import { Fragment as o, jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
3
|
+
var l = {
|
|
4
|
+
container: "_container_u3o0e_1",
|
|
5
|
+
padding: "_padding_u3o0e_7",
|
|
6
|
+
"maxWidth-sm": "_maxWidth-sm_u3o0e_12",
|
|
7
|
+
"maxWidth-md": "_maxWidth-md_u3o0e_16",
|
|
8
|
+
"maxWidth-lg": "_maxWidth-lg_u3o0e_20",
|
|
9
|
+
"maxWidth-xl": "_maxWidth-xl_u3o0e_24",
|
|
10
|
+
"maxWidth-full": "_maxWidth-full_u3o0e_28"
|
|
11
|
+
}, u = ({ children: e, maxWidth: t = "xl", padding: n = !0, className: r = "", style: i }) => /* @__PURE__ */ s("div", {
|
|
12
|
+
className: `${l.container} ${l[`maxWidth-${t}`]} ${n ? l.padding : ""} ${r}`,
|
|
13
|
+
style: i,
|
|
14
|
+
children: e
|
|
15
|
+
}), d = {
|
|
16
|
+
topBar: "_topBar_10g3c_1",
|
|
17
|
+
content: "_content_10g3c_13",
|
|
18
|
+
left: "_left_10g3c_23",
|
|
19
|
+
right: "_right_10g3c_30",
|
|
20
|
+
logo: "_logo_10g3c_36"
|
|
21
|
+
}, f = ({ logo: e, leftContent: t, rightContent: n, className: r = "" }) => /* @__PURE__ */ s("header", {
|
|
22
|
+
className: `${d.topBar} ${r}`,
|
|
23
|
+
children: /* @__PURE__ */ c("div", {
|
|
24
|
+
className: d.content,
|
|
25
|
+
children: [/* @__PURE__ */ c("div", {
|
|
26
|
+
className: d.left,
|
|
27
|
+
children: [e && /* @__PURE__ */ s("div", {
|
|
28
|
+
className: d.logo,
|
|
29
|
+
children: e
|
|
30
|
+
}), t]
|
|
31
|
+
}), /* @__PURE__ */ s("div", {
|
|
32
|
+
className: d.right,
|
|
33
|
+
children: n
|
|
34
|
+
})]
|
|
35
|
+
})
|
|
36
|
+
}), p = {
|
|
37
|
+
footer: "_footer_zjuj8_1",
|
|
38
|
+
content: "_content_zjuj8_7",
|
|
39
|
+
defaultContent: "_defaultContent_zjuj8_13",
|
|
40
|
+
copyright: "_copyright_zjuj8_21",
|
|
41
|
+
disclaimer: "_disclaimer_zjuj8_26"
|
|
42
|
+
}, m = ({ children: e, className: t = "" }) => /* @__PURE__ */ s("footer", {
|
|
43
|
+
className: `${p.footer} ${t}`,
|
|
44
|
+
children: /* @__PURE__ */ s("div", {
|
|
45
|
+
className: p.content,
|
|
46
|
+
children: e || /* @__PURE__ */ c("div", {
|
|
47
|
+
className: p.defaultContent,
|
|
48
|
+
children: [/* @__PURE__ */ c("p", {
|
|
49
|
+
className: p.copyright,
|
|
50
|
+
children: [
|
|
51
|
+
"© ",
|
|
52
|
+
(/* @__PURE__ */ new Date()).getFullYear(),
|
|
53
|
+
" The Astrogator's Table. All rights reserved."
|
|
54
|
+
]
|
|
55
|
+
}), /* @__PURE__ */ s("p", {
|
|
56
|
+
className: p.disclaimer,
|
|
57
|
+
children: "Star Wars: Galaxy of Heroes is a trademark of Electronic Arts Inc."
|
|
58
|
+
})]
|
|
59
|
+
})
|
|
60
|
+
})
|
|
61
|
+
}), h = {
|
|
62
|
+
button: "_button_159ms_1",
|
|
63
|
+
sm: "_sm_159ms_22",
|
|
64
|
+
md: "_md_159ms_28",
|
|
65
|
+
lg: "_lg_159ms_34",
|
|
66
|
+
primary: "_primary_159ms_41",
|
|
67
|
+
secondary: "_secondary_159ms_55",
|
|
68
|
+
outline: "_outline_159ms_69",
|
|
69
|
+
ghost: "_ghost_159ms_80",
|
|
70
|
+
danger: "_danger_159ms_89",
|
|
71
|
+
fullWidth: "_fullWidth_159ms_100",
|
|
72
|
+
loading: "_loading_159ms_105",
|
|
73
|
+
loadingSpinner: "_loadingSpinner_159ms_110",
|
|
74
|
+
spinner: "_spinner_159ms_116",
|
|
75
|
+
spin: "_spin_159ms_116",
|
|
76
|
+
loadingText: "_loadingText_159ms_131"
|
|
77
|
+
}, g = ({ children: e, variant: t = "primary", size: n = "md", fullWidth: r = !1, loading: i = !1, disabled: a = !1, className: o = "", ...l }) => /* @__PURE__ */ s("button", {
|
|
78
|
+
className: `${h.button} ${h[t]} ${h[n]} ${r ? h.fullWidth : ""} ${i ? h.loading : ""} ${o}`,
|
|
79
|
+
disabled: a || i,
|
|
80
|
+
...l,
|
|
81
|
+
children: i ? /* @__PURE__ */ c("span", {
|
|
82
|
+
className: h.loadingSpinner,
|
|
83
|
+
children: [/* @__PURE__ */ s("span", { className: h.spinner }), /* @__PURE__ */ s("span", {
|
|
84
|
+
className: h.loadingText,
|
|
85
|
+
children: e
|
|
86
|
+
})]
|
|
87
|
+
}) : e
|
|
88
|
+
}), _ = {
|
|
89
|
+
inputWrapper: "_inputWrapper_15t4g_1",
|
|
90
|
+
fullWidth: "_fullWidth_15t4g_7",
|
|
91
|
+
label: "_label_15t4g_11",
|
|
92
|
+
required: "_required_15t4g_20",
|
|
93
|
+
input: "_input_15t4g_1",
|
|
94
|
+
error: "_error_15t4g_55",
|
|
95
|
+
errorText: "_errorText_15t4g_63",
|
|
96
|
+
helperText: "_helperText_15t4g_68"
|
|
97
|
+
}, v = e.forwardRef(({ label: e, error: t, helperText: n, fullWidth: r = !1, className: i = "", id: a, ...o }, l) => {
|
|
98
|
+
let u = a || `input-${Math.random().toString(36).substr(2, 9)}`, d = !!t;
|
|
99
|
+
return /* @__PURE__ */ c("div", {
|
|
100
|
+
className: `${_.inputWrapper} ${r ? _.fullWidth : ""} ${i}`,
|
|
101
|
+
children: [
|
|
102
|
+
e && /* @__PURE__ */ c("label", {
|
|
103
|
+
htmlFor: u,
|
|
104
|
+
className: _.label,
|
|
105
|
+
children: [e, o.required && /* @__PURE__ */ s("span", {
|
|
106
|
+
className: _.required,
|
|
107
|
+
children: "*"
|
|
108
|
+
})]
|
|
109
|
+
}),
|
|
110
|
+
/* @__PURE__ */ s("input", {
|
|
111
|
+
ref: l,
|
|
112
|
+
id: u,
|
|
113
|
+
className: `${_.input} ${d ? _.error : ""}`,
|
|
114
|
+
...o
|
|
115
|
+
}),
|
|
116
|
+
t && /* @__PURE__ */ s("span", {
|
|
117
|
+
className: _.errorText,
|
|
118
|
+
children: t
|
|
119
|
+
}),
|
|
120
|
+
n && !t && /* @__PURE__ */ s("span", {
|
|
121
|
+
className: _.helperText,
|
|
122
|
+
children: n
|
|
123
|
+
})
|
|
124
|
+
]
|
|
125
|
+
});
|
|
126
|
+
});
|
|
127
|
+
v.displayName = "Input";
|
|
128
|
+
var y = {
|
|
129
|
+
selectWrapper: "_selectWrapper_ir4bq_1",
|
|
130
|
+
fullWidth: "_fullWidth_ir4bq_7",
|
|
131
|
+
label: "_label_ir4bq_11",
|
|
132
|
+
required: "_required_ir4bq_20",
|
|
133
|
+
selectContainer: "_selectContainer_ir4bq_24",
|
|
134
|
+
select: "_select_ir4bq_1",
|
|
135
|
+
error: "_error_ir4bq_63",
|
|
136
|
+
arrow: "_arrow_ir4bq_71",
|
|
137
|
+
errorText: "_errorText_ir4bq_81",
|
|
138
|
+
helperText: "_helperText_ir4bq_86"
|
|
139
|
+
}, b = e.forwardRef(({ label: e, error: t, helperText: n, options: r, placeholder: i, fullWidth: a = !1, className: o = "", id: l, ...u }, d) => {
|
|
140
|
+
let f = l || `select-${Math.random().toString(36).substr(2, 9)}`, p = !!t;
|
|
141
|
+
return /* @__PURE__ */ c("div", {
|
|
142
|
+
className: `${y.selectWrapper} ${a ? y.fullWidth : ""} ${o}`,
|
|
143
|
+
children: [
|
|
144
|
+
e && /* @__PURE__ */ c("label", {
|
|
145
|
+
htmlFor: f,
|
|
146
|
+
className: y.label,
|
|
147
|
+
children: [e, u.required && /* @__PURE__ */ s("span", {
|
|
148
|
+
className: y.required,
|
|
149
|
+
children: "*"
|
|
150
|
+
})]
|
|
151
|
+
}),
|
|
152
|
+
/* @__PURE__ */ c("div", {
|
|
153
|
+
className: y.selectContainer,
|
|
154
|
+
children: [/* @__PURE__ */ c("select", {
|
|
155
|
+
ref: d,
|
|
156
|
+
id: f,
|
|
157
|
+
className: `${y.select} ${p ? y.error : ""}`,
|
|
158
|
+
...u,
|
|
159
|
+
children: [
|
|
160
|
+
i && /* @__PURE__ */ s("option", {
|
|
161
|
+
value: "",
|
|
162
|
+
disabled: !0,
|
|
163
|
+
children: i
|
|
164
|
+
}),
|
|
165
|
+
r && r.map((e) => /* @__PURE__ */ s("option", {
|
|
166
|
+
value: e.value,
|
|
167
|
+
disabled: e.disabled,
|
|
168
|
+
children: e.label
|
|
169
|
+
}, e.value)),
|
|
170
|
+
!r && u.children
|
|
171
|
+
]
|
|
172
|
+
}), /* @__PURE__ */ s("span", {
|
|
173
|
+
className: y.arrow,
|
|
174
|
+
children: "▼"
|
|
175
|
+
})]
|
|
176
|
+
}),
|
|
177
|
+
t && /* @__PURE__ */ s("span", {
|
|
178
|
+
className: y.errorText,
|
|
179
|
+
children: t
|
|
180
|
+
}),
|
|
181
|
+
n && !t && /* @__PURE__ */ s("span", {
|
|
182
|
+
className: y.helperText,
|
|
183
|
+
children: n
|
|
184
|
+
})
|
|
185
|
+
]
|
|
186
|
+
});
|
|
187
|
+
});
|
|
188
|
+
b.displayName = "Select";
|
|
189
|
+
//#endregion
|
|
190
|
+
//#region src/services/auth.ts
|
|
191
|
+
var x = "astrogators_access_token", S = "astrogators_refresh_token", C = () => localStorage.getItem(x), w = (e) => {
|
|
192
|
+
localStorage.setItem(x, e);
|
|
193
|
+
}, T = () => {
|
|
194
|
+
localStorage.removeItem(x);
|
|
195
|
+
}, E = () => localStorage.getItem(S), D = (e) => {
|
|
196
|
+
localStorage.setItem(S, e);
|
|
197
|
+
}, O = () => {
|
|
198
|
+
localStorage.removeItem(S);
|
|
199
|
+
}, k = (e, t) => {
|
|
200
|
+
w(e), D(t);
|
|
201
|
+
}, A = () => {
|
|
202
|
+
T(), O();
|
|
203
|
+
}, j = () => !!C(), M = class {
|
|
204
|
+
baseURL;
|
|
205
|
+
onUnauthorized;
|
|
206
|
+
isRefreshing = !1;
|
|
207
|
+
refreshPromise = null;
|
|
208
|
+
constructor(e) {
|
|
209
|
+
this.baseURL = e.baseURL, this.onUnauthorized = e.onUnauthorized;
|
|
210
|
+
}
|
|
211
|
+
async refreshAccessToken() {
|
|
212
|
+
let e = E();
|
|
213
|
+
if (!e) throw Error("No refresh token available");
|
|
214
|
+
let t = await fetch(`${this.baseURL}/api/v1/auth/refresh-token`, {
|
|
215
|
+
method: "POST",
|
|
216
|
+
headers: { "Content-Type": "application/json" },
|
|
217
|
+
body: JSON.stringify({ refresh_token: e })
|
|
218
|
+
});
|
|
219
|
+
if (!t.ok) throw A(), this.onUnauthorized?.(), Error("Token refresh failed");
|
|
220
|
+
let n = await t.json();
|
|
221
|
+
return k(n.access_token, e), n.access_token;
|
|
222
|
+
}
|
|
223
|
+
async request(e, t = {}) {
|
|
224
|
+
let n = C(), r = {
|
|
225
|
+
"Content-Type": "application/json",
|
|
226
|
+
...t.headers
|
|
227
|
+
};
|
|
228
|
+
n && (r.Authorization = `Bearer ${n}`);
|
|
229
|
+
let i = `${this.baseURL}${e}`, a = await fetch(i, {
|
|
230
|
+
...t,
|
|
231
|
+
headers: r
|
|
232
|
+
});
|
|
233
|
+
if (a.status === 401 && n) {
|
|
234
|
+
this.isRefreshing || (this.isRefreshing = !0, this.refreshPromise = this.refreshAccessToken().finally(() => {
|
|
235
|
+
this.isRefreshing = !1, this.refreshPromise = null;
|
|
236
|
+
}));
|
|
237
|
+
try {
|
|
238
|
+
r.Authorization = `Bearer ${await this.refreshPromise}`, a = await fetch(i, {
|
|
239
|
+
...t,
|
|
240
|
+
headers: r
|
|
241
|
+
});
|
|
242
|
+
} catch {
|
|
243
|
+
throw Error("Authentication failed");
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
if (!a.ok) {
|
|
247
|
+
let e = {
|
|
248
|
+
message: a.statusText,
|
|
249
|
+
status: a.status
|
|
250
|
+
};
|
|
251
|
+
try {
|
|
252
|
+
let t = await a.json();
|
|
253
|
+
a.status === 422 && Array.isArray(t.detail) ? e.message = t.detail.map((e) => e.msg || "Validation error").join(", ") : typeof t.detail == "string" ? e.message = t.detail : t.message && (e.message = t.message), e.detail = t.detail;
|
|
254
|
+
} catch {}
|
|
255
|
+
throw e;
|
|
256
|
+
}
|
|
257
|
+
return a.status === 204 ? {} : a.json();
|
|
258
|
+
}
|
|
259
|
+
async get(e, t) {
|
|
260
|
+
return this.request(e, {
|
|
261
|
+
...t,
|
|
262
|
+
method: "GET"
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
async post(e, t, n) {
|
|
266
|
+
return this.request(e, {
|
|
267
|
+
...n,
|
|
268
|
+
method: "POST",
|
|
269
|
+
body: t ? JSON.stringify(t) : void 0
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
async put(e, t, n) {
|
|
273
|
+
return this.request(e, {
|
|
274
|
+
...n,
|
|
275
|
+
method: "PUT",
|
|
276
|
+
body: t ? JSON.stringify(t) : void 0
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
async patch(e, t, n) {
|
|
280
|
+
return this.request(e, {
|
|
281
|
+
...n,
|
|
282
|
+
method: "PATCH",
|
|
283
|
+
body: t ? JSON.stringify(t) : void 0
|
|
284
|
+
});
|
|
285
|
+
}
|
|
286
|
+
async delete(e, t) {
|
|
287
|
+
return this.request(e, {
|
|
288
|
+
...t,
|
|
289
|
+
method: "DELETE"
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
}, N, P = (e) => {
|
|
293
|
+
N = new M(e);
|
|
294
|
+
}, F = "astrogators_ally_codes", I = "astrogators_selected_ally_code", L = () => {
|
|
295
|
+
try {
|
|
296
|
+
let e = localStorage.getItem(F);
|
|
297
|
+
return e ? JSON.parse(e) : [];
|
|
298
|
+
} catch (e) {
|
|
299
|
+
return console.error("Failed to read ally codes from localStorage:", e), [];
|
|
300
|
+
}
|
|
301
|
+
}, R = (e) => {
|
|
302
|
+
try {
|
|
303
|
+
let t = L();
|
|
304
|
+
if (t.some((t) => t.ally_code === e.ally_code)) return;
|
|
305
|
+
t.push(e), localStorage.setItem(F, JSON.stringify(t));
|
|
306
|
+
} catch (e) {
|
|
307
|
+
console.error("Failed to save ally code to localStorage:", e);
|
|
308
|
+
}
|
|
309
|
+
}, z = (e) => {
|
|
310
|
+
try {
|
|
311
|
+
let t = L().filter((t) => t.ally_code !== e);
|
|
312
|
+
localStorage.setItem(F, JSON.stringify(t));
|
|
313
|
+
} catch (e) {
|
|
314
|
+
console.error("Failed to remove ally code from localStorage:", e);
|
|
315
|
+
}
|
|
316
|
+
}, B = (e) => {
|
|
317
|
+
try {
|
|
318
|
+
let t = L().map((t) => t.ally_code === e ? {
|
|
319
|
+
...t,
|
|
320
|
+
last_used_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
321
|
+
} : t);
|
|
322
|
+
localStorage.setItem(F, JSON.stringify(t));
|
|
323
|
+
} catch (e) {
|
|
324
|
+
console.error("Failed to update ally code last used:", e);
|
|
325
|
+
}
|
|
326
|
+
}, V = () => localStorage.getItem(I), H = (e) => {
|
|
327
|
+
e ? localStorage.setItem(I, e) : localStorage.removeItem(I);
|
|
328
|
+
}, U = () => {
|
|
329
|
+
localStorage.removeItem(F), localStorage.removeItem(I);
|
|
330
|
+
}, W = t(void 0), G = ({ children: e, apiBaseUrl: t }) => {
|
|
331
|
+
let [r, o] = a(null), [c, l] = a(!0), [u, d] = a(!0), [f, p] = a(!0), [m, h] = a([]), [g, _] = a(null), [v, y] = a(!1), [b, x] = a({
|
|
332
|
+
show: !1,
|
|
333
|
+
localStorageCodes: []
|
|
334
|
+
});
|
|
335
|
+
i(() => {
|
|
336
|
+
P({ baseURL: t });
|
|
337
|
+
}, [t]), i(() => {
|
|
338
|
+
(async () => {
|
|
339
|
+
try {
|
|
340
|
+
d((await N.get("/api/v1/config/features")).auth_enabled);
|
|
341
|
+
} catch (e) {
|
|
342
|
+
console.error("Failed to fetch features:", e), d(!0);
|
|
343
|
+
} finally {
|
|
344
|
+
p(!1);
|
|
345
|
+
}
|
|
346
|
+
})();
|
|
347
|
+
}, [t]);
|
|
348
|
+
let S = n(async () => {
|
|
349
|
+
if (!j()) {
|
|
350
|
+
o(null), l(!1);
|
|
351
|
+
return;
|
|
352
|
+
}
|
|
353
|
+
try {
|
|
354
|
+
o(await N.get("/api/v1/users/me"));
|
|
355
|
+
} catch (e) {
|
|
356
|
+
console.error("Failed to fetch user:", e), o(null), A();
|
|
357
|
+
} finally {
|
|
358
|
+
l(!1);
|
|
359
|
+
}
|
|
360
|
+
}, []);
|
|
361
|
+
i(() => {
|
|
362
|
+
S();
|
|
363
|
+
}, [S]);
|
|
364
|
+
let C = async (e) => {
|
|
365
|
+
try {
|
|
366
|
+
let t = await N.post("/api/v1/auth/login", e);
|
|
367
|
+
k(t.access_token, t.refresh_token), o(await N.get("/api/v1/users/me"));
|
|
368
|
+
} catch (e) {
|
|
369
|
+
throw console.error("Login failed:", e), e;
|
|
370
|
+
}
|
|
371
|
+
}, w = async (e) => {
|
|
372
|
+
try {
|
|
373
|
+
await N.post("/api/v1/auth/register", e);
|
|
374
|
+
} catch (e) {
|
|
375
|
+
throw console.error("Registration failed:", e), e;
|
|
376
|
+
}
|
|
377
|
+
}, T = () => {
|
|
378
|
+
A(), o(null), h([]), _(null), x({
|
|
379
|
+
show: !1,
|
|
380
|
+
localStorageCodes: []
|
|
381
|
+
});
|
|
382
|
+
}, E = async () => {
|
|
383
|
+
await S();
|
|
384
|
+
}, D = async (e) => {
|
|
385
|
+
try {
|
|
386
|
+
return (await N.post("/api/v1/auth/forgot-password", e)).message;
|
|
387
|
+
} catch (e) {
|
|
388
|
+
throw console.error("Forgot password failed:", e), e;
|
|
389
|
+
}
|
|
390
|
+
}, O = async (e) => {
|
|
391
|
+
try {
|
|
392
|
+
return (await N.post("/api/v1/auth/reset-password", e)).message;
|
|
393
|
+
} catch (e) {
|
|
394
|
+
throw console.error("Reset password failed:", e), e;
|
|
395
|
+
}
|
|
396
|
+
}, M = async (e) => {
|
|
397
|
+
try {
|
|
398
|
+
return (await N.post("/api/v1/auth/resend-verification", e)).message;
|
|
399
|
+
} catch (e) {
|
|
400
|
+
throw console.error("Resend verification failed:", e), e;
|
|
401
|
+
}
|
|
402
|
+
}, F = n(async () => {
|
|
403
|
+
y(!0);
|
|
404
|
+
try {
|
|
405
|
+
if (r) {
|
|
406
|
+
h((await N.get("/api/v1/users/me/ally-codes")).ally_codes);
|
|
407
|
+
let e = L();
|
|
408
|
+
e.length > 0 && x({
|
|
409
|
+
show: !0,
|
|
410
|
+
localStorageCodes: e.map((e) => e.ally_code)
|
|
411
|
+
});
|
|
412
|
+
} else h(L());
|
|
413
|
+
_(V());
|
|
414
|
+
} catch (e) {
|
|
415
|
+
console.error("Failed to fetch ally codes:", e), h([]);
|
|
416
|
+
} finally {
|
|
417
|
+
y(!1);
|
|
418
|
+
}
|
|
419
|
+
}, [r]), I = n(async (e) => {
|
|
420
|
+
r && typeof e == "number" ? (await N.put(`/api/v1/users/me/ally-codes/${e}/use`, {}), await F()) : !r && typeof e == "string" && (B(e), h(L()));
|
|
421
|
+
}, [r, F]), G = n((e) => {
|
|
422
|
+
if (_(e), H(e), e && r) {
|
|
423
|
+
let t = m.find((t) => "ally_code" in t && t.ally_code === e);
|
|
424
|
+
t && "id" in t && I(t.id);
|
|
425
|
+
} else e && !r && B(e);
|
|
426
|
+
}, [
|
|
427
|
+
r,
|
|
428
|
+
m,
|
|
429
|
+
I
|
|
430
|
+
]), K = n(async (e) => {
|
|
431
|
+
if (!/^\d{9}$/.test(e)) throw Error("Ally code must be exactly 9 digits");
|
|
432
|
+
if (r) {
|
|
433
|
+
let t = await N.post("/api/v1/users/me/ally-codes", { ally_code: e });
|
|
434
|
+
h((e) => [t, ...e]), m.length === 0 && G(e);
|
|
435
|
+
} else {
|
|
436
|
+
let t = await N.get(`/api/v1/player-data/player/${e}`);
|
|
437
|
+
if (!t) throw Error("Invalid ally code - player not found");
|
|
438
|
+
R({
|
|
439
|
+
ally_code: e,
|
|
440
|
+
player_name: t.data?.name ?? null,
|
|
441
|
+
last_used_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
442
|
+
}), h(L()), m.length === 0 && G(e);
|
|
443
|
+
}
|
|
444
|
+
}, [
|
|
445
|
+
r,
|
|
446
|
+
m.length,
|
|
447
|
+
G
|
|
448
|
+
]), q = n(async (e) => {
|
|
449
|
+
r && typeof e == "number" ? (await N.delete(`/api/v1/users/me/ally-codes/${e}`), h((t) => t.filter((t) => "id" in t && t.id !== e))) : !r && typeof e == "string" && (z(e), h(L()), g === e && G(null));
|
|
450
|
+
}, [
|
|
451
|
+
r,
|
|
452
|
+
g,
|
|
453
|
+
G
|
|
454
|
+
]), J = n(() => {
|
|
455
|
+
x({
|
|
456
|
+
show: !1,
|
|
457
|
+
localStorageCodes: []
|
|
458
|
+
});
|
|
459
|
+
}, []), Y = n(async () => {
|
|
460
|
+
if (!r) return;
|
|
461
|
+
let e = L();
|
|
462
|
+
for (let t of e) try {
|
|
463
|
+
await K(t.ally_code);
|
|
464
|
+
} catch (e) {
|
|
465
|
+
console.error(`Failed to migrate ally code ${t.ally_code}:`, e);
|
|
466
|
+
}
|
|
467
|
+
U(), J();
|
|
468
|
+
}, [
|
|
469
|
+
r,
|
|
470
|
+
K,
|
|
471
|
+
J
|
|
472
|
+
]);
|
|
473
|
+
i(() => {
|
|
474
|
+
F();
|
|
475
|
+
}, [F]);
|
|
476
|
+
let ee = {
|
|
477
|
+
user: r,
|
|
478
|
+
isAuthenticated: !!r,
|
|
479
|
+
isLoading: c,
|
|
480
|
+
login: C,
|
|
481
|
+
register: w,
|
|
482
|
+
logout: T,
|
|
483
|
+
refreshUser: E,
|
|
484
|
+
forgotPassword: D,
|
|
485
|
+
resetPassword: O,
|
|
486
|
+
resendVerification: M,
|
|
487
|
+
authEnabled: u,
|
|
488
|
+
isLoadingFeatures: f,
|
|
489
|
+
allyCodes: m,
|
|
490
|
+
selectedAllyCode: g,
|
|
491
|
+
isLoadingAllyCodes: v,
|
|
492
|
+
fetchAllyCodes: F,
|
|
493
|
+
addAllyCode: K,
|
|
494
|
+
removeAllyCode: q,
|
|
495
|
+
selectAllyCode: G,
|
|
496
|
+
updateAllyCodeLastUsed: I,
|
|
497
|
+
migrationPrompt: b,
|
|
498
|
+
dismissMigrationPrompt: J,
|
|
499
|
+
migrateLocalStorageCodes: Y
|
|
500
|
+
};
|
|
501
|
+
return /* @__PURE__ */ s(W.Provider, {
|
|
502
|
+
value: ee,
|
|
503
|
+
children: e
|
|
504
|
+
});
|
|
505
|
+
}, K = () => {
|
|
506
|
+
let e = r(W);
|
|
507
|
+
if (e === void 0) throw Error("useAuth must be used within an AuthProvider");
|
|
508
|
+
return e;
|
|
509
|
+
}, q = (e) => !e || e.length !== 9 ? e : `${e.slice(0, 3)}-${e.slice(3, 6)}-${e.slice(6, 9)}`, J = (e) => e.replace(/-/g, ""), Y = {
|
|
510
|
+
allyCodeDropdown: "_allyCodeDropdown_1m0tw_1",
|
|
511
|
+
select: "_select_1m0tw_8",
|
|
512
|
+
manageButton: "_manageButton_1m0tw_12",
|
|
513
|
+
managePanel: "_managePanel_1m0tw_16",
|
|
514
|
+
addSection: "_addSection_1m0tw_37",
|
|
515
|
+
addInputGroup: "_addInputGroup_1m0tw_43",
|
|
516
|
+
error: "_error_1m0tw_55",
|
|
517
|
+
success: "_success_1m0tw_61",
|
|
518
|
+
codesList: "_codesList_1m0tw_67",
|
|
519
|
+
codeItem: "_codeItem_1m0tw_71",
|
|
520
|
+
doneButton: "_doneButton_1m0tw_88"
|
|
521
|
+
}, ee = ({ onAllyCodeSelected: e, className: t = "" }) => {
|
|
522
|
+
let { allyCodes: n, selectedAllyCode: r, selectAllyCode: i, removeAllyCode: o, addAllyCode: l, isLoadingAllyCodes: u } = K(), [d, f] = a(!1), [p, m] = a(""), [h, _] = a(""), [y, x] = a(""), [S, C] = a(!1), w = n.map((e) => ({
|
|
523
|
+
value: e.ally_code,
|
|
524
|
+
label: e.player_name ? `${e.player_name} (${q(e.ally_code)})` : q(e.ally_code)
|
|
525
|
+
})), T = (t) => {
|
|
526
|
+
let n = t.target.value || null;
|
|
527
|
+
i(n), e?.(n);
|
|
528
|
+
}, E = async (e) => {
|
|
529
|
+
let t = n.find((t) => t.ally_code === e);
|
|
530
|
+
t && await o("id" in t ? t.id : t.ally_code);
|
|
531
|
+
};
|
|
532
|
+
return n.length === 0 ? null : /* @__PURE__ */ c("div", {
|
|
533
|
+
className: `${Y.allyCodeDropdown} ${t}`,
|
|
534
|
+
children: [
|
|
535
|
+
/* @__PURE__ */ s(b, {
|
|
536
|
+
options: w,
|
|
537
|
+
value: r || "",
|
|
538
|
+
onChange: T,
|
|
539
|
+
placeholder: "Select ally code",
|
|
540
|
+
disabled: u,
|
|
541
|
+
className: Y.select
|
|
542
|
+
}),
|
|
543
|
+
d && /* @__PURE__ */ c("div", {
|
|
544
|
+
className: Y.managePanel,
|
|
545
|
+
children: [
|
|
546
|
+
/* @__PURE__ */ s("h4", { children: "Manage Ally Codes" }),
|
|
547
|
+
/* @__PURE__ */ c("div", {
|
|
548
|
+
className: Y.addSection,
|
|
549
|
+
children: [
|
|
550
|
+
/* @__PURE__ */ c("div", {
|
|
551
|
+
className: Y.addInputGroup,
|
|
552
|
+
children: [/* @__PURE__ */ s(v, {
|
|
553
|
+
type: "text",
|
|
554
|
+
placeholder: "9-digit ally code",
|
|
555
|
+
value: p,
|
|
556
|
+
onChange: (e) => m(e.target.value.replace(/\D/g, "").slice(0, 9)),
|
|
557
|
+
disabled: S
|
|
558
|
+
}), /* @__PURE__ */ s(g, {
|
|
559
|
+
variant: "primary",
|
|
560
|
+
size: "sm",
|
|
561
|
+
onClick: async () => {
|
|
562
|
+
if (_(""), x(""), !/^\d{9}$/.test(p)) {
|
|
563
|
+
_("Ally code must be exactly 9 digits");
|
|
564
|
+
return;
|
|
565
|
+
}
|
|
566
|
+
C(!0);
|
|
567
|
+
try {
|
|
568
|
+
await l(p), x("Added successfully!"), m(""), setTimeout(() => x(""), 2e3);
|
|
569
|
+
} catch (e) {
|
|
570
|
+
_(e.message || "Failed to add ally code");
|
|
571
|
+
} finally {
|
|
572
|
+
C(!1);
|
|
573
|
+
}
|
|
574
|
+
},
|
|
575
|
+
loading: S,
|
|
576
|
+
disabled: p.length !== 9,
|
|
577
|
+
children: "Add"
|
|
578
|
+
})]
|
|
579
|
+
}),
|
|
580
|
+
h && /* @__PURE__ */ s("div", {
|
|
581
|
+
className: Y.error,
|
|
582
|
+
children: h
|
|
583
|
+
}),
|
|
584
|
+
y && /* @__PURE__ */ s("div", {
|
|
585
|
+
className: Y.success,
|
|
586
|
+
children: y
|
|
587
|
+
})
|
|
588
|
+
]
|
|
589
|
+
}),
|
|
590
|
+
/* @__PURE__ */ s("div", {
|
|
591
|
+
className: Y.codesList,
|
|
592
|
+
children: n.map((e) => /* @__PURE__ */ c("div", {
|
|
593
|
+
className: Y.codeItem,
|
|
594
|
+
children: [/* @__PURE__ */ s("span", { children: e.player_name ? `${e.player_name} (${q(e.ally_code)})` : q(e.ally_code) }), /* @__PURE__ */ s(g, {
|
|
595
|
+
variant: "ghost",
|
|
596
|
+
size: "sm",
|
|
597
|
+
onClick: () => E(e.ally_code),
|
|
598
|
+
children: "Remove"
|
|
599
|
+
})]
|
|
600
|
+
}, e.ally_code))
|
|
601
|
+
}),
|
|
602
|
+
/* @__PURE__ */ s(g, {
|
|
603
|
+
variant: "secondary",
|
|
604
|
+
size: "sm",
|
|
605
|
+
onClick: () => f(!1),
|
|
606
|
+
className: Y.doneButton,
|
|
607
|
+
children: "Done"
|
|
608
|
+
})
|
|
609
|
+
]
|
|
610
|
+
}),
|
|
611
|
+
/* @__PURE__ */ s(g, {
|
|
612
|
+
variant: "ghost",
|
|
613
|
+
size: "sm",
|
|
614
|
+
onClick: () => f(!d),
|
|
615
|
+
className: Y.manageButton,
|
|
616
|
+
children: "Manage"
|
|
617
|
+
})
|
|
618
|
+
]
|
|
619
|
+
});
|
|
620
|
+
}, X = {
|
|
621
|
+
card: "_card_b4471_1",
|
|
622
|
+
chamfered: "_chamfered_b4471_8",
|
|
623
|
+
default: "_default_b4471_13",
|
|
624
|
+
elevated: "_elevated_b4471_17",
|
|
625
|
+
outline: "_outline_b4471_22",
|
|
626
|
+
"padding-none": "_padding-none_b4471_28",
|
|
627
|
+
"padding-sm": "_padding-sm_b4471_32",
|
|
628
|
+
"padding-md": "_padding-md_b4471_36",
|
|
629
|
+
"padding-lg": "_padding-lg_b4471_40",
|
|
630
|
+
hoverable: "_hoverable_b4471_45"
|
|
631
|
+
}, te = ({ children: e, variant: t = "default", chamfered: n = !1, chamferSize: r = "md", padding: i = "md", hoverable: a = !1, showDiagonalBorders: l = !1, diagonalBorderColor: u, className: d = "", onClick: f, style: p }) => {
|
|
632
|
+
let m = n ? r === "asymmetric" ? "chamfered-box-asymmetric" : r === "sm" ? "chamfered-box-sm" : r === "lg" ? "chamfered-box-lg" : "chamfered-box" : "", h = u ? { color: u } : void 0;
|
|
633
|
+
return /* @__PURE__ */ c("div", {
|
|
634
|
+
className: `${X.card} ${n ? X.chamfered : ""} ${X[t]} ${X[`padding-${i}`]} ${m} ${a ? X.hoverable : ""} ${d}`,
|
|
635
|
+
onClick: f,
|
|
636
|
+
role: f ? "button" : void 0,
|
|
637
|
+
tabIndex: f ? 0 : void 0,
|
|
638
|
+
style: p,
|
|
639
|
+
children: [l && /* @__PURE__ */ c(o, { children: [
|
|
640
|
+
/* @__PURE__ */ s("div", {
|
|
641
|
+
className: "chamfered-diagonal-border chamfered-diagonal-tl",
|
|
642
|
+
style: h
|
|
643
|
+
}),
|
|
644
|
+
/* @__PURE__ */ s("div", {
|
|
645
|
+
className: "chamfered-diagonal-border chamfered-diagonal-tr",
|
|
646
|
+
style: h
|
|
647
|
+
}),
|
|
648
|
+
/* @__PURE__ */ s("div", {
|
|
649
|
+
className: "chamfered-diagonal-border chamfered-diagonal-bl",
|
|
650
|
+
style: h
|
|
651
|
+
}),
|
|
652
|
+
/* @__PURE__ */ s("div", {
|
|
653
|
+
className: `chamfered-diagonal-border ${r === "asymmetric" ? "chamfered-diagonal-br-large" : "chamfered-diagonal-br"}`,
|
|
654
|
+
style: h
|
|
655
|
+
})
|
|
656
|
+
] }), e]
|
|
657
|
+
});
|
|
658
|
+
}, Z = {
|
|
659
|
+
badge: "_badge_rk7t5_1",
|
|
660
|
+
sm: "_sm_rk7t5_11",
|
|
661
|
+
md: "_md_rk7t5_16",
|
|
662
|
+
lg: "_lg_rk7t5_21",
|
|
663
|
+
default: "_default_rk7t5_27",
|
|
664
|
+
primary: "_primary_rk7t5_32",
|
|
665
|
+
secondary: "_secondary_rk7t5_37",
|
|
666
|
+
success: "_success_rk7t5_42",
|
|
667
|
+
warning: "_warning_rk7t5_47",
|
|
668
|
+
error: "_error_rk7t5_52",
|
|
669
|
+
info: "_info_rk7t5_57"
|
|
670
|
+
}, ne = ({ children: e, variant: t = "default", size: n = "md", className: r = "" }) => /* @__PURE__ */ s("span", {
|
|
671
|
+
className: `${Z.badge} ${Z[t]} ${Z[n]} ${r}`,
|
|
672
|
+
children: e
|
|
673
|
+
}), Q = {
|
|
674
|
+
overlay: "_overlay_1b3yt_1",
|
|
675
|
+
fadeIn: "_fadeIn_1b3yt_1",
|
|
676
|
+
modal: "_modal_1b3yt_13",
|
|
677
|
+
slideUp: "_slideUp_1b3yt_1",
|
|
678
|
+
sm: "_sm_1b3yt_25",
|
|
679
|
+
md: "_md_1b3yt_30",
|
|
680
|
+
lg: "_lg_1b3yt_35",
|
|
681
|
+
xl: "_xl_1b3yt_40",
|
|
682
|
+
header: "_header_1b3yt_45",
|
|
683
|
+
title: "_title_1b3yt_53",
|
|
684
|
+
closeButton: "_closeButton_1b3yt_60",
|
|
685
|
+
content: "_content_1b3yt_78"
|
|
686
|
+
}, re = ({ isOpen: e, onClose: t, title: n, children: r, size: a = "md", closeOnOverlayClick: o = !0, className: l = "" }) => (i(() => (e ? document.body.style.overflow = "hidden" : document.body.style.overflow = "unset", () => {
|
|
687
|
+
document.body.style.overflow = "unset";
|
|
688
|
+
}), [e]), i(() => {
|
|
689
|
+
let n = (n) => {
|
|
690
|
+
n.key === "Escape" && e && t();
|
|
691
|
+
};
|
|
692
|
+
return document.addEventListener("keydown", n), () => document.removeEventListener("keydown", n);
|
|
693
|
+
}, [e, t]), e ? /* @__PURE__ */ s("div", {
|
|
694
|
+
className: Q.overlay,
|
|
695
|
+
onClick: (e) => {
|
|
696
|
+
o && e.target === e.currentTarget && t();
|
|
697
|
+
},
|
|
698
|
+
children: /* @__PURE__ */ c("div", {
|
|
699
|
+
className: `${Q.modal} ${Q[a]} ${l}`,
|
|
700
|
+
role: "dialog",
|
|
701
|
+
"aria-modal": "true",
|
|
702
|
+
children: [n && /* @__PURE__ */ c("div", {
|
|
703
|
+
className: Q.header,
|
|
704
|
+
children: [/* @__PURE__ */ s("h2", {
|
|
705
|
+
className: Q.title,
|
|
706
|
+
children: n
|
|
707
|
+
}), /* @__PURE__ */ s("button", {
|
|
708
|
+
className: Q.closeButton,
|
|
709
|
+
onClick: t,
|
|
710
|
+
"aria-label": "Close modal",
|
|
711
|
+
children: "✕"
|
|
712
|
+
})]
|
|
713
|
+
}), /* @__PURE__ */ s("div", {
|
|
714
|
+
className: Q.content,
|
|
715
|
+
children: r
|
|
716
|
+
})]
|
|
717
|
+
})
|
|
718
|
+
}) : null), $ = {
|
|
719
|
+
spinner: "_spinner_1uhnh_2",
|
|
720
|
+
spin: "_spin_1uhnh_2",
|
|
721
|
+
sm: "_sm_1uhnh_9",
|
|
722
|
+
md: "_md_1uhnh_15",
|
|
723
|
+
lg: "_lg_1uhnh_21",
|
|
724
|
+
dots: "_dots_1uhnh_34",
|
|
725
|
+
dot: "_dot_1uhnh_34",
|
|
726
|
+
bounce: "_bounce_1uhnh_1",
|
|
727
|
+
visuallyHidden: "_visuallyHidden_1uhnh_91"
|
|
728
|
+
}, ie = ({ size: e = "md", variant: t = "spinner", className: n = "" }) => t === "dots" ? /* @__PURE__ */ c("div", {
|
|
729
|
+
className: `${$.dots} ${$[e]} ${n}`,
|
|
730
|
+
children: [
|
|
731
|
+
/* @__PURE__ */ s("span", { className: $.dot }),
|
|
732
|
+
/* @__PURE__ */ s("span", { className: $.dot }),
|
|
733
|
+
/* @__PURE__ */ s("span", { className: $.dot })
|
|
734
|
+
]
|
|
735
|
+
}) : /* @__PURE__ */ s("div", {
|
|
736
|
+
className: `${$.spinner} ${$[e]} ${n}`,
|
|
737
|
+
role: "status",
|
|
738
|
+
children: /* @__PURE__ */ s("span", {
|
|
739
|
+
className: $.visuallyHidden,
|
|
740
|
+
children: "Loading..."
|
|
741
|
+
})
|
|
742
|
+
});
|
|
743
|
+
//#endregion
|
|
744
|
+
export { ee as AllyCodeDropdown, M as ApiClient, G as AuthProvider, ne as Badge, g as Button, te as Card, u as Container, m as Footer, v as Input, ie as Loader, re as Modal, b as Select, f as TopBar, N as apiClient, U as clearAllyCodes, A as clearTokens, q as formatAllyCode, C as getAccessToken, L as getAllyCodesFromStorage, E as getRefreshToken, V as getSelectedAllyCode, P as initializeApiClient, j as isAuthenticated, T as removeAccessToken, z as removeAllyCodeFromStorage, O as removeRefreshToken, R as saveAllyCodeToStorage, w as setAccessToken, D as setRefreshToken, H as setSelectedAllyCode, k as setTokens, J as unformatAllyCode, B as updateAllyCodeLastUsed, K as useAuth };
|