@blockspark/chat-widget 1.0.16 → 1.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.
- package/dist/{ChatWidget-CFvb5g7s.js → ChatWidget-DKfLes8T.js} +2 -2
- package/dist/{ChatWidget-CFvb5g7s.js.map → ChatWidget-DKfLes8T.js.map} +1 -1
- package/dist/{ChatWidget-CdA7TymM.cjs → ChatWidget-lvHzA07s.cjs} +2 -2
- package/dist/{ChatWidget-CdA7TymM.cjs.map → ChatWidget-lvHzA07s.cjs.map} +1 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/nuxt.cjs.js +1 -1
- package/dist/nuxt.esm.js +2 -2
- package/dist/{sanitize-DRKcO9o5.cjs → sanitize-D904jROs.cjs} +3 -3
- package/dist/sanitize-D904jROs.cjs.map +1 -0
- package/dist/{sanitize-NEykcppO.js → sanitize-O18C3eqP.js} +121 -8
- package/dist/sanitize-O18C3eqP.js.map +1 -0
- package/dist/services/chatService.d.ts.map +1 -1
- package/dist/vue.cjs.js +1 -1
- package/dist/vue.esm.js +2 -2
- package/package.json +1 -1
- package/dist/sanitize-DRKcO9o5.cjs.map +0 -1
- package/dist/sanitize-NEykcppO.js.map +0 -1
|
@@ -1358,11 +1358,31 @@ class ChatService {
|
|
|
1358
1358
|
body: JSON.stringify(body)
|
|
1359
1359
|
});
|
|
1360
1360
|
if (!response.ok) {
|
|
1361
|
-
const
|
|
1361
|
+
const contentType2 = response.headers.get("content-type");
|
|
1362
|
+
let error = {};
|
|
1363
|
+
if (contentType2 && contentType2.includes("application/json")) {
|
|
1364
|
+
try {
|
|
1365
|
+
error = await response.json();
|
|
1366
|
+
} catch {
|
|
1367
|
+
error = {};
|
|
1368
|
+
}
|
|
1369
|
+
} else {
|
|
1370
|
+
const text2 = await response.text();
|
|
1371
|
+
throw new Error(
|
|
1372
|
+
`API endpoint returned HTML instead of JSON. Status: ${response.status}. This usually means the endpoint doesn't exist or the server is misconfigured. URL: ${this.baseUrl}/api/support/chat/start`
|
|
1373
|
+
);
|
|
1374
|
+
}
|
|
1362
1375
|
throw new Error(
|
|
1363
1376
|
error.message || `HTTP error! status: ${response.status}`
|
|
1364
1377
|
);
|
|
1365
1378
|
}
|
|
1379
|
+
const contentType = response.headers.get("content-type");
|
|
1380
|
+
if (!contentType || !contentType.includes("application/json")) {
|
|
1381
|
+
const text2 = await response.text();
|
|
1382
|
+
throw new Error(
|
|
1383
|
+
`API endpoint returned non-JSON response. Status: ${response.status}. Content-Type: ${contentType || "unknown"}. This usually means the endpoint doesn't exist or the server is misconfigured. URL: ${this.baseUrl}/api/support/chat/start`
|
|
1384
|
+
);
|
|
1385
|
+
}
|
|
1366
1386
|
const data = await response.json();
|
|
1367
1387
|
this.sessionManager.updateSessionFromResponse(data);
|
|
1368
1388
|
if (data.status && data.data) {
|
|
@@ -1422,18 +1442,49 @@ class ChatService {
|
|
|
1422
1442
|
body: JSON.stringify(body)
|
|
1423
1443
|
}
|
|
1424
1444
|
);
|
|
1445
|
+
const contentType = response.headers.get("content-type");
|
|
1425
1446
|
if (response.status === 400 || response.status === 404) {
|
|
1426
|
-
|
|
1447
|
+
let error = {};
|
|
1448
|
+
if (contentType && contentType.includes("application/json")) {
|
|
1449
|
+
try {
|
|
1450
|
+
error = await response.json();
|
|
1451
|
+
} catch {
|
|
1452
|
+
error = {};
|
|
1453
|
+
}
|
|
1454
|
+
} else {
|
|
1455
|
+
const text2 = await response.text();
|
|
1456
|
+
throw new Error(
|
|
1457
|
+
`API endpoint returned HTML instead of JSON. Status: ${response.status}. This usually means the chat_id is invalid or the endpoint doesn't exist. URL: ${this.baseUrl}/api/support/chat/${chatId}/handoff`
|
|
1458
|
+
);
|
|
1459
|
+
}
|
|
1427
1460
|
throw new Error(
|
|
1428
1461
|
error.message || "Invalid chat_id. Chat may have expired."
|
|
1429
1462
|
);
|
|
1430
1463
|
}
|
|
1431
1464
|
if (!response.ok) {
|
|
1432
|
-
|
|
1465
|
+
let error = {};
|
|
1466
|
+
if (contentType && contentType.includes("application/json")) {
|
|
1467
|
+
try {
|
|
1468
|
+
error = await response.json();
|
|
1469
|
+
} catch {
|
|
1470
|
+
error = {};
|
|
1471
|
+
}
|
|
1472
|
+
} else {
|
|
1473
|
+
const text2 = await response.text();
|
|
1474
|
+
throw new Error(
|
|
1475
|
+
`API endpoint returned HTML instead of JSON. Status: ${response.status}. This usually means the endpoint doesn't exist or the server is misconfigured. URL: ${this.baseUrl}/api/support/chat/${chatId}/handoff`
|
|
1476
|
+
);
|
|
1477
|
+
}
|
|
1433
1478
|
throw new Error(
|
|
1434
1479
|
error.message || `HTTP error! status: ${response.status}`
|
|
1435
1480
|
);
|
|
1436
1481
|
}
|
|
1482
|
+
if (!contentType || !contentType.includes("application/json")) {
|
|
1483
|
+
const text2 = await response.text();
|
|
1484
|
+
throw new Error(
|
|
1485
|
+
`API endpoint returned non-JSON response. Status: ${response.status}. Content-Type: ${contentType || "unknown"}. This usually means the endpoint doesn't exist or the server is misconfigured. URL: ${this.baseUrl}/api/support/chat/${chatId}/handoff`
|
|
1486
|
+
);
|
|
1487
|
+
}
|
|
1437
1488
|
const data = await response.json();
|
|
1438
1489
|
this.sessionManager.updateSessionFromResponse(data);
|
|
1439
1490
|
if (data.status) {
|
|
@@ -1473,18 +1524,49 @@ class ChatService {
|
|
|
1473
1524
|
})
|
|
1474
1525
|
}
|
|
1475
1526
|
);
|
|
1527
|
+
const contentType = response.headers.get("content-type");
|
|
1476
1528
|
if (response.status === 401 || response.status === 404) {
|
|
1477
|
-
|
|
1529
|
+
let error = {};
|
|
1530
|
+
if (contentType && contentType.includes("application/json")) {
|
|
1531
|
+
try {
|
|
1532
|
+
error = await response.json();
|
|
1533
|
+
} catch {
|
|
1534
|
+
error = {};
|
|
1535
|
+
}
|
|
1536
|
+
} else {
|
|
1537
|
+
const text2 = await response.text();
|
|
1538
|
+
throw new Error(
|
|
1539
|
+
`API endpoint returned HTML instead of JSON. Status: ${response.status}. This usually means the chat_id is invalid or the endpoint doesn't exist. URL: ${this.baseUrl}/api/support/chat/${chatId}/message`
|
|
1540
|
+
);
|
|
1541
|
+
}
|
|
1478
1542
|
throw new Error(
|
|
1479
1543
|
error.message || "Chat not found or unauthorized"
|
|
1480
1544
|
);
|
|
1481
1545
|
}
|
|
1482
1546
|
if (!response.ok) {
|
|
1483
|
-
|
|
1547
|
+
let error = {};
|
|
1548
|
+
if (contentType && contentType.includes("application/json")) {
|
|
1549
|
+
try {
|
|
1550
|
+
error = await response.json();
|
|
1551
|
+
} catch {
|
|
1552
|
+
error = {};
|
|
1553
|
+
}
|
|
1554
|
+
} else {
|
|
1555
|
+
const text2 = await response.text();
|
|
1556
|
+
throw new Error(
|
|
1557
|
+
`API endpoint returned HTML instead of JSON. Status: ${response.status}. This usually means the endpoint doesn't exist or the server is misconfigured. URL: ${this.baseUrl}/api/support/chat/${chatId}/message`
|
|
1558
|
+
);
|
|
1559
|
+
}
|
|
1484
1560
|
throw new Error(
|
|
1485
1561
|
error.message || `HTTP error! status: ${response.status}`
|
|
1486
1562
|
);
|
|
1487
1563
|
}
|
|
1564
|
+
if (!contentType || !contentType.includes("application/json")) {
|
|
1565
|
+
const text2 = await response.text();
|
|
1566
|
+
throw new Error(
|
|
1567
|
+
`API endpoint returned non-JSON response. Status: ${response.status}. Content-Type: ${contentType || "unknown"}. This usually means the endpoint doesn't exist or the server is misconfigured. URL: ${this.baseUrl}/api/support/chat/${chatId}/message`
|
|
1568
|
+
);
|
|
1569
|
+
}
|
|
1488
1570
|
const data = await response.json();
|
|
1489
1571
|
this.sessionManager.updateSessionFromResponse(data);
|
|
1490
1572
|
if (data?.ignored === true && data?.reason === "chat_resolved") {
|
|
@@ -1547,18 +1629,49 @@ class ChatService {
|
|
|
1547
1629
|
headers
|
|
1548
1630
|
}
|
|
1549
1631
|
);
|
|
1632
|
+
const contentType = response.headers.get("content-type");
|
|
1550
1633
|
if (response.status === 401 || response.status === 404) {
|
|
1551
|
-
|
|
1634
|
+
let error = {};
|
|
1635
|
+
if (contentType && contentType.includes("application/json")) {
|
|
1636
|
+
try {
|
|
1637
|
+
error = await response.json();
|
|
1638
|
+
} catch {
|
|
1639
|
+
error = {};
|
|
1640
|
+
}
|
|
1641
|
+
} else {
|
|
1642
|
+
const text2 = await response.text();
|
|
1643
|
+
throw new Error(
|
|
1644
|
+
`API endpoint returned HTML instead of JSON. Status: ${response.status}. This usually means the chat_id is invalid or the endpoint doesn't exist. URL: ${this.baseUrl}/api/support/chat/${chatId}/messages`
|
|
1645
|
+
);
|
|
1646
|
+
}
|
|
1552
1647
|
throw new Error(
|
|
1553
1648
|
error.message || "Chat not found or unauthorized"
|
|
1554
1649
|
);
|
|
1555
1650
|
}
|
|
1556
1651
|
if (!response.ok) {
|
|
1557
|
-
|
|
1652
|
+
let error = {};
|
|
1653
|
+
if (contentType && contentType.includes("application/json")) {
|
|
1654
|
+
try {
|
|
1655
|
+
error = await response.json();
|
|
1656
|
+
} catch {
|
|
1657
|
+
error = {};
|
|
1658
|
+
}
|
|
1659
|
+
} else {
|
|
1660
|
+
const text2 = await response.text();
|
|
1661
|
+
throw new Error(
|
|
1662
|
+
`API endpoint returned HTML instead of JSON. Status: ${response.status}. This usually means the endpoint doesn't exist or the server is misconfigured. URL: ${this.baseUrl}/api/support/chat/${chatId}/messages`
|
|
1663
|
+
);
|
|
1664
|
+
}
|
|
1558
1665
|
throw new Error(
|
|
1559
1666
|
error.message || `HTTP error! status: ${response.status}`
|
|
1560
1667
|
);
|
|
1561
1668
|
}
|
|
1669
|
+
if (!contentType || !contentType.includes("application/json")) {
|
|
1670
|
+
const text2 = await response.text();
|
|
1671
|
+
throw new Error(
|
|
1672
|
+
`API endpoint returned non-JSON response. Status: ${response.status}. Content-Type: ${contentType || "unknown"}. This usually means the endpoint doesn't exist or the server is misconfigured. URL: ${this.baseUrl}/api/support/chat/${chatId}/messages`
|
|
1673
|
+
);
|
|
1674
|
+
}
|
|
1562
1675
|
const data = await response.json();
|
|
1563
1676
|
this.sessionManager.updateSessionFromResponse(data);
|
|
1564
1677
|
return data.messages || [];
|
|
@@ -2832,4 +2945,4 @@ export {
|
|
|
2832
2945
|
linkifyText as l,
|
|
2833
2946
|
sendDialogflowMessage as s
|
|
2834
2947
|
};
|
|
2835
|
-
//# sourceMappingURL=sanitize-
|
|
2948
|
+
//# sourceMappingURL=sanitize-O18C3eqP.js.map
|