@elvix.is/sdk 0.5.4 → 0.5.6

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 (3) hide show
  1. package/dist/react.d.ts +92 -34
  2. package/dist/react.js +1005 -304
  3. package/package.json +1 -1
package/dist/react.d.ts CHANGED
@@ -1,8 +1,18 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { ReactNode } from 'react';
2
+ import { ReactNode, CSSProperties } from 'react';
3
3
  import { ElvixActionResult } from './index.js';
4
4
  export { ElvixUser, ElvixVerifyResult } from './index.js';
5
5
 
6
+ /** Size overrides every <Elvix*> component accepts so hosts can fit it to any slot. */
7
+ type ElvixSizeProps = {
8
+ width?: number | string;
9
+ height?: number | string;
10
+ minWidth?: number | string;
11
+ maxWidth?: number | string;
12
+ minHeight?: number | string;
13
+ maxHeight?: number | string;
14
+ };
15
+
6
16
  /**
7
17
  * `<ElvixCard>` — the chrome every nested `<Elvix*>` mutation surface
8
18
  * lives in. Brand-tinted border, secured-by-elvix footer, scrollable
@@ -12,13 +22,18 @@ export { ElvixUser, ElvixVerifyResult } from './index.js';
12
22
  * components render their own ElvixCard internally. Exported for
13
23
  * cases where a host wants to compose multiple components inside one
14
24
  * card (e.g. an account page row).
25
+ *
26
+ * Accepts `ElvixSizeProps` (width/height/min/max) merged into the root
27
+ * element so every component built on ElvixCard is sizable by default;
28
+ * the size props win over the card's maxWidth/width defaults.
15
29
  */
16
- declare function ElvixCard({ title, footer, className, children, }: {
30
+ declare function ElvixCard({ title, footer, className, style, children, width, height, minWidth, maxWidth, minHeight, maxHeight, }: {
17
31
  title?: ReactNode;
18
32
  footer?: ReactNode;
19
33
  className?: string;
34
+ style?: CSSProperties;
20
35
  children: ReactNode;
21
- }): react_jsx_runtime.JSX.Element;
36
+ } & ElvixSizeProps): react_jsx_runtime.JSX.Element;
22
37
 
23
38
  /**
24
39
  * Editable sign-in copy.
@@ -43,6 +58,8 @@ type ElvixCopy = {
43
58
  subtitle?: string;
44
59
  /** Google factor button. */
45
60
  googleButton?: string;
61
+ /** Passkey factor button. */
62
+ passkeyButton?: string;
46
63
  /** Email field placeholder. */
47
64
  emailPlaceholder?: string;
48
65
  /** Email submit button (identify step). */
@@ -186,7 +203,7 @@ declare function ElvixProvider({ clientId, theme, brand, baseUrl, children, clas
186
203
  * exposes. Hosts navigate from the callback; this component never
187
204
  * calls `router.push` itself.
188
205
  */
189
- declare function ElvixSignIn({ onResult, redirectAfterSignIn, copy: copyProp, className, }: {
206
+ declare function ElvixSignIn({ onResult, redirectAfterSignIn, copy: copyProp, className, width, height, minWidth, maxWidth, minHeight, maxHeight, }: {
190
207
  onResult?: (r: ElvixSignInResult) => void;
191
208
  /** Default redirect target on success when the server doesn't echo one. */
192
209
  redirectAfterSignIn?: string;
@@ -197,7 +214,45 @@ declare function ElvixSignIn({ onResult, redirectAfterSignIn, copy: copyProp, cl
197
214
  */
198
215
  copy?: Partial<ElvixCopy>;
199
216
  className?: string;
200
- }): react_jsx_runtime.JSX.Element;
217
+ } & ElvixSizeProps): react_jsx_runtime.JSX.Element;
218
+
219
+ /**
220
+ * `<ElvixSignInForm>` — the polished, fully-styled sign-in surface a
221
+ * customer drops onto their own app.
222
+ *
223
+ * Where `<ElvixSignIn>` is the bare-bones flow (class-hooked, host paints
224
+ * it), this is the finished card: rounded logo tile, "Sign in to {app}"
225
+ * heading, "Continue with Google", an OR divider, the email→code OTP
226
+ * flow, a legal footer, and a "Secured by elvix" badge. It ships with
227
+ * **inline styles only** — no host CSS required, so it looks right the
228
+ * moment it mounts on any origin.
229
+ *
230
+ * Cross-origin correct: OTP start/verify pick credentials from
231
+ * `isSameOrigin(baseUrl)` exactly like `<ElvixSignIn>`; on a third-party
232
+ * origin the session token comes back in the response body and is stored
233
+ * via `setElvixToken`. Google is a top-level redirect.
234
+ *
235
+ * Reads enabled methods + branding from the Console-configured bootstrap
236
+ * envelope (`<ElvixProvider clientId>` must be an ancestor). Renders only
237
+ * the factors the Console turned on; never invents UI it denied.
238
+ *
239
+ * `onResult({ ok, ... })` fires on success AND every failure, mirroring
240
+ * `<ElvixSignIn>`. The component never navigates the host itself.
241
+ */
242
+ type ElvixSignInFormProps = {
243
+ /** Fires on every terminal outcome — success and failure — like `<ElvixSignIn>`. */
244
+ onResult?: (r: ElvixSignInResult) => void;
245
+ /** Default redirect target on success when the server doesn't echo one. */
246
+ redirectAfterSignIn?: string;
247
+ /**
248
+ * Thin per-embed copy override. The primary way to edit copy is the elvix
249
+ * Console (served live in the bootstrap `strings`); this prop just lets a
250
+ * single embed tweak a string or two without a Console change.
251
+ */
252
+ copy?: Partial<ElvixCopy>;
253
+ className?: string;
254
+ } & /** Sizing — applied to the card root inline style (SDK components are sizable). */ ElvixSizeProps;
255
+ declare function ElvixSignInForm({ onResult, redirectAfterSignIn, copy: copyProp, className, minWidth, maxWidth, minHeight, maxHeight, width, height, }: ElvixSignInFormProps): react_jsx_runtime.JSX.Element;
201
256
 
202
257
  type ElvixSignInButtonSize = "sm" | "md" | "lg";
203
258
  type ElvixSignInButtonTheme = "light" | "dark" | "auto";
@@ -224,8 +279,11 @@ type ElvixSignInButtonProps = {
224
279
  onClick?: () => void;
225
280
  /** Terminal outcome of mode="embed": success (with token) or error. */
226
281
  onResult?: (result: ElvixSignInResult) => void;
227
- };
228
- declare function ElvixSignInButton({ clientId, baseUrl, returnUrl, type, variant, shape, size, theme, preset, label, className, href, mode, onClick, onResult, }: ElvixSignInButtonProps): react_jsx_runtime.JSX.Element;
282
+ } & /**
283
+ * Dimensional sizing (width/height/min/max), additive to the `size` preset.
284
+ * Merged last into the root element so an explicit width/height wins.
285
+ */ ElvixSizeProps;
286
+ declare function ElvixSignInButton({ clientId, baseUrl, returnUrl, type, variant, shape, size, theme, preset, label, className, href, mode, onClick, onResult, width, height, minWidth, maxWidth, minHeight, maxHeight, }: ElvixSignInButtonProps): react_jsx_runtime.JSX.Element;
229
287
 
230
288
  type ElvixSecuredBadgeVariant = "white" | "dark" | "outline";
231
289
  type ElvixSecuredBadgeSize = "sm" | "md" | "lg";
@@ -240,8 +298,8 @@ type ElvixSecuredBadgeProps = {
240
298
  /** Where the badge links. Defaults to elvix. */
241
299
  href?: string;
242
300
  className?: string;
243
- };
244
- declare function ElvixSecuredBadge({ variant, size, theme, accentColor, href, className, }: ElvixSecuredBadgeProps): react_jsx_runtime.JSX.Element;
301
+ } & /** Dimensional sizing, additive to the `size` preset; merged last so it wins. */ ElvixSizeProps;
302
+ declare function ElvixSecuredBadge({ variant, size, theme, accentColor, href, className, width, height, minWidth, maxWidth, minHeight, maxHeight, }: ElvixSecuredBadgeProps): react_jsx_runtime.JSX.Element;
245
303
 
246
304
  /**
247
305
  * Session token store for cross-origin SDK use.
@@ -290,111 +348,111 @@ declare function ElvixLifecycleWatcher({ baseUrl, pollMs, onSignedOut, }: {
290
348
  * current Application. PATCH /api/account/apps/<appId>/username.
291
349
  * Render a single in-frame card with two panes: edit + done.
292
350
  */
293
- declare function ElvixUsername({ onResult, }: {
351
+ declare function ElvixUsername({ onResult, width, height, minWidth, maxWidth, minHeight, maxHeight, }: {
294
352
  onResult?: (r: ElvixActionResult<{
295
353
  username: string;
296
354
  }>) => void;
297
- }): react_jsx_runtime.JSX.Element;
355
+ } & ElvixSizeProps): react_jsx_runtime.JSX.Element;
298
356
 
299
357
  /**
300
358
  * `<ElvixAvatar>` — upload / replace the end-user's avatar for this
301
359
  * Application. Reads file → base64 → PATCH /api/account/apps/<appId>/avatar.
302
360
  */
303
- declare function ElvixAvatar({ onResult, }: {
361
+ declare function ElvixAvatar({ onResult, width, height, minWidth, maxWidth, minHeight, maxHeight, }: {
304
362
  onResult?: (r: ElvixActionResult<{
305
363
  avatarUrl: string;
306
364
  }>) => void;
307
- }): react_jsx_runtime.JSX.Element;
365
+ } & ElvixSizeProps): react_jsx_runtime.JSX.Element;
308
366
 
309
367
  /**
310
368
  * `<ElvixBanner>` — upload / replace the end-user's profile banner
311
369
  * (16:9 cover image) for this Application.
312
370
  */
313
- declare function ElvixBanner({ onResult, }: {
371
+ declare function ElvixBanner({ onResult, width, height, minWidth, maxWidth, minHeight, maxHeight, }: {
314
372
  onResult?: (r: ElvixActionResult<{
315
373
  bannerUrl: string;
316
374
  }>) => void;
317
- }): react_jsx_runtime.JSX.Element;
375
+ } & ElvixSizeProps): react_jsx_runtime.JSX.Element;
318
376
 
319
377
  /**
320
378
  * `<ElvixIdentityForm>` — edit the end-user's display name + bio for
321
379
  * the current Application. Lightweight per-app profile fields.
322
380
  */
323
- declare function ElvixIdentityForm({ initialName, initialBio, onResult, }: {
381
+ declare function ElvixIdentityForm({ initialName, initialBio, onResult, width, height, minWidth, maxWidth, minHeight, maxHeight, }: {
324
382
  initialName?: string;
325
383
  initialBio?: string;
326
384
  onResult?: (r: ElvixActionResult<{
327
385
  name: string;
328
386
  bio: string;
329
387
  }>) => void;
330
- }): react_jsx_runtime.JSX.Element;
388
+ } & ElvixSizeProps): react_jsx_runtime.JSX.Element;
331
389
 
332
390
  /**
333
391
  * `<ElvixRegion>` — set the end-user's region (ISO 3166-1 alpha-2
334
392
  * country code + timezone). Used by elvix for data-residency hints
335
393
  * and locale defaults.
336
394
  */
337
- declare function ElvixRegion({ initialCountry, initialTimezone, onResult, }: {
395
+ declare function ElvixRegion({ initialCountry, initialTimezone, onResult, width, height, minWidth, maxWidth, minHeight, maxHeight, }: {
338
396
  initialCountry?: string;
339
397
  initialTimezone?: string;
340
398
  onResult?: (r: ElvixActionResult<{
341
399
  country: string;
342
400
  timezone: string;
343
401
  }>) => void;
344
- }): react_jsx_runtime.JSX.Element;
402
+ } & ElvixSizeProps): react_jsx_runtime.JSX.Element;
345
403
 
346
404
  /**
347
405
  * `<ElvixLanguages>` — set the end-user's preferred languages (BCP-47
348
406
  * tag list, ordered by preference). The first entry drives UI locale.
349
407
  */
350
- declare function ElvixLanguages({ initial, onResult, }: {
408
+ declare function ElvixLanguages({ initial, onResult, width, height, minWidth, maxWidth, minHeight, maxHeight, }: {
351
409
  initial?: string[];
352
410
  onResult?: (r: ElvixActionResult<{
353
411
  languages: string[];
354
412
  }>) => void;
355
- }): react_jsx_runtime.JSX.Element;
413
+ } & ElvixSizeProps): react_jsx_runtime.JSX.Element;
356
414
 
357
- declare function ElvixSessions({ onResult, }: {
415
+ declare function ElvixSessions({ onResult, width, height, minWidth, maxWidth, minHeight, maxHeight, }: {
358
416
  onResult?: (r: ElvixActionResult<{
359
417
  revoked: number;
360
418
  }>) => void;
361
- }): react_jsx_runtime.JSX.Element;
419
+ } & ElvixSizeProps): react_jsx_runtime.JSX.Element;
362
420
 
363
421
  /**
364
422
  * `<ElvixExport>` — GDPR Art. 15 data-export request. Triggers an
365
423
  * async server-side zip + emails a single-use download link to the
366
424
  * end-user's bound email address.
367
425
  */
368
- declare function ElvixExport({ onResult, }: {
426
+ declare function ElvixExport({ onResult, width, height, minWidth, maxWidth, minHeight, maxHeight, }: {
369
427
  onResult?: (r: ElvixActionResult<{
370
428
  requestId: string;
371
429
  }>) => void;
372
- }): react_jsx_runtime.JSX.Element;
430
+ } & ElvixSizeProps): react_jsx_runtime.JSX.Element;
373
431
 
374
- declare function ElvixDeactivate({ onResult, }: {
432
+ declare function ElvixDeactivate({ onResult, width, height, minWidth, maxWidth, minHeight, maxHeight, }: {
375
433
  onResult?: (r: ElvixActionResult) => void;
376
- }): react_jsx_runtime.JSX.Element;
434
+ } & ElvixSizeProps): react_jsx_runtime.JSX.Element;
377
435
 
378
- declare function ElvixLeave({ onResult, }: {
436
+ declare function ElvixLeave({ onResult, width, height, minWidth, maxWidth, minHeight, maxHeight, }: {
379
437
  onResult?: (r: ElvixActionResult) => void;
380
- }): react_jsx_runtime.JSX.Element;
438
+ } & ElvixSizeProps): react_jsx_runtime.JSX.Element;
381
439
 
382
440
  /**
383
441
  * `<ElvixAddressBook>` — list / add / remove the end-user's addresses
384
442
  * on this Application. Read uses GET /api/account/apps/<appId>/addresses;
385
443
  * mutations POST + DELETE on the same path.
386
444
  */
387
- declare function ElvixAddressBook({ onResult, }: {
445
+ declare function ElvixAddressBook({ onResult, width, height, minWidth, maxWidth, minHeight, maxHeight, }: {
388
446
  onResult?: (r: ElvixActionResult) => void;
389
- }): react_jsx_runtime.JSX.Element;
447
+ } & ElvixSizeProps): react_jsx_runtime.JSX.Element;
390
448
 
391
449
  /**
392
450
  * `<ElvixLegalEntities>` — list / add / remove the end-user's legal
393
451
  * entities (company names + tax IDs) on this Application. Useful for
394
452
  * B2B apps that bill at the entity level.
395
453
  */
396
- declare function ElvixLegalEntities({ onResult, }: {
454
+ declare function ElvixLegalEntities({ onResult, width, height, minWidth, maxWidth, minHeight, maxHeight, }: {
397
455
  onResult?: (r: ElvixActionResult) => void;
398
- }): react_jsx_runtime.JSX.Element;
456
+ } & ElvixSizeProps): react_jsx_runtime.JSX.Element;
399
457
 
400
- export { DEFAULT_COPY, ElvixActionResult, ElvixAddressBook, ElvixAvatar, ElvixBanner, type ElvixBootstrapEnvelope, type ElvixBrand, ElvixCard, type ElvixCopy, ElvixDeactivate, ElvixExport, ElvixIdentityForm, ElvixLanguages, ElvixLeave, ElvixLegalEntities, ElvixLifecycleWatcher, ElvixProvider, ElvixRegion, ElvixSecuredBadge, ElvixSessions, ElvixSignIn, ElvixSignInButton, type ElvixSignInMethod, type ElvixSignInResult, type ElvixSignInResultErr, type ElvixSignInResultOk, type ElvixTheme, ElvixUsername, type UseUserListResult, getElvixToken, setElvixToken, useElvixApp, useElvixContext, useUserMemberships, useUserRoles, useUserScopes };
458
+ export { DEFAULT_COPY, ElvixActionResult, ElvixAddressBook, ElvixAvatar, ElvixBanner, type ElvixBootstrapEnvelope, type ElvixBrand, ElvixCard, type ElvixCopy, ElvixDeactivate, ElvixExport, ElvixIdentityForm, ElvixLanguages, ElvixLeave, ElvixLegalEntities, ElvixLifecycleWatcher, ElvixProvider, ElvixRegion, ElvixSecuredBadge, ElvixSessions, ElvixSignIn, ElvixSignInButton, ElvixSignInForm, type ElvixSignInMethod, type ElvixSignInResult, type ElvixSignInResultErr, type ElvixSignInResultOk, type ElvixSizeProps, type ElvixTheme, ElvixUsername, type UseUserListResult, getElvixToken, setElvixToken, useElvixApp, useElvixContext, useUserMemberships, useUserRoles, useUserScopes };