@elvix.is/sdk 0.5.9 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/react.d.ts CHANGED
@@ -276,6 +276,7 @@ declare function ElvixSignIn({ onResult, redirectAfterSignIn, copy: copyProp, cl
276
276
  type ElvixSignInResult = {
277
277
  ok: true;
278
278
  redirect?: string;
279
+ token?: string;
279
280
  } | {
280
281
  ok: false;
281
282
  error: string;
package/dist/react.js CHANGED
@@ -1552,6 +1552,17 @@ function AuthBody({
1552
1552
  return;
1553
1553
  }
1554
1554
  if (body.next_step === "passkey") {
1555
+ if (!isSameOrigin(baseUrl)) {
1556
+ const redirect2 = finalRedirect(body.final ?? body.redirect);
1557
+ const token2 = body.token ?? getElvixToken() ?? void 0;
1558
+ onResult?.({ ok: true, redirect: redirect2, token: token2 });
1559
+ if (onAuthenticated) {
1560
+ onAuthenticated({ ok: true, redirect: redirect2, token: token2 });
1561
+ return;
1562
+ }
1563
+ window.location.href = redirect2;
1564
+ return;
1565
+ }
1555
1566
  setBackendFinalRedirect(body.final ?? "/");
1556
1567
  setStep("passkey");
1557
1568
  return;
@@ -1563,14 +1574,15 @@ function AuthBody({
1563
1574
  return;
1564
1575
  }
1565
1576
  const redirect = finalRedirect(body.redirect ?? defaultRedirect(intent));
1566
- onResult?.({ ok: true, redirect });
1577
+ const token = body.token ?? getElvixToken() ?? void 0;
1578
+ onResult?.({ ok: true, redirect, token });
1567
1579
  if (onAuthenticated) {
1568
- onAuthenticated({ ok: true, redirect, token: body.token });
1580
+ onAuthenticated({ ok: true, redirect, token });
1569
1581
  return;
1570
1582
  }
1571
1583
  window.location.href = redirect;
1572
1584
  },
1573
- [intent, onAuthenticated, onResult, finalRedirect]
1585
+ [intent, onAuthenticated, onResult, finalRedirect, baseUrl]
1574
1586
  );
1575
1587
  useEffect4(() => {
1576
1588
  if (isPreview) return;
@@ -1804,9 +1816,10 @@ function AuthBody({
1804
1816
  return;
1805
1817
  }
1806
1818
  const redirect = finalRedirect();
1807
- onResult?.({ ok: true, redirect });
1819
+ const token = getElvixToken() ?? void 0;
1820
+ onResult?.({ ok: true, redirect, token });
1808
1821
  if (onAuthenticated) {
1809
- onAuthenticated({ ok: true, redirect });
1822
+ onAuthenticated({ ok: true, redirect, token });
1810
1823
  return;
1811
1824
  }
1812
1825
  window.location.href = redirect;
@@ -1818,9 +1831,10 @@ function AuthBody({
1818
1831
  if (onboardingBusy) return;
1819
1832
  setOnboardingBusy("skip");
1820
1833
  const redirect = finalRedirect();
1821
- onResult?.({ ok: true, redirect });
1834
+ const token = getElvixToken() ?? void 0;
1835
+ onResult?.({ ok: true, redirect, token });
1822
1836
  if (onAuthenticated) {
1823
- onAuthenticated({ ok: true, redirect });
1837
+ onAuthenticated({ ok: true, redirect, token });
1824
1838
  return;
1825
1839
  }
1826
1840
  window.location.href = redirect;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elvix.is/sdk",
3
- "version": "0.5.9",
3
+ "version": "0.6.0",
4
4
  "description": "Official elvix SDK. Drop-in React components, server helpers, and an MCP server so AI coding agents integrate elvix on the first try.",
5
5
  "license": "MIT",
6
6
  "homepage": "https://elvix.is",