@syntrologie/adapt-chatbot 2.55.0 → 2.55.1
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/ChatAssistantLit.d.ts +5 -3
- package/dist/ChatAssistantLit.d.ts.map +1 -1
- package/dist/ChatAssistantLit.js +1 -1
- package/dist/ChatTransport.d.ts +4 -4
- package/dist/ChatTransport.d.ts.map +1 -1
- package/dist/Turnstile.d.ts +18 -0
- package/dist/Turnstile.d.ts.map +1 -1
- package/dist/{chunk-57MPLQOL.js → chunk-EXDL3OKE.js} +87 -28
- package/dist/{chunk-57MPLQOL.js.map → chunk-EXDL3OKE.js.map} +2 -2
- package/dist/runtime.js +9 -10
- package/dist/runtime.js.map +2 -2
- package/package.json +1 -1
package/dist/runtime.js
CHANGED
|
@@ -5,11 +5,11 @@ import {
|
|
|
5
5
|
ElementInstanceStore,
|
|
6
6
|
ItemHandler,
|
|
7
7
|
TileHandler,
|
|
8
|
-
|
|
8
|
+
acquireBotCheckTokenForSend,
|
|
9
9
|
decodeMutationEnvelope,
|
|
10
10
|
fetchMountedElements,
|
|
11
11
|
renderFallbackHtml
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-EXDL3OKE.js";
|
|
13
13
|
import {
|
|
14
14
|
pickPersona
|
|
15
15
|
} from "./chunk-VFWA5W56.js";
|
|
@@ -745,9 +745,6 @@ var ChatTransport = class {
|
|
|
745
745
|
const headers2 = {};
|
|
746
746
|
const token = readRuntimeToken(this._config?.runtime);
|
|
747
747
|
if (token) headers2.Authorization = `Bearer ${token}`;
|
|
748
|
-
const cft = await this._acquireTurnstileWithChallenge();
|
|
749
|
-
if (cft) headers2["CF-Turnstile-Token"] = cft;
|
|
750
|
-
if (abort.signal.aborted) return;
|
|
751
748
|
const readIds = () => {
|
|
752
749
|
try {
|
|
753
750
|
const rt = this._config?.runtime;
|
|
@@ -1129,13 +1126,15 @@ var ChatTransport = class {
|
|
|
1129
1126
|
}
|
|
1130
1127
|
}
|
|
1131
1128
|
/**
|
|
1132
|
-
* Acquire a Turnstile token
|
|
1133
|
-
*
|
|
1134
|
-
*
|
|
1135
|
-
*
|
|
1129
|
+
* Acquire a Turnstile token for a visitor send. Only reached from
|
|
1130
|
+
* `_ensureConnected`, i.e. on interaction. Returns null without touching
|
|
1131
|
+
* Cloudflare when the build has no sitekey or the backend does not enforce
|
|
1132
|
+
* the check; null also when acquisition fails.
|
|
1136
1133
|
*/
|
|
1137
1134
|
async _acquireTurnstileWithChallenge() {
|
|
1138
|
-
|
|
1135
|
+
if (!this._config) return null;
|
|
1136
|
+
const backendUrl = this._config.backendUrl.replace(/\/$/, "");
|
|
1137
|
+
const { token } = await acquireBotCheckTokenForSend(backendUrl);
|
|
1139
1138
|
return token;
|
|
1140
1139
|
}
|
|
1141
1140
|
// -------------------------------------------------------------------------
|