@iqauth/sdk 2.0.4 → 2.1.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.
Files changed (43) hide show
  1. package/dist/browser-session.d.mts +1 -1
  2. package/dist/browser-session.d.ts +1 -1
  3. package/dist/browser-session.js +4 -1
  4. package/dist/browser-session.mjs +1 -1
  5. package/dist/{chunk-JQWYIIIS.mjs → chunk-MDUHPQMM.mjs} +4 -1
  6. package/dist/{chunk-73R6BEGO.mjs → chunk-ZESHDJDU.mjs} +1 -1
  7. package/dist/{client-CggvJmmm.d.ts → client-DXbHb2ul.d.ts} +1 -1
  8. package/dist/{client-C1DXfB8Z.d.mts → client-Dv4v92Mj.d.mts} +1 -1
  9. package/dist/{express-BKAXB5Nl.d.ts → express-B4o3P8vK.d.ts} +1 -1
  10. package/dist/{express-CpfyYTmw.d.mts → express-BZmF1llh.d.mts} +1 -1
  11. package/dist/express.d.mts +3 -3
  12. package/dist/express.d.ts +3 -3
  13. package/dist/express.js +4 -1
  14. package/dist/express.mjs +2 -2
  15. package/dist/fastify.d.mts +6 -0
  16. package/dist/fastify.d.ts +6 -0
  17. package/dist/fastify.js +21 -3
  18. package/dist/fastify.mjs +18 -3
  19. package/dist/hono.js +4 -1
  20. package/dist/hono.mjs +1 -1
  21. package/dist/index.d.mts +2 -2
  22. package/dist/index.d.ts +2 -2
  23. package/dist/index.js +4 -1
  24. package/dist/index.mjs +2 -2
  25. package/dist/mobile.d.mts +1 -1
  26. package/dist/mobile.d.ts +1 -1
  27. package/dist/mobile.js +4 -1
  28. package/dist/mobile.mjs +1 -1
  29. package/dist/next.js +4 -1
  30. package/dist/next.mjs +1 -1
  31. package/dist/react.d.mts +64 -2
  32. package/dist/react.d.ts +64 -2
  33. package/dist/react.js +501 -132
  34. package/dist/react.mjs +498 -132
  35. package/dist/server.d.mts +2 -2
  36. package/dist/server.d.ts +2 -2
  37. package/dist/server.js +4 -1
  38. package/dist/server.mjs +2 -2
  39. package/dist/service.d.mts +1 -1
  40. package/dist/service.d.ts +1 -1
  41. package/dist/service.js +4 -1
  42. package/dist/service.mjs +1 -1
  43. package/package.json +1 -1
package/dist/react.d.ts CHANGED
@@ -122,6 +122,9 @@ declare function AuthCallback({ onComplete, fallback }?: AuthCallbackProps): Rea
122
122
  interface IQAuthBranding {
123
123
  brandName: string | null;
124
124
  logoUrl: string | null;
125
+ logoLightUrl?: string | null;
126
+ logoDarkUrl?: string | null;
127
+ faviconUrl?: string | null;
125
128
  loginHeadline: string | null;
126
129
  loginSubheadline: string | null;
127
130
  primaryColor: string | null;
@@ -129,10 +132,31 @@ interface IQAuthBranding {
129
132
  backgroundColor: string | null;
130
133
  surfaceColor: string | null;
131
134
  textColor: string | null;
135
+ heroImageUrl?: string | null;
136
+ /** Optional full-bleed background image for the `full_bleed` layout. */
137
+ backgroundImageUrl?: string | null;
138
+ tagline?: string | null;
139
+ loginSideCopy?: string | null;
140
+ googleButtonLabel?: string | null;
141
+ customCss?: string | null;
142
+ /** "centered_card" | "split_screen" | "full_bleed" */
143
+ loginLayout?: string | null;
144
+ /** "solid" | "outline" | "ghost" */
145
+ socialButtonStyle?: string | null;
146
+ fontFamilyBody?: string | null;
147
+ fontFamilyHeading?: string | null;
148
+ customFontUrl?: string | null;
149
+ borderRadius?: number | string | null;
150
+ footerText?: string | null;
151
+ emailHeaderImageUrl?: string | null;
152
+ emailSenderName?: string | null;
153
+ emailFooter?: string | null;
132
154
  supportEmail?: string | null;
133
155
  supportUrl?: string | null;
134
156
  termsUrl?: string | null;
135
157
  privacyUrl?: string | null;
158
+ /** Composite revision (`${tenantRev}.${appRev}`) for cache-busting. */
159
+ brandingRev?: string | null;
136
160
  }
137
161
  interface IQAuthSignInContext {
138
162
  app: {
@@ -149,6 +173,13 @@ interface IQAuthSignInContext {
149
173
  allowedOrigins: string[];
150
174
  returnAllowed: boolean;
151
175
  branding: IQAuthBranding | null;
176
+ brandingRev?: string | null;
177
+ session?: {
178
+ userId: string;
179
+ email: string;
180
+ name: string;
181
+ authenticatedAt: number;
182
+ } | null;
152
183
  }
153
184
  interface SharedComponentProps {
154
185
  /** Base URL of the IQAuth service (e.g. https://auth.dispositioniq.com). */
@@ -166,13 +197,44 @@ declare function useIQAuthSignInContext(iqAuthBaseUrl: string, appKey: string, r
166
197
  loading: boolean;
167
198
  error: string | null;
168
199
  };
200
+ declare function sanitizeBrandCss(input: string | null | undefined): string;
201
+ /**
202
+ * Fetches the layered tenant/app branding for use by chrome-only SDK
203
+ * components (`<UserButton/>`, `<UserProfile/>`, `<OrganizationSwitcher/>`)
204
+ * that don't go through `<SignIn/>`'s sign-in-context.
205
+ *
206
+ * Cached at module scope for 60s, keyed by URL. The cache is also
207
+ * brandingRev-aware: a newer rev for the same URL replaces older entries
208
+ * even within the TTL window. Returns `null` until first resolution; callers
209
+ * should treat that as "use neutral defaults".
210
+ *
211
+ * Reads `appId` from the IQAuthProvider's session manager (parsed from the
212
+ * publishable key) so per-app branding overrides are layered. Callers may
213
+ * override with the explicit `appId` parameter.
214
+ */
215
+ declare function useResolvedSdkBranding(iqAuthBaseUrl: string, appId?: string | null): IQAuthBranding | null;
169
216
  interface SignInProps extends SharedComponentProps {
170
217
  /** URL the IQAuth backend should redirect back to with `?code=...`. Must be in the app's allowed_origins. */
171
218
  returnTo: string;
172
219
  /** Called after successful redirect. By default, `window.location.href = url`. */
173
220
  onRedirect?: (url: string) => void;
221
+ /** Pass `"login"` to force the form to render even when an SSO session is active. */
222
+ prompt?: "login";
174
223
  }
175
- declare function SignIn({ iqAuthBaseUrl, appKey, returnTo, onRedirect, className }: SignInProps): react_jsx_runtime.JSX.Element;
224
+ /**
225
+ * Pure render-decision helper. When this returns `true`, `<SignIn/>` MUST
226
+ * render the silent SSO placeholder instead of the email/password form,
227
+ * even on the very first render before `useEffect` fires. Exported so that
228
+ * smoke tests can verify the no-flash guarantee without standing up a DOM.
229
+ */
230
+ declare function isSilentSsoEligible(ctx: {
231
+ session?: unknown;
232
+ app: {
233
+ defaultClientId: string | null;
234
+ };
235
+ returnAllowed: boolean;
236
+ } | null | undefined, effectivePrompt: "login" | undefined): boolean;
237
+ declare function SignIn({ iqAuthBaseUrl, appKey, returnTo, onRedirect, className, prompt }: SignInProps): react_jsx_runtime.JSX.Element;
176
238
  interface SignUpProps extends SharedComponentProps {
177
239
  returnTo?: string;
178
240
  onSuccess?: () => void;
@@ -206,4 +268,4 @@ interface OrganizationSwitcherProps {
206
268
  declare function OrganizationSwitcher({ iqAuthBaseUrl, onSwitched, className }: OrganizationSwitcherProps): react_jsx_runtime.JSX.Element;
207
269
  declare const __version__ = "phase-bc-1.0.0";
208
270
 
209
- export { AuthCallback, type AuthCallbackProps, type IQAuthBranding, IQAuthProvider, type IQAuthProviderProps, type IQAuthSignInContext, OrganizationSwitcher, type OrganizationSwitcherProps, RedirectToSignIn, type RedirectToSignInProps, type SessionError, type SharedComponentProps, SignIn, type SignInProps, SignUp, type SignUpProps, SignedIn, SignedOut, type UseAuthResult, type UseOrganizationResult, type UseSessionResult, type UseUserResult, UserButton, type UserButtonProps, UserProfile, type UserProfileProps, type UserSummary, __version__, useAuth, useAuthFetch, useIQAuthSignInContext, useOrganization, useSession, useUser };
271
+ export { AuthCallback, type AuthCallbackProps, type IQAuthBranding, IQAuthProvider, type IQAuthProviderProps, type IQAuthSignInContext, OrganizationSwitcher, type OrganizationSwitcherProps, RedirectToSignIn, type RedirectToSignInProps, type SessionError, type SharedComponentProps, SignIn, type SignInProps, SignUp, type SignUpProps, SignedIn, SignedOut, type UseAuthResult, type UseOrganizationResult, type UseSessionResult, type UseUserResult, UserButton, type UserButtonProps, UserProfile, type UserProfileProps, type UserSummary, __version__, isSilentSsoEligible, sanitizeBrandCss, useAuth, useAuthFetch, useIQAuthSignInContext, useOrganization, useResolvedSdkBranding, useSession, useUser };