@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/widget.global.js
CHANGED
|
@@ -5963,6 +5963,16 @@
|
|
|
5963
5963
|
setMetadata(data) {
|
|
5964
5964
|
metadata.value = { ...metadata.value, ...data };
|
|
5965
5965
|
},
|
|
5966
|
+
async logout() {
|
|
5967
|
+
isOpen.value = false;
|
|
5968
|
+
currentUser.value = null;
|
|
5969
|
+
metadata.value = {};
|
|
5970
|
+
resetRouter();
|
|
5971
|
+
SocketService.disconnect();
|
|
5972
|
+
VisitorService.clear();
|
|
5973
|
+
await VisitorService.init();
|
|
5974
|
+
await SocketService.connect();
|
|
5975
|
+
},
|
|
5966
5976
|
shutdown() {
|
|
5967
5977
|
J(null, mountPoint);
|
|
5968
5978
|
host.remove();
|
|
@@ -5982,16 +5992,17 @@
|
|
|
5982
5992
|
var controller = null;
|
|
5983
5993
|
var bootPromise = null;
|
|
5984
5994
|
var Spacinbox = {
|
|
5985
|
-
boot(options) {
|
|
5995
|
+
async boot(options) {
|
|
5986
5996
|
if (typeof document === "undefined") {
|
|
5987
|
-
return Promise.resolve();
|
|
5997
|
+
return Promise.resolve({ success: false });
|
|
5988
5998
|
}
|
|
5989
5999
|
if (bootPromise) {
|
|
5990
6000
|
return bootPromise;
|
|
5991
6001
|
}
|
|
5992
6002
|
bootPromise = mountWidget(options).then((instance) => {
|
|
5993
6003
|
controller = instance;
|
|
5994
|
-
|
|
6004
|
+
return { success: true };
|
|
6005
|
+
}).catch(() => ({ success: false }));
|
|
5995
6006
|
return bootPromise;
|
|
5996
6007
|
},
|
|
5997
6008
|
async identify(user) {
|
|
@@ -6000,6 +6011,9 @@
|
|
|
6000
6011
|
}
|
|
6001
6012
|
return controller.identify(user);
|
|
6002
6013
|
},
|
|
6014
|
+
async logout() {
|
|
6015
|
+
return controller?.logout();
|
|
6016
|
+
},
|
|
6003
6017
|
setMetadata(data) {
|
|
6004
6018
|
controller?.setMetadata(data);
|
|
6005
6019
|
},
|