decane-connect-kit 2.20.0 → 2.21.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
@@ -2038,10 +2038,13 @@ function readRedirectOutcome(search) {
2038
2038
  const name = params.get("decane_name");
2039
2039
  const email = params.get("decane_email");
2040
2040
  const picture = params.get("decane_picture");
2041
+ const username = params.get("decane_username");
2042
+ const providerSubject = params.get("decane_provider_subject");
2041
2043
  const profile = {
2042
2044
  ...name ? { name } : {},
2043
2045
  ...email ? { email } : {},
2044
- ...picture ? { picture } : {}
2046
+ ...picture ? { picture } : {},
2047
+ ...username ? { username } : {}
2045
2048
  };
2046
2049
  return {
2047
2050
  kind: "result",
@@ -2054,7 +2057,8 @@ function readRedirectOutcome(search) {
2054
2057
  // test `result.profile` rather than an object that is always present but
2055
2058
  // sometimes empty. X never sends an email, so this is the normal case
2056
2059
  // there rather than an edge one.
2057
- ...Object.keys(profile).length ? { profile } : {}
2060
+ ...Object.keys(profile).length ? { profile } : {},
2061
+ ...providerSubject ? { providerSubject } : {}
2058
2062
  }
2059
2063
  };
2060
2064
  }
@@ -4450,7 +4454,8 @@ async function createDecaneConnect(config) {
4450
4454
  return {
4451
4455
  addresses,
4452
4456
  isNewUser: result.isNewUser,
4453
- ...result.profile ? { profile: result.profile } : {}
4457
+ ...result.profile ? { profile: result.profile } : {},
4458
+ ...result.providerSubject ? { providerSubject: result.providerSubject } : {}
4454
4459
  };
4455
4460
  }
4456
4461
  const client = {
@@ -7263,6 +7268,7 @@ var DEFAULT_SOCIAL = {
7263
7268
  addresses: null,
7264
7269
  isNewUser: false,
7265
7270
  profile: null,
7271
+ providerSubject: null,
7266
7272
  isUnlocked: false,
7267
7273
  sessionExpiresAt: null,
7268
7274
  needsReconnect: false,
@@ -7398,6 +7404,7 @@ function DecaneKit({ config, children }) {
7398
7404
  addresses: result.addresses,
7399
7405
  isNewUser: result.isNewUser,
7400
7406
  profile: result.profile ?? null,
7407
+ providerSubject: result.providerSubject ?? null,
7401
7408
  isUnlocked: sdk?.isUnlocked() ?? false,
7402
7409
  sessionExpiresAt: sdk?.sessionExpiresAt() ?? null,
7403
7410
  needsReconnect: false,
@@ -7930,6 +7937,9 @@ function useSocialAuth() {
7930
7937
  // user first signed in, so it carries the same name and email a Google
7931
7938
  // sign-in does rather than coming back anonymous.
7932
7939
  profile: socialAuth.profile,
7940
+ // The provider's stable id, where it gives one. Null otherwise. Safe to
7941
+ // match an account on, unlike the handle in `profile.username`.
7942
+ providerSubject: socialAuth.providerSubject,
7933
7943
  // Long-running work in progress, for driving your own status UI.
7934
7944
  phase: socialAuth.phase,
7935
7945
  isCreatingWallet: socialAuth.phase === "creating",