update(chat): update ui chat
This commit is contained in:
parent
6e60415341
commit
a1794db11c
|
|
@ -12,7 +12,6 @@
|
|||
if (w.__MSW_LOADED__) return;
|
||||
w.__MSW_LOADED__ = true;
|
||||
|
||||
var P = w.PROLOGY_CONFIG || {};
|
||||
var CFG = {
|
||||
apiEndpoint:
|
||||
P.CHAT_API_URL ||
|
||||
|
|
@ -24,7 +23,9 @@
|
|||
rateLimit: {
|
||||
max: P.CHAT_RATE_LIMIT_MAX != null ? P.CHAT_RATE_LIMIT_MAX : 3,
|
||||
windowMin:
|
||||
P.CHAT_RATE_LIMIT_WINDOW_MIN != null ? P.CHAT_RATE_LIMIT_WINDOW_MIN : 10,
|
||||
P.CHAT_RATE_LIMIT_WINDOW_MIN != null
|
||||
? P.CHAT_RATE_LIMIT_WINDOW_MIN
|
||||
: 10,
|
||||
},
|
||||
minFillMs: P.CHAT_MIN_FILL_MS != null ? P.CHAT_MIN_FILL_MS : 3000,
|
||||
fabImageUrl:
|
||||
|
|
@ -97,11 +98,7 @@
|
|||
var phone = (f.phone || "").trim();
|
||||
var message = (f.message || "").trim();
|
||||
if (!name || !/^[\p{L}\p{M}'\-\s]{2,80}$/u.test(name)) e.push("sms-name");
|
||||
if (
|
||||
!phone ||
|
||||
!/^[\d\s\+\-\(\)]{7,15}$/.test(phone) ||
|
||||
!/\d{5,}/.test(phone)
|
||||
)
|
||||
if (!phone || !/^04\s?\d{2}\s?\d{3}\s?\d{3}$/.test(phone))
|
||||
e.push("sms-phone");
|
||||
if (!message || message.length < 10) e.push("sms-msg");
|
||||
return e;
|
||||
|
|
@ -146,7 +143,7 @@
|
|||
/* FAB — no transition on background/box-shadow to kill flicker; only transform transitions */
|
||||
"#fab{position:fixed;bottom:24px;" + pos + "z-index:99998;",
|
||||
"width:60px;height:60px;border-radius:50%;",
|
||||
"background-image:url(" + CFG.fabImageUrl + ");",
|
||||
"background-image:url(https://prology.nswteam.net/media/wysiwyg/image_2026-04-02_15-43-14.png);",
|
||||
"background-size:cover;background-position:center;background-repeat:no-repeat;",
|
||||
"border:none;cursor:pointer;outline:none;",
|
||||
"box-shadow:0 6px 20px rgba(79,70,229,.4);",
|
||||
|
|
@ -241,7 +238,7 @@
|
|||
/* SMS */
|
||||
'<div class="pane active" id="pane-sms">',
|
||||
'<div class="field"><input id="sms-name" type="text" maxlength="80" autocomplete="name" placeholder="Your Name"><div class="hint" id="h-sms-name">Please enter your full name</div></div>',
|
||||
'<div class="field"><input id="sms-phone" type="tel" maxlength="15" autocomplete="tel" placeholder="Mobile Number (Australia)"><div class="hint" id="h-sms-phone">Enter a valid AU mobile number</div></div>',
|
||||
'<div class="field"><input id="sms-phone" type="tel" inputmode="numeric" maxlength="13" autocomplete="tel-national" placeholder="Mobile Phone (AU): 04 XX XXX XXX"><div class="hint" id="h-sms-phone">Enter AU mobile in format: 04 XX XXX XXX</div></div>',
|
||||
'<div class="field"><textarea id="sms-msg" maxlength="1000" placeholder="How can we help?"></textarea><div class="hint" id="h-sms-msg">Please provide more details (min 10 chars)</div></div>',
|
||||
'<div class="hp"><input type="text" id="hp-sms" tabindex="-1" autocomplete="off"></div>',
|
||||
'<button class="btn-submit" id="btn-sms">Send SMS ' +
|
||||
|
|
@ -275,7 +272,7 @@
|
|||
'<div class="success-icon">' + SVG_CHECK + "</div>",
|
||||
"<h3>Message Received!</h3>",
|
||||
"<p>Thanks for reaching out.<br>We'll get back to you shortly.</p>",
|
||||
'<button class="btn-new" id="btn-new">Send another message</button>',
|
||||
'<button class="btn-submit" id="btn-new">Send another message</button>',
|
||||
"</div>",
|
||||
"</div>",
|
||||
].join("");
|
||||
|
|
@ -424,8 +421,17 @@
|
|||
bumpRl();
|
||||
showSuccess();
|
||||
} else if (xhr.status === 429)
|
||||
setStatus(prefix, "Server busy. Please try again later.", "warn");
|
||||
else setStatus(prefix, "Failed to send. Please try again.", "fail");
|
||||
setStatus(
|
||||
prefix,
|
||||
"Too many requests. Please try again later.",
|
||||
"warn",
|
||||
);
|
||||
else
|
||||
setStatus(
|
||||
prefix,
|
||||
"Too many requests. Please try again later.",
|
||||
"fail",
|
||||
);
|
||||
};
|
||||
xhr.ontimeout = function () {
|
||||
$btn.disabled = false;
|
||||
|
|
|
|||
Loading…
Reference in New Issue