diff --git a/tagteams/groups/th_content_scripts.js b/tagteams/groups/th_content_scripts.js new file mode 100644 index 0000000..9e76c91 --- /dev/null +++ b/tagteams/groups/th_content_scripts.js @@ -0,0 +1,2550 @@ +function th_tagTeamTDCXLoad() { + document.documentElement.setAttribute("data-hostname", window.location.hostname); + + // Libs + // Toastify + !function(t){var i=function(t){return new i.lib.init(t)};i.lib=i.prototype={toastify:"0.0.1",constructor:i,init:function(t){return t||(t={}),this.options={},this.options.text=t.text||"Hi there!",this.options.duration=t.duration||3e3,this.options.selector=t.selector,this.options.class=t.class || "",this.options.callback=t.callback||function(){},this},buildToast:function(){if(!this.options)throw"Toastify is not initialized";var t=document.createElement("div");return t.className="_panel_toastify on " + this.options.class,t.innerHTML=this.options.text,t.addEventListener("click",this.options.callback),t},showToast:function(){var t,o=this.buildToast();if(!(t=void 0===this.options.selector?document.body:document.getElementById(this.options.selector)))throw"Root element is not defined";return t.insertBefore(o,t.firstChild),i.reposition(),window.setTimeout((function(){o.classList.remove("on"),window.setTimeout((function(){o.remove(),i.reposition()}).bind(this),400)}).bind(this),this.options.duration),this}},i.reposition=function(){for(var t=15,i=document.getElementsByClassName("_panel_toastify"),o=0;o - 1) { + if(_datatemp.am_isgcc) { + noteBarAlert('Is GCC', _datatemp.case_id); + var elminputbcc = document.querySelector("email-address-input.bcc"); + if(elminputbcc) { + elminputbcc.classList.add("isgcc"); + } + } + + var is_precall = false; + document.querySelectorAll(".case-log-container.active-case-log-container case-message-view").forEach(function(elm){ + if(elm.innerText.includes("Emails or feedback from Advertiser")) { + is_precall = true; + } + }); + + if(is_precall === false) { + noteBarAlert('Missing Note precall', _datatemp.case_id); + + Toastify({ + text: 'Missing Note precall', + duration: 6000, + class: "error", + callback: function(){ + this.remove(); + } + }).showToast(); + } + + // Check email + cLog(() => {console.log("checkInputEmailInbox 1"); }); + checkInputEmailInbox(); + } + } + + // Noted + function notedByCase(_datatemp = {}) { + var lst_notification = ''; + + if(_datatemp.am_isgcc) { + lst_notification +=`

Is GCC?

`; + var elminputbcc = document.querySelector("email-address-input.bcc"); + if(elminputbcc) { + elminputbcc.classList.add("isgcc"); + } + } + + const staticHtmlPolicyv2 = trustedTypes.createPolicy( + 'foo-static', {createHTML: () => lst_notification}); + panel_div.querySelector("._panel__notification").innerHTML = staticHtmlPolicyv2.createHTML(''); + } + + + // innerText Case + function loadInfoCaseInnerTextElm (_panel, name, _value) { + try { + + // Input text, input date, textarea + _panel.querySelectorAll(` + [type="text"][name="${name}"], + [type="datetime-local"][name="${name}"], + textarea[name="${name}"]` + ).forEach(function(elm){ + elm.value = _value; + }); + + // div, span + _panel.querySelectorAll('[data-infocase="' + name + '"]').forEach(function(elm){ + elm.innerText = _value; + }); + _panel.querySelectorAll('[data-infocase_capitalize="' + name + '"]').forEach(function(elm){ + elm.innerText = capitalizeFirstLetter(_value); + }); + + _panel.querySelectorAll('[data-infocase_link="' + name + '"]').forEach(function(elm){ + elm.setAttribute("href", _value); + }); + + // checkbox + var _value_option = _value.split("\n")[0].trim(); + _panel.querySelectorAll('input[type="checkbox"][name="' + name + '"][value="' + _value_option + '"]').forEach(function(elm){ + elm.checked = true; + }); + + _value_option = _value.split("\n")[0].trim(); + _panel.querySelectorAll(`select[name="${name}"] > option[value="${_value_option}"]`).forEach(function(elm){ + elm.selected = true; + }); + } catch (error) { + console.log(error) + } + } + + + var saveCase2Storage = (formDataObj, _callback) => { + // ID trust + + if(formDataObj.case_id) { + if(getOnlyCaseId(formDataObj.case_id)) { + + // Save + var _time = +new Date(); + var case_id = formDataObj.case_id; + dataStatus.cdtx_lastupdate = _time; + + setChromeStorage('cdtx_datastatus', dataStatus); + setChromeStorage('cdtx_lastupdate', _time); + setChromeStorage('cdtx_lastupdate_caseid', case_id); + setChromeStorage('cdtx_caseid_' + case_id, formDataObj, _callback); + } + } + } + + + var saveSettings2Storage = (formDataObj, _callback) => { + + // Save + var _time = +new Date(); + dataStatus.cdtx_lastupdate = _time; + + setChromeStorage('cdtx_datastatus', dataStatus); + setChromeStorage('cdtx_lastupdate', _time); + setChromeStorage('cdtx_settings', formDataObj, _callback); + + } + +// =============================================== + + + // Is Ready Connect Case + function isReadyBasic(_callback, _n_once = 0) { + var n_time_dkneed = 0, + n_time_dkneed_compare = 0; + var is_ready = () => { + if(n_time_dkneed_compare < n_time_dkneed) return; + _callback(); + } + + n_time_dkneed++; + wait4Elem('[debug-id="case-id"] .case-id').then(function (elm) { + if(location.hash.includes(elm.innerText) === false) { + if(_n_once < 3) { + setTimeout(() => { + isReadyBasic(_callback, _n_once + 1); + }, 1000) + } + } else { + is_ready(n_time_dkneed_compare++); + cLog(() => {console.info(n_time_dkneed_compare , '=' , n_time_dkneed, '--- [debug-id="case-id"] .case-id bassic')}); + } + }); + + // has cuf-form-field + n_time_dkneed++; + wait4Elem("cuf-form-field").then(function () { + is_ready(n_time_dkneed_compare++); + cLog(() => {console.info(n_time_dkneed_compare , '=' , n_time_dkneed, '--- cuf-form-field - bassic')}); + }); + + + n_time_dkneed++; + wait4Elem("#read-card-tab-panel-case-log .case-log-container.active-case-log-container .activities > div").then((elm1) => { + is_ready(n_time_dkneed_compare++); + document.querySelector('[debug-id="dock-item-case-log"]').click(); + document.querySelector('[debug-id="dock-item-home"]').click(); + cLog(() => {console.info(n_time_dkneed_compare , '=' , n_time_dkneed, '--- click open tab case-log')}); + + }) + } + + +// Load Data Status Case List + function loadDataStatusCaseList(_callback) { + // Get Case List + // 1. load all + + chrome.storage.local.get(null, function(results) { + dataStatus.case_list = []; + for (let key in results) { + // 2. load only caselist + if(key.includes("cdtx_caseid_")) { + dataStatus.case_list.push(results[key]); + } + } + + // Load case + _callback(); + }); + } + + + +// ============= +// loadInfoSettingsInnerTextElm +// ============= + + // innerText Settings + function loadInfoSettingsInnerTextElm (_panel, name, _value) { + try { + + // Input text, input date, textarea + _panel.querySelectorAll(` + [data-infosetting][type="text"][name="${name}"], + [data-infosetting][type="datetime-local"][name="${name}"], + textarea[data-infosetting][name="${name}"]` + ).forEach(function(elm){ + elm.value = _value; + }); + + // div, span + _panel.querySelectorAll('[data-infosetting="' + name + '"]').forEach(function(elm){ + elm.innerText = _value; + }); + + + _panel.querySelectorAll('[data-infosetting_link="' + name + '"]').forEach(function(elm){ + elm.setAttribute("href", _value); + }); + + // checkbox + var _value_option = _value.split("\n")[0].trim(); + _panel.querySelectorAll('input[data-infosetting][type="checkbox"]').forEach(function(elm){ + if(elm.getAttribute("name") === name && elm.getAttribute("value") === _value ) { + elm.checked = true; + } + }); + + _value_option = _value.split("\n")[0].trim(); + _panel.querySelectorAll(`select[data-infosetting][name="${name}"] > option[value="${_value_option}"]`).forEach(function(elm){ + elm.selected = true; + }); + + } catch (error) { + console.log(error) + } + } + + +// ============= +// loadInputSettingss +// ============= + function loadInputSettings(_panel) { + + getChromeStorage('cdtx_settings', (response) => { + var _datatemp = response.value || false; + window.dataTagTeamSettings = response.value || false; + // Load + var _object = {}; + if(_datatemp) { + _object = _datatemp; + } + + // STEP 1: Load object to element + + if(_datatemp !== false) { + _panel.querySelectorAll('input[data-infosetting][type="checkbox"]').forEach(function(elm){ + elm.checked = false; + }); + } + + for (const property in _object) { + // console.log(`${property}: ${_object[property]}`); + + loadInfoSettingsInnerTextElm(_panel, `${property}`, `${_object[property]}`); + } + + + // Overwrite + // your name, your shortname + _panel.querySelectorAll('[data-infosetting="your-shortname"]').forEach(function(elm){ + elm.innerText = window.tagteamoption.optionkl__inputyourshortname; + }); + _panel.querySelectorAll('[data-infosetting="your-name"]').forEach(function(elm){ + elm.innerText = window.tagteamoption.optionkl__inputyourname; + }); + // Other forcheckbox + + // loadInfoSettingsInnerTextElm(_panel, `${property}`, `${_object[property]}`); + }); + + } + +// load_script_toolaction + var load_script_toolaction = () => { + panel_div.querySelectorAll(`[data-btntoolaction]`).forEach(function(elm) { + elm.addEventListener('click', function(e){ + var _action = this.getAttribute("data-btntoolaction"); + panel_div.setAttribute("data-btntoolaction_status", _action); + + // open main + if(_action === 'focus_case') { + tagteamFocusCase(); + } + // open main + if(_action === 'extract_gtm_id') { + tagteam_showGTMID(); + } + }); + }); + }; + +// Function + // ==== + // Auto Resize Textarea + // ==== + function textareaAutoResize(_class, _elm){ + panel_div.querySelectorAll(`textarea.autoresize`).forEach(function(elm){ + elm.addEventListener('click', function() { + textAreaAdjust(this); + }, false); + + elm.addEventListener('input', function() { + textAreaAdjust(this); + }, false); + + + // clearInterval(timerId); + // timerId = setInterval((elm) => { + // if(elm.value) { + // textAreaAdjust(elm); + // console.log(333) + // console.log(elm); + // console.log(timerId); + // clearInterval(that.timerId); + // } + // }, 1000) + // (function (elm) { + // return setInterval(function () { + // textAreaAdjust(elm); + // }, 1000); + // })(i); + + }); + } + + + // ===== + // clearInput + // ===== + function clearInput(){ + // STEP 0: Empty + // div, span + panel_div.querySelectorAll('[data-infocase]').forEach(function(elm){ + elm.innerText = ""; + }); + + var formThis = panel_div.querySelector("#formCase"); + formThis.reset(); + } + + +// === +// ACTION +// === + var load_script_action = () => { + panel_div.querySelectorAll(`[data-btnaction]`).forEach(function(elm) { + elm.addEventListener('click', function(e){ + var _action = this.getAttribute("data-btnaction"); + panel_div.setAttribute("data-btnaction_status", _action); + + // open main + if(_action === 'openmain') { + // 1. openmain + panel_div.classList.remove("hide_main"); + document.documentElement.classList.remove("_hide_main"); + + // 2. openmain + setChromeStorage('cdtx_hidepanel-' + location.hostname, true , () => { + // Empty + }); + } + + // open main + if(_action === 'toggleopenmain_withoutsave') { + // 1. open main + toggleClass("hide_main", panel_div) + toggleClass("_hide_main", document.documentElement) + + } + + // opentoolbar + if(_action === 'opentoolbar') { + // 2. opentoolbar + setChromeStorage('cdtx_hidetoolbar-' + location.hostname, toggleClass("hide_toolbar", panel_div) , () => { + // Empty + }); + } + + // emailtemplate + if(_action === 'openemailtemplate') { + // 2. Click Step2step + document.querySelector('[data-btnaction="openmain"]').click(); + document.querySelector('[data-btnaction="email-template"]').click(); + + } + + // emailtemplate + if(_action === 'crawl_case') { + console.log("crawl_case") + // 2. Click Step2step + unmark_all_and_crawl(); + + } + + + // opentiptutorial + if(_action === 'opentiptutorial') { + // 2. Save + toggleClass("hide_opentiptutorial", panel_div); + + var _blogs = panel_div.querySelector("._panel__blogs.empty"); + if(_blogs) { + + panel_div.classList.add('is-progress'); + + load_fetch_content(window.dataTagteam.api_blog, (response) => { + + if(response.body) { + var itemLi = ''; + response.body.forEach((item) => { + itemLi += `
`; + if(item.image) { + itemLi += `
`; + } + itemLi += `
${item.title}
`; + itemLi += `
${item.content_expect}
`; + itemLi += `
${item.content}
`; + itemLi += `
Expand
`; + itemLi += `
`; + }); + _blogs.innerHTML = itemLi; + + panel_div.querySelectorAll(`[data-blogs_expand]`).forEach(function(elm){ + elm.addEventListener('click', function(ev) { + var elmblogs = this.closest('[data-blogs]'); + toggleClass("full", elmblogs); + }, false); + }); + + panel_div.querySelector('#_panel__blogs-search').addEventListener("keyup", (e) => { + var _search = panel_div.querySelector('#_panel__blogs-search').innerText.toLowerCase(); + panel_div.querySelectorAll('[data-blogs]').forEach((elm) => { + // elm + elm.hidden = true; + if(elm.innerText.toLowerCase().includes(_search)) { + elm.hidden = false; + } + }); + }); + } + + + // All OK => remove class empty + _blogs.classList.remove('empty'); + panel_div.classList.remove('is-progress'); + + }); + } + // getChromeStorage('cdtx_opentiptutorial-date', () => { + // // Empty + + // setChromeStorage('cdtx_opentiptutorial-date', '' , () => { + // // Empty + // }); + // }); + } + + // opensetting + if(_action === 'opensetting') { + // 2. Save + setChromeStorage('cdtx_opensetting-' + location.hostname, toggleClass("hide_opensetting", panel_div) , () => { + // Empty + }); + } + + // opensetting + if(_action === 'firstemail') { + // 2. Save + // window.dataTagteam.sendFirstEmail(); + panel_div.querySelector(`[data-btnaction="emailtemp__insert1stemail"]`).click(); + } + + // open tip and tutorial + if(_action === 'open tip and tutorial') { + // 1. Remove class + panel_div.classList.remove("hide_tiptutorial"); + + // 2. Save + setChromeStorage('cdtx_hidetiptutorial-' + location.hostname, true , () => { + // Empty + }); + } + + if(_action === 'pushto_casesummary') { + var case_sumary = document.querySelector('material-input[debug-id="case-summary-input"] textarea'); + if(case_sumary && location.host.includes('cases.connect.corp.google.com')) { + case_sumary.value = new Date(panel_div.querySelector('input[name="meeting_time"]').value).toLocaleDateString('en-GB') + " " + panel_div.querySelector('textarea[name="note"]').value; + case_sumary.dispatchEvent(new Event('input')); + } + } + + // Case pin + if(_action === 'case_pin') { + var case_id = panel_div.querySelector('[name="case_id"]').value; + case_id = getOnlyCaseId(case_id); + if(case_id) { + setChromeStorage('cdtx_casecurrent', case_id , (response) => { + dataStatus.cdtx_casecurrent = case_id; + + Toastify({ + text: 'Have PIN case', + duration: 3000, + class: "success", + callback: function(){ + this.remove(); + } + }).showToast(); + }); + } + } + + if(_action === 'hide_panel') { + // 1. Add class + panel_div.classList.add("hide_main"); + document.documentElement.classList.add("_hide_main"); + + // 2. Save + setChromeStorage('cdtx_hidepanel-' + location.hostname, false , () => { + // Empty + }); + } + + + // toggle_minisize_panel + if(_action === 'toggle_minisize_panel') { + + setChromeStorage('cdtx_minisize-' + location.hostname, toggleClass("minisize", panel_div) , () => { + // Empty + }); + } + + // toggle_minisize_panel + if(_action === 'toggle_panel_darkmode') { + + setChromeStorage('cdtx_setting-darkmode', toggleClass("_panel_darkmode", panel_div) , () => { + // Empty + }); + } + + + + if(_action === 'close_panel') { + this.closest("[data-panel]").classList.remove("active"); + if(this.closest('[data-panel="list-case"]')) { + if(panel_div.classList.contains("list-case__active")) { + panel_div.classList.remove("list-case__active"); + } + } + } + + if(_action === 'loadscript') { + var _panel_elm = panel_div.querySelector(`[data-panel="script-reading"]`); + toggleClass("active", _panel_elm); + } + + if(_action === 'email-template') { + var _panel_elm = panel_div.querySelector(`[data-panel="email-template"]`); + toggleClass("active", _panel_elm); + } + + if(_action === 'list-case') { + var _panel_elm = panel_div.querySelector(`[data-panel="list-case"]`); + toggleClass("active", _panel_elm); + toggleClass("list-case__active", panel_div); + } + + if(_action === 'form-case') { + var _panel_elm = panel_div.querySelector(`[data-panel="form-case"]`); + toggleClass("active", _panel_elm); + } + + if(_action === 'load_casecurrent') { + + getChromeStorage('cdtx_casecurrent', (response) => { + // Empty + var itemelm = panel_div.querySelector(`._panel__caselist [data-caseid="${response.value}"]`); + if(itemelm) { + itemelm.click(); + } + }); + } + }); + }); + } + +// Load Email Template + function loadEmailTemplateAction(){ + panel_div.querySelectorAll("._panel_btn--addtemplate").forEach(function(elm) { + elm.addEventListener("click", function() { + cLog(() => { + console.log(1, "Here"); + }) + + // 0. ready + var _insertmailbox = (_this) => { + + var template_title = _this.closest("._emailtemp-item").querySelector("._emailtemp-item__title"); + var template_body = _this.closest("._emailtemp-item").querySelector("#email-body-content-top-content"); + + // Wait and insert + wait4Elem('.write-cards-wrapper:not([style*="display:none"]):not([style*="display: none"]) card.write-card.is-top[card-type="compose"] #email-body-content-top').then(function (elm) { + cLog(() => {console.log("checkInputEmailInbox 2"); }); + checkInputEmailInbox(); + + var _card_istop = document.querySelector('.write-cards-wrapper:not([style*="display:none"]):not([style*="display: none"]) card.write-card.is-top'); + + + var subject = _card_istop.querySelector("input.subject"); + var body_content = _card_istop.querySelector("#email-body-content"); + var body_content_top = _card_istop.querySelector("#email-body-content-top"); + var body_content_top_content = _card_istop.querySelector("#email-body-content-top-content"); + + body_content.style.padding = '0px'; + body_content.style.width = '100%'; + // Insert value + subject.value = template_title.innerText; + body_content_top.innerHTML = template_body.innerHTML; + + // action save status + subject.dispatchEvent(new Event('input')); + body_content_top.dispatchEvent(new Event('input')); + body_content_top_content.dispatchEvent(new Event('input')); + _card_istop.querySelector('[debug-id="add_highlight"]').click(); + + // Click offer + if( + _this.closest("._emailtemp-item").getAttribute("data-type").includes("SO - ") + ) { + + if(_card_istop.querySelector('[debug-id="solution_offered_checkbox"].disabled')) { + Toastify({ + text: 'Please update Tracking Issue Time', + duration: 3000, + class: "warning", + callback: function(){ + this.remove(); + } + }).showToast(); + + document.querySelector('[debug-id="dock-item-issue"]').click(); + } + + _card_istop.querySelector('[debug-id="solution_offered_checkbox"]:not(.disabled):not(._active)').click(); + _card_istop.querySelector('[debug-id="solution_offered_checkbox"]:not(.disabled)').classList.add('_active'); + } + + // Open document doc list + document.querySelector('compose-card-content-wrapper').click(); + document.querySelector('compose-card-content-wrapper').focus(); + + }); + + } + + // 1.1 Open dial + if(document.querySelector('.write-cards-wrapper:not([style*="display:none"]):not([style*="display: none"]) card.write-card.is-top[card-type="compose"] #email-body-content-top')) { + _insertmailbox(this); + } else { + document.querySelector("material-fab-speed-dial").dispatchEvent(new Event('mouseenter')); + document.querySelector("material-fab.themeable.action-2.compose").addEventListener("click", () => { + var n_card = document.querySelectorAll("card[casesanimate].write-card").length || 0; + var myTimeCheck = setInterval(() => { + var n_card_2 = document.querySelectorAll("card[casesanimate].write-card").length || 0; + if(n_card_2 > n_card) { + clearInterval(myTimeCheck); + _insertmailbox(this); + + // Close dial + document.querySelector("material-fab-speed-dial").dispatchEvent(new Event('mouseenter')); + + } + }, 1000) + + }); + + // 1.2 + document.querySelector("material-fab.themeable.action-2.compose").click(); + + } + + }); + }); + + panel_div.querySelector('#_emailtemp_search_input').addEventListener("keyup", (e) => { + var _search = panel_div.querySelector('#_emailtemp_search_input').innerText.toLowerCase(); + panel_div.querySelectorAll('[data-type]').forEach((elm) => { + // elm + elm.style.display = 'none'; + console.log(elm.getAttribute("data-type").toLowerCase().includes(_search)) + if(elm.getAttribute("data-type").toLowerCase().includes(_search)) { + elm.style.display = ''; + } + }); + }); + } + +function activeListCase(caseid){ + panel_div.querySelectorAll('[data-caseid]').forEach((elm)=>{ + console.log(elm.getAttribute('data-caseid'), caseid); + if(elm.getAttribute('data-caseid') == caseid) { + elm.classList.add("active"); + } else { + elm.classList.remove("active"); + } + }); +} + +// ============= +// loadInputCase +// ============= +function loadInputCase(_panel, _datatemp, _isvalidate = true) { + window.dataTagteam.current_case = _datatemp; + clearInput(); + + // Add noted to panel div + notedByCase(_datatemp); + + + // active item in list + activeListCase(_datatemp.case_id); + + // Validation + if(_isvalidate) { + validationCase(_datatemp); + } + + // Hide Process bar + panel_div.classList.remove('is-progress'); + + // Set Attribute + panel_div.setAttribute("data-drive", JSON.stringify(_datatemp)); + + // Load + var _object = {}; + if(_datatemp) { + _object = _datatemp; + } + + + // Add link google meet + if(_object.customer_gmeet) { + loadInfoCaseInnerTextElm(_panel, 'customer_gmeet', _object.customer_gmeet); + + var _linkgooglemeet_section = _panel.querySelector('[data-infocase="linkgooglemeet_section"]'); + if(_linkgooglemeet_section) { + _linkgooglemeet_section.innerHTML = `Truy cập link google cuộc họp tại đây Hoặc qua: ${_object.customer_gmeet}`; + } + } else { + getChromeStorage("cdtx_listmeetlink", (response) => { + var casesmeet = response.value || {}; + if(casesmeet[_object.case_id]) { + _object.customer_gmeet = casesmeet[_object.case_id]; + loadInfoCaseInnerTextElm(_panel, 'customer_gmeet', casesmeet[_object.case_id]); + + var _linkgooglemeet_section = _panel.querySelector('[data-infocase="linkgooglemeet_section"]'); + if(_linkgooglemeet_section) { + _linkgooglemeet_section.innerHTML = `Truy cập link google cuộc họp tại đây Hoặc qua: ${_object.customer_gmeet}`; + } + } + }); + } + // STEP 1: Load object to element + for (const property in _object) { + // console.log(`${property}: ${_object[property]}`); + + loadInfoCaseInnerTextElm(_panel, `${property}`, `${_object[property]}`); + } + + // STEP 2: Special display + _panel.querySelector('[data-infocase_link="case_id"]').setAttribute("href", "https://cases.connect.corp.google.com/#/case/" + _datatemp.case_id); + _panel.querySelector('[data-infocase_link="customer_ocid"]').setAttribute("href", "https://adwords.corp.google.com/aw/overview?ocid=" + _datatemp.customer_ocid); + + //Format date + // alert(new Date(_datatemp.meeting_time).toLocaleDateString('en-GB')); + // _panel.querySelector('[data-infocase="local_format_meeting_time"]').innerText = new Date(_datatemp.meeting_time).toLocaleDateString('en-GB') + + loadInfoCaseInnerTextElm(_panel, 'local_format_meeting_time', new Date(_datatemp.meeting_time).toLocaleDateString('en-GB')); + + + // Link + _panel.querySelector('[data-infocase="customer_website"]').setAttribute("href", _datatemp.customer_website); + + + loadInfoCaseInnerTextElm(_panel, 'am_isgcc', '---'); + _panel.querySelector(`[data-panel="script-reading"]`).setAttribute('data-isgcc', '0'); + if(_datatemp.am_isgcc) { + loadInfoCaseInnerTextElm(_panel, 'am_isgcc', 'GCC'); + _panel.querySelector('[name="am_isgcc"]').checked = true; + _panel.querySelector(`[data-panel="script-reading"]`).setAttribute('data-isgcc', '1'); + } + + if(_datatemp.qlus_status) { + loadInfoCaseInnerTextElm(_panel, 'qlus_status', _datatemp.qlus_status); + _panel.querySelector(`[data-panel="email-template"]`).setAttribute('data-qlus_status', _datatemp.qlus_status); + } + + if(_datatemp.est_setup) { + loadInfoCaseInnerTextElm(_panel, 'est_setup', _datatemp.est_setup); + } + + if(_datatemp.customer_adsid) { + loadInfoCaseInnerTextElm(_panel, 'customer_adsid_format', reformatAdsId(_datatemp.customer_adsid)); + console.log('111111111111', document.querySelector('._panel_shortcut_gearloose_vanbo')); + wait4Elem('._panel_shortcut_gearloose_vanbo').then(function (elm) { + if(elm) { + elm.setAttribute("href", 'https://gearloose2.corp.google.com/#/search/merchants?q=awid:' + reformatAdsId(_datatemp.customer_adsid)); + elm.style.display = ""; + } + }); + } + + // Remove new line tasks - nowrap + if(_datatemp.tasks) { + loadInfoCaseInnerTextElm(_panel, 'tasks_nowrap', _datatemp.tasks.trim().replace("\n", ", ")); + } + + + // STEP 3: Load condition to script reading + _panel.querySelector('._panel__script'); +} +// ====== +// loadCaseList +// ====== +function loadCaseList(elm_caselist){ + var case_list = dataStatus.case_list; + elm_caselist.innerHTML = _TrustScript(""); + + // Sort + case_list.sort((a, b) => (a.meeting_time < b.meeting_time) ? 1 : ((b.meeting_time < a.meeting_time) ? -1 : 0)); + + // Display + var once_todaystr = true; + case_list.forEach(function(item){ + + // Time + const date1 = new Date(); + const date2 = new Date(item.meeting_time); + const diffTime = (date2 - date1); + const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24)); + + const date1date = date1.getDate(); + const date1month = date1.getMonth() + 1; + const date1year = date1.getFullYear(); + const date1fullnum = +`${date1year}${date1month}${date1date < 10 ? "0" + date1date : date1date}`; + const date2date = date2.getDate(); + const date2month = date2.getMonth() + 1; + const date2year = date2.getFullYear(); + const date2fullnum = +`${date2year}${date2month}${date2date < 10 ? "0" + date2date : date2date}`; + + const is_today = date1fullnum === date2fullnum; + const str_today = is_today ? "Today" : ""; + + var itemstr = ""; + if(once_todaystr) { + if(date2fullnum < date1fullnum) { + itemstr += `
  • `; + once_todaystr = false; + } + } + + itemstr += `
  • + ${item.case_id} - ${item.customer_name}(${item.customer_gender}) + + ${(item.qlus_status ? '' + item.qlus_status + '' : "")} + ${(item.assignee ? '' + item.assignee + '' : "")} + ${'' + (!is_today? date2date + "/" + date2month : "Today") + ''} + + + ${'Delete'} + +
  • `; + + const staticHtmlPolicyv2 = trustedTypes.createPolicy('foo-static', {createHTML: () => itemstr}); + elm_caselist.insertAdjacentHTML("beforeEnd", staticHtmlPolicyv2.createHTML('')); + }); + + + var lst_caseid = elm_caselist.querySelectorAll("[data-caseid]"); + lst_caseid.forEach(function(elm){ + elm.addEventListener("click", function(e){ + const _caseid = this.getAttribute("data-caseid"); + + loadDataStatusCaseList(() => { + var caseload = loadCaseDatabaseByID(_caseid); + if(caseload) { + cLog(() => { console.log('loadInputCase | 2'); }) + loadInputCase(panel_div, caseload, false); + + elm_caselist.querySelectorAll("[data-caseid]").forEach(function(_elm){ + _elm.classList.remove("active"); + }); + this.classList.add("active"); + } + }); + + }); + }); + + var lst_caseid = elm_caselist.querySelectorAll("[data-action]"); + lst_caseid.forEach(function(elm){ + elm.addEventListener("click", function(e){ + const itemelm = this.closest('li[data-caseid]'); + const _caseid = itemelm.getAttribute("data-caseid"); + const _type = elm.getAttribute("data-action"); + + if(_type === "remove_case") { + if (confirm("You sure remove case: " + _caseid)) { + const formData = new FormData(); + formData.append('action', "remove_case"); + formData.append('case_id', _caseid); + + removeChromeStorage("cdtx_caseid_" + _caseid, function(){ + itemelm.remove(); + + Toastify({ + text: 'Removed: ' + _caseid, + duration: 3000, + callback: function(){ + this.remove(); + } + }).showToast(); + }); + } + + } + + }); + }); +} + + +// Is Ready Connect Case +function is_readycaseconnect(_callback) { + + var n_time_dkneed = 0, + n_time_dkneed_compare = 0; + var is_ready = () => { + if(n_time_dkneed_compare < n_time_dkneed) return; + _callback(); + } + +// 2.1 + n_time_dkneed++; + wait4Elem("cuf-form-field").then(function () { + is_ready(n_time_dkneed_compare++); + cLog(()=>{console.info(n_time_dkneed_compare , '=' , n_time_dkneed, '--- cuf-form-field');}); + }); + + n_time_dkneed++; + wait4Elem('[debug-id="case-id"] .case-id').then(function () { + is_ready(n_time_dkneed_compare++); + cLog(()=>{console.info(n_time_dkneed_compare , '=' , n_time_dkneed, '--- [debug-id="case-id"] .case-id');}); + }); + + // n_time_dkneed++; + wait4Elem("#read-card-tab-panel-case-log .case-log-container.active-case-log-container .activities > div").then((elm1) => { + document.querySelector('[debug-id="dock-item-case-log"]').click(); + document.querySelector('[debug-id="dock-item-home"]').click(); + + document.querySelectorAll('#read-card-tab-panel-case-log .case-log-container.active-case-log-container .activities > div').forEach(function(elm){ + if(elm.innerText.includes('Review case in Connect Sales')) { + // console.log(elm.querySelector("table")) + + elm.querySelector('case-message-view .message-content-container-full').click(); + + wait4Elem("#read-card-tab-panel-case-log .case-log-container.active-case-log-container .activities > div table tr").then( (elm2) => { + // is_ready(n_time_dkneed_compare++); + console.info(n_time_dkneed_compare , '=' , n_time_dkneed, '--- message-content-container-full'); + + + }) + } + }); + + // Recheck pre call? + // Is Precall? + if(window.location.hostname === "cases.connect.corp.google.com" && window.location.href.indexOf("#/case/") > - 1) { + var is_precall = false; + document.querySelectorAll(".case-log-container.active-case-log-container case-message-view").forEach(function(elm){ + if(elm.innerText.includes("Emails or feedback from Advertiser")) { + is_precall = true; + } + }); + + if(is_precall === false) { + Toastify({ + text: 'Not Precall', + duration: 6000, + class: "error", + callback: function(){ + this.remove(); + } + }).showToast(); + } + } + }); + + + // n_time_dkneed++; + // wait4Elem('contact-email-field').then(function () { + // is_ready(n_time_dkneed_compare++); + // console.info(n_time_dkneed_compare , '=' , n_time_dkneed, '--- contact-email-field'); + // }); + + // n_time_dkneed++; + // wait4Elem('case-message-view').then(function () { + // is_ready(n_time_dkneed_compare++); + // console.info(n_time_dkneed_compare , '=' , n_time_dkneed, '--- case-message-view'); + // }); + + // n_time_dkneed++; + // wait4Elem('home-data-item').then(function () { + // is_ready(n_time_dkneed_compare++); + // console.info(n_time_dkneed_compare , '=' , n_time_dkneed, '---home-data-item'); + // }); + + // n_time_dkneed++; + // wait4Elem('contact-info').then(function () { + // is_ready(n_time_dkneed_compare++); + // console.info(n_time_dkneed_compare , '=' , n_time_dkneed, '---contact-info'); + // }); + + // n_time_dkneed++; + // wait4Elem('internal-user-info').then(function () { + // is_ready(n_time_dkneed_compare++); + // console.info(n_time_dkneed_compare , '=' , n_time_dkneed, '---internal-user-info'); + // }); +} + + +//Load case +function loadCase(elm) { + + if((window.location.hostname === "cases.connect.corp.google.com" && window.location.href.indexOf("#/case/") > - 1) ) { + + // Case ID + var sLoadCase = function(n_time_recall = 0) { + var _caseid = document.querySelector(".case-id").innerText; + if(location.hash.includes(_caseid) === false) { + + cLog(() => {console.log("1. case id != hash")}) + var myTimeLoadCase = setTimeout(() => { + n_time_recall = n_time_recall + 1; + cLog(() => {console.log("1.2 rerun sLoadCase | ntime", n_time_recall)}) + sLoadCase(n_time_recall); + }, 1500); + + if(n_time_recall > 10) { + cLog(() => {console.log("1.3 n_time_recall limit Clear case id != hash")}) + clearTimeout(myTimeLoadCase); + } + + return false; + } + + + + var caseload = loadCaseDatabaseByID(_caseid); + + cLog(() => {console.log("2. case id === hash => OK | ntime", _caseid, caseload, n_time_recall)}) + + + if(caseload) { + cLog(() => {console.log("1. Has Data ========="); }) + cLog(() => { console.log('loadInputCase | 3'); }) + loadInputCase(elm, caseload); + + + + // Change status btn + panel_div.querySelector('#formCase [action="save"]').innerText = "SAVED"; + panel_div.querySelector('#formCase [action="save"]').classList.remove("_panel_btn--success"); + + } else { + Toastify({ + text: 'NEW!!!! This case is new', + duration: 3000, + class: "success", + callback: function(){ + this.remove(); + } + }).showToast(); + + // is_readycaseconnect(() => { + // unmark_all_and_crawl(); + cLog(()=>{console.log('_caseid', _caseid)}) + crawl_basic(_caseid); + + // // Show Input + // if(document.querySelector('[debug-id="target-input"]')) { + // document.querySelector('[debug-id="target-input"]').dispatchEvent(new Event("mouseover")); + + // wait4Elem('target-item .value').then(function () { + // var ads_id = document.querySelector("target-item .value").innerText; + // if(document.querySelector('._panel_shortcut_gearloose_vanbo')) { + // document.querySelector('._panel_shortcut_gearloose_vanbo').setAttribute("href", 'https://gearloose2.corp.google.com/#/search/merchants?q=awid:' + reformatAdsId(ads_id)); + // document.querySelector('._panel_shortcut_gearloose_vanbo').style.display = ""; + // } + // }); + // } + // }); + + + // Change status btn + panel_div.querySelector('#formCase [action="save"]').innerText = "FIRST SAVE"; + panel_div.querySelector('#formCase [action="save"]').classList.add("_panel_btn--success"); + } + + + // Open dial + document.querySelector("material-fab-speed-dial").dispatchEvent(new Event('mouseenter')); + // Close dial + document.querySelector("material-fab-speed-dial").dispatchEvent(new Event('mouseleave')); + }; + + // s1: load start + wait4Elem(".case-id").then(function () { + sLoadCase(); + }); + + // s1: load by hash change once + + if(hashchange_once === false) { + hashchange_once = true; + window.addEventListener('hashchange', () => { + wait4Elem(".case-id").then(function () { + cLog(() => {console.log("hashchange => sLoadCase | ", window.dataTagteam.current_case)}); + sLoadCase(); + }); + }, false); + } + + + // Exit + return true; + } + + if(window.location.href.includes("calendar.google.com")) { + // Set auto by checkbox + document.addEventListener("readystatechange", (event) => { + if(document.readyState === "complete") { + var is_updatelist_link = () => { + getChromeStorage("cdtx_listmeetlink", (response) => { + var casesmeet = response.value || {}; + document.querySelectorAll('[jslog][data-eventid]').forEach(function(elm){ + var jslog = elm.getAttribute('jslog'); + var caseid = elm.innerText.match(/\d-\d+/g); + if(jslog){ + var meetid = jslog.match(/\w{3}-\w{4}-\w{3}/g); + } + + if(caseid && meetid){ + casesmeet[caseid[0]] = "https://meet.google.com/" + meetid[0] + } + }); + + setChromeStorage("cdtx_listmeetlink", casesmeet, () => { + + cLog(() => { + console.log("Has update meet link!"); + }) + }); + }); + } + + is_updatelist_link(); + + // reUpdate 20mins + setInterval(() => { + is_updatelist_link(); + }, 1000 * 60 * 20); + + + + + var _reupdate_data = function(){ + if(panel_div.getAttribute("data-caseid") && panel_div.classList.contains("_hascasedata") === false) { + + loadDataStatusCaseList(() => { + var _datatemp = loadCaseDatabaseByID(panel_div.getAttribute("data-caseid")); + if(_datatemp) { + loadCaseList(panel_div.querySelector('._panel__caselist')); + loadInputCase(elm, _datatemp); + panel_div.classList.add("_hascasedata"); + } + }); + } + } + + setInterval(() => { + _reupdate_data(); + }, 1000 * 4); + } + + }); + + var _isauto = true; + + + if(_isauto) { + var _dialogParent = document.querySelector("#yDmH0d"), + _onceChange = '', + _elmHeading = _dialogParent.querySelector("#rAECCd"); + if(_elmHeading) { + var _string = _elmHeading.innerText; + var _caseid = getOnlyCaseId(_string); + if(_caseid) { + var _datatemp = loadCaseDatabaseByID(_caseid); + cLog(() => { console.log('loadInputCase | 4'); }) + loadInputCase(elm, _datatemp); + elm.querySelector('[data-infocase="case_id"]').innerText = _caseid; + + // Open + if(window.tagteamoption.optionkl__disable_dialog == false) { + document.querySelector('[data-btnaction="openmain"]').click(); + } + + // var alinkelm = _dialogParent.querySelector('[href*="meet.google.com"]'); + // if(alinkelm) { + // var _link = alinkelm.getAttribute("href").split("?")[0]; + + // var _cusmeet = elm.querySelector('[data-infocase_link="customer_gmeet"]'); + // var _cusmeet_input = elm.querySelector('[name="customer_gmeet"]'); + // // if(_cusmeet_input.value.length < 1) { + // _cusmeet.setAttribute("href", _link); + + // if(_cusmeet) { + // _cusmeet_input.value = _link; + // } + // // } + + // } + } + } + + _dialogParent.addEventListener('DOMSubtreeModified', (e) => { + _elmHeading = _dialogParent.querySelector("#rAECCd"); + + + // STEP 2: Empty + if(_elmHeading) { + var _string = _elmHeading.innerText; + var _caseid = getOnlyCaseId(_string); + if(_caseid) { + // Open + if(window.tagteamoption.optionkl__disable_dialog == false) { + document.querySelector('[data-btnaction="openmain"]').click(); + } + + if(_onceChange !== _caseid) { + _onceChange = _caseid; + var _datatemp = loadCaseDatabaseByID(_caseid); + + // set status + panel_div.setAttribute("data-caseid", _caseid); + if(_datatemp) { + panel_div.classList.add("_hascasedata"); + } else { + panel_div.classList.remove("_hascasedata"); + } + + if(_datatemp) { + var itemelm = panel_div.querySelector(`._panel__caselist [data-caseid="${_caseid}"]`); + + if(itemelm) { + itemelm.click(); + } + + + // 2.1 formchanger + setTimeout(() => { + // Save google meet link + var alinkelm = _dialogParent.querySelector('[href*="meet.google.com"]'); + if(alinkelm) { + var _link = alinkelm.getAttribute("href").split("?")[0]; + + var _cusmeet = elm.querySelector('[data-infocase_link="customer_gmeet"]'); + var _cusmeet_input = elm.querySelector('[name="customer_gmeet"]'); + // if(_cusmeet_input.value.length < 1) { + _cusmeet_input.value = _link; + if(_cusmeet) { + _cusmeet.setAttribute("href", _link); + } + + // Action save + elm.querySelector('[action="save"]').click(); + // } + + } + }, 1000); + } else { + clearInput(); + + elm.querySelector('[data-infocase="case_id"]').innerText = _caseid; + elm.querySelector('[data-infocase_link="case_id"]').setAttribute("href", "https://cases.connect.corp.google.com/#/case/" + _caseid); + + Toastify({ + text: 'NEW!!!! This case is new', + duration: 3000, + class: "warning", + callback: function(){ + this.remove(); + } + }).showToast(); + + // Open + if(window.tagteamoption.optionkl__disable_dialog == false) { + document.querySelector('[data-btnaction="openmain"]').click(); + } + } + } + } + } + }); + } + + // Exit + return true; + } + + if(dataStatus.case_current) { + cLog(() => { + console.log("Preload current case"); + }) + var caseload = loadCaseDatabaseByID(dataStatus.case_current); + cLog(() => { console.log('loadInputCase | 5'); }) + loadInputCase(elm, caseload); + } + +} + +// 0.0 unmark all before crawl +var s_crawl_case = (_caseid, callback = function(){}) => { + var _datatemp = _datatemp || {}; + + _datatemp.case_id = _caseid; + // Ads ID + var dataList = []; + var dataListTemp = []; + var customer_adsid = "EMPTY!!!"; + document.querySelectorAll("configurable-signals home-data-item").forEach(function(elm){ + dataList = elm.innerText.split("\n"); + if(dataList[0] === window.dataTagteam.language.google_ads_external_customer_id) { + _datatemp.customer_adsid = dataList[1]; + } + }); + + + // appointment_time + var appointment_time = ''; + document.querySelectorAll("card.read-card:not(.hidden) cuf-form-field").forEach(function(elm){ + var dataList = elm.innerText.split("\n"); + if(dataList[0] === "Appointment Time") { + appointment_time += " " + dataList[1] ; + } + }); + + _datatemp.appointment_time = appointment_time; + if(_datatemp.appointment_time) { + _datatemp.meeting_time = getDataTimeFormat(_datatemp.appointment_time); + _datatemp.meeting_ontime = getDataTimeFormat(_datatemp.appointment_time); + + if(_datatemp.meeting_time === false) { + if(window.dataTagteam.meeting_time) { + + _datatemp.meeting_time = getDataTimeFormat(window.dataTagteam.meeting_time); + _datatemp.meeting_ontime = getDataTimeFormat(window.dataTagteam.meeting_time); + } + } + // window.dataTagteam.meeting_time + } + + + // Other + document.querySelectorAll("card.read-card:not(.hidden) cuf-form-field").forEach(function(elm){ + dataList = elm.innerText.trim().split("\n"); + dataList = dataList.map(s => s.trim()); + dataList = dataList.filter(n => n); + + if(dataList[0] === "Website") { + _datatemp.customer_website = dataList[1]; + } + + if(dataList[0] === "Request Category") { + dataListTemp = dataList; + delete dataListTemp[0]; + dataListTemp = dataListTemp.filter(n => n); + + _datatemp.tasks = dataListTemp.join("\n"); + + } + + if(dataList[0] === "Tasks") { + dataListTemp = dataList; + delete dataListTemp[0]; + dataListTemp = dataListTemp.filter(n => n); + + if(_datatemp.tasks) { + dataListTemp.push(_datatemp.tasks); + } + _datatemp.tasks = dataListTemp.join("\n"); + } + + if(dataList[0] === "Instructions for the Implementation (Guide)") { + dataListTemp = dataList; + delete dataListTemp[0]; + dataListTemp = dataListTemp.filter(n => n); + _datatemp.request = dataListTemp.join("\n"); + } + + if(dataList[0] === "Sales Program") { + _datatemp.sales_program = dataList[1]; + + // Is GCC + if(dataList.join(" ").includes("GCC")){ + _datatemp.am_isgcc = 1; + + Toastify({ + text: 'HAVE GCC => EMAIL SEND:
    TO BCC', + duration: 3000, + class: "warning" + }).showToast(); + } + } + + + if(dataList[0] === "Accounts") { + _datatemp.customer_ocid = dataList[1]; + } + + if(dataList[0] === "Attribution Model for the New Conversion Action") { + _datatemp.customer_attributionmodel = dataList[1]; + } + + + if(dataList[0] === "Contact") { + if(dataList[1].includes(window.dataTagteam.language.phone_prefix)) { + _datatemp.customer_contact = dataList[1]; + } + } + + + }); + + + // Customer + document.querySelectorAll("internal-user-info").forEach(function(elm){ + if(elm.querySelector(".email").innerText.includes("@google.com") === false) { + if(elm.querySelector(".name")) { + _datatemp.customer_name = elm.querySelector(".name").innerText.trim(); + } + if(elm.querySelector(".email")) { + _datatemp.customer_email = elm.querySelector(".email").innerText.trim(); + } + } + }); + + // AM + if(document.querySelector("internal-user-info .name")) { + _datatemp.am_name = document.querySelector("internal-user-info .name").innerText.trim(); + } + if(document.querySelector("internal-user-info .name")) { + _datatemp.am_email = document.querySelector("internal-user-info .email").innerText.trim(); + } + + + // Assign to + if(document.querySelector(`[debug-id="assignee"]`)) { + _datatemp.assignee = document.querySelector(`[debug-id="assignee"]`).innerText; + } else { + Toastify({ + text: 'This task has not been assigned yet!!', + duration: 3000, + class: "warning", + callback: function(){ + this.remove(); + } + }).showToast(); + + } + + + + document.querySelectorAll('#read-card-tab-panel-case-log .case-log-container.active-case-log-container .activities > div').forEach(function(elm){ + if(elm.innerText.includes('Review case in Connect Sales')) { + + var _tableinfo = elm.querySelectorAll("table tr"); + if(_tableinfo.length) { + _tableinfo.forEach((elm) => { + var _td_1 = elm.querySelector("td:nth-child(1)"); + var _td_2 = elm.querySelector("td:nth-child(2)"); + if(_td_1 && _td_2) { + // console.log(_td_1.innerText, _td_2.innerText); + + if(_td_1.innerText.includes("Website")) { + _datatemp.customer_website = _td_2.innerText; + } + + if(_td_1.innerText.includes("Tasks")) { + _datatemp.tasks = _td_2.innerText.trim().replace("\n", "").replace(",", ", "); + } + + if(_td_1.innerText.includes("Contact")) { + var _temp_now = _td_2.innerHTML.split("
    "); + _temp_now.forEach(function(str_item){ + str_item = str_item.replace(/(<([^>]+)>)/gi, ""); + + if(str_item.includes("Name: ")) { + _datatemp.customer_name = str_item.split("Name: ")[1]; + } + + if(str_item.includes("Email: ")) { + _datatemp.customer_email = str_item.split("Email: ")[1]; + } + + if(str_item.includes("Phone: ")) { + _datatemp.customer_contact = str_item.split("Phone: ")[1]; + } + + }); + } + + if(_td_1.innerText.includes("Instructions for the Implementation (Guide)")) { + _datatemp.request = _td_2.innerText; + } + + if(_td_1.innerText.includes("Account")) { + _datatemp.customer_ocid = _td_2.innerText; + window.tagteamoption.customer_ocid = _td_2.innerText; + } + } + + }); + } + } + }); + + // == Load case + var elm = panel_div.querySelector('form#formCase'); + cLog(() => { console.log('loadInputCase | 6'); }) + loadInputCase(elm, _datatemp); + callback(); +}; + +// 0.1 Crawl basic for case +// Crawl without unmark +var crawl_basic = (_caseid) => { + cLog(() => { console.log('STEP 1: crawl_basic'); }) + + var _datatemp = _datatemp || {}; + + _datatemp.case_id = _caseid; + // Ads ID + var dataList = []; + var dataListTemp = []; + var customer_adsid = "EMPTY!!!"; + document.querySelectorAll("configurable-signals home-data-item").forEach(function(elm){ + dataList = elm.innerText.split("\n"); + if(dataList[0] === window.dataTagteam.language.google_ads_external_customer_id) { + _datatemp.customer_adsid = dataList[1]; + } + }); + + // appointment_time + var appointment_time = ''; + document.querySelectorAll("card.read-card:not(.hidden) cuf-form-field").forEach(function(elm){ + var dataList = elm.innerText.split("\n"); + if(dataList[0] === "Appointment Time") { + appointment_time += " " + dataList[1] ; + } + }); + + _datatemp.appointment_time = appointment_time; + + // Get from code Van Bo + if(window.tempAppointmentTime) { + _datatemp.appointment_time = window.tempAppointmentTime; + } + + if(_datatemp.appointment_time) { + _datatemp.meeting_time = getDataTimeFormat(_datatemp.appointment_time); + _datatemp.meeting_ontime = getDataTimeFormat(_datatemp.appointment_time); + + if(_datatemp.meeting_time != false) { + window.dataTagteam.meeting_time = _datatemp.meeting_time; + } + } + + + // Other + document.querySelectorAll("card.read-card:not(.hidden) cuf-form-field").forEach(function(elm){ + + dataList = elm.innerText.trim().split("\n"); + dataList = dataList.map(s => s.trim()); + dataList = dataList.filter(n => n); + + if(dataList[0] === "Website") { + _datatemp.customer_website = dataList[1]; + } + + + if(dataList[0] === "Request Category") { + dataListTemp = dataList; + if(dataListTemp[0] === 'Request Category') { + delete dataListTemp[0]; + } + + dataListTemp = dataListTemp.filter(n => n); + _datatemp.tasks = dataListTemp.join("\n"); + } + + + if(dataList[0] === "Tasks") { + dataListTemp = dataList; + + if(dataListTemp[0] === 'Tasks') { + delete dataListTemp[0]; + } + + dataListTemp = dataListTemp.filter(n => n); + _datatemp.tasks = dataListTemp.join("\n"); + } + + if(dataList[0] === "Instructions for the Implementation (Guide)") { + dataListTemp = dataList; + delete dataListTemp[0]; + dataListTemp = dataListTemp.filter(n => n); + _datatemp.request = dataListTemp.join("\n"); + } + + if(dataList[0] === "Sales Program") { + _datatemp.sales_program = dataList[1]; + + // Is GCC + if(dataList.join(" ").includes("GCC")){ + _datatemp.am_isgcc = 1; + + Toastify({ + text: 'HAVE GCC => EMAIL SEND:
    TO BCC', + duration: 3000, + class: "warning" + }).showToast(); + } + } + + + if(dataList[0] === "Accounts") { + _datatemp.customer_ocid = dataList[1]; + } + + if(dataList[0] === "Attribution Model for the New Conversion Action") { + _datatemp.customer_attributionmodel = dataList[1]; + } + + + if(dataList[0] === "Contact") { + if(dataList[1].includes(window.dataTagteam.language.phone_prefix)) { + _datatemp.customer_contact = dataList[1]; + } + } + + + }); + + // Customer + document.querySelectorAll("internal-user-info").forEach(function(elm){ + if(elm.querySelector(".email").innerText.includes("@google.com") === false) { + if(elm.querySelector(".name")) { + _datatemp.customer_name = elm.querySelector(".name").innerText.trim(); + } + if(elm.querySelector(".email")) { + _datatemp.customer_email = elm.querySelector(".email").innerText.trim(); + } + } + }); + + // AM + if(document.querySelector("internal-user-info .name")) { + _datatemp.am_name = document.querySelector("internal-user-info .name").innerText.trim(); + } + if(document.querySelector("internal-user-info .name")) { + _datatemp.am_email = document.querySelector("internal-user-info .email").innerText.trim(); + } + + // Assign to + if(document.querySelector(`[debug-id="assignee"]`)) { + _datatemp.assignee = document.querySelector(`[debug-id="assignee"]`).innerText; + } else { + Toastify({ + text: 'This task has not been assigned yet!!', + duration: 3000, + class: "warning", + callback: function(){ + this.remove(); + } + }).showToast(); + + } + + + cLog(() => { console.log("basic", _datatemp); }) + + // == Load case + var elm = panel_div.querySelector('form#formCase'); + cLog(() => { console.log('loadInputCase | 7'); }) + loadInputCase(elm, _datatemp); + +} + +// 0.2 Unmark all element and crawl +// for first save +var unmark_all_and_crawl = (callback) => { + if(!document.querySelector(".case-id")) { + + Toastify({ + text: 'Not found Case ID / Is Not connect case ...', + duration: 3000 + }).showToast(); + + return false; + } + + // add Process bar + panel_div.classList.add('is-progress'); + + // Get Case ID + var _caseid = document.querySelector(".case-id").innerText; + var caseload = loadCaseDatabaseByID(_caseid); + + if(caseload) { + // cLog(() => {console.log("2. Has Data =========", caseload);}) + var elm = panel_div.querySelector('form#formCase'); + cLog(() => { console.log('loadInputCase | 8'); }) + loadInputCase(elm, caseload); + callback(); + } else { + cLog(() => {console.log("New Crawl Data From Case Connent =========", caseload);}) + + // 1. open all unmark + document.querySelector('[aria-controls="read-card-tab-panel-home"]').click(); + document.querySelector('[aria-controls="read-card-tab-panel-case-log"]').click(); + document.querySelector('[aria-controls="read-card-tab-panel-home"]').click(); + + // Expand all mask button + if(document.querySelectorAll('[id="read-card-tab-panel-home"] .unmask-button').length) { + var _unmark = (_ntime = 0) => { + var unmaskbutton = document.querySelectorAll('[id="read-card-tab-panel-home"] .unmask-button'); + + if(_ntime > 10) { + return false; + } + + // 2.1 click load more + var more_less_button = document.querySelectorAll(`.more-less-button:not(.show-more)`); + if(more_less_button.length) { + more_less_button.forEach(function (elm) { + elm.click(); + }); + } + + // 2.2 open all unmark + if(unmaskbutton.length){ + unmaskbutton.forEach(function (elm) { + elm.click(); + + // test demo + if(_global_status.test) { + elm.classList.remove("unmask-button"); + } + }); + + setTimeout(()=>{ + _unmark(_ntime + 1); + }, 1500); + } else { + // 2.3 => READY Craw + s_crawl_case(_caseid, callback); + } + return false; + + } + + // Unmark + _unmark(); + + + } else { + s_crawl_case(_caseid, callback); + } + } +} +var set_init_load = () => { + panel_div = document.querySelector("#_panel_div"); + + if(panel_div) { + + // 2. ==== + // 2. Form + // 2.1 form Submit + var _formCase = panel_div.querySelector('form#formCase'); + + loadCase(_formCase); + _formCase.addEventListener('submit', function(e){ + e.preventDefault(); + + + // prepare + var _form = () => { + const formData = new FormData(e.target); + let formDataObj = {}; + + + formData.append('action', "case_save"); + + formData.forEach((value, key) => (formDataObj[key] = value)); + + + // Is OK + if(getOnlyCaseId(formDataObj.case_id) !== false) { + + _formCase.querySelector(`[action="save"]`).innerText = "PROCCESS ... "; + + saveCase2Storage(formDataObj, (response) => { + loadDataStatusCaseList(() => { + + var caseload = loadCaseDatabaseByID(response.case_id); + + Toastify({ + text: 'SAVED', + duration: 3000, + callback: function(){ + this.remove(); + } + }).showToast(); + + // Load case + cLog(() => { console.log('loadInputCase | 9'); }) + loadInputCase(panel_div, caseload); + // Load list + loadCaseList(panel_div.querySelector("._panel__caselist")); + + _formCase.querySelector(`[action="save"]`).innerText = "SAVED"; + + // Check is has current case is empty? + getChromeStorage('cdtx_casecurrent', (response) => { + if(typeof response.value === 'undefined') { + panel_div.querySelector('[data-btnaction="case_pin"]').click(); + } + }); + }); + }); + } else { + Toastify({ + text: 'ID CASE EMPTY -> FALSE', + duration: 3000, + class: "warning", + callback: function(){ + this.remove(); + } + }).showToast(); + + } + } + + + // If is first save, not isset in database + cLog(() => { console.log("check ---- ", window.dataTagteam.current_case.case_id)}); + + if(loadCaseDatabaseByID(window.dataTagteam.current_case.case_id) === false) { + cLog(() => {console.log('recrawl and First save')}); + is_readycaseconnect(() => { + unmark_all_and_crawl(() => { + cLog(() => {console.log('is_readycaseconnect and unmark_all_and_crawl', window.dataTagteam.current_case)}); + _form(); + }); + + }) + + } else { + cLog(() => {console.log('Has data and save')}); + _form(); + } + + + + }); + + // 2.1 formchanger + _formCase.addEventListener('change', function() { + _formCase.querySelector(`[action="save"]`).click(); + }); + + // 2.3 Form Settings + try { + var _formSettings = panel_div.querySelector('form#formSettings'); + _formSettings.addEventListener('submit', function(e){ + e.preventDefault(); + const formData = new FormData(e.target); + let formDataObj = {}; + + formData.forEach((value, key) => (formDataObj[key] = value)); + + saveSettings2Storage(formDataObj, (response) => { + Toastify({ + text: 'SETTIGNS SAVED', + duration: 3000, + callback: function(){ + this.remove(); + } + }).showToast(); + + // loadInputSettings(panel_div); + }); + + }); + + // 2.1 formchanger + _formSettings.addEventListener('change', function() { + _formSettings.querySelector(`[action="save"]`).click(); + }); + } catch (error) { + + } + + // 3. load case list + loadCaseList(panel_div.querySelector('._panel__caselist')); + + // 4. Email template + loadEmailTemplateAction(); + + // 5. load Script Action + load_script_action(); + + // 6. Load minisize + getChromeStorage('cdtx_minisize-' + location.hostname, (response) => { + if(response.value) { + panel_div.classList.add("minisize"); + toggleClass("_panel_minisize", document.documentElement); + } + }); + + // 6. Load minisize + getChromeStorage('cdtx_setting-darkmode', (response) => { + if(response.value) { + panel_div.classList.add("_panel_darkmode"); + } + }); + + // 6. Load minisize + getChromeStorage('cdtx_setting-horizon', (response) => { + if(response.value) { + panel_div.classList.add("_panel__horizon"); + } + }); + + // 7. Show Panel Default + getChromeStorage('cdtx_hidepanel-' + location.hostname, (response) => { + if(response.value) { + panel_div.classList.remove("hide_main"); + document.documentElement.classList.remove("_hide_main"); + } else { + panel_div.classList.add("hide_main"); + document.documentElement.classList.add("_hide_main"); + } + }); + + // 8. Load current for other case connect + getChromeStorage('cdtx_casecurrent', (response) => { + // Load current case if empty + if(panel_div.querySelector('[name="case_id"]').value.trim() === '') { + var itemelm = panel_div.querySelector(`._panel__caselist [data-caseid="${response.value}"]`); + if(itemelm) { + itemelm.click(); + } + } + }); + + + + + + + // 9. Recheck Realtime + var myRecheckRealtime = setInterval(() => { + try { + getChromeStorage('cdtx_lastupdate', (response) => { + if(dataStatus.cdtx_lastupdate !== response.value) { + dataStatus.cdtx_lastupdate = response.value; + + getChromeStorage('cdtx_lastupdate_caseid', (response) => { + var case_currentopen = panel_div.querySelector(`[name="case_id"]`).value; + + if(case_currentopen == response.value) { + var itemelm = panel_div.querySelector(`._panel__caselist [data-caseid="${response.value}"]`); + + if(itemelm) { + itemelm.click(); + loadInputSettings(panel_div); + + Toastify({ + text: 'Has Sync Update', + duration: 1500, + callback: function(){ + this.remove(); + } + }).showToast(); + } + } + }); + } + }); + + if(location.hostname === 'meet.google.com') { + getChromeStorage('cdtx_casecurrent', (response) => { + if(dataStatus.cdtx_casecurrent !== response.value) { + var itemelm = panel_div.querySelector(`._panel__caselist [data-caseid="${response.value}"]`); + if(itemelm) { + itemelm.click(); + dataStatus.cdtx_casecurrent = response.value; + + Toastify({ + text: 'Has Sync', + duration: 1500, + callback: function(){ + this.remove(); + } + }).showToast(); + } + } + }); + } + + } catch (error) { + Toastify({ + text: 'New Version Tag VN Extension
    PLEASE REFRESH PAGE', + duration: 1000 * 5, + class: "error", + callback: function(){ + this.remove(); + } + }).showToast(); + clearInterval(myRecheckRealtime); + } + }, 2000); + + // 10. Autoresize Textare + textareaAutoResize(); + + + // 11. Load action toolbar + load_script_toolaction() + + + // 12. load setting + loadInputSettings(panel_div); + + // 13. XXXX + + + // 12. XXXX + + } +} +// ========= +// loadpanelcaseconnect +// ========= +var loadpanelcaseconnect = (is_reload = false) => { + + var _pos_append_html = function (cdtx_paneldivhtml) { + if( + window.location.hostname === "meet.google.com" || + window.location.hostname === "calendar.google.com" || + window.location.hostname === "cases.connect.corp.google.com" && window.location.href.indexOf("#/case/") > - 1 || + _global_status.test + ) { + // 1 document.body.classList.add("_panel_sidebar"); + document.documentElement.className += ' _panel_sidebar _hide_main '; + document.body.insertAdjacentHTML("afterEnd", cdtx_paneldivhtml); + // 2 add shortcut button to connect cases + + if(window.location.hostname === "meet.google.com") { + var _addshortcutbtn_meet = () => { + var _panel_addshortcutbtn = document.querySelector(".dock-container._panel_btnshortcut"); + if(!_panel_addshortcutbtn) { + var dock_container = document.body; + if(dock_container) { + var strhtml = `
    +
    +
    + +
    +
    +
    `; + var dock_container_add = _TrustScript(strhtml); + // // Open + // document.querySelector('[data-btnaction="openmain"]').click(); + dock_container.insertAdjacentHTML("afterEnd", dock_container_add); + document.querySelector('._panel_shortcut_toggleopenmain_withoutsave').addEventListener("click", (e) => { + toggleClass("hide_main", panel_div) + toggleClass("_hide_main", document.documentElement) + }); + } + + } + }; + + _addshortcutbtn_meet(); + } + + if(window.location.hostname === "cases.connect.corp.google.com" ) { + cLog(() => {console.log('1. isReadyBasic')}); + + isReadyBasic(() => { + var _addshortcutbtn = () => { + var _panel_addshortcutbtn = document.querySelector(".dock-container._panel_btnshortcut"); + if(!_panel_addshortcutbtn) { + var dock_container = document.querySelector(".dock-container"); + if(dock_container) { + var strhtml = `
    +
    +
    + +
    +
    +
    +
    + +
    +
    +
    +
    + +
    +
    + + + + + + + +
    `; + + var dock_container_add = _TrustScript(strhtml); + // // Open + // document.querySelector('[data-btnaction="openmain"]').click(); + dock_container.insertAdjacentHTML("afterEnd", dock_container_add); + document.querySelector('._panel_shortcut_toggleopenmain_withoutsave').addEventListener("click", (e) => { + toggleClass("hide_main", panel_div) + toggleClass("_hide_main", document.documentElement) + }); + + document.querySelector('._panel_shortcut_openemailtemplate').addEventListener("click", (e) => { + document.querySelector('[data-btnaction="openemailtemplate"]').click(); + }); + + document.querySelector('._panel_shortcut_fisrtemail').addEventListener("click", (e) => { + document.querySelector('[data-btnaction="firstemail"]').click(); + }); + + + // go/TeamVn + var _timekey_current = new Date().getDate(); + if(sessionStorage.getItem("goTeamVNToDay") != _timekey_current) { + document.querySelector('._panel_shortcut_go_teamvietnam').classList.add('notview_today'); + } + + document.querySelector('._panel_shortcut_go_teamvietnam').addEventListener("click", (e) => { + sessionStorage.setItem("goTeamVNToDay", _timekey_current); + e.target.remove(); + }); + + + } + + } + }; + + // Start + + + + // 0.2 _addshortcutbtn + cLog(() => {console.log('_addshortcutbtn');}) + wait4Elem('[debug-id="case-id"] .case-id').then(function () { + _addshortcutbtn(); + }); + + // recheck + setInterval(() => { + _addshortcutbtn(); + }, 5000); + + + // 2. CR Button Email Template + onClickElm('[debug-id="canned_response_button"]', 'click', function(elm, e){ + // var _isGCC = window.dataTagteam.current_case.am_isgcc ? true : false; + // th_prepareForEmail(_isGCC); + + + // wait4Elem('material-dialog footer').then(dialog => { + // if(!document.querySelector('#cr-list')) {th_prepareCR()}; + // }); + + // Check + cLog(() => {console.log("checkInputEmailInbox 3"); }); + checkInputEmailInbox(); + }); + + // 3. Show by dock + onClickElm(`.dock-container [debug-id]:not([debug-id="dock-item-home"])`, `click`, (elm, e) => { + // allow + if(window.tagteamoption.optionkl__disable_dialog === false) { + // Detech human click by XY + if(e.offsetX > 0 && e.offsetY > 0) { + panel_div.classList.remove("hide_main"); + document.documentElement.classList.remove("_hide_main"); + } + } + }); + + onClickElm(`.dock-container [debug-id="dock-item-home"]`, `click`, (elm, e) => { + // allow + if(window.tagteamoption.optionkl__disable_dialog === false) { + // Detech human click by XY + if(e.offsetX > 0 && e.offsetY > 0) { + panel_div.classList.add("hide_main"); + document.documentElement.classList.add("_hide_main"); + } + } + }); + + onClickElm(`#cr-list li`, `click`, (elm, e) => { + th_clearAndPrepareCRTemplate(); + }); + + + // Action noted card + onClickElm(`noted span`, `click`, (elm, e) => { + // allow + elm.remove(); + }); + + // Remove Note + onClickElm(`[card-type="compose"] [data-notetitle]`, `click`, (elm, e) => { + // allow + elm.removeAttribute("data-notetitle"); + elm.setAttribute("data-notetitlestatus", "ischange"); + }); + onClickElm(`[card-type="compose"] [data-highlight]`, `click`, (elm, e) => { + // allow + elm.removeAttribute("data-highlight"); + }); + + + + // // // 13. Realtime forall + // var _realtime_recheck = () => { + // // Select the node that will be observed for mutations + // var targetNode = document.body; + + // // Options for the observer (which mutations to observe) + // var config = { attributes: true, childList: true, subtree: true }; + + // // Callback function to execute when mutations are observed + // var callback = function(mutationList, observer) { + // var _istopelm = document.querySelector(`.write-cards-wrapper:not([style*="display:none"]):not([style*="display: none"]) card.write-card.is-top[card-type="compose"]`); + // if(_istopelm) { + // cLog(() => {console.log("checkInputEmailInbox 3"); }); + // checkInputEmailInbox(); + // } + // }; + + // // Create an observer instance linked to the callback function + // var observer = new c(callback); + + // // Start observing the target node for configured mutations + // observer.observe(targetNode, config); + // } + // _realtime_recheck(); + + + }); + } + + + // Return + return true; + } + + + // add shortcut button to connect cases + // if( + // window.location.hostname === ""|| + // _global_status.test + // ) { + + // return true; + + // } + + return true; + + }; + + // SHOW content + var cdtx_paneldivhtml = _TrustScript(window.dataTagteam.panel_div); + _pos_append_html(cdtx_paneldivhtml); + + set_init_load(); + // load_action_script_reading(); +} + +// Load Data Status Case List +function autoLoadCode(keyaction) { + getChromeStorage('cdtx_settings', (response) => { + var _datatemp = response.value || false; + window.dataTagTeamSettings = response.value || false; + + // Load + var _object = {}; + if(_datatemp) { + _object = _datatemp; + } + + switch (keyaction) { + case 'auto_loadcode_vanbo': + if(typeof _datatemp.auto_loadcode_vanbo === "undefined") { + window.dataTagteam.tagteamFocusCase(); + } + break; + + case 'auto_loadgtmid': + if(typeof _datatemp.auto_loadcode_vanbo === "undefined") { + tagteam_showGTMID(); + } + break; + + default: + break; + } + }); +} + +function loadInit() { + // 0.0 + // Load style + var cdtx_panel_div_style = _TrustScript(window.dataTagteam.panel_div_style); + document.body.insertAdjacentHTML("afterEnd", cdtx_panel_div_style); + + + // 0.0 + // Load GTM ID + if( + window.location.hostname === "tagmanager.google.com" || + window.location.hostname === "tagmanager-ics.corp.google.com" + ) { + autoLoadCode('auto_loadgtmid'); + } + + // 0.1 Load panel + if(window.tagteamoption.optionkl__disable_dialog == false) { + loadpanelcaseconnect(); + } + + // 0.1 Load focus case + if(window.tagteamoption.optionkl__disable_focuscase == false) { + if(window.location.hostname === "cases.connect.corp.google.com" && window.location.href.indexOf("#/case/") > - 1) { + isReadyBasic(() => { + autoLoadCode('auto_loadcode_vanbo'); + }); + + // var hashchange_oncevanbo = false; + // if(hashchange_oncevanbo === false) { + // hashchange_oncevanbo = true; + // window.addEventListener('hashchange', () => { + // // Load code van bo + // isReadyBasic(() => { + // autoLoadCode('auto_loadcode_vanbo'); + // }); + // }, false); + // } + } + } + +} + +// ============ +// LOAD CASE +// ============ +getChromeStorage('cdtx_settings', (response) => { + window.dataTagTeamSettings = response.value || false; + + getChromeStorage("cdtx_datastatus", (response) => { + dataStatus = response.value || dataStatus; + loadDataStatusCaseList(() => { + cLog(() => {console.log("0 = Case connect")}); + // Load Dialog + loadInit(); + + }); + + + + }); +}); + + +// ============== +// BACKDOOR +// ============== + switch(location.hash) { + + case "#hide_panel": + localStorage["hide_panel"] = true; + return false; + break; + + case "#show_panel": + localStorage["hide_panel"] = false; + break; + + case "#remove__paneldivhtml": + removeChromeStorage("cdtx_paneldivhtml", () => { + + }); + break; + + case "#test_all": + backdoor_manage_keystorage(); + break; + + } + if(_global_status.test) { + backdoor_manage_keystorage(); + } + // Get Case List + // 1. load all + function backdoor_manage_keystorage() { + wait4Elem(".list_keystorage").then(() => { + chrome.storage.local.get(null, function(results) { + var li = ""; + for (let key in results) { + li += `
  • ${key} Remove
  • `; + console.log(key, results[key]); + } + + panel_div.querySelector("ul.list_keystorage").innerHTML = _TrustScript(li); + + document.querySelectorAll("ul.list_keystorage [data-btnremovekeystorage]").forEach((elm) => { + elm.addEventListener("click", (e) => { + var key = elm.getAttribute('data-btnremovekeystorage'); + + if (confirm("You sure remove: " + key)) { + removeChromeStorage(key, () => { + Toastify({ + text: `Remove ${key} success`, + duration: 3000, + callback: function(){ + this.remove(); + } + }).showToast(); + + elm.closest("li").remove(); + }); + } + }); + }); + }); + }); + + } + +} diff --git a/tagteams/groups/th_panel_div.js b/tagteams/groups/th_panel_div.js new file mode 100644 index 0000000..dce6360 --- /dev/null +++ b/tagteams/groups/th_panel_div.js @@ -0,0 +1,1933 @@ +// ._panel_btnshortcut { + // position: relative + // } + // ._panel_btnshortcut:after { + // content: "1. Missing Precall\A 2. Is GCC"; + // background: #F44336; + // border: 1px solid #fff; + // border-left: 0; + // color: #fff; + // font-size: 12px; + // display: block; + // font-weight: bold; + // position: absolute; + // left: 100%; + // top: 30px; + // height: auto; + // width: 100px; + // padding: 5px 10px; + // z-index: 99999; + // border-radius: 0 5px 5px 0; + // opacity: 0.9; + // white-space: pre-wrap; + // } + + + + + // tagteamext_demo-th_panel_div.js.php + var th_list_emailtemplatecontent = { + 'first_email': `
    + + + + + + + +
    Tin vui! Nhóm giải pháp kỹ thuật đã nhận được yêu cầu của bạn
    + + + + + + +
    + + + + + + + + + +
    CUSTOMER NAME thân mến!
    +

    Cảm ơn bạn đã đặt lịch hẹn với Nhóm giải pháp kỹ thuật của Google. Người đại diện của Google đã thay mặt bạn đặt lịch hẹn này và chúng tôi sẽ hỗ trợ bạn theo Mã yêu cầu 0-00000000000000 cho customer_website.com

    +

    Vui lòng kiểm tra hộp thư đến trong email của bạn để tìm lời mời trên lịch cho cuộc hẹn sắp tới với chúng tôi, và làm theo hướng dẫn được trình bày trong thư để xác nhận việc bạn sẽ tham dự cuộc hẹn. Để chuẩn bị cho cuộc gọi, vui lòng xem và hoàn tất những Việc cần làm được nêu tại đây.

    +

    +

    Nếu bạn có câu hỏi trước khi tham gia cuộc gọi hoặc muốn thêm những người tham dự khác, vui lòng cho chúng tôi biết bằng cách trả lời email này hoặc liên hệ với Người đại diện bán hàng của Google. Chúng tôi rất mong được làm việc với bạn! Cảm ơn bạn.

    +
    +
    + + + + + + +
    + + + + + + +
    Giải pháp kỹ thuật của Google
    +
    +

    +

    + + + + + + +
    + + + + + + +
    Yêu cầu số 0-00000000000000
    +
    +
    `, + 'send_google_meet_link': `
    + + + + + + +
    + + + + + + +
    + + + + + + + + + +
    CUSTOMER NAME thân mến!
    +

    Gửi bạn link cuộc họp trên Google Meet!

    +

    Truy cập link google cuộc họp tại đây + Hoặc qua: LINK

    +

    Xin cảm ơn!

    +

    Trân trọng!

    +
    +
    + + + + + + +
    + + + + + + + +
    + YOUR-NAME
    + Đội giải pháp kỹ thuật
    TDCX đại diện của Google
    +
    +
    +

    +

    + + + + + + +
    + + + + + + +
    Yêu cầu số 0-00000000000000
    +
    +
    `, + 'huong_dan_chen_ma_gtm_va_xac_nhan_lich_hen': `
    + + + + + + +
    + + + + + + +
    + + + + + + + + + +
    CUSTOMER NAME thân mến!
    +

    Đầu tiên là xin chúc bạn một ngày tràn đầy niềm vui.

    +

    Như qua trao đổi thì cần phía đội ngũ phát triển website giúp đỡ về việc chèn mã theo dõi vào website:

    +
      +
    1. Mã theo dõi của mình là GTM-MZL8JS7
    2. +
    3. Có thể copy theo dõi GTM (Google tag manager) dành cho <head> vui lòng truy cập: https://jsfiddle.net/n3p8kst0/
      + Lưu ý: Thay thế GTM-XXXXXXX bằng mã ở trên của bạn +
    4. +
    5. Xem hướng dẫn chèn mã tại: https://developers.google.com/tag-platform/tag-manager/web
    6. +
    +

    Cuộc hẹn tiếp theo để hướng dẫn bạn sẽ vào lúc 4 giờ chiều ngày 1/11/2023 theo giờ Việt Nam. Rất mong sự có mặt của bạn để hoàn thành quá trình cài đặt cho trường hợp này.

    +

    Xin cảm ơn!

    +

    Trân trọng!

    +
    +
    + + + + + + +
    + + + + + + + +
    + YOUR-NAME
    + Đội giải pháp kỹ thuật
    TDCX đại diện của Google
    +
    +
    +

    +

    + + + + + + +
    + + + + + + +
    Yêu cầu số 0-00000000000000
    +
    +
    `, + 'as_reschedule_1': `
    + + + + + + +
    + + + + + + +
    + + + + + + + + + +
    CUSTOMER NAME thân mến!
    +

    Chúng tôi đã nhận được yêu cầu của bạn về việc dời lịch cho cuộc gọi hỗ trợ triển khai Tasks cho nhuahuongchi.com.

    +

    +

    Chúng tôi rất mong được trợ giúp bạn! Xin lưu ý rằng do nhu cầu sử dụng dịch vụ của chúng tôi đang ở mức cao, nên chúng tôi không có nhiều thời gian rảnh. Chúng tôi hiểu rằng việc triển khai này rất quan trọng đối với bạn, vì vậy, điều quan trọng là bạn có thể tham gia cuộc gọi vào thời điểm đã lên lịch để tránh bỏ lỡ cơ hội này. Đây là lần dời lịch cuối cùng và chúng tôi sẽ không thể tiếp tục dời lịch hẹn nữa.

    +


    Lịch hẹn đã được dời sang 11 giờ ngày 19/10/2022 theo giờ Việt Nam và chúng tôi sẽ gọi cho bạn theo số điện thoại mà bạn đã cung cấp: +84 96 693 19 48

    Nếu bạn không rảnh vào thời gian này vì bất cứ lý do gì, vui lòng cho chúng tôi biết bằng cách trả lời email này.

    Chúng tôi rất mong được trò chuyện với bạn!

    +

    Trân trọng!

    +
    +
    + + + + + + +
    + + + + + + + +
    + YOUR-NAME
    + Đội giải pháp kỹ thuật
    TDCX đại diện của Google
    +
    +
    +

    +

    + + + + + + +
    + + + + + + +
    Yêu cầu số 0-00000000000000
    +
    +
    `, + 'so_verified': `
    + + + + + + + +
    Xin chúc mừng, trường hợp của bạn đã được triển khai thành công
    + + + + + + +
    + + + + + + + + + +
    CUSTOMER NAME thân mến!
    +

    Xin chúc mừng! 

    +

    Đối với trường hợp + 5-6594000033737, chúng tôi rất vui mừng được thông báo rằng quá trình triển khai đã hoàn tất thành công. Chúng tôi đang ghi nhận các lượt hiển thị đã xác minh, nên có thể xác nhận rằng chiến dịch của bạn đang hoạt động đúng cách và như dự kiến! +

    +

    Điều này có nghĩa là trường hợp 5-6594000033737 hiện đã được đóng thành công. Nếu bạn gặp vấn đề, có mối lo ngại hay câu hỏi chung, thì nhóm của chúng tôi luôn sẵn sàng và rất mong được trợ giúp bạn!

    +

    Bạn nên liên hệ với Người quản lý tài khoản của Google nếu cần đặt lại lịch hẹn với chúng tôi trong tương lai.

    +

    +

    +

    Cảm ơn bạn đã hợp tác lâu dài với Google! 

    +
    +

    Trân trọng!

    +
    +
    + + + + + + +
    + + + + + + + +
    + YOUR-NAME
    + Đội giải pháp kỹ thuật
    TDCX đại diện của Google
    +
    +
    +

    +

    + + + + + + +
    + + + + + + +
    Yêu cầu số 0-00000000000000
    +
    +
    `, + 'ni_attempted_contact': `
    + + + + + + + +
    Chúng tôi đã cố gắng liên lạc với bạn hôm nay
    + + + + + + +
    + + + + + + + + + +
    CUSTOMER NAME thân mến!
    +

    + Đầu thư, chúng tôi xin chúc bạn có một ngày tốt lành! 
    +
    + Hôm nay, nhóm giải pháp kỹ thuật của chúng tôi đã cố gắng gọi điện cho bạn để trao đổi về yêu cầu Tasks cho + nhuahuongchi.com
    + Chúng tôi đã thử gọi cho bạn một lần nữa sau 10 phút, nhưng rất tiếc vẫn không thể gặp được bạn
    +
    + Chúng tôi sẽ thử gọi cho bạn một lần cuối vào ngày làm việc tiếp theo. Nếu vẫn không thể liên lạc với bạn, chúng tôi sẽ đóng trường hợp này. 
    +
    + Bạn có thể mở lại trường hợp này bất cứ lúc nào theo một trong các cách sau: +

    +
      +
    • Trả lời email này để cho biết ngày và giờ thuận tiện cho bạn.
    • +
    • Liên hệ với Người quản lý tài khoản của Google để nhờ họ giúp bạn liên hệ lại với chúng tôi. 
    • +
    +

    Cảm ơn bạn!

    +

    Trân trọng!

    +
    +
    + + + + + + +
    + + + + + + + +
    + YOUR-NAME
    + Đội giải pháp kỹ thuật
    TDCX đại diện của Google
    +
    +
    +

    +

    + + + + + + +
    + + + + + + +
    Yêu cầu số 0-00000000000000
    +
    +
    `, + 'in_not_reachable': `
    + + + + + + + +
    Trường hợp của bạn đã bị đóng do không nhận được phản hồi từ phía bạn
    + + + + + + +
    + + + + + + + + + +
    CUSTOMER NAME thân mến!
    +

    Đối với trường hợp 5-6594000033737 cho nhuahuongchi.com, chúng tôi đã chờ bạn phản hồi để tiến hành việc triển khai.  Rất tiếc, vì bạn không phản hồi, nên chúng tôi hiện đã đóng trường hợp này. 

    +

    Nếu vẫn muốn tiến hành việc triển khai này, bạn có thể tham khảo Trung tâm trợ giúp của Google hoặc liên hệ với Người quản lý tài khoản của Google bất cứ lúc nào. Họ luôn sẵn sàng trợ giúp bạn
    + Chúng tôi rất mong được tiếp tục hợp tác với bạn trong tương lai!  +

    +
    +

    Nếu bạn muốn tìm hiểu thêm về tính năng Theo dõi lượt chuyển đổi ngoại tuyến, thì sau đây là một số đường liên kết đến các tài nguyên có giá trị mà bạn có thể thấy hữu ích! 

    + +
    +

    Trân trọng!

    +
    +
    + + + + + + +
    + + + + + + + +
    + YOUR-NAME
    + Đội giải pháp kỹ thuật
    TDCX đại diện của Google
    +
    +
    +

    +

    + + + + + + +
    + + + + + + +
    Yêu cầu số 0-00000000000000
    +
    +
    `, + 'so_verification_not_needed': `
    + + + + + + + +
    Trường hợp của bạn đã được triển khai thành công
    + + + + + + +
    + + + + + + + + + +
    CUSTOMER NAME thân mến!
    +

    Xin chúc mừng! 

    +

    Đối với trường hợp  5-6594000033737, chúng tôi rất vui mừng được thông báo rằng chúng tôi đã triển khai thành công Tasks trên trang web của bạnnhuahuongchi.com và cũng nhận thấy thẻ này đang hoạt động theo thời gian thực.

    +

    Chúng tôi sẽ đóng yêu cầu này. Tuy nhiên, nếu tình hình của bạn thay đổi, vui lòng liên hệ với Người quản lý tài khoản của Google hoặc tham khảo trung tâm trợ giúp. Họ luôn sẵn sàng trợ giúp bạn!

    +

    Cảm ơn bạn đã hợp tác lâu dài với Google! 

    +

    Nếu bạn muốn tìm hiểu thêm, thì sau đây là một số đường liên kết dẫn đến các tài nguyên có giá trị liên quan đến việc Triển khai thẻ và nguồn cấp dữ liệu mua sắm. Các tài nguyên này có thể hữu ích để bạn sử dụng trong tương lai!

    +

    Thẻ liên quan

    + +

    Nguồn cấp dữ liệu mua sắm liên quan

    + +

    +

    +

    Cảm ơn bạn!

    +

    Trân trọng!

    +
    +
    + + + + + + +
    + + + + + + + +
    + YOUR-NAME
    + Đội giải pháp kỹ thuật
    TDCX đại diện của Google
    +
    +
    +

    +

    + + + + + + +
    + + + + + + +
    Yêu cầu số 0-00000000000000
    +
    +
    `, + 'ni_awaiting_validation': `
    + + + + + + + +
    Đang chờ hiển thị / chuyển đổi
    + + + + + + +
    + + + + + + + + + +
    CUSTOMER NAME thân mến!
    +

    + Cảm ơn bạn đã liên hệ với Nhóm giải pháp kỹ thuật về việc ZZZ cho + nhuahuongchi.com +

    +
      +

      Hiện tại, chúng tôi đã hoàn tất việc triển khai và đang theo dõi trường hợp này để đảm bảo mọi thứ hoạt động đúng như dự kiến và mang lại kết quả mong muốn.
      +
      + Các bước tiếp theo
      + Việc cài đặt sẽ được coi là đã hoàn tất thành công sau khi chúng tôi ghi nhận lượt hiển thị/lượt chuyển đổi đúng như dự kiến. 
      +
      + Nếu việc triển khai không diễn ra như dự kiến, chúng tôi sẽ cố gắng giải quyết/điều tra vấn đề và liên hệ với bạn nếu cần.
      +
      + Nếu bạn muốn tìm hiểu thêm, thì sau đây là một số đường liên kết dẫn đến các tài nguyên có giá trị liên quan đến việc Triển khai thẻ và nguồn cấp dữ liệu mua sắm. Các tài nguyên này có thể hữu ích để bạn sử dụng trong tương lai!
      +
      + Thẻ liên quan
      +

      + +

      Nguồn cấp dữ liệu mua sắm liên quan

      + +

      +

      +

      Cảm ơn bạn!

      +

      Trân trọng!

      +
      +
      + + + + + + +
      + + + + + + + +
      + YOUR-NAME
      + Đội giải pháp kỹ thuật
      TDCX đại diện của Google
      +
      +
      +

      +

      + + + + + + +
      + + + + + + +
      Yêu cầu số 0-00000000000000
      +
      +
      `, + 'ec_a_if_pii_is_visible_available': `
      + + + + + + + +
      Những điều kiện cần thiết cho Cuộc hẹn triển khai Chuyển đổi nâng cao
      + + + + + + +
      + + + + + + + + + +
      CUSTOMER NAME thân mến!
      + +

      Cảm ơn bạn đã lên lịch hẹn với Đội giải pháp kỹ thuật vào lúc 01/01/2023. Để chia sẻ màn hình hỗ trợ cho quá trình triển khai, vui lòng nhấp vào đường liên kết sau để tham gia cuộc họp Google Meet: LINK . Chúng tôi sẽ liên hệ đến bạn theo số điện thoại được cung cấp:  0978000000.


      +

      Để buổi cài đặt được triển khai thành công, bạn vui lòng xem qua và hoàn thành danh sách sau trước khi cuộc gọi diễn ra:


      +
        +
      1. Chấp thuận “Điều khoản dữ liệu khách hàng" trong mục Cài đặt Lượt chuyển đổi trước khi cuộc gọi diễn ra. Vui lòng thao tác theo các bước sau: Trên tài khoản Google Ads của bạn, chọn “Đo lường" > chọn “Lượt chuyển đổi" > chọn “Cài đặt" > chấp nhận mục “Điều khoản dữ liệu khách hàng”.
      2. +
      3. Đảm bảo rằng trang chuyển đổi của bạn có chứa “Thông tin nhận dạng cá nhân của người dùng” (địa chỉ Email, Số điện thoại). 
      4. +
      5. Đảm bảo trang web của bạn được mã hóa thông qua HTTPS.
      6. +
      7. Đảm bảo rằng người có quyền quản trị đối với tài khoản Google Ads (người có thể thực hiện các thay đổi đối với quảng cáo Google Ads) tham gia vào cuộc gọi.
      8. +
      9. Đảm bảo rằng người có quyền quản trị đối với mã nguồn trang web của bạn/ hoặc GTM (ví dụ như quyền truy cập vào bảng điều khiển của Quản trị viên và/ hoặc GTM) tham gia cuộc gọi và đảm bảo tạo bản sao lưu trang web trước khi triển khai.
      10. +
      11. Kiểm tra lượt chuyển đổi (Gửi biểu mẫu/ Đặt hàng thành công) là bước quan trọng để xác nhận việc triển khai. Vui lòng đảm bảo người có đủ thẩm quyền để thực hiện các hành động này tham gia vào cuộc gọi.
      12. +

      +

      Lưu ý : Lượt chuyển đổi nâng cao cho trang web chỉ đủ điều kiện để theo dõi lượt chuyển đổi được thiết lập từ trong tài khoản Google Ads và không được nhập từ các nguồn khác, ví dụ như Google Analytics. Nguồn chuyển đổi phải là Trang web và được cài đặt qua GTM hoặc mã nguồn website thông qua Thẻ toàn trang web. Bạn có thể tham khảo tài liệu này để biết thêm thông tin.


      +

      Trong trường hợp bạn gặp bất kỳ khó khăn nào với các bước triển khai được liệt kê trên, cuộc gọi sẽ cần phải hẹn lại để hoàn tất cho việc triển khai. Nếu bạn cần dời lại cuộc hẹn này, vui lòng cho chúng tôi biết bằng cách trả lời email này và chúng tôi sẽ sắp xếp thời gian phù hợp hơn cho bạn.


      +

      Trân trọng,

      + + +
      +
      + + + + + + +
      + + + + + + + +
      + YOUR-NAME
      + Đội giải pháp kỹ thuật
      TDCX đại diện của Google
      +
      +
      +

      +

      + + + + + + +
      + + + + + + +
      Yêu cầu số 0-00000000000000
      +
      +
      `, + 'ec_b_automatic_eligible_if_pii_is_not_visible_available': `
      + + + + + + + +
      Những điều kiện cần thiết cho Cuộc hẹn triển khai Chuyển đổi nâng cao
      + + + + + + +
      + + + + + + + + + +
      CUSTOMER NAME thân mến!
      + +

      Cảm ơn bạn đã lên lịch hẹn với Đội giải pháp kỹ thuật vào lúc 01/01/2023. Để chia sẻ màn hình hỗ trợ cho quá trình triển khai, vui lòng nhấp vào đường liên kết sau để tham gia cuộc họp Google Meet: LINK . Chúng tôi sẽ liên hệ đến bạn theo số điện thoại được cung cấp:  0978000000.

      +

      Để buổi cài đặt được triển khai thành công, bạn vui lòng xem qua và hoàn thành danh sách sau trước khi cuộc gọi diễn ra:

      +
        +
      1. Chấp thuận 'điều khoản dữ liệu khách hàng' trong Cài đặt chuyển đổi trước cuộc gọi. Vui lòng thực hiện theo các bước bên dưới để hoàn tất quá trình này: trong tài khoản Google Ads của bạn , hãy nhấp vào “Đo lường > Chuyển đổi > Cài đặt > chấp nhận mục “ Điều khoản dữ liệu khách hàng”.

      2. +
      3. Đảm bảo trang web của bạn được mã hóa thông qua HTTPS.

      4. +
      5. Đảm bảo rằng người có quyền quản trị đối với tài khoản Google Ads (người có thể thực hiện các thay đổi đối với quảng cáo Google Ads) tham gia vào cuộc gọi.

      6. +
      7. Đảm bảo rằng người có quyền quản trị đối với mã nguồn trang web của bạn/ hoặc GTM (ví dụ như quyền truy cập vào bảng điều khiển của Quản trị viên và/ hoặc GTM) tham gia cuộc gọiđảm bảo tạo bản sao lưu trang web trước khi triển khai.

      8. +
      9. Vui lòng liên hệ với Người quản lý tài khoản Google Ads của bạn để đảm bảo bạn có đủ điều kiện tham gia EC Alpha và nó có phù hợp với bạn hay không. Tuy nhiên, nếu bạn vẫn muốn tiếp tục triển khai với phương pháp thủ công, xin hãy liên hệ với Nhà phát triển website của bạn và đảm bảo rằng trang chuyển đổi của bạn có thông tin Người dùng bắt buộc (Số điện thoại, địa chỉ email hoặc Tên đầy đủ cùng với Địa chỉ vật lý). Đây là đoạn mẫu của biến lớp dữ liệu {Add data layer code for GTM/Gtag code here}.
      10. +

      +

      Lưu ý : Lượt chuyển đổi nâng cao cho trang web chỉ khả dụng cho các lượt chuyển đổi được thiết lập từ trong tài khoản Google Ads và không được nhập từ các nguồn khác, ví dụ như Google Analytics. Nguồn chuyển đổi phải là Trang web và được cài đặt qua GTM hoặc mã nguồn website thông qua Thẻ toàn trang web. Bạn có thể tham khảo tài liệu này để biết thêm thông tin.


      +

      Trong trường hợp bạn gặp bất kỳ khó khăn nào với các bước được liệt kê trước khi triển khai ở trên, cuộc gọi sẽ phải được đặt lại để hoàn tất cho việc triển khai. Nếu bạn cần dời lại cuộc hẹn này, vui lòng cho chúng tôi biết bằng cách trả lời email này và chúng tôi sẽ sắp xếp thời gian phù hợp hơn cho bạn.


      +

      Trân trọng,

      + + + +
      +
      + + + + + + +
      + + + + + + + +
      + YOUR-NAME
      + Đội giải pháp kỹ thuật
      TDCX đại diện của Google
      +
      +
      +

      +

      + + + + + + +
      + + + + + + +
      Yêu cầu số 0-00000000000000
      +
      +
      `, + 'ec_c_automatic_not_eligible_if_pii_is_not_visible_available': `
      + + + + + + + +
      Những điều kiện cần thiết cho Cuộc hẹn triển khai Chuyển đổi nâng cao
      + + + + + + +
      + + + + + + + + + +
      CUSTOMER NAME thân mến!
      +

      Cảm ơn bạn đã lên lịch hẹn với Đội giải pháp kỹ thuật vào lúc 01/01/2023. Để chia sẻ màn hình hỗ trợ cho quá trình triển khai, vui lòng nhấp vào đường liên kết sau để tham gia cuộc họp Google Meet: LINK . Chúng tôi sẽ liên hệ đến bạn theo số điện thoại được cung cấp:  0978000000.

      +

      Để buổi cài đặt được triển khai thành công, bạn vui lòng xem qua và hoàn thành danh sách sau trước khi cuộc gọi diễn ra:

      +
        +
      1. Chấp thuận 'điều khoản dữ liệu khách hàng' trong Cài đặt chuyển đổi trước cuộc gọi. Vui lòng thực hiện theo các bước bên dưới để hoàn tất quá trình này: trong tài khoản Google Ads của bạn , hãy nhấp vào “Đo lường > Chuyển đổi > Cài đặt > chấp nhận mục “ Điều khoản dữ liệu khách hàng”.
      2. +
      +
        +
      1. Đảm bảo rằng trang chuyển đổi của bạn có chứa “Thông tin nhận dạng cá nhân của người dùng” (địa chỉ Email, Số điện thoại).  Đây là đoạn mẫu của biến lớp dữ liệu  {Add data layer code for GTM/Gtag code here}.
      2. +
      +
        +
      1. Đảm bảo trang web của bạn được mã hóa thông qua HTTPS.
      2. +
      +
        +
      1. Đảm bảo rằng người có quyền quản trị đối với tài khoản Google Ads (người có thể thực hiện các thay đổi đối với quảng cáo Google Ads) tham gia vào cuộc gọi.
      2. +
      +
        +
      1. Đảm bảo rằng người có quyền quản trị đối với mã nguồn trang web của bạn/ hoặc GTM (ví dụ như quyền truy cập vào bảng điều khiển của Quản trị viên và/ hoặc GTM) tham gia cuộc gọiđảm bảo tạo bản sao lưu trang web trước khi triển khai.
      2. +
      +
        +
      1. Kiểm tra lượt chuyển đổi (Gửi biểu mẫu/ Đặt hàng thành công) là bước quan trọng để xác nhận việc triển khai. Vui lòng đảm bảo người có đủ thẩm quyền để thực hiện các hành động này tham gia vào cuộc gọi.
      2. +
      +

      Lưu ý : Lượt chuyển đổi nâng cao cho trang web chỉ khả dụng cho lượt chuyển đổi được thiết lập từ trong tài khoản Google Ads và không được nhập từ các nguồn khác, ví dụ như Google Analytics. Nguồn chuyển đổi phải là Trang web và được cài đặt qua GTM hoặc mã nguồn website  thông qua Thẻ toàn trang web. Bạn có thể tham khảo tài liệu này để biết thêm thông tin.

      +

      Trong trường hợp bạn gặp bất kỳ khó khăn nào với các bước triển khai được liệt kê trên, cuộc gọi sẽ cần phải hẹn lại để hoàn tất cho việc triển khai. Nếu bạn cần dời lại cuộc hẹn này, vui lòng cho chúng tôi biết bằng cách trả lời email này và chúng tôi sẽ sắp xếp thời gian phù hợp hơn cho bạn.

      +

      Trân trọng,

      + + +
      +
      + + + + + + +
      + + + + + + + +
      + YOUR-NAME
      + Đội giải pháp kỹ thuật
      TDCX đại diện của Google
      +
      +
      +

      +

      + + + + + + +
      + + + + + + +
      Yêu cầu số 0-00000000000000
      +
      +
      `, + 'ec_d_ecommerce_website_or_cases_when_you_are_unable_to_check_pii': `
      + + + + + + + +
      Những điều kiện cần thiết cho Cuộc hẹn triển khai Chuyển đổi nâng cao
      + + + + + + +
      + + + + + + + + + +
      CUSTOMER NAME thân mến!
      +

      Cảm ơn bạn đã lên lịch hẹn với Đội giải pháp kỹ thuật vào lúc 01/01/2023. Để chia sẻ màn hình hỗ trợ cho quá trình triển khai, vui lòng nhấp vào đường liên kết sau để tham gia cuộc họp Google Meet: LINK . Chúng tôi sẽ liên hệ đến bạn theo số điện thoại được cung cấp:  0978000000.

      +

      Để buổi cài đặt được triển khai thành công, bạn vui lòng xem qua và hoàn thành danh sách sau trước khi cuộc gọi diễn ra:

      +
        +
      1. Chấp thuận “Điều khoản dữ liệu khách hàng" trong mục Cài đặt Lượt chuyển đổi trước khi cuộc gọi diễn ra. Vui lòng thao tác theo các bước sau: Trên tài khoản Google Ads của bạn, chọn “Đo lường" > chọn “Lượt chuyển đổi" > chọn “Cài đặt" > chấp nhận mục “Điều khoản dữ liệu khách hàng”.

      2. +
      3. Đảm bảo rằng trang chuyển đổi của bạn có chứa “Thông tin nhận dạng cá nhân của người dùng” (địa chỉ Email, Số điện thoại). Bạn có thể tìm hiểu thêm từ bài viết này để kiểm tra sự hiện diện của các trường thông tin cần thiết trên trang website.

      4. +
      5. Nếu không, bạn cần kiểm tra tài khoản Google Ads có đang ghi nhận hơn 5 lượt chuyển đổi mỗi ngày, lượt chuyển đổi có thể đến từ bất kỳ hành động nào với Nguồn chuyển đổi là “Trang web”. Nếu không, bạn sẽ cần liên hệ đến nhà phát triển website để đảm bảo trang chuyển đổi của bạn có chứa “Thông tin nhận dạng cá nhân của người dùng” (địa chỉ Email, Số điện thoại) hoặc nhà phát triển website có thể đẩy biến lớp dữ liệu vào trang chuyển đổi của bạn hay không?

      6. +
      7. Đảm bảo trang web của bạn được mã hóa thông qua HTTPS.

      8. +
      9. Đảm bảo rằng người có quyền quản trị đối với tài khoản Google Ads (người có thể thực hiện các thay đổi đối với quảng cáo Google Ads) tham gia vào cuộc gọi.

      10. +
      11. Đảm bảo rằng người có quyền quản trị đối với mã nguồn trang web của bạn/ hoặc GTM (ví dụ như quyền truy cập vào bảng điều khiển của Quản trị viên và/ hoặc GTM) tham gia cuộc gọi và đảm bảo tạo bản sao lưu trang web trước khi triển khai.

      12. +
      13. Kiểm tra lượt chuyển đổi (Gửi biểu mẫu/ Đặt hàng thành công) là bước quan trọng để xác nhận việc triển khai. Vui lòng đảm bảo người có đủ thẩm quyền để thực hiện các hành động này tham gia vào cuộc gọi.
      14. +
      +

      Lưu ý : Lượt chuyển đổi nâng cao cho trang web chỉ khả dụng cho các lượt chuyển đổi được thiết lập từ trong tài khoản Google Ads và không được nhập từ các nguồn khác, ví dụ như Google Analytics. Nguồn chuyển đổi phải là Trang web và được cài đặt qua GTM hoặc mã nguồn website  thông qua Thẻ toàn trang web. Bạn có thể tham khảo tài liệu này để biết thêm thông tin.


      +

      Trong trường hợp bạn gặp bất kỳ khó khăn nào với các bước triển khai được liệt kê trên, cuộc gọi sẽ cần phải hẹn lại để hoàn tất cho việc triển khai. Nếu bạn cần dời lại cuộc hẹn này, vui lòng cho chúng tôi biết bằng cách trả lời email này và chúng tôi sẽ sắp xếp thời gian phù hợp hơn cho bạn.


      +

      Trân trọng,

      +
      +
      + + + + + + +
      + + + + + + + +
      + YOUR-NAME
      + Đội giải pháp kỹ thuật
      TDCX đại diện của Google
      +
      +
      +

      +

      + + + + + + +
      + + + + + + +
      Yêu cầu số 0-00000000000000
      +
      +
      `, + 'ec_e_if_an_advertiser_is_eligible_for_the_automatic_option_based_on_pre_call_checks_keep_either_gtm_or_gtag_one_of_the_two_options_below_option_based_on_advertisers_conversion_set_up': `
      + + + + + + + +
      Những điều kiện cần thiết cho Cuộc hẹn triển khai Chuyển đổi nâng cao
      + + + + + + +
      + + + + + + + + + +
      CUSTOMER NAME thân mến!
      +

      Cảm ơn bạn đã quan tâm về việc triển khai Chuyển đổi Nâng cao. Chúng tôi nhận thấy bạn đã đủ điều kiện để thiết lập theo dõi Chuyển đổi Nâng cao tự động. Vui lòng thao tác theo các bước sau để hoàn tất thiết lập.

      +

      Hướng dẫn

      +
        +
      1. Đăng nhập vào tài khoản Google Ads của bạn.

      2. +
      3. Ở góc trên bên phải của tài khoản, hãy nhấp vào biểu tượng công cụ và bên dưới mục "Đo lường", hãy nhấp vào Lượt chuyển đổi.

      4. +
      5. Mở hành động chuyển đổi mà bạn muốn sử dụng tính năng lượt chuyển đổi nâng cao.

      6. +
      7. Trong phần "Lượt chuyển đổi nâng cao" ở dưới cùng, hãy nhấp vào Bật tính năng lượt chuyển đổi nâng cao.

      8. +
      9. Nhấp vào Đồng ý với tuyên bố tuân thủ điều khoản điều kiện. Bằng cách bật tính năng lượt chuyển đổi nâng cao, bạn xác nhận rằng mình tuân thủ các chính sách của chúng tôi. Điều khoản xử lý dữ liệu của Google Ads (chỉ có bản Tiếng Anh) áp dụng cho việc bạn sử dụng tính năng lượt chuyển đổi nâng cao.

      10. +
      11. Kiểm tra trang web của bạn để tìm thẻ Google bằng cách nhập URL trang đích của bạn và nhấp vào Kiểm tra URL.

      12. +
      13. Trong “Loại thẻ”, bạn sẽ thấy tính năng cài đặt mặc định là Trình quản lý thẻ của Google hoặc thẻ Google của bạn. Bất kỳ phương pháp nào bạn đã sử dụng để thiết lập thẻ trang web cũng sẽ được sử dụng để thiết lập lượt chuyển đổi nâng cao.

      14. +
      15. Nếu bạn đang sử dụng thẻ Google, bạn sẽ được mặc định sử dụng “Thiết lập tự động” nếu khả dụng và có thể hoàn tất thiết lập của mình từ màn hình này. Nếu đang sử dụng Trình quản lý thẻ của Google, bạn có thể nhấp vào Lưu và mở tài khoản Trình quản lý thẻ của Google để hoàn tất phần còn lại của quá trình thiết lập.

      16. +
      17. Tiếp theo, bạn sẽ chọn những phần thông tin khách hàng mà bạn muốn sử dụng cho lượt chuyển đổi nâng cao. Tại thời điểm này, chỉ có Email khả dụng nhưng trong tương lai có thể có các tùy chọn khác như Địa chỉ và Số điện thoại.

      18. +
      19. Nhấp vào Lưu. Bạn sẽ thấy thông báo rằng Google cần một chút thời gian để đánh giá xem chuyển đổi của bạn có hoạt động bình thường với “Thiết lập tự động” hay không. Bạn có thể kiểm tra lại sau khoảng 1 tuần để xem xét trạng thái của hành động chuyển đổi của mình và xem liệu có cần thực hiện bất kỳ hành động bổ sung nào.

      20. +
      +

      Tới đây bạn đã triển khai thành công lượt chuyển đổi nâng cao cho hành động chuyển đổi này. Lặp lại các bước này cho từng hành động chuyển đổi mà bạn muốn triển khai tính năng lượt chuyển đổi nâng cao.


      +

      Vui lòng lưu ý rằng bạn sẽ thấy thông báo rằng “Google cần một chút thời gian để đánh giá xem chuyển đổi của bạn có hoạt động bình thường với “Thiết lập tự động” hay không. Bạn có thể kiểm tra lại sau 1 tuần để xem lại trạng thái của hành động chuyển đổi và liên hệ với Đội ngũ Kỹ thuật đại diện Google nếu cần thực hiện bất kỳ hành động khắc phục hay bổ sung, và chúng tôi sẵn lòng hỗ trợ bạn.


      + + +
      +

      Hoàn tất Thiết lập tự động trong Trình quản lý thẻ của Google

      +

      Trước tiên, hãy đảm bảo rằng bạn đã đợi 5 ngày sau khi ký Điều khoản dịch vụ trong tài khoản Google Ads của mình. Sau khoảng thời gian này, bạn có thể kiểm tra các thẻ theo dõi chuyển đổi của mình trong Trình quản lý thẻ của Google để xem các thẻ đó có được bật cho chuyển đổi nâng cao hay không và tiếp tục triển khai thiết lập.

      +
        +
      1. Đăng nhập vào tài khoản Trình quản lý thẻ của Google.

      2. +
      3. Nhấp vào Không gian làm việc, sau đó nhấp vào Thẻ từ menu điều hướng.

      4. +
      5. Chọn thẻ theo dõi lượt chuyển đổi Google Ads mà bạn muốn triển khai tính năng lượt chuyển đổi nâng cao và chỉnh sửa thẻ đó.

        Nếu bạn chưa thiết lập thẻ theo dõi chuyển đổi Google Ads trong tài khoản Trình quản lý thẻ của Google, hãy tìm hiểu thêm về chuyển đổi Google Ads.

        Đảm bảo hành động chuyển đổi này có cùng ID theo dõi lượt chuyển đổi và nhãn chuyển đổi giống như hành động chuyển đổi mà bạn đã bật tính năng lượt chuyển đổi nâng cao trong tài khoản Google Ads của mình.
      6. +
      +


      +
        +
      1. Nhấp vào Bao gồm dữ liệu do người dùng cung cấp từ trang web của bạn.
        Nếu bạn không thấy điều này, hãy đảm bảo rằng bạn đã ký vào điều khoản dịch vụ trong tài khoản Google Ads đang quản lý hành động chuyển đổi mà bạn đang thiết lập tính năng lượt chuyển đổi nâng cao. Nếu bạn cho rằng mình đã làm việc này, đợi 5 ngày mà vẫn không thấy trường dữ liệu "Cung cấp lượt chuyển đổi nâng cao" trong Trình quản lý thẻ của Google, hãy liên hệ với Đại diện quản lý Google hoặc bộ phận hỗ trợ của Google nếu bạn không có người đại diện quản lý.
      2. +
      +
        +
      1. Trong Dữ liệu người dùng, chọn Biến mới, rồi chọn Dữ liệu do người dùng cung cấp.

      2. +
      3. Chọn Bộ sưu tập tự động.

      4. +
      5. Nhấp vào Lưu cho biến rồi lưu thẻ theo dõi chuyển đổi.

      6. +
      +

      Vui lòng lưu ý rằng bạn sẽ thấy thông báo rằng “Google cần một chút thời gian để đánh giá xem chuyển đổi của bạn có hoạt động bình thường với “Thiết lập tự động” hay không. Bạn có thể kiểm tra lại sau 1 tuần để xem lại trạng thái của hành động chuyển đổi và liên hệ với Đội ngũ Kỹ thuật đại diện Google nếu cần thực hiện bất kỳ hành động khắc phục hay bổ sung, và chúng tôi sẵn lòng hỗ trợ bạn.

      + +
      + +


      Bạn cũng có thể tham khảo Trung tâm trợ giúp để được hướng dẫn thêm về vấn đề này.

      +

      Trân trọng,

      + + +
      +
      + + + + + + +
      + + + + + + + +
      + YOUR-NAME
      + Đội giải pháp kỹ thuật
      TDCX đại diện của Google
      +
      +
      +

      +

      + + + + + + +
      + + + + + + +
      Yêu cầu số 0-00000000000000
      +
      +
      `, + 'ec_f_if_advertiser_imports_google_analytics_conversions_for_tracking_and_wants_to_implement_ec': `
      + + + + + + + +
      Những điều kiện cần thiết cho Cuộc hẹn triển khai Chuyển đổi nâng cao
      + + + + + + +
      + + + + + + + + + +
      CUSTOMER NAME thân mến!
      +

      Cảm ơn bạn đã quan tâm đến việc triển khai Lượt chuyển đổi nâng cao.

      +

      Chúng tôi nhận thấy rằng bạn đang nhập chuyển đổi Google Analytics (GA) vào Google Ads. Nếu bạn đang tìm cách triển khai Lượt chuyển đổi nâng cao cho các lượt chuyển đổi đã nhập từ GA, thì lưu ý rằng  Lượt chuyển đổi nâng cao hiện tại chỉ khả dụng cho những lượt chuyển đổi sử dụng nguồn từ Website / sử dụng tính năng theo dõi lượt chuyển đổi gTag.

      +

      Chúng tôi xin lỗi vì bất kỳ sự bất tiện nào mà điều này có thể đã gây ra.

      +

      Trân trọng,

      + + +
      +
      + + + + + + +
      + + + + + + + +
      + YOUR-NAME
      + Đội giải pháp kỹ thuật
      TDCX đại diện của Google
      +
      +
      +

      +

      + + + + + + +
      + + + + + + +
      Yêu cầu số 0-00000000000000
      +
      +
      `, + 'ec_g_if_advertiser_cms_is_not_supported_for_ec_implementation_send_this_email': `
      + + + + + + + +
      Những điều kiện cần thiết cho Cuộc hẹn triển khai Chuyển đổi nâng cao
      + + + + + + +
      + + + + + + + + + +
      CUSTOMER NAME thân mến!
      +

      Cảm ơn bạn đã quan tâm đến việc triển khai Lượt chuyển đổi nâng cao. 

      +

      Chúng tôi nhận thấy rằng bạn đang sử dụng Hệ thống quản lý nội dung (CMS) của {Insert CMS Name} và hiện tại chúng tôi không thể hỗ trợ triển khai cho CMS này. Vui lòng liên hệ với Đội ngũ hỗ trợ nền tảng CMS tương ứng của bạn để được hướng dẫn. 

      +

      Chúng tôi xin lỗi vì bất kỳ sự bất tiện nào mà điều này có thể đã gây ra.

      +

      Trân trọng,

      + + +
      +
      + + + + + + +
      + + + + + + + +
      + YOUR-NAME
      + Đội giải pháp kỹ thuật
      TDCX đại diện của Google
      +
      +
      +

      +

      + + + + + + +
      + + + + + + +
      Yêu cầu số 0-00000000000000
      +
      +
      `, + + }; + + var th_panel_div_style = ``; + + var th_panel_div = ` +
      + +
      + + + + + + + + + + + +
      +
      +
      +
      +
      +
      + + +
      +
      + Mini + Darkmode +
      +
      +
      +
      +
      + + + + + + + + + + + + + + + + + List case + + + + + + + + + + + +
      +
      +
      +
      +
      +
      +
      +
      +
      +
      +
      +
      +
      +
      +
      + Case ID: CASEID + + + + + + + + + +
      + Ads ID: + 123-321-0000 + + + + + + + + + + +
      + +
      +
      + Customer: CUSTOMER_NAME () (zzz@ccc.com) +
      + Website: CUSTOMER_WEBSITE
      + Contact: CUSTOMER_CONTACT
      +
      + Status+: +
      + QLUS_STATUS + +
      + +
      + Schedule: + +
      +
      +
      +
      + Note: Push to case summary + + Tasks: TASKS
      + Attribution Model: customer_attributionmodel
      +
      + Request: + +
      +
      + AM: AM_NAME (zzz@ccc.com) +
      + Đơn vị: ZZZZZ Sales program +
      + Meeting_time: 01/01/2022 + +
      + Assign to: JOINX, +
      +
      +
      +

      OTHER

      +
      +
      +
      + Case ID: + + Ads ID: + +
      +
      + AM: + + Email: + + Sales Program: + + +
      +
      + Task: + + Attribution Model: + +
      +
      +
      +
      +
      +
      + Customer: + + Website: + + Email: + + Phone: + + OCID: + + Meet: + + Meeting time: + +
      +
      + Est: + +
      +
      + CMS / Platform: + +
      +
      + Assignee: + +
      +
      +
      +
      +
      +
      +
      +
      +
      +
      +
      +
      + + + Script Reading +
      +
      +
      +
      C2 B2
      +

      +

      Dạ em chào C2, em là Your shortname đến từ đội giải pháp kỹ thuật đại diện Google +
      có phải em Your shortname đang nghe máy với C2 B2 đó không? +
      // KH: đúng rồi em! +

      +

      Em nhận được yêu cầu từ đội hỗ trợ Google Ads, là hôm nay hỗ trợ cài đặt Tasks cho website F2, phải không C2 ạ? +
      // KH: đúng rồi em!


      +

      Em có nhận được yêu cầu từ bạn C2 (người quản lý của Google)hôm nay sẽ hỗ trợ C2 cài đặt Tasks cho trang web F2. phải không ạ? +
      // KH: đúng rồi em!


      dạ, Ước tính thời gian cài đặt này là G2 phút, vậy mình có đang ngồi máy tính để tiện cài đặt không C2? +
      // KH: Có em +
      +
      +

      Trước khi bắt đầu cài đặt C2 lưu ý giúp em cuộc gọi này sẽ được ghi âm nhằm nâng cao chất lượng dịch vụ [cho] khách hàng , C2 nha! +
      // KH: Ok em +
      Nếu sảy sự cố mất kết nối, C2 vui lòng không liên hệ qua số này, em sẽ chủ động gọi lại cho C2
      // KH: Ok em +
      em Your shortname có gởi cho C2 một email có link google meet [á] để chia sẽ màn hình với em, C2 truy cập vào giúp em nha +
      // KH: OK em +
      // Chờ KH truy cập link, xong chưa +
      [Rôi]Tại đây C2 giúp em tắt camera và đóng tất cả các thông tin riêng tư mà C2 không muốn chia sẽ

      [Rồi] sau đó nhấn vào nút [tham gia ngay], tiếp theo, C2 nhấn vào nút chia sẽ màn hình có dấu mũi tên hướng lên nằm bên dưới chính giữa của google meet, sau đó chọn [toàn bộ màn hình của bạn], nếu có nhiều màn hình thì C2 chọn cái đầu tiên +
      // KH: OK em +

      // Me: em đã thấy màn hình của C2 rồi, +

      +

      à C2! Bên em trước đó có gởi cho C2 một email xác nhận lịch hẹn ngày hôm nay [á], mình đã đọc qua nội dung bên trong rồi đúng không ạ? +
      // KH: có rồi +
      Nếu như C2 thấy mọi vấn đề nêu trên C2 cảm thấy thỏa, thì mình tiến hành cài đặt luôn nha! +

      // KH: Chưa +
      Thế thì em sẽ mô tả sơ nội dung về điều mình cần chuẩn bị cho việc cài đặt code trên website của mình nha +
      Trước tiên là mình cần đủ quyền truy cập cho Google Ads, Analytics, GTM, quản trị admin website. +
      Nếu như C2 thấy mọi vấn đề nêu trên C2 cảm thấy thỏa, thì mình tiến hành cài đặt luôn nha! +

      // KH: OK em +
      ............. +
      ............. +
      +

      Hướng dẫn KH đọc báo cáo +
      +
      +
      +
      + // 1. Tóm tắt lại quá trình cài đặt
      + // 2. các trường hợp
      + 2.1. Việc cài đặt đã thành công. Sau cuộc gọi này bên em sẽ gởi email thông báo thành công có kèm phần đánh giá chất lượng dịch vụ. C2 có thời gian thì phản hồi giúp em.
      + 2.2. Bên em sẽ theo dõi trong 2 ngày tới để đảm bảo dữ liệu được ghi nhận đúng. Nếu không có vấn đề gì thì sau 2 ngày bên em sẽ gửi 1 email thông báo thành công có kèm phần đánh giá chất lượng dịch vụ. C2 có thời gian thì phản hồi giúp em.
      + 2.3. Bên em sẽ theo dõi thêm 2 ngày để đảm bảo dữ liệu được ghi nhận đúng. Nếu không có vấn đề gì thì trong vòng 2 ngày bên em sẽ gửi 1 email thông báo thành công có kèm phần đánh giá chất lượng dịch vụ. C2 có thời gian thì phản hồi giúp em.
      + 2.4. Tạm ngưng phần hỗ trợ tại đây và sẽ tiếp tục trong sau 24h. C2 có thể sắp xếp lịch hẹn vào ZZZZZ

      + 2.5. *** Tùy vào case nhé +
      +

      Mình còn thắc mắc nào trong quá trình cài đặt không C2 B2 ơi!
      + // Có
      + // Tự tin giải đáp, giúp họ clear hơn trong phạm vi mình có thể

      + + // Không
      + Sau buổi hôm nay em sẽ gửi cho C2 email thông báo mình đã cài đặt thành công, kèm theo bảng đánh giá chất lượng dịch vụ, C2 có thời gian C2 phản hồi giúp em!
      + Và trong thời gian tiếp theo C2 cũng theo dõi, nếu có vấn đề gì thì C2 cứ phản hồi qua mail này, em sẵn sàng hỗ trợ lại C2 ha!
      + // OK em + Em cảm ơn C2 đã dành thời gian cho buổi cài đặt ngày hôm nay, giờ C2 có thể nhấn dừng chia sẽ màn hình được rồi ạ!
      + Cảm ơn C2 và em chào C2!
      +
      + +
      +
      +
      +
      +
      +
      + + + Email Template +
      +
      +
      + + +
      +
      + Insert +
      Đội giải pháp kỹ thuật - Xác nhận lịch hẹn [5-0987654321]
      +
      +
      +
      + ${th_list_emailtemplatecontent.first_email} +
      +
      +
      +
      +
      + Insert +
      Đội giải pháp kỹ thuật - Link cuộc họp Google Meet cho trường hợp [5-6594000033737]
      +
      +
      +
      + ${th_list_emailtemplatecontent.send_google_meet_link} +
      +
      +
      +
      +
      + Insert +
      Đội giải pháp kỹ thuật - Hướng dẫn chèn mã GTM và xác nhận lịch hẹn cho trường hợp [5-6594000033737]
      +
      +
      +
      + ${th_list_emailtemplatecontent.huong_dan_chen_ma_gtm_va_xac_nhan_lich_hen} +
      +
      +
      +
      +
      + Insert +
      Đội giải pháp kỹ thuật - Đặt lại lịch hẹn lần 2 cho trường hợp [5-6594000033737]
      +
      +
      +
      + ${th_list_emailtemplatecontent.as_reschedule_1} +
      +
      +
      +
      +
      + Insert +
      Đội giải pháp kỹ thuật – Đã xác minh lượt hiển thị/lượt chuyển đổi cho trường hợp [5-6594000033737]
      +
      +
      +
      + ${th_list_emailtemplatecontent.so_verified} +
      +
      +
      +
      +
      + Insert +
      Đội giải pháp kỹ thuật - Thông báo không thể liên hệ được lần 1 [5-6594000033737]
      +
      +
      +
      + ${th_list_emailtemplatecontent.ni_attempted_contact} +
      +
      +
      +
      +
      + Insert +
      Đội giải pháp kỹ thuật - Thông báo đóng hỗ trợ kỹ thuật cho trường hợp [5-6594000033737]
      +
      +
      +
      + ${th_list_emailtemplatecontent.in_not_reachable} +
      +
      +
      +
      +
      + Insert +
      Đội giải pháp kỹ thuật - Thông báo cài đặt thành công cho trường hợp [5-6594000033737]
      +
      +
      +
      + ${th_list_emailtemplatecontent.so_verification_not_needed} +
      +
      +
      +
      +
      + Insert +
      Đội giải pháp kỹ thuật – Đợi xác minh luợt chuyển đổi - dữ liệu cho trường hợp [5-6594000033737]
      +
      +
      +
      + ${th_list_emailtemplatecontent.ni_awaiting_validation} +
      +
      +
      +
      +
      + Insert +
      Đội giải pháp kỹ thuật - Những điều kiện cần thiết cho Cuộc hẹn triển khai Chuyển đổi nâng cao [5-0000000000000]
      +
      +
      +
      + ${th_list_emailtemplatecontent.ec_a_if_pii_is_visible_available} +
      +
      +
      +
      + +
      + Insert +
      Đội giải pháp kỹ thuật - Những điều kiện cần thiết cho Cuộc hẹn triển khai Chuyển đổi nâng cao [5-0000000000000]
      +
      +
      +
      + ${th_list_emailtemplatecontent.ec_b_automatic_eligible_if_pii_is_not_visible_available} +
      +
      +
      +
      + +
      + Insert +
      Đội giải pháp kỹ thuật - Những điều kiện cần thiết cho Cuộc hẹn triển khai Chuyển đổi nâng cao [5-0000000000000]
      +
      +
      +
      + ${th_list_emailtemplatecontent.ec_c_automatic_not_eligible_if_pii_is_not_visible_available} +
      +
      +
      +
      + +
      + Insert +
      Đội giải pháp kỹ thuật - Những điều kiện cần thiết cho Cuộc hẹn triển khai Chuyển đổi nâng cao [5-0000000000000]
      +
      +
      +
      + ${th_list_emailtemplatecontent.ec_d_ecommerce_website_or_cases_when_you_are_unable_to_check_pii} +
      +
      +
      +
      + +
      + Insert +
      Đội giải pháp kỹ thuật - Những điều kiện cần thiết cho Cuộc hẹn triển khai Chuyển đổi nâng cao [5-0000000000000]
      +
      +
      +
      + ${th_list_emailtemplatecontent.ec_e_if_an_advertiser_is_eligible_for_the_automatic_option_based_on_pre_call_checks_keep_either_gtm_or_gtag_one_of_the_two_options_below_option_based_on_advertisers_conversion_set_up} +
      +
      +
      +
      + +
      + Insert +
      Đội giải pháp kỹ thuật - Những điều kiện cần thiết cho Cuộc hẹn triển khai Chuyển đổi nâng cao [5-0000000000000]
      +
      +
      +
      + ${th_list_emailtemplatecontent.ec_f_if_advertiser_imports_google_analytics_conversions_for_tracking_and_wants_to_implement_ec} +
      +
      +
      +
      + +
      + Insert +
      Đội giải pháp kỹ thuật - Những điều kiện cần thiết cho Cuộc hẹn triển khai Chuyển đổi nâng cao [5-0000000000000]
      +
      +
      +
      + ${th_list_emailtemplatecontent.ec_g_if_advertiser_cms_is_not_supported_for_ec_implementation_send_this_email} +
      +
      +
      +
      + +
      +
      +
      +
      +
      +
      + + + List Case +
      +
      +
      +
        +
      +
      +
      +
      +
      +
      +
      +
      + + + Tip and Tutorial +
      +
      +
      + +
      +
      +
      +
      +
      +
      +
      +
      +
      +
      +
      +
      +
      +
      +
      + + + Setting +
      +
      +
      +
      +
      +
      +
      +
      +
      +
      +
      + + Mini + Darkmode +
      +
      + +
      +
      +
      +
      +
      + List keystorage: +
        + empty +
      +
      +
      + +
      +
      +
      +
      +
      +
      +
      +
      + `; + \ No newline at end of file diff --git a/tagteams/groups/th_sub.js b/tagteams/groups/th_sub.js new file mode 100644 index 0000000..c994747 --- /dev/null +++ b/tagteams/groups/th_sub.js @@ -0,0 +1,1997 @@ + +var th_language = { + 'appointment_time': 'Appointment Time', + 'google_ads_external_customer_id': 'Google Ads External Customer ID', + 'phone_prefix' : "+84", +}; + +var th_key_task_searchandreplace = ` + ads_conversion_tracking_troubleshooting:Ads Conversion Tracking Troubleshooting:kiểm tra khắc phục sự cố theo dõi lượt chuyển đổi + ads_conversion_tracking:Ads Conversion Tracking:triển khai theo dõi lượt chuyển đổi + ga4_migration:GA4 Migration:triển khai theo dõi số liệu Google Analytics 4 + shopping_onboarding:Shopping Onboarding:triển khai Google Shopping + ads_remarketing:Ads Remarketing:triển khai tiếp thị lại + ads_dynamic_remarketing:Ads Dynamic Remarketing:triển khai tiếp thị lại động + ads_enhanced_conversions:Ads Enhanced Conversions:triển khai chuyển đổi nâng cao + ads_website_call_conversion:Ads Website Call Conversion:triển khai lượt chuyển đổi cuộc gọi + analytics_cross_domain_tracking:Analytics Cross Domain Tracking:phân tích theo dõi tên miền chéo + analytics_dynamic_remarketing:Analytics Dynamic Remarketing:phân tích tiếp thị lại động + analytics_e-commerce_tracking:Analytics E-Commerce Tracking:phân tích theo dõi thương mại điện tử + analytics_enhanced_e-commerce_tracking:Analytics Enhanced E-Commerce Tracking:phân tích theo dõi thương mại điện tử nâng cao + analytics_event_tracking:Analytics Event Tracking:theo dõi các sự kiện phân tích + analytics_health_check:Analytics Health Check:kiểm tra khả năng ghi nhận phân tích + analytics_remarketing:Analytics Remarketing:phân tích tiếp thị lại + analytics_setup:Analytics Setup:cài đặt phân tích + analytics_troubleshooting:Analytics Troubleshooting:kiểm tra khắc phục sự cố phân tích + consent_mode:Consent Mode:triển khai chế độ đồng ý cho trang web + fix_sitewide_tagging_ogt_ct:Fix Sitewide Tagging (OGT & CT):sửa lỗi gắn thẻ trên toàn trang web (OGT & CT) + ga4_e-commerce_migration:GA4 E-Commerce Migration:triển khai theo dõi số liệu mua hàng với Google Analytics 4 + google_tag_manager_installation:Google Tag Manager Installation:cài đặt trình quản lý thẻ cho website + ads_conversion_code:Ads Conversion Code:triển khai mã nguồn lượt chuyển đổi + website_call_conversion:Website Call Conversion:triển khai lượt chuyển đổi cuộc gọi cho trang web + ga_destination_tracking:GA Destination Tracking:triển khai theo dõi trang đích với Google Analytics + ga_event_tracking:GA Event Tracking:triển khai theo dõi sự kiện Google Analytics + ga_smart_goals:GA Smart Goals:triển khai mục tiêu thông minh với Google Analytics + site_wide_tag_-_conversion_tracking_fix(ogt_&_ct):Site Wide Tag - Conversion Tracking Fix(OGT & CT):sửa lỗi gắn thẻ và lượt chuyển đổi trên toàn trang web (OGT & CT) + dynamic_remarketing_retail:Dynamic Remarketing - Retail:triển khai tiếp thị lại động - retail (bán lẻ) + dynamic_remarketing_x_non_retail:Dynamic Remarketing - X (Non-Retail):triển khai tiếp thị lại động - X (Non-Retail) + google_analytics_dynamic_remarketing_non_retail:Google Analytics Dynamic Remarketing (Non-Retail):triển khai tiếp thị lại động trên Google Analytics (Non-Retail) + google_analytics_dynamic_remarketing_retail:Google Analytics Dynamic Remarketing (Retail):triển khai tiếp thị lại động trên Google Analytics - X (Non-Retail) + google_analytics_health_check:Google Analytics Health Check:triển khai kiểm tra khả năng ghi nhận của Google Analytics + ga_starter_pack:GA Starter Pack:làm quen với Google Analytics + google_analytics_troubleshooting:Google Analytics Troubleshooting:kiểm tra khắc phục sự cố Google Analytics + offline_conversion_tracking:Offline Conversion Tracking:triển khai chuyển đổi theo dõi ngoại tuyến + recaptcha_implementation:ReCaptcha Implementation:triển khai ReCaptcha + cross_domain_tracking:Cross Domain Tracking:triển khai theo dõi tên miền chéo + lead_form_ad_extension:Lead Form Ad Extension:triển khai tiện ích mở rộng biểu mẫu khách hàng tiềm năng + enhanced_conversions:Enhanced Conversions:triển khai chuyển đổi nâng cao + shopping_feed_optimization:Shopping Feed Optimization:tối ưu nguồn cấp dữ liệu trên Google Shopping +`; + +var th_heading_searchandreplace = ` + Tin vui! Nhóm giải pháp kỹ thuật đã nhận được yêu cầu của bạn:Tin vui! Nhóm giải pháp kỹ thuật đã nhận được yêu cầu của bạn + Tin vui! Nhóm giải pháp kỹ thuật đã nhận được yêu cầu của bạn:Tin vui! Nhóm giải pháp kỹ thuật đã nhận được yêu cầu của bạn + Here's the latest update regarding your case:Thông tin cập nhật mới nhất về trường hợp của bạn + Your appointment has been successfully rescheduled:Cuộc hẹn của bạn đã được lên lịch lại thành công + Cuộc hẹn của bạn đã được lên lịch lại:Cuộc hẹn của bạn đã được lên lịch lại + Congratulations, your case has been successfully implemented:Xin chúc mừng, trường hợp của bạn đã được triển khai thành công + Your case has been successfully implemented:Trường hợp của bạn đã được triển khai thành công + Congratulations on implementing your case:Chúc mừng bạn việc cài đặt đã được triển khai thành công + Your case has been successfully implemented:Trường hợp của bạn đã được triển khai thành công + More information is needed to complete your implementation:Cần thêm thông tin để hoàn thành việc triển khai của bạn + Your case is in consultation:Trường hợp của bạn đang được xem xét + Your case status has been updated:Đang chờ dữ liệu hiển thị hoặc chuyển đổi + We tried to reach you today regarding your case:Chúng tôi đã cố gắng liên lạc với bạn hôm nay + Please provide additional details for your case:Vui lòng cung cấp thêm chi tiết cho trường hợp của bạn + Your case cannot be completed due to technical issues:Trường hợp của bạn không thể được hoàn thành do các vấn đề kỹ thuật + Your case has been closed due to inactivity:Trường hợp của bạn đã bị đóng do không nhận được phản hồi từ nhà quảng cáo + Your case has been closed:Trường hợp của bạn đã được đóng lại + Your case is not ready for implementation. Tìm hiểu lý do:Trường hợp của bạn chưa sẵn sàng để triển khai. Tìm hiểu lý do + Your case has been rerouted to the correct support team:Trường hợp của bạn đã được chuyển hướng đến nhóm hỗ trợ phù hợp + We are working to reroute your case to the correct support team:Chúng tôi đang làm việc để chuyển trường hợp của bạn đến đúng nhóm hỗ trợ + Your request is out of scope for the Technical Solutions Team:Yêu cầu của bạn nằm ngoài phạm vi của Nhóm giải pháp kỹ thuật + Your case will be closed. Tìm hiểu lý do:Trường hợp của bạn sẽ được đóng lại. Tìm hiểu lý do +`; + +var th_hotkey_email = { + 'ts as new':'Đội giải pháp kỹ thuật - Xác nhận lịch hẹn', + 'ts as wip offtfr':'Đội giải pháp kỹ thuật – Đang triển khai việc cài đặt', + 'ts as wip offs':'Đội giải pháp kỹ thuật – Đang triển khai việc cài đặt', + 'ts as resched1':'Đội giải pháp kỹ thuật – Đặt lại lịch hẹn lần 1', + 'ts as reschedok':'Đội giải pháp kỹ thuật – Đặt lại lịch hẹn lần 2', + 'ts so verif':'Đội giải pháp kỹ thuật – Đã xác minh lượt hiển thị/lượt chuyển đổi', + 'ts so verif nrc':'Đội giải pháp kỹ thuật – Xác nhận triển khai thành công', + 'ts so unv':'Đội giải pháp kỹ thuật – Triển khai Tag đã hoàn tất', + 'ts so vnn':'Đội giải pháp kỹ thuật – Triển khai thành công', + 'ts ni ai':'Đội giải pháp kỹ thuật – Chờ thông tin phản hồi từ nhà quảng cáo', + 'ts ni ic':'Đội giải pháp kỹ thuật – Đang tham khảo Nhóm hỗ trợ nội bộ', + 'ts ni av':'Đội giải pháp kỹ thuật – Đang chờ Hiển thị/ Chuyển đổi', + 'ts ni ac':'Đội giải pháp kỹ thuật – Không liên lạc được với nhà quảng cáo', + 'ts ni oth':'Đội giải pháp kỹ thuật – Chờ thêm thông tin đầu vào', + 'ts in inf':'Đội giải pháp kỹ thuật – Không thể khả thi về mặt kỹ thuật', + 'ts in nrch':'Đội giải pháp kỹ thuật – Không nhận được phản hồi từ nhà quảng cáo', + 'ts in ni':'Đội giải pháp kỹ thuật – Nhà quảng cáo không cần hỗ trợ', + 'ts in nrdy':'Đội giải pháp kỹ thuật – Nhà quảng cáo chưa sẵn sàng', + 'ts in oost':'Đội giải pháp kỹ thuật – Chuyển yêu cầu cho đội ngũ thích hợp', + 'ts in oosu':'Đội giải pháp kỹ thuật – Không thể chuyển tiếp yêu cầu', + 'ts in oos seller':'Đội giải pháp kỹ thuật – Ngoài phạm vi hỗ trợ ', + 'ts in oth':'Đội giải pháp kỹ thuật – Trường hợp của bạn đã được đóng', +}; + +var th_searchandremove = [ + 'Giải pháp kỹ thuật của Google', +]; + +var th_api_blog = 'https://cdtx.lyl.vn/wordpress/wp-json/tagteam/blogs'; + + + +var th_load_remote = function (result, _default_action) { + var _timekey_current = new Date().getDate() + "" + new Date().getHours(); + // var _timekey_current = new Date().getDate() + "" + new Date().getMinutes(); + var _option = result.optionkl__modecase; // Auto | Development | ExtensionDefault + + + switch (_option) { + + // ExtensionDefault + case 'ExtensionDefault': + _default_action(); + + break; + + + // Development + // th_api_blog | action: script4dev + case 'Development': + var _key = "cdtx_scriptsync_dev"; + var _body = { + "action": "script4dev", + "language": "vi" + }; + load_fetch_post_content(th_api_blog, _body, (response_api) => { + if(response_api.rs) { + setChromeStorage(_key, response_api.rs , () => { + if(response_api.typeaction == 'script_sync') { + eval(response_api.script_str); + } else { + _default_action(); + } + }); + } + }); + + break; + + // Auto - auto sync + // th_api_blog | action: script4agent + default: + var _key = "cdtx_scriptsync_auto"; + + var _sync_api = (_objectvalue) => { + var _body = { + "action": "script4agent", + "language": "vi", + "timesync": _timekey_current + }; + load_fetch_post_content(th_api_blog, _body, (response_api) => { + console.log("load_fetch_post_content", response_api); + if(response_api.rs) { + setChromeStorage(_key, response_api , () => { + if(response_api.typeaction == 'script_sync') { + eval(response_api.script_str); + } else { + _default_action(); + } + }); + } else { + cLog(() => {console.log("FETCH DATA ERROR or RETURN FALSE")}) + var _rsfalse = { + rs: false, + script_str: _objectvalue.script_str, + timesync: _timekey_current,// day+hour + typeaction: _objectvalue.typeaction, // script_sync + } + setChromeStorage(_key, _rsfalse , () => { + if(response_api.typeaction == 'script_sync') { + eval(_objectvalue.script_str); + } else { + _default_action(); + } + + }) + } + }); + } + + getChromeStorage(_key, (response) => { + var _objectvalue = {}; + if(response.value) { + _objectvalue = response.value; + cLog(() => {console.log("===", _objectvalue)}) + // + if(_objectvalue.timesync == _timekey_current) { + cLog(() => {console.log("_CACHE", _objectvalue.typeaction)}) + if(_objectvalue.typeaction == 'script_sync') { + eval(_objectvalue.script_str); + } else { + _default_action(); + } + } else { + // Sync API + _sync_api(_objectvalue) + } + } else { + cLog(() => {console.log("FIRST TIME => FETCH API")}) + // Sync API + _sync_api(_objectvalue); + } + }); + } +} + +var th_checkStyleByTheme = (opt_isdisable) => { + if(opt_isdisable) return false; + + + var _timekey_current = new Date().getDate() + "" + new Date().getHours(); + // var _timekey_current = new Date().getDate() + "" + new Date().getMinutes(); + var _key = "cdtx_stylecasebytheme"; + + var _sync_api = (_objectvalue) => { + var _body = { + "action": "stylecasebytheme", + "language": "vi", + "timesync": _timekey_current + }; + load_fetch_post_content(th_api_blog, _body, (response_api) => { + if(response_api.rs) { + setChromeStorage(_key, response_api , () => { + var cdtx_panel_div_style = _TrustScript(response_api.style_str); + document.body.insertAdjacentHTML("afterEnd", cdtx_panel_div_style); + }); + } + }); + } + + getChromeStorage(_key, (response) => { + var _objectvalue = {}; + if(response.value) { + _objectvalue = response.value; + cLog(() => {console.log("===", _objectvalue)}) + if(_objectvalue.timesync == _timekey_current) { + cLog(() => {console.log("CACHE ===== STYLE")}) + var cdtx_panel_div_style = _TrustScript(_objectvalue.style_str); + document.body.insertAdjacentHTML("afterEnd", cdtx_panel_div_style); + } else { + // Sync API + _sync_api(_objectvalue) + } + } else { + cLog(() => {console.log("FIRST TIME => FETCH API")}) + // Sync API + _sync_api(_objectvalue); + } + }); +} + +var th_clearAndPrepareCRTemplate = () => { + // Prepare + var _composeemailcard = document.querySelector('.write-cards-wrapper:not([style*="display:none"]):not([style*="display: none"]) card.write-card.is-top[card-type="compose"]'); + if(_composeemailcard) { + cLog(()=>{console.log("CR -> Start")}); + var _email_body_content = _composeemailcard.querySelector('#email-body-content'); + _email_body_content.style.padding = '0px'; + _email_body_content.style.width = '100%'; + + var _email_body_content_top = _composeemailcard.querySelector('#email-body-content-top'); + _email_body_content_top.innerHTML = '

      '; + + var _email_body_content_top_content = _composeemailcard.querySelector('#email-body-content-top-content'); + + + _email_body_content_top_content.innerHTML = '


      '; + + var ntime = 0; + var myInterval = setInterval(() => { + _email_body_content_top_content.dispatchEvent(new Event('input')); + _email_body_content_top_content.dispatchEvent(new Event('focus')); + _email_body_content_top_content.dispatchEvent(new Event('click')); + _email_body_content_top_content.click(); + + + cLog(()=>{console.log("CR -> interval focus cursor point and check content")}); + + addCursor2Contenteditable(_email_body_content_top_content); + + if(_email_body_content_top_content.innerText.trim().length > 0) { + clearInterval(myInterval); + + // replace heading search td table and replace heading + var _tdcellist = _email_body_content_top_content.querySelectorAll("td"); + if(_tdcellist.length) { + _tdcellist.forEach((item) => { + var _heading = item.innerText.trim(); + var _getvalue = searchAndReturnValue(th_heading_searchandreplace, _heading, 1); + if(_getvalue) { + item.innerText = _getvalue; + } + }); + } + + // replace heading search td table and replace heading + var _tdcellist = _email_body_content_top_content.querySelectorAll(".replaced"); + if(_tdcellist.length) { + _tdcellist.forEach((item) => { + var _heading = item.innerText.trim(); + var _list = [''] + var _getvalue = searchAndReturnValue(th_key_task_searchandreplace, _heading, 1); + if(_getvalue) { + item.innerText = _getvalue; + } + }) + } + + // remove text + var _tr = _email_body_content_top_content.querySelectorAll("tr"); + if(_tr.length) { + _tr.forEach((item) => { + var _text = item.innerText.trim(); + th_searchandremove.forEach((item2) => { + if(_text == item2) { + item.remove(); + } + }) + }) + } + } + + // more than 10s + if(ntime > 10) { + cLog(()=>{console.log("CR -> Clear time more than 10s")}); + clearInterval(myInterval); + } + ntime++; + + + }, 1000); + } +} + + + +// -- Send +var th_sendFirstEmail = () => { + function waitForElm(selector) { + return new Promise(resolve => { + if (document.querySelector(selector)) { + return resolve(document.querySelector(selector)); + } + + const observer = new MutationObserver(mutations => { + if (document.querySelector(selector)) { + resolve(document.querySelector(selector)); + observer.disconnect(); + } + }); + + observer.observe(document.body, { + childList: true, + subtree: true + }); + }); + } + + var caseId = document.querySelector('.case-id').innerText; + document.querySelector('.recipient-dropdown > dropdown-button .button-text').click(); + document.querySelector('[aria-label="Create a write card"]').dispatchEvent(new Event('focus')); + + + wait4Elem('material-list.options-list').then((elm) => { + document.querySelector('material-list.options-list .item:nth-child(1)').click(); + wait4Elem('[debug-id="contact-info-name"]').then(elm => { + wait4Elem('[aria-label="Create new email"]').then(elm => { + elm.click(); + + wait4Elem('.write-cards-wrapper:not([style*="display:none"]):not([style*="display: none"]) card.write-card.is-top[card-type="compose"] #email-body-content-top').then(function (elm) { + + wait4Elem('email-address-dropdown material-dropdown-select .address').then(elm => { + elm.click(); + + wait4Elem('[id*=email-address-id--technical-solutions]').then(elm => { + elm.click(); + + wait4Elem('.write-cards-wrapper:not([style*="display:none"]):not([style*="display: none"]) .is-top .subject').then(elm => { + elm.value = `Đội giải pháp kỹ thuật - Xác nhận lịch hẹn [${caseId}]`; + elm.dispatchEvent(new Event('input')); + + wait4Elem('.write-cards-wrapper:not([style*="display:none"]):not([style*="display: none"]) .is-top .editor-frame #email-body-content-top').then(emailBodyTop => { + var xpath = `//div[contains(@class, 'form-label')][text() = 'Website']//following-sibling::div`; + var url = document.evaluate(xpath, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue.innerText; + var name = document.querySelector('.internal-user-info .name').innerText; + var inviteHtml = ` + + + + + + +
      Tin vui! Nhóm giải pháp kỹ thuật đã nhận được yêu cầu của bạn
      + + + + + + +
      + + + + + + + + + +
      ${name} thân mến!
      +

      Cảm ơn bạn đã đặt lịch hẹn với Nhóm giải pháp kỹ thuật của Google. Người đại diện của Google đã thay mặt bạn đặt lịch hẹn này và chúng tôi sẽ hỗ trợ bạn theo Mã yêu cầu 4-9981000032961 cho ${url}. 

      +

      Vui lòng kiểm tra hộp thư đến trong email của bạn để tìm lời mời trên lịch cho cuộc hẹn sắp tới với chúng tôi, và làm theo hướng dẫn được trình bày trong thư để xác nhận việc bạn sẽ tham dự cuộc hẹn. Để chuẩn bị cho cuộc gọi, vui lòng xem và hoàn tất những Việc cần làm được nêu tại đây.

      +

      Nếu bạn có câu hỏi trước khi tham gia cuộc gọi hoặc muốn thêm những người tham dự khác, vui lòng cho chúng tôi biết bằng cách trả lời email này hoặc liên hệ với Người đại diện bán hàng của Google. Chúng tôi rất mong được làm việc với bạn! Cảm ơn bạn.

      +
      +
      + + + + + + +
      + + + + + + +
      Giải pháp kỹ thuật của Google
      +
      +

      +

      + + + + + + +
      + + + + + + +
      Yêu cầu số ${caseId}
      +
      `; + emailBodyTop.innerHTML = inviteHtml; + document.execCommand("insertText", false, " "); + }) + }); + }); + }); + }); + }); + }); + document.querySelector('[aria-label="Create a write card"]').dispatchEvent(new Event('blur')); + }); +} + + + + +var th_TagteamFocusCase = () => { + cLog(() => {console.log("CODE VAN BO LOAD HAS LOAD")}); + try { + // ==== CODE - VAN BO + var ntime = 0; + var css = ` + .hasdock card-deck .decks { + max-height: calc(100% - 64px) + } + + + #preview-note { + width: 100%; + height: 800px; + position: relative; + padding-top: 40px; + } + + #preview-note #preview-area { + width: 511px; + min-height: 543px; + max-height: none; + margin-top: 20px; + padding: 10px; + outline: none; + color: #202124; + border: 2px dashed #599fff; + font-size: 13px; + text-align: left; + } + + #preview-note #preview-area div { + padding: 5px 0; + } + + #preview-area ul { + list-style-type: none; + padding-left: 0px; + } + + #preview-area h4 { + display: inline !important; + } + + #signature { + background-color: #fdfdfd; + padding: 10px; + width: 50%; + height: 100%; + } + + #signature { + font-family: Google Sans, Helvetica, Arial; + } + + #signature .tag-shopping .form-group { + width: 800px; + display: flex; + margin: 0.8em 0.5em; + align-items: center; + position: relative; + flex-flow: row wrap; + } + + #signature .collapsible-content .form-group { + width: 80%; + display: flex; + margin: 0.7em; + align-items: center; + } + + #signature .tag-shopping .form-group .form-control:focus { + outline: none; + } + + #signature .tag-shopping .form-group .form-control { + width: 400px; + border: 1px solid #99c2fa; + border-radius: 4px; + padding: 8px 4px; + } + + #signature .tag-shopping .form-group button, + #addToNote, + #resetNote, + #signatureBtn { + background-color: #599fff; + border: none; + color: white; + text-decoration: none; + margin: 0 15px; + border-radius: 3px; + padding: 9px 18px; + cursor: pointer; + } + + #addToNote, + #resetNote { + padding: 15px 30px; + margin: 15px; + } + + #signature .tag-shopping .form-group label { + font-weight: 600; + width: 20%; + text-align: left; + color: #202124; + } + + #signature .collapsible-content .form-group .label { + font-weight: 600; + text-align: left; + width: 50%; + color: #202124; + } + + #signature .tag-shopping #task { + padding: 16px 0; + text-align: left; + line-height: 27px; + } + + #signature .tag-shopping #task label { + margin-right: 20px; + } + + #signature option:nth-child(2n-1) { + background: #f6f6f6; + } + + .modal { + display: none; + position: fixed; + z-index: 999; + /* padding-top: 100px; */ + left: 0; + top: 0; + width: 100%; + height: 100vh; + overflow: auto; + background-color: rgb(0, 0, 0); + background-color: rgba(0, 0, 0, 0.4); + } + + /* Modal Content */ + .modal-content { + position: relative; + background-color: #fefefe; + margin: auto; + padding: 0; + border: 1px solid #888; + width: 1300px; + max-width: 96%; + max-height: 96%; + box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19); + -webkit-animation-name: animatetop; + -webkit-animation-duration: 0.4s; + animation-name: animatetop; + animation-duration: 0.4s; + text-align: center; + overflow: auto; + display: flex; + } + + /* The Close Button */ + .close { + color: #599fff; + position: absolute; + right: 0; + font-size: 28px; + font-weight: bold; + padding-right: 10px; + z-index: 1; + } + + .close:hover, + .close:focus { + color: #000; + text-decoration: none; + cursor: pointer; + } + + .modal-header { + /* padding: 2px 16px; */ + background: red; + color: #599fff; + font-weight: bold; + height: 29px; + } + + /* collapsible */ + .leadgen { + width: 100%; + text-align: left; + } + + .ec-check-list { + width: 100%; + text-align: left; + } + + .modal .collapsible { + background-color: #fdfdfd; + color: #202124; + cursor: pointer; + padding: 10px; + width: 578px; + border: 1px solid #202124; + text-align: left; + outline: none; + font-size: 15px; + font-weight: 600; + border-radius: 10px; + margin-bottom: 11px; + } + + .modal .active, + .collapsible:hover { + background-color: #fafafa; + } + + .modal .collapsible:after { + content: '+'; + color: #599fff; + font-weight: bold; + float: right; + margin-left: 5px; + } + + .modal .active:after { + content: "-"; + } + + .modal .collapsible-content { + padding: 0; + max-height: 0; + overflow: hidden; + transition: max-height 0.2s ease-out; + background-color: #fdfdfd; + width: 800px; + } + + /* Add Animation */ + @-webkit-keyframes animatetop { + from { + top: -300px; + opacity: 0 + } + + to { + top: 0; + opacity: 1 + } + } + + @keyframes animatetop { + from { + top: -300px; + opacity: 0 + } + + to { + top: 0; + opacity: 1 + } + } + + /*Dock css*/ + + + @font-face { + font-family: "San Francisco"; + font-weight: 400; + src: url("https://applesocial.s3.amazonaws.com/assets/styles/fonts/sanfrancisco/sanfranciscodisplay-regular-webfont.woff"); + } + + @font-face { + font-family: "San Francisco"; + font-weight: 800; + src: url("https://applesocial.s3.amazonaws.com/assets/styles/fonts/sanfrancisco/sanfranciscodisplay-bold-webfont.woff"); + } + + .dock-float { + width: auto; + height: 60px; + border-radius: 16px; + display: flex; + justify-content: center; + position: fixed; + bottom: 5px; + left: 50%; + transform: translateX(-50%); + z-index: 999; + } + + .dock-float .dock-float-container { + padding: 3px; + width: 366px; + height: 48px; + display: flex; + align-items: center; + justify-content: center; + border-radius: 16px; + background: rgba(83, 83, 83, 0.25); + backdrop-filter: blur(13px); + -webkit-backdrop-filter: blur(13px); + border: 1px solid rgba(255, 255, 255, 0.18); + } + + .dock-float .dock-float-container .li-bin { + margin-left: 20px; + border-left: 1.5px solid rgba(255, 255, 255, 0.4); + padding: 0px 10px; + } + + .dock-float .dock-float-container .li-1::after { + position: absolute; + width: 5px; + height: 5px; + border-radius: 50%; + background: rgba(255, 255, 255, 0.5); + content: ""; + bottom: 2px; + } + + .dock-float .dock-float-container li { + list-style: none; + display: flex; + align-items: center; + justify-content: center; + width: 50px; + height: 50px; + vertical-align: bottom; + /* margin: 4px 0; */ + transition: 0.2s; + transform-origin: 50% 100%; + cursor: pointer; + } + + .dock-float .dock-float-container li:hover { + margin: 0px 13px 0px 13px; + } + + .dock-float .dock-float-container li .name { + position: absolute; + width: 100px; + top: -70px; + background: rgba(0, 0, 0, 0.5); + color: rgba(255, 255, 255, 0.9); + height: 10px; + padding: 10px 15px; + display: flex; + align-items: center; + justify-content: center; + border-radius: 5px; + visibility: hidden; + } + + .dock-float .dock-float-container li .name::after { + content: ""; + position: absolute; + bottom: -10px; + width: 0; + height: 0; + backdrop-filter: blur(13px); + -webkit-backdrop-filter: blur(13px); + border-left: 10px solid transparent; + border-right: 10px solid transparent; + border-top: 10px solid rgba(0, 0, 0, 0.5); + } + + .dock-float .dock-float-container li .ico { + width: 100%; + height: 100%; + object-fit: cover; + transition: 0.2s; + } + + .dock-float .dock-float-container li .ico-bin { + width: 94% !important; + height: 94% !important; + object-fit: cover; + transition: 0.2s; + } + + .dock-float .dock-float-container li .ico-bin:hover { + margin-left: 10px; + } + + .dock-float .dock-float-container li:hover .name { + visibility: visible !important; + } + + /* toggle */ + @charset "UTF-8"; + + .toggler-wrapper { + display: block; + width: 45px; + height: 25px; + cursor: pointer; + position: relative; + } + + .toggler-wrapper input[type="checkbox"] { + display: none; + } + + .toggler-wrapper input[type="checkbox"]:checked+.toggler-slider { + background-color: #599fff; + } + + .toggler-wrapper .toggler-slider { + background-color: #ccc; + position: absolute; + border-radius: 100px; + top: 0; + left: 0; + width: 100%; + height: 100%; + -webkit-transition: all 300ms ease; + transition: all 300ms ease; + } + + .toggler-wrapper .toggler-knob { + position: absolute; + -webkit-transition: all 300ms ease; + transition: all 300ms ease; + } + + .toggler-wrapper.style-1 input[type="checkbox"]:checked+.toggler-slider .toggler-knob { + left: calc(100% - 19px - 3px); + } + + .toggler-wrapper.style-1 .toggler-knob { + width: calc(25px - 6px); + height: calc(25px - 6px); + border-radius: 50%; + left: 3px; + top: 3px; + background-color: #fff; + } + + /* radio checkmark */ + /* Customize the label (the container) */ + .container-checkmark { + display: flex; + position: relative; + padding-left: 35px; + width: 100px; + cursor: pointer; + font-size: 18px; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + } + + /* Hide the browser's default radio button */ + .container-checkmark input { + position: absolute; + opacity: 0; + cursor: pointer; + height: 0; + width: 0; + } + + /* Create a custom radio button */ + .checkmark { + position: absolute; + top: 0; + left: 0; + height: 22px; + width: 22px; + background-color: #ccc; + border-radius: 50%; + } + + /* On mouse-over, add a grey background color */ + .container-checkmark:hover input~.checkmark { + background-color: #ccc; + } + + /* When the radio button is checked, add a blue background */ + .container-checkmark input:checked~.checkmark { + background-color: #2196F3; + } + + /* Create the indicator (the dot/circle - hidden when not checked) */ + .checkmark:after, + .checkmark-checkbox:after { + content: ""; + position: absolute; + display: none; + } + + /* Show the indicator (dot/circle) when checked */ + .container-checkmark input:checked~.checkmark:after { + display: block; + } + + /* Style the indicator (dot/circle) */ + .container-checkmark .checkmark:after { + top: 6px; + left: 6px; + width: 10px; + height: 10px; + border-radius: 50%; + background: white; + } + + /* checkbox checkmark */ + /* Create a custom checkbox */ + .checkmark-checkbox { + position: absolute; + top: -11px; + left: 0; + height: 22px; + width: 22px; + background-color: #ccc; + } + + /* On mouse-over, add a grey background color */ + .container-checkmark:hover input~.checkmark-checkbox { + background-color: #ccc; + } + + /* When the checkbox is checked, add a blue background */ + .container-checkmark input:checked~.checkmark-checkbox { + background-color: #2196F3; + } + + /* Create the checkmark/indicator (hidden when not checked) */ + .checkmark-checkbox:after { + content: ""; + position: absolute; + display: none; + } + + /* Show the checkmark when checked */ + .container-checkmark input:checked~.checkmark-checkbox:after { + display: block; + } + + /* Style the checkmark/indicator */ + .container-checkmark .checkmark-checkbox:after { + left: 7px; + top: 3px; + width: 5px; + height: 10px; + border: solid white; + border-width: 0 3px 3px 0; + -webkit-transform: rotate(45deg); + -ms-transform: rotate(45deg); + transform: rotate(45deg); + } + + /* style cr-list */ + #cr-list { + position: relative; + height: 350px; + } + + .cr-list { + list-style: none; + transition: all 0.5s ease-out; + position: absolute; + padding-left: 12px; + padding-bottom: 12px; + } + + .cr-list li { + padding: 6px 0; + color: #000; + background: none; + cursor: pointer; + } + + .cr-list li:hover { + background: #E5E5E5; + } + + .cr-list.hidden { + transform: translateX(150%); + } + + .cr-list button { + padding-left: 12px; + } + + #cr-list button.hidden { + display: none; + } + + /*Loader*/ + .lds-dual-ring { + display: inline-block; + width: 80px; + height: 80px; + } + + .lds-dual-ring:after { + content: " "; + display: block; + width: 64px; + height: 64px; + margin: 8px; + border-radius: 50%; + border: 6px solid rgb(26, 115, 232); + border-color: rgb(26, 115, 232) transparent rgb(26, 115, 232) transparent; + animation: lds-dual-ring 1.2s linear infinite; + } + + @keyframes lds-dual-ring { + 0% { + transform: rotate(0deg); + } + + 100% { + transform: rotate(360deg); + } + } + `; + var head = document.head || document.getElementsByTagName('head')[0]; + var style = document.createElement('style'); + head.appendChild(style); + style.type = 'text/css'; + if (style.styleSheet) { + style.styleSheet.cssText = css; + } else { + style.appendChild(document.createTextNode(css)); + }; + + // var loadingCustom = document.createElement('div'); + // loadingCustom.classList.add('lds-dual-ring'); + // document.querySelector('.is-top iswirte .editor').appendChild(loadingCustom); + function renderDock() { + var dock_float_html = `
      +
      +
    • +
      Send mail
      + +
    • +
    • +
      Click to call
      + +
    • +
    • +
      Oncall Notes
      + +
    • +
    • +
      Ads ICS
      + +
    • +
    • +
      Gearloose
      + +
    • +
    • +
      OGT Dashboard
      + +
    • +
    • +
      EC Dashboard
      + +
    • + +
      +
      `; + var dock_float = document.createElement('div'); + dock_float.innerHTML = dock_float_html; + document.querySelector('.decks').appendChild(dock_float); + document.body.classList.add('hasdock'); + + const focus = (elem, index) => { + let previous = index - 1; + let previous1 = index - 2; + let next = index + 1; + let next2 = index + 2; + + if (previous == -1) { + // console.log("first element"); + elem.style.transform = "scale(1.5) translateY(-10px)"; + } else if (next == icons.length) { + elem.style.transform = "scale(1.5) translateY(-10px)"; + // console.log("last element"); + } else { + elem.style.transform = "scale(1.5) translateY(-10px)"; + if(icons[previous]) { + icons[previous].style.transform = "scale(1.2) translateY(-6px)"; + } + if(icons[previous1]) { + icons[previous1].style.transform = "scale(1.1)"; + } + if(icons[next]) { + icons[next].style.transform = "scale(1.2) translateY(-6px)"; + } + if(icons[next2]) { + icons[next2].style.transform = "scale(1.1)"; + } + } + }; + + let icons = document.querySelectorAll(".ico"); + let length = icons.length; + + icons.forEach((item, index) => { + item.addEventListener("mouseover", (e) => { + focus(e.target, index); + }); + item.addEventListener("mouseleave", (e) => { + icons.forEach((item) => { + item.style.transform = "scale(1) translateY(0px)"; + }); + }); + }); + document.querySelector('.open-email').addEventListener('click', openEmail) + document.querySelector('.click2call').addEventListener('click', copyPhone) + document.querySelector('.open-note').addEventListener('click', openNote) + document.querySelector('.ads-ics').addEventListener('click', adsICS) + document.querySelector('.open-gearloose').addEventListener('click', gearloose) + document.querySelector('.ogt-dashboard').addEventListener('click', ogtDashboard) + document.querySelector('.ec-dashboard').addEventListener('click', ecDashboard) + } + + var modalHtml = ` + + `; + + var modalNode = document.createElement('div'); + modalNode.innerHTML = modalHtml; + document.body.appendChild(modalNode); + + //collapse + let coll = document.querySelectorAll(".collapsible"); + for (let i = 0; i < coll.length; i++) { + coll[i].addEventListener("click", function() { + this.classList.toggle("active"); + var content = this.nextElementSibling; + if (content.style.maxHeight) { + content.style.maxHeight = null; + } else { + content.style.maxHeight = content.scrollHeight + "px"; + } + }); + } + + document.querySelector('#addToNote').addEventListener('click', addToNote); + document.querySelector('#resetNote').addEventListener('click', resetNote); + var modal = document.getElementById("sinature-modal"); + + function addToNote() { + // var noteHtml = `${document.querySelector('#preview-area').innerHTML = ()}`; + caseSumary = document.querySelector('.case-summary').value; + var caseSumaryNote = document.querySelector('[aria-label="Enter a case summary"]'); + caseSumaryNote.value = caseSumary; + caseSumaryNote.focus(); + caseSumaryNote.dispatchEvent(new Event('input')); + var lastUpdate = new Date().toLocaleString('vi-VN', { year: 'numeric', month: '2-digit', day: '2-digit' }) + document.execCommand('insertText', false, ` | updated at: ${lastUpdate}`); + var noteHtml = document.createElement('div'); + noteHtml.innerHTML = document.querySelector('#preview-area').innerHTML; + noteHtml.setAttribute('id', 'case-note-added'); + noteHtml.querySelectorAll('div, span').forEach(item => { + item.setAttribute('class', ''); + item.setAttribute('id', ''); + }) + document.querySelector('.write-cards-wrapper:not([style*="display:none"]):not([style*="display: none"]) card.write-card.is-top[card-type="case-note"] [aria-label="Case Note"]').insertAdjacentHTML("beforeend", noteHtml.innerHTML); + document.querySelector('.write-cards-wrapper:not([style*="display:none"]):not([style*="display: none"]) card.write-card.is-top[card-type="case-note"] [aria-label="Case Note"]').focus(); + document.execCommand("insertText", false, " "); + waitForElm('.is-top .section.footer card-widget.align-left:not(.hidden)').then(elm => { + + }); + modal.style.display = "none"; + + } + + function resetNote() { + document.querySelectorAll('.form-control:not(.case-summary), #pre-call-check, [name="tasks"], #follow-up-done').forEach(item => { + item.value = ''; + item.checked = false; + is_leadgen = false; + document.querySelector('.collapsible.leadgen').classList.remove('active'); + var content = document.querySelector('.collapsible-content'); + content.style.maxHeight = null; + }) + document.querySelectorAll('#preview-area div').forEach(item => { + item.style.display = 'none'; + }) + } + + function openNote() { + document.querySelector('.case-summary').value = caseSumary; + openCaseNote(); + // handle form + var closeSpan = document.querySelector('.close'); + closeSpan.onclick = function(event) { + modal.style.display = "none"; + }; + var signatureBtn = document.getElementById('on-call-note'); + document.querySelector('#preview-precall').innerHTML = (``); + + document.querySelector('#pre-call-check').addEventListener('change', function() { + if (this.checked) { + document.querySelector('#preview-precall').style.display = 'block'; + } else { + document.querySelector('#preview-precall').style.display = 'none'; + } + }) + + document.querySelector('.collapsible.leadgen').addEventListener('click', function() { + if (this.classList.contains('active')) { + is_leadgen = true + document.querySelector('#preview-leadgen-check').style.display = 'block'; + addLeadgen(); + } else { + document.querySelector('#preview-leadgen-check').style.display = 'none'; + is_leadgen = false; + } + }); + + function addLeadgen() { + var answer1 = answer2 = answer3 = 'No', + answer4 = 'GCLIDless'; + document.querySelector('#gclidless-education').addEventListener('change', function() { + answer1 = this.checked ? 'Yes' : 'No'; + document.querySelector('.answer1').innerText = (answer1); + }); + document.querySelector('#pitched-gclidless').addEventListener('change', function() { + answer2 = this.checked ? 'Yes' : 'No'; + document.querySelector('.answer2').innerText = (answer2); + if (!(this.checked)) { + document.querySelector('.pitched-gclidless-reason').style.display = 'block'; + } else { + document.querySelector('.pitched-gclidless-reason').style.display = 'none'; + } + }) + document.querySelector('#ogt-check').addEventListener('change', function() { + answer3 = this.checked ? 'Yes' : 'No'; + document.querySelector('.answer3').innerText = (answer3); + if (!(this.checked)) { + document.querySelector('.ogt-check-reason').style.display = 'block'; + } else { + document.querySelector('.ogt-check-reason').style.display = 'none'; + } + }) + document.querySelectorAll('input[name="imt-type"]').forEach(item => { + item.addEventListener('change', function() { + if (item.checked) { + answer4 = item.value; + document.querySelector('.answer4').innerText = (answer4); + } + }); + }) + document.querySelector('.pitched-gclidless-reason').addEventListener('blur', function() { + if (this.value.trim().length > 0) document.querySelector('.answer2').innerText = (answer2 + ' - ' + this.value); + else document.querySelector('.answer2').innerText = (answer2); + }) + document.querySelector('.ogt-check-reason').addEventListener('blur', function() { + if (this.value.trim().length > 0) document.querySelector('.answer3').innerText = (answer3 + ' - ' + this.value); + else document.querySelector('.answer3').innerText = (answer3); + }) + } + + + document.querySelector('[aria-label="Speakeasy ID"').addEventListener('blur', function() { + seIds = this.value.trim().split(','); + if (this.value.trim() == '') { + document.querySelector('#preview-seid').innerHTML = (''); + return false; + } + if (seIds && seIds.length > 0) { + var seidHtml = []; + seIds = seIds.forEach(id => { + seidHtml.push(`${id}`) + }); + document.querySelector('#preview-seid').style.display = 'block'; + document.querySelector('#preview-seid').innerHTML = ('

      Speakeasy Ids: ' + seidHtml.join(', ') + '

      '); + } else { + document.querySelector('#preview-seid').innerHTML = (''); + } + }); + + document.querySelector('[aria-label="Sub-status"]').addEventListener('change', function() { + if (this.value != '') { + document.querySelector('#preview-substatus').style.display = 'block'; + document.querySelector('#preview-substatus').innerHTML = ('

      Sub-status: ' + this.value + '

      '); + } else { + document.querySelector('#preview-substatus').style.display = 'none'; + document.querySelector('#preview-substatus').innerHTML = ''; + } + }) + document.querySelector('[aria-label="Sub-status Reason"]').addEventListener('change', function() { + if (this.value != '') { + document.querySelector('#preview-substatus-reason').style.display = 'block'; + document.querySelector('#preview-substatus-reason').innerHTML = ('

      Sub-status Reason: ' + this.value + '

      '); + } else { + document.querySelector('#preview-substatus-reason').style.display = 'none'; + document.querySelector('#preview-substatus-reason').innerHTML = ''; + } + + }) + var taskImplemented = document.querySelector('#task'); + var taskHtml = ''; + tasks.forEach(task => { + taskHtml += ` ${task}
      `; + }); + taskImplemented.innerHTML = taskHtml; + var taskPreviewHtml = []; + document.querySelectorAll('#task [name="tasks"]').forEach(function(item) { + item.addEventListener('change', function() { + if (item.checked) { + taskPreviewHtml.push(item.value); + if (taskPreviewHtml.length > 0) { + document.querySelector('#preview-tasks').style.display = 'block'; + document.querySelector('#preview-tasks .tasks').innerHTML = taskPreviewHtml.join(', '); + } + } else { + taskPreviewHtml.splice(taskPreviewHtml.indexOf(item.value), 1); + document.querySelector('#preview-tasks .tasks').innerHTML = taskPreviewHtml.join(', '); + if (taskPreviewHtml.length == 0) { + document.querySelector('#preview-tasks').style.display = 'none'; + } + } + }); + }); + + + document.querySelector('[aria-label="Conversion Ids"]').addEventListener('blur', function() { + conversionIds = this.value.split(/[,;]/); + if (this.value.trim() == '') { + document.querySelector('#preview-ctIds').innerHTML = (''); + return false; + } + document.querySelector('#preview-ctIds').style.display = 'block'; + document.querySelector('#preview-ctIds').innerHTML = ('

      Conversion Ids: ' + conversionIds.join(', ') + '

      '); + }); + document.querySelector('#oncall-area').addEventListener('keyup', function() { + document.querySelector('#preview-oncallcmts').style.display = 'block'; + document.querySelector('#preview-oncallcmts').innerHTML = ('

      Oncall Comments:
      ' + this.value.replaceAll('\n', `
      `) + '

      '); + }); + + document.querySelector('[aria-label="Follow up Date"]').addEventListener('change', function() { + let flupDate = this.value ? new Date(this.value) : null; + if (flupDate) { + let onlyDate = flupDate.toLocaleString('vi-VN', { year: 'numeric', month: '2-digit', day: '2-digit' }); + document.querySelector('#preview-flupdate').style.display = 'block'; + document.querySelector('#preview-flupdate').innerHTML = ('

      Follow up date: ' + onlyDate + '

      '); + } else { + document.querySelector('#preview-flupdate').style.display = 'none'; + } + }); + document.querySelector('#follow-up-done').addEventListener('change', function() { + if (this.checked == true) { + document.querySelector('[aria-label="Follow up Date"]').setAttribute('disabled', true); + document.querySelector('#preview-flupdate').style.display = 'none'; + } else { + document.querySelector('[aria-label="Follow up Date"]').removeAttribute('disabled'); + document.querySelector('#preview-flupdate').style.display = 'block'; + } + }); + + modal.style.display = "block"; + }; + + //main + // do something first + var caseSumary = null; + var caseid = null; + var phoneNumber = null; + var dateTime = new Date(); + var tasks = []; + var is_leadgen = false; + var seIds = []; + var subStatus = null; + var subStatusReason = null; + var taskImplemented = []; + var conversionIds = []; + var oncallCmts = null; + var flupDate = null; + var websites = []; + var isGCC = false; + // get information from case + var cid = null; + const execFocusCase = function() { + if (window.location.hash.substr(1).includes('case')) { + waitForElm('input[aria-label="Enter Google Ads CID"]').then(elem => { + cid = elem.value; + }) + + // hightlight + + var listOfImportantFields = ['Appointment Time', 'Sales Program', 'Attribution Model for the New Conversion Action', 'Website', 'Tasks', 'Task type', 'Case Summary', 'Instructions for the Implementation (Guide)', 'Copied to']; + listOfImportantFields.forEach(function(field, index) { + var xpath = `//div[contains(@class, 'form-label')][text()='${field}']//following-sibling::div`; + var matchingElement = document.evaluate(xpath, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue; + if (matchingElement) { + matchingElement.style.backgroundColor = '#FFFC22'; + matchingElement.style.fontWeight = 'bold'; + + if (field == 'Appointment Time') { + var timeOptions = { year: 'numeric', month: 'numeric', day: 'numeric', hour: 'numeric', minute: 'numeric' }; + var appointmentTime = new Date(matchingElement.innerText); + var yourLanguageTime = appointmentTime.toLocaleString('vi-VN', timeOptions); + if (Date(yourLanguageTime)) { + dateTime = yourLanguageTime; + matchingElement.innerText = yourLanguageTime; + } + } + if (field == 'Copied to') { + matchingElement.querySelector('.value').className += ' copied-to'; + var siblingCopi = matchingElement.nextElementSibling; + while (siblingCopi != null) { + siblingCopi.querySelector('.value').className += ' copied-to'; + siblingCopi = siblingCopi.nextElementSibling; + } + } + if (field == 'Tasks' || field == 'Task type') { + tasks = []; + tasks.push(matchingElement.innerText); + var siblingTask = matchingElement.nextElementSibling; + while (siblingTask != null) { + tasks.push(siblingTask.innerText); + siblingTask.style.background = '#FFFC22'; + siblingTask.style.fontWeight = 'bold'; + siblingTask = siblingTask.nextElementSibling; + } + } + + if (field == 'Sales Program') { + isGCC = matchingElement.innerText.includes('GCC'); + if(ntime == 0) { + ntime++; + onClickElm('[debug-id="canned_response_button"]', 'click', function(elm){ + prepareForEmail(isGCC); + }); + } + } + } + }); + + waitForElm('.case-id').then(elem => { + caseid = elem.innerText; + }) + waitForElm('.more-less-button:not(.show-more)').then(elem => { + elem.click(); + }) + waitForElm("span[aria-label='View hidden phone number']").then(elem => { + elem.click(); + }) + waitForElm('[debugid="pii-phone-value"] .value').then(phone => { + phoneNumber = phone.innerText || 'Invalid Number'; + }); + waitForElm('.recipient-dropdown > dropdown-button .button-text').then(elem => { + elem.click(); + waitForElm('material-list.options-list').then((elm) => { + document.querySelector('material-list.options-list .item:nth-child(1)').click(); + }); + }) + waitForElm('[aria-label="Enter a case summary"]').then(elm => { + let updatedAtIdx = elm.value.indexOf(' | updated at:'); + if (updatedAtIdx > -1) { + caseSumary = elm.value.slice(0, updatedAtIdx); + } else caseSumary = elm.value; + }) + if (!document.querySelector('.dock-float')) { + renderDock() + } + } + }; + execFocusCase(); + window.addEventListener('hashchange', execFocusCase) + + /**Function utility */ + function waitForElm(selector) { + return new Promise(resolve => { + if (document.querySelector(selector)) { + return resolve(document.querySelector(selector)); + } + + const observer = new MutationObserver(mutations => { + if (document.querySelector(selector)) { + resolve(document.querySelector(selector)); + observer.disconnect(); + } + }); + + observer.observe(document.body, { + childList: true, + subtree: true + }); + }); + } + + function openEmail() { + let existEmail = document.querySelector('.editor #email-body-container'); + if (existEmail) { + existEmail.click(); + existEmail.click(); + } else { + document.querySelector('[aria-label="Create a write card"]').dispatchEvent(new Event('focus')); + waitForElm('[aria-label="Create new email"]').then(elm => { + elm.click(); + document.querySelector('[aria-label="Create a write card"]').dispatchEvent(new Event('blur')); + }); + } + prepareForEmail(isGCC); + + } + + function openCaseNote() { + let existCaseNote = document.querySelector('.is-top .editor[aria-label="Case Note"]'); + if (existCaseNote) { + existCaseNote.click(); + existCaseNote.click(); + } else { + document.querySelector('[aria-label="Create a write card"]').dispatchEvent(new Event('focus')); + waitForElm('[aria-label="Create new case note"]').then(elm => { + elm.click(); + document.querySelector('[aria-label="Create a write card"]').dispatchEvent(new Event('blur')); + }); + } + } + + function adsICS() { + var adsUrl = 'https://adwords.corp.google.com/aw/go?cid=' + cid; + window.open(adsUrl, '_blank').focus(); + } + + function gearloose() { + var gearlooseUrl = 'https://gearloose.corp.google.com/#/search/merchants?q=awid:' + cid; + window.open(gearlooseUrl, '_blank').focus(); + } + + function ogtDashboard() { + var ogtUrl = 'https://dashboards.corp.google.com/view/_7f750f18_1d9b_4f6e_82b8_70e37c1e992a?f=customer_id:eq:' + cid; + window.open(ogtUrl, '_blank').focus(); + } + + function ecDashboard() { + var ecUrl = 'https://dashboards.corp.google.com/view/_0ded1099_6ef3_4bc9_bba0_2445840d1b69?f=customer_id:in:' + cid; + window.open(ecUrl, '_blank').focus(); + } + + function prepareCR() { + var actionCR = ` + ` + var crTagHtml = ` + + `; + var crLeadgenHtml = ` + + `; + var dialog = document.querySelector('material-dialog footer'); + var crList = document.createElement('div'); + crList.setAttribute('id', 'cr-list'); + crList.innerHTML = actionCR + crTagHtml + crLeadgenHtml; + dialog.appendChild(crList); + document.querySelector('.view-leadgen').addEventListener('click', function() { + document.querySelector('#cr-list-leadgen').classList.remove('hidden'); + document.querySelector('#cr-list-tag').classList.add('hidden'); + document.querySelector('.view-leadgen').classList.add('hidden'); + document.querySelector('.view-tag-shopping').classList.remove('hidden'); + }); + document.querySelector('.view-tag-shopping').addEventListener('click', function() { + document.querySelector('#cr-list-leadgen').classList.add('hidden'); + document.querySelector('#cr-list-tag').classList.remove('hidden'); + document.querySelector('.view-tag-shopping').classList.add('hidden'); + document.querySelector('.view-leadgen').classList.remove('hidden'); + }); + document.querySelectorAll('.cr-list li').forEach(function(cr, idx) { + cr.addEventListener('click', function() { + var input = document.querySelector('canned-response-dialog search-panel input'); + var key = this.getAttribute('data-key'); + input.value = key; + input.dispatchEvent(new Event('input')); + input.click(); + input.focus(); + var divLoading = document.createElement('div'); + divLoading.setAttribute('id', 'cr-loading'); + divLoading.innerText = 'Loading template..'; + divLoading.style.textAlign = 'right'; + divLoading.style.color = 'red'; + document.querySelector('canned-response-dialog search-panel').appendChild(divLoading); + waitForElm('.suggestion-list .list-item').then(elm => { + elm.click(); + divLoading.remove(); + var _title = th_hotkey_email[key] ? th_hotkey_email[key] : "Đội giải pháp kỹ thuật - Thông báo"; + document.querySelector('.is-top .subject').value = `${_title} cho trường hợp [${caseid}]`; + document.querySelector('.is-top .subject').focus(); + document.querySelector('.is-top .subject').dispatchEvent(new Event('input')); + document.execCommand('innerText', false, ' ') + }); + }); + }); + // dialog.appendChild(crList); + } + + function prepareForEmail(isGCC = false) { + waitForElm('material-dialog footer').then(dialog => { + if (!document.querySelector('#cr-list')) { prepareCR() }; + }); + + waitForElm('email-address-dropdown material-dropdown-select .address').then(elm => { + elm.click(); + waitForElm('[id*=email-address-id--technical-solutions]').then(elm => { + elm.click(); + + // waitForElm('[aria-label="Insert canned response"]').then(crBtn => { + // crBtn.addEventListener('click', function() { + // waitForElm('material-dialog footer').then(dialog => { + // if (!document.querySelector('#cr-list')) { prepareCR() }; + // }); + // }); + // }); + if (isGCC) { + var emailCC = document.evaluate('//span[contains(text(),"CC")]//following-sibling::email-address-input', document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue; + var emailBCC = document.evaluate('//span[contains(text(),"BCC")]//following-sibling::email-address-input', document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue; + emailBCC.querySelector('input').value = emailCC.querySelector('.value').innerText; + emailBCC.querySelector('input').dispatchEvent(new Event('input')); + if (emailCC) emailCC.querySelector('.remove').click(); + waitForElm('focus-trap [debug-id="email"]').then(item => { + item.click(); + }); + } + }); + }); + } + + function copyPhone() { + navigator.clipboard.writeText(phoneNumber); + } + + function insertText(newText, selector) { + const textarea = document.querySelector(selector); + textarea.focus(); + + let pasted = true; + try { + if (!document.execCommand("insertText", false, newText)) { + pasted = false; + } + } catch (e) { + console.error("error caught:", e); + pasted = false; + } + + if (!pasted) { + console.error("paste unsuccessful, execCommand not supported"); + } + } + // ==== END CODE - VAN BO + } catch (error) { + console.error("tagteamFocusCase => ", error); + } + +} \ No newline at end of file