@proveanything/smartlinks-auth-ui 0.5.14 → 0.5.15
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;
|
|
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;AAgT7I,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,CA8qE5D,CAAC"}
|
package/dist/index.esm.js
CHANGED
|
@@ -13112,7 +13112,10 @@ const appendWhatsAppResumeParams = (url, token) => {
|
|
|
13112
13112
|
else {
|
|
13113
13113
|
nextUrl.searchParams.delete('token');
|
|
13114
13114
|
}
|
|
13115
|
-
|
|
13115
|
+
const serializedUrl = nextUrl.toString();
|
|
13116
|
+
return token === '{{token}}'
|
|
13117
|
+
? serializedUrl.replace(encodeURIComponent(token), token)
|
|
13118
|
+
: serializedUrl;
|
|
13116
13119
|
}
|
|
13117
13120
|
catch {
|
|
13118
13121
|
return url;
|
|
@@ -13182,7 +13185,7 @@ const interpolateReply = (input, vars) => {
|
|
|
13182
13185
|
.replace(/\{\{\s*phoneNumber\s*\}\}/gi, vars.phoneNumber?.trim() || '')
|
|
13183
13186
|
.replace(/\{\{\s*returnUrl\s*\}\}/gi, vars.returnUrl?.trim() || '')
|
|
13184
13187
|
.replace(/\{\{\s*clientId\s*\}\}/gi, vars.clientId?.trim() || '')
|
|
13185
|
-
.replace(/\{\{\s*token\s*\}\}/gi, vars.token
|
|
13188
|
+
.replace(/\{\{\s*token\s*\}\}/gi, vars.token === undefined ? '{{token}}' : vars.token.trim());
|
|
13186
13189
|
};
|
|
13187
13190
|
const buildWhatsAppReply = (cfg, vars) => {
|
|
13188
13191
|
if (!cfg)
|
|
@@ -14731,10 +14734,11 @@ const SmartlinksAuthUI = ({ apiEndpoint, clientId, clientName, accountData, onAu
|
|
|
14731
14734
|
// Resolve reply config: per-call prop wins, otherwise fall back to AuthKit default.
|
|
14732
14735
|
const replyConfig = whatsappReply ?? config?.whatsappReply;
|
|
14733
14736
|
const effectiveRedirectUrl = getRedirectUrl();
|
|
14737
|
+
const resumableRedirectUrl = appendWhatsAppResumeParams(effectiveRedirectUrl, '{{token}}');
|
|
14734
14738
|
const reply = buildWhatsAppReply(replyConfig, {
|
|
14735
14739
|
name: displayName,
|
|
14736
14740
|
clientName,
|
|
14737
|
-
returnUrl:
|
|
14741
|
+
returnUrl: resumableRedirectUrl,
|
|
14738
14742
|
clientId,
|
|
14739
14743
|
});
|
|
14740
14744
|
// Resolve outbound prefill message: per-call prop wins, then AuthKit default.
|
|
@@ -14744,7 +14748,7 @@ const SmartlinksAuthUI = ({ apiEndpoint, clientId, clientName, accountData, onAu
|
|
|
14744
14748
|
// formed session.user — no follow-up updateProfile call needed.
|
|
14745
14749
|
const trimmedName = displayName?.trim() || undefined;
|
|
14746
14750
|
const contactData = trimmedName ? { name: trimmedName } : undefined;
|
|
14747
|
-
const result = await api.sendWhatsApp(
|
|
14751
|
+
const result = await api.sendWhatsApp(resumableRedirectUrl, undefined, reply, prefillMessage, contactData);
|
|
14748
14752
|
whatsappSendRef.current = {
|
|
14749
14753
|
token: result.token,
|
|
14750
14754
|
sessionKey: result.sessionKey,
|