@pocketping/widget 1.12.1 → 1.12.2

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.cjs CHANGED
@@ -221,25 +221,51 @@ function styles(options) {
221
221
  /* Mobile: fullscreen widget to prevent scroll issues */
222
222
  @media (max-width: 480px) {
223
223
  .pp-window {
224
- position: fixed;
224
+ position: fixed !important;
225
+ /* No !important on top/bottom/height - controlled by JS for keyboard handling */
225
226
  top: 0;
226
- left: 0;
227
- right: 0;
228
- bottom: 0;
229
- width: 100%;
230
- height: 100%;
231
- max-height: 100%;
227
+ left: 0 !important;
228
+ right: 0 !important;
229
+ bottom: auto;
230
+ width: 100vw !important;
231
+ height: 100vh;
232
+ height: 100dvh;
233
+ max-width: 100vw !important;
234
+ max-height: 100vh;
232
235
  max-height: 100dvh;
233
- min-height: 100%;
234
- min-height: 100dvh;
235
- border-radius: 0;
236
- overflow: hidden;
237
- touch-action: none; /* Prevent page scroll behind widget */
236
+ min-height: 0; /* Allow shrinking for keyboard */
237
+ border-radius: 0 !important;
238
+ overflow: hidden !important;
239
+ touch-action: manipulation; /* Allow scroll and touch, prevent double-tap zoom */
240
+ margin: 0 !important;
241
+ padding: 0 !important;
242
+ box-sizing: border-box !important;
238
243
  }
239
244
 
240
- /* Prevent any horizontal scroll */
241
- .pp-window * {
242
- max-width: 100%;
245
+ /* Prevent any overflow */
246
+ .pp-window *,
247
+ .pp-window *::before,
248
+ .pp-window *::after {
249
+ max-width: 100% !important;
250
+ box-sizing: border-box !important;
251
+ }
252
+
253
+ /* Ensure messages area scrolls properly */
254
+ .pp-messages {
255
+ max-width: 100vw !important;
256
+ min-height: 0 !important; /* Allow shrinking for scroll */
257
+ overflow-x: hidden !important;
258
+ overflow-y: auto !important;
259
+ touch-action: pan-y !important; /* Enable vertical scrolling */
260
+ -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
261
+ }
262
+
263
+ /* Allow touch on input area for typing */
264
+ .pp-input-form,
265
+ .pp-input,
266
+ .pp-send-btn,
267
+ .pp-attach-btn {
268
+ touch-action: manipulation !important;
243
269
  }
244
270
  }
245
271
 
@@ -250,6 +276,9 @@ function styles(options) {
250
276
  padding: 10px 16px;
251
277
  background: ${resolvedHeaderColor};
252
278
  color: white;
279
+ flex-shrink: 0; /* Never shrink - always visible */
280
+ position: relative;
281
+ z-index: 10; /* Stay above messages during any scroll issues */
253
282
  }
254
283
 
255
284
  .pp-header-info {
@@ -322,6 +351,7 @@ function styles(options) {
322
351
 
323
352
  .pp-messages {
324
353
  flex: 1;
354
+ min-height: 0; /* Critical: allows flex child to shrink and enable scrolling */
325
355
  overflow-y: auto;
326
356
  overflow-x: hidden;
327
357
  padding: 16px 12px;
@@ -348,6 +378,7 @@ function styles(options) {
348
378
  margin: 12px;
349
379
  border-radius: 8px;
350
380
  box-shadow: 0 1px 0.5px rgba(0, 0, 0, 0.13);
381
+ flex-shrink: 0;
351
382
  }
352
383
 
353
384
  .pp-date-separator {
@@ -355,6 +386,7 @@ function styles(options) {
355
386
  align-items: center;
356
387
  justify-content: center;
357
388
  margin: 12px 0;
389
+ flex-shrink: 0;
358
390
  }
359
391
 
360
392
  .pp-date-separator span {
@@ -377,6 +409,7 @@ function styles(options) {
377
409
  overflow: hidden; /* Prevent horizontal overflow */
378
410
  touch-action: pan-y; /* Only vertical scroll */
379
411
  max-width: 100%;
412
+ flex-shrink: 0; /* Never shrink - maintain natural size for scrolling */
380
413
  }
381
414
 
382
415
  .pp-swipe-left {
@@ -460,6 +493,7 @@ function styles(options) {
460
493
  display: block; /* Block for proper float behavior */
461
494
  will-change: transform;
462
495
  box-shadow: 0 1px 0.5px rgba(0, 0, 0, 0.13);
496
+ flex-shrink: 0; /* Never shrink - for typing indicator which is direct child */
463
497
  }
464
498
 
465
499
  .pp-message-visitor {
@@ -639,6 +673,7 @@ function styles(options) {
639
673
  gap: 8px;
640
674
  background: ${resolvedFooterColor};
641
675
  align-items: flex-end;
676
+ flex-shrink: 0; /* Never shrink */
642
677
  }
643
678
 
644
679
  .pp-input {
@@ -711,6 +746,7 @@ function styles(options) {
711
746
  font-size: 10px;
712
747
  color: ${isDark ? "#8696a0" : "#667781"};
713
748
  background: ${resolvedFooterColor};
749
+ flex-shrink: 0; /* Never shrink */
714
750
  }
715
751
 
716
752
  .pp-footer a {
@@ -2090,6 +2126,29 @@ function ChatWidget({ client: client2, config: initialConfig }) {
2090
2126
  };
2091
2127
  }
2092
2128
  }, [isOpen]);
2129
+ const [viewportStyle, setViewportStyle] = (0, import_hooks2.useState)(null);
2130
+ (0, import_hooks2.useEffect)(() => {
2131
+ const isMobile = window.innerWidth <= 480;
2132
+ if (!isOpen || !isMobile) {
2133
+ setViewportStyle(null);
2134
+ return;
2135
+ }
2136
+ const vv = window.visualViewport;
2137
+ if (!vv) return;
2138
+ const handleViewportChange = () => {
2139
+ setViewportStyle({
2140
+ height: vv.height,
2141
+ top: vv.offsetTop
2142
+ });
2143
+ };
2144
+ handleViewportChange();
2145
+ vv.addEventListener("resize", handleViewportChange);
2146
+ vv.addEventListener("scroll", handleViewportChange);
2147
+ return () => {
2148
+ vv.removeEventListener("resize", handleViewportChange);
2149
+ vv.removeEventListener("scroll", handleViewportChange);
2150
+ };
2151
+ }, [isOpen]);
2093
2152
  (0, import_hooks2.useEffect)(() => {
2094
2153
  if (!isOpen && messages.length > 0) {
2095
2154
  const unread = messages.filter(
@@ -2439,6 +2498,12 @@ function ChatWidget({ client: client2, config: initialConfig }) {
2439
2498
  "div",
2440
2499
  {
2441
2500
  class: `pp-window pp-${position} pp-theme-${theme} ${isDragging ? "pp-dragging" : ""}`,
2501
+ style: viewportStyle ? {
2502
+ height: `${viewportStyle.height}px`,
2503
+ maxHeight: `${viewportStyle.height}px`,
2504
+ top: `${viewportStyle.top}px`,
2505
+ bottom: "auto"
2506
+ } : void 0,
2442
2507
  onDragEnter: handleDragEnter,
2443
2508
  onDragOver: handleDragOver,
2444
2509
  onDragLeave: handleDragLeave,
package/dist/index.js CHANGED
@@ -180,25 +180,51 @@ function styles(options) {
180
180
  /* Mobile: fullscreen widget to prevent scroll issues */
181
181
  @media (max-width: 480px) {
182
182
  .pp-window {
183
- position: fixed;
183
+ position: fixed !important;
184
+ /* No !important on top/bottom/height - controlled by JS for keyboard handling */
184
185
  top: 0;
185
- left: 0;
186
- right: 0;
187
- bottom: 0;
188
- width: 100%;
189
- height: 100%;
190
- max-height: 100%;
186
+ left: 0 !important;
187
+ right: 0 !important;
188
+ bottom: auto;
189
+ width: 100vw !important;
190
+ height: 100vh;
191
+ height: 100dvh;
192
+ max-width: 100vw !important;
193
+ max-height: 100vh;
191
194
  max-height: 100dvh;
192
- min-height: 100%;
193
- min-height: 100dvh;
194
- border-radius: 0;
195
- overflow: hidden;
196
- touch-action: none; /* Prevent page scroll behind widget */
195
+ min-height: 0; /* Allow shrinking for keyboard */
196
+ border-radius: 0 !important;
197
+ overflow: hidden !important;
198
+ touch-action: manipulation; /* Allow scroll and touch, prevent double-tap zoom */
199
+ margin: 0 !important;
200
+ padding: 0 !important;
201
+ box-sizing: border-box !important;
197
202
  }
198
203
 
199
- /* Prevent any horizontal scroll */
200
- .pp-window * {
201
- max-width: 100%;
204
+ /* Prevent any overflow */
205
+ .pp-window *,
206
+ .pp-window *::before,
207
+ .pp-window *::after {
208
+ max-width: 100% !important;
209
+ box-sizing: border-box !important;
210
+ }
211
+
212
+ /* Ensure messages area scrolls properly */
213
+ .pp-messages {
214
+ max-width: 100vw !important;
215
+ min-height: 0 !important; /* Allow shrinking for scroll */
216
+ overflow-x: hidden !important;
217
+ overflow-y: auto !important;
218
+ touch-action: pan-y !important; /* Enable vertical scrolling */
219
+ -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
220
+ }
221
+
222
+ /* Allow touch on input area for typing */
223
+ .pp-input-form,
224
+ .pp-input,
225
+ .pp-send-btn,
226
+ .pp-attach-btn {
227
+ touch-action: manipulation !important;
202
228
  }
203
229
  }
204
230
 
@@ -209,6 +235,9 @@ function styles(options) {
209
235
  padding: 10px 16px;
210
236
  background: ${resolvedHeaderColor};
211
237
  color: white;
238
+ flex-shrink: 0; /* Never shrink - always visible */
239
+ position: relative;
240
+ z-index: 10; /* Stay above messages during any scroll issues */
212
241
  }
213
242
 
214
243
  .pp-header-info {
@@ -281,6 +310,7 @@ function styles(options) {
281
310
 
282
311
  .pp-messages {
283
312
  flex: 1;
313
+ min-height: 0; /* Critical: allows flex child to shrink and enable scrolling */
284
314
  overflow-y: auto;
285
315
  overflow-x: hidden;
286
316
  padding: 16px 12px;
@@ -307,6 +337,7 @@ function styles(options) {
307
337
  margin: 12px;
308
338
  border-radius: 8px;
309
339
  box-shadow: 0 1px 0.5px rgba(0, 0, 0, 0.13);
340
+ flex-shrink: 0;
310
341
  }
311
342
 
312
343
  .pp-date-separator {
@@ -314,6 +345,7 @@ function styles(options) {
314
345
  align-items: center;
315
346
  justify-content: center;
316
347
  margin: 12px 0;
348
+ flex-shrink: 0;
317
349
  }
318
350
 
319
351
  .pp-date-separator span {
@@ -336,6 +368,7 @@ function styles(options) {
336
368
  overflow: hidden; /* Prevent horizontal overflow */
337
369
  touch-action: pan-y; /* Only vertical scroll */
338
370
  max-width: 100%;
371
+ flex-shrink: 0; /* Never shrink - maintain natural size for scrolling */
339
372
  }
340
373
 
341
374
  .pp-swipe-left {
@@ -419,6 +452,7 @@ function styles(options) {
419
452
  display: block; /* Block for proper float behavior */
420
453
  will-change: transform;
421
454
  box-shadow: 0 1px 0.5px rgba(0, 0, 0, 0.13);
455
+ flex-shrink: 0; /* Never shrink - for typing indicator which is direct child */
422
456
  }
423
457
 
424
458
  .pp-message-visitor {
@@ -598,6 +632,7 @@ function styles(options) {
598
632
  gap: 8px;
599
633
  background: ${resolvedFooterColor};
600
634
  align-items: flex-end;
635
+ flex-shrink: 0; /* Never shrink */
601
636
  }
602
637
 
603
638
  .pp-input {
@@ -670,6 +705,7 @@ function styles(options) {
670
705
  font-size: 10px;
671
706
  color: ${isDark ? "#8696a0" : "#667781"};
672
707
  background: ${resolvedFooterColor};
708
+ flex-shrink: 0; /* Never shrink */
673
709
  }
674
710
 
675
711
  .pp-footer a {
@@ -2049,6 +2085,29 @@ function ChatWidget({ client: client2, config: initialConfig }) {
2049
2085
  };
2050
2086
  }
2051
2087
  }, [isOpen]);
2088
+ const [viewportStyle, setViewportStyle] = useState2(null);
2089
+ useEffect2(() => {
2090
+ const isMobile = window.innerWidth <= 480;
2091
+ if (!isOpen || !isMobile) {
2092
+ setViewportStyle(null);
2093
+ return;
2094
+ }
2095
+ const vv = window.visualViewport;
2096
+ if (!vv) return;
2097
+ const handleViewportChange = () => {
2098
+ setViewportStyle({
2099
+ height: vv.height,
2100
+ top: vv.offsetTop
2101
+ });
2102
+ };
2103
+ handleViewportChange();
2104
+ vv.addEventListener("resize", handleViewportChange);
2105
+ vv.addEventListener("scroll", handleViewportChange);
2106
+ return () => {
2107
+ vv.removeEventListener("resize", handleViewportChange);
2108
+ vv.removeEventListener("scroll", handleViewportChange);
2109
+ };
2110
+ }, [isOpen]);
2052
2111
  useEffect2(() => {
2053
2112
  if (!isOpen && messages.length > 0) {
2054
2113
  const unread = messages.filter(
@@ -2398,6 +2457,12 @@ function ChatWidget({ client: client2, config: initialConfig }) {
2398
2457
  "div",
2399
2458
  {
2400
2459
  class: `pp-window pp-${position} pp-theme-${theme} ${isDragging ? "pp-dragging" : ""}`,
2460
+ style: viewportStyle ? {
2461
+ height: `${viewportStyle.height}px`,
2462
+ maxHeight: `${viewportStyle.height}px`,
2463
+ top: `${viewportStyle.top}px`,
2464
+ bottom: "auto"
2465
+ } : void 0,
2401
2466
  onDragEnter: handleDragEnter,
2402
2467
  onDragOver: handleDragOver,
2403
2468
  onDragLeave: handleDragLeave,