@v-tilt/browser 1.4.7 → 1.5.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.
@@ -753,7 +753,7 @@ class LazyLoadedChat {
753
753
  }
754
754
  }
755
755
  _handleSend() {
756
- var _a;
756
+ var _a, _b;
757
757
  const input = (_a = this._widget) === null || _a === void 0 ? void 0 : _a.querySelector(".vtilt-chat-input");
758
758
  if (!input) {
759
759
  return;
@@ -770,6 +770,19 @@ class LazyLoadedChat {
770
770
  }
771
771
  this.sendMessage(content);
772
772
  input.value = "";
773
+ // Reset textarea height after sending
774
+ input.style.height = "auto";
775
+ input.style.height = "60px";
776
+ // Update send button state after sending
777
+ const sendButton = (_b = this._widget) === null || _b === void 0 ? void 0 : _b.querySelector(".vtilt-chat-send");
778
+ if (sendButton) {
779
+ const primary = this._theme.primaryColor;
780
+ sendButton.disabled = true;
781
+ sendButton.style.background = "#E5E5E5";
782
+ sendButton.style.color = "#999999";
783
+ sendButton.style.cursor = "not-allowed";
784
+ sendButton.style.opacity = "0.6";
785
+ }
773
786
  }
774
787
  }
775
788
  _updateUI() {
@@ -1151,60 +1164,134 @@ class LazyLoadedChat {
1151
1164
  </style>
1152
1165
 
1153
1166
  <div class="vtilt-chat-input-container" style="
1154
- padding: 12px 16px;
1155
- padding-bottom: max(12px, env(safe-area-inset-bottom, 12px));
1167
+ padding: 8px 12px;
1168
+ padding-bottom: max(8px, env(safe-area-inset-bottom, 8px));
1156
1169
  border-top: 1px solid #E5E5E5;
1157
- display: flex;
1158
- align-items: center;
1159
- gap: 12px;
1160
1170
  flex-shrink: 0;
1161
1171
  background: #ffffff;
1162
1172
  ">
1163
- <div style="flex: 1; min-width: 0;">
1164
- <input
1165
- type="text"
1173
+ <div style="
1174
+ position: relative;
1175
+ border: 1px solid #DDDDDD;
1176
+ border-radius: 12px;
1177
+ background: #ffffff;
1178
+ overflow: hidden;
1179
+ ">
1180
+ <textarea
1166
1181
  class="vtilt-chat-input"
1167
1182
  placeholder="Message..."
1168
1183
  autocomplete="off"
1169
1184
  autocorrect="on"
1170
1185
  autocapitalize="sentences"
1186
+ rows="1"
1171
1187
  style="
1172
1188
  width: 100%;
1173
1189
  box-sizing: border-box;
1174
- border: 1px solid #DDDDDD;
1175
- border-radius: 24px;
1176
- padding: 12px 18px;
1177
- font-size: 16px;
1190
+ border: none;
1191
+ border-radius: 0;
1192
+ padding: 12px 12px 36px 12px;
1193
+ font-size: 15px;
1178
1194
  line-height: 1.4;
1179
1195
  outline: none;
1180
- background: #ffffff;
1196
+ background: transparent;
1181
1197
  -webkit-appearance: none;
1182
1198
  appearance: none;
1183
1199
  color: #000000;
1184
- transition: border-color 0.15s ease, box-shadow 0.15s ease;
1200
+ transition: none;
1201
+ resize: none;
1202
+ overflow-y: auto;
1203
+ overflow-x: hidden;
1204
+ min-height: 60px;
1205
+ max-height: 120px;
1206
+ font-family: inherit;
1185
1207
  "
1186
- />
1208
+ ></textarea>
1209
+ <div style="
1210
+ position: absolute;
1211
+ left: 0;
1212
+ bottom: 0;
1213
+ display: flex;
1214
+ align-items: center;
1215
+ gap: 8px;
1216
+ padding: 8px 0 8px 10px;
1217
+ pointer-events: none;
1218
+ z-index: 1;
1219
+ ">
1220
+ <button
1221
+ class="vtilt-chat-attach"
1222
+ style="
1223
+ background: none;
1224
+ border: none;
1225
+ padding: 0;
1226
+ cursor: pointer;
1227
+ display: flex;
1228
+ align-items: center;
1229
+ justify-content: center;
1230
+ width: 20px;
1231
+ height: 20px;
1232
+ pointer-events: auto;
1233
+ color: #666666;
1234
+ transition: color 0.15s ease;
1235
+ "
1236
+ title="Attach file"
1237
+ >
1238
+ <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
1239
+ <path d="M21.44 11.05l-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48"></path>
1240
+ </svg>
1241
+ </button>
1242
+ <button
1243
+ class="vtilt-chat-mic"
1244
+ style="
1245
+ background: none;
1246
+ border: none;
1247
+ padding: 0;
1248
+ cursor: pointer;
1249
+ display: flex;
1250
+ align-items: center;
1251
+ justify-content: center;
1252
+ width: 20px;
1253
+ height: 20px;
1254
+ pointer-events: auto;
1255
+ color: #666666;
1256
+ transition: color 0.15s ease;
1257
+ "
1258
+ title="Voice message"
1259
+ >
1260
+ <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
1261
+ <path d="M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z"></path>
1262
+ <path d="M19 10v2a7 7 0 0 1-14 0v-2"></path>
1263
+ <line x1="12" y1="19" x2="12" y2="23"></line>
1264
+ <line x1="8" y1="23" x2="16" y2="23"></line>
1265
+ </svg>
1266
+ </button>
1267
+ </div>
1268
+ <button class="vtilt-chat-send" disabled style="
1269
+ position: absolute;
1270
+ right: 0;
1271
+ bottom: 0;
1272
+ background: #E5E5E5;
1273
+ color: #999999;
1274
+ border: none;
1275
+ border-radius: 50%;
1276
+ padding: 0;
1277
+ width: 32px;
1278
+ height: 32px;
1279
+ margin: 6px 8px 6px 6px;
1280
+ cursor: not-allowed;
1281
+ display: flex;
1282
+ align-items: center;
1283
+ justify-content: center;
1284
+ -webkit-tap-highlight-color: transparent;
1285
+ touch-action: manipulation;
1286
+ z-index: 2;
1287
+ transition: background-color 0.15s ease, color 0.15s ease, transform 0.1s ease, cursor 0.15s ease;
1288
+ opacity: 0.6;
1289
+ ">
1290
+ <svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor">
1291
+ <path d="M2.01 21L23 12 2.01 3 2 10l15 2-15 2z"/>
1292
+ </svg>
1293
+ </button>
1187
1294
  </div>
1188
- <button class="vtilt-chat-send" style="
1189
- background: ${primary};
1190
- color: white;
1191
- border: none;
1192
- border-radius: 50%;
1193
- padding: 0;
1194
- width: 44px;
1195
- height: 44px;
1196
- cursor: pointer;
1197
- display: flex;
1198
- align-items: center;
1199
- justify-content: center;
1200
- -webkit-tap-highlight-color: transparent;
1201
- touch-action: manipulation;
1202
- flex-shrink: 0;
1203
- ">
1204
- <svg width="20" height="20" viewBox="0 0 24 24" fill="white">
1205
- <path d="M2.01 21L23 12 2.01 3 2 10l15 2-15 2z"/>
1206
- </svg>
1207
- </button>
1208
1295
  </div>
1209
1296
  `;
1210
1297
  }
@@ -1221,16 +1308,85 @@ class LazyLoadedChat {
1221
1308
  });
1222
1309
  }
1223
1310
  _attachConversationListeners() {
1224
- var _a, _b, _c;
1225
- (_b = (_a = this._widget) === null || _a === void 0 ? void 0 : _a.querySelector(".vtilt-chat-send")) === null || _b === void 0 ? void 0 : _b.addEventListener("click", () => this._handleSend());
1226
- const input = (_c = this._widget) === null || _c === void 0 ? void 0 : _c.querySelector(".vtilt-chat-input");
1227
- input === null || input === void 0 ? void 0 : input.addEventListener("keypress", (e) => {
1311
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
1312
+ const sendButton = (_a = this._widget) === null || _a === void 0 ? void 0 : _a.querySelector(".vtilt-chat-send");
1313
+ sendButton === null || sendButton === void 0 ? void 0 : sendButton.addEventListener("click", () => {
1314
+ if (!sendButton.disabled) {
1315
+ this._handleSend();
1316
+ }
1317
+ });
1318
+ const input = (_b = this._widget) === null || _b === void 0 ? void 0 : _b.querySelector(".vtilt-chat-input");
1319
+ // Attachment button (placeholder for future functionality)
1320
+ (_d = (_c = this._widget) === null || _c === void 0 ? void 0 : _c.querySelector(".vtilt-chat-attach")) === null || _d === void 0 ? void 0 : _d.addEventListener("click", (e) => {
1321
+ e.preventDefault();
1322
+ alert("File attachments coming soon!");
1323
+ });
1324
+ // Emoji button (placeholder for future functionality)
1325
+ (_f = (_e = this._widget) === null || _e === void 0 ? void 0 : _e.querySelector(".vtilt-chat-emoji")) === null || _f === void 0 ? void 0 : _f.addEventListener("click", (e) => {
1326
+ e.preventDefault();
1327
+ // TODO: Implement emoji picker functionality
1328
+ console.log("Emoji clicked - functionality coming soon");
1329
+ });
1330
+ // GIF button (placeholder for future functionality)
1331
+ (_h = (_g = this._widget) === null || _g === void 0 ? void 0 : _g.querySelector(".vtilt-chat-gif")) === null || _h === void 0 ? void 0 : _h.addEventListener("click", (e) => {
1332
+ e.preventDefault();
1333
+ // TODO: Implement GIF picker functionality
1334
+ console.log("GIF clicked - functionality coming soon");
1335
+ });
1336
+ // Microphone button (placeholder for future functionality)
1337
+ (_k = (_j = this._widget) === null || _j === void 0 ? void 0 : _j.querySelector(".vtilt-chat-mic")) === null || _k === void 0 ? void 0 : _k.addEventListener("click", (e) => {
1338
+ e.preventDefault();
1339
+ alert("Voice messages coming soon!");
1340
+ });
1341
+ // Auto-resize textarea
1342
+ const autoResize = () => {
1343
+ if (input) {
1344
+ input.style.height = "auto";
1345
+ const scrollHeight = input.scrollHeight;
1346
+ const minHeight = 60;
1347
+ const maxHeight = 120;
1348
+ input.style.height = `${Math.min(Math.max(scrollHeight, minHeight), maxHeight)}px`;
1349
+ }
1350
+ };
1351
+ // Update send button state
1352
+ const primary = this._theme.primaryColor;
1353
+ const updateSendButton = () => {
1354
+ var _a;
1355
+ const sendButton = (_a = this._widget) === null || _a === void 0 ? void 0 : _a.querySelector(".vtilt-chat-send");
1356
+ if (sendButton && input) {
1357
+ const hasText = input.value.trim().length > 0;
1358
+ sendButton.disabled = !hasText;
1359
+ if (hasText) {
1360
+ sendButton.style.background = primary || "#E5E5E5";
1361
+ sendButton.style.color = "white";
1362
+ sendButton.style.cursor = "pointer";
1363
+ sendButton.style.opacity = "1";
1364
+ }
1365
+ else {
1366
+ sendButton.style.background = "#E5E5E5";
1367
+ sendButton.style.color = "#999999";
1368
+ sendButton.style.cursor = "not-allowed";
1369
+ sendButton.style.opacity = "0.6";
1370
+ }
1371
+ }
1372
+ };
1373
+ input === null || input === void 0 ? void 0 : input.addEventListener("input", () => {
1374
+ autoResize();
1375
+ this._handleUserTyping();
1376
+ updateSendButton();
1377
+ });
1378
+ // Keyboard handling: Enter sends, Shift+Enter creates new line
1379
+ input === null || input === void 0 ? void 0 : input.addEventListener("keydown", (e) => {
1228
1380
  if (e.key === "Enter" && !e.shiftKey) {
1229
1381
  e.preventDefault();
1230
1382
  this._handleSend();
1231
1383
  }
1232
1384
  });
1233
- input === null || input === void 0 ? void 0 : input.addEventListener("input", () => this._handleUserTyping());
1385
+ // Initial resize on mount
1386
+ if (input) {
1387
+ autoResize();
1388
+ updateSendButton();
1389
+ }
1234
1390
  }
1235
1391
  _formatRelativeTime(isoString) {
1236
1392
  const date = new Date(isoString);
@@ -1435,13 +1591,63 @@ class LazyLoadedChat {
1435
1591
  .vtilt-chat-close:hover { color: #000 !important; background: #F0F0F0 !important; }
1436
1592
  .vtilt-chat-back:hover { color: #000 !important; background: #F0F0F0 !important; }
1437
1593
 
1438
- .vtilt-chat-input { font-size: 16px !important; -webkit-text-size-adjust: 100%; transition: border-color 0.15s ease, box-shadow 0.15s ease; }
1439
- .vtilt-chat-input:focus { border-color: ${primary} !important; box-shadow: 0 0 0 2px ${primary}20 !important; outline: none !important; }
1440
- .vtilt-chat-input::placeholder { color: #999999; }
1594
+ .vtilt-chat-input-container > div:first-child:focus-within {
1595
+ border-color: ${primary} !important;
1596
+ box-shadow: 0 0 0 2px ${primary}20 !important;
1597
+ }
1598
+ .vtilt-chat-input {
1599
+ font-size: 16px !important;
1600
+ -webkit-text-size-adjust: 100%;
1601
+ }
1602
+ .vtilt-chat-input:focus {
1603
+ outline: none !important;
1604
+ }
1605
+ .vtilt-chat-input::placeholder {
1606
+ color: #999999;
1607
+ }
1608
+ .vtilt-chat-input::-webkit-scrollbar {
1609
+ width: 4px;
1610
+ }
1611
+ .vtilt-chat-input::-webkit-scrollbar-track {
1612
+ background: transparent;
1613
+ }
1614
+ .vtilt-chat-input::-webkit-scrollbar-thumb {
1615
+ background: rgba(0, 0, 0, 0.2);
1616
+ border-radius: 2px;
1617
+ }
1618
+ .vtilt-chat-input::-webkit-scrollbar-thumb:hover {
1619
+ background: rgba(0, 0, 0, 0.3);
1620
+ }
1621
+ /* Firefox scrollbar */
1622
+ .vtilt-chat-input {
1623
+ scrollbar-width: thin;
1624
+ scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
1625
+ }
1626
+ .vtilt-chat-attach:hover,
1627
+ .vtilt-chat-emoji:hover,
1628
+ .vtilt-chat-gif:hover,
1629
+ .vtilt-chat-mic:hover {
1630
+ color: #333333 !important;
1631
+ }
1632
+ .vtilt-chat-attach:active,
1633
+ .vtilt-chat-emoji:active,
1634
+ .vtilt-chat-gif:active,
1635
+ .vtilt-chat-mic:active {
1636
+ color: #000000 !important;
1637
+ }
1638
+ .vtilt-chat-send:not(:disabled):hover {
1639
+ opacity: 0.9 !important;
1640
+ transform: scale(1.05);
1641
+ }
1642
+ .vtilt-chat-send:not(:disabled):active {
1643
+ opacity: 0.8 !important;
1644
+ transform: scale(0.95);
1645
+ }
1646
+ .vtilt-chat-send:disabled {
1647
+ cursor: not-allowed !important;
1648
+ }
1441
1649
 
1442
1650
  .vtilt-chat-send { transition: opacity 0.1s ease; }
1443
- .vtilt-chat-send:hover { opacity: 0.85; }
1444
- .vtilt-chat-send:active { opacity: 0.7; }
1445
1651
 
1446
1652
  .vtilt-chat-new-channel { transition: opacity 0.1s ease; }
1447
1653
  .vtilt-chat-new-channel:hover { opacity: 0.9; }
@@ -24,7 +24,7 @@ const globals_1 = require("./globals");
24
24
  const user_agent_utils_1 = require("./user-agent-utils");
25
25
  const URL_REGEX_PREFIX = "https?://(.*)";
26
26
  // Library version - should match package.json version
27
- const LIB_VERSION = "1.0.7"; // TODO: Auto-import from package.json
27
+ const LIB_VERSION = "1.5.0"; // TODO: Auto-import from package.json
28
28
  // Campaign parameters that could be considered personal data (e.g., GDPR)
29
29
  // These can be masked in URLs and properties before being sent
30
30
  exports.PERSONAL_DATA_CAMPAIGN_PARAMS = [
package/lib/vtilt.d.ts CHANGED
@@ -4,7 +4,7 @@ import { SessionRecordingWrapper } from "./extensions/replay";
4
4
  import { ChatWrapper } from "./extensions/chat/chat-wrapper";
5
5
  import { type QueuedRequest } from "./request-queue";
6
6
  export declare class VTilt {
7
- readonly version = "1.1.5";
7
+ readonly version = "1.5.0";
8
8
  private configManager;
9
9
  private sessionManager;
10
10
  private userManager;
package/lib/vtilt.js CHANGED
@@ -34,7 +34,7 @@ const isArray = Array.isArray;
34
34
  class VTilt {
35
35
  constructor(config = {}) {
36
36
  // SDK version - injected at build time or defaults to package version
37
- this.version = "1.1.5";
37
+ this.version = "1.5.0";
38
38
  this.__loaded = false; // Matches snippet's window.vt.__loaded check
39
39
  this._initial_pageview_captured = false;
40
40
  this._visibility_state_listener = null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@v-tilt/browser",
3
- "version": "1.4.7",
3
+ "version": "1.5.0",
4
4
  "description": "vTilt browser tracking library",
5
5
  "main": "dist/main.js",
6
6
  "module": "dist/module.js",