@iqauth/sdk 2.5.0 → 2.6.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/dist/react.js CHANGED
@@ -2374,7 +2374,19 @@ function useIQAuthSignInContext(iqAuthBaseUrl, appKey, returnTo) {
2374
2374
  let cancelled = false;
2375
2375
  setLoading(true);
2376
2376
  const url2 = `${iqAuthBaseUrl.replace(/\/$/, "")}/api/public/apps/${encodeURIComponent(appKey)}/sign-in-context?return_to=${encodeURIComponent(returnTo)}`;
2377
- fetch(url2, { credentials: "include" }).then((r) => r.json()).then((payload) => {
2377
+ fetch(url2, { credentials: "include" }).then(async (r) => {
2378
+ const contentType = r.headers.get("content-type") || "";
2379
+ if (!r.ok || !contentType.includes("json")) {
2380
+ const bodyPreview = await r.text().then((t2) => t2.slice(0, 160)).catch(() => "");
2381
+ console.error(
2382
+ `[IQAuth] sign-in-context request failed: ${r.status} ${r.statusText} (content-type: ${contentType || "\u2014"}). URL: ${url2}. Common causes: (1) iqAuthBaseUrl points at the wrong host (it should be your IQAuth issuer, e.g. https://auth.dispositioniq.com \u2014 NOT your own app's domain); (2) the app key "${appKey}" is wrong or revoked; (3) CORS preflight is blocked because this origin isn't in the app's allowed-origins list. Response body preview: ${bodyPreview}`
2383
+ );
2384
+ throw new Error(
2385
+ r.status >= 500 ? "Failed to load sign-in context (server error)" : `Failed to load sign-in context (HTTP ${r.status})`
2386
+ );
2387
+ }
2388
+ return r.json();
2389
+ }).then((payload) => {
2378
2390
  if (cancelled) return;
2379
2391
  if (payload?.success === false) throw new Error(payload?.error?.message || "Failed to load sign-in context");
2380
2392
  setCtx(payload.data);
@@ -2397,6 +2409,14 @@ var SHELL_CSS = `
2397
2409
  grid-template-columns: 1fr;
2398
2410
  background: var(--brand-bg, #f7f7f6);
2399
2411
  color: var(--brand-text, #0f172a);
2412
+ /* Container queries so the two-pane layout responds to the SDK's
2413
+ RENDERED width, not the viewport. This keeps the form usable when
2414
+ a host app embeds <SignIn/> inside a narrower card or sidebar
2415
+ instead of full-screen \u2014 the previous viewport @media query would
2416
+ happily render the side-by-side hero+form into a 200px container
2417
+ and wrap text one character per line. */
2418
+ container-type: inline-size;
2419
+ container-name: iqauth-sdk;
2400
2420
  }
2401
2421
  .iqauth-sdk-hero { display: none; }
2402
2422
  .iqauth-sdk-pane {
@@ -2446,7 +2466,7 @@ var SHELL_CSS = `
2446
2466
  .iqauth-sdk-google-btn:hover { background: #f8fafc; border-color: rgba(15,23,42,0.28); }
2447
2467
  .iqauth-sdk-google-btn[disabled] { opacity: 0.6; cursor: not-allowed; }
2448
2468
 
2449
- @media (min-width: 768px) {
2469
+ @container iqauth-sdk (min-width: 768px) {
2450
2470
  .iqauth-sdk-shell:not([data-layout="centered_card"]):not([data-layout="full_bleed"]) { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
2451
2471
  .iqauth-sdk-hero {
2452
2472
  display: flex; flex-direction: column; justify-content: space-between;
@@ -2467,7 +2487,7 @@ var SHELL_CSS = `
2467
2487
  .iqauth-sdk-hero-foot { font-size: 12px; opacity: 0.7; }
2468
2488
  .iqauth-sdk-mobile-brand { display: none; }
2469
2489
  }
2470
- @media (min-width: 1280px) {
2490
+ @container iqauth-sdk (min-width: 1280px) {
2471
2491
  .iqauth-sdk-shell:not([data-layout="centered_card"]):not([data-layout="full_bleed"]) { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); }
2472
2492
  }
2473
2493
  `;
package/dist/react.mjs CHANGED
@@ -629,7 +629,19 @@ function useIQAuthSignInContext(iqAuthBaseUrl, appKey, returnTo) {
629
629
  let cancelled = false;
630
630
  setLoading(true);
631
631
  const url = `${iqAuthBaseUrl.replace(/\/$/, "")}/api/public/apps/${encodeURIComponent(appKey)}/sign-in-context?return_to=${encodeURIComponent(returnTo)}`;
632
- fetch(url, { credentials: "include" }).then((r) => r.json()).then((payload) => {
632
+ fetch(url, { credentials: "include" }).then(async (r) => {
633
+ const contentType = r.headers.get("content-type") || "";
634
+ if (!r.ok || !contentType.includes("json")) {
635
+ const bodyPreview = await r.text().then((t2) => t2.slice(0, 160)).catch(() => "");
636
+ console.error(
637
+ `[IQAuth] sign-in-context request failed: ${r.status} ${r.statusText} (content-type: ${contentType || "\u2014"}). URL: ${url}. Common causes: (1) iqAuthBaseUrl points at the wrong host (it should be your IQAuth issuer, e.g. https://auth.dispositioniq.com \u2014 NOT your own app's domain); (2) the app key "${appKey}" is wrong or revoked; (3) CORS preflight is blocked because this origin isn't in the app's allowed-origins list. Response body preview: ${bodyPreview}`
638
+ );
639
+ throw new Error(
640
+ r.status >= 500 ? "Failed to load sign-in context (server error)" : `Failed to load sign-in context (HTTP ${r.status})`
641
+ );
642
+ }
643
+ return r.json();
644
+ }).then((payload) => {
633
645
  if (cancelled) return;
634
646
  if (payload?.success === false) throw new Error(payload?.error?.message || "Failed to load sign-in context");
635
647
  setCtx(payload.data);
@@ -652,6 +664,14 @@ var SHELL_CSS = `
652
664
  grid-template-columns: 1fr;
653
665
  background: var(--brand-bg, #f7f7f6);
654
666
  color: var(--brand-text, #0f172a);
667
+ /* Container queries so the two-pane layout responds to the SDK's
668
+ RENDERED width, not the viewport. This keeps the form usable when
669
+ a host app embeds <SignIn/> inside a narrower card or sidebar
670
+ instead of full-screen \u2014 the previous viewport @media query would
671
+ happily render the side-by-side hero+form into a 200px container
672
+ and wrap text one character per line. */
673
+ container-type: inline-size;
674
+ container-name: iqauth-sdk;
655
675
  }
656
676
  .iqauth-sdk-hero { display: none; }
657
677
  .iqauth-sdk-pane {
@@ -701,7 +721,7 @@ var SHELL_CSS = `
701
721
  .iqauth-sdk-google-btn:hover { background: #f8fafc; border-color: rgba(15,23,42,0.28); }
702
722
  .iqauth-sdk-google-btn[disabled] { opacity: 0.6; cursor: not-allowed; }
703
723
 
704
- @media (min-width: 768px) {
724
+ @container iqauth-sdk (min-width: 768px) {
705
725
  .iqauth-sdk-shell:not([data-layout="centered_card"]):not([data-layout="full_bleed"]) { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
706
726
  .iqauth-sdk-hero {
707
727
  display: flex; flex-direction: column; justify-content: space-between;
@@ -722,7 +742,7 @@ var SHELL_CSS = `
722
742
  .iqauth-sdk-hero-foot { font-size: 12px; opacity: 0.7; }
723
743
  .iqauth-sdk-mobile-brand { display: none; }
724
744
  }
725
- @media (min-width: 1280px) {
745
+ @container iqauth-sdk (min-width: 1280px) {
726
746
  .iqauth-sdk-shell:not([data-layout="centered_card"]):not([data-layout="full_bleed"]) { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); }
727
747
  }
728
748
  `;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iqauth/sdk",
3
- "version": "2.5.0",
3
+ "version": "2.6.0",
4
4
  "description": "TypeScript SDK for IQAuth — the canonical way for all IQ projects to integrate with IQAuthService",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",