@cupcodev/ui 1.2.4 → 1.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -0
- package/dist/index.cjs +155 -58
- package/dist/index.d.cts +5 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +154 -58
- package/package.json +4 -2
- package/postinstall.cjs +20 -0
package/README.md
CHANGED
|
@@ -70,6 +70,10 @@ setCupcodeRuntimeEnv({
|
|
|
70
70
|
});
|
|
71
71
|
```
|
|
72
72
|
|
|
73
|
+
Observação:
|
|
74
|
+
- Ao instalar/atualizar `@cupcodev/ui`, o pacote exibe esse lembrete no `postinstall`.
|
|
75
|
+
- Se o projeto usa `npm install --ignore-scripts`, esse aviso não aparece; nesse caso, aplique a configuração manualmente.
|
|
76
|
+
|
|
73
77
|
### Uso básico
|
|
74
78
|
|
|
75
79
|
```tsx
|
package/dist/index.cjs
CHANGED
|
@@ -374,6 +374,7 @@ __export(src_exports, {
|
|
|
374
374
|
parseAssetId: () => parseAssetId,
|
|
375
375
|
reducer: () => reducer,
|
|
376
376
|
resolveOidcEndpoints: () => resolveOidcEndpoints,
|
|
377
|
+
resolveTelescupImageURL: () => resolveTelescupImageURL,
|
|
377
378
|
responsiveSizeClasses: () => responsiveSizeClasses,
|
|
378
379
|
setCupcodeRuntimeEnv: () => setCupcodeRuntimeEnv,
|
|
379
380
|
sonnerToast: () => import_sonner.toast,
|
|
@@ -1253,6 +1254,31 @@ var isRuntimeDev = () => {
|
|
|
1253
1254
|
return mode === "development";
|
|
1254
1255
|
};
|
|
1255
1256
|
|
|
1257
|
+
// src/utils/parseAssetId.ts
|
|
1258
|
+
var UUID_REGEX = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
|
|
1259
|
+
var UUID_IN_TEXT_REGEX = /[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}/i;
|
|
1260
|
+
var isUuid = (value) => {
|
|
1261
|
+
if (typeof value !== "string") return false;
|
|
1262
|
+
return UUID_REGEX.test(value.trim());
|
|
1263
|
+
};
|
|
1264
|
+
function parseAssetId(input) {
|
|
1265
|
+
var _a65, _b5, _c, _d;
|
|
1266
|
+
const raw = input == null ? void 0 : input.trim();
|
|
1267
|
+
if (!raw) return void 0;
|
|
1268
|
+
if (UUID_REGEX.test(raw)) return raw;
|
|
1269
|
+
const matchFromRaw = (_a65 = raw.match(UUID_IN_TEXT_REGEX)) == null ? void 0 : _a65[0];
|
|
1270
|
+
if (isUuid(matchFromRaw)) return matchFromRaw;
|
|
1271
|
+
try {
|
|
1272
|
+
const url = new URL(raw);
|
|
1273
|
+
const queryParamId = (_c = (_b5 = url.searchParams.get("id")) != null ? _b5 : url.searchParams.get("asset_id")) != null ? _c : url.searchParams.get("assetId");
|
|
1274
|
+
if (isUuid(queryParamId)) return queryParamId;
|
|
1275
|
+
const matchFromPath = (_d = url.pathname.match(UUID_IN_TEXT_REGEX)) == null ? void 0 : _d[0];
|
|
1276
|
+
if (isUuid(matchFromPath)) return matchFromPath;
|
|
1277
|
+
} catch (e) {
|
|
1278
|
+
}
|
|
1279
|
+
return void 0;
|
|
1280
|
+
}
|
|
1281
|
+
|
|
1256
1282
|
// src/hooks/useTelescupAsset.ts
|
|
1257
1283
|
var getApiBase = () => getRuntimeEnvOr("VITE_TELESCUP_API_BASE", "https://cdn.cupcode.com.br").replace(/\/+$/, "");
|
|
1258
1284
|
function buildTelescupImageURL(options) {
|
|
@@ -1265,6 +1291,25 @@ function buildTelescupImageURL(options) {
|
|
|
1265
1291
|
params.set("q", quality.toString());
|
|
1266
1292
|
return `${getApiBase()}/i?${params.toString()}`;
|
|
1267
1293
|
}
|
|
1294
|
+
function resolveTelescupImageURL(value, options) {
|
|
1295
|
+
const raw = value == null ? void 0 : value.trim();
|
|
1296
|
+
if (!raw) return void 0;
|
|
1297
|
+
const parsedId = parseAssetId(raw);
|
|
1298
|
+
if (parsedId) {
|
|
1299
|
+
return buildTelescupImageURL({
|
|
1300
|
+
id: parsedId,
|
|
1301
|
+
width: options == null ? void 0 : options.width,
|
|
1302
|
+
height: options == null ? void 0 : options.height,
|
|
1303
|
+
fit: options == null ? void 0 : options.fit,
|
|
1304
|
+
format: options == null ? void 0 : options.format,
|
|
1305
|
+
quality: options == null ? void 0 : options.quality
|
|
1306
|
+
});
|
|
1307
|
+
}
|
|
1308
|
+
if (raw.startsWith("http://") || raw.startsWith("https://") || raw.startsWith("data:") || raw.startsWith("blob:")) {
|
|
1309
|
+
return raw;
|
|
1310
|
+
}
|
|
1311
|
+
return void 0;
|
|
1312
|
+
}
|
|
1268
1313
|
function buildTelescupVideoURL(id) {
|
|
1269
1314
|
return `${getApiBase()}/i/v?id=${id}`;
|
|
1270
1315
|
}
|
|
@@ -1299,31 +1344,6 @@ function useTelescupImage(options, lang) {
|
|
|
1299
1344
|
return { url, meta, loading };
|
|
1300
1345
|
}
|
|
1301
1346
|
|
|
1302
|
-
// src/utils/parseAssetId.ts
|
|
1303
|
-
var UUID_REGEX = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
|
|
1304
|
-
var UUID_IN_TEXT_REGEX = /[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}/i;
|
|
1305
|
-
var isUuid = (value) => {
|
|
1306
|
-
if (typeof value !== "string") return false;
|
|
1307
|
-
return UUID_REGEX.test(value.trim());
|
|
1308
|
-
};
|
|
1309
|
-
function parseAssetId(input) {
|
|
1310
|
-
var _a65, _b5, _c, _d;
|
|
1311
|
-
const raw = input == null ? void 0 : input.trim();
|
|
1312
|
-
if (!raw) return void 0;
|
|
1313
|
-
if (UUID_REGEX.test(raw)) return raw;
|
|
1314
|
-
const matchFromRaw = (_a65 = raw.match(UUID_IN_TEXT_REGEX)) == null ? void 0 : _a65[0];
|
|
1315
|
-
if (isUuid(matchFromRaw)) return matchFromRaw;
|
|
1316
|
-
try {
|
|
1317
|
-
const url = new URL(raw);
|
|
1318
|
-
const queryParamId = (_c = (_b5 = url.searchParams.get("id")) != null ? _b5 : url.searchParams.get("asset_id")) != null ? _c : url.searchParams.get("assetId");
|
|
1319
|
-
if (isUuid(queryParamId)) return queryParamId;
|
|
1320
|
-
const matchFromPath = (_d = url.pathname.match(UUID_IN_TEXT_REGEX)) == null ? void 0 : _d[0];
|
|
1321
|
-
if (isUuid(matchFromPath)) return matchFromPath;
|
|
1322
|
-
} catch (e) {
|
|
1323
|
-
}
|
|
1324
|
-
return void 0;
|
|
1325
|
-
}
|
|
1326
|
-
|
|
1327
1347
|
// src/components/cupcode/DockWrapper.tsx
|
|
1328
1348
|
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
1329
1349
|
var getImageUrl = (rawId, width = 60, height = 60, format = "avif", quality = 60) => {
|
|
@@ -6736,21 +6756,13 @@ var extractSharedFilesFromMessages = (messages) => {
|
|
|
6736
6756
|
};
|
|
6737
6757
|
var resolveTelescupImageUrl = (value, options) => {
|
|
6738
6758
|
var _a65, _b5, _c;
|
|
6739
|
-
|
|
6740
|
-
|
|
6741
|
-
|
|
6742
|
-
|
|
6743
|
-
|
|
6744
|
-
|
|
6745
|
-
|
|
6746
|
-
if (parsedId2) {
|
|
6747
|
-
return buildTelescupImageURL({ id: parsedId2, width, height, fit: "cover", format: "avif", quality });
|
|
6748
|
-
}
|
|
6749
|
-
return raw;
|
|
6750
|
-
}
|
|
6751
|
-
const parsedId = parseAssetId(raw);
|
|
6752
|
-
if (!parsedId) return void 0;
|
|
6753
|
-
return buildTelescupImageURL({ id: parsedId, width, height, fit: "cover", format: "avif", quality });
|
|
6759
|
+
return resolveTelescupImageURL(value, {
|
|
6760
|
+
width: (_a65 = options == null ? void 0 : options.width) != null ? _a65 : 96,
|
|
6761
|
+
height: (_b5 = options == null ? void 0 : options.height) != null ? _b5 : 96,
|
|
6762
|
+
fit: "cover",
|
|
6763
|
+
format: "avif",
|
|
6764
|
+
quality: (_c = options == null ? void 0 : options.quality) != null ? _c : 72
|
|
6765
|
+
});
|
|
6754
6766
|
};
|
|
6755
6767
|
var resolveGroupAvatarFromTelescup = (asset, fallbackId) => {
|
|
6756
6768
|
var _a65, _b5;
|
|
@@ -22563,8 +22575,22 @@ var buildHandle2 = (value, email, fallbackId) => {
|
|
|
22563
22575
|
var resolveCurrentUserId = (user) => {
|
|
22564
22576
|
const sub = toStringOrUndefined(user == null ? void 0 : user.sub);
|
|
22565
22577
|
if (sub) return sub;
|
|
22578
|
+
const id = toStringOrUndefined(user == null ? void 0 : user.id);
|
|
22579
|
+
if (id) return id;
|
|
22580
|
+
const userId = toStringOrUndefined(user == null ? void 0 : user.userId);
|
|
22581
|
+
if (userId) return userId;
|
|
22566
22582
|
return null;
|
|
22567
22583
|
};
|
|
22584
|
+
var resolveUserIdFromClaims = (claims) => {
|
|
22585
|
+
var _a65, _b5, _c, _d, _e;
|
|
22586
|
+
return (_e = (_d = (_c = (_b5 = (_a65 = toStringOrUndefined(claims.sub)) != null ? _a65 : toStringOrUndefined(claims.user_id)) != null ? _b5 : toStringOrUndefined(claims.userId)) != null ? _c : toStringOrUndefined(claims.uid)) != null ? _d : toStringOrUndefined(claims.id)) != null ? _e : toStringOrUndefined(claims["https://cupcode.com/user_id"]);
|
|
22587
|
+
};
|
|
22588
|
+
var resolveEmailFromClaims = (claims) => {
|
|
22589
|
+
var _a65, _b5;
|
|
22590
|
+
const candidate = (_b5 = (_a65 = toStringOrUndefined(claims.email)) != null ? _a65 : toStringOrUndefined(claims["https://cupcode.com/email"])) != null ? _b5 : toStringOrUndefined(claims.preferred_username);
|
|
22591
|
+
if (!candidate || !candidate.includes("@")) return void 0;
|
|
22592
|
+
return candidate.toLowerCase();
|
|
22593
|
+
};
|
|
22568
22594
|
var formatMessageTime = (rawTimestamp) => {
|
|
22569
22595
|
if (!rawTimestamp) return "";
|
|
22570
22596
|
const parsed = new Date(rawTimestamp);
|
|
@@ -22572,18 +22598,7 @@ var formatMessageTime = (rawTimestamp) => {
|
|
|
22572
22598
|
return parsed.toLocaleTimeString("pt-BR", { hour: "2-digit", minute: "2-digit" });
|
|
22573
22599
|
};
|
|
22574
22600
|
var resolveChatAvatarUrl = (value) => {
|
|
22575
|
-
|
|
22576
|
-
if (!raw) return void 0;
|
|
22577
|
-
if (raw.startsWith("http://") || raw.startsWith("https://") || raw.startsWith("data:") || raw.startsWith("blob:")) {
|
|
22578
|
-
const parsedId2 = parseAssetId(raw);
|
|
22579
|
-
if (parsedId2) {
|
|
22580
|
-
return buildTelescupImageURL({ id: parsedId2, width: 72, height: 72, fit: "cover", format: "avif", quality: 70 });
|
|
22581
|
-
}
|
|
22582
|
-
return raw;
|
|
22583
|
-
}
|
|
22584
|
-
const parsedId = parseAssetId(raw);
|
|
22585
|
-
if (!parsedId) return void 0;
|
|
22586
|
-
return buildTelescupImageURL({ id: parsedId, width: 72, height: 72, fit: "cover", format: "avif", quality: 70 });
|
|
22601
|
+
return resolveTelescupImageURL(value, { width: 72, height: 72, fit: "cover", format: "avif", quality: 70 });
|
|
22587
22602
|
};
|
|
22588
22603
|
var isGenericRecord = (value) => typeof value === "object" && value !== null;
|
|
22589
22604
|
var buildExternalUrl = (baseUrl, target) => {
|
|
@@ -22829,7 +22844,7 @@ var MainNavbar = ({
|
|
|
22829
22844
|
ctaHref = "/login",
|
|
22830
22845
|
pathname,
|
|
22831
22846
|
onNavigate,
|
|
22832
|
-
authStatus
|
|
22847
|
+
authStatus,
|
|
22833
22848
|
authUser,
|
|
22834
22849
|
presenceStatus,
|
|
22835
22850
|
onPresenceStatusChange,
|
|
@@ -22846,6 +22861,8 @@ var MainNavbar = ({
|
|
|
22846
22861
|
const [isChatSending, setIsChatSending] = (0, import_react19.useState)(false);
|
|
22847
22862
|
const [chatError, setChatError] = (0, import_react19.useState)(null);
|
|
22848
22863
|
const [resolvedSenderId, setResolvedSenderId] = (0, import_react19.useState)(null);
|
|
22864
|
+
const [tokenDerivedUserId, setTokenDerivedUserId] = (0, import_react19.useState)(null);
|
|
22865
|
+
const [tokenDerivedEmail, setTokenDerivedEmail] = (0, import_react19.useState)(void 0);
|
|
22849
22866
|
const [persistedProfileAvatarValue, setPersistedProfileAvatarValue] = (0, import_react19.useState)(void 0);
|
|
22850
22867
|
const [accountsLanguage, setAccountsLanguage] = (0, import_react19.useState)("pt-BR");
|
|
22851
22868
|
const [accountsRecentActivity, setAccountsRecentActivity] = (0, import_react19.useState)([]);
|
|
@@ -22865,8 +22882,17 @@ var MainNavbar = ({
|
|
|
22865
22882
|
if (typeof window !== "undefined") return window.location.pathname || "/";
|
|
22866
22883
|
return "/";
|
|
22867
22884
|
}, [pathname]);
|
|
22868
|
-
const currentUserId = (0, import_react19.useMemo)(() =>
|
|
22869
|
-
|
|
22885
|
+
const currentUserId = (0, import_react19.useMemo)(() => {
|
|
22886
|
+
var _a66;
|
|
22887
|
+
return (_a66 = resolveCurrentUserId(authUser)) != null ? _a66 : tokenDerivedUserId;
|
|
22888
|
+
}, [authUser, tokenDerivedUserId]);
|
|
22889
|
+
const authEmail = (0, import_react19.useMemo)(
|
|
22890
|
+
() => {
|
|
22891
|
+
var _a66, _b6;
|
|
22892
|
+
return (_b6 = (_a66 = toStringOrUndefined(authUser == null ? void 0 : authUser.email)) == null ? void 0 : _a66.toLowerCase()) != null ? _b6 : tokenDerivedEmail;
|
|
22893
|
+
},
|
|
22894
|
+
[authUser == null ? void 0 : authUser.email, tokenDerivedEmail]
|
|
22895
|
+
);
|
|
22870
22896
|
const isChatSuperAdmin = (0, import_react19.useMemo)(() => {
|
|
22871
22897
|
var _a66, _b6;
|
|
22872
22898
|
const roleTokens = `${(_a66 = authUser == null ? void 0 : authUser.role) != null ? _a66 : ""} ${(_b6 = authUser == null ? void 0 : authUser.jobTitle) != null ? _b6 : ""}`.toLowerCase();
|
|
@@ -22880,7 +22906,77 @@ var MainNavbar = ({
|
|
|
22880
22906
|
}, []);
|
|
22881
22907
|
const resolvedProfileAvatarUrl = (_b5 = (_a65 = resolveChatAvatarUrl(persistedProfileAvatarValue)) != null ? _a65 : authUser == null ? void 0 : authUser.picture) != null ? _b5 : void 0;
|
|
22882
22908
|
const effectiveCurrentUserId = resolvedSenderId != null ? resolvedSenderId : currentUserId;
|
|
22883
|
-
const
|
|
22909
|
+
const hasStoredAccessToken = (() => {
|
|
22910
|
+
if (typeof window === "undefined") return false;
|
|
22911
|
+
try {
|
|
22912
|
+
return Boolean(sessionStorage.getItem(ACCESS_TOKEN_STORAGE_KEY));
|
|
22913
|
+
} catch (e) {
|
|
22914
|
+
return false;
|
|
22915
|
+
}
|
|
22916
|
+
})();
|
|
22917
|
+
const resolvedAuthStatus = (0, import_react19.useMemo)(() => {
|
|
22918
|
+
if (authStatus) return authStatus;
|
|
22919
|
+
if ((authUser == null ? void 0 : authUser.sub) || (authUser == null ? void 0 : authUser.id) || (authUser == null ? void 0 : authUser.userId) || (authUser == null ? void 0 : authUser.email)) {
|
|
22920
|
+
return "authenticated";
|
|
22921
|
+
}
|
|
22922
|
+
if (tokenDerivedUserId || tokenDerivedEmail || hasStoredAccessToken) {
|
|
22923
|
+
return "authenticated";
|
|
22924
|
+
}
|
|
22925
|
+
return "unauthenticated";
|
|
22926
|
+
}, [
|
|
22927
|
+
authStatus,
|
|
22928
|
+
authUser == null ? void 0 : authUser.email,
|
|
22929
|
+
authUser == null ? void 0 : authUser.id,
|
|
22930
|
+
authUser == null ? void 0 : authUser.sub,
|
|
22931
|
+
authUser == null ? void 0 : authUser.userId,
|
|
22932
|
+
hasStoredAccessToken,
|
|
22933
|
+
tokenDerivedEmail,
|
|
22934
|
+
tokenDerivedUserId
|
|
22935
|
+
]);
|
|
22936
|
+
const isAuthenticated = resolvedAuthStatus === "authenticated";
|
|
22937
|
+
(0, import_react19.useEffect)(() => {
|
|
22938
|
+
if (authStatus === "unauthenticated") {
|
|
22939
|
+
setTokenDerivedUserId(null);
|
|
22940
|
+
setTokenDerivedEmail(void 0);
|
|
22941
|
+
return;
|
|
22942
|
+
}
|
|
22943
|
+
let canceled = false;
|
|
22944
|
+
const resolveIdentityFromToken = async () => {
|
|
22945
|
+
var _a66, _b6;
|
|
22946
|
+
try {
|
|
22947
|
+
let token = null;
|
|
22948
|
+
if (typeof window !== "undefined") {
|
|
22949
|
+
try {
|
|
22950
|
+
token = sessionStorage.getItem(ACCESS_TOKEN_STORAGE_KEY);
|
|
22951
|
+
} catch (e) {
|
|
22952
|
+
token = null;
|
|
22953
|
+
}
|
|
22954
|
+
}
|
|
22955
|
+
if (!token && getAccessToken) {
|
|
22956
|
+
token = await getAccessToken();
|
|
22957
|
+
}
|
|
22958
|
+
if (!token) {
|
|
22959
|
+
if (!canceled) {
|
|
22960
|
+
setTokenDerivedUserId(null);
|
|
22961
|
+
setTokenDerivedEmail(void 0);
|
|
22962
|
+
}
|
|
22963
|
+
return;
|
|
22964
|
+
}
|
|
22965
|
+
const claims = (_a66 = decodeJwt(token)) != null ? _a66 : {};
|
|
22966
|
+
if (canceled) return;
|
|
22967
|
+
setTokenDerivedUserId((_b6 = resolveUserIdFromClaims(claims)) != null ? _b6 : null);
|
|
22968
|
+
setTokenDerivedEmail(resolveEmailFromClaims(claims));
|
|
22969
|
+
} catch (error) {
|
|
22970
|
+
if (isRuntimeDev()) {
|
|
22971
|
+
console.warn("[chat] Falha ao resolver identidade via access token:", error.message);
|
|
22972
|
+
}
|
|
22973
|
+
}
|
|
22974
|
+
};
|
|
22975
|
+
void resolveIdentityFromToken();
|
|
22976
|
+
return () => {
|
|
22977
|
+
canceled = true;
|
|
22978
|
+
};
|
|
22979
|
+
}, [authStatus, getAccessToken]);
|
|
22884
22980
|
(0, import_react19.useEffect)(() => {
|
|
22885
22981
|
if (!isAuthenticated) {
|
|
22886
22982
|
setResolvedSenderId(null);
|
|
@@ -24241,8 +24337,8 @@ var MainNavbar = ({
|
|
|
24241
24337
|
actions: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
24242
24338
|
UserMenuCupcode,
|
|
24243
24339
|
{
|
|
24244
|
-
isAuthenticated:
|
|
24245
|
-
isLoading:
|
|
24340
|
+
isAuthenticated: resolvedAuthStatus === "authenticated",
|
|
24341
|
+
isLoading: resolvedAuthStatus === "loading",
|
|
24246
24342
|
loginLabel: ctaLabel,
|
|
24247
24343
|
displayName: authUser == null ? void 0 : authUser.name,
|
|
24248
24344
|
username: (_c = authUser == null ? void 0 : authUser.preferredUsername) != null ? _c : authUser == null ? void 0 : authUser.nickname,
|
|
@@ -28041,6 +28137,7 @@ var useAuth = () => {
|
|
|
28041
28137
|
parseAssetId,
|
|
28042
28138
|
reducer,
|
|
28043
28139
|
resolveOidcEndpoints,
|
|
28140
|
+
resolveTelescupImageURL,
|
|
28044
28141
|
responsiveSizeClasses,
|
|
28045
28142
|
setCupcodeRuntimeEnv,
|
|
28046
28143
|
sonnerToast,
|
package/dist/index.d.cts
CHANGED
|
@@ -442,6 +442,8 @@ declare const UserMenuCupcode: React.FC<UserMenuCupcodeProps>;
|
|
|
442
442
|
type MainNavbarAuthStatus = "loading" | "authenticated" | "unauthenticated";
|
|
443
443
|
type MainNavbarAuthUser = {
|
|
444
444
|
sub?: string;
|
|
445
|
+
id?: string;
|
|
446
|
+
userId?: string;
|
|
445
447
|
name?: string;
|
|
446
448
|
email?: string;
|
|
447
449
|
picture?: string;
|
|
@@ -1601,7 +1603,9 @@ interface TelescupMeta {
|
|
|
1601
1603
|
title?: string;
|
|
1602
1604
|
description?: string;
|
|
1603
1605
|
}
|
|
1606
|
+
type ResolveTelescupImageOptions = Omit<TelescupImageOptions, "id">;
|
|
1604
1607
|
declare function buildTelescupImageURL(options: TelescupImageOptions): string;
|
|
1608
|
+
declare function resolveTelescupImageURL(value?: string, options?: ResolveTelescupImageOptions): string | undefined;
|
|
1605
1609
|
declare function buildTelescupVideoURL(id: string): string;
|
|
1606
1610
|
declare function useTelescupMeta(id: string, lang?: string): {
|
|
1607
1611
|
meta: TelescupMeta;
|
|
@@ -1699,4 +1703,4 @@ declare const getRuntimeEnv: (key: string) => string | undefined;
|
|
|
1699
1703
|
declare const getRuntimeEnvOr: (key: string, fallback: string) => string;
|
|
1700
1704
|
declare const isRuntimeDev: () => boolean;
|
|
1701
1705
|
|
|
1702
|
-
export { Accordion, AccordionContent, AccordionCupcode, AccordionItem, AccordionTrigger, type AccountsAuthConfig, Alert, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AlertTitle, AspectRatio, type AuthContextValue, AuthProvider, type AuthStatus, type AuthUser, type UserPresenceStatus as AuthUserPresenceStatus, Avatar, AvatarFallback, AvatarImage, AvatarWithStatus, BackgroundRainbow, BackgroundStars, Badge, type BadgeProps, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, ButtonProps, Calendar, type CalendarProps, Card, CardContent, CardDescription, CardFooter, CardGlass, CardHeader, CardTitle, Checkbox, ChipTag, type ChipTagProps, type ChipVariant, Collapsible, CollapsibleContent, CollapsibleTrigger, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, AccordionContent$1 as CupcodeAccordionContent, AccordionItem$1 as CupcodeAccordionItem, AccordionTrigger$1 as CupcodeAccordionTrigger, Avatar$1 as CupcodeAvatar, AvatarFallback$1 as CupcodeAvatarFallback, AvatarImage$1 as CupcodeAvatarImage, type StatusType as CupcodeAvatarStatus, Badge$1 as CupcodeBadge, type CupcodeRuntimeEnv, type CupcodeRuntimeEnvValue, Select$1 as CupcodeSelect, SelectContent$1 as CupcodeSelectContent, SelectGroup$1 as CupcodeSelectGroup, SelectItem$1 as CupcodeSelectItem, SelectTrigger$1 as CupcodeSelectTrigger, SelectValue$1 as CupcodeSelectValue, Skeleton$1 as CupcodeSkeleton, type SkeletonProps as CupcodeSkeletonProps, SkeletonText as CupcodeSkeletonText, Switch$1 as CupcodeSwitch, Tabs$1 as CupcodeTabs, TabsContent$1 as CupcodeTabsContent, TabsList$1 as CupcodeTabsList, TabsTrigger$1 as CupcodeTabsTrigger, TooltipContent$1 as CupcodeTooltipContent, TooltipProvider$1 as CupcodeTooltipProvider, TooltipTrigger$1 as CupcodeTooltipTrigger, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, Dock, type DockButton, type DockCard, type DockCategory, type DockItem, type DockProps, DockWrapper, Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EmptyState, type EnqueueResult, ErrorBoundary, Eyebrow, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, HeroTitle, HoverCard, HoverCardContent, HoverCardTrigger, Input, InputField, type InputFieldProps, InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot, JellyButton, JellyButtonOriginal, type JellyButtonOriginalProps, Label, LoadingScreen, LoadingSpinner, type LoadingSpinnerProps, MainNavbar, type MainNavbarAuthUser, type MainNavbarProps, Menubar, MenubarCheckboxItem, MenubarContent, MenubarGroup, MenubarItem, MenubarLabel, MenubarMenu, MenubarPortal, MenubarRadioGroup, MenubarRadioItem, MenubarSeparator, MenubarShortcut, MenubarSub, MenubarSubContent, MenubarSubTrigger, MenubarTrigger, Modal, ModalClose, ModalContent, ModalDescription, ModalFooter, ModalHeader, ModalTitle, ModalTrigger, type NavItem, NavbarCupcode, type NavbarCupcodeProps, NavigationMenu, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, NavigationMenuViewport, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, ParticleSystem, Popover, PopoverContent, PopoverTrigger, PricingCard, Progress, ProgressCupcode, RadioGroup, RadioGroupItem, ResizableHandle, ResizablePanel, ResizablePanelGroup, type ResponsiveSize, ScrollArea, ScrollBar, ScrollbarArea, type ScrollbarAreaProps, type ScrollbarColor, type ScrollbarThemeMode, ScrollbarThemeProvider, type ScrollbarThemeProviderProps, Select, SelectContent, SelectField, type SelectFieldProps, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, Skeleton, Slider, Toaster$1 as SonnerToaster, type StatusType, Switch, SwitchField, type SwitchFieldProps, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, TagGroup, type TagGroupProps, type TelescupAsset, TelescupAssetPicker, type TelescupAssetPickerProps, type TelescupClient, type TelescupClientConfig, TelescupClientError, type TelescupFilters, TelescupImage, type TelescupLanguage, type TelescupMeta$1 as TelescupMeta, TelescupUpload, type TelescupUploadLabels, type TelescupUploadProps, TelescupUploader, type TelescupUploaderProps, TelescupVideo, Textarea, TextareaField, type TextareaFieldProps, type TextareaProps, ThemeToggle, Timeline, Toast$1 as Toast, ToastAction, type ToastActionElement, ToastClose, ToastCupcode, type ToastCupcodeProps, ToastDescription, type ToastProps, ToastProvider, ToastTitle, type ToastVariant, ToastViewport, Toaster, Toggle, ToggleGroup, ToggleGroupItem, type TokenResponse, Tooltip, TooltipContent, TooltipCupcode, TooltipProvider, TooltipTrigger, type UploadConflictPolicy, type UploadPolicy, type UploadQueueItem, type UploadQueueStatus, type UseTelescupAssetsOptions, type UseTelescupUploadQueueOptions, type UserMenuChatMessage, type UserMenuChatMessageLog, type UserMenuChatOpenRequest, type UserMenuChatReaction, type UserMenuChatUser, UserMenuCupcode, type UserMenuCupcodeProps, type UserMenuLanguage, type UserMenuNotification, type UserMenuNotificationKind, type UserMenuRecentActivity, type UserMenuTabId, type UserPresenceStatus$1 as UserPresenceStatus, badgeVariants, buildAuthorizeUrl, buildLogoutUrl, buildTelescupImageURL, buildTelescupVideoURL, cn, createTelescupClient, decodeJwt, exchangeCodeForToken, generateCodeChallenge, generateCodeVerifier, generateNonce, generateState, getAccountsConfig, getMainNavItems, getRuntimeEnv, getRuntimeEnvOr, getSupabase, getSupabasePublic, isRuntimeDev, navigationMenuTriggerStyle, parseAssetId, reducer, resolveOidcEndpoints, responsiveSizeClasses, setCupcodeRuntimeEnv, toast, toggleVariants, useActiveSection, useAuth, useBreakpoint, useFormField, useIsMobile, useSidebar, useTelescupAssets, useTelescupImage, useTelescupMeta, useTelescupUploadQueue, useToast };
|
|
1706
|
+
export { Accordion, AccordionContent, AccordionCupcode, AccordionItem, AccordionTrigger, type AccountsAuthConfig, Alert, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AlertTitle, AspectRatio, type AuthContextValue, AuthProvider, type AuthStatus, type AuthUser, type UserPresenceStatus as AuthUserPresenceStatus, Avatar, AvatarFallback, AvatarImage, AvatarWithStatus, BackgroundRainbow, BackgroundStars, Badge, type BadgeProps, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, ButtonProps, Calendar, type CalendarProps, Card, CardContent, CardDescription, CardFooter, CardGlass, CardHeader, CardTitle, Checkbox, ChipTag, type ChipTagProps, type ChipVariant, Collapsible, CollapsibleContent, CollapsibleTrigger, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, AccordionContent$1 as CupcodeAccordionContent, AccordionItem$1 as CupcodeAccordionItem, AccordionTrigger$1 as CupcodeAccordionTrigger, Avatar$1 as CupcodeAvatar, AvatarFallback$1 as CupcodeAvatarFallback, AvatarImage$1 as CupcodeAvatarImage, type StatusType as CupcodeAvatarStatus, Badge$1 as CupcodeBadge, type CupcodeRuntimeEnv, type CupcodeRuntimeEnvValue, Select$1 as CupcodeSelect, SelectContent$1 as CupcodeSelectContent, SelectGroup$1 as CupcodeSelectGroup, SelectItem$1 as CupcodeSelectItem, SelectTrigger$1 as CupcodeSelectTrigger, SelectValue$1 as CupcodeSelectValue, Skeleton$1 as CupcodeSkeleton, type SkeletonProps as CupcodeSkeletonProps, SkeletonText as CupcodeSkeletonText, Switch$1 as CupcodeSwitch, Tabs$1 as CupcodeTabs, TabsContent$1 as CupcodeTabsContent, TabsList$1 as CupcodeTabsList, TabsTrigger$1 as CupcodeTabsTrigger, TooltipContent$1 as CupcodeTooltipContent, TooltipProvider$1 as CupcodeTooltipProvider, TooltipTrigger$1 as CupcodeTooltipTrigger, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, Dock, type DockButton, type DockCard, type DockCategory, type DockItem, type DockProps, DockWrapper, Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EmptyState, type EnqueueResult, ErrorBoundary, Eyebrow, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, HeroTitle, HoverCard, HoverCardContent, HoverCardTrigger, Input, InputField, type InputFieldProps, InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot, JellyButton, JellyButtonOriginal, type JellyButtonOriginalProps, Label, LoadingScreen, LoadingSpinner, type LoadingSpinnerProps, MainNavbar, type MainNavbarAuthUser, type MainNavbarProps, Menubar, MenubarCheckboxItem, MenubarContent, MenubarGroup, MenubarItem, MenubarLabel, MenubarMenu, MenubarPortal, MenubarRadioGroup, MenubarRadioItem, MenubarSeparator, MenubarShortcut, MenubarSub, MenubarSubContent, MenubarSubTrigger, MenubarTrigger, Modal, ModalClose, ModalContent, ModalDescription, ModalFooter, ModalHeader, ModalTitle, ModalTrigger, type NavItem, NavbarCupcode, type NavbarCupcodeProps, NavigationMenu, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, NavigationMenuViewport, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, ParticleSystem, Popover, PopoverContent, PopoverTrigger, PricingCard, Progress, ProgressCupcode, RadioGroup, RadioGroupItem, ResizableHandle, ResizablePanel, ResizablePanelGroup, type ResolveTelescupImageOptions, type ResponsiveSize, ScrollArea, ScrollBar, ScrollbarArea, type ScrollbarAreaProps, type ScrollbarColor, type ScrollbarThemeMode, ScrollbarThemeProvider, type ScrollbarThemeProviderProps, Select, SelectContent, SelectField, type SelectFieldProps, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, Skeleton, Slider, Toaster$1 as SonnerToaster, type StatusType, Switch, SwitchField, type SwitchFieldProps, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, TagGroup, type TagGroupProps, type TelescupAsset, TelescupAssetPicker, type TelescupAssetPickerProps, type TelescupClient, type TelescupClientConfig, TelescupClientError, type TelescupFilters, TelescupImage, type TelescupLanguage, type TelescupMeta$1 as TelescupMeta, TelescupUpload, type TelescupUploadLabels, type TelescupUploadProps, TelescupUploader, type TelescupUploaderProps, TelescupVideo, Textarea, TextareaField, type TextareaFieldProps, type TextareaProps, ThemeToggle, Timeline, Toast$1 as Toast, ToastAction, type ToastActionElement, ToastClose, ToastCupcode, type ToastCupcodeProps, ToastDescription, type ToastProps, ToastProvider, ToastTitle, type ToastVariant, ToastViewport, Toaster, Toggle, ToggleGroup, ToggleGroupItem, type TokenResponse, Tooltip, TooltipContent, TooltipCupcode, TooltipProvider, TooltipTrigger, type UploadConflictPolicy, type UploadPolicy, type UploadQueueItem, type UploadQueueStatus, type UseTelescupAssetsOptions, type UseTelescupUploadQueueOptions, type UserMenuChatMessage, type UserMenuChatMessageLog, type UserMenuChatOpenRequest, type UserMenuChatReaction, type UserMenuChatUser, UserMenuCupcode, type UserMenuCupcodeProps, type UserMenuLanguage, type UserMenuNotification, type UserMenuNotificationKind, type UserMenuRecentActivity, type UserMenuTabId, type UserPresenceStatus$1 as UserPresenceStatus, badgeVariants, buildAuthorizeUrl, buildLogoutUrl, buildTelescupImageURL, buildTelescupVideoURL, cn, createTelescupClient, decodeJwt, exchangeCodeForToken, generateCodeChallenge, generateCodeVerifier, generateNonce, generateState, getAccountsConfig, getMainNavItems, getRuntimeEnv, getRuntimeEnvOr, getSupabase, getSupabasePublic, isRuntimeDev, navigationMenuTriggerStyle, parseAssetId, reducer, resolveOidcEndpoints, resolveTelescupImageURL, responsiveSizeClasses, setCupcodeRuntimeEnv, toast, toggleVariants, useActiveSection, useAuth, useBreakpoint, useFormField, useIsMobile, useSidebar, useTelescupAssets, useTelescupImage, useTelescupMeta, useTelescupUploadQueue, useToast };
|
package/dist/index.d.ts
CHANGED
|
@@ -442,6 +442,8 @@ declare const UserMenuCupcode: React.FC<UserMenuCupcodeProps>;
|
|
|
442
442
|
type MainNavbarAuthStatus = "loading" | "authenticated" | "unauthenticated";
|
|
443
443
|
type MainNavbarAuthUser = {
|
|
444
444
|
sub?: string;
|
|
445
|
+
id?: string;
|
|
446
|
+
userId?: string;
|
|
445
447
|
name?: string;
|
|
446
448
|
email?: string;
|
|
447
449
|
picture?: string;
|
|
@@ -1601,7 +1603,9 @@ interface TelescupMeta {
|
|
|
1601
1603
|
title?: string;
|
|
1602
1604
|
description?: string;
|
|
1603
1605
|
}
|
|
1606
|
+
type ResolveTelescupImageOptions = Omit<TelescupImageOptions, "id">;
|
|
1604
1607
|
declare function buildTelescupImageURL(options: TelescupImageOptions): string;
|
|
1608
|
+
declare function resolveTelescupImageURL(value?: string, options?: ResolveTelescupImageOptions): string | undefined;
|
|
1605
1609
|
declare function buildTelescupVideoURL(id: string): string;
|
|
1606
1610
|
declare function useTelescupMeta(id: string, lang?: string): {
|
|
1607
1611
|
meta: TelescupMeta;
|
|
@@ -1699,4 +1703,4 @@ declare const getRuntimeEnv: (key: string) => string | undefined;
|
|
|
1699
1703
|
declare const getRuntimeEnvOr: (key: string, fallback: string) => string;
|
|
1700
1704
|
declare const isRuntimeDev: () => boolean;
|
|
1701
1705
|
|
|
1702
|
-
export { Accordion, AccordionContent, AccordionCupcode, AccordionItem, AccordionTrigger, type AccountsAuthConfig, Alert, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AlertTitle, AspectRatio, type AuthContextValue, AuthProvider, type AuthStatus, type AuthUser, type UserPresenceStatus as AuthUserPresenceStatus, Avatar, AvatarFallback, AvatarImage, AvatarWithStatus, BackgroundRainbow, BackgroundStars, Badge, type BadgeProps, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, ButtonProps, Calendar, type CalendarProps, Card, CardContent, CardDescription, CardFooter, CardGlass, CardHeader, CardTitle, Checkbox, ChipTag, type ChipTagProps, type ChipVariant, Collapsible, CollapsibleContent, CollapsibleTrigger, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, AccordionContent$1 as CupcodeAccordionContent, AccordionItem$1 as CupcodeAccordionItem, AccordionTrigger$1 as CupcodeAccordionTrigger, Avatar$1 as CupcodeAvatar, AvatarFallback$1 as CupcodeAvatarFallback, AvatarImage$1 as CupcodeAvatarImage, type StatusType as CupcodeAvatarStatus, Badge$1 as CupcodeBadge, type CupcodeRuntimeEnv, type CupcodeRuntimeEnvValue, Select$1 as CupcodeSelect, SelectContent$1 as CupcodeSelectContent, SelectGroup$1 as CupcodeSelectGroup, SelectItem$1 as CupcodeSelectItem, SelectTrigger$1 as CupcodeSelectTrigger, SelectValue$1 as CupcodeSelectValue, Skeleton$1 as CupcodeSkeleton, type SkeletonProps as CupcodeSkeletonProps, SkeletonText as CupcodeSkeletonText, Switch$1 as CupcodeSwitch, Tabs$1 as CupcodeTabs, TabsContent$1 as CupcodeTabsContent, TabsList$1 as CupcodeTabsList, TabsTrigger$1 as CupcodeTabsTrigger, TooltipContent$1 as CupcodeTooltipContent, TooltipProvider$1 as CupcodeTooltipProvider, TooltipTrigger$1 as CupcodeTooltipTrigger, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, Dock, type DockButton, type DockCard, type DockCategory, type DockItem, type DockProps, DockWrapper, Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EmptyState, type EnqueueResult, ErrorBoundary, Eyebrow, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, HeroTitle, HoverCard, HoverCardContent, HoverCardTrigger, Input, InputField, type InputFieldProps, InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot, JellyButton, JellyButtonOriginal, type JellyButtonOriginalProps, Label, LoadingScreen, LoadingSpinner, type LoadingSpinnerProps, MainNavbar, type MainNavbarAuthUser, type MainNavbarProps, Menubar, MenubarCheckboxItem, MenubarContent, MenubarGroup, MenubarItem, MenubarLabel, MenubarMenu, MenubarPortal, MenubarRadioGroup, MenubarRadioItem, MenubarSeparator, MenubarShortcut, MenubarSub, MenubarSubContent, MenubarSubTrigger, MenubarTrigger, Modal, ModalClose, ModalContent, ModalDescription, ModalFooter, ModalHeader, ModalTitle, ModalTrigger, type NavItem, NavbarCupcode, type NavbarCupcodeProps, NavigationMenu, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, NavigationMenuViewport, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, ParticleSystem, Popover, PopoverContent, PopoverTrigger, PricingCard, Progress, ProgressCupcode, RadioGroup, RadioGroupItem, ResizableHandle, ResizablePanel, ResizablePanelGroup, type ResponsiveSize, ScrollArea, ScrollBar, ScrollbarArea, type ScrollbarAreaProps, type ScrollbarColor, type ScrollbarThemeMode, ScrollbarThemeProvider, type ScrollbarThemeProviderProps, Select, SelectContent, SelectField, type SelectFieldProps, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, Skeleton, Slider, Toaster$1 as SonnerToaster, type StatusType, Switch, SwitchField, type SwitchFieldProps, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, TagGroup, type TagGroupProps, type TelescupAsset, TelescupAssetPicker, type TelescupAssetPickerProps, type TelescupClient, type TelescupClientConfig, TelescupClientError, type TelescupFilters, TelescupImage, type TelescupLanguage, type TelescupMeta$1 as TelescupMeta, TelescupUpload, type TelescupUploadLabels, type TelescupUploadProps, TelescupUploader, type TelescupUploaderProps, TelescupVideo, Textarea, TextareaField, type TextareaFieldProps, type TextareaProps, ThemeToggle, Timeline, Toast$1 as Toast, ToastAction, type ToastActionElement, ToastClose, ToastCupcode, type ToastCupcodeProps, ToastDescription, type ToastProps, ToastProvider, ToastTitle, type ToastVariant, ToastViewport, Toaster, Toggle, ToggleGroup, ToggleGroupItem, type TokenResponse, Tooltip, TooltipContent, TooltipCupcode, TooltipProvider, TooltipTrigger, type UploadConflictPolicy, type UploadPolicy, type UploadQueueItem, type UploadQueueStatus, type UseTelescupAssetsOptions, type UseTelescupUploadQueueOptions, type UserMenuChatMessage, type UserMenuChatMessageLog, type UserMenuChatOpenRequest, type UserMenuChatReaction, type UserMenuChatUser, UserMenuCupcode, type UserMenuCupcodeProps, type UserMenuLanguage, type UserMenuNotification, type UserMenuNotificationKind, type UserMenuRecentActivity, type UserMenuTabId, type UserPresenceStatus$1 as UserPresenceStatus, badgeVariants, buildAuthorizeUrl, buildLogoutUrl, buildTelescupImageURL, buildTelescupVideoURL, cn, createTelescupClient, decodeJwt, exchangeCodeForToken, generateCodeChallenge, generateCodeVerifier, generateNonce, generateState, getAccountsConfig, getMainNavItems, getRuntimeEnv, getRuntimeEnvOr, getSupabase, getSupabasePublic, isRuntimeDev, navigationMenuTriggerStyle, parseAssetId, reducer, resolveOidcEndpoints, responsiveSizeClasses, setCupcodeRuntimeEnv, toast, toggleVariants, useActiveSection, useAuth, useBreakpoint, useFormField, useIsMobile, useSidebar, useTelescupAssets, useTelescupImage, useTelescupMeta, useTelescupUploadQueue, useToast };
|
|
1706
|
+
export { Accordion, AccordionContent, AccordionCupcode, AccordionItem, AccordionTrigger, type AccountsAuthConfig, Alert, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AlertTitle, AspectRatio, type AuthContextValue, AuthProvider, type AuthStatus, type AuthUser, type UserPresenceStatus as AuthUserPresenceStatus, Avatar, AvatarFallback, AvatarImage, AvatarWithStatus, BackgroundRainbow, BackgroundStars, Badge, type BadgeProps, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, ButtonProps, Calendar, type CalendarProps, Card, CardContent, CardDescription, CardFooter, CardGlass, CardHeader, CardTitle, Checkbox, ChipTag, type ChipTagProps, type ChipVariant, Collapsible, CollapsibleContent, CollapsibleTrigger, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, AccordionContent$1 as CupcodeAccordionContent, AccordionItem$1 as CupcodeAccordionItem, AccordionTrigger$1 as CupcodeAccordionTrigger, Avatar$1 as CupcodeAvatar, AvatarFallback$1 as CupcodeAvatarFallback, AvatarImage$1 as CupcodeAvatarImage, type StatusType as CupcodeAvatarStatus, Badge$1 as CupcodeBadge, type CupcodeRuntimeEnv, type CupcodeRuntimeEnvValue, Select$1 as CupcodeSelect, SelectContent$1 as CupcodeSelectContent, SelectGroup$1 as CupcodeSelectGroup, SelectItem$1 as CupcodeSelectItem, SelectTrigger$1 as CupcodeSelectTrigger, SelectValue$1 as CupcodeSelectValue, Skeleton$1 as CupcodeSkeleton, type SkeletonProps as CupcodeSkeletonProps, SkeletonText as CupcodeSkeletonText, Switch$1 as CupcodeSwitch, Tabs$1 as CupcodeTabs, TabsContent$1 as CupcodeTabsContent, TabsList$1 as CupcodeTabsList, TabsTrigger$1 as CupcodeTabsTrigger, TooltipContent$1 as CupcodeTooltipContent, TooltipProvider$1 as CupcodeTooltipProvider, TooltipTrigger$1 as CupcodeTooltipTrigger, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, Dock, type DockButton, type DockCard, type DockCategory, type DockItem, type DockProps, DockWrapper, Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EmptyState, type EnqueueResult, ErrorBoundary, Eyebrow, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, HeroTitle, HoverCard, HoverCardContent, HoverCardTrigger, Input, InputField, type InputFieldProps, InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot, JellyButton, JellyButtonOriginal, type JellyButtonOriginalProps, Label, LoadingScreen, LoadingSpinner, type LoadingSpinnerProps, MainNavbar, type MainNavbarAuthUser, type MainNavbarProps, Menubar, MenubarCheckboxItem, MenubarContent, MenubarGroup, MenubarItem, MenubarLabel, MenubarMenu, MenubarPortal, MenubarRadioGroup, MenubarRadioItem, MenubarSeparator, MenubarShortcut, MenubarSub, MenubarSubContent, MenubarSubTrigger, MenubarTrigger, Modal, ModalClose, ModalContent, ModalDescription, ModalFooter, ModalHeader, ModalTitle, ModalTrigger, type NavItem, NavbarCupcode, type NavbarCupcodeProps, NavigationMenu, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, NavigationMenuViewport, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, ParticleSystem, Popover, PopoverContent, PopoverTrigger, PricingCard, Progress, ProgressCupcode, RadioGroup, RadioGroupItem, ResizableHandle, ResizablePanel, ResizablePanelGroup, type ResolveTelescupImageOptions, type ResponsiveSize, ScrollArea, ScrollBar, ScrollbarArea, type ScrollbarAreaProps, type ScrollbarColor, type ScrollbarThemeMode, ScrollbarThemeProvider, type ScrollbarThemeProviderProps, Select, SelectContent, SelectField, type SelectFieldProps, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, Skeleton, Slider, Toaster$1 as SonnerToaster, type StatusType, Switch, SwitchField, type SwitchFieldProps, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, TagGroup, type TagGroupProps, type TelescupAsset, TelescupAssetPicker, type TelescupAssetPickerProps, type TelescupClient, type TelescupClientConfig, TelescupClientError, type TelescupFilters, TelescupImage, type TelescupLanguage, type TelescupMeta$1 as TelescupMeta, TelescupUpload, type TelescupUploadLabels, type TelescupUploadProps, TelescupUploader, type TelescupUploaderProps, TelescupVideo, Textarea, TextareaField, type TextareaFieldProps, type TextareaProps, ThemeToggle, Timeline, Toast$1 as Toast, ToastAction, type ToastActionElement, ToastClose, ToastCupcode, type ToastCupcodeProps, ToastDescription, type ToastProps, ToastProvider, ToastTitle, type ToastVariant, ToastViewport, Toaster, Toggle, ToggleGroup, ToggleGroupItem, type TokenResponse, Tooltip, TooltipContent, TooltipCupcode, TooltipProvider, TooltipTrigger, type UploadConflictPolicy, type UploadPolicy, type UploadQueueItem, type UploadQueueStatus, type UseTelescupAssetsOptions, type UseTelescupUploadQueueOptions, type UserMenuChatMessage, type UserMenuChatMessageLog, type UserMenuChatOpenRequest, type UserMenuChatReaction, type UserMenuChatUser, UserMenuCupcode, type UserMenuCupcodeProps, type UserMenuLanguage, type UserMenuNotification, type UserMenuNotificationKind, type UserMenuRecentActivity, type UserMenuTabId, type UserPresenceStatus$1 as UserPresenceStatus, badgeVariants, buildAuthorizeUrl, buildLogoutUrl, buildTelescupImageURL, buildTelescupVideoURL, cn, createTelescupClient, decodeJwt, exchangeCodeForToken, generateCodeChallenge, generateCodeVerifier, generateNonce, generateState, getAccountsConfig, getMainNavItems, getRuntimeEnv, getRuntimeEnvOr, getSupabase, getSupabasePublic, isRuntimeDev, navigationMenuTriggerStyle, parseAssetId, reducer, resolveOidcEndpoints, resolveTelescupImageURL, responsiveSizeClasses, setCupcodeRuntimeEnv, toast, toggleVariants, useActiveSection, useAuth, useBreakpoint, useFormField, useIsMobile, useSidebar, useTelescupAssets, useTelescupImage, useTelescupMeta, useTelescupUploadQueue, useToast };
|
package/dist/index.js
CHANGED
|
@@ -862,6 +862,31 @@ var isRuntimeDev = () => {
|
|
|
862
862
|
return mode === "development";
|
|
863
863
|
};
|
|
864
864
|
|
|
865
|
+
// src/utils/parseAssetId.ts
|
|
866
|
+
var UUID_REGEX = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
|
|
867
|
+
var UUID_IN_TEXT_REGEX = /[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}/i;
|
|
868
|
+
var isUuid = (value) => {
|
|
869
|
+
if (typeof value !== "string") return false;
|
|
870
|
+
return UUID_REGEX.test(value.trim());
|
|
871
|
+
};
|
|
872
|
+
function parseAssetId(input) {
|
|
873
|
+
var _a65, _b5, _c, _d;
|
|
874
|
+
const raw = input == null ? void 0 : input.trim();
|
|
875
|
+
if (!raw) return void 0;
|
|
876
|
+
if (UUID_REGEX.test(raw)) return raw;
|
|
877
|
+
const matchFromRaw = (_a65 = raw.match(UUID_IN_TEXT_REGEX)) == null ? void 0 : _a65[0];
|
|
878
|
+
if (isUuid(matchFromRaw)) return matchFromRaw;
|
|
879
|
+
try {
|
|
880
|
+
const url = new URL(raw);
|
|
881
|
+
const queryParamId = (_c = (_b5 = url.searchParams.get("id")) != null ? _b5 : url.searchParams.get("asset_id")) != null ? _c : url.searchParams.get("assetId");
|
|
882
|
+
if (isUuid(queryParamId)) return queryParamId;
|
|
883
|
+
const matchFromPath = (_d = url.pathname.match(UUID_IN_TEXT_REGEX)) == null ? void 0 : _d[0];
|
|
884
|
+
if (isUuid(matchFromPath)) return matchFromPath;
|
|
885
|
+
} catch (e) {
|
|
886
|
+
}
|
|
887
|
+
return void 0;
|
|
888
|
+
}
|
|
889
|
+
|
|
865
890
|
// src/hooks/useTelescupAsset.ts
|
|
866
891
|
var getApiBase = () => getRuntimeEnvOr("VITE_TELESCUP_API_BASE", "https://cdn.cupcode.com.br").replace(/\/+$/, "");
|
|
867
892
|
function buildTelescupImageURL(options) {
|
|
@@ -874,6 +899,25 @@ function buildTelescupImageURL(options) {
|
|
|
874
899
|
params.set("q", quality.toString());
|
|
875
900
|
return `${getApiBase()}/i?${params.toString()}`;
|
|
876
901
|
}
|
|
902
|
+
function resolveTelescupImageURL(value, options) {
|
|
903
|
+
const raw = value == null ? void 0 : value.trim();
|
|
904
|
+
if (!raw) return void 0;
|
|
905
|
+
const parsedId = parseAssetId(raw);
|
|
906
|
+
if (parsedId) {
|
|
907
|
+
return buildTelescupImageURL({
|
|
908
|
+
id: parsedId,
|
|
909
|
+
width: options == null ? void 0 : options.width,
|
|
910
|
+
height: options == null ? void 0 : options.height,
|
|
911
|
+
fit: options == null ? void 0 : options.fit,
|
|
912
|
+
format: options == null ? void 0 : options.format,
|
|
913
|
+
quality: options == null ? void 0 : options.quality
|
|
914
|
+
});
|
|
915
|
+
}
|
|
916
|
+
if (raw.startsWith("http://") || raw.startsWith("https://") || raw.startsWith("data:") || raw.startsWith("blob:")) {
|
|
917
|
+
return raw;
|
|
918
|
+
}
|
|
919
|
+
return void 0;
|
|
920
|
+
}
|
|
877
921
|
function buildTelescupVideoURL(id) {
|
|
878
922
|
return `${getApiBase()}/i/v?id=${id}`;
|
|
879
923
|
}
|
|
@@ -908,31 +952,6 @@ function useTelescupImage(options, lang) {
|
|
|
908
952
|
return { url, meta, loading };
|
|
909
953
|
}
|
|
910
954
|
|
|
911
|
-
// src/utils/parseAssetId.ts
|
|
912
|
-
var UUID_REGEX = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
|
|
913
|
-
var UUID_IN_TEXT_REGEX = /[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}/i;
|
|
914
|
-
var isUuid = (value) => {
|
|
915
|
-
if (typeof value !== "string") return false;
|
|
916
|
-
return UUID_REGEX.test(value.trim());
|
|
917
|
-
};
|
|
918
|
-
function parseAssetId(input) {
|
|
919
|
-
var _a65, _b5, _c, _d;
|
|
920
|
-
const raw = input == null ? void 0 : input.trim();
|
|
921
|
-
if (!raw) return void 0;
|
|
922
|
-
if (UUID_REGEX.test(raw)) return raw;
|
|
923
|
-
const matchFromRaw = (_a65 = raw.match(UUID_IN_TEXT_REGEX)) == null ? void 0 : _a65[0];
|
|
924
|
-
if (isUuid(matchFromRaw)) return matchFromRaw;
|
|
925
|
-
try {
|
|
926
|
-
const url = new URL(raw);
|
|
927
|
-
const queryParamId = (_c = (_b5 = url.searchParams.get("id")) != null ? _b5 : url.searchParams.get("asset_id")) != null ? _c : url.searchParams.get("assetId");
|
|
928
|
-
if (isUuid(queryParamId)) return queryParamId;
|
|
929
|
-
const matchFromPath = (_d = url.pathname.match(UUID_IN_TEXT_REGEX)) == null ? void 0 : _d[0];
|
|
930
|
-
if (isUuid(matchFromPath)) return matchFromPath;
|
|
931
|
-
} catch (e) {
|
|
932
|
-
}
|
|
933
|
-
return void 0;
|
|
934
|
-
}
|
|
935
|
-
|
|
936
955
|
// src/components/cupcode/DockWrapper.tsx
|
|
937
956
|
import { jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
938
957
|
var getImageUrl = (rawId, width = 60, height = 60, format = "avif", quality = 60) => {
|
|
@@ -6395,21 +6414,13 @@ var extractSharedFilesFromMessages = (messages) => {
|
|
|
6395
6414
|
};
|
|
6396
6415
|
var resolveTelescupImageUrl = (value, options) => {
|
|
6397
6416
|
var _a65, _b5, _c;
|
|
6398
|
-
|
|
6399
|
-
|
|
6400
|
-
|
|
6401
|
-
|
|
6402
|
-
|
|
6403
|
-
|
|
6404
|
-
|
|
6405
|
-
if (parsedId2) {
|
|
6406
|
-
return buildTelescupImageURL({ id: parsedId2, width, height, fit: "cover", format: "avif", quality });
|
|
6407
|
-
}
|
|
6408
|
-
return raw;
|
|
6409
|
-
}
|
|
6410
|
-
const parsedId = parseAssetId(raw);
|
|
6411
|
-
if (!parsedId) return void 0;
|
|
6412
|
-
return buildTelescupImageURL({ id: parsedId, width, height, fit: "cover", format: "avif", quality });
|
|
6417
|
+
return resolveTelescupImageURL(value, {
|
|
6418
|
+
width: (_a65 = options == null ? void 0 : options.width) != null ? _a65 : 96,
|
|
6419
|
+
height: (_b5 = options == null ? void 0 : options.height) != null ? _b5 : 96,
|
|
6420
|
+
fit: "cover",
|
|
6421
|
+
format: "avif",
|
|
6422
|
+
quality: (_c = options == null ? void 0 : options.quality) != null ? _c : 72
|
|
6423
|
+
});
|
|
6413
6424
|
};
|
|
6414
6425
|
var resolveGroupAvatarFromTelescup = (asset, fallbackId) => {
|
|
6415
6426
|
var _a65, _b5;
|
|
@@ -22222,8 +22233,22 @@ var buildHandle2 = (value, email, fallbackId) => {
|
|
|
22222
22233
|
var resolveCurrentUserId = (user) => {
|
|
22223
22234
|
const sub = toStringOrUndefined(user == null ? void 0 : user.sub);
|
|
22224
22235
|
if (sub) return sub;
|
|
22236
|
+
const id = toStringOrUndefined(user == null ? void 0 : user.id);
|
|
22237
|
+
if (id) return id;
|
|
22238
|
+
const userId = toStringOrUndefined(user == null ? void 0 : user.userId);
|
|
22239
|
+
if (userId) return userId;
|
|
22225
22240
|
return null;
|
|
22226
22241
|
};
|
|
22242
|
+
var resolveUserIdFromClaims = (claims) => {
|
|
22243
|
+
var _a65, _b5, _c, _d, _e;
|
|
22244
|
+
return (_e = (_d = (_c = (_b5 = (_a65 = toStringOrUndefined(claims.sub)) != null ? _a65 : toStringOrUndefined(claims.user_id)) != null ? _b5 : toStringOrUndefined(claims.userId)) != null ? _c : toStringOrUndefined(claims.uid)) != null ? _d : toStringOrUndefined(claims.id)) != null ? _e : toStringOrUndefined(claims["https://cupcode.com/user_id"]);
|
|
22245
|
+
};
|
|
22246
|
+
var resolveEmailFromClaims = (claims) => {
|
|
22247
|
+
var _a65, _b5;
|
|
22248
|
+
const candidate = (_b5 = (_a65 = toStringOrUndefined(claims.email)) != null ? _a65 : toStringOrUndefined(claims["https://cupcode.com/email"])) != null ? _b5 : toStringOrUndefined(claims.preferred_username);
|
|
22249
|
+
if (!candidate || !candidate.includes("@")) return void 0;
|
|
22250
|
+
return candidate.toLowerCase();
|
|
22251
|
+
};
|
|
22227
22252
|
var formatMessageTime = (rawTimestamp) => {
|
|
22228
22253
|
if (!rawTimestamp) return "";
|
|
22229
22254
|
const parsed = new Date(rawTimestamp);
|
|
@@ -22231,18 +22256,7 @@ var formatMessageTime = (rawTimestamp) => {
|
|
|
22231
22256
|
return parsed.toLocaleTimeString("pt-BR", { hour: "2-digit", minute: "2-digit" });
|
|
22232
22257
|
};
|
|
22233
22258
|
var resolveChatAvatarUrl = (value) => {
|
|
22234
|
-
|
|
22235
|
-
if (!raw) return void 0;
|
|
22236
|
-
if (raw.startsWith("http://") || raw.startsWith("https://") || raw.startsWith("data:") || raw.startsWith("blob:")) {
|
|
22237
|
-
const parsedId2 = parseAssetId(raw);
|
|
22238
|
-
if (parsedId2) {
|
|
22239
|
-
return buildTelescupImageURL({ id: parsedId2, width: 72, height: 72, fit: "cover", format: "avif", quality: 70 });
|
|
22240
|
-
}
|
|
22241
|
-
return raw;
|
|
22242
|
-
}
|
|
22243
|
-
const parsedId = parseAssetId(raw);
|
|
22244
|
-
if (!parsedId) return void 0;
|
|
22245
|
-
return buildTelescupImageURL({ id: parsedId, width: 72, height: 72, fit: "cover", format: "avif", quality: 70 });
|
|
22259
|
+
return resolveTelescupImageURL(value, { width: 72, height: 72, fit: "cover", format: "avif", quality: 70 });
|
|
22246
22260
|
};
|
|
22247
22261
|
var isGenericRecord = (value) => typeof value === "object" && value !== null;
|
|
22248
22262
|
var buildExternalUrl = (baseUrl, target) => {
|
|
@@ -22488,7 +22502,7 @@ var MainNavbar = ({
|
|
|
22488
22502
|
ctaHref = "/login",
|
|
22489
22503
|
pathname,
|
|
22490
22504
|
onNavigate,
|
|
22491
|
-
authStatus
|
|
22505
|
+
authStatus,
|
|
22492
22506
|
authUser,
|
|
22493
22507
|
presenceStatus,
|
|
22494
22508
|
onPresenceStatusChange,
|
|
@@ -22505,6 +22519,8 @@ var MainNavbar = ({
|
|
|
22505
22519
|
const [isChatSending, setIsChatSending] = useState13(false);
|
|
22506
22520
|
const [chatError, setChatError] = useState13(null);
|
|
22507
22521
|
const [resolvedSenderId, setResolvedSenderId] = useState13(null);
|
|
22522
|
+
const [tokenDerivedUserId, setTokenDerivedUserId] = useState13(null);
|
|
22523
|
+
const [tokenDerivedEmail, setTokenDerivedEmail] = useState13(void 0);
|
|
22508
22524
|
const [persistedProfileAvatarValue, setPersistedProfileAvatarValue] = useState13(void 0);
|
|
22509
22525
|
const [accountsLanguage, setAccountsLanguage] = useState13("pt-BR");
|
|
22510
22526
|
const [accountsRecentActivity, setAccountsRecentActivity] = useState13([]);
|
|
@@ -22524,8 +22540,17 @@ var MainNavbar = ({
|
|
|
22524
22540
|
if (typeof window !== "undefined") return window.location.pathname || "/";
|
|
22525
22541
|
return "/";
|
|
22526
22542
|
}, [pathname]);
|
|
22527
|
-
const currentUserId = useMemo8(() =>
|
|
22528
|
-
|
|
22543
|
+
const currentUserId = useMemo8(() => {
|
|
22544
|
+
var _a66;
|
|
22545
|
+
return (_a66 = resolveCurrentUserId(authUser)) != null ? _a66 : tokenDerivedUserId;
|
|
22546
|
+
}, [authUser, tokenDerivedUserId]);
|
|
22547
|
+
const authEmail = useMemo8(
|
|
22548
|
+
() => {
|
|
22549
|
+
var _a66, _b6;
|
|
22550
|
+
return (_b6 = (_a66 = toStringOrUndefined(authUser == null ? void 0 : authUser.email)) == null ? void 0 : _a66.toLowerCase()) != null ? _b6 : tokenDerivedEmail;
|
|
22551
|
+
},
|
|
22552
|
+
[authUser == null ? void 0 : authUser.email, tokenDerivedEmail]
|
|
22553
|
+
);
|
|
22529
22554
|
const isChatSuperAdmin = useMemo8(() => {
|
|
22530
22555
|
var _a66, _b6;
|
|
22531
22556
|
const roleTokens = `${(_a66 = authUser == null ? void 0 : authUser.role) != null ? _a66 : ""} ${(_b6 = authUser == null ? void 0 : authUser.jobTitle) != null ? _b6 : ""}`.toLowerCase();
|
|
@@ -22539,7 +22564,77 @@ var MainNavbar = ({
|
|
|
22539
22564
|
}, []);
|
|
22540
22565
|
const resolvedProfileAvatarUrl = (_b5 = (_a65 = resolveChatAvatarUrl(persistedProfileAvatarValue)) != null ? _a65 : authUser == null ? void 0 : authUser.picture) != null ? _b5 : void 0;
|
|
22541
22566
|
const effectiveCurrentUserId = resolvedSenderId != null ? resolvedSenderId : currentUserId;
|
|
22542
|
-
const
|
|
22567
|
+
const hasStoredAccessToken = (() => {
|
|
22568
|
+
if (typeof window === "undefined") return false;
|
|
22569
|
+
try {
|
|
22570
|
+
return Boolean(sessionStorage.getItem(ACCESS_TOKEN_STORAGE_KEY));
|
|
22571
|
+
} catch (e) {
|
|
22572
|
+
return false;
|
|
22573
|
+
}
|
|
22574
|
+
})();
|
|
22575
|
+
const resolvedAuthStatus = useMemo8(() => {
|
|
22576
|
+
if (authStatus) return authStatus;
|
|
22577
|
+
if ((authUser == null ? void 0 : authUser.sub) || (authUser == null ? void 0 : authUser.id) || (authUser == null ? void 0 : authUser.userId) || (authUser == null ? void 0 : authUser.email)) {
|
|
22578
|
+
return "authenticated";
|
|
22579
|
+
}
|
|
22580
|
+
if (tokenDerivedUserId || tokenDerivedEmail || hasStoredAccessToken) {
|
|
22581
|
+
return "authenticated";
|
|
22582
|
+
}
|
|
22583
|
+
return "unauthenticated";
|
|
22584
|
+
}, [
|
|
22585
|
+
authStatus,
|
|
22586
|
+
authUser == null ? void 0 : authUser.email,
|
|
22587
|
+
authUser == null ? void 0 : authUser.id,
|
|
22588
|
+
authUser == null ? void 0 : authUser.sub,
|
|
22589
|
+
authUser == null ? void 0 : authUser.userId,
|
|
22590
|
+
hasStoredAccessToken,
|
|
22591
|
+
tokenDerivedEmail,
|
|
22592
|
+
tokenDerivedUserId
|
|
22593
|
+
]);
|
|
22594
|
+
const isAuthenticated = resolvedAuthStatus === "authenticated";
|
|
22595
|
+
useEffect16(() => {
|
|
22596
|
+
if (authStatus === "unauthenticated") {
|
|
22597
|
+
setTokenDerivedUserId(null);
|
|
22598
|
+
setTokenDerivedEmail(void 0);
|
|
22599
|
+
return;
|
|
22600
|
+
}
|
|
22601
|
+
let canceled = false;
|
|
22602
|
+
const resolveIdentityFromToken = async () => {
|
|
22603
|
+
var _a66, _b6;
|
|
22604
|
+
try {
|
|
22605
|
+
let token = null;
|
|
22606
|
+
if (typeof window !== "undefined") {
|
|
22607
|
+
try {
|
|
22608
|
+
token = sessionStorage.getItem(ACCESS_TOKEN_STORAGE_KEY);
|
|
22609
|
+
} catch (e) {
|
|
22610
|
+
token = null;
|
|
22611
|
+
}
|
|
22612
|
+
}
|
|
22613
|
+
if (!token && getAccessToken) {
|
|
22614
|
+
token = await getAccessToken();
|
|
22615
|
+
}
|
|
22616
|
+
if (!token) {
|
|
22617
|
+
if (!canceled) {
|
|
22618
|
+
setTokenDerivedUserId(null);
|
|
22619
|
+
setTokenDerivedEmail(void 0);
|
|
22620
|
+
}
|
|
22621
|
+
return;
|
|
22622
|
+
}
|
|
22623
|
+
const claims = (_a66 = decodeJwt(token)) != null ? _a66 : {};
|
|
22624
|
+
if (canceled) return;
|
|
22625
|
+
setTokenDerivedUserId((_b6 = resolveUserIdFromClaims(claims)) != null ? _b6 : null);
|
|
22626
|
+
setTokenDerivedEmail(resolveEmailFromClaims(claims));
|
|
22627
|
+
} catch (error) {
|
|
22628
|
+
if (isRuntimeDev()) {
|
|
22629
|
+
console.warn("[chat] Falha ao resolver identidade via access token:", error.message);
|
|
22630
|
+
}
|
|
22631
|
+
}
|
|
22632
|
+
};
|
|
22633
|
+
void resolveIdentityFromToken();
|
|
22634
|
+
return () => {
|
|
22635
|
+
canceled = true;
|
|
22636
|
+
};
|
|
22637
|
+
}, [authStatus, getAccessToken]);
|
|
22543
22638
|
useEffect16(() => {
|
|
22544
22639
|
if (!isAuthenticated) {
|
|
22545
22640
|
setResolvedSenderId(null);
|
|
@@ -23900,8 +23995,8 @@ var MainNavbar = ({
|
|
|
23900
23995
|
actions: /* @__PURE__ */ jsx45("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ jsx45(
|
|
23901
23996
|
UserMenuCupcode,
|
|
23902
23997
|
{
|
|
23903
|
-
isAuthenticated:
|
|
23904
|
-
isLoading:
|
|
23998
|
+
isAuthenticated: resolvedAuthStatus === "authenticated",
|
|
23999
|
+
isLoading: resolvedAuthStatus === "loading",
|
|
23905
24000
|
loginLabel: ctaLabel,
|
|
23906
24001
|
displayName: authUser == null ? void 0 : authUser.name,
|
|
23907
24002
|
username: (_c = authUser == null ? void 0 : authUser.preferredUsername) != null ? _c : authUser == null ? void 0 : authUser.nickname,
|
|
@@ -27699,6 +27794,7 @@ export {
|
|
|
27699
27794
|
parseAssetId,
|
|
27700
27795
|
reducer,
|
|
27701
27796
|
resolveOidcEndpoints,
|
|
27797
|
+
resolveTelescupImageURL,
|
|
27702
27798
|
responsiveSizeClasses,
|
|
27703
27799
|
setCupcodeRuntimeEnv,
|
|
27704
27800
|
toast2 as sonnerToast,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cupcodev/ui",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "1.2.
|
|
4
|
+
"version": "1.2.6",
|
|
5
5
|
"packageManager": "pnpm@10.28.2+sha512.41872f037ad22f7348e3b1debbaf7e867cfd448f2726d9cf74c08f19507c31d2c8e7a11525b983febc2df640b5438dee6023ebb1f84ed43cc2d654d2bc326264",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "./dist/index.cjs",
|
|
@@ -37,7 +37,8 @@
|
|
|
37
37
|
"files": [
|
|
38
38
|
"dist",
|
|
39
39
|
"styles",
|
|
40
|
-
"tailwind-preset.cjs"
|
|
40
|
+
"tailwind-preset.cjs",
|
|
41
|
+
"postinstall.cjs"
|
|
41
42
|
],
|
|
42
43
|
"engines": {
|
|
43
44
|
"node": ">=18.18.0"
|
|
@@ -59,6 +60,7 @@
|
|
|
59
60
|
"test:consumer": "node ./scripts/consumer-smoke.mjs",
|
|
60
61
|
"lint": "eslint . --max-warnings=0",
|
|
61
62
|
"prepublishOnly": "npm run check:release",
|
|
63
|
+
"postinstall": "node ./postinstall.cjs",
|
|
62
64
|
"preview": "vite preview"
|
|
63
65
|
},
|
|
64
66
|
"devDependencies": {
|
package/postinstall.cjs
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const message = `
|
|
2
|
+
[cupcode-ui] Configuração obrigatória no app consumidor:
|
|
3
|
+
|
|
4
|
+
No main.tsx (ou arquivo de bootstrap similar), adicione:
|
|
5
|
+
|
|
6
|
+
import { setCupcodeRuntimeEnv } from "@cupcodev/ui";
|
|
7
|
+
|
|
8
|
+
setCupcodeRuntimeEnv({
|
|
9
|
+
VITE_SUPABASE_URL: import.meta.env.VITE_SUPABASE_URL,
|
|
10
|
+
VITE_SUPABASE_ANON_KEY: import.meta.env.VITE_SUPABASE_ANON_KEY,
|
|
11
|
+
VITE_TELESCUP_BASE_URL: import.meta.env.VITE_TELESCUP_BASE_URL,
|
|
12
|
+
VITE_TELESCUP_API_BASE: import.meta.env.VITE_TELESCUP_API_BASE,
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
Também importe os estilos:
|
|
16
|
+
|
|
17
|
+
import "@cupcodev/ui/styles.css";
|
|
18
|
+
`;
|
|
19
|
+
|
|
20
|
+
console.log(message);
|