Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/renaming api name #5

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 40 additions & 40 deletions addon/components/tawk-messenger.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,122 +61,122 @@ export default class TawkMessengerComponent extends Component {
*/
mapListeners() {
window.addEventListener('tawkLoad', () => {
if (this.args.onLoad) {
this.args.onLoad();
if (this.args.tawkOnLoad) {
this.args.tawkOnLoad();
}
});

window.addEventListener('tawkStatusChange', (status) => {
if (this.args.onStatusChange) {
this.args.onStatusChange(status.detail);
if (this.args.tawkOnStatusChange) {
this.args.tawkOnStatusChange(status.detail);
}
});

window.addEventListener('tawkBeforeLoad', () => {
if (this.args.onBeforeLoad) {
this.args.onBeforeLoad();
if (this.args.tawkOnBeforeLoad) {
this.args.tawkOnBeforeLoad();
}
});

window.addEventListener('tawkChatMaximized', () => {
if (this.args.onChatMaximized) {
this.args.onChatMaximized();
if (this.args.tawkOnChatMaximized) {
this.args.tawkOnChatMaximized();
}
});

window.addEventListener('tawkChatMinimized', () => {
if (this.args.onChatMinimized) {
this.args.onChatMinimized();
if (this.args.tawkOnChatMinimized) {
this.args.tawkOnChatMinimized();
}
});

window.addEventListener('tawkChatHidden', () => {
if (this.args.onChatHidden) {
this.args.onChatHidden();
if (this.args.tawkOnChatHidden) {
this.args.tawkOnChatHidden();
}
});

window.addEventListener('tawkChatStarted', () => {
if (this.args.onChatStarted) {
this.args.onChatStarted();
if (this.args.tawkOnChatStarted) {
this.args.tawkOnChatStarted();
}
});

window.addEventListener('tawkChatEnded', () => {
if (this.args.onChatEnded) {
this.args.onChatEnded();
if (this.args.tawkOnChatEnded) {
this.args.tawkOnChatEnded();
}
});

window.addEventListener('tawkPrechatSubmit', (data) => {
if (this.args.onPrechatSubmit) {
this.args.onPrechatSubmit(data.detail);
if (this.args.tawkOnPrechatSubmit) {
this.args.tawkOnPrechatSubmit(data.detail);
}
});

window.addEventListener('tawkOfflineSubmit', (data) => {
if (this.args.onOfflineSubmit) {
this.args.onOfflineSubmit(data.detail);
if (this.args.tawkOnOfflineSubmit) {
this.args.tawkOnOfflineSubmit(data.detail);
}
});

window.addEventListener('tawkChatMessageVisitor', (message) => {
if (this.args.onChatMessageVisitor) {
this.args.onChatMessageVisitor(message.detail);
if (this.args.tawkOnChatMessageVisitor) {
this.args.tawkOnChatMessageVisitor(message.detail);
}
});

window.addEventListener('tawkChatMessageAgent', (message) => {
if (this.args.onChatMessageAgent) {
this.args.onChatMessageAgent(message.detail);
if (this.args.tawkOnChatMessageAgent) {
this.args.tawkOnChatMessageAgent(message.detail);
}
});

window.addEventListener('tawkChatMessageSystem', (message) => {
if (this.args.onChatMessageSystem) {
this.args.onChatMessageSystem(message.detail);
if (this.args.tawkOnChatMessageSystem) {
this.args.tawkOnChatMessageSystem(message.detail);
}
});

window.addEventListener('tawkAgentJoinChat', (data) => {
if (this.args.onAgentJoinChat) {
this.args.onAgentJoinChat(data.detail);
if (this.args.tawkOnAgentJoinChat) {
this.args.tawkOnAgentJoinChat(data.detail);
}
});

window.addEventListener('tawkAgentLeaveChat', (data) => {
if (this.args.onAgentLeaveChat) {
this.args.onAgentLeaveChat(data.detail);
if (this.args.tawkOnAgentLeaveChat) {
this.args.tawkOnAgentLeaveChat(data.detail);
}
});

window.addEventListener('tawkChatSatisfaction', (satisfaction) => {
if (this.args.onChatSatisfaction) {
this.args.onChatSatisfaction(satisfaction.detail);
if (this.args.tawkOnChatSatisfaction) {
this.args.tawkOnChatSatisfaction(satisfaction.detail);
}
});

window.addEventListener('tawkVisitorNameChanged', (visitorName) => {
if (this.args.onVisitorNameChanged) {
this.args.onVisitorNameChanged(visitorName.detail);
if (this.args.tawkOnVisitorNameChanged) {
this.args.tawkOnVisitorNameChanged(visitorName.detail);
}
});

window.addEventListener('tawkFileUpload', (link) => {
if (this.args.onFileUpload) {
this.args.onFileUpload(link.detail);
if (this.args.tawkOnFileUpload) {
this.args.tawkOnFileUpload(link.detail);
}
});

window.addEventListener('tawkTagsUpdated', (data) => {
if (this.args.onTagsUpdated) {
this.args.onTagsUpdated(data.detail);
if (this.args.tawkOnTagsUpdated) {
this.args.tawkOnTagsUpdated(data.detail);
}
});

window.addEventListener('tawkUnreadCountChanged', (data) => {
if (this.args.onUnreadCountChanged) {
this.args.onUnreadCountChanged(data.detail);
if (this.args.tawkOnUnreadCountChanged) {
this.args.tawkOnUnreadCountChanged(data.detail);
}
});
}
Expand Down
46 changes: 23 additions & 23 deletions addon/services/tawk-messenger.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,101 +13,101 @@ export default class TawkMessenger extends Service {
/**
* API for calling an action on the widget
*/
maximize() {
tawkMaximize() {
return window.Tawk_API.maximize();
}

minimize() {
tawkMinimize() {
return window.Tawk_API.minimize();
}

toggle() {
tawkToggle() {
return window.Tawk_API.toggle();
}

popup() {
tawkPopup() {
return window.Tawk_API.popup();
}

showWidget() {
tawkShowWidget() {
return window.Tawk_API.showWidget();
}

hideWidget() {
tawkHideWidget() {
return window.Tawk_API.hideWidget();
}

toggleVisibility() {
tawkToggleVisibility() {
return window.Tawk_API.toggleVisibility();
}

endChat() {
tawkEndChat() {
return window.Tawk_API.endChat();
}

/**
* API for returning a data
*/
getWindowType() {
tawkGetWindowType() {
return window.Tawk_API.getWindowType();
}

getStatus() {
tawkGetStatus() {
return window.Tawk_API.getStatus();
}

isChatMaximized() {
tawkIsChatMaximized() {
return window.Tawk_API.isChatMaximized();
}

isChatMinimized() {
tawkIsChatMinimized() {
return window.Tawk_API.isChatMinimized();
}

isChatHidden() {
tawkIsChatHidden() {
return window.Tawk_API.isChatHidden();
}

isChatOngoing() {
tawkIsChatOngoing() {
return window.Tawk_API.isChatOngoing();
}

isVisitorEngaged() {
tawkIsVisitorEngaged() {
return window.Tawk_API.isVisitorEngaged();
}

onLoaded() {
tawkOnLoaded() {
return window.Tawk_API.onLoaded;
}

onBeforeLoaded() {
tawkOnBeforeLoaded() {
return window.Tawk_API.onBeforeLoaded;
}

widgetPosition() {
tawkWidgetPosition() {
return window.Tawk_API.widgetPosition();
}

/**
* API for setting a data on the widget
*/
visitor(data) {
tawkvisitor(data) {
window.Tawk_API.visitor = data;
}
jaoaustero marked this conversation as resolved.
Show resolved Hide resolved

setAttributes(attribute, callback) {
tawkSetAttributes(attribute, callback) {
window.Tawk_API.setAttributes(attribute, callback);
}

addEvent(event, metadata, callback) {
tawkAddEvent(event, metadata, callback) {
window.Tawk_API.addEvent(event, metadata, callback);
}

addTags(tags, callback) {
tawkAddTags(tags, callback) {
window.Tawk_API.addTags(tags, callback);
}

removeTags(tags, callback) {
tawkRemoveTags(tags, callback) {
window.Tawk_API.removeTags(tags, callback);
}
}
Loading
Loading