@spacinbox/sdk 2.1.0 → 2.3.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.cjs +17 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +17 -3
- package/dist/index.js.map +1 -1
- package/dist/widget.global.js +17 -3
- package/dist/widget.global.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1448,6 +1448,16 @@ async function mountWidget(options) {
|
|
|
1448
1448
|
setMetadata(data) {
|
|
1449
1449
|
metadata.value = { ...metadata.value, ...data };
|
|
1450
1450
|
},
|
|
1451
|
+
async logout() {
|
|
1452
|
+
isOpen.value = false;
|
|
1453
|
+
currentUser.value = null;
|
|
1454
|
+
metadata.value = {};
|
|
1455
|
+
resetRouter();
|
|
1456
|
+
SocketService.disconnect();
|
|
1457
|
+
VisitorService.clear();
|
|
1458
|
+
await VisitorService.init();
|
|
1459
|
+
await SocketService.connect();
|
|
1460
|
+
},
|
|
1451
1461
|
shutdown() {
|
|
1452
1462
|
(0, import_preact2.render)(null, mountPoint);
|
|
1453
1463
|
host.remove();
|
|
@@ -1467,16 +1477,17 @@ async function mountWidget(options) {
|
|
|
1467
1477
|
var controller = null;
|
|
1468
1478
|
var bootPromise = null;
|
|
1469
1479
|
var Spacinbox = {
|
|
1470
|
-
boot(options) {
|
|
1480
|
+
async boot(options) {
|
|
1471
1481
|
if (typeof document === "undefined") {
|
|
1472
|
-
return Promise.resolve();
|
|
1482
|
+
return Promise.resolve({ success: false });
|
|
1473
1483
|
}
|
|
1474
1484
|
if (bootPromise) {
|
|
1475
1485
|
return bootPromise;
|
|
1476
1486
|
}
|
|
1477
1487
|
bootPromise = mountWidget(options).then((instance) => {
|
|
1478
1488
|
controller = instance;
|
|
1479
|
-
|
|
1489
|
+
return { success: true };
|
|
1490
|
+
}).catch(() => ({ success: false }));
|
|
1480
1491
|
return bootPromise;
|
|
1481
1492
|
},
|
|
1482
1493
|
async identify(user) {
|
|
@@ -1485,6 +1496,9 @@ var Spacinbox = {
|
|
|
1485
1496
|
}
|
|
1486
1497
|
return controller.identify(user);
|
|
1487
1498
|
},
|
|
1499
|
+
async logout() {
|
|
1500
|
+
return controller?.logout();
|
|
1501
|
+
},
|
|
1488
1502
|
setMetadata(data) {
|
|
1489
1503
|
controller?.setMetadata(data);
|
|
1490
1504
|
},
|