decane-connect-kit 2.7.6 → 2.8.1

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,
@@ -6553,6 +6810,23 @@ function DecaneKit({ config, children }) {
6553
6810
  throw e;
6554
6811
  }
6555
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]);
6556
6830
  const connectWithToken = (0, import_react5.useCallback)(async (token, opts) => {
6557
6831
  const sdk = socialRef.current;
6558
6832
  if (!sdk) throw new Error("Social sign-in not configured");
@@ -6705,6 +6979,8 @@ function DecaneKit({ config, children }) {
6705
6979
  connectWithKingsChat,
6706
6980
  connectWithEmail,
6707
6981
  verifyEmailCode: verifyEmailCode2,
6982
+ connectWithPhone,
6983
+ verifyPhoneCode: verifyPhoneCode2,
6708
6984
  connectWithToken,
6709
6985
  customAuthLabel: customAuthConfig?.label,
6710
6986
  connectWithCustomAuth: customAuthConfig ? connectWithCustomAuth : void 0,
@@ -6748,6 +7024,8 @@ function DecaneKit({ config, children }) {
6748
7024
  onKingsChatSignIn: connectWithKingsChat,
6749
7025
  onEmailStart: connectWithEmail,
6750
7026
  onEmailVerify: verifyEmailCode2,
7027
+ onPhoneStart: connectWithPhone,
7028
+ onPhoneVerify: verifyPhoneCode2,
6751
7029
  canUsePasskey: socialAuth.canUsePasskey,
6752
7030
  passkeyAddress: socialAuth.addresses?.evm ?? socialAuth.addresses?.solana ?? null,
6753
7031
  onPasskeySignIn: signInWithPasskey,
@@ -6770,6 +7048,8 @@ function DecaneKit({ config, children }) {
6770
7048
  onKingsChatSignIn: connectWithKingsChat,
6771
7049
  onEmailStart: connectWithEmail,
6772
7050
  onEmailVerify: verifyEmailCode2,
7051
+ onPhoneStart: connectWithPhone,
7052
+ onPhoneVerify: verifyPhoneCode2,
6773
7053
  authMethods: config?.social?.authMethods ?? ["google", "email"],
6774
7054
  canUsePasskey: socialAuth.canUsePasskey,
6775
7055
  passkeyAddress: socialAuth.addresses?.evm ?? socialAuth.addresses?.solana ?? null,
@@ -6799,8 +7079,11 @@ function useSocialAuth() {
6799
7079
  const {
6800
7080
  socialAuth,
6801
7081
  connectWithGoogle,
7082
+ connectWithKingsChat,
6802
7083
  connectWithEmail,
6803
7084
  verifyEmailCode: verifyEmailCode2,
7085
+ connectWithPhone,
7086
+ verifyPhoneCode: verifyPhoneCode2,
6804
7087
  connectWithToken,
6805
7088
  customAuthLabel,
6806
7089
  connectWithCustomAuth,
@@ -6809,7 +7092,9 @@ function useSocialAuth() {
6809
7092
  socialDisconnect
6810
7093
  } = useDecaneContext();
6811
7094
  const [googleLoading, setGoogleLoading] = (0, import_react6.useState)(false);
7095
+ const [kingschatLoading, setKingschatLoading] = (0, import_react6.useState)(false);
6812
7096
  const [emailLoading, setEmailLoading] = (0, import_react6.useState)(false);
7097
+ const [phoneLoading, setPhoneLoading] = (0, import_react6.useState)(false);
6813
7098
  const [tokenLoading, setTokenLoading] = (0, import_react6.useState)(false);
6814
7099
  const [customLoading, setCustomLoading] = (0, import_react6.useState)(false);
6815
7100
  const [error, setError] = (0, import_react6.useState)(null);
@@ -6823,6 +7108,18 @@ function useSocialAuth() {
6823
7108
  setGoogleLoading(false);
6824
7109
  }
6825
7110
  }, [connectWithGoogle]);
7111
+ const signInWithKingsChat = (0, import_react6.useCallback)(async () => {
7112
+ setKingschatLoading(true);
7113
+ setError(null);
7114
+ try {
7115
+ await connectWithKingsChat();
7116
+ } catch (e) {
7117
+ setError(e.message);
7118
+ throw e;
7119
+ } finally {
7120
+ setKingschatLoading(false);
7121
+ }
7122
+ }, [connectWithKingsChat]);
6826
7123
  const sendEmailCode = (0, import_react6.useCallback)(async (email) => {
6827
7124
  setEmailLoading(true);
6828
7125
  setError(null);
@@ -6848,6 +7145,31 @@ function useSocialAuth() {
6848
7145
  setEmailLoading(false);
6849
7146
  }
6850
7147
  }, [verifyEmailCode2]);
7148
+ const sendPhoneCode = (0, import_react6.useCallback)(async (phone) => {
7149
+ setPhoneLoading(true);
7150
+ setError(null);
7151
+ try {
7152
+ await connectWithPhone(phone);
7153
+ return { codeRequired: true };
7154
+ } catch (e) {
7155
+ setError(e.message);
7156
+ throw e;
7157
+ } finally {
7158
+ setPhoneLoading(false);
7159
+ }
7160
+ }, [connectWithPhone]);
7161
+ const confirmPhoneCode = (0, import_react6.useCallback)(async (phone, code) => {
7162
+ setPhoneLoading(true);
7163
+ setError(null);
7164
+ try {
7165
+ await verifyPhoneCode2(phone, code);
7166
+ } catch (e) {
7167
+ setError(e.message);
7168
+ throw e;
7169
+ } finally {
7170
+ setPhoneLoading(false);
7171
+ }
7172
+ }, [verifyPhoneCode2]);
6851
7173
  const signInWithToken = (0, import_react6.useCallback)(async (token, opts) => {
6852
7174
  setTokenLoading(true);
6853
7175
  setError(null);
@@ -6917,15 +7239,20 @@ function useSocialAuth() {
6917
7239
  // this into a real reconnect (signInWithGoogle / sendEmailCode), not unlock().
6918
7240
  needsReconnect: socialAuth.needsReconnect,
6919
7241
  googleLoading,
7242
+ kingschatLoading,
6920
7243
  emailLoading,
7244
+ phoneLoading,
6921
7245
  tokenLoading,
6922
7246
  customLoading,
6923
7247
  customAuthLabel,
6924
7248
  error,
6925
7249
  clearError: () => setError(null),
6926
7250
  signInWithGoogle,
7251
+ signInWithKingsChat,
6927
7252
  sendEmailCode,
6928
7253
  confirmEmailCode,
7254
+ sendPhoneCode,
7255
+ confirmPhoneCode,
6929
7256
  signInWithToken,
6930
7257
  signInWithCustomAuth: connectWithCustomAuth ? signInWithCustomAuth : void 0,
6931
7258
  signInWithPasskey,