@iqauth/sdk 2.7.0 → 2.8.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.
Files changed (88) hide show
  1. package/dist/browser-session.d.mts +3 -3
  2. package/dist/browser-session.d.ts +3 -3
  3. package/dist/browser-session.js +31 -5
  4. package/dist/browser-session.mjs +1 -1
  5. package/dist/browser.d.mts +3 -3
  6. package/dist/browser.d.ts +3 -3
  7. package/dist/browser.js +23 -3
  8. package/dist/browser.mjs +1 -1
  9. package/dist/{chunk-YVALAG3B.mjs → chunk-25SSYDIP.mjs} +1 -1
  10. package/dist/{chunk-RTJAIBXY.mjs → chunk-4V7FKOTG.mjs} +23 -3
  11. package/dist/{chunk-SL3KRS4W.mjs → chunk-CIJORODR.mjs} +23 -1
  12. package/dist/chunk-JRDVUWAL.mjs +46 -0
  13. package/dist/{chunk-5T7GHBX6.mjs → chunk-TLET552H.mjs} +36 -0
  14. package/dist/{chunk-PMAFENVI.mjs → chunk-VYQ3ETCK.mjs} +27 -12
  15. package/dist/{chunk-RR2MGPTK.mjs → chunk-WHT6WKTY.mjs} +539 -83
  16. package/dist/{chunk-RUJXRTEW.mjs → chunk-WSH4SW7F.mjs} +122 -8
  17. package/dist/{chunk-JXQI62A7.mjs → chunk-ZLJPABB7.mjs} +31 -5
  18. package/dist/{client-BGFnBpfc.d.mts → client-D8L-PaWr.d.mts} +14 -4
  19. package/dist/{client-CDQ21LvW.d.ts → client-DkPL0EPZ.d.ts} +14 -4
  20. package/dist/{express-Piv2WhWM.d.ts → express-Budysq4h.d.ts} +2 -2
  21. package/dist/{express-CVNQEkOr.d.mts → express-DDTA3qV1.d.mts} +2 -2
  22. package/dist/express.d.mts +5 -5
  23. package/dist/express.d.ts +5 -5
  24. package/dist/express.js +217 -36
  25. package/dist/express.mjs +38 -26
  26. package/dist/fastify.d.mts +10 -2
  27. package/dist/fastify.d.ts +10 -2
  28. package/dist/fastify.js +260 -16
  29. package/dist/fastify.mjs +80 -5
  30. package/dist/hono.d.mts +10 -2
  31. package/dist/hono.d.ts +10 -2
  32. package/dist/hono.js +240 -16
  33. package/dist/hono.mjs +60 -5
  34. package/dist/{index-5KSZEnDe.d.ts → index-Cko-d5po.d.mts} +227 -5
  35. package/dist/{index-CKoZHAoc.d.mts → index-RNqwEcmY.d.ts} +227 -5
  36. package/dist/index.d.mts +5 -5
  37. package/dist/index.d.ts +5 -5
  38. package/dist/index.js +149 -26
  39. package/dist/index.mjs +5 -5
  40. package/dist/locales.d.mts +1 -1
  41. package/dist/locales.d.ts +1 -1
  42. package/dist/locales.js +36 -0
  43. package/dist/locales.mjs +1 -1
  44. package/dist/mobile.d.mts +3 -3
  45. package/dist/mobile.d.ts +3 -3
  46. package/dist/mobile.js +31 -5
  47. package/dist/mobile.mjs +1 -1
  48. package/dist/next.d.mts +10 -2
  49. package/dist/next.d.ts +10 -2
  50. package/dist/next.js +212 -11
  51. package/dist/next.mjs +62 -4
  52. package/dist/{provisioningBridge-M5G47LWO.d.mts → provisioningBridge-BXPMZCLe.d.ts} +30 -2
  53. package/dist/{provisioningBridge-CGpMRie4.d.ts → provisioningBridge-IEycmsgb.d.mts} +30 -2
  54. package/dist/react-permissions.d.mts +4 -4
  55. package/dist/react-permissions.d.ts +4 -4
  56. package/dist/react-permissions.mjs +4 -3
  57. package/dist/react.d.mts +4 -4
  58. package/dist/react.d.ts +4 -4
  59. package/dist/react.js +570 -41
  60. package/dist/react.mjs +19 -5
  61. package/dist/server/handlers.d.mts +56 -5
  62. package/dist/server/handlers.d.ts +56 -5
  63. package/dist/server/handlers.js +123 -8
  64. package/dist/server/handlers.mjs +3 -1
  65. package/dist/server.d.mts +28 -8
  66. package/dist/server.d.ts +28 -8
  67. package/dist/server.js +176 -14
  68. package/dist/server.mjs +9 -4
  69. package/dist/service.d.mts +3 -3
  70. package/dist/service.d.ts +3 -3
  71. package/dist/service.js +31 -5
  72. package/dist/service.mjs +1 -1
  73. package/dist/{signIn-T-CZ6t6r.d.mts → signIn-CReqfXsh.d.mts} +18 -1
  74. package/dist/{signIn-BLFnz8SV.d.ts → signIn-Cfa1GTpO.d.ts} +18 -1
  75. package/dist/{tokens-Bqhmqq_R.d.ts → tokens-9F6ETrzk.d.ts} +1 -1
  76. package/dist/{tokens-CITeoG6P.d.mts → tokens-B06VtvUi.d.mts} +1 -1
  77. package/dist/{types-XOV9XPVi.d.mts → types-Bn8O-OEd.d.mts} +66 -2
  78. package/dist/{types-XOV9XPVi.d.ts → types-Bn8O-OEd.d.ts} +66 -2
  79. package/dist/{types-BdQ2lqfT.d.mts → types-DnU2LhXR.d.mts} +6 -0
  80. package/dist/{types-BdQ2lqfT.d.ts → types-DnU2LhXR.d.ts} +6 -0
  81. package/dist/webhooks.d.mts +22 -9
  82. package/dist/webhooks.d.ts +22 -9
  83. package/dist/webhooks.js +27 -12
  84. package/dist/webhooks.mjs +1 -1
  85. package/dist/ws.d.mts +2 -2
  86. package/dist/ws.d.ts +2 -2
  87. package/docs/guides/invitations.md +65 -0
  88. package/package.json +7 -2
@@ -2,9 +2,9 @@ import * as csstype from 'csstype';
2
2
  import * as react_jsx_runtime from 'react/jsx-runtime';
3
3
  import * as React from 'react';
4
4
  import { ReactNode } from 'react';
5
- import { S as SessionManager, a as SessionSnapshot, b as SignInOptions, c as SignOutOptions, A as AccountRegistry, C as CallbackResult, M as MagicLinkRequestInput, P as PasswordlessOptions, L as LinkedIdentity, d as LinkProviderInput } from './signIn-BLFnz8SV.js';
6
- import { J as JwtClaims, S as SessionUser } from './types-XOV9XPVi.js';
7
- import { I as IQAuthLocaleBundle, b as IQAuthLocaleOverride, a as IQAuthLocaleKey } from './types-BdQ2lqfT.js';
5
+ import { S as SessionManager, a as SessionSnapshot, b as SignInOptions, c as SignOutOptions, A as AccountRegistry, C as CallbackResult, M as MagicLinkRequestInput, P as PasswordlessOptions, L as LinkedIdentity, d as LinkProviderInput } from './signIn-CReqfXsh.mjs';
6
+ import { J as JwtClaims, S as SessionUser } from './types-Bn8O-OEd.mjs';
7
+ import { I as IQAuthLocaleBundle, b as IQAuthLocaleOverride, a as IQAuthLocaleKey } from './types-DnU2LhXR.mjs';
8
8
 
9
9
  /**
10
10
  * F11 — `appearance.elements`. The keys are the slot names supported by SDK
@@ -360,13 +360,105 @@ interface ProtectProps {
360
360
  role?: string | string[];
361
361
  /** Required permission/entitlement. Pass an array to mean "any of". */
362
362
  permission?: string | string[];
363
+ /**
364
+ * Task #194 — Required scope. Matches when the active session's
365
+ * `scopeContext` claim equals the supplied `{type, id}`. Pass an array
366
+ * to mean "any of". A tenant-wide session (no `scopeContext`) does NOT
367
+ * satisfy a scope constraint — wrap such code in a separate `<Protect role>`
368
+ * gate if you also want to admit tenant-wide admins.
369
+ */
370
+ scope?: ScopeRequirement | ScopeRequirement[];
363
371
  /** Custom predicate run against `claims`. Truthy result = allowed. */
364
372
  condition?: (claims: JwtClaims | null) => boolean;
365
373
  /** Rendered when the user is not authorized. Defaults to `null`. */
366
374
  fallback?: ReactNode;
367
375
  children?: ReactNode;
368
376
  }
369
- declare function Protect({ role, permission, condition, fallback, children }: ProtectProps): React.FunctionComponentElement<{
377
+ /**
378
+ * Task #197 — Server-authoritative scope pivot, factored out of the
379
+ * `useMemberships()` hook so it can be unit-tested without rendering React.
380
+ *
381
+ * Behavior:
382
+ * 1. POST `/api/v1/auth/switch-scope` through `manager.fetch()` (which
383
+ * attaches the Bearer token + retries once on 401).
384
+ * 2. On a non-2xx response, throw with the server-provided error message
385
+ * so callers can surface it via toast / banner.
386
+ * 3. On success, adopt the access token the server returned in the JSON
387
+ * body via `manager.adoptAccessToken()`. This is the key behavior:
388
+ * the new claims (with the pivoted `scopeContext`) take effect in
389
+ * memory immediately, without a second `/refresh` round-trip that
390
+ * could fail and strand the user on a stale token despite the
391
+ * server-side pivot having already succeeded.
392
+ * 4. Fire-and-forget a `manager.refresh()` so the refresh-cookie session
393
+ * stays aligned with the new scope across tabs / future bootstraps.
394
+ * We deliberately do NOT await or throw on its failure — the pivot
395
+ * already succeeded server-side AND in memory.
396
+ * 5. Defensive fallback: if the response body omits `accessToken` (older
397
+ * server that didn't ship Task #197 yet), fall through to the legacy
398
+ * "drive a refresh and throw on failure" path.
399
+ */
400
+ declare function performScopeSwitch(manager: SessionManager, base: string, target: ScopeRequirement): Promise<void>;
401
+ /**
402
+ * Task #199 — Server-authoritative tenant pivot, mirror of
403
+ * `performScopeSwitch`. Modeled to survive a failing refresh leg the
404
+ * same way: the success response from `POST /api/v1/auth/select-tenant`
405
+ * carries the freshly-minted access token, we `adoptAccessToken()` it
406
+ * immediately, and only then fire a fire-and-forget `manager.refresh()`
407
+ * so the refresh-cookie session stays aligned across tabs / future
408
+ * bootstraps.
409
+ *
410
+ * The endpoint accepts the authenticated tenant-pivot shape (no
411
+ * `tenantSelectionToken`) when the request carries a valid access
412
+ * token — `manager.fetch()` attaches it for us.
413
+ *
414
+ * Returns a discriminated union:
415
+ * - `{ kind: "ok", tenantId }` — pivot completed
416
+ * - `{ kind: "mfa_required", tenantId, mfaChallengeToken, availableMethods }`
417
+ * - `{ kind: "scope_selection_required", tenantId, scopeSelectionToken, scopes }`
418
+ *
419
+ * Throws on non-2xx and on the legacy-server refresh fallback failing.
420
+ * The MFA and scope-selection branches were previously thrown with a
421
+ * magic-string `Error("mfa_required: …")` / `Error("scope_selection_required: …")`;
422
+ * Task #205 moves them to typed results so `<OrganizationSwitcher/>`
423
+ * and `<OrganizationList/>` can render localized prompts that route
424
+ * the user to the hosted sign-in to complete the missing step.
425
+ */
426
+ type TenantSwitchResult = {
427
+ kind: "ok";
428
+ tenantId: string;
429
+ } | {
430
+ kind: "mfa_required";
431
+ tenantId: string;
432
+ mfaChallengeToken: string;
433
+ availableMethods: string[];
434
+ } | {
435
+ kind: "scope_selection_required";
436
+ tenantId: string;
437
+ scopeSelectionToken: string;
438
+ scopes: Array<Record<string, unknown>>;
439
+ };
440
+ declare function performTenantSwitch(manager: SessionManager, base: string, tenantId: string): Promise<TenantSwitchResult>;
441
+ /** Task #194 — Shape passed to `<Protect scope>` and `useMemberships().switchScope`. */
442
+ interface ScopeRequirement {
443
+ type: "vendor" | "source" | "client";
444
+ id: string;
445
+ }
446
+ /**
447
+ * Task #194 — Pure helper that returns `true` when the supplied claims
448
+ * carry a `scopeContext` matching ANY of the supplied requirements.
449
+ * Exported so framework adapters AND tests can verify the matching rule
450
+ * without rendering React.
451
+ *
452
+ * Matching rule:
453
+ * - `claims.scopeContext.type === required.type`
454
+ * - `claims.scopeContext.id === required.id`
455
+ *
456
+ * A claims object with no `scopeContext` never matches a scope requirement
457
+ * — tenant-wide admins must be gated separately via `<Protect role>` if you
458
+ * want them to also see scope-gated UI.
459
+ */
460
+ declare function claimSatisfiesScope(claims: JwtClaims | null, required: ScopeRequirement | ScopeRequirement[]): boolean;
461
+ declare function Protect({ role, permission, scope, condition, fallback, children }: ProtectProps): React.FunctionComponentElement<{
370
462
  children?: ReactNode | undefined;
371
463
  }>;
372
464
  /**
@@ -547,8 +639,24 @@ interface SignInProps extends Partial<SharedComponentProps> {
547
639
  * F10 — Optional. Defaults to `${origin}/api/iqauth/callback` (the path
548
640
  * mounted by the framework adapters). Must be in the app's allowed
549
641
  * origins.
642
+ *
643
+ * NOTE: this is the OIDC `redirect_uri` — i.e. WHERE the authorization
644
+ * code is delivered (the adapter's callback handler), NOT the page the
645
+ * user finally lands on. To control the post-login landing page use
646
+ * {@link afterSignInUrl}.
550
647
  */
551
648
  returnTo?: string;
649
+ /**
650
+ * Where the user should land AFTER login completes (distinct from
651
+ * {@link returnTo}, which is pinned to the adapter callback). The SDK
652
+ * persists this in the `iqauth_return_to` cookie before redirecting; the
653
+ * cookies-only framework adapters' `/api/iqauth/callback` reads it and
654
+ * 302s there once the code→cookie exchange finishes. When omitted, the
655
+ * SDK reads `?return_to=` / `?next=` from the current URL; if neither is
656
+ * present the adapter falls back to `/`. Sanitized against the provider's
657
+ * `allowedReturnOrigins` (same-origin + allow-list only).
658
+ */
659
+ afterSignInUrl?: string;
552
660
  /** Called after successful redirect. By default, `window.location.href = url`. */
553
661
  onRedirect?: (url: string) => void;
554
662
  /** Pass `"login"` to force the form to render even when an SSO session is active. */
@@ -562,6 +670,22 @@ interface SignInProps extends Partial<SharedComponentProps> {
562
670
  * continue.
563
671
  */
564
672
  silentSso?: boolean;
673
+ /**
674
+ * Task #171 — Optional deep-link scope hint forwarded to the hosted
675
+ * `/oidc/sso-login`, `/oidc/sso-tenant-select`, and
676
+ * `/oidc/sso-scope-select` endpoints. When the user has only source/client
677
+ * memberships in the resolved tenant AND this hint uniquely matches one
678
+ * active membership the backend skips the picker and mints a scoped
679
+ * session straight away. Accepted forms: `{ type: "vendor"|"source"|
680
+ * "client", id: string }` or the canonical string `"<type>:<id>"`.
681
+ * When omitted, the SDK also reads `?scope_hint=<type>:<id>` from
682
+ * `window.location.search` so apps using the standard hosted entry point
683
+ * inherit deep-link hints for free.
684
+ */
685
+ scopeHint?: {
686
+ type: "vendor" | "source" | "client";
687
+ id: string;
688
+ } | string;
565
689
  }
566
690
  /**
567
691
  * Pure render-decision helper. When this returns `true`, `<SignIn/>` MUST
@@ -576,6 +700,19 @@ declare function isSilentSsoEligible(ctx: {
576
700
  };
577
701
  returnAllowed: boolean;
578
702
  } | null | undefined, effectivePrompt: "login" | undefined): boolean;
703
+ /**
704
+ * Pure resolver for `<SignIn/>`'s post-login landing page. Precedence:
705
+ * explicit `prop` → `?return_to=` → `?next=` → `/`. The result is passed
706
+ * through {@link sanitizeReturnTo} so only same-origin or allow-listed
707
+ * destinations survive (open-redirect safe). Exported so the resolution
708
+ * order can be unit-tested without a DOM.
709
+ */
710
+ declare function resolveAfterSignInDestination(args: {
711
+ prop?: string | null;
712
+ search?: string;
713
+ allowedOrigins?: string[];
714
+ currentOrigin?: string;
715
+ }): string;
579
716
  declare function SignIn(props: SignInProps): react_jsx_runtime.JSX.Element;
580
717
  interface SignUpProps extends SharedComponentProps {
581
718
  returnTo?: string;
@@ -609,6 +746,91 @@ interface OrganizationSwitcherProps {
609
746
  className?: string;
610
747
  }
611
748
  declare function OrganizationSwitcher({ iqAuthBaseUrl, onSwitched, appearance: _appearance, className }: OrganizationSwitcherProps): react_jsx_runtime.JSX.Element;
749
+ /** Task #194 — One scoped membership entry (source/client/vendor). */
750
+ interface ScopedMembership {
751
+ membershipId: string;
752
+ scopeType: "vendor" | "source" | "client";
753
+ scopeId: string;
754
+ scopeName: string;
755
+ role: string;
756
+ /** Surfaces inherited grants (e.g. a vendor-wide grant that implicitly covers a source). */
757
+ grantedVia?: "direct" | "vendor" | "source" | string;
758
+ }
759
+ interface UseMembershipsResult {
760
+ isLoading: boolean;
761
+ error: string | null;
762
+ /** Flattened source/client/vendor memberships in the active tenant. */
763
+ memberships: ScopedMembership[];
764
+ /** The scope the active access token is currently minted under (or `null` for tenant-wide). */
765
+ active: {
766
+ type: "vendor" | "source" | "client";
767
+ id: string;
768
+ role: string;
769
+ membershipId: string;
770
+ } | null;
771
+ /** Re-fetch the membership list (e.g. after an admin grants new access). */
772
+ refresh: () => Promise<void>;
773
+ /**
774
+ * Switch the active scope. Calls `POST /api/v1/auth/switch-scope` then
775
+ * `manager.refresh()` so the next access token carries the new
776
+ * `scopeContext`. Throws on HTTP errors so callers can surface a toast.
777
+ */
778
+ switchScope: (target: ScopeRequirement) => Promise<void>;
779
+ }
780
+ /**
781
+ * Task #194 — First-class scoped-memberships hook. Modelled after Clerk's
782
+ * `useOrganizationList()` but for IQAuth's source/client/vendor scopes.
783
+ *
784
+ * - `memberships`: flat list across vendors + sources + clients in the
785
+ * currently bound tenant. Fetched once on mount via
786
+ * `GET /api/v1/auth/available-scopes`.
787
+ * - `active`: derived synchronously from `snapshot.user.scopeContext`,
788
+ * so it stays in sync with refreshes triggered elsewhere (tab focus,
789
+ * cross-tab broadcast).
790
+ * - `switchScope({type, id})`: server-authoritative scope pivot.
791
+ * Returns after `manager.refresh()` resolves so consumers can `await`
792
+ * it and assume the new claim is live on the next render.
793
+ */
794
+ declare function useMemberships(): UseMembershipsResult;
795
+ interface ScopeSwitcherProps {
796
+ /** Optional callback fired after a successful switch + refresh. */
797
+ onSwitched?: (target: ScopeRequirement) => void;
798
+ /** Filter the rendered list. Defaults to all three scope types. */
799
+ include?: Array<"vendor" | "source" | "client">;
800
+ className?: string;
801
+ }
802
+ /**
803
+ * Task #194 — Headless-ish scope picker. Renders the current `active`
804
+ * scope as a button; expanding it lists every membership returned by
805
+ * `useMemberships()`. Picking one calls `switchScope()` and (on success)
806
+ * triggers `onSwitched`. Uses inline styles for the same reason
807
+ * `<OrganizationSwitcher/>` does: SDK chrome must work in any host app
808
+ * without requiring a specific CSS framework. Host apps can build their
809
+ * own UI on top of `useMemberships()` directly when they need full
810
+ * control.
811
+ */
812
+ declare function ScopeSwitcher({ onSwitched, include, className }: ScopeSwitcherProps): React.DetailedReactHTMLElement<{
813
+ className: string | undefined;
814
+ "data-testid": string;
815
+ style: {
816
+ fontSize: number;
817
+ opacity: number;
818
+ };
819
+ }, HTMLElement> | React.DetailedReactHTMLElement<{
820
+ className: string | undefined;
821
+ "data-testid": string;
822
+ style: {
823
+ fontSize: number;
824
+ color: "#b91c1c";
825
+ };
826
+ }, HTMLElement> | React.DetailedReactHTMLElement<{
827
+ className: string | undefined;
828
+ "data-testid": string;
829
+ style: {
830
+ position: "relative";
831
+ display: "inline-block";
832
+ };
833
+ }, HTMLElement> | null;
612
834
  interface ImpersonationInfo {
613
835
  isImpersonating: boolean;
614
836
  /** The admin who started the impersonation (from JWT `act` claim). */
@@ -1623,4 +1845,4 @@ interface LinkedAccountsProps extends Partial<PasswordlessOptions> {
1623
1845
  declare function LinkedAccounts({ className, onChange, ...rest }: LinkedAccountsProps): react_jsx_runtime.JSX.Element;
1624
1846
  declare const __version__ = "phase-bc-1.0.0";
1625
1847
 
1626
- export { SignUp as $, type AccountSummary as A, type RedirectToSignedInProps as B, RedirectToSignedIn as C, type UseReturnToOptions as D, useReturnTo as E, type IQAuthReturnToBouncerProps as F, IQAuthReturnToBouncer as G, preflightReturnTo as H, type IQAuthAppearanceElements as I, type AuthCallbackProps as J, AuthCallback as K, type IQAuthBranding as L, MultisessionAppSupport as M, type IQAuthSignInContext as N, type SharedComponentProps as O, type ProtectProps as P, useIQAuthSignInContext as Q, type RedirectToSignInProps as R, type SessionError as S, sanitizeBrandCss as T, type UseUserResult as U, useResolvedSdkBranding as V, type SignInProps as W, isSilentSsoEligible as X, SignIn as Y, type SignUpProps as Z, __useIQAuthInternal as _, type IQAuthAppearance as a, type UserSummary as a0, type UserButtonProps as a1, UserButton as a2, type UserProfileProps as a3, UserProfile as a4, type OrganizationSwitcherProps as a5, OrganizationSwitcher as a6, type ImpersonationInfo as a7, useImpersonation as a8, type ImpersonationBannerProps as a9, ImpersonationBanner as aa, type UseReverificationOptions as ab, useReverification as ac, type CreateOrganizationProps as ad, slugify as ae, CreateOrganization as af, type OrganizationProfileProps as ag, OrganizationProfile as ah, type OrganizationListProps as ai, OrganizationList as aj, type WaitlistProps as ak, Waitlist as al, type UseMagicLinkResult as am, useMagicLink as an, type UsePasskeyResult as ao, usePasskey as ap, type UseLinkedIdentitiesResult as aq, useLinkedIdentities as ar, type MagicLinkSignInFormProps as as, MagicLinkSignInForm as at, type PasskeySignInButtonProps as au, PasskeySignInButton as av, type LinkedAccountsProps as aw, LinkedAccounts as ax, __version__ as ay, type IQAuthProviderProps as b, IQAuthProvider as c, useT as d, useUser as e, type UseSessionResult as f, useSession as g, type UseAuthResult as h, useAuth as i, type UseOrganizationResult as j, useOrganization as k, useAuthFetch as l, type SessionListItem as m, type UseSessionListResult as n, useSessionList as o, useAccountList as p, type UseAccountSwitcherResult as q, revokeSession as r, useAccountSwitcher as s, SignedIn as t, useLocale as u, SignedOut as v, IQAuthLoading as w, IQAuthLoaded as x, RedirectToSignIn as y, Protect as z };
1848
+ export { useResolvedSdkBranding as $, type AccountSummary as A, performTenantSwitch as B, type ScopeRequirement as C, claimSatisfiesScope as D, Protect as E, type RedirectToSignedInProps as F, RedirectToSignedIn as G, type UseReturnToOptions as H, type IQAuthAppearanceElements as I, useReturnTo as J, type IQAuthReturnToBouncerProps as K, IQAuthReturnToBouncer as L, MultisessionAppSupport as M, preflightReturnTo as N, type AuthCallbackProps as O, type ProtectProps as P, AuthCallback as Q, type RedirectToSignInProps as R, type SessionError as S, type TenantSwitchResult as T, type UseUserResult as U, type IQAuthBranding as V, type IQAuthSignInContext as W, type SharedComponentProps as X, useIQAuthSignInContext as Y, sanitizeBrandCss as Z, __useIQAuthInternal as _, type IQAuthAppearance as a, type SignInProps as a0, isSilentSsoEligible as a1, resolveAfterSignInDestination as a2, SignIn as a3, type SignUpProps as a4, SignUp as a5, type UserSummary as a6, type UserButtonProps as a7, UserButton as a8, type UserProfileProps as a9, usePasskey as aA, type UseLinkedIdentitiesResult as aB, useLinkedIdentities as aC, type MagicLinkSignInFormProps as aD, MagicLinkSignInForm as aE, type PasskeySignInButtonProps as aF, PasskeySignInButton as aG, type LinkedAccountsProps as aH, LinkedAccounts as aI, __version__ as aJ, UserProfile as aa, type OrganizationSwitcherProps as ab, OrganizationSwitcher as ac, type ScopedMembership as ad, type UseMembershipsResult as ae, useMemberships as af, type ScopeSwitcherProps as ag, ScopeSwitcher as ah, type ImpersonationInfo as ai, useImpersonation as aj, type ImpersonationBannerProps as ak, ImpersonationBanner as al, type UseReverificationOptions as am, useReverification as an, type CreateOrganizationProps as ao, slugify as ap, CreateOrganization as aq, type OrganizationProfileProps as ar, OrganizationProfile as as, type OrganizationListProps as at, OrganizationList as au, type WaitlistProps as av, Waitlist as aw, type UseMagicLinkResult as ax, useMagicLink as ay, type UsePasskeyResult as az, type IQAuthProviderProps as b, IQAuthProvider as c, useT as d, useUser as e, type UseSessionResult as f, useSession as g, type UseAuthResult as h, useAuth as i, type UseOrganizationResult as j, useOrganization as k, useAuthFetch as l, type SessionListItem as m, type UseSessionListResult as n, useSessionList as o, useAccountList as p, type UseAccountSwitcherResult as q, revokeSession as r, useAccountSwitcher as s, SignedIn as t, useLocale as u, SignedOut as v, IQAuthLoading as w, IQAuthLoaded as x, RedirectToSignIn as y, performScopeSwitch as z };
@@ -2,9 +2,9 @@ import * as csstype from 'csstype';
2
2
  import * as react_jsx_runtime from 'react/jsx-runtime';
3
3
  import * as React from 'react';
4
4
  import { ReactNode } from 'react';
5
- import { S as SessionManager, a as SessionSnapshot, b as SignInOptions, c as SignOutOptions, A as AccountRegistry, C as CallbackResult, M as MagicLinkRequestInput, P as PasswordlessOptions, L as LinkedIdentity, d as LinkProviderInput } from './signIn-T-CZ6t6r.mjs';
6
- import { J as JwtClaims, S as SessionUser } from './types-XOV9XPVi.mjs';
7
- import { I as IQAuthLocaleBundle, b as IQAuthLocaleOverride, a as IQAuthLocaleKey } from './types-BdQ2lqfT.mjs';
5
+ import { S as SessionManager, a as SessionSnapshot, b as SignInOptions, c as SignOutOptions, A as AccountRegistry, C as CallbackResult, M as MagicLinkRequestInput, P as PasswordlessOptions, L as LinkedIdentity, d as LinkProviderInput } from './signIn-Cfa1GTpO.js';
6
+ import { J as JwtClaims, S as SessionUser } from './types-Bn8O-OEd.js';
7
+ import { I as IQAuthLocaleBundle, b as IQAuthLocaleOverride, a as IQAuthLocaleKey } from './types-DnU2LhXR.js';
8
8
 
9
9
  /**
10
10
  * F11 — `appearance.elements`. The keys are the slot names supported by SDK
@@ -360,13 +360,105 @@ interface ProtectProps {
360
360
  role?: string | string[];
361
361
  /** Required permission/entitlement. Pass an array to mean "any of". */
362
362
  permission?: string | string[];
363
+ /**
364
+ * Task #194 — Required scope. Matches when the active session's
365
+ * `scopeContext` claim equals the supplied `{type, id}`. Pass an array
366
+ * to mean "any of". A tenant-wide session (no `scopeContext`) does NOT
367
+ * satisfy a scope constraint — wrap such code in a separate `<Protect role>`
368
+ * gate if you also want to admit tenant-wide admins.
369
+ */
370
+ scope?: ScopeRequirement | ScopeRequirement[];
363
371
  /** Custom predicate run against `claims`. Truthy result = allowed. */
364
372
  condition?: (claims: JwtClaims | null) => boolean;
365
373
  /** Rendered when the user is not authorized. Defaults to `null`. */
366
374
  fallback?: ReactNode;
367
375
  children?: ReactNode;
368
376
  }
369
- declare function Protect({ role, permission, condition, fallback, children }: ProtectProps): React.FunctionComponentElement<{
377
+ /**
378
+ * Task #197 — Server-authoritative scope pivot, factored out of the
379
+ * `useMemberships()` hook so it can be unit-tested without rendering React.
380
+ *
381
+ * Behavior:
382
+ * 1. POST `/api/v1/auth/switch-scope` through `manager.fetch()` (which
383
+ * attaches the Bearer token + retries once on 401).
384
+ * 2. On a non-2xx response, throw with the server-provided error message
385
+ * so callers can surface it via toast / banner.
386
+ * 3. On success, adopt the access token the server returned in the JSON
387
+ * body via `manager.adoptAccessToken()`. This is the key behavior:
388
+ * the new claims (with the pivoted `scopeContext`) take effect in
389
+ * memory immediately, without a second `/refresh` round-trip that
390
+ * could fail and strand the user on a stale token despite the
391
+ * server-side pivot having already succeeded.
392
+ * 4. Fire-and-forget a `manager.refresh()` so the refresh-cookie session
393
+ * stays aligned with the new scope across tabs / future bootstraps.
394
+ * We deliberately do NOT await or throw on its failure — the pivot
395
+ * already succeeded server-side AND in memory.
396
+ * 5. Defensive fallback: if the response body omits `accessToken` (older
397
+ * server that didn't ship Task #197 yet), fall through to the legacy
398
+ * "drive a refresh and throw on failure" path.
399
+ */
400
+ declare function performScopeSwitch(manager: SessionManager, base: string, target: ScopeRequirement): Promise<void>;
401
+ /**
402
+ * Task #199 — Server-authoritative tenant pivot, mirror of
403
+ * `performScopeSwitch`. Modeled to survive a failing refresh leg the
404
+ * same way: the success response from `POST /api/v1/auth/select-tenant`
405
+ * carries the freshly-minted access token, we `adoptAccessToken()` it
406
+ * immediately, and only then fire a fire-and-forget `manager.refresh()`
407
+ * so the refresh-cookie session stays aligned across tabs / future
408
+ * bootstraps.
409
+ *
410
+ * The endpoint accepts the authenticated tenant-pivot shape (no
411
+ * `tenantSelectionToken`) when the request carries a valid access
412
+ * token — `manager.fetch()` attaches it for us.
413
+ *
414
+ * Returns a discriminated union:
415
+ * - `{ kind: "ok", tenantId }` — pivot completed
416
+ * - `{ kind: "mfa_required", tenantId, mfaChallengeToken, availableMethods }`
417
+ * - `{ kind: "scope_selection_required", tenantId, scopeSelectionToken, scopes }`
418
+ *
419
+ * Throws on non-2xx and on the legacy-server refresh fallback failing.
420
+ * The MFA and scope-selection branches were previously thrown with a
421
+ * magic-string `Error("mfa_required: …")` / `Error("scope_selection_required: …")`;
422
+ * Task #205 moves them to typed results so `<OrganizationSwitcher/>`
423
+ * and `<OrganizationList/>` can render localized prompts that route
424
+ * the user to the hosted sign-in to complete the missing step.
425
+ */
426
+ type TenantSwitchResult = {
427
+ kind: "ok";
428
+ tenantId: string;
429
+ } | {
430
+ kind: "mfa_required";
431
+ tenantId: string;
432
+ mfaChallengeToken: string;
433
+ availableMethods: string[];
434
+ } | {
435
+ kind: "scope_selection_required";
436
+ tenantId: string;
437
+ scopeSelectionToken: string;
438
+ scopes: Array<Record<string, unknown>>;
439
+ };
440
+ declare function performTenantSwitch(manager: SessionManager, base: string, tenantId: string): Promise<TenantSwitchResult>;
441
+ /** Task #194 — Shape passed to `<Protect scope>` and `useMemberships().switchScope`. */
442
+ interface ScopeRequirement {
443
+ type: "vendor" | "source" | "client";
444
+ id: string;
445
+ }
446
+ /**
447
+ * Task #194 — Pure helper that returns `true` when the supplied claims
448
+ * carry a `scopeContext` matching ANY of the supplied requirements.
449
+ * Exported so framework adapters AND tests can verify the matching rule
450
+ * without rendering React.
451
+ *
452
+ * Matching rule:
453
+ * - `claims.scopeContext.type === required.type`
454
+ * - `claims.scopeContext.id === required.id`
455
+ *
456
+ * A claims object with no `scopeContext` never matches a scope requirement
457
+ * — tenant-wide admins must be gated separately via `<Protect role>` if you
458
+ * want them to also see scope-gated UI.
459
+ */
460
+ declare function claimSatisfiesScope(claims: JwtClaims | null, required: ScopeRequirement | ScopeRequirement[]): boolean;
461
+ declare function Protect({ role, permission, scope, condition, fallback, children }: ProtectProps): React.FunctionComponentElement<{
370
462
  children?: ReactNode | undefined;
371
463
  }>;
372
464
  /**
@@ -547,8 +639,24 @@ interface SignInProps extends Partial<SharedComponentProps> {
547
639
  * F10 — Optional. Defaults to `${origin}/api/iqauth/callback` (the path
548
640
  * mounted by the framework adapters). Must be in the app's allowed
549
641
  * origins.
642
+ *
643
+ * NOTE: this is the OIDC `redirect_uri` — i.e. WHERE the authorization
644
+ * code is delivered (the adapter's callback handler), NOT the page the
645
+ * user finally lands on. To control the post-login landing page use
646
+ * {@link afterSignInUrl}.
550
647
  */
551
648
  returnTo?: string;
649
+ /**
650
+ * Where the user should land AFTER login completes (distinct from
651
+ * {@link returnTo}, which is pinned to the adapter callback). The SDK
652
+ * persists this in the `iqauth_return_to` cookie before redirecting; the
653
+ * cookies-only framework adapters' `/api/iqauth/callback` reads it and
654
+ * 302s there once the code→cookie exchange finishes. When omitted, the
655
+ * SDK reads `?return_to=` / `?next=` from the current URL; if neither is
656
+ * present the adapter falls back to `/`. Sanitized against the provider's
657
+ * `allowedReturnOrigins` (same-origin + allow-list only).
658
+ */
659
+ afterSignInUrl?: string;
552
660
  /** Called after successful redirect. By default, `window.location.href = url`. */
553
661
  onRedirect?: (url: string) => void;
554
662
  /** Pass `"login"` to force the form to render even when an SSO session is active. */
@@ -562,6 +670,22 @@ interface SignInProps extends Partial<SharedComponentProps> {
562
670
  * continue.
563
671
  */
564
672
  silentSso?: boolean;
673
+ /**
674
+ * Task #171 — Optional deep-link scope hint forwarded to the hosted
675
+ * `/oidc/sso-login`, `/oidc/sso-tenant-select`, and
676
+ * `/oidc/sso-scope-select` endpoints. When the user has only source/client
677
+ * memberships in the resolved tenant AND this hint uniquely matches one
678
+ * active membership the backend skips the picker and mints a scoped
679
+ * session straight away. Accepted forms: `{ type: "vendor"|"source"|
680
+ * "client", id: string }` or the canonical string `"<type>:<id>"`.
681
+ * When omitted, the SDK also reads `?scope_hint=<type>:<id>` from
682
+ * `window.location.search` so apps using the standard hosted entry point
683
+ * inherit deep-link hints for free.
684
+ */
685
+ scopeHint?: {
686
+ type: "vendor" | "source" | "client";
687
+ id: string;
688
+ } | string;
565
689
  }
566
690
  /**
567
691
  * Pure render-decision helper. When this returns `true`, `<SignIn/>` MUST
@@ -576,6 +700,19 @@ declare function isSilentSsoEligible(ctx: {
576
700
  };
577
701
  returnAllowed: boolean;
578
702
  } | null | undefined, effectivePrompt: "login" | undefined): boolean;
703
+ /**
704
+ * Pure resolver for `<SignIn/>`'s post-login landing page. Precedence:
705
+ * explicit `prop` → `?return_to=` → `?next=` → `/`. The result is passed
706
+ * through {@link sanitizeReturnTo} so only same-origin or allow-listed
707
+ * destinations survive (open-redirect safe). Exported so the resolution
708
+ * order can be unit-tested without a DOM.
709
+ */
710
+ declare function resolveAfterSignInDestination(args: {
711
+ prop?: string | null;
712
+ search?: string;
713
+ allowedOrigins?: string[];
714
+ currentOrigin?: string;
715
+ }): string;
579
716
  declare function SignIn(props: SignInProps): react_jsx_runtime.JSX.Element;
580
717
  interface SignUpProps extends SharedComponentProps {
581
718
  returnTo?: string;
@@ -609,6 +746,91 @@ interface OrganizationSwitcherProps {
609
746
  className?: string;
610
747
  }
611
748
  declare function OrganizationSwitcher({ iqAuthBaseUrl, onSwitched, appearance: _appearance, className }: OrganizationSwitcherProps): react_jsx_runtime.JSX.Element;
749
+ /** Task #194 — One scoped membership entry (source/client/vendor). */
750
+ interface ScopedMembership {
751
+ membershipId: string;
752
+ scopeType: "vendor" | "source" | "client";
753
+ scopeId: string;
754
+ scopeName: string;
755
+ role: string;
756
+ /** Surfaces inherited grants (e.g. a vendor-wide grant that implicitly covers a source). */
757
+ grantedVia?: "direct" | "vendor" | "source" | string;
758
+ }
759
+ interface UseMembershipsResult {
760
+ isLoading: boolean;
761
+ error: string | null;
762
+ /** Flattened source/client/vendor memberships in the active tenant. */
763
+ memberships: ScopedMembership[];
764
+ /** The scope the active access token is currently minted under (or `null` for tenant-wide). */
765
+ active: {
766
+ type: "vendor" | "source" | "client";
767
+ id: string;
768
+ role: string;
769
+ membershipId: string;
770
+ } | null;
771
+ /** Re-fetch the membership list (e.g. after an admin grants new access). */
772
+ refresh: () => Promise<void>;
773
+ /**
774
+ * Switch the active scope. Calls `POST /api/v1/auth/switch-scope` then
775
+ * `manager.refresh()` so the next access token carries the new
776
+ * `scopeContext`. Throws on HTTP errors so callers can surface a toast.
777
+ */
778
+ switchScope: (target: ScopeRequirement) => Promise<void>;
779
+ }
780
+ /**
781
+ * Task #194 — First-class scoped-memberships hook. Modelled after Clerk's
782
+ * `useOrganizationList()` but for IQAuth's source/client/vendor scopes.
783
+ *
784
+ * - `memberships`: flat list across vendors + sources + clients in the
785
+ * currently bound tenant. Fetched once on mount via
786
+ * `GET /api/v1/auth/available-scopes`.
787
+ * - `active`: derived synchronously from `snapshot.user.scopeContext`,
788
+ * so it stays in sync with refreshes triggered elsewhere (tab focus,
789
+ * cross-tab broadcast).
790
+ * - `switchScope({type, id})`: server-authoritative scope pivot.
791
+ * Returns after `manager.refresh()` resolves so consumers can `await`
792
+ * it and assume the new claim is live on the next render.
793
+ */
794
+ declare function useMemberships(): UseMembershipsResult;
795
+ interface ScopeSwitcherProps {
796
+ /** Optional callback fired after a successful switch + refresh. */
797
+ onSwitched?: (target: ScopeRequirement) => void;
798
+ /** Filter the rendered list. Defaults to all three scope types. */
799
+ include?: Array<"vendor" | "source" | "client">;
800
+ className?: string;
801
+ }
802
+ /**
803
+ * Task #194 — Headless-ish scope picker. Renders the current `active`
804
+ * scope as a button; expanding it lists every membership returned by
805
+ * `useMemberships()`. Picking one calls `switchScope()` and (on success)
806
+ * triggers `onSwitched`. Uses inline styles for the same reason
807
+ * `<OrganizationSwitcher/>` does: SDK chrome must work in any host app
808
+ * without requiring a specific CSS framework. Host apps can build their
809
+ * own UI on top of `useMemberships()` directly when they need full
810
+ * control.
811
+ */
812
+ declare function ScopeSwitcher({ onSwitched, include, className }: ScopeSwitcherProps): React.DetailedReactHTMLElement<{
813
+ className: string | undefined;
814
+ "data-testid": string;
815
+ style: {
816
+ fontSize: number;
817
+ opacity: number;
818
+ };
819
+ }, HTMLElement> | React.DetailedReactHTMLElement<{
820
+ className: string | undefined;
821
+ "data-testid": string;
822
+ style: {
823
+ fontSize: number;
824
+ color: "#b91c1c";
825
+ };
826
+ }, HTMLElement> | React.DetailedReactHTMLElement<{
827
+ className: string | undefined;
828
+ "data-testid": string;
829
+ style: {
830
+ position: "relative";
831
+ display: "inline-block";
832
+ };
833
+ }, HTMLElement> | null;
612
834
  interface ImpersonationInfo {
613
835
  isImpersonating: boolean;
614
836
  /** The admin who started the impersonation (from JWT `act` claim). */
@@ -1623,4 +1845,4 @@ interface LinkedAccountsProps extends Partial<PasswordlessOptions> {
1623
1845
  declare function LinkedAccounts({ className, onChange, ...rest }: LinkedAccountsProps): react_jsx_runtime.JSX.Element;
1624
1846
  declare const __version__ = "phase-bc-1.0.0";
1625
1847
 
1626
- export { SignUp as $, type AccountSummary as A, type RedirectToSignedInProps as B, RedirectToSignedIn as C, type UseReturnToOptions as D, useReturnTo as E, type IQAuthReturnToBouncerProps as F, IQAuthReturnToBouncer as G, preflightReturnTo as H, type IQAuthAppearanceElements as I, type AuthCallbackProps as J, AuthCallback as K, type IQAuthBranding as L, MultisessionAppSupport as M, type IQAuthSignInContext as N, type SharedComponentProps as O, type ProtectProps as P, useIQAuthSignInContext as Q, type RedirectToSignInProps as R, type SessionError as S, sanitizeBrandCss as T, type UseUserResult as U, useResolvedSdkBranding as V, type SignInProps as W, isSilentSsoEligible as X, SignIn as Y, type SignUpProps as Z, __useIQAuthInternal as _, type IQAuthAppearance as a, type UserSummary as a0, type UserButtonProps as a1, UserButton as a2, type UserProfileProps as a3, UserProfile as a4, type OrganizationSwitcherProps as a5, OrganizationSwitcher as a6, type ImpersonationInfo as a7, useImpersonation as a8, type ImpersonationBannerProps as a9, ImpersonationBanner as aa, type UseReverificationOptions as ab, useReverification as ac, type CreateOrganizationProps as ad, slugify as ae, CreateOrganization as af, type OrganizationProfileProps as ag, OrganizationProfile as ah, type OrganizationListProps as ai, OrganizationList as aj, type WaitlistProps as ak, Waitlist as al, type UseMagicLinkResult as am, useMagicLink as an, type UsePasskeyResult as ao, usePasskey as ap, type UseLinkedIdentitiesResult as aq, useLinkedIdentities as ar, type MagicLinkSignInFormProps as as, MagicLinkSignInForm as at, type PasskeySignInButtonProps as au, PasskeySignInButton as av, type LinkedAccountsProps as aw, LinkedAccounts as ax, __version__ as ay, type IQAuthProviderProps as b, IQAuthProvider as c, useT as d, useUser as e, type UseSessionResult as f, useSession as g, type UseAuthResult as h, useAuth as i, type UseOrganizationResult as j, useOrganization as k, useAuthFetch as l, type SessionListItem as m, type UseSessionListResult as n, useSessionList as o, useAccountList as p, type UseAccountSwitcherResult as q, revokeSession as r, useAccountSwitcher as s, SignedIn as t, useLocale as u, SignedOut as v, IQAuthLoading as w, IQAuthLoaded as x, RedirectToSignIn as y, Protect as z };
1848
+ export { useResolvedSdkBranding as $, type AccountSummary as A, performTenantSwitch as B, type ScopeRequirement as C, claimSatisfiesScope as D, Protect as E, type RedirectToSignedInProps as F, RedirectToSignedIn as G, type UseReturnToOptions as H, type IQAuthAppearanceElements as I, useReturnTo as J, type IQAuthReturnToBouncerProps as K, IQAuthReturnToBouncer as L, MultisessionAppSupport as M, preflightReturnTo as N, type AuthCallbackProps as O, type ProtectProps as P, AuthCallback as Q, type RedirectToSignInProps as R, type SessionError as S, type TenantSwitchResult as T, type UseUserResult as U, type IQAuthBranding as V, type IQAuthSignInContext as W, type SharedComponentProps as X, useIQAuthSignInContext as Y, sanitizeBrandCss as Z, __useIQAuthInternal as _, type IQAuthAppearance as a, type SignInProps as a0, isSilentSsoEligible as a1, resolveAfterSignInDestination as a2, SignIn as a3, type SignUpProps as a4, SignUp as a5, type UserSummary as a6, type UserButtonProps as a7, UserButton as a8, type UserProfileProps as a9, usePasskey as aA, type UseLinkedIdentitiesResult as aB, useLinkedIdentities as aC, type MagicLinkSignInFormProps as aD, MagicLinkSignInForm as aE, type PasskeySignInButtonProps as aF, PasskeySignInButton as aG, type LinkedAccountsProps as aH, LinkedAccounts as aI, __version__ as aJ, UserProfile as aa, type OrganizationSwitcherProps as ab, OrganizationSwitcher as ac, type ScopedMembership as ad, type UseMembershipsResult as ae, useMemberships as af, type ScopeSwitcherProps as ag, ScopeSwitcher as ah, type ImpersonationInfo as ai, useImpersonation as aj, type ImpersonationBannerProps as ak, ImpersonationBanner as al, type UseReverificationOptions as am, useReverification as an, type CreateOrganizationProps as ao, slugify as ap, CreateOrganization as aq, type OrganizationProfileProps as ar, OrganizationProfile as as, type OrganizationListProps as at, OrganizationList as au, type WaitlistProps as av, Waitlist as aw, type UseMagicLinkResult as ax, useMagicLink as ay, type UsePasskeyResult as az, type IQAuthProviderProps as b, IQAuthProvider as c, useT as d, useUser as e, type UseSessionResult as f, useSession as g, type UseAuthResult as h, useAuth as i, type UseOrganizationResult as j, useOrganization as k, useAuthFetch as l, type SessionListItem as m, type UseSessionListResult as n, useSessionList as o, useAccountList as p, type UseAccountSwitcherResult as q, revokeSession as r, useAccountSwitcher as s, SignedIn as t, useLocale as u, SignedOut as v, IQAuthLoading as w, IQAuthLoaded as x, RedirectToSignIn as y, performScopeSwitch as z };
package/dist/index.d.mts CHANGED
@@ -1,14 +1,14 @@
1
- export { j as ApiKeysModule, g as AppsModule, A as AuthModule, B as BrandingModule, m as ClientsModule, C as CreateAppRequest, h as CreateAppResponse, E as EntitlementsModule, G as GdprModule, H as HierarchyModule, I as IQAuthClient, a as InMemoryOidcStateStore, k as InvitesModule, M as MembershipsModule, p as MfaModule, d as OidcAuthRequest, e as OidcCallbackResult, O as OidcModule, f as OidcModuleOptions, b as OidcStateStore, c as OidcStoredRequest, i as PermissionGroupsModule, P as PermissionsModule, o as PinModule, R as RolesModule, n as ScopeModule, S as SessionsModule, l as SourcesModule, T as TenantsModule, U as UsersModule, V as VendorsModule, W as WebhooksModule } from './client-BGFnBpfc.mjs';
1
+ export { j as ApiKeysModule, g as AppsModule, A as AuthModule, B as BrandingModule, m as ClientsModule, C as CreateAppRequest, h as CreateAppResponse, E as EntitlementsModule, G as GdprModule, H as HierarchyModule, I as IQAuthClient, a as InMemoryOidcStateStore, k as InvitesModule, M as MembershipsModule, p as MfaModule, d as OidcAuthRequest, e as OidcCallbackResult, O as OidcModule, f as OidcModuleOptions, b as OidcStateStore, c as OidcStoredRequest, i as PermissionGroupsModule, P as PermissionsModule, o as PinModule, R as RolesModule, n as ScopeModule, S as SessionsModule, l as SourcesModule, T as TenantsModule, U as UsersModule, V as VendorsModule, W as WebhooksModule } from './client-D8L-PaWr.mjs';
2
2
  export { b as ErrorCode, E as ErrorCodes, I as IQAuthError, c as IQAuthErrorCode, a as IQ_AUTH_ERROR_CODES } from './errors-Jl1Jtm-6.mjs';
3
- export { i as iqAuthMiddleware } from './express-CVNQEkOr.mjs';
4
- export { b as DEFAULT_CLOCK_TOLERANCE_SECONDS, a as DEFAULT_TOKEN_AUDIENCE, D as DEFAULT_TOKEN_ISSUER, c as TokenVerifyOptions, T as TokensModule, d as TokensModuleOptions } from './tokens-CITeoG6P.mjs';
3
+ export { i as iqAuthMiddleware } from './express-DDTA3qV1.mjs';
4
+ export { b as DEFAULT_CLOCK_TOLERANCE_SECONDS, a as DEFAULT_TOKEN_AUDIENCE, D as DEFAULT_TOKEN_ISSUER, c as TokenVerifyOptions, T as TokensModule, d as TokensModuleOptions } from './tokens-B06VtvUi.mjs';
5
5
  export { K as KeyMode, c as ParsedPublishableKey, P as PublishableKeyPayload, a as assertPublishableKey, e as encodePublishableKey, i as isPublishableKey, b as isSecretKey, p as parsePublishableKey } from './publishableKey-f2kq-rKw.mjs';
6
6
  export { UserinfoResponse, buildUserinfoResponse, handleUserinfo } from './server/handlers.mjs';
7
7
  export { VerifyWsUpgradeOptions, VerifyWsUpgradeResult, WsUpgradeRequestLike, verifyWsUpgrade } from './ws.mjs';
8
8
  export { CreateTestIssuerOptions, MintAuthCodeOptions, MintTokenOptions, TestIssuer, createTestIssuer } from './test.mjs';
9
- export { ap as AcceptInviteRequest, ac as AddGroupPermissionRequest, af as AddUserOverrideRequest, D as ApiErrorResponse, ai as ApiKeyInfo, al as ApiKeyIntrospection, E as ApiResponse, A as ApiSuccessResponse, a0 as AppInfo, $ as AppManifest, a2 as AppSyncResult, a6 as AssignRoleRequest, aO as AvailableScopesTree, b0 as BackupCodeCountResult, a$ as BackupCodesResult, u as BrandingAsset, B as BrandingConfig, w as BrandingDomainMapping, aD as Client, aj as CreateApiKeyRequest, ak as CreateApiKeyResult, aE as CreateClientRequest, an as CreateInviteRequest, aL as CreateMembershipRequest, a4 as CreateRoleRequest, aB as CreateSourceRequest, C as CreateTenantRequest, ay as CreateVendorRequest, ar as CreateWebhookRequest, as as CreateWebhookResult, ag as EffectivePermission, a_ as EmailEnrollResult, av as Entitlement, X as ExpressMiddlewareOptions, aT as GdprExportData, aw as GrantEntitlementRequest, ab as GroupPermission, aI as HierarchyClient, aJ as HierarchyLink, aH as HierarchySource, aG as HierarchyVendor, i as IQAuthBaseClaims, I as IQAuthBrowserSessionClientConfig, h as IQAuthClaims, e as IQAuthClientConfig, d as IQAuthEnvironment, c as IQAuthNextFunction, a as IQAuthRequestLike, b as IQAuthResponseLike, Y as IQAuthRetryConfig, f as IQAuthTokenClientConfig, Z as IQAuthVerifyConfig, ad as InheritanceRelation, am as Invitation, q as InviteTenantUserRequest, r as InviteTenantUserResult, ao as InviteValidation, x as JwksKey, y as JwksResponse, J as JwtClaims, L as LoginResult, aK as Membership, aN as MembershipWithDetails, aW as MfaAvailableMethods, G as MfaEnrollment, F as MfaMethod, Q as MfaPolicy, K as MfaVerifyResult, M as MigrateUserRequest, O as OidcDiscovery, z as OidcTokenResponse, N as PasswordPolicy, ah as PermissionCheckResult, aa as PermissionGroup, a1 as PermissionNodeInfo, _ as PermissionNodeManifest, aV as PinLoginResult, aU as PinStatus, P as PromoteToVendorRequest, p as PromoteToVendorResult, V as ProvisionUserRequest, W as ProvisionUserResponse, a3 as Role, g as ScopeContext, aS as ScopeSwitchResult, aP as ScopeTreeClient, aQ as ScopeTreeSource, aR as ScopeTreeVendor, m as Session, l as SessionAuthenticatedLoginResult, S as SessionUser, aZ as SmsEnrollResult, aA as Source, j as Tenant, n as TenantInfo, a9 as TenantUser, s as TenantUserRoleUpdate, k as TokenAuthenticatedLoginResult, T as TokenPair, aX as TotpEnrollResult, H as TotpEnrollmentResult, aY as TotpVerifyResult, t as UpdateBrandingRequest, aF as UpdateClientRequest, aM as UpdateMembershipRequest, a5 as UpdateRoleRequest, aC as UpdateSourceRequest, o as UpdateTenantRequest, az as UpdateVendorRequest, v as UploadAssetRequest, a8 as UserGroupAssignment, ae as UserPermissionOverride, R as UserPermissions, U as UserProfile, a7 as UserRoleAssignment, ax as Vendor, at as WebhookDelivery, aq as WebhookEndpoint, au as WebhookTestResult } from './types-XOV9XPVi.mjs';
9
+ export { ap as AcceptInviteRequest, ac as AddGroupPermissionRequest, af as AddUserOverrideRequest, D as ApiErrorResponse, ai as ApiKeyInfo, al as ApiKeyIntrospection, E as ApiResponse, A as ApiSuccessResponse, a0 as AppInfo, $ as AppManifest, a2 as AppSyncResult, a6 as AssignRoleRequest, aO as AvailableScopesTree, b0 as BackupCodeCountResult, a$ as BackupCodesResult, u as BrandingAsset, B as BrandingConfig, w as BrandingDomainMapping, aD as Client, aj as CreateApiKeyRequest, ak as CreateApiKeyResult, aE as CreateClientRequest, an as CreateInviteRequest, aL as CreateMembershipRequest, a4 as CreateRoleRequest, aB as CreateSourceRequest, C as CreateTenantRequest, ay as CreateVendorRequest, ar as CreateWebhookRequest, as as CreateWebhookResult, ag as EffectivePermission, a_ as EmailEnrollResult, av as Entitlement, X as ExpressMiddlewareOptions, aT as GdprExportData, aw as GrantEntitlementRequest, ab as GroupPermission, aI as HierarchyClient, aJ as HierarchyLink, aH as HierarchySource, aG as HierarchyVendor, i as IQAuthBaseClaims, I as IQAuthBrowserSessionClientConfig, h as IQAuthClaims, e as IQAuthClientConfig, d as IQAuthEnvironment, c as IQAuthNextFunction, a as IQAuthRequestLike, b as IQAuthResponseLike, Y as IQAuthRetryConfig, f as IQAuthTokenClientConfig, Z as IQAuthVerifyConfig, ad as InheritanceRelation, am as Invitation, q as InviteTenantUserRequest, r as InviteTenantUserResult, ao as InviteValidation, x as JwksKey, y as JwksResponse, J as JwtClaims, L as LoginResult, aK as Membership, aN as MembershipWithDetails, aW as MfaAvailableMethods, G as MfaEnrollment, F as MfaMethod, Q as MfaPolicy, K as MfaVerifyResult, M as MigrateUserRequest, O as OidcDiscovery, z as OidcTokenResponse, N as PasswordPolicy, ah as PermissionCheckResult, aa as PermissionGroup, a1 as PermissionNodeInfo, _ as PermissionNodeManifest, aV as PinLoginResult, aU as PinStatus, P as PromoteToVendorRequest, p as PromoteToVendorResult, V as ProvisionUserRequest, W as ProvisionUserResponse, a3 as Role, g as ScopeContext, aS as ScopeSwitchResult, aP as ScopeTreeClient, aQ as ScopeTreeSource, aR as ScopeTreeVendor, m as Session, l as SessionAuthenticatedLoginResult, S as SessionUser, aZ as SmsEnrollResult, aA as Source, j as Tenant, n as TenantInfo, a9 as TenantUser, s as TenantUserRoleUpdate, k as TokenAuthenticatedLoginResult, T as TokenPair, aX as TotpEnrollResult, H as TotpEnrollmentResult, aY as TotpVerifyResult, t as UpdateBrandingRequest, aF as UpdateClientRequest, aM as UpdateMembershipRequest, a5 as UpdateRoleRequest, aC as UpdateSourceRequest, o as UpdateTenantRequest, az as UpdateVendorRequest, v as UploadAssetRequest, a8 as UserGroupAssignment, ae as UserPermissionOverride, R as UserPermissions, U as UserProfile, a7 as UserRoleAssignment, ax as Vendor, at as WebhookDelivery, aq as WebhookEndpoint, au as WebhookTestResult } from './types-Bn8O-OEd.mjs';
10
10
  export { IQAUTH_SIGNATURE_HEADER, IQAuthEvent, IQAuthWebhookEvent, LEGACY_SIGNATURE_HEADERS, ParseWebhookEventOptions, VerifyWebhookOptions, WebhookSignatureError, isValidWebhookSignature, parseWebhookEvent, verifyWebhookSignature } from './webhooks.mjs';
11
- export { P as ProvisioningBridge, a as ProvisioningBridgeOptions, d as ProvisioningContext, b as ProvisioningStorage, c as createProvisioningBridge } from './provisioningBridge-M5G47LWO.mjs';
11
+ export { P as ProvisioningBridge, a as ProvisioningBridgeOptions, d as ProvisioningContext, b as ProvisioningStorage, c as createProvisioningBridge } from './provisioningBridge-IEycmsgb.mjs';
12
12
 
13
13
  /**
14
14
  * Shared wildcard permission utilities.