@mobil80-dev/chatbot-widget 2.0.8 → 3.0.0

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.js CHANGED
@@ -206,17 +206,23 @@ function updateCard (config) {
206
206
  vcCard.style.display = 'none';
207
207
  };
208
208
 
209
+ const isMobile = window.innerWidth <= 600;
210
+
209
211
  Object.assign(card.style, {
210
212
  position: 'fixed',
211
- bottom: '90px',
212
- right: '20px',
213
- maxWidth: '90vw',
214
- width: '400px',
215
- height: '420px',
216
- maxHeight: '100vh',
213
+ bottom: isMobile ? '0' : '90px',
214
+ right: isMobile ? '0' : '50px',
215
+
216
+ width: isMobile ? '100vw' : '400px',
217
+ maxWidth: isMobile ? '100vw' : '400px',
218
+
219
+ height: isMobile ? '100vh' : '420px',
220
+ maxHeight: isMobile ? '100vh' : '420px',
221
+
217
222
  background: colors.cardBg,
218
- borderRadius: '12px',
219
- boxShadow: '0 10px 30px rgba(0,0,0,.3)',
223
+ borderRadius: isMobile ? '0' : '12px',
224
+ boxShadow: isMobile ? 'none' : '0 10px 30px rgba(0,0,0,.3)',
225
+
220
226
  zIndex: 999999,
221
227
  display: isOpen ? 'flex' : 'none',
222
228
  flexDirection: 'column'
@@ -268,7 +274,7 @@ function updateCard (config) {
268
274
  const data = await res.json();
269
275
  hideLoader(sendBtn);
270
276
  addBotMessage(
271
- data?.data?.blocks?.map(b => b.text).join('\n') || 'No response'
277
+ data?.data?.blocks?.map(b => b.text).join('\n') || data?.data || 'No response'
272
278
  );
273
279
  } catch {
274
280
  hideLoader(sendBtn);
package/dist/index.umd.js CHANGED
@@ -212,17 +212,23 @@
212
212
  vcCard.style.display = 'none';
213
213
  };
214
214
 
215
+ const isMobile = window.innerWidth <= 600;
216
+
215
217
  Object.assign(card.style, {
216
218
  position: 'fixed',
217
- bottom: '90px',
218
- right: '20px',
219
- maxWidth: '90vw',
220
- width: '400px',
221
- height: '420px',
222
- maxHeight: '100vh',
219
+ bottom: isMobile ? '0' : '90px',
220
+ right: isMobile ? '0' : '50px',
221
+
222
+ width: isMobile ? '100vw' : '400px',
223
+ maxWidth: isMobile ? '100vw' : '400px',
224
+
225
+ height: isMobile ? '100vh' : '420px',
226
+ maxHeight: isMobile ? '100vh' : '420px',
227
+
223
228
  background: colors.cardBg,
224
- borderRadius: '12px',
225
- boxShadow: '0 10px 30px rgba(0,0,0,.3)',
229
+ borderRadius: isMobile ? '0' : '12px',
230
+ boxShadow: isMobile ? 'none' : '0 10px 30px rgba(0,0,0,.3)',
231
+
226
232
  zIndex: 999999,
227
233
  display: isOpen ? 'flex' : 'none',
228
234
  flexDirection: 'column'
@@ -274,7 +280,7 @@
274
280
  const data = await res.json();
275
281
  hideLoader(sendBtn);
276
282
  addBotMessage(
277
- data?.data?.blocks?.map(b => b.text).join('\n') || 'No response'
283
+ data?.data?.blocks?.map(b => b.text).join('\n') || data?.data || 'No response'
278
284
  );
279
285
  } catch {
280
286
  hideLoader(sendBtn);
package/index.js CHANGED
@@ -206,17 +206,23 @@ function updateCard (config) {
206
206
  vcCard.style.display = 'none'
207
207
  }
208
208
 
209
+ const isMobile = window.innerWidth <= 600
210
+
209
211
  Object.assign(card.style, {
210
212
  position: 'fixed',
211
- bottom: '90px',
212
- right: '20px',
213
- maxWidth: '90vw',
214
- width: '400px',
215
- height: '420px',
216
- maxHeight: '100vh',
213
+ bottom: isMobile ? '0' : '90px',
214
+ right: isMobile ? '0' : '50px',
215
+
216
+ width: isMobile ? '100vw' : '400px',
217
+ maxWidth: isMobile ? '100vw' : '400px',
218
+
219
+ height: isMobile ? '100vh' : '420px',
220
+ maxHeight: isMobile ? '100vh' : '420px',
221
+
217
222
  background: colors.cardBg,
218
- borderRadius: '12px',
219
- boxShadow: '0 10px 30px rgba(0,0,0,.3)',
223
+ borderRadius: isMobile ? '0' : '12px',
224
+ boxShadow: isMobile ? 'none' : '0 10px 30px rgba(0,0,0,.3)',
225
+
220
226
  zIndex: 999999,
221
227
  display: isOpen ? 'flex' : 'none',
222
228
  flexDirection: 'column'
@@ -268,7 +274,7 @@ function updateCard (config) {
268
274
  const data = await res.json()
269
275
  hideLoader(sendBtn)
270
276
  addBotMessage(
271
- data?.data?.blocks?.map(b => b.text).join('\n') || 'No response'
277
+ data?.data?.blocks?.map(b => b.text).join('\n') || data?.data || 'No response'
272
278
  )
273
279
  } catch {
274
280
  hideLoader(sendBtn)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mobil80-dev/chatbot-widget",
3
- "version": "2.0.8",
3
+ "version": "3.0.0",
4
4
  "description": "Drop-in JavaScript chat widget for websites (no iframe, no framework)",
5
5
  "author": "NanthaGopal",
6
6
  "license": "MIT",