@proveanything/smartlinks-auth-ui 0.6.1 → 0.6.2

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.
@@ -1 +1 @@
1
- {"version":3,"file":"SmartlinksAuthUI.d.ts","sourceRoot":"","sources":["../../src/components/SmartlinksAuthUI.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA+C,MAAM,OAAO,CAAC;AAcpE,OAAO,KAAK,EAAE,qBAAqB,EAAyF,MAAM,UAAU,CAAC;AAwW7I,QAAA,MAAM,mBAAmB,QAAa,OAAO,CAAC,IAAI,CAqBjD,CAAC;AAqDF,OAAO,EAAE,mBAAmB,EAAE,CAAC;AAI/B,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,CA63E5D,CAAC"}
1
+ {"version":3,"file":"SmartlinksAuthUI.d.ts","sourceRoot":"","sources":["../../src/components/SmartlinksAuthUI.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA+C,MAAM,OAAO,CAAC;AAcpE,OAAO,KAAK,EAAE,qBAAqB,EAAyF,MAAM,UAAU,CAAC;AAwW7I,QAAA,MAAM,mBAAmB,QAAa,OAAO,CAAC,IAAI,CAqBjD,CAAC;AAqDF,OAAO,EAAE,mBAAmB,EAAE,CAAC;AAI/B,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,CA04E5D,CAAC"}
package/dist/index.esm.js CHANGED
@@ -14123,7 +14123,13 @@ const SmartlinksAuthUI = ({ apiEndpoint, clientId, clientName, accountData, onAu
14123
14123
  if (urlMode === 'verifyEmail') {
14124
14124
  log.log('Verifying email with token:', token);
14125
14125
  const response = await api.verifyEmailWithToken(token);
14126
- log.log('Email verification response:', { hasToken: !!response.token, hasUser: !!response.user, emailVerificationMode: response.emailVerificationMode, isNewUser: response.isNewUser });
14126
+ log.log('Email verification response:', { hasToken: !!response?.token, hasUser: !!response?.user, emailVerificationMode: response?.emailVerificationMode, isNewUser: response?.isNewUser });
14127
+ // Detect resolved-error shapes (proxy mode serializes errors instead of throwing).
14128
+ // Common case: sign-up intent claim / verification token already consumed → route to login.
14129
+ const resolvedErrorMessage = getActionResultErrorMessage(response);
14130
+ if (resolvedErrorMessage || !response) {
14131
+ throw new Error(resolvedErrorMessage || 'This verification link has already been used or has expired.');
14132
+ }
14127
14133
  // Get email verification mode from response or config
14128
14134
  const verificationMode = response.emailVerificationMode || config?.emailVerification?.mode || 'verify-auto-login';
14129
14135
  if ((verificationMode === 'verify-auto-login' || verificationMode === 'immediate') && response.token) {
@@ -14185,7 +14191,12 @@ const SmartlinksAuthUI = ({ apiEndpoint, clientId, clientName, accountData, onAu
14185
14191
  else if (urlMode === 'magicLink') {
14186
14192
  log.log('Verifying magic link token:', token);
14187
14193
  const response = await api.verifyMagicLink(token);
14188
- log.log('Magic link verification response:', { hasToken: !!response.token, hasUser: !!response.user, isNewUser: response.isNewUser });
14194
+ log.log('Magic link verification response:', { hasToken: !!response?.token, hasUser: !!response?.user, isNewUser: response?.isNewUser });
14195
+ // Detect resolved-error shapes (proxy mode serializes errors instead of throwing).
14196
+ const resolvedMagicError = getActionResultErrorMessage(response);
14197
+ if (resolvedMagicError || !response) {
14198
+ throw new Error(resolvedMagicError || 'This magic link has already been used or has expired.');
14199
+ }
14189
14200
  // Auto-login with magic link if token is provided
14190
14201
  if (response.token) {
14191
14202
  // Always await - auth.login now waits for parent ack automatically in iframe mode