@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.
package/dist/index.js
CHANGED
|
@@ -13132,7 +13132,10 @@ const appendWhatsAppResumeParams = (url, token) => {
|
|
|
13132
13132
|
else {
|
|
13133
13133
|
nextUrl.searchParams.delete('token');
|
|
13134
13134
|
}
|
|
13135
|
-
|
|
13135
|
+
const serializedUrl = nextUrl.toString();
|
|
13136
|
+
return token === '{{token}}'
|
|
13137
|
+
? serializedUrl.replace(encodeURIComponent(token), token)
|
|
13138
|
+
: serializedUrl;
|
|
13136
13139
|
}
|
|
13137
13140
|
catch {
|
|
13138
13141
|
return url;
|
|
@@ -13202,7 +13205,7 @@ const interpolateReply = (input, vars) => {
|
|
|
13202
13205
|
.replace(/\{\{\s*phoneNumber\s*\}\}/gi, vars.phoneNumber?.trim() || '')
|
|
13203
13206
|
.replace(/\{\{\s*returnUrl\s*\}\}/gi, vars.returnUrl?.trim() || '')
|
|
13204
13207
|
.replace(/\{\{\s*clientId\s*\}\}/gi, vars.clientId?.trim() || '')
|
|
13205
|
-
.replace(/\{\{\s*token\s*\}\}/gi, vars.token
|
|
13208
|
+
.replace(/\{\{\s*token\s*\}\}/gi, vars.token === undefined ? '{{token}}' : vars.token.trim());
|
|
13206
13209
|
};
|
|
13207
13210
|
const buildWhatsAppReply = (cfg, vars) => {
|
|
13208
13211
|
if (!cfg)
|
|
@@ -14751,10 +14754,11 @@ const SmartlinksAuthUI = ({ apiEndpoint, clientId, clientName, accountData, onAu
|
|
|
14751
14754
|
// Resolve reply config: per-call prop wins, otherwise fall back to AuthKit default.
|
|
14752
14755
|
const replyConfig = whatsappReply ?? config?.whatsappReply;
|
|
14753
14756
|
const effectiveRedirectUrl = getRedirectUrl();
|
|
14757
|
+
const resumableRedirectUrl = appendWhatsAppResumeParams(effectiveRedirectUrl, '{{token}}');
|
|
14754
14758
|
const reply = buildWhatsAppReply(replyConfig, {
|
|
14755
14759
|
name: displayName,
|
|
14756
14760
|
clientName,
|
|
14757
|
-
returnUrl:
|
|
14761
|
+
returnUrl: resumableRedirectUrl,
|
|
14758
14762
|
clientId,
|
|
14759
14763
|
});
|
|
14760
14764
|
// Resolve outbound prefill message: per-call prop wins, then AuthKit default.
|
|
@@ -14764,7 +14768,7 @@ const SmartlinksAuthUI = ({ apiEndpoint, clientId, clientName, accountData, onAu
|
|
|
14764
14768
|
// formed session.user — no follow-up updateProfile call needed.
|
|
14765
14769
|
const trimmedName = displayName?.trim() || undefined;
|
|
14766
14770
|
const contactData = trimmedName ? { name: trimmedName } : undefined;
|
|
14767
|
-
const result = await api.sendWhatsApp(
|
|
14771
|
+
const result = await api.sendWhatsApp(resumableRedirectUrl, undefined, reply, prefillMessage, contactData);
|
|
14768
14772
|
whatsappSendRef.current = {
|
|
14769
14773
|
token: result.token,
|
|
14770
14774
|
sessionKey: result.sessionKey,
|