@dreamtree-org/landing-kit 0.10.0 → 0.10.1

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/platform.cjs CHANGED
@@ -107,7 +107,7 @@ function readPlatformCsrf(cookieString, name) {
107
107
  return null;
108
108
  }
109
109
  function joinUrl(basePath, path, query) {
110
- const base2 = basePath.replace(/\/+$/, "");
110
+ const base3 = basePath.replace(/\/+$/, "");
111
111
  const rel = path ? `/${String(path).replace(/^\/+/, "")}` : "";
112
112
  const params = new URLSearchParams();
113
113
  for (const [k, v] of Object.entries(query != null ? query : {})) {
@@ -115,7 +115,7 @@ function joinUrl(basePath, path, query) {
115
115
  params.append(k, String(v));
116
116
  }
117
117
  const qs = params.toString();
118
- return `${base2}${rel}${qs ? `?${qs}` : ""}`;
118
+ return `${base3}${rel}${qs ? `?${qs}` : ""}`;
119
119
  }
120
120
  function createPlatformClient(opts = {}) {
121
121
  var _a, _b, _c, _d, _e;
@@ -2839,10 +2839,10 @@ function PlatformConsole({
2839
2839
  const browser = useBrowserLocation(!routed);
2840
2840
  const pathname = routed ? givenPath : browser.pathname;
2841
2841
  const navigate = givenNavigate != null ? givenNavigate : browser.navigate;
2842
- const base2 = `/${trim(basePath)}`.replace(/\/$/, "") || "";
2842
+ const base3 = `/${trim(basePath)}`.replace(/\/$/, "") || "";
2843
2843
  const client = (0, import_react16.useMemo)(
2844
- () => given != null ? given : createPlatformClient({ basePath: apiBasePath, loginPath: loginPath != null ? loginPath : `${base2}/login` }),
2845
- [given, apiBasePath, loginPath, base2]
2844
+ () => given != null ? given : createPlatformClient({ basePath: apiBasePath, loginPath: loginPath != null ? loginPath : `${base3}/login` }),
2845
+ [given, apiBasePath, loginPath, base3]
2846
2846
  );
2847
2847
  const Link = (0, import_react16.useMemo)(() => makeLink(linkAs, navigate), [linkAs, navigate]);
2848
2848
  const [me, setMe] = (0, import_react16.useState)(initialMe);
@@ -2856,7 +2856,7 @@ function PlatformConsole({
2856
2856
  (0, import_react16.useEffect)(() => {
2857
2857
  void reloadMe();
2858
2858
  }, [reloadMe]);
2859
- const href = (0, import_react16.useCallback)((rel2 = "") => `${base2}/${trim(rel2)}`.replace(/\/$/, "") || "/", [base2]);
2859
+ const href = (0, import_react16.useCallback)((rel2 = "") => `${base3}/${trim(rel2)}`.replace(/\/$/, "") || "/", [base3]);
2860
2860
  const companyLoginPath = (0, import_react16.useCallback)(
2861
2861
  (slug) => {
2862
2862
  var _a2, _b2;
@@ -2874,10 +2874,10 @@ function PlatformConsole({
2874
2874
  await client.post("auth/logout", {}, { skipAuthRedirect: true });
2875
2875
  } finally {
2876
2876
  if (onSignOut) onSignOut();
2877
- else if (typeof window !== "undefined") window.location.assign(loginPath != null ? loginPath : `${base2}/login`);
2877
+ else if (typeof window !== "undefined") window.location.assign(loginPath != null ? loginPath : `${base3}/login`);
2878
2878
  }
2879
2879
  };
2880
- const rel = pathname.startsWith(base2) ? pathname.slice(base2.length) : pathname;
2880
+ const rel = pathname.startsWith(base3) ? pathname.slice(base3.length) : pathname;
2881
2881
  const route = matchConsoleRoute(rel, visiblePages);
2882
2882
  const gate = me && me.access && me.access.console === false;
2883
2883
  const active = (prefix) => prefix === "" ? route.view === "overview" : trim(rel) === prefix || trim(rel).startsWith(`${prefix}/`);
@@ -2903,7 +2903,7 @@ function PlatformConsole({
2903
2903
  features: enabled,
2904
2904
  companyLoginPath,
2905
2905
  companyLoginUrl: (slug) => `${origin}${companyLoginPath(slug)}`,
2906
- loginUrl: `${origin}${loginPath != null ? loginPath : `${base2}/login`}`,
2906
+ loginUrl: `${origin}${loginPath != null ? loginPath : `${base3}/login`}`,
2907
2907
  brand,
2908
2908
  appName: appName != null ? appName : (_a = me == null ? void 0 : me.app) == null ? void 0 : _a.name
2909
2909
  };
@@ -2925,11 +2925,11 @@ function PlatformConsole({
2925
2925
  }
2926
2926
 
2927
2927
  // src/platform/PlatformLogin.jsx
2928
- var import_react20 = __toESM(require("react"), 1);
2928
+ var import_react22 = __toESM(require("react"), 1);
2929
2929
  var import_twreact_ui16 = require("@dreamtree-org/twreact-ui");
2930
2930
 
2931
2931
  // src/AuthShell.jsx
2932
- var import_react19 = require("react");
2932
+ var import_react21 = require("react");
2933
2933
 
2934
2934
  // src/DemoAccounts.jsx
2935
2935
  var import_react17 = require("react");
@@ -2987,13 +2987,116 @@ function DemoAccounts({ load, onSelect, className = "" }) {
2987
2987
  ] });
2988
2988
  }
2989
2989
 
2990
- // src/useTapReveal.js
2990
+ // src/DreamtreeSso.jsx
2991
+ var import_react19 = require("react");
2992
+
2993
+ // src/sso.js
2994
+ function decodeKey(part) {
2995
+ const key = part.split("=")[0];
2996
+ try {
2997
+ return decodeURIComponent(key.replace(/\+/g, " "));
2998
+ } catch {
2999
+ return key;
3000
+ }
3001
+ }
3002
+ function buildSsoUrl(startUrl, { returnTo, companySlug } = {}) {
3003
+ const raw = String(startUrl != null ? startUrl : "");
3004
+ const hashAt = raw.indexOf("#");
3005
+ const hash = hashAt === -1 ? "" : raw.slice(hashAt);
3006
+ const beforeHash = hashAt === -1 ? raw : raw.slice(0, hashAt);
3007
+ const queryAt = beforeHash.indexOf("?");
3008
+ const path = queryAt === -1 ? beforeHash : beforeHash.slice(0, queryAt);
3009
+ const query = queryAt === -1 ? "" : beforeHash.slice(queryAt + 1);
3010
+ const add = [
3011
+ ["return_to", returnTo],
3012
+ ["dt_company", companySlug]
3013
+ ].filter(([, v]) => v != null && v !== "");
3014
+ const replaced = new Set(add.map(([k]) => k));
3015
+ const params = query.split("&").filter((p) => p && !replaced.has(decodeKey(p))).concat(add.map(([k, v]) => `${k}=${encodeURIComponent(String(v))}`));
3016
+ return `${path}${params.length ? `?${params.join("&")}` : ""}${hash}`;
3017
+ }
3018
+
3019
+ // src/icons.jsx
2991
3020
  var import_react18 = require("react");
3021
+ var import_jsx_runtime19 = require("react/jsx-runtime");
3022
+ var base2 = {
3023
+ viewBox: "0 0 24 24",
3024
+ fill: "none",
3025
+ stroke: "currentColor",
3026
+ strokeWidth: 2,
3027
+ strokeLinecap: "round",
3028
+ strokeLinejoin: "round",
3029
+ "aria-hidden": "true",
3030
+ focusable: "false"
3031
+ };
3032
+ var make2 = (paths) => function Icon({ size = 16, className = "dt-lp-icon" }) {
3033
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("svg", { ...base2, width: size, height: size, className, children: paths });
3034
+ };
3035
+ var ArrowRight = make2(/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("path", { d: "M5 12h14M13 6l6 6-6 6" }));
3036
+ var ChevronRight = make2(/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("path", { d: "m9 6 6 6-6 6" }));
3037
+ var Check = make2(/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("path", { d: "M20 6 9 17l-5-5" }));
3038
+ var Help = make2(
3039
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
3040
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("circle", { cx: "12", cy: "12", r: "10" }),
3041
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("path", { d: "M9.1 9a3 3 0 0 1 5.8 1c0 2-3 3-3 3M12 17h.01" })
3042
+ ] })
3043
+ );
3044
+ var Alert9 = make2(
3045
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
3046
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("path", { d: "M10.3 3.9 1.8 18a2 2 0 0 0 1.7 3h17a2 2 0 0 0 1.7-3L13.7 3.9a2 2 0 0 0-3.4 0Z" }),
3047
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("path", { d: "M12 9v4M12 17h.01" })
3048
+ ] })
3049
+ );
3050
+ var MenuIcon = make2(/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("path", { d: "M4 6h16M4 12h16M4 18h16" }));
3051
+ var Close = make2(/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("path", { d: "M18 6 6 18M6 6l12 12" }));
3052
+ var Calendar = make2(
3053
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
3054
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("rect", { x: "3", y: "4", width: "18", height: "18", rx: "2" }),
3055
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("path", { d: "M16 2v4M8 2v4M3 10h18m-12 6 2 2 4-4" })
3056
+ ] })
3057
+ );
3058
+
3059
+ // src/DreamtreeSso.jsx
3060
+ var import_jsx_runtime20 = require("react/jsx-runtime");
3061
+ var DEFAULT_SSO_LABEL = "Continue with Dreamtree";
3062
+ function DreamtreeSso({ provider, children }) {
3063
+ const { startUrl, mode, label = DEFAULT_SSO_LABEL, companySlug, returnTo } = provider;
3064
+ const isSso = mode === "sso";
3065
+ const autoRedirect = isSso && provider.autoRedirect !== false;
3066
+ const href = buildSsoUrl(startUrl, { returnTo, companySlug });
3067
+ const redirected = (0, import_react19.useRef)(false);
3068
+ (0, import_react19.useEffect)(() => {
3069
+ if (!autoRedirect || redirected.current) return;
3070
+ redirected.current = true;
3071
+ window.location.assign(href);
3072
+ }, [autoRedirect, href]);
3073
+ const button = /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("a", { className: "dt-auth-sso-btn", href, children: [
3074
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { children: label }),
3075
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ArrowRight, { size: 16, className: "dt-auth-sso-icon" })
3076
+ ] });
3077
+ if (isSso) {
3078
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "dt-auth-sso dt-auth-sso--only", children: [
3079
+ autoRedirect ? /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("p", { className: "dt-auth-sso-status", role: "status", "aria-live": "polite", children: [
3080
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "dt-auth-sso-spinner", "aria-hidden": "true" }),
3081
+ "Redirecting to Dreamtree ID\u2026"
3082
+ ] }) : null,
3083
+ button
3084
+ ] });
3085
+ }
3086
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
3087
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "dt-auth-sso", children: button }),
3088
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "dt-auth-or", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { children: "or" }) }),
3089
+ children
3090
+ ] });
3091
+ }
3092
+
3093
+ // src/useTapReveal.js
3094
+ var import_react20 = require("react");
2992
3095
  function useTapReveal({ taps = 4, windowMs = 1500 } = {}) {
2993
- const [revealed, setRevealed] = (0, import_react18.useState)(false);
2994
- const count = (0, import_react18.useRef)(0);
2995
- const last = (0, import_react18.useRef)(0);
2996
- const onClick = (0, import_react18.useCallback)(() => {
3096
+ const [revealed, setRevealed] = (0, import_react20.useState)(false);
3097
+ const count = (0, import_react20.useRef)(0);
3098
+ const last = (0, import_react20.useRef)(0);
3099
+ const onClick = (0, import_react20.useCallback)(() => {
2997
3100
  if (revealed) return;
2998
3101
  const now = Date.now();
2999
3102
  count.current = now - last.current <= windowMs ? count.current + 1 : 1;
@@ -3004,7 +3107,7 @@ function useTapReveal({ taps = 4, windowMs = 1500 } = {}) {
3004
3107
  }
3005
3108
 
3006
3109
  // src/AuthShell.jsx
3007
- var import_jsx_runtime19 = require("react/jsx-runtime");
3110
+ var import_jsx_runtime21 = require("react/jsx-runtime");
3008
3111
  var DEFAULT_LEGAL = [
3009
3112
  { label: "Privacy Policy", href: "/privacy" },
3010
3113
  { label: "Terms", href: "/terms" },
@@ -3012,10 +3115,10 @@ var DEFAULT_LEGAL = [
3012
3115
  ];
3013
3116
  function BrandMark({ brand, size }) {
3014
3117
  if (brand.logoSrc) {
3015
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("img", { className: "dt-auth-mark-img", src: brand.logoSrc, alt: "", width: size, height: size });
3118
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("img", { className: "dt-auth-mark-img", src: brand.logoSrc, alt: "", width: size, height: size });
3016
3119
  }
3017
- if (brand.mark) return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "dt-auth-mark-node", children: brand.mark });
3018
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "dt-auth-monogram", style: { width: size, height: size }, "aria-hidden": "true", children: brand.name.charAt(0) });
3120
+ if (brand.mark) return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "dt-auth-mark-node", children: brand.mark });
3121
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "dt-auth-monogram", style: { width: size, height: size }, "aria-hidden": "true", children: brand.name.charAt(0) });
3019
3122
  }
3020
3123
  function brandStyle(brand) {
3021
3124
  return {
@@ -3034,52 +3137,53 @@ function AuthShell({
3034
3137
  legalLinks = DEFAULT_LEGAL,
3035
3138
  linkComponent: LinkComponent,
3036
3139
  className = "",
3037
- demoAccounts
3140
+ demoAccounts,
3141
+ ssoProvider
3038
3142
  }) {
3039
3143
  var _a, _b;
3040
- const headingId = (0, import_react19.useId)();
3144
+ const headingId = (0, import_react21.useId)();
3041
3145
  const { revealed, tapProps } = useTapReveal({ taps: (_a = demoAccounts == null ? void 0 : demoAccounts.taps) != null ? _a : 4 });
3042
3146
  const isPlatform = variant === "platform";
3043
3147
  const headline = isPlatform ? brand.platformHeadline || "Platform administration" : brand.headline;
3044
3148
  const pitch = isPlatform ? brand.platformPitch || `Super administrator console for ${brand.name}. Every action here is audited.` : brand.pitch;
3045
- const renderLink = (l) => LinkComponent ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(LinkComponent, { to: l.href, href: l.href, className: "dt-auth-legal-link", children: l.label }, l.href) : /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("a", { href: l.href, className: "dt-auth-legal-link", children: l.label }, l.href);
3046
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
3149
+ const renderLink = (l) => LinkComponent ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(LinkComponent, { to: l.href, href: l.href, className: "dt-auth-legal-link", children: l.label }, l.href) : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("a", { href: l.href, className: "dt-auth-legal-link", children: l.label }, l.href);
3150
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
3047
3151
  "div",
3048
3152
  {
3049
3153
  className: `dt-auth ${isPlatform ? "dt-auth--platform" : ""} ${className}`,
3050
3154
  style: brandStyle(brand),
3051
3155
  "data-product": brand.id,
3052
3156
  children: [
3053
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("aside", { className: "dt-auth-panel", children: [
3054
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("a", { href: "/", className: "dt-auth-brand", children: [
3055
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(BrandMark, { brand, size: 28 }),
3056
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "dt-auth-brand-name", children: brand.name }),
3057
- isPlatform ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "dt-auth-badge", children: "Platform" }) : null
3157
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("aside", { className: "dt-auth-panel", children: [
3158
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("a", { href: "/", className: "dt-auth-brand", children: [
3159
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(BrandMark, { brand, size: 28 }),
3160
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "dt-auth-brand-name", children: brand.name }),
3161
+ isPlatform ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "dt-auth-badge", children: "Platform" }) : null
3058
3162
  ] }),
3059
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "dt-auth-pitch", children: [
3060
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("h2", { children: headline }),
3061
- pitch ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { children: pitch }) : null,
3062
- !isPlatform && ((_b = brand.points) == null ? void 0 : _b.length) ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("ul", { children: brand.points.map((p) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("li", { children: p }, p)) }) : null
3163
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "dt-auth-pitch", children: [
3164
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("h2", { children: headline }),
3165
+ pitch ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { children: pitch }) : null,
3166
+ !isPlatform && ((_b = brand.points) == null ? void 0 : _b.length) ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("ul", { children: brand.points.map((p) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("li", { children: p }, p)) }) : null
3063
3167
  ] }),
3064
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "dt-auth-panel-foot", children: brand.category || "by Dreamtree-Org" })
3168
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "dt-auth-panel-foot", children: brand.category || "by Dreamtree-Org" })
3065
3169
  ] }),
3066
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("main", { className: "dt-auth-main", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "dt-auth-column", children: [
3067
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("a", { href: "/", className: "dt-auth-brand dt-auth-brand--mobile", children: [
3068
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(BrandMark, { brand, size: 24 }),
3069
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "dt-auth-brand-name", children: brand.name }),
3070
- isPlatform ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "dt-auth-badge", children: "Platform" }) : null
3170
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("main", { className: "dt-auth-main", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "dt-auth-column", children: [
3171
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("a", { href: "/", className: "dt-auth-brand dt-auth-brand--mobile", children: [
3172
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(BrandMark, { brand, size: 24 }),
3173
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "dt-auth-brand-name", children: brand.name }),
3174
+ isPlatform ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "dt-auth-badge", children: "Platform" }) : null
3071
3175
  ] }),
3072
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("section", { className: "dt-auth-card", "aria-labelledby": headingId, children: [
3073
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("header", { className: "dt-auth-head", children: [
3074
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("h1", { id: headingId, ...demoAccounts ? tapProps : {}, children: title }),
3075
- subtitle ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { children: subtitle }) : null
3176
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("section", { className: "dt-auth-card", "aria-labelledby": headingId, children: [
3177
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("header", { className: "dt-auth-head", children: [
3178
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("h1", { id: headingId, ...demoAccounts ? tapProps : {}, children: title }),
3179
+ subtitle ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { children: subtitle }) : null
3076
3180
  ] }),
3077
- children,
3078
- demoAccounts && revealed ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(DemoAccounts, { load: demoAccounts.load, onSelect: demoAccounts.onSelect }) : null
3181
+ ssoProvider ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DreamtreeSso, { provider: ssoProvider, children }) : children,
3182
+ demoAccounts && revealed && (ssoProvider == null ? void 0 : ssoProvider.mode) !== "sso" ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DemoAccounts, { load: demoAccounts.load, onSelect: demoAccounts.onSelect }) : null
3079
3183
  ] }),
3080
- footer ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "dt-auth-footer", children: footer }) : null,
3081
- (legalLinks == null ? void 0 : legalLinks.length) ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("nav", { className: "dt-auth-legal", "aria-label": "Legal", children: legalLinks.map((l, i) => /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { className: "dt-auth-legal-item", children: [
3082
- i > 0 ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { "aria-hidden": "true", children: "\xB7" }) : null,
3184
+ footer ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "dt-auth-footer", children: footer }) : null,
3185
+ (legalLinks == null ? void 0 : legalLinks.length) ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("nav", { className: "dt-auth-legal", "aria-label": "Legal", children: legalLinks.map((l, i) => /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("span", { className: "dt-auth-legal-item", children: [
3186
+ i > 0 ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { "aria-hidden": "true", children: "\xB7" }) : null,
3083
3187
  renderLink(l)
3084
3188
  ] }, l.href)) }) : null
3085
3189
  ] }) })
@@ -3089,17 +3193,17 @@ function AuthShell({
3089
3193
  }
3090
3194
 
3091
3195
  // src/platform/PlatformLogin.jsx
3092
- var import_jsx_runtime20 = require("react/jsx-runtime");
3196
+ var import_jsx_runtime22 = require("react/jsx-runtime");
3093
3197
  function PlatformLogin({ brand, basePath, client: given, onSignedIn, redirectTo = "/platform", title = "Platform administration", subtitle = "Administrator sign-in", linkComponent, legalLinks }) {
3094
- const client = (0, import_react20.useMemo)(() => given != null ? given : createPlatformClient({ basePath, onUnauthorized: () => {
3198
+ const client = (0, import_react22.useMemo)(() => given != null ? given : createPlatformClient({ basePath, onUnauthorized: () => {
3095
3199
  } }), [given, basePath]);
3096
- const [step, setStep] = (0, import_react20.useState)("password");
3097
- const [email, setEmail] = (0, import_react20.useState)("");
3098
- const [password, setPassword] = (0, import_react20.useState)("");
3099
- const [ticket, setTicket] = (0, import_react20.useState)(null);
3100
- const [code, setCode] = (0, import_react20.useState)("");
3101
- const [busy, setBusy] = (0, import_react20.useState)(false);
3102
- const [error, setError] = (0, import_react20.useState)(null);
3200
+ const [step, setStep] = (0, import_react22.useState)("password");
3201
+ const [email, setEmail] = (0, import_react22.useState)("");
3202
+ const [password, setPassword] = (0, import_react22.useState)("");
3203
+ const [ticket, setTicket] = (0, import_react22.useState)(null);
3204
+ const [code, setCode] = (0, import_react22.useState)("");
3205
+ const [busy, setBusy] = (0, import_react22.useState)(false);
3206
+ const [error, setError] = (0, import_react22.useState)(null);
3103
3207
  const done = (res) => {
3104
3208
  if (onSignedIn) onSignedIn(res);
3105
3209
  else if (typeof window !== "undefined") window.location.assign(redirectTo);
@@ -3139,17 +3243,17 @@ function PlatformLogin({ brand, basePath, client: given, onSignedIn, redirectTo
3139
3243
  setBusy(false);
3140
3244
  }
3141
3245
  };
3142
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(AuthShell, { brand, variant: "platform", title, subtitle, linkComponent, legalLinks, children: step === "password" ? /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("form", { onSubmit: submitPassword, className: "flex flex-col gap-4", children: [
3143
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_twreact_ui16.Input, { label: "Admin email", type: "email", autoComplete: "username", autoFocus: true, value: email, onChange: (e) => setEmail(e.target.value) }),
3144
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_twreact_ui16.Input, { label: "Password", type: "password", autoComplete: "current-password", value: password, onChange: (e) => setPassword(e.target.value) }),
3145
- error && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_twreact_ui16.Alert, { variant: "error", children: error }),
3146
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_twreact_ui16.Button, { type: "submit", loading: busy, disabled: !email || !password, fullWidth: true, children: "Sign in" })
3147
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("form", { onSubmit: submitCode, className: "flex flex-col gap-4", children: [
3148
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "text-sm", children: "Enter the 6-digit code from your authenticator app." }),
3149
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_twreact_ui16.Input, { label: "Authenticator code", otp: true, autoFocus: true, value: code, onChange: (e) => setCode(e.target.value.replace(/\s/g, "")) }),
3150
- error && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_twreact_ui16.Alert, { variant: "error", children: error }),
3151
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_twreact_ui16.Button, { type: "submit", loading: busy, disabled: code.length < 6, fullWidth: true, children: "Verify" }),
3152
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
3246
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(AuthShell, { brand, variant: "platform", title, subtitle, linkComponent, legalLinks, children: step === "password" ? /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("form", { onSubmit: submitPassword, className: "flex flex-col gap-4", children: [
3247
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_twreact_ui16.Input, { label: "Admin email", type: "email", autoComplete: "username", autoFocus: true, value: email, onChange: (e) => setEmail(e.target.value) }),
3248
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_twreact_ui16.Input, { label: "Password", type: "password", autoComplete: "current-password", value: password, onChange: (e) => setPassword(e.target.value) }),
3249
+ error && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_twreact_ui16.Alert, { variant: "error", children: error }),
3250
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_twreact_ui16.Button, { type: "submit", loading: busy, disabled: !email || !password, fullWidth: true, children: "Sign in" })
3251
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("form", { onSubmit: submitCode, className: "flex flex-col gap-4", children: [
3252
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { className: "text-sm", children: "Enter the 6-digit code from your authenticator app." }),
3253
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_twreact_ui16.Input, { label: "Authenticator code", otp: true, autoFocus: true, value: code, onChange: (e) => setCode(e.target.value.replace(/\s/g, "")) }),
3254
+ error && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_twreact_ui16.Alert, { variant: "error", children: error }),
3255
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_twreact_ui16.Button, { type: "submit", loading: busy, disabled: code.length < 6, fullWidth: true, children: "Verify" }),
3256
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3153
3257
  import_twreact_ui16.Button,
3154
3258
  {
3155
3259
  variant: "ghost",