@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/runtime.js CHANGED
@@ -5,11 +5,11 @@ import {
5
5
  ElementInstanceStore,
6
6
  ItemHandler,
7
7
  TileHandler,
8
- acquireTokenWithChallenge,
8
+ acquireBotCheckTokenForSend,
9
9
  decodeMutationEnvelope,
10
10
  fetchMountedElements,
11
11
  renderFallbackHtml
12
- } from "./chunk-57MPLQOL.js";
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 via the managed-challenge flow.
1133
- * Delegates to the shared Turnstile helper that owns the verify
1134
- * panel lifecycle. Returns null when Turnstile is disabled at
1135
- * build time or acquisition fails.
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
- const { token } = await acquireTokenWithChallenge();
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
  // -------------------------------------------------------------------------