decane-connect-kit 2.7.5 → 2.8.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/index.cjs CHANGED
@@ -2093,6 +2093,18 @@ var ApiClient = class {
2093
2093
  body: JSON.stringify({ email, code })
2094
2094
  });
2095
2095
  }
2096
+ async authPhoneStart(phone) {
2097
+ await this._request("/auth/phone/start", {
2098
+ method: "POST",
2099
+ body: JSON.stringify({ phone })
2100
+ });
2101
+ }
2102
+ async authPhoneVerify(phone, code) {
2103
+ return this._request("/auth/phone/verify", {
2104
+ method: "POST",
2105
+ body: JSON.stringify({ phone, code })
2106
+ });
2107
+ }
2096
2108
  // GET /share (the server share itself) was removed as part of the TEE
2097
2109
  // migration — the browser must never reconstruct the private key anymore.
2098
2110
  // Only public addresses are fetched from the backend now.
@@ -2938,6 +2950,14 @@ async function verifyEmailCode(api, email, code) {
2938
2950
  return api.authEmailVerify(email, code);
2939
2951
  }
2940
2952
 
2953
+ // src/social/auth/phone.ts
2954
+ async function startPhoneAuth(api, phone) {
2955
+ await api.authPhoneStart(phone);
2956
+ }
2957
+ async function verifyPhoneCode(api, phone, code) {
2958
+ return api.authPhoneVerify(phone, code);
2959
+ }
2960
+
2941
2961
  // src/social/auth/kingschat.ts
2942
2962
  init_errors();
2943
2963
  var KINGSCHAT_AUTH_ORIGIN = "https://accounts.kingsch.at";
@@ -4145,6 +4165,14 @@ async function createDecaneConnect(config) {
4145
4165
  const result = await verifyEmailCode(api, email, code);
4146
4166
  return handleAuthResult(result);
4147
4167
  },
4168
+ async connectWithPhone(phone) {
4169
+ await startPhoneAuth(api, phone);
4170
+ return { codeRequired: true };
4171
+ },
4172
+ async verifyPhoneCode(phone, code) {
4173
+ const result = await verifyPhoneCode(api, phone, code);
4174
+ return handleAuthResult(result);
4175
+ },
4148
4176
  async canSignInWithPasskey() {
4149
4177
  return await passkeyLoginCandidate() !== null;
4150
4178
  },
@@ -4907,6 +4935,8 @@ function WalletSelector({
4907
4935
  onKingsChatSignIn,
4908
4936
  onEmailStart,
4909
4937
  onEmailVerify,
4938
+ onPhoneStart,
4939
+ onPhoneVerify,
4910
4940
  customAuthLabel,
4911
4941
  onCustomAuthSignIn,
4912
4942
  canUsePasskey = false,
@@ -4922,6 +4952,9 @@ function WalletSelector({
4922
4952
  const [emailStep, setEmailStep] = (0, import_react2.useState)("input");
4923
4953
  const [emailVal, setEmailVal] = (0, import_react2.useState)("");
4924
4954
  const [codeVal, setCodeVal] = (0, import_react2.useState)("");
4955
+ const [phoneStep, setPhoneStep] = (0, import_react2.useState)("input");
4956
+ const [phoneVal, setPhoneVal] = (0, import_react2.useState)("");
4957
+ const [phoneCode, setPhoneCode] = (0, import_react2.useState)("");
4925
4958
  const [socialLoad, setSocialLoad] = (0, import_react2.useState)(false);
4926
4959
  const [socialErr, setSocialErr] = (0, import_react2.useState)("");
4927
4960
  const [showOtherMethods, setShowOtherMethods] = (0, import_react2.useState)(false);
@@ -5032,6 +5065,33 @@ function WalletSelector({
5032
5065
  setSocialLoad(false);
5033
5066
  }
5034
5067
  }
5068
+ async function handlePhoneStart(e) {
5069
+ e.preventDefault();
5070
+ if (!onPhoneStart) return;
5071
+ setSocialLoad(true);
5072
+ setSocialErr("");
5073
+ try {
5074
+ await onPhoneStart(phoneVal);
5075
+ setPhoneStep("code");
5076
+ } catch (e2) {
5077
+ setSocialErr(e2.message);
5078
+ } finally {
5079
+ setSocialLoad(false);
5080
+ }
5081
+ }
5082
+ async function handlePhoneVerify(e) {
5083
+ e.preventDefault();
5084
+ if (!onPhoneVerify) return;
5085
+ setSocialLoad(true);
5086
+ setSocialErr("");
5087
+ try {
5088
+ await onPhoneVerify(phoneVal, phoneCode);
5089
+ } catch (e2) {
5090
+ setSocialErr(e2.message);
5091
+ } finally {
5092
+ setSocialLoad(false);
5093
+ }
5094
+ }
5035
5095
  const handleKey = (0, import_react2.useCallback)(
5036
5096
  (e) => {
5037
5097
  if (e.key === "Escape") {
@@ -5567,6 +5627,126 @@ function WalletSelector({
5567
5627
  }
5568
5628
  },
5569
5629
  socialLoad ? "Verifying\u2026" : "Verify"
5630
+ )))), !passkeyFirst && socialAuthMethods.includes("phone") && onPhoneStart && onPhoneVerify && (phoneStep === "input" ? /* @__PURE__ */ import_react2.default.createElement("form", { onSubmit: handlePhoneStart, style: { display: "flex", flexDirection: "column", gap: 8 } }, /* @__PURE__ */ import_react2.default.createElement(
5631
+ "input",
5632
+ {
5633
+ type: "tel",
5634
+ placeholder: "+234 801 234 5678",
5635
+ value: phoneVal,
5636
+ onChange: (e) => setPhoneVal(e.target.value),
5637
+ required: true,
5638
+ style: {
5639
+ width: "100%",
5640
+ padding: "10px 12px",
5641
+ background: "var(--dc-surface)",
5642
+ border: "1px solid var(--dc-border)",
5643
+ borderRadius: 10,
5644
+ color: "var(--dc-text)",
5645
+ fontSize: 13,
5646
+ fontFamily: "inherit",
5647
+ outline: "none",
5648
+ boxSizing: "border-box"
5649
+ },
5650
+ onFocus: (e) => {
5651
+ e.currentTarget.style.borderColor = "var(--dc-border-accent)";
5652
+ },
5653
+ onBlur: (e) => {
5654
+ e.currentTarget.style.borderColor = "var(--dc-border)";
5655
+ }
5656
+ }
5657
+ ), /* @__PURE__ */ import_react2.default.createElement(
5658
+ "button",
5659
+ {
5660
+ type: "submit",
5661
+ disabled: socialLoad || !phoneVal,
5662
+ style: {
5663
+ width: "100%",
5664
+ padding: "10px 16px",
5665
+ background: "var(--dc-accent)",
5666
+ color: "var(--dc-accent-text)",
5667
+ border: "none",
5668
+ borderRadius: 10,
5669
+ fontSize: 14,
5670
+ fontWeight: 700,
5671
+ cursor: socialLoad ? "not-allowed" : "pointer",
5672
+ fontFamily: "inherit",
5673
+ opacity: socialLoad || !phoneVal ? 0.6 : 1
5674
+ }
5675
+ },
5676
+ socialLoad ? "Sending\u2026" : "Send code"
5677
+ )) : /* @__PURE__ */ import_react2.default.createElement("form", { onSubmit: handlePhoneVerify, style: { display: "flex", flexDirection: "column", gap: 8 } }, /* @__PURE__ */ import_react2.default.createElement("p", { style: { margin: 0, fontSize: 12, color: "var(--dc-text-muted)", textAlign: "center" } }, "Code sent to ", /* @__PURE__ */ import_react2.default.createElement("strong", { style: { color: "var(--dc-text)" } }, phoneVal)), /* @__PURE__ */ import_react2.default.createElement(
5678
+ "input",
5679
+ {
5680
+ type: "text",
5681
+ inputMode: "numeric",
5682
+ placeholder: "6-digit code",
5683
+ value: phoneCode,
5684
+ onChange: (e) => setPhoneCode(e.target.value.replace(/\D/g, "").slice(0, 6)),
5685
+ autoFocus: true,
5686
+ required: true,
5687
+ style: {
5688
+ width: "100%",
5689
+ padding: "10px 12px",
5690
+ background: "var(--dc-surface)",
5691
+ border: "1px solid var(--dc-border)",
5692
+ borderRadius: 10,
5693
+ color: "var(--dc-text)",
5694
+ fontSize: 20,
5695
+ fontFamily: "monospace",
5696
+ letterSpacing: 8,
5697
+ textAlign: "center",
5698
+ outline: "none",
5699
+ boxSizing: "border-box"
5700
+ },
5701
+ onFocus: (e) => {
5702
+ e.currentTarget.style.borderColor = "var(--dc-border-accent)";
5703
+ },
5704
+ onBlur: (e) => {
5705
+ e.currentTarget.style.borderColor = "var(--dc-border)";
5706
+ }
5707
+ }
5708
+ ), /* @__PURE__ */ import_react2.default.createElement("div", { style: { display: "flex", gap: 8 } }, /* @__PURE__ */ import_react2.default.createElement(
5709
+ "button",
5710
+ {
5711
+ type: "button",
5712
+ onClick: () => {
5713
+ setPhoneStep("input");
5714
+ setPhoneCode("");
5715
+ setSocialErr("");
5716
+ },
5717
+ style: {
5718
+ flex: 1,
5719
+ padding: "9px 0",
5720
+ background: "transparent",
5721
+ border: "1px solid var(--dc-border)",
5722
+ borderRadius: 10,
5723
+ color: "var(--dc-text-muted)",
5724
+ fontSize: 13,
5725
+ cursor: "pointer",
5726
+ fontFamily: "inherit"
5727
+ }
5728
+ },
5729
+ "Back"
5730
+ ), /* @__PURE__ */ import_react2.default.createElement(
5731
+ "button",
5732
+ {
5733
+ type: "submit",
5734
+ disabled: socialLoad || phoneCode.length < 6,
5735
+ style: {
5736
+ flex: 2,
5737
+ padding: "9px 0",
5738
+ background: "var(--dc-accent)",
5739
+ color: "var(--dc-accent-text)",
5740
+ border: "none",
5741
+ borderRadius: 10,
5742
+ fontSize: 13,
5743
+ fontWeight: 700,
5744
+ cursor: socialLoad || phoneCode.length < 6 ? "not-allowed" : "pointer",
5745
+ fontFamily: "inherit",
5746
+ opacity: socialLoad || phoneCode.length < 6 ? 0.6 : 1
5747
+ }
5748
+ },
5749
+ socialLoad ? "Verifying\u2026" : "Verify"
5570
5750
  )))), !passkeyFirst && customAuthLabel && onCustomAuthSignIn && /* @__PURE__ */ import_react2.default.createElement(import_react2.default.Fragment, null, (socialAuthMethods.includes("google") || socialAuthMethods.includes("email")) && /* @__PURE__ */ import_react2.default.createElement("div", { style: { display: "flex", alignItems: "center", gap: 10 } }, /* @__PURE__ */ import_react2.default.createElement("div", { style: { flex: 1, height: 1, background: "var(--dc-border)" } }), /* @__PURE__ */ import_react2.default.createElement("span", { style: { fontSize: 11, color: "var(--dc-text-muted)", whiteSpace: "nowrap" } }, "or"), /* @__PURE__ */ import_react2.default.createElement("div", { style: { flex: 1, height: 1, background: "var(--dc-border)" } })), /* @__PURE__ */ import_react2.default.createElement(
5571
5751
  "button",
5572
5752
  {
@@ -5697,6 +5877,8 @@ function SignInView({
5697
5877
  onKingsChatSignIn,
5698
5878
  onEmailStart,
5699
5879
  onEmailVerify,
5880
+ onPhoneStart,
5881
+ onPhoneVerify,
5700
5882
  authMethods,
5701
5883
  resumeHint,
5702
5884
  customAuthLabel,
@@ -5711,6 +5893,10 @@ function SignInView({
5711
5893
  const [code, setCode] = (0, import_react3.useState)("");
5712
5894
  const [emailSent, setEmailSent] = (0, import_react3.useState)(false);
5713
5895
  const [emailLoading, setEmailLoading] = (0, import_react3.useState)(false);
5896
+ const [phone, setPhone] = (0, import_react3.useState)("");
5897
+ const [phoneCode, setPhoneCode] = (0, import_react3.useState)("");
5898
+ const [phoneSent, setPhoneSent] = (0, import_react3.useState)(false);
5899
+ const [phoneLoading, setPhoneLoading] = (0, import_react3.useState)(false);
5714
5900
  const [customLoading, setCustomLoading] = (0, import_react3.useState)(false);
5715
5901
  const [passkeyLoading, setPasskeyLoading] = (0, import_react3.useState)(false);
5716
5902
  const [showOtherMethods, setShowOtherMethods] = (0, import_react3.useState)(false);
@@ -5778,6 +5964,33 @@ function SignInView({
5778
5964
  setEmailLoading(false);
5779
5965
  }
5780
5966
  }
5967
+ async function handlePhoneStart(e) {
5968
+ e.preventDefault();
5969
+ if (!onPhoneStart) return;
5970
+ setError("");
5971
+ setPhoneLoading(true);
5972
+ try {
5973
+ await onPhoneStart(phone);
5974
+ setPhoneSent(true);
5975
+ } catch (e2) {
5976
+ setError(e2.message);
5977
+ } finally {
5978
+ setPhoneLoading(false);
5979
+ }
5980
+ }
5981
+ async function handlePhoneVerify(e) {
5982
+ e.preventDefault();
5983
+ if (!onPhoneVerify) return;
5984
+ setError("");
5985
+ setPhoneLoading(true);
5986
+ try {
5987
+ await onPhoneVerify(phone, phoneCode);
5988
+ } catch (e2) {
5989
+ setError(e2.message);
5990
+ } finally {
5991
+ setPhoneLoading(false);
5992
+ }
5993
+ }
5781
5994
  async function handleCustomAuth() {
5782
5995
  if (!onCustomAuthSignIn) return;
5783
5996
  setError("");
@@ -5923,7 +6136,47 @@ function SignInView({
5923
6136
  fontWeight: 700,
5924
6137
  cursor: "pointer",
5925
6138
  fontFamily: "inherit"
5926
- } }, emailLoading ? "\u2026" : "Verify"))), !passkeyFirst && customAuthLabel && onCustomAuthSignIn && /* @__PURE__ */ import_react3.default.createElement(import_react3.default.Fragment, null, (authMethods.includes("google") || authMethods.includes("email")) && /* @__PURE__ */ import_react3.default.createElement("div", { style: { textAlign: "center", color: "var(--dc-text-muted)", fontSize: 12, margin: "10px 0" } }, "\u2014 or \u2014"), /* @__PURE__ */ import_react3.default.createElement(
6139
+ } }, emailLoading ? "\u2026" : "Verify"))), !passkeyFirst && authMethods.includes("phone") && onPhoneStart && onPhoneVerify && /* @__PURE__ */ import_react3.default.createElement(import_react3.default.Fragment, null, (authMethods.includes("google") || authMethods.includes("email")) && /* @__PURE__ */ import_react3.default.createElement("div", { style: { textAlign: "center", color: "var(--dc-text-muted)", fontSize: 12, margin: "10px 0" } }, "\u2014 or \u2014"), !phoneSent ? /* @__PURE__ */ import_react3.default.createElement("form", { onSubmit: handlePhoneStart, style: { display: "flex", gap: 8 } }, /* @__PURE__ */ import_react3.default.createElement(
6140
+ "input",
6141
+ {
6142
+ type: "tel",
6143
+ required: true,
6144
+ placeholder: "+234 801 234 5678",
6145
+ value: phone,
6146
+ onChange: (e) => setPhone(e.target.value),
6147
+ style: { ...inputStyle, flex: 1 }
6148
+ }
6149
+ ), /* @__PURE__ */ import_react3.default.createElement("button", { type: "submit", disabled: phoneLoading, style: {
6150
+ padding: "0 16px",
6151
+ background: "var(--dc-surface)",
6152
+ border: "1px solid var(--dc-border)",
6153
+ borderRadius: 8,
6154
+ color: "var(--dc-text)",
6155
+ fontSize: 13,
6156
+ cursor: "pointer",
6157
+ fontFamily: "inherit"
6158
+ } }, phoneLoading ? "\u2026" : "Send code")) : /* @__PURE__ */ import_react3.default.createElement("form", { onSubmit: handlePhoneVerify, style: { display: "flex", gap: 8 } }, /* @__PURE__ */ import_react3.default.createElement(
6159
+ "input",
6160
+ {
6161
+ placeholder: "6-digit code",
6162
+ value: phoneCode,
6163
+ maxLength: 6,
6164
+ autoFocus: true,
6165
+ inputMode: "numeric",
6166
+ onChange: (e) => setPhoneCode(e.target.value.replace(/\D/g, "")),
6167
+ style: { ...inputStyle, flex: 1, letterSpacing: 4, textAlign: "center" }
6168
+ }
6169
+ ), /* @__PURE__ */ import_react3.default.createElement("button", { type: "submit", disabled: phoneLoading, style: {
6170
+ padding: "0 16px",
6171
+ background: "var(--dc-accent)",
6172
+ color: "var(--dc-accent-text)",
6173
+ border: "none",
6174
+ borderRadius: 8,
6175
+ fontSize: 13,
6176
+ fontWeight: 700,
6177
+ cursor: "pointer",
6178
+ fontFamily: "inherit"
6179
+ } }, phoneLoading ? "\u2026" : "Verify"))), !passkeyFirst && customAuthLabel && onCustomAuthSignIn && /* @__PURE__ */ import_react3.default.createElement(import_react3.default.Fragment, null, (authMethods.includes("google") || authMethods.includes("email")) && /* @__PURE__ */ import_react3.default.createElement("div", { style: { textAlign: "center", color: "var(--dc-text-muted)", fontSize: 12, margin: "10px 0" } }, "\u2014 or \u2014"), /* @__PURE__ */ import_react3.default.createElement(
5927
6180
  "button",
5928
6181
  {
5929
6182
  onClick: handleCustomAuth,
@@ -6060,6 +6313,8 @@ function SocialWalletModal({
6060
6313
  onKingsChatSignIn,
6061
6314
  onEmailStart,
6062
6315
  onEmailVerify,
6316
+ onPhoneStart,
6317
+ onPhoneVerify,
6063
6318
  authMethods = ["google", "email"],
6064
6319
  customAuthLabel,
6065
6320
  onCustomAuthSignIn,
@@ -6194,6 +6449,8 @@ function SocialWalletModal({
6194
6449
  onKingsChatSignIn,
6195
6450
  onEmailStart,
6196
6451
  onEmailVerify,
6452
+ onPhoneStart,
6453
+ onPhoneVerify,
6197
6454
  authMethods,
6198
6455
  resumeHint: socialAuth.needsReconnect ? "your wallet" : void 0,
6199
6456
  customAuthLabel,
@@ -6437,7 +6694,16 @@ function DecaneKit({ config, children }) {
6437
6694
  apiBaseUrl,
6438
6695
  chains,
6439
6696
  rpcUrls,
6440
- requireAssertionPerSignature
6697
+ requireAssertionPerSignature,
6698
+ // Recovery callbacks. Forwarding these is what makes recovery
6699
+ // configurable at all from <DecaneKit>; before, they were silently
6700
+ // dropped and the headless client was constructed without them.
6701
+ offerRecoveryAtSignup,
6702
+ onRecoveryShareOffer,
6703
+ onRecoveryFileReady,
6704
+ promptForRecoveryFile,
6705
+ onRecoveryRotated,
6706
+ onRecoveryProgress
6441
6707
  } = config.social;
6442
6708
  createDecaneConnect({
6443
6709
  appId: config.appId,
@@ -6447,7 +6713,13 @@ function DecaneKit({ config, children }) {
6447
6713
  chains: chains ?? ["evm:1", "solana:mainnet"],
6448
6714
  rpcUrls,
6449
6715
  promptPin,
6450
- requireAssertionPerSignature
6716
+ requireAssertionPerSignature,
6717
+ offerRecoveryAtSignup,
6718
+ onRecoveryShareOffer,
6719
+ onRecoveryFileReady,
6720
+ promptForRecoveryFile,
6721
+ onRecoveryRotated,
6722
+ onRecoveryProgress
6451
6723
  }).then((sdk) => {
6452
6724
  socialRef.current = sdk;
6453
6725
  sdk.on(
@@ -6538,6 +6810,23 @@ function DecaneKit({ config, children }) {
6538
6810
  throw e;
6539
6811
  }
6540
6812
  }, [clearPhase]);
6813
+ const connectWithPhone = (0, import_react5.useCallback)(async (phone) => {
6814
+ const sdk = socialRef.current;
6815
+ if (!sdk) throw new Error("Social sign-in not configured");
6816
+ return sdk.connectWithPhone(phone);
6817
+ }, []);
6818
+ const verifyPhoneCode2 = (0, import_react5.useCallback)(async (phone, code) => {
6819
+ const sdk = socialRef.current;
6820
+ if (!sdk) throw new Error("Social sign-in not configured");
6821
+ try {
6822
+ const result = await sdk.verifyPhoneCode(phone, code);
6823
+ applyResult(result);
6824
+ setSelectorOpen(false);
6825
+ } catch (e) {
6826
+ clearPhase();
6827
+ throw e;
6828
+ }
6829
+ }, [clearPhase]);
6541
6830
  const connectWithToken = (0, import_react5.useCallback)(async (token, opts) => {
6542
6831
  const sdk = socialRef.current;
6543
6832
  if (!sdk) throw new Error("Social sign-in not configured");
@@ -6690,6 +6979,8 @@ function DecaneKit({ config, children }) {
6690
6979
  connectWithKingsChat,
6691
6980
  connectWithEmail,
6692
6981
  verifyEmailCode: verifyEmailCode2,
6982
+ connectWithPhone,
6983
+ verifyPhoneCode: verifyPhoneCode2,
6693
6984
  connectWithToken,
6694
6985
  customAuthLabel: customAuthConfig?.label,
6695
6986
  connectWithCustomAuth: customAuthConfig ? connectWithCustomAuth : void 0,
@@ -6733,6 +7024,8 @@ function DecaneKit({ config, children }) {
6733
7024
  onKingsChatSignIn: connectWithKingsChat,
6734
7025
  onEmailStart: connectWithEmail,
6735
7026
  onEmailVerify: verifyEmailCode2,
7027
+ onPhoneStart: connectWithPhone,
7028
+ onPhoneVerify: verifyPhoneCode2,
6736
7029
  canUsePasskey: socialAuth.canUsePasskey,
6737
7030
  passkeyAddress: socialAuth.addresses?.evm ?? socialAuth.addresses?.solana ?? null,
6738
7031
  onPasskeySignIn: signInWithPasskey,
@@ -6755,6 +7048,8 @@ function DecaneKit({ config, children }) {
6755
7048
  onKingsChatSignIn: connectWithKingsChat,
6756
7049
  onEmailStart: connectWithEmail,
6757
7050
  onEmailVerify: verifyEmailCode2,
7051
+ onPhoneStart: connectWithPhone,
7052
+ onPhoneVerify: verifyPhoneCode2,
6758
7053
  authMethods: config?.social?.authMethods ?? ["google", "email"],
6759
7054
  canUsePasskey: socialAuth.canUsePasskey,
6760
7055
  passkeyAddress: socialAuth.addresses?.evm ?? socialAuth.addresses?.solana ?? null,
@@ -6786,6 +7081,8 @@ function useSocialAuth() {
6786
7081
  connectWithGoogle,
6787
7082
  connectWithEmail,
6788
7083
  verifyEmailCode: verifyEmailCode2,
7084
+ connectWithPhone,
7085
+ verifyPhoneCode: verifyPhoneCode2,
6789
7086
  connectWithToken,
6790
7087
  customAuthLabel,
6791
7088
  connectWithCustomAuth,
@@ -6795,6 +7092,7 @@ function useSocialAuth() {
6795
7092
  } = useDecaneContext();
6796
7093
  const [googleLoading, setGoogleLoading] = (0, import_react6.useState)(false);
6797
7094
  const [emailLoading, setEmailLoading] = (0, import_react6.useState)(false);
7095
+ const [phoneLoading, setPhoneLoading] = (0, import_react6.useState)(false);
6798
7096
  const [tokenLoading, setTokenLoading] = (0, import_react6.useState)(false);
6799
7097
  const [customLoading, setCustomLoading] = (0, import_react6.useState)(false);
6800
7098
  const [error, setError] = (0, import_react6.useState)(null);
@@ -6833,6 +7131,31 @@ function useSocialAuth() {
6833
7131
  setEmailLoading(false);
6834
7132
  }
6835
7133
  }, [verifyEmailCode2]);
7134
+ const sendPhoneCode = (0, import_react6.useCallback)(async (phone) => {
7135
+ setPhoneLoading(true);
7136
+ setError(null);
7137
+ try {
7138
+ await connectWithPhone(phone);
7139
+ return { codeRequired: true };
7140
+ } catch (e) {
7141
+ setError(e.message);
7142
+ throw e;
7143
+ } finally {
7144
+ setPhoneLoading(false);
7145
+ }
7146
+ }, [connectWithPhone]);
7147
+ const confirmPhoneCode = (0, import_react6.useCallback)(async (phone, code) => {
7148
+ setPhoneLoading(true);
7149
+ setError(null);
7150
+ try {
7151
+ await verifyPhoneCode2(phone, code);
7152
+ } catch (e) {
7153
+ setError(e.message);
7154
+ throw e;
7155
+ } finally {
7156
+ setPhoneLoading(false);
7157
+ }
7158
+ }, [verifyPhoneCode2]);
6836
7159
  const signInWithToken = (0, import_react6.useCallback)(async (token, opts) => {
6837
7160
  setTokenLoading(true);
6838
7161
  setError(null);
@@ -6903,6 +7226,7 @@ function useSocialAuth() {
6903
7226
  needsReconnect: socialAuth.needsReconnect,
6904
7227
  googleLoading,
6905
7228
  emailLoading,
7229
+ phoneLoading,
6906
7230
  tokenLoading,
6907
7231
  customLoading,
6908
7232
  customAuthLabel,
@@ -6911,6 +7235,8 @@ function useSocialAuth() {
6911
7235
  signInWithGoogle,
6912
7236
  sendEmailCode,
6913
7237
  confirmEmailCode,
7238
+ sendPhoneCode,
7239
+ confirmPhoneCode,
6914
7240
  signInWithToken,
6915
7241
  signInWithCustomAuth: connectWithCustomAuth ? signInWithCustomAuth : void 0,
6916
7242
  signInWithPasskey,