@proveanything/smartlinks-auth-ui 0.5.2 → 0.5.5

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/api.d.ts CHANGED
@@ -74,11 +74,15 @@ export declare class AuthAPI {
74
74
  buttonLabel: string;
75
75
  buttonUrl: string;
76
76
  };
77
- }): Promise<{
77
+ }, prefillMessage?: string): Promise<{
78
78
  waLink: string;
79
79
  code: string;
80
80
  token: string;
81
81
  expiresAt: string;
82
+ sessionKey?: string;
83
+ }>;
84
+ exchangeWhatsAppSession(token: string, sessionKey: string): Promise<AuthResponse & {
85
+ success: boolean;
82
86
  }>;
83
87
  getWhatsAppStatus(token: string): Promise<{
84
88
  ok: boolean;
package/dist/api.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAIpF;;;GAGG;AACH,qBAAa,OAAO;IAClB,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,UAAU,CAAC,CAAS;IAC5B,OAAO,CAAC,GAAG,CAAyC;gBAExC,YAAY,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,UAAU;IAQxF,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC;IAI7D,QAAQ,CAAC,IAAI,EAAE,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC;IAWnD,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAC7C,cAAc,CAAC,EAAE;YAAE,KAAK,EAAE,MAAM,CAAC;YAAC,IAAI,CAAC,EAAE,MAAM,CAAC;YAAC,G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IAIxG,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC;QAC9C,EAAE,EAAE,OAAO,CAAC;QACZ,MAAM,EAAE,SAAS,GAAG,UAAU,GAAG,QAAQ,GAAG,SAAS,GAAG,SAAS,CAAC;QAClE,QAAQ,EAAE,OAAO,CAAC;QAClB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QAC5B,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;KAC7B,CAAC;IAII,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC;QAChE,OAAO,EAAE,OAAO,CAAC;QACjB,QAAQ,EAAE,OAAO,CAAC;QAClB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;KAC7B,CAAC;CAGH"}
@@ -1 +1 @@
1
- {"version":3,"file":"AuthUIPreview.d.ts","sourceRoot":"","sources":["../../src/components/AuthUIPreview.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAE3D,UAAU,kBAAkB;IAC1B,aAAa,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;IACtC,gBAAgB,CAAC,EAAE,YAAY,EAAE,CAAC;IAClC,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,gBAAgB,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAC;IACrC,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAqKtD,CAAC"}
1
+ {"version":3,"file":"AuthUIPreview.d.ts","sourceRoot":"","sources":["../../src/components/AuthUIPreview.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAE3D,UAAU,kBAAkB;IAC1B,aAAa,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;IACtC,gBAAgB,CAAC,EAAE,YAAY,EAAE,CAAC;IAClC,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,gBAAgB,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAC;IACrC,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CA8KtD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"ProviderButtons.d.ts","sourceRoot":"","sources":["../../src/components/ProviderButtons.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,gBAAgB,CAAC;AAExB,UAAU,oBAAoB;IAC5B,gBAAgB,EAAE,YAAY,EAAE,CAAC;IACjC,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,aAAa,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACnC,YAAY,EAAE,MAAM,IAAI,CAAC;IACzB,gBAAgB,CAAC,EAAE,MAAM,IAAI,CAAC;IAC9B,eAAe,CAAC,EAAE,MAAM,IAAI,CAAC;IAC7B,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CAgI1D,CAAC"}
1
+ {"version":3,"file":"ProviderButtons.d.ts","sourceRoot":"","sources":["../../src/components/ProviderButtons.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,gBAAgB,CAAC;AAExB,UAAU,oBAAoB;IAC5B,gBAAgB,EAAE,YAAY,EAAE,CAAC;IACjC,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,aAAa,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACnC,YAAY,EAAE,MAAM,IAAI,CAAC;IACzB,gBAAgB,CAAC,EAAE,MAAM,IAAI,CAAC;IAC9B,eAAe,CAAC,EAAE,MAAM,IAAI,CAAC;IAC7B,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CAqI1D,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"SmartlinksAuthUI.d.ts","sourceRoot":"","sources":["../../src/components/SmartlinksAuthUI.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAuC,MAAM,OAAO,CAAC;AAa5D,OAAO,KAAK,EAAE,qBAAqB,EAAyF,MAAM,UAAU,CAAC;AAqQ7I,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,CAs8D5D,CAAC"}
1
+ {"version":3,"file":"SmartlinksAuthUI.d.ts","sourceRoot":"","sources":["../../src/components/SmartlinksAuthUI.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA+C,MAAM,OAAO,CAAC;AAapE,OAAO,KAAK,EAAE,qBAAqB,EAAyF,MAAM,UAAU,CAAC;AAqQ7I,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,CAq+D5D,CAAC"}
@@ -5,6 +5,7 @@ export interface WhatsAppSendResult {
5
5
  code: string;
6
6
  token: string;
7
7
  expiresAt: string;
8
+ sessionKey?: string;
8
9
  }
9
10
  export interface WhatsAppStatusResult {
10
11
  status: 'pending' | 'verified' | 'failed' | 'expired' | 'unknown';
@@ -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;CACnB;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,qEAAqE;IACrE,UAAU,EAAE,CAAC,MAAM,EAAE,oBAAoB,KAAK,IAAI,CAAC;IACnD,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,iEAA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eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,CAqS5D,CAAC"}
package/dist/index.esm.js CHANGED
@@ -321,9 +321,13 @@ const ProviderButtons = ({ enabledProviders, providerOrder, onEmailLogin, onGoog
321
321
  if (enabledProviders.length === 0)
322
322
  return null;
323
323
  // Determine the order of providers to display
324
- const orderedProviders = providerOrder && providerOrder.length > 0
325
- ? providerOrder.filter(p => enabledProviders.includes(p))
326
- : enabledProviders;
324
+ const orderedProviders = (() => {
325
+ if (!providerOrder || providerOrder.length === 0)
326
+ return enabledProviders;
327
+ const configured = providerOrder.filter((p) => enabledProviders.includes(p));
328
+ const missing = enabledProviders.filter((p) => !configured.includes(p));
329
+ return [...configured, ...missing];
330
+ })();
327
331
  // Provider button configurations
328
332
  const providerConfigs = {
329
333
  email: {
@@ -10982,9 +10986,9 @@ const WhatsAppAuthForm = ({ onSend, onPollStatus, onVerified, onBack, loading =
10982
10986
  const awaitingNameInput = collectName && !sent;
10983
10987
  const awaitingAutoSend = !collectName && !sent;
10984
10988
  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
10985
- ? 'Send the pre-filled WhatsApp message to verify yourself. We\'ll log you in automatically.'
10989
+ ? "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."
10986
10990
  : awaitingNameInput
10987
- ? 'Tell us your name, then send us a WhatsApp message — no phone number needed.'
10991
+ ? "We'll open WhatsApp with a pre-filled message. Just hit send to confirm your number — no SMS code, no typing."
10988
10992
  : '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: {
10989
10993
  display: 'flex',
10990
10994
  alignItems: 'center',
@@ -10993,7 +10997,7 @@ const WhatsAppAuthForm = ({ onSend, onPollStatus, onVerified, onBack, loading =
10993
10997
  background: '#25D366',
10994
10998
  color: '#fff',
10995
10999
  textDecoration: 'none',
10996
- }, children: [jsx("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "currentColor", "aria-hidden": "true", children: jsx("path", { d: "M17.472 14.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.148-.67.15-.197.297-.767.966-.94 1.164-.173.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.298-.347.446-.52.149-.174.198-.298.298-.497.099-.198.05-.371-.025-.52-.075-.149-.669-1.612-.916-2.207-.242-.579-.487-.5-.669-.51-.173-.008-.371-.01-.57-.01-.198 0-.52.074-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.875 1.213 3.074.149.198 2.096 3.2 5.077 4.487.709.306 1.262.489 1.694.625.712.227 1.36.195 1.871.118.571-.085 1.758-.719 2.006-1.413.247-.694.247-1.289.173-1.413-.074-.124-.272-.198-.57-.347m-5.421 7.403h-.004a9.87 9.87 0 01-5.031-1.378l-.361-.214-3.741.982.998-3.648-.235-.374a9.86 9.86 0 01-1.51-5.26c.001-5.45 4.436-9.884 9.888-9.884 2.64 0 5.122 1.03 6.988 2.898a9.825 9.825 0 012.893 6.994c-.003 5.45-4.437 9.884-9.885 9.884m8.413-18.297A11.815 11.815 0 0012.05 0C5.495 0 .16 5.335.157 11.892c0 2.096.547 4.142 1.588 5.945L.057 24l6.305-1.654a11.882 11.882 0 005.683 1.448h.005c6.554 0 11.89-5.335 11.893-11.893A11.821 11.821 0 0020.464 3.488" }) }), "Open WhatsApp"] })), showOnDesktop && qrDataUrl && (jsxs("div", { style: { textAlign: 'center', margin: '0.75rem 0' }, children: [jsx("div", { style: {
11000
+ }, children: [jsx("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "currentColor", "aria-hidden": "true", children: jsx("path", { d: "M17.472 14.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.148-.67.15-.197.297-.767.966-.94 1.164-.173.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.298-.347.446-.52.149-.174.198-.298.298-.497.099-.198.05-.371-.025-.52-.075-.149-.669-1.612-.916-2.207-.242-.579-.487-.5-.669-.51-.173-.008-.371-.01-.57-.01-.198 0-.52.074-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.875 1.213 3.074.149.198 2.096 3.2 5.077 4.487.709.306 1.262.489 1.694.625.712.227 1.36.195 1.871.118.571-.085 1.758-.719 2.006-1.413.247-.694.247-1.289.173-1.413-.074-.124-.272-.198-.57-.347m-5.421 7.403h-.004a9.87 9.87 0 01-5.031-1.378l-.361-.214-3.741.982.998-3.648-.235-.374a9.86 9.86 0 01-1.51-5.26c.001-5.45 4.436-9.884 9.888-9.884 2.64 0 5.122 1.03 6.988 2.898a9.825 9.825 0 012.893 6.994c-.003 5.45-4.437 9.884-9.885 9.884m8.413-18.297A11.815 11.815 0 0012.05 0C5.495 0 .16 5.335.157 11.892c0 2.096.547 4.142 1.588 5.945L.057 24l6.305-1.654a11.882 11.882 0 005.683 1.448h.005c6.554 0 11.89-5.335 11.893-11.893A11.821 11.821 0 0020.464 3.488" }) }), "Open WhatsApp & send message"] })), showOnDesktop && qrDataUrl && (jsxs("div", { style: { textAlign: 'center', margin: '0.75rem 0' }, children: [jsx("div", { style: {
10997
11001
  display: 'inline-block',
10998
11002
  padding: '0.75rem',
10999
11003
  background: '#fff',
@@ -11003,7 +11007,7 @@ const WhatsAppAuthForm = ({ onSend, onPollStatus, onVerified, onBack, loading =
11003
11007
  fontSize: '0.8125rem',
11004
11008
  color: '#6B7280',
11005
11009
  marginTop: '0.5rem',
11006
- }, 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 open WhatsApp on this device" })), jsxs("div", { style: {
11010
+ }, 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: {
11007
11011
  marginTop: '1rem',
11008
11012
  padding: '0.75rem',
11009
11013
  borderRadius: '0.5rem',
@@ -11012,7 +11016,7 @@ const WhatsAppAuthForm = ({ onSend, onPollStatus, onVerified, onBack, loading =
11012
11016
  fontSize: '0.8125rem',
11013
11017
  color: '#374151',
11014
11018
  textAlign: 'center',
11015
- }, children: [jsx("span", { className: "auth-spinner", style: { marginRight: '0.5rem' } }), "Waiting for your WhatsApp message\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: {
11019
+ }, 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: {
11016
11020
  marginTop: '0.75rem',
11017
11021
  background: 'none',
11018
11022
  border: 'none',
@@ -11489,15 +11493,20 @@ class AuthAPI {
11489
11493
  return smartlinks.authKit.verifyMagicLink(this.clientId, token);
11490
11494
  }
11491
11495
  // ============= WhatsApp =============
11492
- async sendWhatsApp(redirectUrl, phoneNumber, reply) {
11496
+ async sendWhatsApp(redirectUrl, phoneNumber, reply, prefillMessage) {
11493
11497
  // phoneNumber is optional — backend extracts it from the inbound WhatsApp webhook.
11494
11498
  // `reply`, when provided, is sent back to the user via WhatsApp on successful verification.
11499
+ // `prefillMessage` customizes the message body pre-filled in the wa.me link.
11495
11500
  return smartlinks.authKit.sendWhatsApp(this.clientId, {
11496
11501
  phoneNumber: phoneNumber ?? '',
11497
11502
  redirectUrl,
11498
11503
  ...(reply ? { reply } : {}),
11504
+ ...(prefillMessage ? { prefillMessage } : {}),
11499
11505
  });
11500
11506
  }
11507
+ async exchangeWhatsAppSession(token, sessionKey) {
11508
+ return smartlinks.authKit.exchangeWhatsAppSession(this.clientId, token, sessionKey);
11509
+ }
11501
11510
  async getWhatsAppStatus(token) {
11502
11511
  return smartlinks.authKit.getWhatsAppStatus(this.clientId, token);
11503
11512
  }
@@ -13029,7 +13038,7 @@ const checkSilentGoogleSignIn = async (clientId, googleClientId) => {
13029
13038
  });
13030
13039
  };
13031
13040
  // getFriendlyErrorMessage is now imported from ../utils/errorHandling
13032
- const SmartlinksAuthUI = ({ apiEndpoint, clientId, clientName, accountData, onAuthSuccess, onAuthError, onRedirect, enabledProviders = ['email', 'google', 'phone'], initialMode, signupProminence, redirectUrl, theme = 'light', className, customization, skipConfigFetch = false, minimal = false, logger, proxyMode = false, collectionId, disableConfigCache = false, enableSilentGoogleSignIn = false, whatsappReply, }) => {
13041
+ const SmartlinksAuthUI = ({ apiEndpoint, clientId, clientName, accountData, onAuthSuccess, onAuthError, onRedirect, enabledProviders = ['email', 'google', 'phone'], initialMode, signupProminence, redirectUrl, theme = 'light', className, customization, skipConfigFetch = false, minimal = false, logger, proxyMode = false, collectionId, disableConfigCache = false, enableSilentGoogleSignIn = false, whatsappReply, whatsappPrefillMessage, }) => {
13033
13042
  // Resolve signup prominence from props, customization, config, or default
13034
13043
  const resolvedSignupProminence = signupProminence || customization?.signupProminence || 'minimal';
13035
13044
  // Determine initial mode based on signupProminence setting
@@ -14246,6 +14255,8 @@ const SmartlinksAuthUI = ({ apiEndpoint, clientId, clientName, accountData, onAu
14246
14255
  setLoading(false);
14247
14256
  }
14248
14257
  };
14258
+ // Track the most recent WhatsApp send so we can exchange its sessionKey for a real login session.
14259
+ const whatsappSendRef = useRef(null);
14249
14260
  const handleWhatsAppSend = async (displayName) => {
14250
14261
  setLoading(true);
14251
14262
  setError(undefined);
@@ -14258,7 +14269,10 @@ const SmartlinksAuthUI = ({ apiEndpoint, clientId, clientName, accountData, onAu
14258
14269
  name: displayName,
14259
14270
  clientName,
14260
14271
  });
14261
- const result = await api.sendWhatsApp(getRedirectUrl(), undefined, reply);
14272
+ // Resolve outbound prefill message: per-call prop wins, then AuthKit default.
14273
+ const prefillMessage = whatsappPrefillMessage ?? config?.whatsappPrefillMessage;
14274
+ const result = await api.sendWhatsApp(getRedirectUrl(), undefined, reply, prefillMessage);
14275
+ whatsappSendRef.current = { token: result.token, sessionKey: result.sessionKey };
14262
14276
  return result;
14263
14277
  }
14264
14278
  catch (err) {
@@ -14273,12 +14287,28 @@ const SmartlinksAuthUI = ({ apiEndpoint, clientId, clientName, accountData, onAu
14273
14287
  const handleWhatsAppPoll = async (token) => {
14274
14288
  return api.getWhatsAppStatus(token);
14275
14289
  };
14276
- const handleWhatsAppVerified = (status) => {
14277
- // Backend returns a redirectUrl containing a magic-link-style token that
14278
- // completes the login on landing. Treat the same as magic-link verification.
14290
+ const handleWhatsAppVerified = async (status) => {
14279
14291
  const target = status.redirectUrl || getRedirectUrl();
14280
14292
  setAuthSuccess(true);
14281
14293
  setSuccessMessage('WhatsApp verified! Signing you in…');
14294
+ // Exchange the verified WhatsApp proof for a real Auth Kit session token,
14295
+ // so the user is fully logged in (not just verified) and any same-tab
14296
+ // continuation flows (claim, bid, etc.) pick up an authenticated session.
14297
+ const send = whatsappSendRef.current;
14298
+ if (send?.sessionKey) {
14299
+ try {
14300
+ const session = await api.exchangeWhatsAppSession(send.token, send.sessionKey);
14301
+ if (session?.token && session.user) {
14302
+ await auth.login(session.token, session.user, session.accountData, true, getExpirationFromResponse(session));
14303
+ if (!proxyMode) {
14304
+ onAuthSuccess(session.token, session.user, session.accountData);
14305
+ }
14306
+ }
14307
+ }
14308
+ catch (err) {
14309
+ log.warn('WhatsApp session exchange failed, falling back to redirect-only flow:', err);
14310
+ }
14311
+ }
14282
14312
  performRedirect(target, 'magic-link');
14283
14313
  };
14284
14314
  // Show processing state for URL-based auth (verification, magic link, password reset)
@@ -15623,9 +15653,14 @@ const AuthUIPreview = ({ customization, enabledProviders = ['email', 'google', '
15623
15653
  const showMagicLink = enabledProviders.includes('magic-link');
15624
15654
  const showWhatsApp = enabledProviders.includes('whatsapp');
15625
15655
  // Determine ordered providers (excluding email if in button mode)
15626
- const orderedProviders = providerOrder && providerOrder.length > 0
15627
- ? providerOrder.filter(p => enabledProviders.includes(p) && p !== 'email')
15628
- : enabledProviders.filter(p => p !== 'email');
15656
+ const orderedProviders = (() => {
15657
+ const nonEmailProviders = enabledProviders.filter((p) => p !== 'email');
15658
+ if (!providerOrder || providerOrder.length === 0)
15659
+ return nonEmailProviders;
15660
+ const configured = providerOrder.filter((p) => enabledProviders.includes(p) && p !== 'email');
15661
+ const missing = nonEmailProviders.filter((p) => !configured.includes(p));
15662
+ return [...configured, ...missing];
15663
+ })();
15629
15664
  const hasOtherProviders = showGoogle || showPhone || showMagicLink || showWhatsApp;
15630
15665
  // Render provider button helper
15631
15666
  const renderProviderButton = (provider) => {