@proveanything/smartlinks-auth-ui 0.4.11 → 0.4.12

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,KAAuC,MAAM,OAAO,CAAC;AAY5D,OAAO,KAAK,EAAE,qBAAqB,EAAyF,MAAM,UAAU,CAAC;AA4N7I,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,CAk5D5D,CAAC"}
1
+ {"version":3,"file":"SmartlinksAuthUI.d.ts","sourceRoot":"","sources":["../../src/components/SmartlinksAuthUI.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAuC,MAAM,OAAO,CAAC;AAY5D,OAAO,KAAK,EAAE,qBAAqB,EAAyF,MAAM,UAAU,CAAC;AA0O7I,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,CAk5D5D,CAAC"}
package/dist/index.esm.js CHANGED
@@ -12597,6 +12597,18 @@ const useAuth = () => {
12597
12597
  // VERSION: Update this when making changes to help identify which version is running
12598
12598
  const AUTH_UI_VERSION = '46';
12599
12599
  const LOG_PREFIX = `[SmartlinksAuthUI:v${AUTH_UI_VERSION}]`;
12600
+ // Normalize malformed query strings where a second '?' is used instead of '&'.
12601
+ // Some host platforms append "?mode=...&token=..." to a URL that already has a "?pageId=...",
12602
+ // resulting in "?pageId=xxx?mode=resetPassword&token=yyy". Convert any extra '?' to '&'
12603
+ // so URLSearchParams can parse mode/token correctly.
12604
+ const normalizeQueryString = (query) => {
12605
+ // Strip a single leading '?' if present, then replace any remaining '?' with '&'
12606
+ const withoutLead = query.startsWith('?') ? query.slice(1) : query;
12607
+ return withoutLead.replace(/\?/g, '&');
12608
+ };
12609
+ const buildSearchParams = (rawQuery) => {
12610
+ return new URLSearchParams(normalizeQueryString(rawQuery));
12611
+ };
12600
12612
  // Helper to check for URL auth params synchronously (runs during initialization)
12601
12613
  // This prevents the form from flashing before detecting deep-link flows
12602
12614
  const getInitialUrlAuthParams = () => {
@@ -12604,8 +12616,8 @@ const getInitialUrlAuthParams = () => {
12604
12616
  const hash = window.location.hash;
12605
12617
  const hashQueryIndex = hash.indexOf('?');
12606
12618
  const params = hashQueryIndex !== -1
12607
- ? new URLSearchParams(hash.substring(hashQueryIndex + 1))
12608
- : new URLSearchParams(window.location.search);
12619
+ ? buildSearchParams(hash.substring(hashQueryIndex + 1))
12620
+ : buildSearchParams(window.location.search);
12609
12621
  return {
12610
12622
  mode: params.get('mode'),
12611
12623
  token: params.get('token'),
@@ -13081,10 +13093,10 @@ const SmartlinksAuthUI = ({ apiEndpoint, clientId, clientName, accountData, onAu
13081
13093
  if (hashQueryIndex !== -1) {
13082
13094
  // Extract query string from hash (e.g., #/test?mode=verifyEmail&token=abc)
13083
13095
  const hashQuery = hash.substring(hashQueryIndex + 1);
13084
- return new URLSearchParams(hashQuery);
13096
+ return buildSearchParams(hashQuery);
13085
13097
  }
13086
13098
  // Fall back to regular search params (for non-hash routing)
13087
- return new URLSearchParams(window.location.search);
13099
+ return buildSearchParams(window.location.search);
13088
13100
  };
13089
13101
  const params = getUrlParams();
13090
13102
  const urlMode = params.get('mode');