clay-server 2.20.0-beta.2 → 2.20.0-beta.4
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/lib/public/app.js +42 -28
- package/package.json +1 -1
package/lib/public/app.js
CHANGED
|
@@ -5527,26 +5527,31 @@ import { initDebate, handleDebateStarted, handleDebateResumed, handleDebateTurn,
|
|
|
5527
5527
|
'<h2 style="margin:0 0 8px;color:var(--text,#fff);font-size:22px">Set your new PIN</h2>' +
|
|
5528
5528
|
'<p style="margin:0 0 24px;color:var(--text-secondary,#aaa);font-size:14px">Your temporary PIN has expired. Please set a new 6-digit PIN to continue.</p>' +
|
|
5529
5529
|
'<div style="display:flex;gap:8px;justify-content:center;margin-bottom:16px" id="fcp-boxes">' +
|
|
5530
|
-
'<input class="fcp-digit" type="tel" maxlength="1" inputmode="numeric" autocomplete="off" style="width:44px;height:52px;text-align:center;font-size:22px;font-weight:600;border:2px solid var(--border,#333);border-radius:10px;background:var(--bg-
|
|
5531
|
-
'<input class="fcp-digit" type="tel" maxlength="1" inputmode="numeric" autocomplete="off" style="width:44px;height:52px;text-align:center;font-size:22px;font-weight:600;border:2px solid var(--border,#333);border-radius:10px;background:var(--bg-
|
|
5532
|
-
'<input class="fcp-digit" type="tel" maxlength="1" inputmode="numeric" autocomplete="off" style="width:44px;height:52px;text-align:center;font-size:22px;font-weight:600;border:2px solid var(--border,#333);border-radius:10px;background:var(--bg-
|
|
5533
|
-
'<input class="fcp-digit" type="tel" maxlength="1" inputmode="numeric" autocomplete="off" style="width:44px;height:52px;text-align:center;font-size:22px;font-weight:600;border:2px solid var(--border,#333);border-radius:10px;background:var(--bg-
|
|
5534
|
-
'<input class="fcp-digit" type="tel" maxlength="1" inputmode="numeric" autocomplete="off" style="width:44px;height:52px;text-align:center;font-size:22px;font-weight:600;border:2px solid var(--border,#333);border-radius:10px;background:var(--bg-
|
|
5535
|
-
'<input class="fcp-digit" type="tel" maxlength="1" inputmode="numeric" autocomplete="off" style="width:44px;height:52px;text-align:center;font-size:22px;font-weight:600;border:2px solid var(--border,#333);border-radius:10px;background:var(--bg-
|
|
5530
|
+
'<input class="fcp-digit" type="tel" maxlength="1" inputmode="numeric" autocomplete="off" style="width:44px;height:52px;text-align:center;font-size:22px;font-weight:600;border:2px solid var(--border,#333);border-radius:10px;background:var(--bg-alt,#f5f5f5);color:var(--text,#fff);outline:none">' +
|
|
5531
|
+
'<input class="fcp-digit" type="tel" maxlength="1" inputmode="numeric" autocomplete="off" style="width:44px;height:52px;text-align:center;font-size:22px;font-weight:600;border:2px solid var(--border,#333);border-radius:10px;background:var(--bg-alt,#f5f5f5);color:var(--text,#fff);outline:none">' +
|
|
5532
|
+
'<input class="fcp-digit" type="tel" maxlength="1" inputmode="numeric" autocomplete="off" style="width:44px;height:52px;text-align:center;font-size:22px;font-weight:600;border:2px solid var(--border,#333);border-radius:10px;background:var(--bg-alt,#f5f5f5);color:var(--text,#fff);outline:none">' +
|
|
5533
|
+
'<input class="fcp-digit" type="tel" maxlength="1" inputmode="numeric" autocomplete="off" style="width:44px;height:52px;text-align:center;font-size:22px;font-weight:600;border:2px solid var(--border,#333);border-radius:10px;background:var(--bg-alt,#f5f5f5);color:var(--text,#fff);outline:none">' +
|
|
5534
|
+
'<input class="fcp-digit" type="tel" maxlength="1" inputmode="numeric" autocomplete="off" style="width:44px;height:52px;text-align:center;font-size:22px;font-weight:600;border:2px solid var(--border,#333);border-radius:10px;background:var(--bg-alt,#f5f5f5);color:var(--text,#fff);outline:none">' +
|
|
5535
|
+
'<input class="fcp-digit" type="tel" maxlength="1" inputmode="numeric" autocomplete="off" style="width:44px;height:52px;text-align:center;font-size:22px;font-weight:600;border:2px solid var(--border,#333);border-radius:10px;background:var(--bg-alt,#f5f5f5);color:var(--text,#fff);outline:none">' +
|
|
5536
5536
|
'</div>' +
|
|
5537
5537
|
'<button id="fcp-save" disabled style="width:100%;padding:12px;border:none;border-radius:10px;background:var(--accent,#7c3aed);color:#fff;font-size:15px;font-weight:600;cursor:pointer;opacity:0.5">Save PIN</button>' +
|
|
5538
5538
|
'<div id="fcp-err" style="margin-top:12px;color:#ef4444;font-size:13px"></div>' +
|
|
5539
5539
|
'</div>';
|
|
5540
5540
|
document.body.appendChild(ov);
|
|
5541
5541
|
|
|
5542
|
-
var
|
|
5542
|
+
var boxes = ov.querySelectorAll(".fcp-digit");
|
|
5543
5543
|
var saveBtn = ov.querySelector("#fcp-save");
|
|
5544
5544
|
var errEl = ov.querySelector("#fcp-err");
|
|
5545
|
+
var pinValues = ["", "", "", "", "", ""];
|
|
5546
|
+
|
|
5547
|
+
function setDigit(idx, v) {
|
|
5548
|
+
pinValues[idx] = v;
|
|
5549
|
+
boxes[idx].value = v ? "\u2022" : "";
|
|
5550
|
+
boxes[idx].classList.toggle("filled", v.length > 0);
|
|
5551
|
+
}
|
|
5545
5552
|
|
|
5546
5553
|
function getPin() {
|
|
5547
|
-
|
|
5548
|
-
for (var i = 0; i < digits.length; i++) pin += digits[i].value;
|
|
5549
|
-
return pin;
|
|
5554
|
+
return pinValues.join("");
|
|
5550
5555
|
}
|
|
5551
5556
|
|
|
5552
5557
|
function updateBtn() {
|
|
@@ -5555,40 +5560,49 @@ import { initDebate, handleDebateStarted, handleDebateResumed, handleDebateTurn,
|
|
|
5555
5560
|
saveBtn.style.opacity = ready ? "1" : "0.5";
|
|
5556
5561
|
}
|
|
5557
5562
|
|
|
5558
|
-
for (var i = 0; i <
|
|
5563
|
+
for (var i = 0; i < boxes.length; i++) {
|
|
5559
5564
|
(function (idx) {
|
|
5560
|
-
|
|
5561
|
-
var
|
|
5562
|
-
|
|
5563
|
-
|
|
5565
|
+
boxes[idx].addEventListener("input", function () {
|
|
5566
|
+
var raw = this.value.replace(/[^0-9]/g, "");
|
|
5567
|
+
if (!raw) { setDigit(idx, ""); updateBtn(); return; }
|
|
5568
|
+
var v = raw.charAt(raw.length - 1);
|
|
5569
|
+
setDigit(idx, v);
|
|
5570
|
+
if (v && idx < 5) boxes[idx + 1].focus();
|
|
5564
5571
|
updateBtn();
|
|
5565
5572
|
});
|
|
5566
|
-
|
|
5567
|
-
if (e.key === "Backspace"
|
|
5568
|
-
|
|
5569
|
-
|
|
5573
|
+
boxes[idx].addEventListener("keydown", function (e) {
|
|
5574
|
+
if (e.key === "Backspace") {
|
|
5575
|
+
if (!pinValues[idx] && idx > 0) {
|
|
5576
|
+
setDigit(idx - 1, "");
|
|
5577
|
+
boxes[idx - 1].focus();
|
|
5578
|
+
} else {
|
|
5579
|
+
setDigit(idx, "");
|
|
5580
|
+
}
|
|
5570
5581
|
updateBtn();
|
|
5571
5582
|
}
|
|
5583
|
+
if (e.key === "ArrowLeft" && idx > 0) boxes[idx - 1].focus();
|
|
5584
|
+
if (e.key === "ArrowRight" && idx < 5) boxes[idx + 1].focus();
|
|
5572
5585
|
if (e.key === "Enter" && !saveBtn.disabled) doSave();
|
|
5573
5586
|
e.stopPropagation();
|
|
5574
5587
|
});
|
|
5575
|
-
|
|
5576
|
-
|
|
5577
|
-
|
|
5588
|
+
boxes[idx].addEventListener("keyup", function (e) { e.stopPropagation(); });
|
|
5589
|
+
boxes[idx].addEventListener("keypress", function (e) { e.stopPropagation(); });
|
|
5590
|
+
boxes[idx].addEventListener("paste", function (e) {
|
|
5578
5591
|
e.preventDefault();
|
|
5579
|
-
var text = (e.clipboardData || window.clipboardData).getData("text").replace(
|
|
5580
|
-
for (var j = 0; j < text.length && (idx + j) <
|
|
5581
|
-
|
|
5592
|
+
var text = (e.clipboardData || window.clipboardData).getData("text").replace(/[^0-9]/g, "").substring(0, 6);
|
|
5593
|
+
for (var j = 0; j < text.length && (idx + j) < 6; j++) {
|
|
5594
|
+
setDigit(idx + j, text.charAt(j));
|
|
5582
5595
|
}
|
|
5583
5596
|
if (text.length > 0) {
|
|
5584
|
-
var focusIdx = Math.min(idx + text.length,
|
|
5585
|
-
|
|
5597
|
+
var focusIdx = Math.min(idx + text.length, 5);
|
|
5598
|
+
boxes[focusIdx].focus();
|
|
5586
5599
|
}
|
|
5587
5600
|
updateBtn();
|
|
5588
5601
|
});
|
|
5602
|
+
boxes[idx].addEventListener("focus", function () { this.select(); });
|
|
5589
5603
|
})(i);
|
|
5590
5604
|
}
|
|
5591
|
-
|
|
5605
|
+
boxes[0].focus();
|
|
5592
5606
|
|
|
5593
5607
|
function doSave() {
|
|
5594
5608
|
var pin = getPin();
|