PluginProbe
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler / 1.5.1
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler v1.5.1
1.6.5 1.6.4 1.6.3 1.6.2 1.6.1 1.6.0 1.5.4 1.5.5 1.5.3 1.5.2 1.5.1 1.5.0 1.4.2 1.4.1 1.4.0 1.3.28 1.3.27 1.3.26 1.3.25 1.3.23 1.3.22 1.3.21 1.3.20 1.3.19 trunk All 48 releases
fluent-cart / assets / chunks / McpSettings.js

McpSettings.js in FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler 1.5.1, at assets/chunks/McpSettings.js

2 lines 10.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import{A as ce,B as ue,h as r,l as g,i as de,r as b,R as pe,e as m,b as u,o as c,d as e,a as d,t as o,w as p,f as _,c as x,u as n,F as W,g as ve,S as me}from"./vue.esm-bundler.js?ver=1.5.1";import{t as a}from"./Translator.js?ver=1.5.1";import{B as _e,b as fe}from"./Badge.js?ver=1.5.1";import{R as D}from"./Rest.js?ver=1.5.1";import{n as y}from"./Notify.js?ver=1.5.1";import{C as $}from"./OrderCustomerInformation.js?ver=1.5.1";import"./Arr.js?ver=1.5.1";import"./Model.js?ver=1.5.1";import"./Storage.js?ver=1.5.1";import"./Str.js?ver=1.5.1";import"./vue-router.js?ver=1.5.1";import"./Url.js?ver=1.5.1";import"./dayjs.min.js?ver=1.5.1";import"./timezone.js?ver=1.5.1";import"./DynamicIcon.js?ver=1.5.1";import"./_plugin-vue_export-helper.js?ver=1.5.1";import"./index3.js?ver=1.5.1";import"./index.js?ver=1.5.1";import"./IconButton.js?ver=1.5.1";import"./Utils.js?ver=1.5.1";import"./TransitionAccordion.js?ver=1.5.1";import"./Empty.js?ver=1.5.1";import"./common.js?ver=1.5.1";import"./CardBody.js?ver=1.5.1";import"./UserCan.js?ver=1.5.1";import"./Asset.js?ver=1.5.1";import"./AddressComponent2.js?ver=1.5.1";import"./Animation.js?ver=1.5.1";import"./NotFound.js?ver=1.5.1";import"./productService.js?ver=1.5.1";import"./CurrencyFormatter.js?ver=1.5.1";const he={key:0,class:"fct-content-card-list-item py-4 px-6 !flex !pr-6 items-start justify-between !gap-4"},be={class:"min-w-0"},ge={class:"fct-content-card-list-head"},ye={class:"flex items-start gap-2 flex-row"},we={class:"mb-0"},Ce={key:0,class:"fct-content-card-list-content mt-1"},ke={class:"flex items-center gap-3 shrink-0"},Ve={class:"space-y-4"},xe={key:0,class:"fct-mcp-content-box"},Me={class:"fct-mcp-content-box-title"},He={class:"fct-mcp-content-box-text"},Fe={class:"fct-mcp-content-box-action"},Se={key:2,class:"fct-mcp-content-box is-active"},Pe={class:"fct-mcp-content-box-title"},Be={class:"fct-mcp-content-box-text"},Le={class:"fct-mcp-agents-text"},De={class:"tools-count"},Te={class:"tools-label"},Ue={class:"fct-form-group"},je={class:"fct-form-group"},Ae={class:"form-note mb-3"},Ie=["href"],qe={class:"grid gap-3 md:grid-cols-2 mb-3"},Ee={key:0,class:"mb-3"},Re={key:1,class:"form-note mb-2"},Ze={class:"relative fct-mcp-snippet"},Ne={class:"fct-mcp-snippet-code"},ze={class:"mt-2 flex justify-end"},Ct={__name:"McpSettings",props:ce({name:{type:String,required:!0},field:{type:Object},fieldKey:{type:String},value:{required:!0},variant:{type:String},nesting:{type:Boolean,default:!1},statePath:{type:String},form:{type:Object,required:!0},callback:{type:Function,required:!0},label:{type:String},attribute:{required:!0}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(M){const H=ue(M,"modelValue"),q=l=>{const t=H.value&&typeof H.value=="object"?H.value:{};H.value={...t,active:l?"yes":"no"}},K=[{key:"claude-code",label:"Claude Code"},{key:"claude-desktop",label:"Claude Desktop"},{key:"cursor",label:"Cursor"},{key:"codex",label:"Codex"},{key:"generic",label:a("Other")}],E=r(!1),R=r(!1),T=r(!1),F=r(!1),s=r({mcp_enabled:!1,adapter_available:!1,toolkit_installed:!1,can_auto_install:!1,toolkit_download_url:"",endpoint_url:"",tools_count:0,app_passwords_url:"",current_user_login:"",is_local_dev:!1}),w=r("no"),U=r(!1),C=r("claude-code"),Z=r({}),N=r(!1),j=r(!1),k=r(""),A=r(""),S=r(!1),z=r(!1),h=g(()=>w.value==="yes"),P=g(()=>!!s.value.adapter_available),Y=g(()=>P.value?h.value?a("Active"):a("Inactive"):a("Setup required")),G=g(()=>P.value&&h.value?"active":"inactive"),B=g(()=>Z.value[C.value]||null),L=g(()=>{const l=B.value;if(!l||!l.snippet)return"";let t=l.snippet;const v=k.value.trim(),V=A.value.trim();if(v&&V){let f="";try{f=btoa(`${v}:${V}`)}catch{f=""}f&&(t=t.split("<base64(your-username:application-password)>").join(f)),t=t.split("<your-username>").join(v),t=t.split("<your-application-password>").join(V)}return t}),J=()=>(R.value=!0,D.get("settings/mcp").then(l=>{s.value={...s.value,...l},w.value=l.mcp_enabled?"yes":"no",q(!!l.mcp_enabled),l.current_user_login&&!k.value&&(k.value=l.current_user_login),z.value||(S.value=!!l.is_local_dev,z.value=!0)}).catch(l=>y.error(l)).finally(()=>{R.value=!1})),Q=l=>{T.value=!0,D.post("settings/mcp/toggle",{mcp_enabled:l}).then(t=>{y.success(t.message),s.value.mcp_enabled=!!t.mcp_enabled,q(!!t.mcp_enabled),h.value&&F.value&&I()}).catch(t=>{w.value=l==="yes"?"no":"yes",y.error(t)}).finally(()=>{T.value=!1})},I=()=>(j.value=!0,D.get("settings/mcp/config-snippets",{local_dev:S.value?"yes":"no"}).then(l=>(Z.value=l.snippets||{},N.value=!0,l)).catch(l=>y.error(l)).finally(()=>{j.value=!1})),X=l=>{C.value=l},ee=()=>{I()},te=()=>{L.value&&$.copy(L.value,{successMessage:a("Connection snippet copied to your clipboard")})},le=()=>{F.value=!0,h.value&&!N.value&&I()},ae=()=>{U.value=!0,D.post("settings/mcp/install-adapter",{}).then(l=>{y.success(l.message),setTimeout(()=>{window.location.reload()},800)}).catch(l=>{y.error(l),U.value=!1})},oe=()=>{s.value.endpoint_url&&$.copy(s.value.endpoint_url,{successMessage:a("Endpoint URL copied to your clipboard")})};return de(()=>{J().then(()=>{E.value=!0})}),(l,t)=>{const v=b("el-button"),V=b("el-switch"),f=b("el-input"),O=b("el-tab-pane"),ne=b("el-tabs"),se=b("el-checkbox"),ie=b("el-drawer"),re=pe("loading");return E.value?(c(),m("div",he,[e("div",be,[e("div",ge,[e("div",ye,[e("h4",we,o(M.field.title),1),d(_e,{size:"small",type:G.value,"hide-icon":!0},{default:p(()=>[_(o(Y.value),1)]),_:1},8,["type"])])]),M.field.description?(c(),m("div",Ce,[e("p",null,o(M.field.description),1)])):u("",!0)]),e("div",ke,[!P.value||h.value?(c(),x(v,{key:0,size:"small",onClick:le},{default:p(()=>[_(o(n(a)("Configure")),1)]),_:1})):u("",!0),P.value?(c(),x(V,{key:1,"active-value":"yes","inactive-value":"no",modelValue:w.value,"onUpdate:modelValue":t[0]||(t[0]=i=>w.value=i),loading:T.value,onChange:Q},null,8,["modelValue","loading"])):u("",!0)]),d(ie,{modelValue:F.value,"onUpdate:modelValue":t[6]||(t[6]=i=>F.value=i),title:n(a)("MCP Connection"),"aria-label":n(a)("MCP Connection"),size:"640px","append-to":"#fct_admin_app_wrapper","close-on-click-modal":!0,class:"fct-mcp-settings-drawer"},{default:p(()=>[e("div",Ve,[s.value.adapter_available?u("",!0):(c(),m("div",xe,[t[7]||(t[7]=e("div",{class:"fct-mcp-content-box-logo"},[e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 32 32",fill:"none"},[e("g",{"clip-path":"url(#clip0_23040_79251)"},[e("path",{d:"M28.8 0H3.2C1.43269 0 0 1.43269 0 3.2V28.8C0 30.5673 1.43269 32 3.2 32H28.8C30.5673 32 32 30.5673 32 28.8V3.2C32 1.43269 30.5673 0 28.8 0Z",fill:"#008CFF"}),e("path",{d:"M7.5 12.8637C7.5 9.3491 10.3491 6.5 13.8637 6.5H15.4545V19.2272C15.4545 22.7418 12.6055 25.5909 9.0909 25.5909H7.5V12.8637Z",fill:"white"}),e("path",{d:"M17.0454 17.6371C17.0454 14.1225 19.8945 11.2734 23.4091 11.2734H25V19.228C25 22.7425 22.1509 25.5916 18.6363 25.5916H17.0454V17.6371Z",fill:"white"})]),e("defs",null,[e("clipPath",{id:"clip0_23040_79251"},[e("rect",{width:"32",height:"32",fill:"white"})])])])],-1)),e("h4",Me,o(n(a)("FluentHub is required")),1),e("p",He,o(n(a)("FluentCart speaks to AI agents through the MCP adapter bundled with FluentHub (WordPress 6.9+). The endpoint will not respond until it is installed and active.")),1),e("div",Fe,[s.value.can_auto_install?(c(),x(v,{key:0,loading:U.value,onClick:ae},{default:p(()=>[_(o(s.value.toolkit_installed?n(a)("Activate FluentHub"):n(a)("Install FluentHub")),1)]),_:1},8,["loading"])):(c(),x(v,{key:1,tag:"a",href:s.value.toolkit_download_url,target:"_blank",rel:"noopener noreferrer"},{default:p(()=>[_(o(n(a)("Download FluentHub")),1)]),_:1},8,["href"]))])])),s.value.can_auto_install?u("",!0):(c(),x(fe,{key:1,type:"info",icon:"InformationFill",content:n(a)("Tip: FluentCart Pro can install it for you in one click.")},null,8,["content"])),s.value.adapter_available&&!h.value?(c(),m("div",Se,[t[8]||(t[8]=e("div",{class:"fct-mcp-content-box-logo"},[e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 32 32",fill:"none"},[e("g",{"clip-path":"url(#clip0_23040_79251)"},[e("path",{d:"M28.8 0H3.2C1.43269 0 0 1.43269 0 3.2V28.8C0 30.5673 1.43269 32 3.2 32H28.8C30.5673 32 32 30.5673 32 28.8V3.2C32 1.43269 30.5673 0 28.8 0Z",fill:"#008CFF"}),e("path",{d:"M7.5 12.8637C7.5 9.3491 10.3491 6.5 13.8637 6.5H15.4545V19.2272C15.4545 22.7418 12.6055 25.5909 9.0909 25.5909H7.5V12.8637Z",fill:"white"}),e("path",{d:"M17.0454 17.6371C17.0454 14.1225 19.8945 11.2734 23.4091 11.2734H25V19.228C25 22.7425 22.1509 25.5916 18.6363 25.5916H17.0454V17.6371Z",fill:"white"})]),e("defs",null,[e("clipPath",{id:"clip0_23040_79251"},[e("rect",{width:"32",height:"32",fill:"white"})])])])],-1)),e("h4",Pe,o(n(a)("FluentHub is active")),1),e("p",Be,o(n(a)("Turn MCP on from the card to generate connection snippets for your AI clients.")),1)])):u("",!0),s.value.adapter_available&&h.value?(c(),m(W,{key:3},[e("div",Le,[e("span",De,o(s.value.tools_count),1),e("span",Te,o(n(a)("AI tools available to connected agents")),1)]),e("div",Ue,[e("label",null,o(n(a)("Endpoint URL")),1),d(f,{modelValue:s.value.endpoint_url,"onUpdate:modelValue":t[1]||(t[1]=i=>s.value.endpoint_url=i),readonly:""},{append:p(()=>[d(v,{onClick:oe},{default:p(()=>[_(o(n(a)("Copy")),1)]),_:1})]),_:1},8,["modelValue"])]),e("div",je,[e("label",null,o(n(a)("Connect a client")),1),e("p",Ae,[_(o(n(a)("Create an application password for your WordPress user, then fill it in below. Your password stays in the browser — it is only written into the snippet you copy."))+" ",1),e("a",{href:s.value.app_passwords_url,target:"_blank",rel:"noopener noreferrer"},o(n(a)("Create an application password")),9,Ie)]),e("div",qe,[d(f,{modelValue:k.value,"onUpdate:modelValue":t[2]||(t[2]=i=>k.value=i),placeholder:n(a)("WordPress username")},null,8,["modelValue","placeholder"]),d(f,{modelValue:A.value,"onUpdate:modelValue":t[3]||(t[3]=i=>A.value=i),type:"password","show-password":"",placeholder:n(a)("Application password")},null,8,["modelValue","placeholder"])]),d(ne,{modelValue:C.value,"onUpdate:modelValue":t[4]||(t[4]=i=>C.value=i),onTabChange:X},{default:p(()=>[(c(),m(W,null,ve(K,i=>d(O,{key:i.key,label:i.label,name:i.key},null,8,["label","name"])),64))]),_:1},8,["modelValue"]),C.value==="claude-desktop"?(c(),m("div",Ee,[d(se,{modelValue:S.value,"onUpdate:modelValue":t[5]||(t[5]=i=>S.value=i),onChange:ee},{default:p(()=>[_(o(n(a)("Local/self-signed site (disable TLS verification)")),1)]),_:1},8,["modelValue"])])):u("",!0),B.value&&B.value.instructions?(c(),m("p",Re,o(B.value.instructions),1)):u("",!0),e("div",Ze,[me((c(),m("pre",Ne,[_(o(L.value),1)])),[[re,j.value]]),e("div",ze,[d(v,{type:"primary",disabled:!L.value,onClick:te},{default:p(()=>[_(o(n(a)("Copy snippet")),1)]),_:1},8,["disabled"])])])])],64)):u("",!0)])]),_:1},8,["modelValue","title","aria-label"])])):u("",!0)}}};export{Ct as default};
2