@proveanything/smartlinks-auth-ui 0.5.17 → 0.5.19

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;AA2V7I,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,CAutE5D,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;AA2V7I,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,CAouE5D,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"WhatsAppAuthForm.d.ts","sourceRoot":"","sources":["../../src/components/WhatsAppAuthForm.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAC3D,OAAO,gBAAgB,CAAC;AAExB,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAA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,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,SAAS,GAAG,UAAU,GAAG,QAAQ,GAAG,SAAS,GAAG,SAAS,CAAC;IAClE,QAAQ,EAAE,OAAO,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B;AAED,UAAU,qBAAqB;IAC7B,kGAAkG;IAClG,MAAM,EAAE,CAAC,WAAW,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,kBAAkB,CAAC,CAAC;IAC9D,qDAAqD;IACrD,YAAY,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,oBAAoB,CAAC,CAAC;IAC/D,oGAAoG;IACpG,UAAU,EAAE,CAAC,MAAM,EAAE,oBAAoB,KAAK,IAAI,GAAG,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC,CAAC;IAC7E,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,iEAAiE;IACjE,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,6CAA6C;IAC7C,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,iFAAiF;IACjF,WAAW,CAAC,EAAE,kBAAkB,GAAG,IAAI,CAAC;CACzC;AAOD,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,CAiW5D,CAAC"}
package/dist/index.esm.js CHANGED
@@ -11029,11 +11029,12 @@ const WhatsAppAuthForm = ({ onSend, onPollStatus, onVerified, onBack, loading =
11029
11029
  const displayedError = pollError || error;
11030
11030
  const awaitingNameInput = collectName && !sent;
11031
11031
  const awaitingAutoSend = !collectName && !sent;
11032
+ const hasLaunchLink = !!sent?.waLink;
11032
11033
  return (jsxs("form", { className: "auth-form", onSubmit: awaitingNameInput ? handleNameSubmit : (e) => e.preventDefault(), children: [jsxs("div", { className: "auth-form-header", children: [jsx("h2", { className: "auth-form-title", children: "Continue with WhatsApp" }), jsx("p", { className: "auth-form-subtitle", children: sent
11033
11034
  ? "Tap below to open WhatsApp and send us the pre-filled message — that's how we confirm your number. We'll log you in the moment we receive it."
11034
11035
  : awaitingNameInput
11035
11036
  ? "We'll open WhatsApp with a pre-filled message. Just hit send to confirm your number — no SMS code, no typing."
11036
- : 'Preparing your WhatsApp link…' })] }), displayedError && (jsxs("div", { className: "auth-error", role: "alert", children: [jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "currentColor", "aria-hidden": "true", children: jsx("path", { d: "M8 0C3.58 0 0 3.58 0 8s3.58 8 8 8 8-3.58 8-8-3.58-8-8-8zm1 13H7v-2h2v2zm0-3H7V4h2v6z" }) }), displayedError] })), awaitingNameInput && (jsxs(Fragment, { children: [jsxs("div", { className: "auth-form-group", children: [jsx("label", { htmlFor: "waName", className: "auth-label", children: "Name" }), jsx("input", { id: "waName", type: "text", value: displayName, onChange: (e) => setDisplayName(e.target.value), className: "auth-input", placeholder: "John Smith", disabled: loading, autoComplete: "name", autoFocus: true })] }), jsx("button", { type: "submit", className: "auth-button auth-button-primary", disabled: loading, children: loading ? jsx("span", { className: "auth-spinner" }) : 'Continue' })] })), awaitingAutoSend && (jsx("div", { style: { textAlign: 'center', padding: '1.5rem' }, children: jsx("span", { className: "auth-spinner" }) })), sent && (jsxs(Fragment, { children: [!showOnDesktop && (jsxs("a", { href: sent.waLink, target: "_blank", rel: "noopener noreferrer", className: "auth-button auth-button-primary", style: {
11037
+ : 'Preparing your WhatsApp link…' })] }), displayedError && (jsxs("div", { className: "auth-error", role: "alert", children: [jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "currentColor", "aria-hidden": "true", children: jsx("path", { d: "M8 0C3.58 0 0 3.58 0 8s3.58 8 8 8 8-3.58 8-8-3.58-8-8-8zm1 13H7v-2h2v2zm0-3H7V4h2v6z" }) }), displayedError] })), awaitingNameInput && (jsxs(Fragment, { children: [jsxs("div", { className: "auth-form-group", children: [jsx("label", { htmlFor: "waName", className: "auth-label", children: "Name" }), jsx("input", { id: "waName", type: "text", value: displayName, onChange: (e) => setDisplayName(e.target.value), className: "auth-input", placeholder: "John Smith", disabled: loading, autoComplete: "name", autoFocus: true })] }), jsx("button", { type: "submit", className: "auth-button auth-button-primary", disabled: loading, children: loading ? jsx("span", { className: "auth-spinner" }) : 'Continue' })] })), awaitingAutoSend && (jsx("div", { style: { textAlign: 'center', padding: '1.5rem' }, children: jsx("span", { className: "auth-spinner" }) })), sent && (jsxs(Fragment, { children: [!showOnDesktop && hasLaunchLink && (jsxs("a", { href: sent.waLink, target: "_blank", rel: "noopener noreferrer", className: "auth-button auth-button-primary", style: {
11037
11038
  display: 'flex',
11038
11039
  alignItems: 'center',
11039
11040
  justifyContent: 'center',
@@ -11051,7 +11052,7 @@ const WhatsAppAuthForm = ({ onSend, onPollStatus, onVerified, onBack, loading =
11051
11052
  fontSize: '0.8125rem',
11052
11053
  color: '#6B7280',
11053
11054
  marginTop: '0.5rem',
11054
- }, children: "Scan with your phone \u2014 your WhatsApp will open with a pre-filled message. Just hit send." })] })), showOnDesktop && (jsx("a", { href: sent.waLink, target: "_blank", rel: "noopener noreferrer", className: "auth-button auth-button-secondary", style: { display: 'block', textAlign: 'center', textDecoration: 'none' }, children: "Or send the message from this device" })), jsxs("div", { style: {
11055
+ }, children: "Scan with your phone \u2014 your WhatsApp will open with a pre-filled message. Just hit send." })] })), showOnDesktop && hasLaunchLink && (jsx("a", { href: sent.waLink, target: "_blank", rel: "noopener noreferrer", className: "auth-button auth-button-secondary", style: { display: 'block', textAlign: 'center', textDecoration: 'none' }, children: "Or send the message from this device" })), jsxs("div", { style: {
11055
11056
  marginTop: '1rem',
11056
11057
  padding: '0.75rem',
11057
11058
  borderRadius: '0.5rem',
@@ -11060,7 +11061,12 @@ const WhatsAppAuthForm = ({ onSend, onPollStatus, onVerified, onBack, loading =
11060
11061
  fontSize: '0.8125rem',
11061
11062
  color: '#374151',
11062
11063
  textAlign: 'center',
11063
- }, children: [jsx("span", { className: "auth-spinner", style: { marginRight: '0.5rem' } }), "Waiting for your message \u2014 we'll log you in automatically\u2026", jsxs("div", { style: { marginTop: '0.25rem', fontSize: '0.75rem', opacity: 0.7 }, children: ["Code: ", jsx("code", { children: sent.code })] })] }), jsx("button", { type: "button", className: "auth-link", onClick: handleSendNew, disabled: loading, style: {
11064
+ }, children: [jsx("span", { className: "auth-spinner", style: { marginRight: '0.5rem' } }), "Waiting for your message \u2014 we'll log you in automatically\u2026", jsxs("div", { style: { marginTop: '0.25rem', fontSize: '0.75rem', opacity: 0.7 }, children: ["Code: ", jsx("code", { children: sent.code })] })] }), !hasLaunchLink && (jsx("div", { style: {
11065
+ marginTop: '0.75rem',
11066
+ fontSize: '0.8125rem',
11067
+ color: '#6B7280',
11068
+ textAlign: 'center',
11069
+ }, children: "Resume link detected \u2014 checking your WhatsApp verification status\u2026" })), jsx("button", { type: "button", className: "auth-link", onClick: handleSendNew, disabled: loading, style: {
11064
11070
  marginTop: '0.75rem',
11065
11071
  background: 'none',
11066
11072
  border: 'none',
@@ -14736,7 +14742,20 @@ const SmartlinksAuthUI = ({ apiEndpoint, clientId, clientName, accountData, onAu
14736
14742
  const pending = await loadPendingWhatsAppSession();
14737
14743
  if (!pending || cancelled) {
14738
14744
  if (resumeMode === 'whatsapp') {
14739
- syncWhatsAppResumeUrl(null);
14745
+ // A WhatsApp resume link can legitimately be opened in a fresh tab,
14746
+ // another browser, or after storage has been cleared. In that case
14747
+ // we still need to surface the WhatsApp resume UI so polling/status
14748
+ // handling can continue instead of silently stripping the URL and
14749
+ // dumping the user back at the generic login screen.
14750
+ setMode('whatsapp');
14751
+ setRestoredWhatsAppSend(resumeToken
14752
+ ? {
14753
+ waLink: '',
14754
+ code: '',
14755
+ token: resumeToken,
14756
+ expiresAt: '',
14757
+ }
14758
+ : null);
14740
14759
  }
14741
14760
  return;
14742
14761
  }