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