@developpement/tp-chatbot-widget 0.0.10 → 0.0.11
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/package.json +1 -1
- package/src/chatbot.js +8 -3
package/package.json
CHANGED
package/src/chatbot.js
CHANGED
|
@@ -209,11 +209,13 @@
|
|
|
209
209
|
if (!response.ok) return;
|
|
210
210
|
const data = await response.json();
|
|
211
211
|
const t = data.result?.result;
|
|
212
|
+
console.log('[fetchTheme] open_by_default:', t.open_by_default, typeof t.open_by_default);
|
|
212
213
|
if (!t) return;
|
|
213
214
|
if (CLIENT_THEMES[this.client_id]) {
|
|
214
215
|
if (t.primary) CLIENT_THEMES[this.client_id].primary = t.primary;
|
|
215
216
|
if (t.position) CLIENT_THEMES[this.client_id].position = t.position;
|
|
216
217
|
if (t.name) CLIENT_THEMES[this.client_id].name = t.name;
|
|
218
|
+
if (t.open_by_default !== undefined) CLIENT_THEMES[this.client_id].open_by_default = t.open_by_default;
|
|
217
219
|
} else {
|
|
218
220
|
CLIENT_THEMES[this.client_id] = {
|
|
219
221
|
primary: t.primary || DEFAULT_THEME.primary,
|
|
@@ -247,9 +249,12 @@
|
|
|
247
249
|
this.attachEvents();
|
|
248
250
|
this._initialized = true;
|
|
249
251
|
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
252
|
+
const theme = getClientTheme(this.client_id);
|
|
253
|
+
console.log('[widget] theme after fetch:', theme);
|
|
254
|
+
|
|
255
|
+
if (theme.open_by_default) {
|
|
256
|
+
setTimeout(() => this.toggleChat(), 300);
|
|
257
|
+
}
|
|
253
258
|
|
|
254
259
|
if (this.access_token) {
|
|
255
260
|
this.user_info = extractUserInfo(this.access_token);
|