@lokutor/sdk 1.1.37 → 1.1.39
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.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +10 -6
- package/dist/index.mjs +10 -6
- package/package.json +1 -1
- package/src/conversational-panel.ts +11 -8
package/dist/index.d.mts
CHANGED
|
@@ -687,6 +687,7 @@ declare class ConversationalPanel {
|
|
|
687
687
|
showError(text: string): void;
|
|
688
688
|
/** Destroy the component, removing all DOM and stopping any active session */
|
|
689
689
|
destroy(): void;
|
|
690
|
+
private fmt;
|
|
690
691
|
private startTimer;
|
|
691
692
|
private toggleMute;
|
|
692
693
|
private playConnectingSound;
|
package/dist/index.d.ts
CHANGED
|
@@ -687,6 +687,7 @@ declare class ConversationalPanel {
|
|
|
687
687
|
showError(text: string): void;
|
|
688
688
|
/** Destroy the component, removing all DOM and stopping any active session */
|
|
689
689
|
destroy(): void;
|
|
690
|
+
private fmt;
|
|
690
691
|
private startTimer;
|
|
691
692
|
private toggleMute;
|
|
692
693
|
private playConnectingSound;
|
package/dist/index.js
CHANGED
|
@@ -1869,27 +1869,31 @@ var ConversationalPanel = class {
|
|
|
1869
1869
|
this.el.remove();
|
|
1870
1870
|
}
|
|
1871
1871
|
// ─── internal helpers ────────────────────────────────────
|
|
1872
|
+
fmt(s) {
|
|
1873
|
+
const m = Math.floor(s / 60).toString().padStart(2, "0");
|
|
1874
|
+
const sec = (s % 60).toString().padStart(2, "0");
|
|
1875
|
+
return `${m}:${sec}`;
|
|
1876
|
+
}
|
|
1872
1877
|
startTimer() {
|
|
1873
1878
|
let elapsed = 0;
|
|
1874
1879
|
const maxDur = this.cfg.maxDuration || 300;
|
|
1875
1880
|
const silentMax = this.cfg.silenceTimeout || 30;
|
|
1876
1881
|
this._lastSpeechTime = Date.now();
|
|
1877
|
-
this.timerEl.textContent =
|
|
1882
|
+
this.timerEl.textContent = this.fmt(maxDur);
|
|
1878
1883
|
this.timerTicker = window.setInterval(() => {
|
|
1879
1884
|
elapsed++;
|
|
1880
|
-
const
|
|
1881
|
-
|
|
1882
|
-
this.timerEl.textContent = `${m}:${s}`;
|
|
1885
|
+
const remaining = Math.max(0, maxDur - elapsed);
|
|
1886
|
+
this.timerEl.textContent = this.fmt(remaining);
|
|
1883
1887
|
if (elapsed >= maxDur) {
|
|
1884
1888
|
this._locked = true;
|
|
1885
1889
|
this.stop();
|
|
1886
|
-
this.showError("
|
|
1890
|
+
this.showError("Tiempo l\xEDmite alcanzado.");
|
|
1887
1891
|
return;
|
|
1888
1892
|
}
|
|
1889
1893
|
if (Date.now() - this._lastSpeechTime > silentMax * 1e3) {
|
|
1890
1894
|
this._locked = true;
|
|
1891
1895
|
this.stop();
|
|
1892
|
-
this.showError("
|
|
1896
|
+
this.showError("Sesi\xF3n finalizada por inactividad.");
|
|
1893
1897
|
}
|
|
1894
1898
|
}, 1e3);
|
|
1895
1899
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -1822,27 +1822,31 @@ var ConversationalPanel = class {
|
|
|
1822
1822
|
this.el.remove();
|
|
1823
1823
|
}
|
|
1824
1824
|
// ─── internal helpers ────────────────────────────────────
|
|
1825
|
+
fmt(s) {
|
|
1826
|
+
const m = Math.floor(s / 60).toString().padStart(2, "0");
|
|
1827
|
+
const sec = (s % 60).toString().padStart(2, "0");
|
|
1828
|
+
return `${m}:${sec}`;
|
|
1829
|
+
}
|
|
1825
1830
|
startTimer() {
|
|
1826
1831
|
let elapsed = 0;
|
|
1827
1832
|
const maxDur = this.cfg.maxDuration || 300;
|
|
1828
1833
|
const silentMax = this.cfg.silenceTimeout || 30;
|
|
1829
1834
|
this._lastSpeechTime = Date.now();
|
|
1830
|
-
this.timerEl.textContent =
|
|
1835
|
+
this.timerEl.textContent = this.fmt(maxDur);
|
|
1831
1836
|
this.timerTicker = window.setInterval(() => {
|
|
1832
1837
|
elapsed++;
|
|
1833
|
-
const
|
|
1834
|
-
|
|
1835
|
-
this.timerEl.textContent = `${m}:${s}`;
|
|
1838
|
+
const remaining = Math.max(0, maxDur - elapsed);
|
|
1839
|
+
this.timerEl.textContent = this.fmt(remaining);
|
|
1836
1840
|
if (elapsed >= maxDur) {
|
|
1837
1841
|
this._locked = true;
|
|
1838
1842
|
this.stop();
|
|
1839
|
-
this.showError("
|
|
1843
|
+
this.showError("Tiempo l\xEDmite alcanzado.");
|
|
1840
1844
|
return;
|
|
1841
1845
|
}
|
|
1842
1846
|
if (Date.now() - this._lastSpeechTime > silentMax * 1e3) {
|
|
1843
1847
|
this._locked = true;
|
|
1844
1848
|
this.stop();
|
|
1845
|
-
this.showError("
|
|
1849
|
+
this.showError("Sesi\xF3n finalizada por inactividad.");
|
|
1846
1850
|
}
|
|
1847
1851
|
}, 1e3);
|
|
1848
1852
|
}
|
package/package.json
CHANGED
|
@@ -601,31 +601,34 @@ export class ConversationalPanel {
|
|
|
601
601
|
|
|
602
602
|
// ─── internal helpers ────────────────────────────────────
|
|
603
603
|
|
|
604
|
+
private fmt(s: number): string {
|
|
605
|
+
const m = Math.floor(s / 60).toString().padStart(2, '0');
|
|
606
|
+
const sec = (s % 60).toString().padStart(2, '0');
|
|
607
|
+
return `${m}:${sec}`;
|
|
608
|
+
}
|
|
609
|
+
|
|
604
610
|
private startTimer() {
|
|
605
611
|
let elapsed = 0;
|
|
606
612
|
const maxDur = this.cfg.maxDuration || 300;
|
|
607
613
|
const silentMax = this.cfg.silenceTimeout || 30;
|
|
608
614
|
this._lastSpeechTime = Date.now();
|
|
609
|
-
this.timerEl.textContent =
|
|
615
|
+
this.timerEl.textContent = this.fmt(maxDur);
|
|
610
616
|
this.timerTicker = window.setInterval(() => {
|
|
611
617
|
elapsed++;
|
|
612
|
-
const
|
|
613
|
-
|
|
614
|
-
this.timerEl.textContent = `${m}:${s}`;
|
|
618
|
+
const remaining = Math.max(0, maxDur - elapsed);
|
|
619
|
+
this.timerEl.textContent = this.fmt(remaining);
|
|
615
620
|
|
|
616
|
-
// Check max duration
|
|
617
621
|
if (elapsed >= maxDur) {
|
|
618
622
|
this._locked = true;
|
|
619
623
|
this.stop();
|
|
620
|
-
this.showError('
|
|
624
|
+
this.showError('Tiempo límite alcanzado.');
|
|
621
625
|
return;
|
|
622
626
|
}
|
|
623
627
|
|
|
624
|
-
// Check silence timeout
|
|
625
628
|
if (Date.now() - this._lastSpeechTime > silentMax * 1000) {
|
|
626
629
|
this._locked = true;
|
|
627
630
|
this.stop();
|
|
628
|
-
this.showError('
|
|
631
|
+
this.showError('Sesión finalizada por inactividad.');
|
|
629
632
|
}
|
|
630
633
|
}, 1000);
|
|
631
634
|
}
|