PageSourceSearch

https://www.ego886.com/js/StoreCallback-DVyQLHNa.js

js ego886.com collected 2026-10-07 21:55:19 UTC 6,019 bytes, 1 lines download raw bytes

1var D=(h,n,u)=>new Promise((p,i)=>{var w=l=>{try{a(u.next(l))}catch(d){i(d)}},g=l=>{try{a(u.throw(l))}catch(d){i(d)}},a=l=>l.done?p(l.value):Promise.resolve(l.value).then(w,g);a((u=u.apply(h,n)).next())});import{r as S,p as A,b as I,e as k,j as o,f as q,t as f,g as C}from"./vue-vendor-BqEqlBN8.js";import"./parse-hlf3C9cV.js";import{_ as L,u as O,l as r}from"./index-zKxGK1P5.js";import"./vendor-CgfLlPlq.js";import"./query-mEIUYlNa.js";const $={class:"store-callback-page"},P={class:"callback-container"},j={key:0,class:"callback-loading"},X={key:1,class:"callback-content success"},G={class:"store-info"},H={class:"info-row"},U={class:"value"},V={class:"info-row"},W={class:"value"},J={key:0,class:"info-row"},z={class:"value"},F={class:"callback-message"},K={key:2,class:"callback-content failed"},Q={class:"callback-message"},Y=20,Z=100,ee=200,te=200,oe={__name:"StoreCallback",setup(h){const n=I(),{setInterval:u,clearInterval:p}=O(),i=(t,e)=>typeof t!="string"?"":t.substring(0,e).replace(/[<>"']/g,"").trim(),w=S(!0),g=S(!1),a=S({}),l=S(""),d=S("請關閉此視窗並返回頁面"),m=S(3);let b=null;A(()=>D(null,null,function*(){document.title="門市選擇結果 - 星星電商";try{if(n.query.error){const t=i(n.query.message||n.query.error||"門市選擇失敗",te);throw new Error(t)}if(r.log("StoreCallback","URL 參數已接收"),n.query.success==="true"){const t={storeCode:i(n.query.storeCode||"",Y),storeName:i(n.query.storeName||"",Z),storeAddr:i(n.query.storeAddr||"",ee)};r.log("StoreCallback","門市資料已驗證"),a.value=t,g.value=!0;const s=_()==="address"?"地址管理頁面":"結帳頁面";d.value=`${m.value} 秒後將自動返回${s}...`,M(t),T(t),B()}else throw new Error("未收到門市選擇資料")}catch(t){r.error("StoreCallback","處理失敗:",t),l.value=t.message,g.value=!1}finally{w.value=!1}}));function _(){try{const s=sessionStorage.getItem("storeMapContext");if(s)return s}catch(s){r.warn("StoreCallback","[StoreCallback] sessionStorage 不可用")}try{const s=localStorage.getItem("storeMapContext");if(s)return s}catch(s){r.warn("StoreCallback","[StoreCallback] localStorage 不可用")}const t=["checkout","address"],e=n.query.context;return e&&t.includes(e)?e:"checkout"}function M(t){const e=JSON.stringify(t);r.log("StoreCallback","儲存門市資料:",t);try{sessionStorage.setItem("selectedStore",e),sessionStorage.setItem("selectedStoreExpiry",String(Date.now()+300*1e3)),r.log("StoreCallback","sessionStorage 儲存成功")}catch(s){r.warn("StoreCallback","sessionStorage 儲存失敗")}try{if(window.indexedDB){const s=indexedDB.open("StoreMapDB",1);s.onerror=c=>{r.warn("StoreCallback","[StoreCallback] IndexedDB 開啟失敗:",c.target.error)},s.onblocked=()=>{r.warn("StoreCallback","[StoreCallback] IndexedDB 被阻塞")},s.onupgradeneeded=c=>{const v=c.target.result;v.objectStoreNames.contains("stores")||v.createObjectStore("stores",{keyPath:"id"})},s.onsuccess=c=>{const E=c.target.result.transaction(["stores"],"readwrite");E.onerror=y=>{r.warn("StoreCallback","[StoreCallback] IndexedDB 交易失敗:",y.target.error)};const R=E.objectStore("stores").put({id:"selectedStore",data:t,expiry:Date.now()+300*1e3});R.onerror=y=>{r.warn("StoreCallback","[StoreCallback] IndexedDB 寫入失敗:",y.target.error)}}}}catch(s){r.warn("StoreCallback","[StoreCallback] IndexedDB 儲存失敗")}}function N(){return`${Date.now()}-${Math.random().toString(36).substring(2,10)}`}function T(t){if(r.log("StoreCallback","notifyParentWindow 開始"),window.opener)try{window.opener.postMessage({type:"STORE_SELECTED",store:t,token:N(),origin:window.location.origin},window.location.origin),r.log("StoreCallback","postMessage 發送成功")}catch(e){r.error("StoreCallback","postMessage 發送失敗:",e)}
1try{if(window.BroadcastChannel){const e=new BroadcastChannel("store_selection_channel");e.postMessage({type:"STORE_SELECTED",store:t}),r.log("StoreCallback","BroadcastChannel 訊息已發送"),e.close()}}catch(e){r.error("StoreCallback","BroadcastChannel 發送失敗:",e)}}function x(){const t=_();if(window.opener)window.close();else{const e=a.value,s=new URLSearchParams({fromStoreCallback:"true",storeCode:e.storeCode||"",storeName:e.storeName||"",storeAddr:e.storeAddr||""});t==="address"?window.location.href=`/member?panel=address&${s.toString()}`:window.location.href=`/checkout?${s.toString()}`}}function B(){const t=_(),e=a.value,s=t==="address"?"地址管理頁面":"結帳頁面";e&&e.storeName&&(b&&p(b),b=u(()=>{if(m.value--,d.value=`${m.value} 秒後將自動返回${s}...`,m.value<=0){p(b),b=null;const c=new URLSearchParams({fromStoreCallback:"true",storeCode:e.storeCode||"",storeName:e.storeName||"",storeAddr:e.storeAddr||""});t==="address"?window.location.href=`/member?panel=address&${c.toString()}`:window.location.href=`/checkout?${c.toString()}`}},1e3))}return(t,e)=>(C(),k("div",$,[o("div",P,[w.value?(C(),k("div",j,[...e[0]||(e[0]=[o("div",{class:"spinner"},null,-1),o("p",null,"正在處理門市選擇結果...",-1)])])):g.value?(C(),k("div",X,[e[4]||(e[4]=o("div",{class:"callback-icon success"},[o("i",{class:"fas fa-check-circle"})],-1)),e[5]||(e[5]=o("h1",{class:"callback-title"},"門市選擇成功",-1)),o("div",G,[o("div",H,[e[1]||(e[1]=o("span",{class:"label"},"門市名稱",-1)),o("span",U,f(a.value.storeName),1)]),o("div",V,[e[2]||(e[2]=o("span",{class:"label"},"門市地址",-1)),o("span",W,f(a.value.storeAddr),1)]),a.value.storeCode?(C(),k("div",J,[e[3]||(e[3]=o("span",{class:"label"},"門市代碼",-1)),o("span",z,f(a.value.storeCode),1)])):q("",!0)]),o("p",F,f(d.value),1),o("button",{class:"btn-primary",onClick:x},"關閉視窗")])):(C(),k("div",K,[e[6]||(e[6]=o("div",{class:"callback-icon failed"},[o("i",{class:"fas fa-times-circle"})],-1)),e[7]||(e[7]=o("h1",{class:"callback-title"},"門市選擇失敗",-1)),o("p",Q,f(l.value||"無法取得門市資訊,請重試"),1),o("button",{class:"btn-primary",onClick:x},"關閉視窗")]))])]))}},de=L(oe,[["__scopeId","data-v-91bf1d6d"]]);export{de as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.