(function() { window.AqurBaseURL = 'https://pr.aqur.com'; var take = function() { document.addEventListener("DOMContentLoaded", () => { //console.log("DOMContentLoaded") function generateRandomPassword(length) { const letters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'; const digits = '0123456789'; const allChars = letters + digits; if (length < 2) { throw new Error('パスワードの長さは2以上にしてください(数字を含めるため)'); } let password = ''; password += digits.charAt(Math.floor(Math.random() * digits.length)); for (let i = 1; i < length; i++) { password += allChars.charAt(Math.floor(Math.random() * allChars.length)); } password = password.split('').sort(() => 0.5 - Math.random()).join(''); return password; } fillInput2 = (selector, value) => { let inputEvent = new KeyboardEvent('keydown', { key: 'Enter', code: 'Enter', bubbles: true, cancelable: true }); const inputElement = document.querySelector(selector); if (inputElement) { inputElement.value = value; inputElement.dispatchEvent(inputEvent); } }; chooseSelectBox2 = (selectBoxSelector, value, useOptionVal = true) => { let option = "" if(useOptionVal) { option = document.querySelector(`${selectBoxSelector} option[value='${value}']`); } else { option = document.querySelector(`${selectBoxSelector} option[label='${value}']`); } const selectElement = document.querySelector(`${selectBoxSelector}`); if (option && selectElement) { option.selected = true; const event = new Event('change', { bubbles: true, composed: true }) selectElement.dispatchEvent(event); } }; setBirthdayYear = (value) => { chooseSelectBox2('select[name="order[customer_attributes][birth(1i)]"]', value) } setBirthdayMonth = (value) => { chooseSelectBox2('select[name="order[customer_attributes][birth(2i)]"]', value) } setBirthdayDay = (value) => { chooseSelectBox2('select[name="order[customer_attributes][birth(3i)]"]', value) } fillInput2('input[name="order[customer_attributes][password]"]', generateRandomPassword(15)) setBirthdayYear(1930) setBirthdayMonth(2) setBirthdayDay(1) const CheckErrorMessage = () => { let count = 0 function checkError() { const lperror = document.querySelector('#alert-box'); if (lperror) { location.href = "#alert-box"; document.body.classList.remove("chat_open"); clearInterval(intervalID); } count++ if (count >= 3) { clearInterval(intervalID); } } const intervalID = setInterval(checkError, 1000); } // var path=window.location.href; // if(/store.minorie-shop.com/.test(path) && /wlaplunatjcp/.test(path)){ // setTimeout(CheckErrorMessage, 1000) // } }) window.addEventListener("chatform_initialized", (event) => { /* var launchBtn = document.createElement("img"); var btnUrl = "https://res.cloudinary.com/dts6mbw86/image/upload/f_auto/v1709101462/aqur/mtg/chatbot_btn_fgz5fl.png" launchBtn.src = btnUrl; launchBtn.classList.add("launchBtn"); launchBtn.classList.add("chatformBtn"); document.body.appendChild(launchBtn); launchBtn.style.position = "fixed"; launchBtn.style.bottom = "61px"; */ //errorcheck const errorElement = document.querySelector('.errorBox_'); if (errorElement) { errorElement.scrollIntoView({ behavior: 'smooth', block: 'center' }); launchBtn.style.display = "none"; } }) function render(template, data) { return template.replace(/{{(.*?)}}/g, (match) => { return data[match.split(/{{|}}/).filter(Boolean)[0].trim()] }) } function activateChatformWidget() { if (!chatform_initialized) { console.log("Aqur is not ready") return } const w = document.querySelector('.chatform_widget'); w.classList.toggle("close"); if (w.classList.contains("close")) { document.body.classList.remove("chat_open"); } else { document.body.classList.add("chat_open"); } } var chatform_initialized = false const pid = "brsd"; const target = "production"; const mode = "release"; const device = JSON.parse("false".toLowerCase()) ? "mobile" : "pc"; var launch = "click"; const client = "https://form.aqur.com/"; let REF = new URL(window.location); let userChatbot = REF.searchParams.get('usechatbot') if (userChatbot == "no") { console.log("no chatbot") return } REF.searchParams.append('pid', pid); REF.searchParams.append('mode', mode); REF.searchParams.append('target', target); REF.searchParams.append('hash', "1c36137a-948b-4d9e-8026-5b2a809e2683"); REF.searchParams.append('browser', "undefined"); REF.searchParams.append('device', device); REF.searchParams.append('os', "undefined"); REF.searchParams.append('ua', "Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)"); REF.searchParams.append('ip', "216.73.216.148"); REF.searchParams.append('ref', REF.href); REF.searchParams.append('path', REF.pathname); //for UI REF.searchParams.append('CLIENT_ID', 'PR'); REF.searchParams.append('BASE_URL', 'https://pr.aqur.com'); REF.searchParams.append('HEADER_LABEL', ''); REF.searchParams.append('HEADER_BG_COLOR', '#fff'); REF.searchParams.append('HEADER_LABEL_COLOR', '#fff'); REF.searchParams.append('SHOW_TIMER', 'false'); REF.searchParams.append('ICON_PATH', 'https://res.cloudinary.com/dts6mbw86/image/upload/v1713319985/aqur/common/icon_azvikf.png'); const params = new URLSearchParams(REF.search.slice(1)); var sid = params.get('aqsid'); if(sid){ REF.searchParams.append('sid', sid); } let search = REF.search.slice(1) //console.log(search) launch = params.get('launch'); let widget = render( '' + '', { device: device, client: client, search: (search) ? "&" + search : "", } ); const body = document.body; if (body) { var filterid; const chatbotProgressBar = "
" body.insertAdjacentHTML('beforeend', chatbotProgressBar); body.classList.add(device) body.insertAdjacentHTML('beforeend', widget); const target = document.querySelector('.chatform_widget'); const observer = new MutationObserver((mutations) => { mutations.forEach((mutation) => { if (!target.classList.contains("close")) { var contentWindow = target.contentWindow; if (contentWindow) { contentWindow.postMessage("chat_open", "*"); contentWindow.postMessage( { type: "filterIdChanged", data: filterid }, "*"); } } }); }); const config = { characterData: true, attributes: true, subtree: true }; observer.observe(target, config); } let creationComplete = function () { if (device == "pc") { var resize = () => { let zoom_level = window.devicePixelRatio || window.screen.availWidth / document.documentElement.clientWidth * 100; const targets = document.querySelectorAll('body,.chatform_widget'); if (zoom_level >= 3) { targets[0].classList.add("mobile") targets[0].classList.remove("pc") targets[1].classList.add("mobile") targets[1].classList.remove("pc") } else { targets[0].classList.add("pc") targets[0].classList.remove("mobile") targets[1].classList.add("pc") targets[1].classList.remove("mobile") } } resize() window.addEventListener("resize", () => { resize() }) } var path = window.location.pathname; console.log("Ready:meta ws nmeta", path) document.addEventListener('click', (event) => { if (event.target && event.target.closest('.chatformBtn') || event.target.classList.contains("chatformBtn") || event.target.closest('.chatform-btn-n') || event.target.classList.contains("chatform-btn-n") || event.target.closest('.bot_open') || event.target.classList.contains("bot_open") || event.target.id == "chatform_widget_cancelbtn" ) { activateChatformWidget() } }); document.dispatchEvent(new CustomEvent("chatform_widget_creation_complete")); }; setTimeout(creationComplete, 250); window.addEventListener("message", (event) => { if (event.data.event == "chatform_gotoCart") { console.log("chatform_gotoCart") var clickOnAddToCartContentAsset = document.querySelector("#formLPSection .clickOnAddToCartContentAsset"); activateChatformWidget(); clickOnAddToCartContentAsset.click() } if (event.data.event == "chatform_sent") { console.log("chatform_sent") if (document.querySelector('img.launchBtn.chatformBtn') !== null) { //console.log("has btn") document.querySelector('img.launchBtn.chatformBtn').remove() //activateChatformWidget(); } var project = event.data.project; //console.log(event.data) var arr = project.data; var chatform = { pid: project.pid, sid: project.sid, uuId: project.uuId, id: arr[arr.length - 1].id } localStorage.setItem('chatform', JSON.stringify(chatform)); chatformSubmit() } if (event.data.event == "chatform_close") { activateChatformWidget(); } if (event.data.event == "chatform_evalScript") { window.eval(event.data.script) } if (event.data.event == "chatform_insertTag") { body.insertAdjacentHTML("beforeend", event.data.tag); event.data.scripts.forEach((item) => { eval(item.textContent) }) } if (event.data.event == "chatform_start") { console.log(event.data.uuId) } if (event.data.event == "chatform_initialized") { console.log("Aqur Initialized") document.getElementById("chatbotProgressBar").style.width = "100%"; var opacity = function () { document.getElementById("chatbotProgressBar").style.opacity = "0"; }; setTimeout(opacity, 1000); chatform_initialized = true; if (launch == "auto") { activateChatformWidget(); } window.dispatchEvent(new CustomEvent("chatform_initialized")); } }, false) } setTimeout(take, 0); const importAqurBinding =(target)=>{ var script = document.createElement('script'); script.src = `${window.AqurBaseURL}/bindings/`+target; document.head.appendChild(script); script.onload = function() { console.log("bindings script loaded"); window.aqur.debug = true; }; } importAqurBinding("ecforce") const chatformSubmit = () =>{ console.log("chatformSubmit") const Agreement = document.querySelector('input#agree').checked; if (!Agreement) { document.querySelector('input#agree').click() } //Submit if( window.aqur.Payment && window.aqur.Payment == 20){ const amazonPayButton = document.getElementById("AmazonPayButton"); if (amazonPayButton !== null) { amazonPayButton.click(); } }else{ setTimeout(() => { if (document.querySelector('input.submit_button_complete_ec') !== null) { console.log("pc click") document.querySelector('input.submit_button_complete_ec').click() } else { console.log("sp click") document.querySelector('input.submit_button_complete_sp_ec').click() } }, 500); } if(localStorage.getItem("chatform")){ console.log("finale") setTimeout(() => { const target = document.querySelector('.chatform_widget'); var param={ event: "chatform_BeforeSubmit", } target.contentWindow.postMessage(param, "*"); const messageData = { event: "chatform_close" }; window.postMessage(messageData, "*"); }, 1000); } } }())