aumera-on-screen-widget 0.0.16 → 0.0.17

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.
Files changed (2) hide show
  1. package/df-btn.js +10 -2
  2. package/package.json +1 -1
package/df-btn.js CHANGED
@@ -26,6 +26,14 @@
26
26
  return supportedLangs.includes(lang) ? lang : "de";
27
27
  }
28
28
 
29
+ // Helper function to resize Cloudinary images for optimized file size
30
+ function cloudinaryResize(url, width = 32, height = 32) {
31
+ const transform = `w_${width},h_${height},c_fill,f_auto,q_auto`;
32
+
33
+ // Insert transformation right after `/upload/`
34
+ return url.replace('/upload/', `/upload/${transform}/`);
35
+ }
36
+
29
37
  // Async function to fetch chatbot settings from GraphQL
30
38
  async function fetchChatbotSettings(orgId, env, language) {
31
39
  try {
@@ -219,8 +227,8 @@
219
227
 
220
228
  // Use chatbotMask as logo if available
221
229
  if (settings.chatbotMask) {
222
- config.logo = settings.chatbotMask;
223
- config.logoDark = settings.chatbotMask;
230
+ config.logo = cloudinaryResize(settings.chatbotMask, 64, 64);
231
+ config.logoDark = cloudinaryResize(settings.chatbotMask, 64, 64);
224
232
  console.log(
225
233
  "[OSW Widget] Using chatbotMask as logo:",
226
234
  settings.chatbotMask
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aumera-on-screen-widget",
3
- "version": "0.0.16",
3
+ "version": "0.0.17",
4
4
  "description": "A lightweight, customizable chat widget for websites",
5
5
  "main": "df-btn.js",
6
6
  "scripts": {