crisp-sdk-web
Advanced tools
Comparing version 1.0.13 to 1.0.14
@@ -373,3 +373,3 @@ var CrispMessage = /** @class */ (function () { | ||
// Prevents from loading Crisp twice | ||
if (this.isCrispInjected()) { | ||
if (this.isCrispInjected() === true) { | ||
return; | ||
@@ -417,2 +417,11 @@ } | ||
this.tokenId = tokenId; | ||
// Refresh injected token? | ||
if (this.isCrispInjected() === true) { | ||
if (tokenId) { | ||
window.CRISP_TOKEN_ID = tokenId; | ||
} | ||
else { | ||
delete window.CRISP_TOKEN_ID; | ||
} | ||
} | ||
}; | ||
@@ -467,3 +476,3 @@ Crisp.prototype.setZIndex = function (zIndex) { | ||
Crisp.prototype.autoInjectIfNecessasy = function () { | ||
if (!this.isCrispInjected()) { | ||
if (this.isCrispInjected() !== true) { | ||
this.load(); | ||
@@ -473,3 +482,8 @@ } | ||
Crisp.prototype.isCrispInjected = function () { | ||
return this.injected === true || (window.$crisp && window.$crisp.is); | ||
// Check if Crisp was injected (either from the Web SDK, or from another \ | ||
// source) | ||
if (this.injected === true || (window.$crisp && window.$crisp.is)) { | ||
return true; | ||
} | ||
return false; | ||
}; | ||
@@ -476,0 +490,0 @@ Crisp.prototype.deferredLoading = function () { |
@@ -379,3 +379,3 @@ (function (global, factory) { | ||
// Prevents from loading Crisp twice | ||
if (this.isCrispInjected()) { | ||
if (this.isCrispInjected() === true) { | ||
return; | ||
@@ -423,2 +423,11 @@ } | ||
this.tokenId = tokenId; | ||
// Refresh injected token? | ||
if (this.isCrispInjected() === true) { | ||
if (tokenId) { | ||
window.CRISP_TOKEN_ID = tokenId; | ||
} | ||
else { | ||
delete window.CRISP_TOKEN_ID; | ||
} | ||
} | ||
}; | ||
@@ -473,3 +482,3 @@ Crisp.prototype.setZIndex = function (zIndex) { | ||
Crisp.prototype.autoInjectIfNecessasy = function () { | ||
if (!this.isCrispInjected()) { | ||
if (this.isCrispInjected() !== true) { | ||
this.load(); | ||
@@ -479,3 +488,8 @@ } | ||
Crisp.prototype.isCrispInjected = function () { | ||
return this.injected === true || (window.$crisp && window.$crisp.is); | ||
// Check if Crisp was injected (either from the Web SDK, or from another \ | ||
// source) | ||
if (this.injected === true || (window.$crisp && window.$crisp.is)) { | ||
return true; | ||
} | ||
return false; | ||
}; | ||
@@ -482,0 +496,0 @@ Crisp.prototype.deferredLoading = function () { |
{ | ||
"name": "crisp-sdk-web", | ||
"version": "1.0.13", | ||
"version": "1.0.14", | ||
"description": "Include Crisp chat widget inside web frameworks.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -34,3 +34,3 @@ import {CrispClass as Crisp} from "./index"; | ||
unreadCount() : number { | ||
unreadCount(): number { | ||
if (!this.parent.isCrispInjected()) { | ||
@@ -43,3 +43,3 @@ return 0; | ||
isChatOpened() : boolean { | ||
isChatOpened(): boolean { | ||
if (!this.parent.isCrispInjected()) { | ||
@@ -52,3 +52,3 @@ return false; | ||
isVisible() : boolean { | ||
isVisible(): boolean { | ||
if (!this.parent.isCrispInjected()) { | ||
@@ -55,0 +55,0 @@ return false; |
@@ -144,3 +144,3 @@ import CrispMessage from "./message"; | ||
// Prevents from loading Crisp twice | ||
if (this.isCrispInjected()) { | ||
if (this.isCrispInjected() === true) { | ||
return; | ||
@@ -202,7 +202,16 @@ } | ||
setTokenId(tokenId : string) { | ||
setTokenId(tokenId: string) { | ||
this.tokenId = tokenId; | ||
// Refresh injected token? | ||
if (this.isCrispInjected() === true) { | ||
if (tokenId) { | ||
window.CRISP_TOKEN_ID = tokenId; | ||
} else { | ||
delete window.CRISP_TOKEN_ID; | ||
} | ||
} | ||
} | ||
setZIndex(zIndex : number) { | ||
setZIndex(zIndex: number) { | ||
this.createSingletonIfNecessary(); | ||
@@ -213,3 +222,3 @@ | ||
setColorTheme(color : ChatboxColors) { | ||
setColorTheme(color: ChatboxColors) { | ||
this.createSingletonIfNecessary(); | ||
@@ -220,3 +229,3 @@ | ||
setHideOnAway(enabled : boolean) { | ||
setHideOnAway(enabled: boolean) { | ||
this.createSingletonIfNecessary(); | ||
@@ -227,3 +236,3 @@ | ||
setHideOnMobile(enabled : boolean) { | ||
setHideOnMobile(enabled: boolean) { | ||
this.createSingletonIfNecessary(); | ||
@@ -234,3 +243,3 @@ | ||
setPosition(position : ChatboxPosition) { | ||
setPosition(position: ChatboxPosition) { | ||
this.createSingletonIfNecessary(); | ||
@@ -241,3 +250,3 @@ | ||
setAvailabilityTooltip(enabled : boolean) { | ||
setAvailabilityTooltip(enabled: boolean) { | ||
this.createSingletonIfNecessary(); | ||
@@ -248,3 +257,3 @@ | ||
setVacationMode(enabled : boolean) { | ||
setVacationMode(enabled: boolean) { | ||
this.createSingletonIfNecessary(); | ||
@@ -261,3 +270,3 @@ | ||
muteSound(mute : boolean) { | ||
muteSound(mute: boolean) { | ||
this.createSingletonIfNecessary(); | ||
@@ -268,3 +277,3 @@ | ||
toggleOperatorCount(enabled : boolean) { | ||
toggleOperatorCount(enabled: boolean) { | ||
this.createSingletonIfNecessary(); | ||
@@ -282,4 +291,4 @@ | ||
autoInjectIfNecessasy(){ | ||
if (!this.isCrispInjected()) { | ||
autoInjectIfNecessasy() { | ||
if (this.isCrispInjected() !== true) { | ||
this.load(); | ||
@@ -289,4 +298,10 @@ } | ||
isCrispInjected() : boolean { | ||
return this.injected === true || (window.$crisp && window.$crisp.is); | ||
isCrispInjected(): boolean { | ||
// Check if Crisp was injected (either from the Web SDK, or from another \ | ||
// source) | ||
if (this.injected === true || (window.$crisp && window.$crisp.is)) { | ||
return true; | ||
} | ||
return false; | ||
} | ||
@@ -293,0 +308,0 @@ |
@@ -126,3 +126,3 @@ | ||
onMessageSent(callback : Function) { | ||
onMessageSent(callback: Function) { | ||
this.parent.createSingletonIfNecessary(); | ||
@@ -134,3 +134,3 @@ | ||
onMessageReceived(callback : Function) { | ||
onMessageReceived(callback: Function) { | ||
this.parent.createSingletonIfNecessary(); | ||
@@ -142,3 +142,3 @@ | ||
onMessageComposeSent(callback : Function) { | ||
onMessageComposeSent(callback: Function) { | ||
this.parent.createSingletonIfNecessary(); | ||
@@ -150,3 +150,3 @@ | ||
onMessageComposeReceive(callback : Function) { | ||
onMessageComposeReceive(callback: Function) { | ||
this.parent.createSingletonIfNecessary(); | ||
@@ -168,2 +168,2 @@ | ||
FieldMessage | ||
} | ||
} |
@@ -55,3 +55,3 @@ import {CrispClass as Crisp} from "./index"; | ||
getData(key: string) : string | boolean | number | undefined { | ||
getData(key: string): string | boolean | number | undefined { | ||
if (!this.parent.isCrispInjected()) { | ||
@@ -64,3 +64,3 @@ return undefined; | ||
getIdentifier() : string | null { | ||
getIdentifier(): string | null { | ||
if (!this.parent.isCrispInjected()) { | ||
@@ -81,3 +81,3 @@ return null; | ||
private isValidDataValue(value: string) : boolean { | ||
private isValidDataValue(value: string): boolean { | ||
return ( | ||
@@ -95,2 +95,2 @@ typeof value === "string" || | ||
EventsColors | ||
} | ||
} |
@@ -51,4 +51,4 @@ import {CrispClass as Crisp} from "./index"; | ||
setCompany(name : string, data: CompanyData) { | ||
const _payload : CompanyData = {}; | ||
setCompany(name: string, data: CompanyData) { | ||
const _payload: CompanyData = {}; | ||
@@ -78,3 +78,3 @@ if (data && data.url) { | ||
getEmail() : string | null { | ||
getEmail(): string | null { | ||
if (!this.parent.isCrispInjected()) { | ||
@@ -87,3 +87,3 @@ return null; | ||
getPhone() : string | null { | ||
getPhone(): string | null { | ||
if (!this.parent.isCrispInjected()) { | ||
@@ -96,3 +96,3 @@ return null; | ||
getNickname() : string | null{ | ||
getNickname(): string | null{ | ||
if (!this.parent.isCrispInjected()) { | ||
@@ -105,3 +105,3 @@ return null; | ||
getAvatar() : string | null { | ||
getAvatar(): string | null { | ||
if (!this.parent.isCrispInjected()) { | ||
@@ -114,3 +114,3 @@ return null; | ||
getCompany() : object | null { | ||
getCompany(): object | null { | ||
if (!this.parent.isCrispInjected()) { | ||
@@ -123,3 +123,3 @@ return null; | ||
onEmailChanged(callback : Function) { | ||
onEmailChanged(callback: Function) { | ||
if (this.parent.isCrispInjected()) { | ||
@@ -131,3 +131,3 @@ window.$crisp.push(["off", "user:email:changed"]); | ||
onPhoneChanged(callback : Function) { | ||
onPhoneChanged(callback: Function) { | ||
if (this.parent.isCrispInjected()) { | ||
@@ -139,3 +139,3 @@ window.$crisp.push(["off", "user:phone:changed"]); | ||
onNicknameChanged(callback : Function) { | ||
onNicknameChanged(callback: Function) { | ||
if (this.parent.isCrispInjected()) { | ||
@@ -147,3 +147,3 @@ window.$crisp.push(["off", "user:nickname:changed"]); | ||
onAvatarChanged(callback : Function) { | ||
onAvatarChanged(callback: Function) { | ||
if (this.parent.isCrispInjected()) { | ||
@@ -162,2 +162,2 @@ window.$crisp.push(["off", "user:avatar:changed"]); | ||
CompanyDataGeolocation | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
143934
1850