PageSourceSearch

https://www.logistap.com/assets/ZatcaConnectionSetup-CBri6HF_.js

js logistap.com collected 2026-10-02 01:35:50 UTC 10,410 bytes, 1 lines download raw bytes

1import{j as e}from"./index-CkAxGocv.js";import{r as i}from"./i18n-vendor-Co-krN6G.js";import{A as D,e as w,D as M,d as O,H as G,o as V,p as $,I as Z,N as q,O as K}from"./InvoiceShell-BlEwllHn.js";import{f as H}from"./companyProfile-CiP3BkXs.js";import{u as J,h as Q}from"./useCompanySubscription-CEPg_YdA.js";import{u as W,i as X,f as Y,c as ee}from"./financeShared-llUcF-Fg.js";import{z as te,h as ae,f as se,F as re,a as ie,b as ne}from"./invoiceAddressFormat-Cee_FF9K.js";import{L as f}from"./react-vendor-D5E1hOjb.js";import{C as le}from"./chevron-right-B7wd-Mqk.js";import{C as oe}from"./chevron-left-CMJUBmiW.js";import{L as de}from"./lock-keyhole-qgujvuJo.js";import{C as ce}from"./circle-check-Doi6ea3z.js";import{E}from"./external-link-DMmvR9ox.js";import"./supabase-vendor-Co_IX6oM.js";import"./permissionGuard-BRj1WUDY.js";import"./subscriptions-Tkjwci4N.js";import"./subscriptionData-Cd7olKM2.js";import"./companyFinance-Cy-kVkZF.js";import"./circle-alert-ENI3C5U8.js";import"./createLucideIcon-BPd9wT8k.js";import"./refresh-cw-BvuhVw-0.js";import"./loader-circle-BnjBO311.js";import"./x-vmD7m2IU.js";import"./sliders-horizontal-Bexp6hhj.js";const me="https://fatoora.zatca.gov.sa/",xe={en:"https://zatca.gov.sa/en/E-Invoicing/Introduction/Guidelines/Documents/Fatoora_Portal_User_Manual_English.pdf",ar:"https://zatca.gov.sa/ar/E-Invoicing/Introduction/Guidelines/Documents/Fatoora_Portal_User_Manual_Arabic.pdf"};function _e(){const{tr:t,isArabic:g,language:I}=W(),N=g?le:oe,{entitlements:P}=J(),h=Q(P,"feature.zatca_phase2"),[r,d]=i.useState(null),[a,z]=i.useState(null),[n,F]=i.useState(D),[v,b]=i.useState(!0),[R,j]=i.useState(!1),[k,c]=i.useState(""),[C,A]=i.useState(""),[u,S]=i.useState(""),y=i.useCallback(async()=>{if(!h){d(null),b(!1);return}b(!0);try{const[s,U,B]=await Promise.all([w(),H(),M()]);d(s),z(U),F(B)}catch(s){c(O(s))}finally{b(!1)}},[h]);i.useEffect(()=>{y()},[y]);const _=async()=>{if(!/^\d{6}$/.test(u)){c(t("Enter the 6-digit OTP from the Fatoora portal."));return}j(!0),c(""),A("");try{await q(),d(await K(u)),S(""),A(t("Connected to ZATCA Simulation. This is testing only, not production ZATCA."))}catch(s){c(O(s)),w().then(d).catch(()=>{})}finally{j(!1)}},o=te(r),m=o==="simulation"||o==="connected",T=G(a,n),x=(a==null?void 0:a.crNumber.trim())??"",p=!!x&&!V(x,a==null?void 0:a.unifiedNumber),l=ae({street:n.streetName,city:n.city})?se({buildingNumber:n.buildingNumber,street:n.streetName,district:n.district,city:n.city,postalCode:n.postalCode}):null,L=[{label:t("Seller legal name"),value:(a==null?void 0:a.englishName.trim())??"",valid:!!(a!=null&&a.englishName.trim())},{label:t("Seller VAT number"),value:(a==null?void 0:a.vatNumber.trim())??"",valid:$(a==null?void 0:a.vatNumber)},{label:t("City CR Number"),value:x,valid:!!x&&!p},{label:t("Seller address"),value:(l==null?void 0:l.text)??"",valid:!!l,dir:l==null?void 0:l.dir}];return h?e.jsxs(Z,{children:[e.jsxs(f,{to:"/finance/invoices",className:"mb-4 inline-flex h-9 items-center gap-1.5 rounded-md px-2 text-xs font-black text-slate-500 hover:bg-slate-100 dark:hover:bg-slate-900",children:[e.jsx(N,{size:16}),t("Back to Invoices")]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"rounded-lg border border-indigo-200 bg-indigo-50/60 p-4 dark:border-indigo-900 dark:bg-indigo-950/20",children:e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(re,{className:"mt-0.5 shrink-0 text-indigo-600",size:18}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-black text-slate-900 dark:text-white",children:t("ZATCA Phase 2 connection")}),e.jsx("p",{className:"mt-1 max-w-2xl text-xs font-semibold text-slate-600 dark:text-slate-300",children:t("Simulation (testing) mode. This is not production ZATCA verification, and no real invoice is reported to ZATCA from here.")}),e.jsx("p",{className:"mt-1 max-w-2xl text-xs font-semibold text-slate-500 dark:text-slate-400",children:t("Only needed if ZATCA has notified your company for Phase 2. Invoice Maker works without it.")})]})]}),v?null:e.jsx("span",{className:`rounded-full border px-2.5 py-1 text-[10px] font-black ${ie[o]}`,children:t(ne[o])})]})}),v?e.jsx("p",{className:"text-xs font-bold text-slate-500",children:t("Checking the ZATCA connection...")}):e.jsxs("div",{className:"space-y-4 rounded-lg border border-slate-200 bg-white p-4 dark:border-slate-800 dark:bg-slate-950",children:[m?e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(ce,{size:18,className:"mt-0.5 shrink-0 text-emerald-600"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-black text-slate-900 dark:text-white",children:t("Connected to ZATCA Simulation")}),r!=null&&r.onboardedAt?e.jsxs("p",{className:"mt-0.5 text-xs font-semibold text-slate-500",children:[t("Since")," ",X(r.onboardedAt,I)]}):null]})]}):o==="reverification_required"?e.jsx("p",{className:"rounded-lg border border-amber-200 bg-amber-50 p-3 text-xs font-bold text-amber-800 dark:border-amber-900 dark:bg-amber-950/30 dark:text-amber-200",children:t("The company's legal details changed after onboarding. Check the Seller details below, then connect again with a new Fatoora OTP. Invoices cannot be sent to ZATCA until then.")}):null,e.jsxs("div",{className:"rounded-lg border border-slate-200 p-3 dark:border-slate-800",children:[e.jsx("dl",{className:"grid gap-2 sm:grid-cols-2",children:L.map(s=>e.jsxs("div",{children:[e.jsx("dt",{className:"text-[11px] font-bold text-slate-400",children:s.label}),e.jsx("dd",{dir:s.dir,className:`text-xs font-bold ${s.valid?"text-slate-700 dark:text-slate-200":"text-amber-700 dark:text-amber-300"}`,children:s.value||t("Missing")})]},s.label))}),e.jsx("p",{className:`mt-2 text-[11px] font-semibold ${p?"text-amber-700 dark:text-amber-300":"text-slate-500"}`,children:t(p?"This City CR Number looks like the Unified Number. Enter the City CR Number, for example 1010123456. The Unified Number is only for LogisTap registration and verification; it is not used on invoices or sent to ZATCA.":T?"Legal name, City CR Number and VAT Number come from Company Profile. The Seller address comes from Invoice Maker; the Unified Number is not sent to ZATCA.":"Complete the Company Profile and the Seller address in Invoice Maker before connecting to ZATCA.")})]}),m?null:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("section",{className:"rounded-lg border border-indigo-200 bg-indigo-50/60 p-3 dark:border-indigo-900 dark:bg-indigo-950/20",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"text-xs font-black text-slate-800 dark:text-slate-100",children:t("Get a Simulation OTP")}),e.jsxs("ol",{className:"mt-2 list-decimal space-y-1 ps-5 text-[11px] font-semibold leading-5 text-slate-600 dar
1k:text-slate-300",children:[e.jsx("li",{children:t("Open the official FATOORA Portal and sign in with your ZATCA (ERAD) TIN or registered email and password.")}),e.jsx("li",{children:t("From the top-right menu, switch to FATOORA Portal Simulation, accept the terms, then continue.")}),e.jsx("li",{children:t("Choose Onboard New Solution Unit/Device and generate 1 OTP.")}),e.jsx("li",{children:t("Copy the 6-digit OTP and enter it below within 1 hour.")})]})]}),e.jsxs("a",{href:me,target:"_blank",rel:"noreferrer",className:"inline-flex h-9 shrink-0 items-center gap-1.5 rounded-lg bg-indigo-600 px-3 text-xs font-black text-white hover:bg-indigo-700",children:[e.jsx(E,{size:14,"aria-hidden":"true"}),t("Open FATOORA Portal")]})]}),e.jsxs("a",{href:xe[g?"ar":"en"],target:"_blank",rel:"noreferrer",className:"mt-2 inline-flex items-center gap-1 text-[11px] font-bold text-indigo-700 underline-offset-2 hover:underline dark:text-indigo-300",children:[t("View ZATCA's official FATOORA Portal guide"),e.jsx(E,{size:12,"aria-hidden":"true"})]})]}),e.jsxs("div",{className:"flex max-w-md gap-2",children:[e.jsx("input",{className:Y,inputMode:"numeric",maxLength:6,value:u,onChange:s=>S(s.target.value.replace(/\D/g,"")),placeholder:t("6-digit OTP"),"aria-label":t("6-digit OTP")}),e.jsx(ee,{pending:R,disabled:!T,type:"button",onClick:()=>void _(),children:t(o==="reverification_required"?"Reverify":"Connect")})]}),e.jsx("p",{className:"text-[11px] font-semibold text-slate-500",children:t("Only the company owner can connect. Keys and credentials stay encrypted on the backend and are never shown here.")})]}),m&&r?e.jsxs("details",{className:"text-xs",children:[e.jsx("summary",{className:"cursor-pointer font-bold text-slate-500",children:t("Technical details")}),e.jsx("dl",{className:"mt-2 grid gap-2 sm:grid-cols-3",children:[{label:t("EGS name"),value:r.commonName},{label:t("EGS location"),value:r.location},{label:t("Industry"),value:r.industry}].map(s=>e.jsxs("div",{children:[e.jsx("dt",{className:"text-[11px] font-bold text-slate-400",children:s.label}),e.jsx("dd",{className:"font-semibold text-slate-600 dark:text-slate-300",children:s.value||"-"})]},s.label))})]}):null]}),r!=null&&r.lastError&&!m?e.jsx("p",{className:"text-xs font-bold text-red-700",children:t(r.lastError)}):null,k?e.jsx("p",{className:"text-xs font-bold text-red-700",children:t(k)}):null,C?e.jsx("p",{className:"text-xs font-bold text-emerald-700",children:C}):null]})]}):e.jsxs(Z,{children:[e.jsxs(f,{to:"/finance/invoices",className:"mb-4 inline-flex h-9 items-center gap-1.5 rounded-md px-2 text-xs font-black text-slate-500 hover:bg-slate-100 dark:hover:bg-slate-900",children:[e.jsx(N,{size:16}),t("Back to Invoices")]}),e.jsxs("section",{className:"flex max-w-2xl items-start gap-3 rounded-xl border border-amber-200 bg-amber-50 p-4 dark:border-amber-900 dark:bg-amber-950/30",children:[e.jsx(de,{className:"mt-0.5 shrink-0 text-amber-700 dark:text-amber-300",size:20}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-black text-slate-900 dark:text-white",children:t("ZATCA Phase 2 is available on paid plans.")}),e.jsx("p",{className:"mt-1 text-xs font-semibold text-slate-600 dark:text-slate-300",children:t("Upgrade to Starter, Growth or Scale to connect your company to ZATCA Phase 2.")}),e.jsx(f,{to:"/subscription",className:"mt-3 inline-flex h-9 items-center rounded-lg bg-amber-600 px-3 text-xs font-black text-white hover:bg-amber-700",children:t("View Plans")})]})]})]})}export{_e 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.