YetiForceCompany/YetiForceCRM

View on GitHub
public_html/layouts/basic/modules/MailIntegration/resources/outlookMessageCompose.min.js.map

Summary

Maintainability
Test Coverage
{"version":3,"file":"outlookMessageCompose.min.js","sources":["outlookMessageCompose.js"],"sourcesContent":["/* {[The file is published on the basis of YetiForce Public License 6.5 that can be found in the following directory: licenses/LicenseEN.txt or yetiforce.com]} */\n'use strict';\n\nwindow.MailIntegration_Compose = {\n\t/**\n\t * AppConnector wrapper\n\t *\n\t * @param   {object}  request\n\t *\n\t * @return  {object}           AppConnector object with done method\n\t */\n\tconnector(request) {\n\t\treturn AppConnector.request(request).fail((error) => {\n\t\t\tthis.showResponseMessage(false);\n\t\t});\n\t},\n\t/**\n\t * Show response message\n\t *\n\t * @param   {boolean}  success\n\t * @param   {string}  message\n\t */\n\tshowResponseMessage(success, message = '') {\n\t\tif (success) {\n\t\t\tOffice.context.mailbox.item.notificationMessages.replaceAsync('information', {\n\t\t\t\ttype: 'informationalMessage',\n\t\t\t\tmessage: message,\n\t\t\t\ticon: 'iconid',\n\t\t\t\tpersistent: false\n\t\t\t});\n\t\t} else {\n\t\t\tOffice.context.mailbox.item.notificationMessages.replaceAsync('error', {\n\t\t\t\ttype: 'errorMessage',\n\t\t\t\tmessage: app.vtranslate('JS_ERROR') + ' ' + message\n\t\t\t});\n\t\t}\n\t},\n\t/**\n\t * Registered autocomplete template\n\t *\n\t * @return  {object}  overwrite ui-autocomplete list item template\n\t */\n\tregisterAutocompleteTemplate() {\n\t\t$.widget('ui.autocomplete', $.ui.autocomplete, {\n\t\t\t_renderItem: function (ul, item) {\n\t\t\t\tlet listItemTemplate = (user) => {\n\t\t\t\t\treturn `<li class=\"c-search-item js-search-item\">\n\t\t\t\t\t<div class=\"\">\n\t\t\t\t\t\t\t\t<div class=\"row\">\n\t\t\t\t\t\t\t\t\t<div class=\"col-9 pr-0\">\n\t\t\t\t\t\t\t\t\t\t<div class=\"u-fs-14px\">${user.name}</div>\n\t\t\t\t\t\t\t\t\t\t<div class=\"c-search-item__mail small\">${user.mail}</div>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t<div class=\"col-3 pr-0 text-right\">\n\t\t\t\t\t\t\t\t\t\t<button class=\"c-search-item__btn btn btn-xs btn-outline-primary\" data-copy-target=\"cc\">${app.vtranslate(\n\t\t\t\t\t\t\t\t\t\t\t'JS_CC'\n\t\t\t\t\t\t\t\t\t\t)}</button>\n\t\t\t\t\t\t\t\t\t\t<button class=\"c-search-item__btn btn btn-xs btn-outline-primary\" data-copy-target=\"bcc\">${app.vtranslate(\n\t\t\t\t\t\t\t\t\t\t\t'JS_BCC'\n\t\t\t\t\t\t\t\t\t\t)}</button>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t</div></div>\n\t\t\t\t\t\t\t</li>`;\n\t\t\t\t};\n\t\t\t\treturn $(listItemTemplate(item)).appendTo(ul);\n\t\t\t}\n\t\t});\n\t},\n\t/**\n\t * Register autocomplete\n\t *\n\t * @return  {jQuery}  autocomplete instance\n\t */\n\tregisterAutocomplete() {\n\t\treturn this.container.find('.js-search-input').autocomplete({\n\t\t\tdelay: '600',\n\t\t\tminLength: '3',\n\t\t\tclasses: {\n\t\t\t\t'ui-autocomplete': 'mobile'\n\t\t\t},\n\t\t\tsource: function (request, response) {\n\t\t\t\twindow.MailIntegration_Compose.findEmail(request, response);\n\t\t\t},\n\t\t\tselect: function (e, ui) {\n\t\t\t\tlet toElement = 'to';\n\t\t\t\tif (e.target.dataset.copyTarget) {\n\t\t\t\t\ttoElement = e.target.dataset.copyTarget;\n\t\t\t\t} else if (e.originalEvent.target.dataset.copyTarget) {\n\t\t\t\t\ttoElement = e.originalEvent.target.dataset.copyTarget;\n\t\t\t\t} else if (e.originalEvent.originalEvent.target.dataset.copyTarget) {\n\t\t\t\t\ttoElement = e.originalEvent.originalEvent.target.dataset.copyTarget;\n\t\t\t\t}\n\t\t\t\twindow.MailIntegration_Compose.copyRecipient(toElement, [\n\t\t\t\t\t{\n\t\t\t\t\t\tdisplayName: ui.item.name,\n\t\t\t\t\t\temailAddress: ui.item.mail\n\t\t\t\t\t}\n\t\t\t\t]);\n\t\t\t}\n\t\t});\n\t},\n\t/**\n\t * Find mail action for autocomplete source\n\t *\n\t * @param   {object}  request   autocomplete param\n\t * @param   {fuction}  callBack  autocomplete callBack\n\t */\n\tfindEmail(request, callBack) {\n\t\tthis.connector({\n\t\t\tmodule: 'MailIntegration',\n\t\t\taction: 'Mail',\n\t\t\tmode: 'findEmail',\n\t\t\tsearch: request.term\n\t\t}).done((responseData) => {\n\t\t\tlet data = responseData.result.map((user) => {\n\t\t\t\tlet userData = user.split(' <');\n\t\t\t\tlet name = userData[0];\n\t\t\t\tlet mail = userData[1].slice(0, -1);\n\t\t\t\treturn { name, mail };\n\t\t\t});\n\t\t\tcallBack(data);\n\t\t});\n\t},\n\t/**\n\t * Copy recipient to outlook field\n\t *\n\t * @param   {string}  recipientsField  to, cc, bcc\n\t * @param   {object}  newRecipient\n\t */\n\tcopyRecipient(recipientsField, newRecipient) {\n\t\tOffice.context.mailbox.item[recipientsField].addAsync(newRecipient, function (result) {\n\t\t\tif (result.error) {\n\t\t\t\tOffice.context.mailbox.item.notificationMessages.replaceAsync('error', {\n\t\t\t\t\ttype: 'errorMessage',\n\t\t\t\t\tmessage: app.vtranslate('JS_ERROR') + ' ' + result.error\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\t},\n\tregisterEvents() {\n\t\tif (!$('.js-exception-error').length) {\n\t\t\tthis.container = $('#page');\n\t\t\tthis.registerAutocompleteTemplate();\n\t\t\tthis.registerAutocomplete();\n\t\t}\n\t}\n};\nif (typeof Office === 'undefined') {\n\tapp.showNotify({\n\t\ttitle: app.vtranslate('JS_ERROR'),\n\t\ttype: 'error'\n\t});\n} else {\n\t(function ($) {\n\t\tOffice.onReady((info) => {\n\t\t\tif (info.host === Office.HostType.Outlook) {\n\t\t\t\twindow.MailIntegration_Compose.registerEvents();\n\t\t\t}\n\t\t});\n\t})($);\n}\n"],"names":["window","MailIntegration_Compose","connector","request","_this","AppConnector","fail","showResponseMessage","success","message","arguments","length","Office","context","mailbox","item","notificationMessages","replaceAsync","type","icon","persistent","app","vtranslate","registerAutocompleteTemplate","$","widget","ui","autocomplete","_renderItem","ul","listItemTemplate","user","concat","name","mail","appendTo","registerAutocomplete","container","find","delay","minLength","classes","\"ui-autocomplete\"","source","response","findEmail","select","e","toElement","target","dataset","copyTarget","originalEvent","copyRecipient","displayName","emailAddress","callBack","module","action","mode","search","term","done","responseData","data","result","map","userData","split","slice","recipientsField","newRecipient","addAsync","error","registerEvents","showNotify","title","onReady","info","host","HostType","Outlook"],"mappings":";;AAAA,kKACA,YAAY,CAEZA,MAAM,CAACC,uBAAuB,CAAG;AAEjC;AACA;AACA;AACA;AACA;AACA,IACCC,SAAS,CAAA,SAAAA,SAACC,CAAAA,OAAO,CAAE,CAAA,IAAAC,KAAA,CAAA,IAAA,CAClB,OAAOC,YAAY,CAACF,OAAO,CAACA,OAAO,CAAC,CAACG,IAAI,CAAC,UAAW,CACpDF,KAAI,CAACG,mBAAmB,CAAM,CAAA,CAAA,EAC/B,CAAC,CACF,CAAC;AAEF;AACA;AACA;AACA;AACA,IACCA,mBAAmB,CAAAA,SAAAA,mBAAAA,CAACC,OAAO,CAAgB,CAAA,IAAdC,OAAO,CAAA,CAAA,CAAAC,SAAA,CAAAC,MAAA,EAAAD,SAAA,aAAAA,SAAA,CAAA,CAAA,CAAA,CAAG,EAAE,CACpCF,OAAO,CACVI,MAAM,CAACC,OAAO,CAACC,OAAO,CAACC,IAAI,CAACC,oBAAoB,CAACC,YAAY,CAAC,aAAa,CAAE,CAC5EC,IAAI,CAAE,sBAAsB,CAC5BT,OAAO,CAAEA,OAAO,CAChBU,IAAI,CAAE,QAAQ,CACdC,UAAU,CACX,CAAA,CAAA,CAAC,CAAC,CAEFR,MAAM,CAACC,OAAO,CAACC,OAAO,CAACC,IAAI,CAACC,oBAAoB,CAACC,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