@elvix.is/sdk 0.5.4 → 0.5.5

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