PageSourceSearch

https://novo.gruposvip.com/assets/ZAPITestPage-Ceg_ia4L.js

js gruposvip.com collected 2026-09-26 08:44:02 UTC 2,994 bytes, 1 lines download raw bytes

1import{j as e}from"./query-Q_ThwKGI.js";import{r as n}from"./react-vendor-wefok28f.js";import{B as j}from"./button-DrepnwkX.js";import{C as I,b as v,c as A,d as C,a as P,e as T}from"./card-DYyqUxY6.js";import{I as l}from"./input-Cu6Tiemi.js";import{L as d}from"./label-Ch0F7L4t.js";import{u as Z}from"./index-C4Kq7kkR.js";import{s as k}from"./client-DjLwxtrO.js";import{A as y,a as N,b as w}from"./alert-CxLwTMWl.js";import{L as E}from"./icons-By8asZST.js";import"./supabase-COHOFxoQ.js";const F=()=>{const[a,h]=n.useState(""),[o,x]=n.useState(""),[i,f]=n.useState(""),[u,m]=n.useState(!1),[t,c]=n.useState(null),{toast:r}=Z(),g=async()=>{if(!a||!o||!i){r({title:"Missing Information",description:"Please fill all credential fields",variant:"destructive"});return}m(!0),c(null);try{const{data:s,error:p}=await k.functions.invoke("test-zapi-connection",{body:{instanceId:a,token:o,clientToken:i}});if(p)throw new Error(p.message);c(s),s!=null&&s.success?r({title:"Connection Successful",description:"Successfully connected to Z-API service"}):r({title:"Connection Failed",description:(s==null?void 0:s.message)||"Failed to connect to Z-API",variant:"destructive"})}catch(s){console.error("Error testing Z-API connection:",s),c({success:!1,error:s.message}),r({title:"Error",description:`Failed to test connection: ${s.message}`,variant:"destructive"})}finally{m(!1)}};return e.jsxs(I,{className:"w-full",children:[e.jsxs(v,{children:[e.jsx(A,{children:"Z-API Connection Test"}),e.jsx(C,{children:"Test your Z-API credentials to ensure proper integration"})]}),e.jsxs(P,{className:"space-y-4",children:[e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(d,{htmlFor:"instanceId",children:"Z-API Instance ID"}),e.jsx(l,{id:"instanceId",placeholder:"Enter your Z-API instance ID",value:a,onChange:s=>h(s.target.value)})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(d,{htmlFor:"token",children:"Z-API Token"}),e.jsx(l,{id:"token",type:"password",placeholder:"Enter your Z-API token",value:o,onChange:s=>x(s.target.value)})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(d,{htmlFor:"clientToken",children:"Z-API Client Token"}),e.jsx(l,{id:"clientToken",type:"password",placeholder:"Enter your Z-API client token",value:i,onChange:s=>f(s.target.value)})]})]}),t&&e.jsxs(y,{variant:t.success?"default":"destructive",className:"mt-4",children:[e.jsx(N,{children:t.success?"Success":"Error"}),e.jsx(w,{children:t.message||(t.success?"Connected successfully to Z-API":"Failed to connect to Z-API")})]})]}),e.jsx(T,{children:e.jsx(j,{onClick:g,disabled:u,className:"w-full",children:u?e.jsxs(e.Fragment,{children:[e.jsx(E,{className:"mr-2 h-4 w-4 animate-spin"}),"Testing..."]}):"Test Connection"})})]})},G=()=>e.jsxs("div",{className:"container py-8",children:[e.jsx("h1",{className:"text-3xl font-bold mb-6",children:"Z-API Integration Test"}),e.jsx("div",{className:"max-w-4xl mx-auto",children:e.jsx(F,{})})]});export{G 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.