Last active
November 20, 2017 13:22
-
-
Save funkyidol/bfed20368d8e5db55b6a2c04dfbb6c1a to your computer and use it in GitHub Desktop.
Applozic Web chat Integration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface AppLozicStatic { | |
initPlugin(): any; | |
} | |
declare var AppLozic : AppLozicStatic; | |
export = AppLozic; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <reference path ="./jquery.d.ts"/> | |
(function () { | |
var root = this; | |
var AppLozic = function (obj) { | |
if (obj instanceof AppLozic) return obj; | |
if (!(this instanceof AppLozic)) return new AppLozic(obj); | |
// this.EXIFwrapped = obj; | |
}; | |
if (typeof exports !== 'undefined') { | |
if (typeof module !== 'undefined' && module.exports) { | |
exports = module.exports = AppLozic; | |
} | |
exports.AppLozic = AppLozic; | |
} else { | |
root.AppLozic = AppLozic; | |
} | |
AppLozic.initPlugin = function () { | |
var $original; | |
// var $applozic = ""; | |
var $applozic; | |
console.log("initPlugin"); | |
$original = jQuery.noConflict(true); | |
$ = $original; | |
jQuery = $original; | |
if (typeof jQuery !== 'undefined') { | |
console.log("initPlugin 1"); | |
$applozic = jQuery.noConflict(true); | |
$applozic.fn | |
.applozic({ | |
baseUrl : 'https://apps.applozic.com', | |
userId : 'debug454545', //TODO: replace userId with actual UserId | |
userName : 'test', //TODO: replace userId with actual UserName | |
appId : 'applozic-sample-app', | |
// accessToken: 'suraj', //TODO: set user access token.for new user it will create new access token | |
ojq: $original, | |
// obsm: oModal, | |
//optional, leave it blank for testing purpose, read this if you want to add additional security by verifying password from your server https://www.applozic.com/docs/configuration.html#access-token-url | |
// authenticationTypeId: 1, //1 for password verification from Applozic server and 0 for access Token verification from your server | |
// autoTypeSearchEnabled : false, | |
// messageBubbleAvator: true, | |
notificationIconLink: "https://www.applozic.com/resources/images/applozic_icon.png", | |
notificationSoundLink: "", | |
readConversation: readMessage, // readMessage function defined above | |
onInit: onInitialize, //callback function execute on plugin initialize | |
maxAttachmentSize: 25, //max attachment size in MB | |
desktopNotification: true, | |
locShare: true, | |
video: true, | |
topicBox: true, | |
// mapStaticAPIkey: "AIzaSyCWRScTDtbt8tlXDr6hiceCsU83aS2UuZw", | |
// googleApiKey: "AIzaSyDKfWHzu9X7Z2hByeW4RRFJrD9SizOzZt4" // replace it with your Google API key | |
// initAutoSuggestions : initAutoSuggestions // function to enable auto suggestions | |
}); | |
} | |
var oModal = ""; | |
/*if (typeof $original !== 'undefined') { | |
$ = $original; | |
jQuery = $original; | |
if (typeof $.fn.modal === 'function') { | |
oModal = $.fn.modal.noConflict(); | |
} | |
} else { | |
$ = $applozic; | |
jQuery = $applozic; | |
if (typeof $applozic.fn.modal === 'function') { | |
oModal = $applozic.fn.modal.noConflict(); | |
} | |
}*/ | |
//Sample json contains display name and photoLink for userId | |
function readMessage() { | |
//console.log(userId); | |
} | |
//callback function execute after plugin initialize. | |
function onInitialize(response, data) { | |
if (response.status === 'success') { | |
// $applozic.fn.applozic('loadContacts', {'contacts':contactsJSON}); | |
// $applozic.fn.applozic('loadTab', 'shanki.connect'); | |
//write your logic exectute after plugin initialize. | |
alert("success"); | |
} else { | |
alert(response.errorMessage); | |
} | |
} | |
// init(); | |
}; | |
})(); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment