astrogators-shared-ui 0.10.3 → 0.11.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/index.js +82 -67
- package/dist/src/index.d.ts +1 -0
- package/dist/src/services/users.d.ts +19 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -190,8 +190,21 @@ var y = "astrogators_access_token", b = "astrogators_refresh_token", x = () => l
|
|
|
190
190
|
return D(n.access_token, n.refresh_token), n.access_token;
|
|
191
191
|
})().finally(() => {
|
|
192
192
|
j = null;
|
|
193
|
-
}), j), P =
|
|
194
|
-
|
|
193
|
+
}), j), P = 30, F = (e) => {
|
|
194
|
+
try {
|
|
195
|
+
let t = e.split(".")[1].replace(/-/g, "+").replace(/_/g, "/"), { exp: n } = JSON.parse(atob(t));
|
|
196
|
+
return typeof n == "number" && Date.now() / 1e3 >= n - P;
|
|
197
|
+
} catch {
|
|
198
|
+
return !1;
|
|
199
|
+
}
|
|
200
|
+
}, I = async (e, t = {}) => {
|
|
201
|
+
let n = x();
|
|
202
|
+
if (n && F(n)) try {
|
|
203
|
+
n = await N();
|
|
204
|
+
} catch {
|
|
205
|
+
n = x();
|
|
206
|
+
}
|
|
207
|
+
let r = { ...t.headers };
|
|
195
208
|
n && (r.Authorization = `Bearer ${n}`);
|
|
196
209
|
let i = await fetch(e, {
|
|
197
210
|
...t,
|
|
@@ -206,7 +219,7 @@ var y = "astrogators_access_token", b = "astrogators_refresh_token", x = () => l
|
|
|
206
219
|
} catch {
|
|
207
220
|
return i;
|
|
208
221
|
}
|
|
209
|
-
},
|
|
222
|
+
}, L = class {
|
|
210
223
|
baseURL;
|
|
211
224
|
constructor(e) {
|
|
212
225
|
this.baseURL = e.baseURL, M({
|
|
@@ -218,7 +231,7 @@ var y = "astrogators_access_token", b = "astrogators_refresh_token", x = () => l
|
|
|
218
231
|
let n = {
|
|
219
232
|
"Content-Type": "application/json",
|
|
220
233
|
...t.headers
|
|
221
|
-
}, r = await
|
|
234
|
+
}, r = await I(`${this.baseURL}${e}`, {
|
|
222
235
|
...t,
|
|
223
236
|
headers: n
|
|
224
237
|
});
|
|
@@ -268,55 +281,53 @@ var y = "astrogators_access_token", b = "astrogators_refresh_token", x = () => l
|
|
|
268
281
|
method: "DELETE"
|
|
269
282
|
});
|
|
270
283
|
}
|
|
271
|
-
},
|
|
272
|
-
|
|
273
|
-
},
|
|
284
|
+
}, R, te = (e) => {
|
|
285
|
+
R = new L(e);
|
|
286
|
+
}, z = "astrogators_ally_codes", B = "astrogators_selected_ally_code", V = () => {
|
|
274
287
|
try {
|
|
275
|
-
let e = localStorage.getItem(
|
|
288
|
+
let e = localStorage.getItem(z);
|
|
276
289
|
return e ? JSON.parse(e) : [];
|
|
277
290
|
} catch (e) {
|
|
278
291
|
return console.error("Failed to read ally codes from localStorage:", e), [];
|
|
279
292
|
}
|
|
280
293
|
}, ne = (e) => {
|
|
281
294
|
try {
|
|
282
|
-
let t =
|
|
295
|
+
let t = V();
|
|
283
296
|
if (t.some((t) => t.ally_code === e.ally_code)) return;
|
|
284
|
-
t.push(e), localStorage.setItem(
|
|
297
|
+
t.push(e), localStorage.setItem(z, JSON.stringify(t));
|
|
285
298
|
} catch (e) {
|
|
286
299
|
console.error("Failed to save ally code to localStorage:", e);
|
|
287
300
|
}
|
|
288
|
-
},
|
|
301
|
+
}, H = (e) => {
|
|
289
302
|
try {
|
|
290
|
-
let t =
|
|
291
|
-
localStorage.setItem(
|
|
303
|
+
let t = V().filter((t) => t.ally_code !== e);
|
|
304
|
+
localStorage.setItem(z, JSON.stringify(t));
|
|
292
305
|
} catch (e) {
|
|
293
306
|
console.error("Failed to remove ally code from localStorage:", e);
|
|
294
307
|
}
|
|
295
|
-
},
|
|
308
|
+
}, U = (e) => {
|
|
296
309
|
try {
|
|
297
|
-
let t =
|
|
310
|
+
let t = V().map((t) => t.ally_code === e ? {
|
|
298
311
|
...t,
|
|
299
312
|
last_used_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
300
313
|
} : t);
|
|
301
|
-
localStorage.setItem(
|
|
314
|
+
localStorage.setItem(z, JSON.stringify(t));
|
|
302
315
|
} catch (e) {
|
|
303
316
|
console.error("Failed to update ally code last used:", e);
|
|
304
317
|
}
|
|
305
|
-
},
|
|
306
|
-
e ? localStorage.setItem(
|
|
307
|
-
},
|
|
308
|
-
localStorage.removeItem(
|
|
309
|
-
},
|
|
318
|
+
}, re = () => localStorage.getItem(B), ie = (e) => {
|
|
319
|
+
e ? localStorage.setItem(B, e) : localStorage.removeItem(B);
|
|
320
|
+
}, ae = () => {
|
|
321
|
+
localStorage.removeItem(z), localStorage.removeItem(B);
|
|
322
|
+
}, W = t(void 0), oe = ({ children: e, apiBaseUrl: t }) => {
|
|
310
323
|
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({
|
|
311
324
|
show: !1,
|
|
312
325
|
localStorageCodes: []
|
|
313
326
|
});
|
|
314
|
-
i(() => {
|
|
315
|
-
te({ baseURL: t });
|
|
316
|
-
}, [t]), i(() => {
|
|
327
|
+
te({ baseURL: t }), i(() => {
|
|
317
328
|
(async () => {
|
|
318
329
|
try {
|
|
319
|
-
d((await
|
|
330
|
+
d((await R.get("/api/v1/config/features")).auth_enabled);
|
|
320
331
|
} catch (e) {
|
|
321
332
|
console.error("Failed to fetch features:", e), d(!0);
|
|
322
333
|
} finally {
|
|
@@ -330,7 +341,7 @@ var y = "astrogators_access_token", b = "astrogators_refresh_token", x = () => l
|
|
|
330
341
|
return;
|
|
331
342
|
}
|
|
332
343
|
try {
|
|
333
|
-
o(await
|
|
344
|
+
o(await R.get("/api/v1/users/me"));
|
|
334
345
|
} catch (e) {
|
|
335
346
|
console.error("Failed to fetch user:", e), o(null), O();
|
|
336
347
|
} finally {
|
|
@@ -342,14 +353,14 @@ var y = "astrogators_access_token", b = "astrogators_refresh_token", x = () => l
|
|
|
342
353
|
}, [S]);
|
|
343
354
|
let C = async (e) => {
|
|
344
355
|
try {
|
|
345
|
-
let t = await
|
|
346
|
-
D(t.access_token, t.refresh_token), o(await
|
|
356
|
+
let t = await R.post("/api/v1/auth/login", e);
|
|
357
|
+
D(t.access_token, t.refresh_token), o(await R.get("/api/v1/users/me"));
|
|
347
358
|
} catch (e) {
|
|
348
359
|
throw console.error("Login failed:", e), e;
|
|
349
360
|
}
|
|
350
361
|
}, w = async (e) => {
|
|
351
362
|
try {
|
|
352
|
-
await
|
|
363
|
+
await R.post("/api/v1/auth/register", e);
|
|
353
364
|
} catch (e) {
|
|
354
365
|
throw console.error("Registration failed:", e), e;
|
|
355
366
|
}
|
|
@@ -362,19 +373,19 @@ var y = "astrogators_access_token", b = "astrogators_refresh_token", x = () => l
|
|
|
362
373
|
await S();
|
|
363
374
|
}, k = async (e) => {
|
|
364
375
|
try {
|
|
365
|
-
return (await
|
|
376
|
+
return (await R.post("/api/v1/auth/forgot-password", e)).message;
|
|
366
377
|
} catch (e) {
|
|
367
378
|
throw console.error("Forgot password failed:", e), e;
|
|
368
379
|
}
|
|
369
380
|
}, A = async (e) => {
|
|
370
381
|
try {
|
|
371
|
-
return (await
|
|
382
|
+
return (await R.post("/api/v1/auth/reset-password", e)).message;
|
|
372
383
|
} catch (e) {
|
|
373
384
|
throw console.error("Reset password failed:", e), e;
|
|
374
385
|
}
|
|
375
386
|
}, j = async (e) => {
|
|
376
387
|
try {
|
|
377
|
-
return (await
|
|
388
|
+
return (await R.post("/api/v1/auth/resend-verification", e)).message;
|
|
378
389
|
} catch (e) {
|
|
379
390
|
throw console.error("Resend verification failed:", e), e;
|
|
380
391
|
}
|
|
@@ -382,26 +393,26 @@ var y = "astrogators_access_token", b = "astrogators_refresh_token", x = () => l
|
|
|
382
393
|
y(!0);
|
|
383
394
|
try {
|
|
384
395
|
if (r) {
|
|
385
|
-
h((await
|
|
386
|
-
let e =
|
|
396
|
+
h((await R.get("/api/v1/users/me/ally-codes")).ally_codes);
|
|
397
|
+
let e = V();
|
|
387
398
|
e.length > 0 && x({
|
|
388
399
|
show: !0,
|
|
389
400
|
localStorageCodes: e.map((e) => e.ally_code)
|
|
390
401
|
});
|
|
391
|
-
} else h(
|
|
392
|
-
_(
|
|
402
|
+
} else h(V());
|
|
403
|
+
_(re());
|
|
393
404
|
} catch (e) {
|
|
394
405
|
console.error("Failed to fetch ally codes:", e), h([]);
|
|
395
406
|
} finally {
|
|
396
407
|
y(!1);
|
|
397
408
|
}
|
|
398
409
|
}, [r]), N = n(async (e) => {
|
|
399
|
-
r && typeof e == "number" ? (await
|
|
410
|
+
r && typeof e == "number" ? (await R.put(`/api/v1/users/me/ally-codes/${e}/use`, {}), await M()) : !r && typeof e == "string" && (U(e), h(V()));
|
|
400
411
|
}, [r, M]), P = n((e) => {
|
|
401
|
-
if (_(e),
|
|
412
|
+
if (_(e), ie(e), e && r) {
|
|
402
413
|
let t = m.find((t) => "ally_code" in t && t.ally_code === e);
|
|
403
414
|
t && "id" in t && N(t.id);
|
|
404
|
-
} else e && !r &&
|
|
415
|
+
} else e && !r && U(e);
|
|
405
416
|
}, [
|
|
406
417
|
r,
|
|
407
418
|
m,
|
|
@@ -409,50 +420,50 @@ var y = "astrogators_access_token", b = "astrogators_refresh_token", x = () => l
|
|
|
409
420
|
]), F = n(async (e) => {
|
|
410
421
|
if (!/^\d{9}$/.test(e)) throw Error("Ally code must be exactly 9 digits");
|
|
411
422
|
if (r) {
|
|
412
|
-
let t = await
|
|
423
|
+
let t = await R.post("/api/v1/users/me/ally-codes", { ally_code: e });
|
|
413
424
|
h((e) => [t, ...e]), m.length === 0 && P(e);
|
|
414
425
|
} else {
|
|
415
|
-
let t = await
|
|
426
|
+
let t = await R.get(`/api/v1/player-data/player/${e}`);
|
|
416
427
|
if (!t) throw Error("Invalid ally code - player not found");
|
|
417
428
|
ne({
|
|
418
429
|
ally_code: e,
|
|
419
430
|
player_name: t.data?.name ?? null,
|
|
420
431
|
last_used_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
421
|
-
}), h(
|
|
432
|
+
}), h(V()), m.length === 0 && P(e);
|
|
422
433
|
}
|
|
423
434
|
}, [
|
|
424
435
|
r,
|
|
425
436
|
m.length,
|
|
426
437
|
P
|
|
427
|
-
]),
|
|
428
|
-
r && typeof e == "number" ? (await
|
|
438
|
+
]), I = n(async (e) => {
|
|
439
|
+
r && typeof e == "number" ? (await R.delete(`/api/v1/users/me/ally-codes/${e}`), h((t) => t.filter((t) => "id" in t && t.id !== e))) : !r && typeof e == "string" && (H(e), h(V()), g === e && P(null));
|
|
429
440
|
}, [
|
|
430
441
|
r,
|
|
431
442
|
g,
|
|
432
443
|
P
|
|
433
|
-
]),
|
|
444
|
+
]), L = n(() => {
|
|
434
445
|
x({
|
|
435
446
|
show: !1,
|
|
436
447
|
localStorageCodes: []
|
|
437
448
|
});
|
|
438
|
-
}, []),
|
|
449
|
+
}, []), z = n(async () => {
|
|
439
450
|
if (!r) return;
|
|
440
|
-
let e =
|
|
451
|
+
let e = V();
|
|
441
452
|
for (let t of e) try {
|
|
442
453
|
await F(t.ally_code);
|
|
443
454
|
} catch (e) {
|
|
444
455
|
console.error(`Failed to migrate ally code ${t.ally_code}:`, e);
|
|
445
456
|
}
|
|
446
|
-
|
|
457
|
+
ae(), L();
|
|
447
458
|
}, [
|
|
448
459
|
r,
|
|
449
460
|
F,
|
|
450
|
-
|
|
461
|
+
L
|
|
451
462
|
]);
|
|
452
463
|
i(() => {
|
|
453
464
|
M();
|
|
454
465
|
}, [M]);
|
|
455
|
-
let
|
|
466
|
+
let B = {
|
|
456
467
|
user: r,
|
|
457
468
|
isAuthenticated: !!r,
|
|
458
469
|
isLoading: c,
|
|
@@ -470,22 +481,22 @@ var y = "astrogators_access_token", b = "astrogators_refresh_token", x = () => l
|
|
|
470
481
|
isLoadingAllyCodes: v,
|
|
471
482
|
fetchAllyCodes: M,
|
|
472
483
|
addAllyCode: F,
|
|
473
|
-
removeAllyCode:
|
|
484
|
+
removeAllyCode: I,
|
|
474
485
|
selectAllyCode: P,
|
|
475
486
|
updateAllyCodeLastUsed: N,
|
|
476
487
|
migrationPrompt: b,
|
|
477
|
-
dismissMigrationPrompt:
|
|
478
|
-
migrateLocalStorageCodes:
|
|
488
|
+
dismissMigrationPrompt: L,
|
|
489
|
+
migrateLocalStorageCodes: z
|
|
479
490
|
};
|
|
480
|
-
return /* @__PURE__ */ s(
|
|
481
|
-
value:
|
|
491
|
+
return /* @__PURE__ */ s(W.Provider, {
|
|
492
|
+
value: B,
|
|
482
493
|
children: e
|
|
483
494
|
});
|
|
484
495
|
}, G = () => {
|
|
485
|
-
let e = r(
|
|
496
|
+
let e = r(W);
|
|
486
497
|
if (e === void 0) throw Error("useAuth must be used within an AuthProvider");
|
|
487
498
|
return e;
|
|
488
|
-
}, K = (e) => !e || e.length !== 9 ? e : `${e.slice(0, 3)}-${e.slice(3, 6)}-${e.slice(6, 9)}`,
|
|
499
|
+
}, K = (e) => !e || e.length !== 9 ? e : `${e.slice(0, 3)}-${e.slice(3, 6)}-${e.slice(6, 9)}`, se = (e) => e.replace(/-/g, ""), q = {
|
|
489
500
|
allyCodeDropdown: "_allyCodeDropdown_1m0tw_1",
|
|
490
501
|
select: "_select_1m0tw_8",
|
|
491
502
|
manageButton: "_manageButton_1m0tw_12",
|
|
@@ -497,7 +508,7 @@ var y = "astrogators_access_token", b = "astrogators_refresh_token", x = () => l
|
|
|
497
508
|
codesList: "_codesList_1m0tw_67",
|
|
498
509
|
codeItem: "_codeItem_1m0tw_71",
|
|
499
510
|
doneButton: "_doneButton_1m0tw_88"
|
|
500
|
-
},
|
|
511
|
+
}, ce = ({ onAllyCodeSelected: e, className: t = "" }) => {
|
|
501
512
|
let { allyCodes: n, selectedAllyCode: r, selectAllyCode: i, removeAllyCode: o, addAllyCode: l, isLoadingAllyCodes: u } = G(), [d, f] = a(!1), [p, h] = a(""), [_, y] = a(""), [b, x] = a(""), [S, C] = a(!1), w = n.map((e) => ({
|
|
502
513
|
value: e.ally_code,
|
|
503
514
|
label: e.player_name ? `${e.player_name} (${K(e.ally_code)})` : K(e.ally_code)
|
|
@@ -606,7 +617,7 @@ var y = "astrogators_access_token", b = "astrogators_refresh_token", x = () => l
|
|
|
606
617
|
extrasGroup: "_extrasGroup_84pn2_64",
|
|
607
618
|
authCluster: "_authCluster_84pn2_70",
|
|
608
619
|
userLink: "_userLink_84pn2_76"
|
|
609
|
-
},
|
|
620
|
+
}, le = ({ hubUrl: t = "/", appName: n, appHref: r = "/", navItems: i, showAllyCode: a = !1, showAuth: l = !0, rightExtras: u, className: d }) => {
|
|
610
621
|
let { user: p, isAuthenticated: h, logout: g, authEnabled: _ } = G(), v = () => {
|
|
611
622
|
g(), window.location.href = t;
|
|
612
623
|
}, y = !!u || a, b = !!(i && i.length > 0), x = !!n || b, S = l ? h ? /* @__PURE__ */ c("div", {
|
|
@@ -669,7 +680,7 @@ var y = "astrogators_access_token", b = "astrogators_refresh_token", x = () => l
|
|
|
669
680
|
}) : void 0,
|
|
670
681
|
rightContent: /* @__PURE__ */ c(o, { children: [y && /* @__PURE__ */ c("div", {
|
|
671
682
|
className: J.extrasGroup,
|
|
672
|
-
children: [u, a && /* @__PURE__ */ s(
|
|
683
|
+
children: [u, a && /* @__PURE__ */ s(ce, {})]
|
|
673
684
|
}), S] })
|
|
674
685
|
});
|
|
675
686
|
}, Y = {
|
|
@@ -678,7 +689,7 @@ var y = "astrogators_access_token", b = "astrogators_refresh_token", x = () => l
|
|
|
678
689
|
defaultContent: "_defaultContent_zjuj8_13",
|
|
679
690
|
copyright: "_copyright_zjuj8_21",
|
|
680
691
|
disclaimer: "_disclaimer_zjuj8_26"
|
|
681
|
-
},
|
|
692
|
+
}, ue = ({ children: e, className: t = "" }) => /* @__PURE__ */ s("footer", {
|
|
682
693
|
className: `${Y.footer} ${t}`,
|
|
683
694
|
children: /* @__PURE__ */ s("div", {
|
|
684
695
|
className: Y.content,
|
|
@@ -708,7 +719,7 @@ var y = "astrogators_access_token", b = "astrogators_refresh_token", x = () => l
|
|
|
708
719
|
"padding-md": "_padding-md_nwtwa_43",
|
|
709
720
|
"padding-lg": "_padding-lg_nwtwa_47",
|
|
710
721
|
hoverable: "_hoverable_nwtwa_52"
|
|
711
|
-
},
|
|
722
|
+
}, de = ({ 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 }) => {
|
|
712
723
|
let m = n ? r === "asymmetric" ? "chamfered-box-asymmetric" : r === "sm" ? "chamfered-box-sm" : r === "lg" ? "chamfered-box-lg" : "chamfered-box" : "", h = l ? u : void 0, g = h ? { color: h } : void 0, _ = h ? {
|
|
713
724
|
...p,
|
|
714
725
|
"--card-edge-color": h
|
|
@@ -750,7 +761,7 @@ var y = "astrogators_access_token", b = "astrogators_refresh_token", x = () => l
|
|
|
750
761
|
warning: "_warning_rk7t5_47",
|
|
751
762
|
error: "_error_rk7t5_52",
|
|
752
763
|
info: "_info_rk7t5_57"
|
|
753
|
-
},
|
|
764
|
+
}, fe = ({ children: e, variant: t = "default", size: n = "md", className: r = "" }) => /* @__PURE__ */ s("span", {
|
|
754
765
|
className: `${Z.badge} ${Z[t]} ${Z[n]} ${r}`,
|
|
755
766
|
children: e
|
|
756
767
|
}), Q = {
|
|
@@ -766,7 +777,7 @@ var y = "astrogators_access_token", b = "astrogators_refresh_token", x = () => l
|
|
|
766
777
|
title: "_title_1b3yt_53",
|
|
767
778
|
closeButton: "_closeButton_1b3yt_60",
|
|
768
779
|
content: "_content_1b3yt_78"
|
|
769
|
-
},
|
|
780
|
+
}, pe = ({ 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", () => {
|
|
770
781
|
document.body.style.overflow = "unset";
|
|
771
782
|
}), [e]), i(() => {
|
|
772
783
|
let n = (n) => {
|
|
@@ -808,7 +819,7 @@ var y = "astrogators_access_token", b = "astrogators_refresh_token", x = () => l
|
|
|
808
819
|
dot: "_dot_1uhnh_34",
|
|
809
820
|
bounce: "_bounce_1uhnh_1",
|
|
810
821
|
visuallyHidden: "_visuallyHidden_1uhnh_91"
|
|
811
|
-
},
|
|
822
|
+
}, me = ({ size: e = "md", variant: t = "spinner", className: n = "" }) => t === "dots" ? /* @__PURE__ */ c("div", {
|
|
812
823
|
className: `${$.dots} ${$[e]} ${n}`,
|
|
813
824
|
children: [
|
|
814
825
|
/* @__PURE__ */ s("span", { className: $.dot }),
|
|
@@ -822,6 +833,10 @@ var y = "astrogators_access_token", b = "astrogators_refresh_token", x = () => l
|
|
|
822
833
|
className: $.visuallyHidden,
|
|
823
834
|
children: "Loading..."
|
|
824
835
|
})
|
|
825
|
-
})
|
|
836
|
+
}), he = async (e) => {
|
|
837
|
+
if (e.length === 0) return {};
|
|
838
|
+
let t = [...new Set(e)], n = await R.get(`/api/v1/users/lookup?ids=${t.join(",")}`);
|
|
839
|
+
return Object.fromEntries(n.users.map((e) => [e.id, e.username]));
|
|
840
|
+
};
|
|
826
841
|
//#endregion
|
|
827
|
-
export {
|
|
842
|
+
export { ce as AllyCodeDropdown, L as ApiClient, oe as AuthProvider, fe as Badge, m as Button, de as Card, u as Container, ue as Footer, v as Input, me as Loader, pe as Modal, le as NavBar, g as Select, f as TopBar, R as apiClient, I as authedFetch, ae as clearAllyCodes, O as clearTokens, M as configureAuthRefresh, he as fetchUsernames, K as formatAllyCode, x as getAccessToken, V as getAllyCodesFromStorage, w as getRefreshToken, re as getSelectedAllyCode, te as initializeApiClient, ee as isAuthenticated, N as refreshAccessToken, C as removeAccessToken, H as removeAllyCodeFromStorage, E as removeRefreshToken, ne as saveAllyCodeToStorage, S as setAccessToken, T as setRefreshToken, ie as setSelectedAllyCode, D as setTokens, se as unformatAllyCode, U as updateAllyCodeLastUsed, G as useAuth };
|
package/dist/src/index.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ export { authedFetch, refreshAccessToken, configureAuthRefresh, } from './servic
|
|
|
14
14
|
export type { AuthRefreshConfig } from './services/tokenRefresh';
|
|
15
15
|
export { getAccessToken, setAccessToken, removeAccessToken, getRefreshToken, setRefreshToken, removeRefreshToken, setTokens, clearTokens, isAuthenticated, } from './services/auth';
|
|
16
16
|
export { getAllyCodesFromStorage, saveAllyCodeToStorage, removeAllyCodeFromStorage, updateAllyCodeLastUsed, getSelectedAllyCode, setSelectedAllyCode, clearAllyCodes, } from './services/allyCodeStorage';
|
|
17
|
+
export { fetchUsernames } from './services/users';
|
|
17
18
|
export type { StoredAllyCode } from './services/allyCodeStorage';
|
|
18
19
|
export { formatAllyCode, unformatAllyCode } from './utils/formatAllyCode';
|
|
19
20
|
export type { User, LoginRequest, LoginResponse, RegisterRequest, RegisterResponse, RefreshTokenRequest, RefreshTokenResponse, ForgotPasswordRequest, ForgotPasswordResponse, ResetPasswordRequest, ResetPasswordResponse, VerifyEmailRequest, VerifyEmailResponse, ResendVerificationRequest, ResendVerificationResponse, AllyCode, AllyCodeCreate, AllyCodeListResponse, AllyCodeMigrationPrompt, ApiResponse, ApiError, PaginatedResponse, ModStat, ParsedMod, ModListResponse, EvaluationScores, ModEvaluation, EvaluationRequest, EvaluationResponse, } from './types';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Batch user-id -> username lookup.
|
|
3
|
+
*
|
|
4
|
+
* Backs "shared by X" / "authored by X" display in any consumer that only
|
|
5
|
+
* has a bare owner_user_id (mod-ledger's Evaluation, navicharts' StarChart —
|
|
6
|
+
* neither service stores a display name locally, since users live in
|
|
7
|
+
* astrogators-table's separate database). Hits astrogators-table's
|
|
8
|
+
* GET /users/lookup directly via the shared `apiClient` — every consumer
|
|
9
|
+
* already points it at astrogators-table via AuthProvider's `apiBaseUrl`,
|
|
10
|
+
* so no per-app backend proxying is needed for this.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Resolve a batch of user ids to usernames in one request.
|
|
14
|
+
*
|
|
15
|
+
* Dedupes ids client-side. Any id the backend doesn't recognize is simply
|
|
16
|
+
* absent from the returned map — callers should treat a missing entry the
|
|
17
|
+
* same way they already treat a null/unknown username.
|
|
18
|
+
*/
|
|
19
|
+
export declare const fetchUsernames: (ids: number[]) => Promise<Record<number, string>>;
|