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