PageSourceSearch

https://fraudspy.com.bd/build/assets/settings-D_k2g-XK.js

js fraudspy.com.bd collected 2026-09-24 09:52:33 UTC 14,408 bytes, 1 lines download raw bytes

1import{d as W,r as v,i as g,o as z,j as U,e as a,b as r,k as V,l as G,m as Q,p as H,g as t,z as f,f as h,t as u,F as $,y as M,v as o,x as c,h as K,Q as D,R as Z,G as T,B as C}from"./app-D8aYVF87.js";import{_ as J}from"./AppLayout.vue_vue_type_script_setup_true_lang-C4oVZZTp.js";import{C as X}from"./ConfirmModal-CQnfx0RD.js";import{_ as Y}from"./_plugin-vue_export-helper-DlAUqK2U.js";/* empty css            */import"./Primitive-SmALb3gF.js";import"./VisuallyHidden-BR-mgmwZ.js";import"./createLucideIcon-CoY9UKie.js";const ee={class:"mx-auto max-w-5xl p-3 sm:p-4"},te={class:"mb-3 sm:mb-4 rounded-2xl sm:rounded-3xl bg-[var(--card)] px-4 sm:px-5 py-3 sm:py-4 shadow-soft ring-1 ring-black/5 dark:ring-white/10"},se={class:"flex flex-col gap-1 md:flex-row md:items-center md:justify-between"},le={key:0,class:"text-xs text-[var(--muted-foreground)]"},ie={class:"rounded-2xl sm:rounded-3xl bg-[var(--card)] shadow-soft ring-1 ring-black/5 dark:ring-white/10 overflow-hidden"},oe={class:"p-3 border-b border-black/5 dark:border-white/10 md:hidden"},ne={class:"kpi-grid"},ae=["onClick"],re={class:"kpi-icon"},de={class:"kpi-meta"},ue={class:"kpi-title"},ce={class:"kpi-sub"},pe={class:"hidden md:block border-b border-black/5 dark:border-white/10"},me={class:"toggle mt-1 mb-2 px-2"},ve={class:"p-3 sm:p-4"},be={key:0,class:"mb-3 sm:mb-4 rounded-xl px-3 sm:px-4 py-2.5 text-sm",style:{background:"linear-gradient(135deg, color-mix(in oklab, var(--legend-bad) 12%, transparent), transparent)",color:"var(--danger-700)"}},fe={class:"space-y-4 sm:space-y-6"},_e={class:"grid grid-cols-1 gap-3 sm:grid-cols-2"},ge={class:"rounded-xl border border-black/5 p-3 sm:p-4 dark:border-white/10"},he={class:"grid grid-cols-1 gap-3 sm:grid-cols-2"},ye={class:"flex flex-col gap-2 sm:gap-3 md:flex-row md:items-center md:justify-between"},xe={class:"flex gap-2"},ke=["disabled"],we={class:"rounded-2xl border border-black/5 p-3 sm:p-4 dark:border-white/10"},Ce={class:"mb-3 flex items-center justify-between"},Se=["disabled"],Ne={key:0,class:"text-sm text-[var(--muted-foreground)]"},Ie={key:1,class:"grid grid-cols-1 gap-2 sm:grid-cols-2"},Ue={class:"store-title text-slate-900 dark:text-slate-100 flex items-center gap-2"},Ve={key:0,class:"chip"},$e={key:1,class:"chip"},De={key:2,class:"chip"},Ae={class:"mt-0.5 store-meta text-slate-600 dark:text-slate-300"},Pe={class:"mt-0.5 store-addr text-slate-600 dark:text-slate-300 whitespace-pre-line"},Me={class:"space-y-4 sm:space-y-6"},Te={class:"grid grid-cols-1 gap-3 sm:grid-cols-3"},je={class:"auth-input grid place-items-center h-12 font-mono text-sm"},Fe={class:"grid grid-cols-1 gap-3 sm:grid-cols-3"},Le={class:"flex items-center gap-2"},qe={class:"grid grid-cols-1 gap-3 sm:grid-cols-4"},Be={class:"grid grid-cols-1 gap-3 sm:grid-cols-3"},Oe={class:"sm:col-span-2"},Ee={class:"flex items-center justify-end"},Re=["disabled"],We={class:"rounded-2xl border border-black/5 p-3 sm:p-4 dark:border-white/10"},ze={class:"grid grid-cols-2 gap-3 items.end sm:grid-cols-3"},Ge={class:"col-span-2 sm:col-span-2 min-w-0"},Qe={class:"flex items-center gap-2"},He=["value"],Ke={class:"col-span-2 sm:col-span-1 min-w-0 sm:min-w-[220px]"},Ze={class:"flex items.center gap-2"},Je=["value"],Xe="fs-search-theme",Ye=W({__name:"settings",setup(et){const d=v("credentials"),n=g({client_id:"",client_secret:"",base_url:"https://api-hermes.pathao.com"}),p=g({username:"",password:""}),S=v(!1),y=v(!1),m=v(""),b=v([]),x=v(""),i=g({invoice_prefix:"",next_number:1,delivery_type:48,item_type:2,item_quantity:1,item_weight:.5,number_width:6,use_hyphen:!0,item_description:""}),N=v(!1),k=g({url:"https://fraudspy.com.bd/api/webhooks/pathao",secret:"fraudspy1234"});function A(l){navigator.clipboard?.writeText(l)}const _=v(!1),w=g({title:"",message:""});function I(l,e=""){w.title=l,w.message=e,_.value=!0}async function j(){try{const{data:l}=await C.get("/pathao/settings/json");l?.cred&&(n.client_id=l.cred.client_id||"",n.client_secret="",l.cred.base_url&&(n.base_url=l.cred.base_url)),Array.isArray(l?.stores)&&(b.value=l.stores),l?.invoice&&Object.assign(i,{invoice_prefix:l.invoice.invoice_prefix??"",next_number:Number(l.invoice.next_number??1),delivery_type:Number(l.invoice.delivery_type??48),item_type:Number(l.invoice.item_type??2),item_quantity:Number(l.invoice.item_quantity??1),item_weight:Number(l.invoice.item_weight??.5),number_width:Number(l.invoice.number_width??6),use_hyphen:!!(typeof l.invoice.use_hyphen=="boolean"?l.invoice.use_hyphen:Number(l.invoice.use_hyphen??1)===1),item_description:l.invoice.item_description??""}),l?.last_saved_at&&(x.value=l.last_saved_at)}catch(l){m.value=l?.response?.data?.message||"Failed to load settings."}}z(()=>{j()});const F=U(()=>!!n.client_id&&!!n.client_secret&&!!p.username&&!!p.password);
1async function L(){m.value="",S.value=!0;try{const l={client_id:n.client_id.trim(),client_secret:n.client_secret.trim(),base_url:n.base_url,issue_token:!0,username:p.username.trim(),password:p.password},{data:e}=await C.post("/pathao/settings/save",l);e?.last_saved_at&&(x.value=e.last_saved_at),Array.isArray(e?.stores)&&(b.value=e.stores),p.password="",I("Token issued & saved","Access token issued successfully. Merchant stores have been synced.")}catch(l){m.value=l?.response?.data?.message||"Save / issue token failed. Check credentials."}finally{S.value=!1}}async function q(){m.value="",y.value=!0;try{const{data:l}=await C.get("/pathao/settings/stores");b.value=Array.isArray(l?.stores)?l.stores:[],I("Stores refreshed",`Fetched ${b.value.length} store${b.value.length===1?"":"s"} successfully.`)}catch(l){m.value=l?.response?.data?.message||"Failed to fetch stores."}finally{y.value=!1}}async function B(){m.value="",N.value=!0;try{const l={...i},{data:e}=await C.post("/pathao/settings/invoice",l);e?.invoice&&Object.assign(i,{...i,...e.invoice,number_width:Number(e.invoice.number_width??i.number_width),use_hyphen:!!(typeof e.invoice.use_hyphen=="boolean"?e.invoice.use_hyphen:Number(e.invoice.use_hyphen??(i.use_hyphen?1:0))===1)}),I("Invoice defaults saved")}catch(l){m.value=l?.response?.data?.message||"Invoice save failed."}finally{N.value=!1}}const O=U(()=>{const l=(i.invoice_prefix||"INV").trim(),e=String(Math.max(1,Number(i.next_number||1))),s=Math.max(0,Number(i.number_width||0)),P=s>0?e.padStart(s,"0"):e,R=l&&i.use_hyphen?"-":"";return`${l}${R}${P}`}),E=U(()=>
1[{key:"credentials",label:"Credentials",sub:"Client & token",icon:"fa-id-card"},{key:"invoice",label:"Invoice",sub:"Defaults",icon:"fa-file-lines"},{key:"webhook",label:"Webhook",sub:"URL & secret",icon:"fa-link"}]);return(l,e)=>(r(),a($,null,[V(G(Q),{title:"Pathao Settings"}),V(J,{breadcrumbs:[{title:"Home",href:"/"},{title:"Pathao",href:"/pathao"},{title:"Settings",href:"/pathao/settings"}]},{default:H(()=>[t("div",{class:f(Xe)},[t("div",ee,[t("div",te,[t("div",se,[e[21]||(e[21]=t("div",null,[t("h1",{class:"text-xl sm:text-2xl font-bold text-[var(--foreground)]"},"Pathao Settings"),t("p",{class:"text-xs sm:text-sm text-[var(--muted-foreground)]"},"Connect Pathao, configure invoice & webhook")],-1)),x.value?(r(),a("div",le,"Last updated: "+u(x.value),1)):h("",!0)])]),t("div",ie,[t("div",oe,[t("div",ne,[(r(!0),a($,null,M(E.value,s=>(r(),a("button",{key:s.key,type:"button",class:f(["kpi-tab",`kpi--${s.key}`,d.value===s.key&&"kpi-active"]),onClick:P=>d.value=s.key},[t("div",re,[t("i",{class:f(["fa-regular",s.icon])},null,2)]),t("div",de,[t("div",ue,u(s.label),1),t("div",ce,u(s.sub),1)])],10,ae))),128))])]),t("div",pe,[t("div",me,[t("button",{type:"button",class:f(["toggle-btn",d.value==="credentials"&&"active"]),onClick:e[0]||(e[0]=s=>d.value="credentials")},"Credentials",2),t("button",{type:"button",class:f(["toggle-btn",d.value==="invoice"&&"active"]),onClick:e[1]||(e[1]=s=>d.value="invoice")},"Invoice Defaults",2),t("button",{type:"button",class:f(["toggle-btn",d.value==="webhook"&&"active"]),onClick:e[2]||(e[2]=s=>d.value="webhook")},"Webhook",2)])]),t("div",ve,[m.value?(r(),a("div",be,u(m.value),1)):h("",!0),o(t("div",fe,[t("div",_e,[t("div",null,[e[22]||(e[22]=t("label",{class:"lbl"},"Client ID",-1)),o(t("input",{"onUpdate:modelValue":e[3]||(e[3]=s=>n.client_id=s),class:"auth-input w-full",placeholder:"Enter client_id"},null,512),[[c,n.client_id,void 0,{trim:!0}]])]),t("div",null,[e[23]||(e[23]=t("label",{class:"lbl"},"Client Secret",-1)),o(t("input",{"onUpdate:modelValue":e[4]||(e[4]=s=>n.client_secret=s),class:"auth-input w-full",placeholder:"Enter client_secret"},null,512),[[c,n.client_secret,void 0,{trim:!0}]])])]),t("div",ge,[e[26]||(e[26]=t("div",{class:"mb-2 text-sm font-semibold text-[var(--foreground)]"},"Login (issue token)",-1)),t("div",he,[t("div",null,[e[24]||(e[24]=t("label",{class:"lbl"},"Username (email)",-1)),o(t("input",{"onUpdate:modelValue":e[5]||(e[5]=s=>p.username=s),class:"auth-input w-full",placeholder:"[email protected]",autocomplete:"username"},null,512),[[c,p.username,void 0,{trim:!0}]])]),t("div",null,[e[25]||(e[25]=t("label",{class:"lbl"},"Password",-1)),o(t("input",{"onUpdate:modelValue":e[6]||(e[6]=s=>p.password=s),type:"password",class:"auth-input w-full",placeholder:"••••••••",autocomplete:"current-password"},null,512),[[c,p.password]])])])]),t("div",ye,[e[27]||(e[27]=t("div",null,null,-1)),t("div",xe,[t("button",{class:"btn-cta h-10 rounded-xl px-4 text-sm font-semibold text-white disabled:opacity-60",disabled:S.value||!F.value,onClick:L}," Save & Issue Token ",8,ke)])]),t("div",we,[t("div",Ce,[e[28]||(e[28]=t("div",{class:"text-sm font-semibold text-[var(--foreground)]"},"Merchant Stores",-1)),t("button",{class:"btn-ghost h-9 rounded-lg px-3 text-xs font-semibold disabled:opacity-60",disabled:y.value,onClick:q},u(y.value?"Fetching…":"Get Store Names"),9,Se)]),b.value.length?(r(),a("div",Ie,[(r(!0),a($,null,M(b.value,s=>(r(),a("div",{key:s.store_id,class:"store-card rounded-xl bg.white shadow-sm ring-1 ring-black/5 dark:bg-slate-900 dark:ring-white/10"},[t("div",Ue,[K(u(s.store_name||"#"+s.store_id)+" ",1),s.is_default_store?(r(),a("span",Ve,"pickup")):h("",!0),s.is_default_return_store?(r(),a("span",$e,"return")):h("",!0),s.is_active?h("",!0):(r(),a("span",De,"inactive"))]),t("div",Ae," #"+u(s.store_id)+" · City "+u(s.city_id)+" · Zone "+u(s.zone_id),1),t("div",Pe,u(s.store_address),1)]))),128))])):(r(),a("div",Ne," No stores loaded yet. "))])],512),[[D,d.value==="credentials"]]),o(t("div",Me,[t("div",Te,[t("div",null,[e[29]||(e[29]=t("label",{class:"lbl"},"Invoice Prefix",-1)),o(t("input",{"onUpdate:modelValue":e[7]||
1(e[7]=s=>i.invoice_prefix=s),class:"auth-input w-full",placeholder:"e.g. FS"},null,512),[[c,i.invoice_prefix,void 0,{trim:!0}]])]),t("div",null,[e[30]||(e[30]=t("label",{class:"lbl"},"Next Number",-1)),o(t("input",{"onUpdate:modelValue":e[8]||(e[8]=s=>i.next_number=s),type:"number",min:"1",class:"auth-input w-full"},null,512),[[c,i.next_number,void 0,{number:!0}]])]),t("div",null,[e[31]||(e[31]=t("label",{class:"lbl"},"Preview",-1)),t("div",je,u(O.value),1)])]),t("div",Fe,[t("div",null,[e[32]||(e[32]=t("label",{class:"lbl"},"Padding Digits (0 = no padding)",-1)),o(t("input",{"onUpdate:modelValue":e[9]||(e[9]=s=>i.number_width=s),type:"number",min:"0",max:"12",class:"auth-input w-full"},null,512),[[c,i.number_width,void 0,{number:!0}]])]),t("div",Le,[o(t("input",{id:"use_hyphen",type:"checkbox","onUpdate:modelValue":e[10]||(e[10]=s=>i.use_hyphen=s),class:"h-4 w-4"},null,512),[[Z,i.use_hyphen]]),e[33]||(e[33]=t("label",{for:"use_hyphen",class:"lbl m-0"},"Use hyphen after prefix",-1))])]),t("div",qe,[t("div",null,[e[35]||(e[35]=t("label",{class:"lbl"},"Delivery Type",-1)),o(t("select",{"onUpdate:modelValue":e[11]||(e[11]=s=>i.delivery_type=s),class:"auth-input w-full"},[...e[34]||(e[34]=[t("option",{value:48},"Normal Delivery",-1),t("option",{value:12},"On Demand",-1)])],512),[[T,i.delivery_type,void 0,{number:!0}]])]),t("div",null,[e[37]||(e[37]=t("label",{class:"lbl"},"Item Type",-1)),o(t("select",{"onUpdate:modelValue":e[12]||(e[12]=s=>i.item_type=s),class:"auth-input w-full"},[...e[36]||(e[36]=[t("option",{value:1},"Document",-1),t("option",{value:2},"Parcel",-1)])],512),[[T,i.item_type,void 0,{number:!0}]])]),t("div",null,[e[38]||(e[38]=t("label",{class:"lbl"},"Item Quantity",-1)),o(t("input",{"onUpdate:modelValue":e[13]||(e[13]=s=>i.item_quantity=s),type:"number",min:"1",class:"auth-input w-full"},null,512),[[c,i.item_quantity,void 0,{number:!0}]])]),t("div",null,[e[39]||(e[39]=t("label",{class:"lbl"},"Item Weight (kg)",-1)),o(t("input",{"onUpdate:modelValue":e[14]||(e[14]=s=>i.item_weight=s),type:"number",step:"0.1",min:"0.5",max:"10",class:"auth-input w-full"},null,512),[[c,i.item_weight,void 0,{number:!0}]])])]),t("div",Be,[t("div",Oe,[e[40]||(e[40]=t("label",{class:"lbl"},"Item Description",-1)),o(t("input",{"onUpdate:modelValue":e[15]||(e[15]=s=>i.item_description=s),class:"auth-input w-full",placeholder:"e.g. T-Shirt, 1 pc"},null,512),[[c,i.item_description,void 0,{trim:!0}]]),e[41]||(e[41]=t("div",{class:"hint"},"Fixed default for AI Entry. Leave blank to use AI-detected description.",-1))])]),t("div",Ee,[t("button",{class:"btn-cta h-10 rounded-xl px-4 text-sm font-semibold text-white disabled:opacity-60",disabled:N.value,onClick:B}," Save Invoice Defaults ",8,Re)])],512),[[D,d.value==="invoice"]]),o(t("div",null,[t("div",We,[t("div",ze,[t("div",Ge,[e[43]||(e[43]=t("label",{class:"lbl"},"Webhook URL",-1)),t("div",Qe,[t("input",{value:k.url,readonly:"",class:"auth-input w-full"},null,8,He),t("button",{class:"btn-ghost h-10 px-3 text-xs font-semibold shrink-0",onClick:e[16]||(e[16]=s=>A(k.url)),title:"Copy URL"},[...e[42]||(e[42]=[t("i",{class:"fa-regular fa-copy"},null,-1)])])])]),t("div",Ke,[e[45]||(e[45]=t("label",{class:"lbl"},"Signature Secret",-1)),t("div",Ze,[t("input",{value:k.secret,readonly:"",class:"auth-input w-full"},null,8,Je),t("button",{class:"btn-ghost h-10 px-3 text-xs font-semibold shrink-0",onClick:e[17]||(e[17]=s=>A(k.secret)),title:"Copy Secret"},[...e[44]||(e[44]=[t("i",{class:"fa-regular fa-copy"},null,-1)])])])])])])],512),[[D,d.value==="webhook"]])])])]),V(X,{open:_.value,"onUpdate:open":e[18]||(e[18]=s=>_.value=s),title:w.title,message:w.message,variant:"success","confirm-text":"OK","confirm-only":!0,onConfirm:e[19]||(e[19]=()=>_.value=!1),onCancel:e[20]||(e[20]=()=>_.value=!1)},null,8,["open","title","message"])])]),_:1})],64))}}),dt=Y(Ye,[["__scopeId","data-v-06eadd62"]]);export{dt 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.