astrogators-shared-ui 0.17.4 → 0.18.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 CHANGED
@@ -1229,7 +1229,8 @@ function Be(e, t) {
1229
1229
  return i < 24 ? `${i}h ago` : `${Math.floor(i / 24)}d ago`;
1230
1230
  }
1231
1231
  function Ve(e) {
1232
- return `${Math.floor(e / 60)}:${(e % 60).toString().padStart(2, "0")}`;
1232
+ let t = Math.floor(e / 3600), n = Math.floor(e % 3600 / 60), r = (e % 60).toString().padStart(2, "0");
1233
+ return t > 0 ? `${t.toString().padStart(2, "0")}:${n.toString().padStart(2, "0")}:${r}` : `${n}:${r}`;
1233
1234
  }
1234
1235
  var He = {
1235
1236
  rosterRefresh: "_rosterRefresh_1rbul_3",
@@ -1393,6 +1394,6 @@ var He = {
1393
1394
  if (e.length === 0) return {};
1394
1395
  let t = [...new Set(e)], n = await L.get(`/api/v1/users/lookup?ids=${t.join(",")}`);
1395
1396
  return Object.fromEntries(n.users.map((e) => [e.id, e.username]));
1396
- };
1397
+ }, Xe = async (e) => L.post(`/api/v1/users/me/ally-codes/${e}/verify/start`), Ze = async (e) => L.get(`/api/v1/users/me/ally-codes/${e}/verify/status`), Qe = async (e) => L.post(`/api/v1/users/me/ally-codes/${e}/verify/check`);
1397
1398
  //#endregion
1398
- export { je as AllyCodeDropdown, ce as ApiClient, Ce as AuthProvider, Ke as Badge, G as Button, We as Card, p as Container, Re as Footer, ke as Input, Je as Loader, qe as Modal, Le as NavBar, Ue as RosterRefresh, _ as SUITE_NAV, Oe as Select, h as TopBar, L as apiClient, se as authedFetch, ve as clearAllyCodes, k as clearTokens, ne as configureAuthRefresh, Ye as fetchUsernames, q as formatAllyCode, Ve as formatCountdown, Be as formatRelativeTime, S as getAccessToken, z as getAllyCodesFromStorage, T as getRefreshToken, _e as getSelectedAllyCode, le as initializeApiClient, ee as isAuthenticated, g as isSuiteNavGroup, ze as parseBackendTimestamp, M as refreshAccessToken, w as removeAccessToken, he as removeAllyCodeFromStorage, D as removeRefreshToken, me as saveAllyCodeToStorage, C as setAccessToken, E as setRefreshToken, B as setSelectedAllyCode, O as setTokens, Ae as unformatAllyCode, ge as updateAllyCodeLastUsed, V as useAuth };
1399
+ export { je as AllyCodeDropdown, ce as ApiClient, Ce as AuthProvider, Ke as Badge, G as Button, We as Card, p as Container, Re as Footer, ke as Input, Je as Loader, qe as Modal, Le as NavBar, Ue as RosterRefresh, _ as SUITE_NAV, Oe as Select, h as TopBar, L as apiClient, se as authedFetch, Qe as checkAllyCodeVerification, ve as clearAllyCodes, k as clearTokens, ne as configureAuthRefresh, Ye as fetchUsernames, q as formatAllyCode, Ve as formatCountdown, Be as formatRelativeTime, S as getAccessToken, Ze as getAllyCodeVerificationStatus, z as getAllyCodesFromStorage, T as getRefreshToken, _e as getSelectedAllyCode, le as initializeApiClient, ee as isAuthenticated, g as isSuiteNavGroup, ze as parseBackendTimestamp, M as refreshAccessToken, w as removeAccessToken, he as removeAllyCodeFromStorage, D as removeRefreshToken, me as saveAllyCodeToStorage, C as setAccessToken, E as setRefreshToken, B as setSelectedAllyCode, O as setTokens, Xe as startAllyCodeVerification, Ae as unformatAllyCode, ge as updateAllyCodeLastUsed, V as useAuth };
@@ -17,7 +17,8 @@ export type { AuthRefreshConfig } from './services/tokenRefresh';
17
17
  export { getAccessToken, setAccessToken, removeAccessToken, getRefreshToken, setRefreshToken, removeRefreshToken, setTokens, clearTokens, isAuthenticated, } from './services/auth';
18
18
  export { getAllyCodesFromStorage, saveAllyCodeToStorage, removeAllyCodeFromStorage, updateAllyCodeLastUsed, getSelectedAllyCode, setSelectedAllyCode, clearAllyCodes, } from './services/allyCodeStorage';
19
19
  export { fetchUsernames } from './services/users';
20
+ export { startAllyCodeVerification, getAllyCodeVerificationStatus, checkAllyCodeVerification, } from './services/allyCodeVerification';
20
21
  export type { StoredAllyCode } from './services/allyCodeStorage';
21
22
  export { formatAllyCode, unformatAllyCode } from './utils/formatAllyCode';
22
23
  export { parseBackendTimestamp, formatRelativeTime, formatCountdown } from './utils/formatTime';
23
- export type { User, LoginRequest, LoginResponse, RegisterRequest, RegisterResponse, RefreshTokenRequest, RefreshTokenResponse, ForgotPasswordRequest, ForgotPasswordResponse, ResetPasswordRequest, ResetPasswordResponse, VerifyEmailRequest, VerifyEmailResponse, ResendVerificationRequest, ResendVerificationResponse, AllyCode, AllyCodeCreate, AllyCodeListResponse, AllyCodeMigrationPrompt, TokenResponse, UpdateAccountRequest, UpdateAccountResponse, LogoutAllResponse, ApiResponse, ApiError, PaginatedResponse, ModStat, ParsedMod, ModListResponse, EvaluationScores, ModEvaluation, EvaluationRequest, EvaluationResponse, } from './types';
24
+ export type { User, LoginRequest, LoginResponse, RegisterRequest, RegisterResponse, RefreshTokenRequest, RefreshTokenResponse, ForgotPasswordRequest, ForgotPasswordResponse, ResetPasswordRequest, ResetPasswordResponse, VerifyEmailRequest, VerifyEmailResponse, ResendVerificationRequest, ResendVerificationResponse, AllyCode, AllyCodeCreate, AllyCodeListResponse, AllyCodeMigrationPrompt, TokenResponse, UpdateAccountRequest, UpdateAccountResponse, LogoutAllResponse, VerifyChallengeResponse, VerifyStatusResponse, VerifyCheckResponse, ApiResponse, ApiError, PaginatedResponse, ModStat, ParsedMod, ModListResponse, EvaluationScores, ModEvaluation, EvaluationRequest, EvaluationResponse, } from './types';
@@ -0,0 +1,7 @@
1
+ import { VerifyChallengeResponse, VerifyCheckResponse, VerifyStatusResponse } from '../types';
2
+ /** POST .../verify/start — issue or regenerate a challenge. */
3
+ export declare const startAllyCodeVerification: (allyCodeId: number) => Promise<VerifyChallengeResponse>;
4
+ /** GET .../verify/status — resume state without spending a Comlink pull. */
5
+ export declare const getAllyCodeVerificationStatus: (allyCodeId: number) => Promise<VerifyStatusResponse>;
6
+ /** POST .../verify/check — check whether the challenged change has landed yet. */
7
+ export declare const checkAllyCodeVerification: (allyCodeId: number) => Promise<VerifyCheckResponse>;
@@ -1,3 +1,3 @@
1
- export type { User, LoginRequest, LoginResponse, RegisterRequest, RegisterResponse, RefreshTokenRequest, RefreshTokenResponse, ForgotPasswordRequest, ForgotPasswordResponse, ResetPasswordRequest, ResetPasswordResponse, VerifyEmailRequest, VerifyEmailResponse, ResendVerificationRequest, ResendVerificationResponse, AllyCode, AllyCodeCreate, AllyCodeListResponse, AllyCodeMigrationPrompt, TokenResponse, UpdateAccountRequest, UpdateAccountResponse, LogoutAllResponse, } from './user';
1
+ export type { User, LoginRequest, LoginResponse, RegisterRequest, RegisterResponse, RefreshTokenRequest, RefreshTokenResponse, ForgotPasswordRequest, ForgotPasswordResponse, ResetPasswordRequest, ResetPasswordResponse, VerifyEmailRequest, VerifyEmailResponse, ResendVerificationRequest, ResendVerificationResponse, AllyCode, AllyCodeCreate, AllyCodeListResponse, AllyCodeMigrationPrompt, TokenResponse, UpdateAccountRequest, UpdateAccountResponse, LogoutAllResponse, VerifyChallengeResponse, VerifyStatusResponse, VerifyCheckResponse, } from './user';
2
2
  export type { ApiResponse, ApiError, PaginatedResponse } from './api';
3
3
  export type { ModStat, ParsedMod, ModListResponse, EvaluationScores, ModEvaluation, EvaluationRequest, EvaluationResponse, } from './mod';
@@ -74,6 +74,12 @@ export interface AllyCode {
74
74
  player_name: string | null;
75
75
  last_used_at: string | null;
76
76
  created_at: string;
77
+ /**
78
+ * Comlink-verified ownership state (astrogators-table's
79
+ * ally_code_ownerships). 'unverified' until the caller completes the
80
+ * title/portrait challenge via allyCodeVerification.ts.
81
+ */
82
+ ownership_status: 'unverified' | 'verified_by_me' | 'verified_by_other';
77
83
  }
78
84
  export interface AllyCodeCreate {
79
85
  ally_code: string;
@@ -110,3 +116,30 @@ export interface UpdateAccountResponse extends User {
110
116
  export interface LogoutAllResponse {
111
117
  message: string;
112
118
  }
119
+ /**
120
+ * Ally-code ownership verification (astrogators-table's
121
+ * /users/me/ally-codes/{id}/verify/*). The caller is challenged to change
122
+ * their in-game Title or Portrait to `target_id`/`target_display`; `signal`
123
+ * says which.
124
+ */
125
+ export interface VerifyChallengeResponse {
126
+ status: 'already_verified' | 'challenge_issued';
127
+ signal?: 'title' | 'portrait';
128
+ target_id?: string;
129
+ target_display?: string;
130
+ expires_in_seconds?: number;
131
+ verified_at?: string;
132
+ }
133
+ export interface VerifyStatusResponse {
134
+ status: 'unverified' | 'already_verified' | 'challenge_active' | 'challenge_expired';
135
+ owner_user_id?: number;
136
+ verified_at?: string;
137
+ signal?: 'title' | 'portrait';
138
+ target_display?: string;
139
+ expires_in_seconds?: number;
140
+ }
141
+ export interface VerifyCheckResponse {
142
+ status: 'verified' | 'not_matched_yet' | 'pending_floor_wait' | 'already_claimed_by_other' | 'no_active_challenge';
143
+ next_refresh_in_seconds?: number;
144
+ owner_user_id?: number;
145
+ }
@@ -16,5 +16,13 @@ export declare function parseBackendTimestamp(iso: string): Date;
16
16
  * display clock re-renders deterministically.
17
17
  */
18
18
  export declare function formatRelativeTime(date: Date, nowMs: number): string;
19
- /** `m:ss` countdown, e.g. `formatCountdown(125)` → `"2:05"`. */
19
+ /**
20
+ * Countdown label, adaptive by magnitude: `m:ss` under an hour (e.g.
21
+ * `formatCountdown(125)` → `"2:05"`, matching a short cooldown like the
22
+ * roster-sync floor), `HH:MM:SS` at an hour or more (e.g.
23
+ * `formatCountdown(86399)` → `"23:59:59"`, for a day-long TTL like the
24
+ * guild report's) - the hours digits simply aren't there once the
25
+ * remaining time drops under an hour, rather than a `m:ss` display
26
+ * overflowing into unreadable four-digit minutes (`"1439:59"`).
27
+ */
20
28
  export declare function formatCountdown(sec: number): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "astrogators-shared-ui",
3
- "version": "0.17.4",
3
+ "version": "0.18.0",
4
4
  "description": "Shared UI components and utilities for Astrogator's Table applications",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",