@iqauth/sdk 2.0.5 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +19 -3
- package/dist/browser.d.mts +2 -2
- package/dist/browser.d.ts +2 -2
- package/dist/browser.js +57 -6
- package/dist/browser.mjs +2 -2
- package/dist/{chunk-ZESHDJDU.mjs → chunk-D72UL5HL.mjs} +3 -6
- package/dist/{chunk-JQRTY5MY.mjs → chunk-M4J6BPK7.mjs} +3 -8
- package/dist/chunk-QEJB7WEQ.mjs +119 -0
- package/dist/{chunk-S3M2IXCE.mjs → chunk-QZB745C2.mjs} +3 -8
- package/dist/cli/index.js +21 -0
- package/dist/cli/index.mjs +1 -1
- package/dist/{doctor-OHJRZBBT.mjs → doctor-XCI77BQS.mjs} +2 -1
- package/dist/express.js +54 -25
- package/dist/express.mjs +5 -8
- package/dist/fastify.js +53 -19
- package/dist/fastify.mjs +4 -5
- package/dist/hono.js +53 -19
- package/dist/hono.mjs +4 -5
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +59 -4
- package/dist/index.mjs +4 -2
- package/dist/next.js +66 -34
- package/dist/next.mjs +6 -9
- package/dist/{publishableKey-B5DIK81A.d.mts → publishableKey-BaR0HoAH.d.mts} +10 -1
- package/dist/{publishableKey-B5DIK81A.d.ts → publishableKey-BaR0HoAH.d.ts} +10 -1
- package/dist/react.d.mts +91 -4
- package/dist/react.d.ts +91 -4
- package/dist/react.js +466 -162
- package/dist/react.mjs +411 -147
- package/dist/server/handlers.js +63 -17
- package/dist/server/handlers.mjs +3 -2
- package/dist/server.js +53 -21
- package/dist/server.mjs +3 -3
- package/dist/{signIn-VRNzlNyG.d.ts → signIn-BVDTIA_t.d.ts} +1 -1
- package/dist/{signIn-CEMdUAwd.d.mts → signIn-D_kP3v-c.d.mts} +1 -1
- package/package.json +1 -1
- package/dist/chunk-5WFR6Y33.mjs +0 -59
package/dist/react.mjs
CHANGED
|
@@ -4,8 +4,8 @@ import {
|
|
|
4
4
|
redirectToSignIn,
|
|
5
5
|
signIn,
|
|
6
6
|
signOut
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import "./chunk-
|
|
7
|
+
} from "./chunk-QZB745C2.mjs";
|
|
8
|
+
import "./chunk-QEJB7WEQ.mjs";
|
|
9
9
|
import "./chunk-6I6RM4MN.mjs";
|
|
10
10
|
import "./chunk-Y6FXYEAI.mjs";
|
|
11
11
|
|
|
@@ -144,6 +144,16 @@ function SignedOut({ children }) {
|
|
|
144
144
|
if (!isLoaded || isSignedIn) return null;
|
|
145
145
|
return createElement(Fragment, null, children);
|
|
146
146
|
}
|
|
147
|
+
function IQAuthLoading({ children }) {
|
|
148
|
+
const { isLoaded } = useAuth();
|
|
149
|
+
if (isLoaded) return null;
|
|
150
|
+
return createElement(Fragment, null, children);
|
|
151
|
+
}
|
|
152
|
+
function IQAuthLoaded({ children }) {
|
|
153
|
+
const { isLoaded } = useAuth();
|
|
154
|
+
if (!isLoaded) return null;
|
|
155
|
+
return createElement(Fragment, null, children);
|
|
156
|
+
}
|
|
147
157
|
function RedirectToSignIn(props = {}) {
|
|
148
158
|
const { manager, snapshot } = useCtx();
|
|
149
159
|
const [error, setError] = useState(null);
|
|
@@ -212,6 +222,12 @@ function brandStyle(branding) {
|
|
|
212
222
|
if (branding.backgroundColor) s["--brand-bg"] = branding.backgroundColor;
|
|
213
223
|
if (branding.surfaceColor) s["--brand-surface"] = branding.surfaceColor;
|
|
214
224
|
if (branding.textColor) s["--brand-text"] = branding.textColor;
|
|
225
|
+
if (branding.borderRadius != null && branding.borderRadius !== "") {
|
|
226
|
+
const n = typeof branding.borderRadius === "number" ? `${branding.borderRadius}px` : String(branding.borderRadius);
|
|
227
|
+
s["--brand-radius"] = n;
|
|
228
|
+
}
|
|
229
|
+
if (branding.fontFamilyBody) s["--brand-font-body"] = branding.fontFamilyBody;
|
|
230
|
+
if (branding.fontFamilyHeading) s["--brand-font-heading"] = branding.fontFamilyHeading;
|
|
215
231
|
return s;
|
|
216
232
|
}
|
|
217
233
|
async function jsonFetch(url, init) {
|
|
@@ -236,7 +252,7 @@ function useIQAuthSignInContext(iqAuthBaseUrl, appKey, returnTo) {
|
|
|
236
252
|
let cancelled = false;
|
|
237
253
|
setLoading(true);
|
|
238
254
|
const url = `${iqAuthBaseUrl.replace(/\/$/, "")}/api/public/apps/${encodeURIComponent(appKey)}/sign-in-context?return_to=${encodeURIComponent(returnTo)}`;
|
|
239
|
-
fetch(url).then((r) => r.json()).then((payload) => {
|
|
255
|
+
fetch(url, { credentials: "include" }).then((r) => r.json()).then((payload) => {
|
|
240
256
|
if (cancelled) return;
|
|
241
257
|
if (payload?.success === false) throw new Error(payload?.error?.message || "Failed to load sign-in context");
|
|
242
258
|
setCtx(payload.data);
|
|
@@ -254,6 +270,7 @@ function useIQAuthSignInContext(iqAuthBaseUrl, appKey, returnTo) {
|
|
|
254
270
|
var SHELL_CSS = `
|
|
255
271
|
.iqauth-sdk-shell {
|
|
256
272
|
min-height: 100vh;
|
|
273
|
+
width: 100%;
|
|
257
274
|
display: grid;
|
|
258
275
|
grid-template-columns: 1fr;
|
|
259
276
|
background: var(--brand-bg, #f7f7f6);
|
|
@@ -262,20 +279,31 @@ var SHELL_CSS = `
|
|
|
262
279
|
.iqauth-sdk-hero { display: none; }
|
|
263
280
|
.iqauth-sdk-pane {
|
|
264
281
|
display: flex; flex-direction: column; align-items: center; justify-content: center;
|
|
265
|
-
padding:
|
|
282
|
+
padding: 48px 24px; min-height: 100vh;
|
|
266
283
|
}
|
|
267
284
|
.iqauth-sdk-card {
|
|
268
|
-
width: 100%; max-width:
|
|
285
|
+
width: 100%; max-width: 460px;
|
|
269
286
|
background: var(--brand-surface, #ffffff);
|
|
270
287
|
border: 1px solid rgba(15,23,42,0.08);
|
|
271
|
-
border-radius:
|
|
272
|
-
box-shadow: 0 1px 2px rgba(0,0,0,0.04), 0
|
|
288
|
+
border-radius: var(--brand-radius, 16px);
|
|
289
|
+
box-shadow: 0 1px 2px rgba(0,0,0,0.04), 0 12px 32px rgba(15,23,42,0.06);
|
|
273
290
|
overflow: hidden;
|
|
274
291
|
}
|
|
275
|
-
.iqauth-sdk-
|
|
276
|
-
.iqauth-sdk-
|
|
292
|
+
.iqauth-sdk-shell, .iqauth-sdk-shell input, .iqauth-sdk-shell button { font-family: var(--brand-font-body, inherit); }
|
|
293
|
+
.iqauth-sdk-shell h1, .iqauth-sdk-shell h2, .iqauth-sdk-shell h3 { font-family: var(--brand-font-heading, var(--brand-font-body, inherit)); }
|
|
294
|
+
.iqauth-sdk-shell[data-layout="centered_card"] { grid-template-columns: 1fr; }
|
|
295
|
+
.iqauth-sdk-shell[data-layout="centered_card"] .iqauth-sdk-hero { display: none; }
|
|
296
|
+
.iqauth-sdk-shell[data-layout="full_bleed"] { background-size: cover; background-position: center; background-repeat: no-repeat; }
|
|
297
|
+
.iqauth-sdk-shell[data-layout="full_bleed"] .iqauth-sdk-hero { display: none; }
|
|
298
|
+
.iqauth-sdk-shell[data-layout="full_bleed"] .iqauth-sdk-pane { background: rgba(15,23,42,0.30); }
|
|
299
|
+
.iqauth-sdk-shell[data-social-style="outline"] .iqauth-sdk-google-btn { background: transparent; border-color: var(--brand-primary, rgba(15,23,42,0.18)); color: var(--brand-text, inherit); }
|
|
300
|
+
.iqauth-sdk-shell[data-social-style="ghost"] .iqauth-sdk-google-btn { background: transparent; border-color: transparent; color: var(--brand-text, inherit); }
|
|
301
|
+
.iqauth-sdk-shell[data-social-style="solid"] .iqauth-sdk-google-btn { background: var(--brand-primary, #3b82f6); border-color: transparent; color: #fff; }
|
|
302
|
+
.iqauth-sdk-shell[data-social-style="solid"] .iqauth-sdk-google-btn:hover { background: var(--brand-primary, #3b82f6); opacity: 0.92; }
|
|
303
|
+
.iqauth-sdk-card-header { padding: 32px 36px 0; }
|
|
304
|
+
.iqauth-sdk-card-header h1 { font-size: 24px; font-weight: 600; margin: 0; line-height: 1.2; letter-spacing: -0.01em; }
|
|
277
305
|
.iqauth-sdk-card-header p { margin: 8px 0 0; font-size: 14px; color: rgba(15,23,42,0.65); line-height: 1.5; }
|
|
278
|
-
.iqauth-sdk-card-body { padding:
|
|
306
|
+
.iqauth-sdk-card-body { padding: 32px 36px 28px; display: flex; flex-direction: column; gap: 18px; }
|
|
279
307
|
.iqauth-sdk-mobile-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; }
|
|
280
308
|
.iqauth-sdk-mobile-brand img { height: 36px; width: auto; }
|
|
281
309
|
.iqauth-sdk-mobile-brand span { font-size: 16px; font-weight: 600; }
|
|
@@ -296,11 +324,11 @@ var SHELL_CSS = `
|
|
|
296
324
|
.iqauth-sdk-google-btn:hover { background: #f8fafc; border-color: rgba(15,23,42,0.28); }
|
|
297
325
|
.iqauth-sdk-google-btn[disabled] { opacity: 0.6; cursor: not-allowed; }
|
|
298
326
|
|
|
299
|
-
@media (min-width:
|
|
300
|
-
.iqauth-sdk-shell { grid-template-columns: minmax(0,
|
|
327
|
+
@media (min-width: 768px) {
|
|
328
|
+
.iqauth-sdk-shell:not([data-layout="centered_card"]):not([data-layout="full_bleed"]) { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
|
|
301
329
|
.iqauth-sdk-hero {
|
|
302
330
|
display: flex; flex-direction: column; justify-content: space-between;
|
|
303
|
-
padding:
|
|
331
|
+
padding: clamp(32px, 4vw, 56px); color: #ffffff;
|
|
304
332
|
background: linear-gradient(135deg, var(--brand-primary, #3b82f6) 0%, var(--brand-accent, #6366f1) 100%);
|
|
305
333
|
background-size: cover; background-position: center;
|
|
306
334
|
position: relative; overflow: hidden; min-height: 100vh;
|
|
@@ -309,15 +337,113 @@ var SHELL_CSS = `
|
|
|
309
337
|
background-image: var(--iqauth-sdk-hero-image), linear-gradient(135deg, var(--brand-primary, #3b82f6), var(--brand-accent, #6366f1));
|
|
310
338
|
background-blend-mode: multiply;
|
|
311
339
|
}
|
|
312
|
-
.iqauth-sdk-hero-brand img { height:
|
|
313
|
-
.iqauth-sdk-hero-brand .iqauth-sdk-hero-name { font-size:
|
|
314
|
-
.iqauth-sdk-hero-content
|
|
315
|
-
.iqauth-sdk-hero-content
|
|
340
|
+
.iqauth-sdk-hero-brand img { height: 40px; width: auto; filter: brightness(0) invert(1); opacity: 0.96; }
|
|
341
|
+
.iqauth-sdk-hero-brand .iqauth-sdk-hero-name { font-size: 20px; font-weight: 600; letter-spacing: -0.01em; }
|
|
342
|
+
.iqauth-sdk-hero-content { max-width: 520px; }
|
|
343
|
+
.iqauth-sdk-hero-content h2 { font-size: clamp(24px, 2.4vw, 34px); font-weight: 600; line-height: 1.2; margin: 0 0 14px; letter-spacing: -0.015em; word-wrap: break-word; overflow-wrap: break-word; hyphens: auto; }
|
|
344
|
+
.iqauth-sdk-hero-content p { font-size: 15px; line-height: 1.6; opacity: 0.92; margin: 0; white-space: pre-wrap; }
|
|
316
345
|
.iqauth-sdk-hero-foot { font-size: 12px; opacity: 0.7; }
|
|
317
346
|
.iqauth-sdk-mobile-brand { display: none; }
|
|
318
347
|
}
|
|
348
|
+
@media (min-width: 1280px) {
|
|
349
|
+
.iqauth-sdk-shell:not([data-layout="centered_card"]):not([data-layout="full_bleed"]) { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); }
|
|
350
|
+
}
|
|
319
351
|
`;
|
|
320
352
|
var sdkShellStylesInjected = false;
|
|
353
|
+
var SDK_CSS_MAX_LEN = 50 * 1024;
|
|
354
|
+
var SDK_CSS_FORBIDDEN = [
|
|
355
|
+
/<\/?\s*style[^>]*>/gi,
|
|
356
|
+
/<\/?\s*script[^>]*>/gi,
|
|
357
|
+
/<!--[\s\S]*?-->/g,
|
|
358
|
+
/@import\s+[^;]*;?/gi,
|
|
359
|
+
/expression\s*\(/gi,
|
|
360
|
+
/behavior\s*:/gi,
|
|
361
|
+
/-moz-binding\s*:/gi,
|
|
362
|
+
/javascript\s*:/gi,
|
|
363
|
+
/vbscript\s*:/gi
|
|
364
|
+
];
|
|
365
|
+
var SDK_URL_DATA_RE = /url\s*\(\s*(['"]?)\s*data\s*:[^)]*\)/gi;
|
|
366
|
+
function sanitizeBrandCss(input) {
|
|
367
|
+
if (!input) return "";
|
|
368
|
+
let out = String(input);
|
|
369
|
+
if (out.length > SDK_CSS_MAX_LEN) out = out.slice(0, SDK_CSS_MAX_LEN);
|
|
370
|
+
out = out.replace(/</g, "");
|
|
371
|
+
for (const re of SDK_CSS_FORBIDDEN) out = out.replace(re, "");
|
|
372
|
+
out = out.replace(SDK_URL_DATA_RE, "url()");
|
|
373
|
+
return out;
|
|
374
|
+
}
|
|
375
|
+
function SdkBrandLogo({ branding, alt, fallback }) {
|
|
376
|
+
const light = branding?.logoLightUrl || branding?.logoUrl || null;
|
|
377
|
+
const dark = branding?.logoDarkUrl || null;
|
|
378
|
+
if (!light && !dark) return /* @__PURE__ */ jsx(Fragment2, { children: fallback });
|
|
379
|
+
const fallbackSrc = light || dark;
|
|
380
|
+
return /* @__PURE__ */ jsxs("picture", { "data-iqauth-sdk-logo": "", children: [
|
|
381
|
+
dark ? /* @__PURE__ */ jsx("source", { srcSet: dark, media: "(prefers-color-scheme: dark)" }) : null,
|
|
382
|
+
light ? /* @__PURE__ */ jsx("source", { srcSet: light, media: "(prefers-color-scheme: light)" }) : null,
|
|
383
|
+
/* @__PURE__ */ jsx("img", { src: fallbackSrc, alt })
|
|
384
|
+
] });
|
|
385
|
+
}
|
|
386
|
+
var sdkBrandingCache = /* @__PURE__ */ new Map();
|
|
387
|
+
var SDK_BRANDING_TTL_MS = 6e4;
|
|
388
|
+
function flattenBrandingPayload(data) {
|
|
389
|
+
const e = data && data.effective || {};
|
|
390
|
+
const meta = data && data.meta || {};
|
|
391
|
+
return {
|
|
392
|
+
brandName: e.brandName ?? data?.brandName ?? null,
|
|
393
|
+
logoUrl: e.logoLightUrl ?? data?.logoUrl ?? null,
|
|
394
|
+
logoLightUrl: e.logoLightUrl ?? data?.logoLightUrl ?? null,
|
|
395
|
+
logoDarkUrl: e.logoDarkUrl ?? data?.logoDarkUrl ?? null,
|
|
396
|
+
faviconUrl: e.faviconUrl ?? data?.faviconUrl ?? null,
|
|
397
|
+
primaryColor: e.primaryColor ?? data?.primaryColor ?? null,
|
|
398
|
+
accentColor: e.accentColor ?? data?.accentColor ?? null,
|
|
399
|
+
backgroundColor: e.backgroundColor ?? data?.backgroundColor ?? null,
|
|
400
|
+
surfaceColor: e.surfaceColor ?? data?.surfaceColor ?? null,
|
|
401
|
+
textColor: e.textColor ?? data?.textColor ?? null,
|
|
402
|
+
fontFamilyBody: e.fontFamilyBody ?? data?.fontFamilyBody ?? null,
|
|
403
|
+
fontFamilyHeading: e.fontFamilyHeading ?? data?.fontFamilyHeading ?? null,
|
|
404
|
+
customFontUrl: e.customFontUrl ?? data?.customFontUrl ?? null,
|
|
405
|
+
borderRadius: e.borderRadius ?? data?.borderRadius ?? null,
|
|
406
|
+
backgroundImageUrl: e.backgroundImageUrl ?? data?.backgroundImageUrl ?? null,
|
|
407
|
+
customCss: e.customCss ?? data?.customCss ?? null,
|
|
408
|
+
loginLayout: e.loginLayout ?? data?.loginLayout ?? null,
|
|
409
|
+
socialButtonStyle: e.socialButtonStyle ?? data?.socialButtonStyle ?? null,
|
|
410
|
+
footerText: e.footerText ?? data?.footerText ?? null,
|
|
411
|
+
brandingRev: meta.brandingRev ?? data?.brandingRev ?? null
|
|
412
|
+
};
|
|
413
|
+
}
|
|
414
|
+
function useResolvedSdkBranding(iqAuthBaseUrl, appId) {
|
|
415
|
+
const ctx = useContext(IQAuthContext);
|
|
416
|
+
const resolvedAppId = appId ?? ctx?.manager?.appKey ?? null;
|
|
417
|
+
const url = `${iqAuthBaseUrl.replace(/\/$/, "")}/api/public/branding${resolvedAppId ? `?appId=${encodeURIComponent(resolvedAppId)}` : ""}`;
|
|
418
|
+
const cached = sdkBrandingCache.get(url);
|
|
419
|
+
const fresh = cached && Date.now() - cached.ts < SDK_BRANDING_TTL_MS ? cached.data : null;
|
|
420
|
+
const [b, setB] = useState(fresh);
|
|
421
|
+
useEffect(() => {
|
|
422
|
+
let cancelled = false;
|
|
423
|
+
const entry = sdkBrandingCache.get(url);
|
|
424
|
+
const headers = {};
|
|
425
|
+
if (entry?.rev) headers["If-None-Match"] = `W/"brand-${entry.rev}"`;
|
|
426
|
+
if (entry) setB(entry.data);
|
|
427
|
+
fetch(url, { credentials: "include", headers }).then(async (r) => {
|
|
428
|
+
if (cancelled) return;
|
|
429
|
+
if (r.status === 304 && entry) {
|
|
430
|
+
sdkBrandingCache.set(url, { ...entry, ts: Date.now() });
|
|
431
|
+
return;
|
|
432
|
+
}
|
|
433
|
+
if (!r.ok) return;
|
|
434
|
+
const p = await r.json().catch(() => null);
|
|
435
|
+
if (!p?.data) return;
|
|
436
|
+
const flat = flattenBrandingPayload(p.data);
|
|
437
|
+
sdkBrandingCache.set(url, { ts: Date.now(), rev: flat.brandingRev || "", data: flat });
|
|
438
|
+
setB(flat);
|
|
439
|
+
}).catch(() => {
|
|
440
|
+
});
|
|
441
|
+
return () => {
|
|
442
|
+
cancelled = true;
|
|
443
|
+
};
|
|
444
|
+
}, [url]);
|
|
445
|
+
return b;
|
|
446
|
+
}
|
|
321
447
|
function ensureSdkShellStyles() {
|
|
322
448
|
if (typeof document === "undefined" || sdkShellStylesInjected) return;
|
|
323
449
|
const tag = document.createElement("style");
|
|
@@ -363,35 +489,61 @@ function Shell({
|
|
|
363
489
|
const brandVars = brandStyle(branding);
|
|
364
490
|
const brandName = branding?.brandName || "IQAuth";
|
|
365
491
|
const heroImage = branding?.heroImageUrl || null;
|
|
492
|
+
const layout = (branding?.loginLayout || "split_screen").toString();
|
|
493
|
+
const bgImage = branding?.backgroundImageUrl || null;
|
|
494
|
+
const fontUrl = branding?.customFontUrl || null;
|
|
495
|
+
const socialStyle = (branding?.socialButtonStyle || "").toString();
|
|
366
496
|
const heroStyle = heroImage ? { ["--iqauth-sdk-hero-image"]: `url("${heroImage.replace(/"/g, '\\"')}")` } : {};
|
|
497
|
+
const shellStyle = {
|
|
498
|
+
...brandVars,
|
|
499
|
+
...layout === "full_bleed" && bgImage ? { backgroundImage: `linear-gradient(rgba(15,23,42,0.35), rgba(15,23,42,0.45)), url("${bgImage.replace(/"/g, '\\"')}")` } : {}
|
|
500
|
+
};
|
|
367
501
|
const supportLink = branding?.supportUrl ? branding.supportUrl : branding?.supportEmail ? `mailto:${branding.supportEmail}` : null;
|
|
368
502
|
const hasFooterLinks = !!(branding?.termsUrl || branding?.privacyUrl || supportLink);
|
|
369
|
-
return /* @__PURE__ */ jsxs(
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
503
|
+
return /* @__PURE__ */ jsxs(
|
|
504
|
+
"div",
|
|
505
|
+
{
|
|
506
|
+
className: `iqauth-sdk-shell${className ? ` ${className}` : ""}`,
|
|
507
|
+
"data-layout": layout,
|
|
508
|
+
"data-social-style": socialStyle || void 0,
|
|
509
|
+
style: shellStyle,
|
|
510
|
+
"data-iqauth-shell": "",
|
|
511
|
+
"data-branding-rev": branding?.brandingRev || "",
|
|
512
|
+
children: [
|
|
513
|
+
/* @__PURE__ */ jsx("style", { "data-brand": true, children: [
|
|
514
|
+
fontUrl ? `@font-face{font-family:"${(branding?.fontFamilyBody || "Brand").replace(/"/g, "")}";src:url("${fontUrl.replace(/"/g, '\\"')}");font-display:swap;}` : "",
|
|
515
|
+
sanitizeBrandCss(branding?.customCss)
|
|
516
|
+
].filter(Boolean).join("\n") }),
|
|
517
|
+
/* @__PURE__ */ jsxs("aside", { className: "iqauth-sdk-hero", "data-bg-image": heroImage ? "true" : "false", style: heroStyle, "aria-hidden": "true", children: [
|
|
518
|
+
/* @__PURE__ */ jsx("div", { className: "iqauth-sdk-hero-brand", style: { display: "flex", alignItems: "center", gap: 12 }, children: /* @__PURE__ */ jsx(SdkBrandLogo, { branding, alt: "", fallback: /* @__PURE__ */ jsx("span", { className: "iqauth-sdk-hero-name", children: brandName }) }) }),
|
|
519
|
+
/* @__PURE__ */ jsxs("div", { className: "iqauth-sdk-hero-content", children: [
|
|
520
|
+
/* @__PURE__ */ jsx("h2", { children: branding?.tagline || `Welcome to ${brandName}` }),
|
|
521
|
+
/* @__PURE__ */ jsx("p", { children: branding?.loginSideCopy || branding?.loginSubheadline || `Sign in to continue to your ${brandName} workspace.` })
|
|
522
|
+
] }),
|
|
523
|
+
/* @__PURE__ */ jsx("div", { className: "iqauth-sdk-hero-foot", children: `\xA9 ${(/* @__PURE__ */ new Date()).getFullYear()} ${brandName}` })
|
|
524
|
+
] }),
|
|
525
|
+
/* @__PURE__ */ jsx("div", { className: "iqauth-sdk-pane", children: /* @__PURE__ */ jsxs("main", { style: { width: "100%", maxWidth: 420 }, children: [
|
|
526
|
+
/* @__PURE__ */ jsx("div", { className: "iqauth-sdk-mobile-brand", children: /* @__PURE__ */ jsx(SdkBrandLogo, { branding, alt: `${brandName} logo`, fallback: /* @__PURE__ */ jsx("span", { children: brandName }) }) }),
|
|
527
|
+
/* @__PURE__ */ jsxs("section", { className: "iqauth-sdk-card", children: [
|
|
528
|
+
title || subtitle ? /* @__PURE__ */ jsxs("div", { className: "iqauth-sdk-card-header", children: [
|
|
529
|
+
title ? /* @__PURE__ */ jsx("h1", { children: title }) : null,
|
|
530
|
+
subtitle ? /* @__PURE__ */ jsx("p", { children: subtitle }) : null
|
|
531
|
+
] }) : null,
|
|
532
|
+
/* @__PURE__ */ jsx("div", { className: "iqauth-sdk-card-body", children })
|
|
533
|
+
] }),
|
|
534
|
+
hasFooterLinks || branding?.footerText ? /* @__PURE__ */ jsxs("footer", { className: "iqauth-sdk-footer", children: [
|
|
535
|
+
branding?.footerText ? /* @__PURE__ */ jsx("div", { "data-testid": "text-brand-footer-sdk", style: { fontSize: 12, opacity: 0.75 }, children: branding.footerText }) : null,
|
|
536
|
+
hasFooterLinks ? /* @__PURE__ */ jsxs("div", { className: "iqauth-sdk-footer-links", children: [
|
|
537
|
+
branding?.termsUrl ? /* @__PURE__ */ jsx("a", { href: branding.termsUrl, target: "_blank", rel: "noreferrer noopener", children: "Terms" }) : null,
|
|
538
|
+
branding?.privacyUrl ? /* @__PURE__ */ jsx("a", { href: branding.privacyUrl, target: "_blank", rel: "noreferrer noopener", children: "Privacy" }) : null,
|
|
539
|
+
supportLink ? /* @__PURE__ */ jsx("a", { href: supportLink, target: "_blank", rel: "noreferrer noopener", children: "Support" }) : null
|
|
540
|
+
] }) : null
|
|
541
|
+
] }) : null
|
|
542
|
+
] }) })
|
|
543
|
+
]
|
|
544
|
+
},
|
|
545
|
+
branding?.brandingRev || void 0
|
|
546
|
+
);
|
|
395
547
|
}
|
|
396
548
|
function Field({ label, children }) {
|
|
397
549
|
return /* @__PURE__ */ jsxs("label", { style: { display: "flex", flexDirection: "column", gap: 6, fontSize: 13 }, children: [
|
|
@@ -461,7 +613,15 @@ function ErrorBanner({ message }) {
|
|
|
461
613
|
color: "#b91c1c"
|
|
462
614
|
}, children: message });
|
|
463
615
|
}
|
|
464
|
-
function
|
|
616
|
+
function isSilentSsoEligible(ctx, effectivePrompt) {
|
|
617
|
+
if (!ctx) return false;
|
|
618
|
+
if (effectivePrompt === "login") return false;
|
|
619
|
+
if (!ctx.session) return false;
|
|
620
|
+
if (!ctx.app.defaultClientId) return false;
|
|
621
|
+
if (!ctx.returnAllowed) return false;
|
|
622
|
+
return true;
|
|
623
|
+
}
|
|
624
|
+
function SignIn({ iqAuthBaseUrl, appKey, returnTo, onRedirect, className, prompt }) {
|
|
465
625
|
const { ctx, loading, error } = useIQAuthSignInContext(iqAuthBaseUrl, appKey, returnTo);
|
|
466
626
|
const [email, setEmail] = useState("");
|
|
467
627
|
const [password, setPassword] = useState("");
|
|
@@ -470,6 +630,18 @@ function SignIn({ iqAuthBaseUrl, appKey, returnTo, onRedirect, className }) {
|
|
|
470
630
|
const [mfa, setMfa] = useState(null);
|
|
471
631
|
const [tenantSel, setTenantSel] = useState(null);
|
|
472
632
|
const [oauthExchanging, setOauthExchanging] = useState(false);
|
|
633
|
+
const [silent, setSilent] = useState("idle");
|
|
634
|
+
const [forcePrompt, setForcePrompt] = useState(false);
|
|
635
|
+
const effectivePrompt = useMemo(() => {
|
|
636
|
+
if (prompt === "login" || forcePrompt) return "login";
|
|
637
|
+
if (typeof window !== "undefined") {
|
|
638
|
+
try {
|
|
639
|
+
if (new URLSearchParams(window.location.search).get("prompt") === "login") return "login";
|
|
640
|
+
} catch {
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
return void 0;
|
|
644
|
+
}, [prompt, forcePrompt]);
|
|
473
645
|
const oidcPayload = () => ({
|
|
474
646
|
client_id: ctx?.app.defaultClientId,
|
|
475
647
|
redirect_uri: returnTo,
|
|
@@ -559,6 +731,58 @@ function SignIn({ iqAuthBaseUrl, appKey, returnTo, onRedirect, className }) {
|
|
|
559
731
|
const url = `${iqAuthBaseUrl.replace(/\/$/, "")}/api/v1/auth/google?redirect_uri=${encodeURIComponent(bridgeUrl)}&client_id=${encodeURIComponent(ctx.app.defaultClientId)}`;
|
|
560
732
|
window.location.href = url;
|
|
561
733
|
};
|
|
734
|
+
useEffect(() => {
|
|
735
|
+
if (loading || error || !ctx) return;
|
|
736
|
+
if (effectivePrompt === "login") {
|
|
737
|
+
setSilent("skipped");
|
|
738
|
+
return;
|
|
739
|
+
}
|
|
740
|
+
if (silent !== "idle") return;
|
|
741
|
+
if (!ctx.session || !ctx.app.defaultClientId || !ctx.returnAllowed) {
|
|
742
|
+
setSilent("skipped");
|
|
743
|
+
return;
|
|
744
|
+
}
|
|
745
|
+
setSilent("trying");
|
|
746
|
+
(async () => {
|
|
747
|
+
try {
|
|
748
|
+
const r = await fetch(`${iqAuthBaseUrl.replace(/\/$/, "")}/oidc/sso-resume`, {
|
|
749
|
+
method: "POST",
|
|
750
|
+
headers: { "Content-Type": "application/json" },
|
|
751
|
+
credentials: "include",
|
|
752
|
+
body: JSON.stringify(oidcPayload())
|
|
753
|
+
});
|
|
754
|
+
const payload = await r.json().catch(() => ({}));
|
|
755
|
+
if (payload?.type === "redirect" && payload.redirectUrl) {
|
|
756
|
+
(onRedirect || ((u) => {
|
|
757
|
+
window.location.replace(u);
|
|
758
|
+
}))(payload.redirectUrl);
|
|
759
|
+
return;
|
|
760
|
+
}
|
|
761
|
+
if (payload?.type === "tenant_selection") {
|
|
762
|
+
setTenantSel({ token: payload.tenantSelectionToken, tenants: payload.tenants || [] });
|
|
763
|
+
setSilent("failed");
|
|
764
|
+
return;
|
|
765
|
+
}
|
|
766
|
+
setSilent("failed");
|
|
767
|
+
} catch {
|
|
768
|
+
setSilent("failed");
|
|
769
|
+
}
|
|
770
|
+
})();
|
|
771
|
+
}, [loading, error, ctx, effectivePrompt]);
|
|
772
|
+
const switchAccount = (e) => {
|
|
773
|
+
if (e) e.preventDefault();
|
|
774
|
+
setForcePrompt(true);
|
|
775
|
+
setSilent("skipped");
|
|
776
|
+
setTenantSel(null);
|
|
777
|
+
if (typeof window !== "undefined") {
|
|
778
|
+
try {
|
|
779
|
+
const u = new URL(window.location.href);
|
|
780
|
+
u.searchParams.set("prompt", "login");
|
|
781
|
+
window.history.replaceState({}, "", u.toString());
|
|
782
|
+
} catch {
|
|
783
|
+
}
|
|
784
|
+
}
|
|
785
|
+
};
|
|
562
786
|
useEffect(() => {
|
|
563
787
|
if (!ctx?.app.defaultClientId) return;
|
|
564
788
|
const params = new URLSearchParams(window.location.search);
|
|
@@ -596,6 +820,13 @@ function SignIn({ iqAuthBaseUrl, appKey, returnTo, onRedirect, className }) {
|
|
|
596
820
|
if (loading || oauthExchanging) return /* @__PURE__ */ jsx(Shell, { branding: ctx?.branding || null, className, title: oauthExchanging ? "Completing sign-in\u2026" : "Loading\u2026", children: /* @__PURE__ */ jsx("p", { children: oauthExchanging ? "Completing sign-in\u2026" : "Loading\u2026" }) });
|
|
597
821
|
if (error || !ctx) return /* @__PURE__ */ jsx(Shell, { branding: null, className, title: "Application unavailable", children: /* @__PURE__ */ jsx(ErrorBanner, { message: error || "Failed to load app context" }) });
|
|
598
822
|
if (!ctx.returnAllowed) return /* @__PURE__ */ jsx(Shell, { branding: ctx.branding, className, title: "Invalid redirect", children: /* @__PURE__ */ jsx(ErrorBanner, { message: `returnTo "${returnTo}" is not in this app's allowed origins.` }) });
|
|
823
|
+
const silentEligible = isSilentSsoEligible(ctx, effectivePrompt);
|
|
824
|
+
if (silentEligible && silent !== "failed") {
|
|
825
|
+
return /* @__PURE__ */ jsxs(Shell, { branding: ctx.branding, className, title: "Signing you in\u2026", subtitle: ctx.session ? `Welcome back, ${ctx.session.name || ctx.session.email}.` : void 0, children: [
|
|
826
|
+
/* @__PURE__ */ jsx("p", { "data-testid": "text-silent-resume", style: { fontSize: 14, opacity: 0.8 }, children: "Resuming your session." }),
|
|
827
|
+
/* @__PURE__ */ jsx("a", { href: "#", onClick: switchAccount, "data-testid": "link-switch-account", style: { fontSize: 13 }, children: "Not you? Use a different account" })
|
|
828
|
+
] });
|
|
829
|
+
}
|
|
599
830
|
const cardTitle = ctx.branding?.loginHeadline || `Sign in to ${ctx.app.name}`;
|
|
600
831
|
const cardSubtitle = ctx.branding?.loginSubheadline || void 0;
|
|
601
832
|
return /* @__PURE__ */ jsxs(Shell, { branding: ctx.branding, className, title: cardTitle, subtitle: cardSubtitle, children: [
|
|
@@ -645,7 +876,11 @@ function SignIn({ iqAuthBaseUrl, appKey, returnTo, onRedirect, className }) {
|
|
|
645
876
|
/* @__PURE__ */ jsx(Field, { label: "Password", children: /* @__PURE__ */ jsx("input", { style: inputStyle(), type: "password", autoComplete: "current-password", required: true, value: password, onChange: (e) => setPassword(e.target.value) }) }),
|
|
646
877
|
/* @__PURE__ */ jsx(PrimaryButton, { type: "submit", disabled: submitting || !email || !password, children: submitting ? "Signing in\u2026" : "Sign in" })
|
|
647
878
|
] })
|
|
648
|
-
] })
|
|
879
|
+
] }),
|
|
880
|
+
(silent === "failed" || effectivePrompt === "login" && ctx.session) && !mfa ? /* @__PURE__ */ jsxs("p", { style: { marginTop: 12, fontSize: 13, opacity: 0.75 }, children: [
|
|
881
|
+
silent === "failed" && ctx.session ? "Couldn't resume your session. " : null,
|
|
882
|
+
/* @__PURE__ */ jsx("a", { href: "#", onClick: switchAccount, "data-testid": "link-switch-account", children: "Use a different account" })
|
|
883
|
+
] }) : null
|
|
649
884
|
] });
|
|
650
885
|
}
|
|
651
886
|
function SignUp({ iqAuthBaseUrl, appKey, returnTo, onSuccess, className }) {
|
|
@@ -696,6 +931,9 @@ function initialsOf(name, email) {
|
|
|
696
931
|
function UserButton({ iqAuthBaseUrl, accountUrl, onSignOut, className }) {
|
|
697
932
|
const [user, setUser] = useState(null);
|
|
698
933
|
const [open, setOpen] = useState(false);
|
|
934
|
+
const branding = useResolvedSdkBranding(iqAuthBaseUrl);
|
|
935
|
+
const accent = branding?.accentColor || "#6366f1";
|
|
936
|
+
const primary = branding?.primaryColor || "#0f172a";
|
|
699
937
|
useEffect(() => {
|
|
700
938
|
let cancelled = false;
|
|
701
939
|
fetch(`${iqAuthBaseUrl.replace(/\/$/, "")}/api/v1/auth/me`, { credentials: "include" }).then((r) => r.json()).then((p) => {
|
|
@@ -716,59 +954,69 @@ function UserButton({ iqAuthBaseUrl, accountUrl, onSignOut, className }) {
|
|
|
716
954
|
};
|
|
717
955
|
if (!user) return null;
|
|
718
956
|
const target = accountUrl || `${iqAuthBaseUrl.replace(/\/$/, "")}/account`;
|
|
719
|
-
return /* @__PURE__ */ jsxs(
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
957
|
+
return /* @__PURE__ */ jsxs(
|
|
958
|
+
"div",
|
|
959
|
+
{
|
|
960
|
+
className,
|
|
961
|
+
style: { position: "relative", display: "inline-block", ...brandStyle(branding) },
|
|
962
|
+
"data-iqauth-sdk-userbutton": "",
|
|
963
|
+
"data-branding-rev": branding?.brandingRev || "",
|
|
964
|
+
children: [
|
|
965
|
+
/* @__PURE__ */ jsx(
|
|
966
|
+
"button",
|
|
967
|
+
{
|
|
968
|
+
type: "button",
|
|
969
|
+
"aria-haspopup": "menu",
|
|
970
|
+
"aria-expanded": open,
|
|
971
|
+
onClick: () => setOpen((o) => !o),
|
|
972
|
+
style: {
|
|
973
|
+
width: 32,
|
|
974
|
+
height: 32,
|
|
975
|
+
borderRadius: "50%",
|
|
976
|
+
background: accent,
|
|
977
|
+
color: "#fff",
|
|
978
|
+
border: "none",
|
|
979
|
+
cursor: "pointer",
|
|
980
|
+
fontSize: 12,
|
|
981
|
+
fontWeight: 600
|
|
982
|
+
},
|
|
983
|
+
children: user.picture ? /* @__PURE__ */ jsx("img", { src: user.picture, alt: user.name, style: { width: "100%", height: "100%", borderRadius: "50%" } }) : initialsOf(user.name, user.email)
|
|
984
|
+
}
|
|
985
|
+
),
|
|
986
|
+
open ? /* @__PURE__ */ jsxs("div", { role: "menu", style: {
|
|
987
|
+
position: "absolute",
|
|
988
|
+
right: 0,
|
|
989
|
+
top: 40,
|
|
990
|
+
minWidth: 200,
|
|
991
|
+
background: "#fff",
|
|
992
|
+
border: "1px solid rgba(15,23,42,0.12)",
|
|
993
|
+
borderRadius: 8,
|
|
994
|
+
boxShadow: "0 4px 12px rgba(0,0,0,0.08)",
|
|
995
|
+
padding: 8,
|
|
996
|
+
zIndex: 100
|
|
997
|
+
}, children: [
|
|
998
|
+
/* @__PURE__ */ jsxs("div", { style: { padding: "8px 10px", fontSize: 12, opacity: 0.7, borderBottom: "1px solid rgba(15,23,42,0.06)" }, children: [
|
|
999
|
+
/* @__PURE__ */ jsx("div", { style: { fontWeight: 500, color: "#0f172a" }, children: user.name }),
|
|
1000
|
+
/* @__PURE__ */ jsx("div", { children: user.email })
|
|
1001
|
+
] }),
|
|
1002
|
+
/* @__PURE__ */ jsx("a", { href: target, role: "menuitem", style: { display: "block", padding: "8px 10px", fontSize: 13, color: primary, textDecoration: "none" }, children: "Account" }),
|
|
1003
|
+
/* @__PURE__ */ jsx(
|
|
1004
|
+
"button",
|
|
1005
|
+
{
|
|
1006
|
+
role: "menuitem",
|
|
1007
|
+
type: "button",
|
|
1008
|
+
onClick: signOut2,
|
|
1009
|
+
style: { display: "block", width: "100%", textAlign: "left", padding: "8px 10px", fontSize: 13, background: "transparent", border: "none", cursor: "pointer", color: "#b91c1c" },
|
|
1010
|
+
children: "Sign out"
|
|
1011
|
+
}
|
|
1012
|
+
)
|
|
1013
|
+
] }) : null
|
|
1014
|
+
]
|
|
1015
|
+
}
|
|
1016
|
+
);
|
|
770
1017
|
}
|
|
771
1018
|
function UserProfile({ iqAuthBaseUrl, className }) {
|
|
1019
|
+
const branding = useResolvedSdkBranding(iqAuthBaseUrl);
|
|
772
1020
|
const [user, setUser] = useState(null);
|
|
773
1021
|
const [oldPassword, setOldPassword] = useState("");
|
|
774
1022
|
const [newPassword, setNewPassword] = useState("");
|
|
@@ -802,8 +1050,8 @@ function UserProfile({ iqAuthBaseUrl, className }) {
|
|
|
802
1050
|
await fetch(`${iqAuthBaseUrl.replace(/\/$/, "")}/api/v1/auth/sessions/${sessionId}`, { method: "DELETE", credentials: "include" });
|
|
803
1051
|
setSessions((prev) => prev.filter((s) => s.id !== sessionId));
|
|
804
1052
|
};
|
|
805
|
-
if (!user) return /* @__PURE__ */ jsx(Shell, { branding
|
|
806
|
-
return /* @__PURE__ */ jsxs(Shell, { branding
|
|
1053
|
+
if (!user) return /* @__PURE__ */ jsx(Shell, { branding, className, children: /* @__PURE__ */ jsx("p", { children: "Loading account\u2026" }) });
|
|
1054
|
+
return /* @__PURE__ */ jsxs(Shell, { branding, className, children: [
|
|
807
1055
|
/* @__PURE__ */ jsx("h2", { style: { fontSize: 20, fontWeight: 600, margin: "0 0 12px" }, children: "Your account" }),
|
|
808
1056
|
/* @__PURE__ */ jsxs("section", { "aria-labelledby": "iqauth-profile", style: { marginBottom: 20 }, children: [
|
|
809
1057
|
/* @__PURE__ */ jsx("h3", { id: "iqauth-profile", style: { fontSize: 14, fontWeight: 600 }, children: "Profile" }),
|
|
@@ -838,6 +1086,8 @@ function UserProfile({ iqAuthBaseUrl, className }) {
|
|
|
838
1086
|
] });
|
|
839
1087
|
}
|
|
840
1088
|
function OrganizationSwitcher({ iqAuthBaseUrl, onSwitched, className }) {
|
|
1089
|
+
const branding = useResolvedSdkBranding(iqAuthBaseUrl);
|
|
1090
|
+
const accent = branding?.accentColor || "#6366f1";
|
|
841
1091
|
const [memberships, setMemberships] = useState([]);
|
|
842
1092
|
const [activeTenantId, setActiveTenantId] = useState(null);
|
|
843
1093
|
const [open, setOpen] = useState(false);
|
|
@@ -863,59 +1113,70 @@ function OrganizationSwitcher({ iqAuthBaseUrl, onSwitched, className }) {
|
|
|
863
1113
|
}
|
|
864
1114
|
};
|
|
865
1115
|
const active = memberships.find((m) => m.tenantId === activeTenantId);
|
|
866
|
-
return /* @__PURE__ */ jsxs(
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
1116
|
+
return /* @__PURE__ */ jsxs(
|
|
1117
|
+
"div",
|
|
1118
|
+
{
|
|
1119
|
+
className,
|
|
1120
|
+
style: { position: "relative", display: "inline-block", ...brandStyle(branding) },
|
|
1121
|
+
"data-iqauth-sdk-orgswitcher": "",
|
|
1122
|
+
"data-branding-rev": branding?.brandingRev || "",
|
|
1123
|
+
children: [
|
|
1124
|
+
/* @__PURE__ */ jsx(
|
|
1125
|
+
"button",
|
|
1126
|
+
{
|
|
1127
|
+
type: "button",
|
|
1128
|
+
"aria-haspopup": "menu",
|
|
1129
|
+
"aria-expanded": open,
|
|
1130
|
+
onClick: () => setOpen((o) => !o),
|
|
1131
|
+
style: { background: "transparent", border: `1px solid ${accent}55`, color: branding?.primaryColor || "#0f172a", padding: "6px 12px", borderRadius: 6, cursor: "pointer", fontSize: 13 },
|
|
1132
|
+
children: active?.tenantName || active?.tenantSlug || "Select organization"
|
|
1133
|
+
}
|
|
1134
|
+
),
|
|
1135
|
+
open ? /* @__PURE__ */ jsx("div", { role: "menu", style: {
|
|
1136
|
+
position: "absolute",
|
|
1137
|
+
left: 0,
|
|
1138
|
+
top: 36,
|
|
1139
|
+
minWidth: 220,
|
|
1140
|
+
background: "#fff",
|
|
1141
|
+
border: "1px solid rgba(15,23,42,0.12)",
|
|
1142
|
+
borderRadius: 8,
|
|
1143
|
+
boxShadow: "0 4px 12px rgba(0,0,0,0.08)",
|
|
1144
|
+
padding: 8,
|
|
1145
|
+
zIndex: 100
|
|
1146
|
+
}, children: memberships.length === 0 ? /* @__PURE__ */ jsx("p", { style: { fontSize: 13, opacity: 0.6, padding: "4px 6px" }, children: "No memberships" }) : memberships.map((m) => /* @__PURE__ */ jsxs(
|
|
1147
|
+
"button",
|
|
1148
|
+
{
|
|
1149
|
+
role: "menuitem",
|
|
1150
|
+
type: "button",
|
|
1151
|
+
onClick: () => switchTo(m.tenantId),
|
|
1152
|
+
style: {
|
|
1153
|
+
display: "block",
|
|
1154
|
+
width: "100%",
|
|
1155
|
+
textAlign: "left",
|
|
1156
|
+
padding: "8px 10px",
|
|
1157
|
+
background: m.tenantId === activeTenantId ? `${accent}14` : "transparent",
|
|
1158
|
+
border: "none",
|
|
1159
|
+
borderRadius: 4,
|
|
1160
|
+
cursor: "pointer",
|
|
1161
|
+
fontSize: 13,
|
|
1162
|
+
color: "#0f172a"
|
|
1163
|
+
},
|
|
1164
|
+
children: [
|
|
1165
|
+
/* @__PURE__ */ jsx("div", { style: { fontWeight: 500 }, children: m.tenantName || m.tenantSlug || m.tenantId }),
|
|
1166
|
+
/* @__PURE__ */ jsx("div", { style: { fontSize: 11, opacity: 0.6 }, children: m.roles.join(", ") })
|
|
1167
|
+
]
|
|
1168
|
+
},
|
|
1169
|
+
m.tenantId
|
|
1170
|
+
)) }) : null
|
|
1171
|
+
]
|
|
1172
|
+
}
|
|
1173
|
+
);
|
|
915
1174
|
}
|
|
916
1175
|
var __version__ = "phase-bc-1.0.0";
|
|
917
1176
|
export {
|
|
918
1177
|
AuthCallback,
|
|
1178
|
+
IQAuthLoaded,
|
|
1179
|
+
IQAuthLoading,
|
|
919
1180
|
IQAuthProvider,
|
|
920
1181
|
OrganizationSwitcher,
|
|
921
1182
|
RedirectToSignIn,
|
|
@@ -926,10 +1187,13 @@ export {
|
|
|
926
1187
|
UserButton,
|
|
927
1188
|
UserProfile,
|
|
928
1189
|
__version__,
|
|
1190
|
+
isSilentSsoEligible,
|
|
1191
|
+
sanitizeBrandCss,
|
|
929
1192
|
useAuth,
|
|
930
1193
|
useAuthFetch,
|
|
931
1194
|
useIQAuthSignInContext,
|
|
932
1195
|
useOrganization,
|
|
1196
|
+
useResolvedSdkBranding,
|
|
933
1197
|
useSession,
|
|
934
1198
|
useUser
|
|
935
1199
|
};
|