@oondemand/oon-core-front 0.4.17 → 0.4.19

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.d.ts CHANGED
@@ -511,6 +511,8 @@ type OonPageLayout = "default" | "content-only" | "portal";
511
511
  interface OonPageDef {
512
512
  id?: string;
513
513
  path: string;
514
+ /** Rota pública declarada, usada por entradas customizadas como o login do portal. */
515
+ public?: boolean;
514
516
  label?: string;
515
517
  title?: string;
516
518
  section?: string;
package/dist/index.js CHANGED
@@ -895,8 +895,35 @@ function AuthProvider({ http, storage, auth, loginUrl, children }) {
895
895
  setStatus("unauthenticated");
896
896
  return;
897
897
  }
898
+ const launchCode = captureTokenFromUrl("oon_launch");
898
899
  const incoming = captureTokenFromUrl(tokenParam);
899
900
  const stored = storage.get();
901
+ if (launchCode) {
902
+ storage.clear();
903
+ setStatus("loading");
904
+ http.post("/auth/launch/exchange", { code: launchCode }).then((response) => {
905
+ if (!response.data.token) {
906
+ const error = {
907
+ code: "APP_LAUNCH_TOKEN_MISSING",
908
+ message: "A troca de abertura n\xE3o retornou uma sess\xE3o.",
909
+ status: 502
910
+ };
911
+ throw error;
912
+ }
913
+ storage.set(response.data.token);
914
+ return http.get("/auth/validar-token");
915
+ }).then((response) => {
916
+ if (!active) return;
917
+ applyUser(response.data.usuario);
918
+ }).catch((error) => {
919
+ if (!active) return;
920
+ storage.clear();
921
+ applyValidationError(error);
922
+ });
923
+ return () => {
924
+ active = false;
925
+ };
926
+ }
900
927
  const token = incoming ?? devToken ?? stored;
901
928
  if (token && token !== stored) storage.set(token);
902
929
  if (!token) {
@@ -5266,7 +5293,7 @@ function viewToRoute(view, registry) {
5266
5293
  return { path: viewPath(view), element: renderView(view, registry), permissions: requiredPermissions(view), capabilities: "capabilities" in view ? view.capabilities : void 0 };
5267
5294
  }
5268
5295
  function pageToRoute(page, registry) {
5269
- return { path: page.path, element: /* @__PURE__ */ jsx32(CorePage2, { page, registry }), permissions: requiredPermissions(page), capabilities: page.capabilities };
5296
+ return { path: page.path, element: /* @__PURE__ */ jsx32(CorePage2, { page, registry }), public: page.public === true, permissions: requiredPermissions(page), capabilities: page.capabilities };
5270
5297
  }
5271
5298
  function pageToMenu(page) {
5272
5299
  if (!page.label) return null;
@@ -5440,7 +5467,7 @@ function Sidebar({ app, menu, registry }) {
5440
5467
  // package.json
5441
5468
  var package_default = {
5442
5469
  name: "@oondemand/oon-core-front",
5443
- version: "0.4.17",
5470
+ version: "0.4.19",
5444
5471
  repository: {
5445
5472
  type: "git",
5446
5473
  url: "git+https://github.com/oondemand/oon-platform.git",