@cupcodev/ui 8.1.3 → 8.1.4

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.cjs CHANGED
@@ -6281,11 +6281,29 @@ var TelescupUpload = ({
6281
6281
  ] }) })
6282
6282
  ] });
6283
6283
  }
6284
- return mode === "drawer" ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Drawer, { open: Boolean(open), onOpenChange: (next) => !next ? handleClose() : void 0, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(DrawerContent, { className: "h-[90vh] p-6", children: content }) }) : /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Dialog, { open: Boolean(open), onOpenChange: (next) => !next ? handleClose() : void 0, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(DialogContent, { className: "z-[4600] max-w-5xl rounded-md sm:rounded-md", children: [
6285
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(DialogTitle, { className: "sr-only", children: labels.title }),
6286
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(DialogDescription, { className: "sr-only", children: "Sele\xE7\xE3o e upload de assets com metadados do Telescup." }),
6287
- content
6288
- ] }) });
6284
+ return mode === "drawer" ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Drawer, { open: Boolean(open), onOpenChange: (next) => !next ? handleClose() : void 0, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(DrawerContent, { className: "h-[90vh] p-6", children: content }) }) : /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6285
+ Dialog,
6286
+ {
6287
+ open: Boolean(open),
6288
+ onOpenChange: (next) => {
6289
+ if (!next) handleClose();
6290
+ },
6291
+ modal: true,
6292
+ children: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
6293
+ DialogContent,
6294
+ {
6295
+ className: "z-[4600] max-w-5xl rounded-md sm:rounded-md",
6296
+ onInteractOutside: (event) => event.preventDefault(),
6297
+ onPointerDownOutside: (event) => event.preventDefault(),
6298
+ children: [
6299
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(DialogTitle, { className: "sr-only", children: labels.title }),
6300
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(DialogDescription, { className: "sr-only", children: "Sele\xE7\xE3o e upload de assets com metadados do Telescup." }),
6301
+ content
6302
+ ]
6303
+ }
6304
+ )
6305
+ }
6306
+ );
6289
6307
  };
6290
6308
 
6291
6309
  // src/lib/accountsLoginHistory.ts
@@ -6828,8 +6846,10 @@ var UserMenuCupcode = ({
6828
6846
  if (!hasTelescupAvatarSupport || isTelescupAuthPending || isProfileAvatarSaving) return;
6829
6847
  try {
6830
6848
  await ensureTelescupAuth();
6849
+ setIsProfileImageDialogOpen(false);
6831
6850
  setIsProfileAvatarUploadOpen(true);
6832
6851
  } catch (error) {
6852
+ console.error("[UserMenuCupcode] telescup avatar auth failed", error);
6833
6853
  toast({
6834
6854
  title: "Falha ao autenticar no Telescup",
6835
6855
  description: error instanceof Error ? error.message : "N\xE3o foi poss\xEDvel abrir a biblioteca agora.",
@@ -8246,6 +8266,13 @@ var writeTokenBundle = (bundle) => {
8246
8266
  window.localStorage.setItem(TOKEN_STORAGE_KEY, serialized);
8247
8267
  } catch (e) {
8248
8268
  }
8269
+ try {
8270
+ window.sessionStorage.setItem("cc_id_token", bundle.idToken);
8271
+ if (bundle.accessToken) {
8272
+ window.sessionStorage.setItem("access_token", bundle.accessToken);
8273
+ }
8274
+ } catch (e) {
8275
+ }
8249
8276
  };
8250
8277
  var getFlowStorageKey = (state) => `${FLOW_STORAGE_KEY_PREFIX}${state}`;
8251
8278
  var writeFlowState = (flow) => {
@@ -8438,8 +8465,9 @@ var ensureTelescupOidcToken = async () => {
8438
8465
  throw new Error("Autentica\xE7\xE3o do Telescup indispon\xEDvel fora do navegador.");
8439
8466
  }
8440
8467
  if (pendingTokenPromise) return pendingTokenPromise;
8441
- const popup = window.open("", POPUP_WINDOW_NAME, centerPopupFeatures());
8442
- if (!popup) {
8468
+ const popupWindowName = `${POPUP_WINDOW_NAME}-${Date.now()}`;
8469
+ const popup = window.open("about:blank", popupWindowName, centerPopupFeatures());
8470
+ if (!popup || popup.closed) {
8443
8471
  throw new Error("N\xE3o foi poss\xEDvel abrir a autentica\xE7\xE3o do Telescup. Verifique o bloqueador de popups.");
8444
8472
  }
8445
8473
  pendingTokenPromise = new Promise((resolve, reject) => {
package/dist/index.js CHANGED
@@ -5846,11 +5846,29 @@ var TelescupUpload = ({
5846
5846
  ] }) })
5847
5847
  ] });
5848
5848
  }
5849
- return mode === "drawer" ? /* @__PURE__ */ jsx33(Drawer, { open: Boolean(open), onOpenChange: (next) => !next ? handleClose() : void 0, children: /* @__PURE__ */ jsx33(DrawerContent, { className: "h-[90vh] p-6", children: content }) }) : /* @__PURE__ */ jsx33(Dialog, { open: Boolean(open), onOpenChange: (next) => !next ? handleClose() : void 0, children: /* @__PURE__ */ jsxs20(DialogContent, { className: "z-[4600] max-w-5xl rounded-md sm:rounded-md", children: [
5850
- /* @__PURE__ */ jsx33(DialogTitle, { className: "sr-only", children: labels.title }),
5851
- /* @__PURE__ */ jsx33(DialogDescription, { className: "sr-only", children: "Sele\xE7\xE3o e upload de assets com metadados do Telescup." }),
5852
- content
5853
- ] }) });
5849
+ return mode === "drawer" ? /* @__PURE__ */ jsx33(Drawer, { open: Boolean(open), onOpenChange: (next) => !next ? handleClose() : void 0, children: /* @__PURE__ */ jsx33(DrawerContent, { className: "h-[90vh] p-6", children: content }) }) : /* @__PURE__ */ jsx33(
5850
+ Dialog,
5851
+ {
5852
+ open: Boolean(open),
5853
+ onOpenChange: (next) => {
5854
+ if (!next) handleClose();
5855
+ },
5856
+ modal: true,
5857
+ children: /* @__PURE__ */ jsxs20(
5858
+ DialogContent,
5859
+ {
5860
+ className: "z-[4600] max-w-5xl rounded-md sm:rounded-md",
5861
+ onInteractOutside: (event) => event.preventDefault(),
5862
+ onPointerDownOutside: (event) => event.preventDefault(),
5863
+ children: [
5864
+ /* @__PURE__ */ jsx33(DialogTitle, { className: "sr-only", children: labels.title }),
5865
+ /* @__PURE__ */ jsx33(DialogDescription, { className: "sr-only", children: "Sele\xE7\xE3o e upload de assets com metadados do Telescup." }),
5866
+ content
5867
+ ]
5868
+ }
5869
+ )
5870
+ }
5871
+ );
5854
5872
  };
5855
5873
 
5856
5874
  // src/lib/accountsLoginHistory.ts
@@ -6393,8 +6411,10 @@ var UserMenuCupcode = ({
6393
6411
  if (!hasTelescupAvatarSupport || isTelescupAuthPending || isProfileAvatarSaving) return;
6394
6412
  try {
6395
6413
  await ensureTelescupAuth();
6414
+ setIsProfileImageDialogOpen(false);
6396
6415
  setIsProfileAvatarUploadOpen(true);
6397
6416
  } catch (error) {
6417
+ console.error("[UserMenuCupcode] telescup avatar auth failed", error);
6398
6418
  toast({
6399
6419
  title: "Falha ao autenticar no Telescup",
6400
6420
  description: error instanceof Error ? error.message : "N\xE3o foi poss\xEDvel abrir a biblioteca agora.",
@@ -7811,6 +7831,13 @@ var writeTokenBundle = (bundle) => {
7811
7831
  window.localStorage.setItem(TOKEN_STORAGE_KEY, serialized);
7812
7832
  } catch (e) {
7813
7833
  }
7834
+ try {
7835
+ window.sessionStorage.setItem("cc_id_token", bundle.idToken);
7836
+ if (bundle.accessToken) {
7837
+ window.sessionStorage.setItem("access_token", bundle.accessToken);
7838
+ }
7839
+ } catch (e) {
7840
+ }
7814
7841
  };
7815
7842
  var getFlowStorageKey = (state) => `${FLOW_STORAGE_KEY_PREFIX}${state}`;
7816
7843
  var writeFlowState = (flow) => {
@@ -8003,8 +8030,9 @@ var ensureTelescupOidcToken = async () => {
8003
8030
  throw new Error("Autentica\xE7\xE3o do Telescup indispon\xEDvel fora do navegador.");
8004
8031
  }
8005
8032
  if (pendingTokenPromise) return pendingTokenPromise;
8006
- const popup = window.open("", POPUP_WINDOW_NAME, centerPopupFeatures());
8007
- if (!popup) {
8033
+ const popupWindowName = `${POPUP_WINDOW_NAME}-${Date.now()}`;
8034
+ const popup = window.open("about:blank", popupWindowName, centerPopupFeatures());
8035
+ if (!popup || popup.closed) {
8008
8036
  throw new Error("N\xE3o foi poss\xEDvel abrir a autentica\xE7\xE3o do Telescup. Verifique o bloqueador de popups.");
8009
8037
  }
8010
8038
  pendingTokenPromise = new Promise((resolve, reject) => {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cupcodev/ui",
3
3
  "private": false,
4
- "version": "8.1.3",
4
+ "version": "8.1.4",
5
5
  "packageManager": "pnpm@10.28.2+sha512.41872f037ad22f7348e3b1debbaf7e867cfd448f2726d9cf74c08f19507c31d2c8e7a11525b983febc2df640b5438dee6023ebb1f84ed43cc2d654d2bc326264",
6
6
  "type": "module",
7
7
  "main": "./dist/index.cjs",