facturapi
Version:
Librería oficial de Facturapi. Crea CFDIs timbrados y enviados al SAT, XML y PDF
3 lines (2 loc) • 25.3 kB
JavaScript
;var _e=Object.create;var X=Object.defineProperty;var Oe=Object.getOwnPropertyDescriptor;var Ae=Object.getOwnPropertyNames;var Ie=Object.getPrototypeOf,Se=Object.prototype.hasOwnProperty;var ye=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let E of Ae(t))!Se.call(e,E)&&E!==n&&X(e,E,{get:()=>t[E],enumerable:!(o=Oe(t,E))||o.enumerable});return e};var be=(e,t,n)=>(n=e!=null?_e(Ie(e)):{},ye(t||!e||!e.__esModule?X(n,"default",{value:e,enumerable:!0}):n,e));Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});class Ne{constructor(t){this.client=t}create(t,n=null){return this.client.post("/customers",{body:t,params:n})}list(t){return t||(t={}),this.client.get("/customers",{params:t})}retrieve(t){return t?this.client.get("/customers/"+t):Promise.reject(new Error("id is required"))}update(t,n,o=null){return this.client.put("/customers/"+t,{body:n,params:o})}del(t){return this.client.delete("/customers/"+t)}validateTaxInfo(t){return this.client.get("/customers/"+t+"/tax-info-validation")}sendEditLinkByEmail(t,n){return this.client.post("/customers/"+t+"/email-edit-link",{body:n})}}class Re{constructor(t){this.client=t}create(t){return this.client.post("/products",{body:t})}list(t){return this.client.get("/products",{params:t})}retrieve(t){return t?this.client.get("/products/"+t):Promise.reject(new Error("id is required"))}update(t,n){return this.client.put("/products/"+t,{body:n})}del(t){return this.client.delete("/products/"+t)}}class De{constructor(t){this.client=t}create(t,n){return this.client.post("/invoices",{body:t,params:n})}list(t){return t||(t={}),this.client.get("/invoices",{params:t})}retrieve(t){return t?this.client.get("/invoices/"+t):Promise.reject(new Error("id is required"))}cancel(t,n){return this.client.delete("/invoices/"+t,{params:n})}sendByEmail(t,n){return this.client.post("/invoices/"+t+"/email",{body:n})}async downloadPdf(t){return this.client.get("/invoices/"+t+"/pdf")}async downloadXml(t){return this.client.get("/invoices/"+t+"/xml")}downloadZip(t){return this.client.get("/invoices/"+t+"/zip")}downloadCancellationReceiptXml(t){return this.client.get("/invoices/"+t+"/cancellation_receipt/xml")}downloadCancellationReceiptPdf(t){return this.client.get("/invoices/"+t+"/cancellation_receipt/pdf")}updateDraft(t,n){return this.client.put("/invoices/"+t,{body:n})}stampDraft(t,n){return this.client.post("/invoices/"+t+"/stamp",{params:n})}updateStatus(t){return this.client.put("/invoices/"+t+"/status")}copyToDraft(t){return this.client.post("/invoices/"+t+"/copy")}}const Te="https://www.facturapi.io/v2",Ce="https://www.facturapi.io/v1",Y="v2";var J;const I=typeof process<"u"&&!!((J=process==null?void 0:process.versions)!=null&&J.node),ge=typeof navigator<"u"&&(navigator==null?void 0:navigator.product)==="ReactNative";var K=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function we(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var P={exports:{}};(function(e,t){var n=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof K<"u"&&K,o=function(){function c(){this.fetch=!1,this.DOMException=n.DOMException}return c.prototype=n,new c}();(function(c){(function(l){var h=typeof c<"u"&&c||typeof self<"u"&&self||typeof h<"u"&&h,p={searchParams:"URLSearchParams"in h,iterable:"Symbol"in h&&"iterator"in Symbol,blob:"FileReader"in h&&"Blob"in h&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in h,arrayBuffer:"ArrayBuffer"in h};function y(r){return r&&DataView.prototype.isPrototypeOf(r)}if(p.arrayBuffer)var C=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],g=ArrayBuffer.isView||function(r){return r&&C.indexOf(Object.prototype.toString.call(r))>-1};function S(r){if(typeof r!="string"&&(r=String(r)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(r)||r==="")throw new TypeError('Invalid character in header field name: "'+r+'"');return r.toLowerCase()}function b(r){return typeof r!="string"&&(r=String(r)),r}function N(r){var i={next:function(){var s=r.shift();return{done:s===void 0,value:s}}};return p.iterable&&(i[Symbol.iterator]=function(){return i}),i}function f(r){this.map={},r instanceof f?r.forEach(function(i,s){this.append(s,i)},this):Array.isArray(r)?r.forEach(function(i){this.append(i[0],i[1])},this):r&&Object.getOwnPropertyNames(r).forEach(function(i){this.append(i,r[i])},this)}f.prototype.append=function(r,i){r=S(r),i=b(i);var s=this.map[r];this.map[r]=s?s+", "+i:i},f.prototype.delete=function(r){delete this.map[S(r)]},f.prototype.get=function(r){return r=S(r),this.has(r)?this.map[r]:null},f.prototype.has=function(r){return this.map.hasOwnProperty(S(r))},f.prototype.set=function(r,i){this.map[S(r)]=b(i)},f.prototype.forEach=function(r,i){for(var s in this.map)this.map.hasOwnProperty(s)&&r.call(i,this.map[s],s,this)},f.prototype.keys=function(){var r=[];return this.forEach(function(i,s){r.push(s)}),N(r)},f.prototype.values=function(){var r=[];return this.forEach(function(i){r.push(i)}),N(r)},f.prototype.entries=function(){var r=[];return this.forEach(function(i,s){r.push([s,i])}),N(r)},p.iterable&&(f.prototype[Symbol.iterator]=f.prototype.entries);function w(r){if(r.bodyUsed)return Promise.reject(new TypeError("Already read"));r.bodyUsed=!0}function q(r){return new Promise(function(i,s){r.onload=function(){i(r.result)},r.onerror=function(){s(r.error)}})}function ae(r){var i=new FileReader,s=q(i);return i.readAsArrayBuffer(r),s}function le(r){var i=new FileReader,s=q(i);return i.readAsText(r),s}function ce(r){for(var i=new Uint8Array(r),s=new Array(i.length),u=0;u<i.length;u++)s[u]=String.fromCharCode(i[u]);return s.join("")}function H(r){if(r.slice)return r.slice(0);var i=new Uint8Array(r.byteLength);return i.set(new Uint8Array(r)),i.buffer}function x(){return this.bodyUsed=!1,this._initBody=function(r){this.bodyUsed=this.bodyUsed,this._bodyInit=r,r?typeof r=="string"?this._bodyText=r:p.blob&&Blob.prototype.isPrototypeOf(r)?this._bodyBlob=r:p.formData&&FormData.prototype.isPrototypeOf(r)?this._bodyFormData=r:p.searchParams&&URLSearchParams.prototype.isPrototypeOf(r)?this._bodyText=r.toString():p.arrayBuffer&&p.blob&&y(r)?(this._bodyArrayBuffer=H(r.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):p.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(r)||g(r))?this._bodyArrayBuffer=H(r):this._bodyText=r=Object.prototype.toString.call(r):this._bodyText="",this.headers.get("content-type")||(typeof r=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):p.searchParams&&URLSearchParams.prototype.isPrototypeOf(r)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},p.blob&&(this.blob=function(){var r=w(this);if(r)return r;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){if(this._bodyArrayBuffer){var r=w(this);return r||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}else return this.blob().then(ae)}),this.text=function(){var r=w(this);if(r)return r;if(this._bodyBlob)return le(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(ce(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},p.formData&&(this.formData=function(){return this.text().then(fe)}),this.json=function(){return this.text().then(JSON.parse)},this}var ue=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function de(r){var i=r.toUpperCase();return ue.indexOf(i)>-1?i:r}function A(r,i){if(!(this instanceof A))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');i=i||{};var s=i.body;if(r instanceof A){if(r.bodyUsed)throw new TypeError("Already read");this.url=r.url,this.credentials=r.credentials,i.headers||(this.headers=new f(r.headers)),this.method=r.method,this.mode=r.mode,this.signal=r.signal,!s&&r._bodyInit!=null&&(s=r._bodyInit,r.bodyUsed=!0)}else this.url=String(r);if(this.credentials=i.credentials||this.credentials||"same-origin",(i.headers||!this.headers)&&(this.headers=new f(i.headers)),this.method=de(i.method||this.method||"GET"),this.mode=i.mode||this.mode||null,this.signal=i.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&s)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(s),(this.method==="GET"||this.method==="HEAD")&&(i.cache==="no-store"||i.cache==="no-cache")){var u=/([?&])_=[^&]*/;if(u.test(this.url))this.url=this.url.replace(u,"$1_="+new Date().getTime());else{var d=/\?/;this.url+=(d.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}A.prototype.clone=function(){return new A(this,{body:this._bodyInit})};function fe(r){var i=new FormData;return r.trim().split("&").forEach(function(s){if(s){var u=s.split("="),d=u.shift().replace(/\+/g," "),a=u.join("=").replace(/\+/g," ");i.append(decodeURIComponent(d),decodeURIComponent(a))}}),i}function he(r){var i=new f,s=r.replace(/\r?\n[\t ]+/g," ");return s.split("\r").map(function(u){return u.indexOf(`
`)===0?u.substr(1,u.length):u}).forEach(function(u){var d=u.split(":"),a=d.shift().trim();if(a){var R=d.join(":").trim();i.append(a,R)}}),i}x.call(A.prototype);function O(r,i){if(!(this instanceof O))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');i||(i={}),this.type="default",this.status=i.status===void 0?200:i.status,this.ok=this.status>=200&&this.status<300,this.statusText=i.statusText===void 0?"":""+i.statusText,this.headers=new f(i.headers),this.url=i.url||"",this._initBody(r)}x.call(O.prototype),O.prototype.clone=function(){return new O(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new f(this.headers),url:this.url})},O.error=function(){var r=new O(null,{status:0,statusText:""});return r.type="error",r};var Ee=[301,302,303,307,308];O.redirect=function(r,i){if(Ee.indexOf(i)===-1)throw new RangeError("Invalid status code");return new O(null,{status:i,headers:{location:r}})},l.DOMException=h.DOMException;try{new l.DOMException}catch{l.DOMException=function(i,s){this.message=i,this.name=s;var u=Error(i);this.stack=u.stack},l.DOMException.prototype=Object.create(Error.prototype),l.DOMException.prototype.constructor=l.DOMException}function v(r,i){return new Promise(function(s,u){var d=new A(r,i);if(d.signal&&d.signal.aborted)return u(new l.DOMException("Aborted","AbortError"));var a=new XMLHttpRequest;function R(){a.abort()}a.onload=function(){var _={status:a.status,statusText:a.statusText,headers:he(a.getAllResponseHeaders()||"")};_.url="responseURL"in a?a.responseURL:_.headers.get("X-Request-URL");var D="response"in a?a.response:a.responseText;setTimeout(function(){s(new O(D,_))},0)},a.onerror=function(){setTimeout(function(){u(new TypeError("Network request failed"))},0)},a.ontimeout=function(){setTimeout(function(){u(new TypeError("Network request failed"))},0)},a.onabort=function(){setTimeout(function(){u(new l.DOMException("Aborted","AbortError"))},0)};function pe(_){try{return _===""&&h.location.href?h.location.href:_}catch{return _}}a.open(d.method,pe(d.url),!0),d.credentials==="include"?a.withCredentials=!0:d.credentials==="omit"&&(a.withCredentials=!1),"responseType"in a&&(p.blob?a.responseType="blob":p.arrayBuffer&&d.headers.get("Content-Type")&&d.headers.get("Content-Type").indexOf("application/octet-stream")!==-1&&(a.responseType="arraybuffer")),i&&typeof i.headers=="object"&&!(i.headers instanceof f)?Object.getOwnPropertyNames(i.headers).forEach(function(_){a.setRequestHeader(_,b(i.headers[_]))}):d.headers.forEach(function(_,D){a.setRequestHeader(D,_)}),d.signal&&(d.signal.addEventListener("abort",R),a.onreadystatechange=function(){a.readyState===4&&d.signal.removeEventListener("abort",R)}),a.send(typeof d._bodyInit>"u"?null:d._bodyInit)})}return v.polyfill=!0,h.fetch||(h.fetch=v,h.Headers=f,h.Request=A,h.Response=O),l.Headers=f,l.Request=A,l.Response=O,l.fetch=v,l})({})})(o),o.fetch.ponyfill=!0,delete o.fetch.polyfill;var E=n.fetch?n:o;t=E.fetch,t.default=E.fetch,t.fetch=E.fetch,t.Headers=E.Headers,t.Request=E.Request,t.Response=E.Response,e.exports=t})(P,P.exports);var ve=P.exports;const Pe=we(ve);let T,m;I?(T=e=>Buffer.from(e).toString("base64"),m=require("form-data")):ge?T=e=>globalThis.Buffer.from(e).toString("base64"):T=globalThis.btoa;const me=async e=>{var n;if(!e.ok){const o=await e.json();throw new Error(o.message||e.statusText)}const t=e.headers.get("content-type");if(t){if(t.includes("image/")||t.includes("application/pdf")||t.includes("application/xml")||t.includes("application/zip"))if(I){const o=(n=e.body)==null?void 0:n.getReader();if(!o)return e.body;try{const{Readable:E}=await import("stream");return new E({read(){o.read().then(({done:c,value:l})=>{c?this.push(null):this.push(Buffer.from(l))})}})}catch{throw new Error('Node.js streams are not available in this environment. Please install the "stream" package.')}}else return e.blob();else if(t.includes("application/json"))return e.json()}return e.text()};function Le(e){return T(e)}const Be=(e,t=Y)=>{const n=t==="v1"?Ce:Te,o={Authorization:`Basic ${Le(e+":")}`,"Content-Type":"application/json"};return{async request(c,l){const{params:h,body:p,formData:y,...C}=l||{},g=h?"?"+new URLSearchParams(h).toString():"",S=y&&I?{...o,...y.getHeaders()}:o,b={...C,headers:S,body:y||(p?JSON.stringify(p):void 0)},N=await Pe(n+c+g,b);return me(N)},get(c,l){return this.request(c,{method:"GET",...l})},post(c,l){return this.request(c,{method:"POST",...l})},put(c,l){return this.request(c,{method:"PUT",...l})},delete(c,l){return this.request(c,{method:"DELETE",...l})}}};class Me{constructor(t){this.client=t}create(t){return this.client.post("/organizations",{body:t})}list(t){return t||(t={}),this.client.get("/organizations",{params:t})}retrieve(t){return t?this.client.get("/organizations/"+t):Promise.reject(new Error("id is required"))}updateLegal(t,n){return t?this.client.put("/organizations/"+t+"/legal",{body:n}):Promise.reject(new Error("id is required"))}updateCustomization(t,n){return this.client.put("/organizations/"+t+"/customization",{body:n})}updateReceiptSettings(t,n){return this.client.put("/organizations/"+t+"/receipts",{body:n})}updateDomain(t,n){return this.client.put("/organizations/"+t+"/domain",{body:n})}checkDomainIsAvailable(t){return this.client.put("/organizations/domain-check",{body:t})}uploadLogo(t,n){const o=new(I?m:FormData);return I?o.append("file",n,{filename:"file",contentType:"application/octet-stream"}):o.append("file",n,"file"),this.client.put("/organizations/"+t+"/logo",{formData:o})}uploadCertificate(t,n,o,E){const c=new(I?m:FormData);return I?c.append("cer",n,{filename:"cer.cer",contentType:"application/octet-stream"}):c.append("cer",n,"cer.cer"),I?c.append("key",o,{filename:"key.key",contentType:"application/octet-stream"}):c.append("key",o,"key.key"),c.append("password",E),this.client.put("/organizations/"+t+"/certificate",{formData:c})}deleteCertificate(t){return this.client.delete("/organizations/"+t+"/certificate")}del(t){return t?this.client.delete("/organizations/"+t):Promise.reject(new Error("id is required"))}getTestApiKey(t){return this.client.get("/organizations/"+t+"/apikeys/test")}renewTestApiKey(t){return this.client.put("/organizations/"+t+"/apikeys/test")}async listLiveApiKeys(t){return this.client.get("/organizations/"+t+"/apikeys/live")}renewLiveApiKey(t){return this.client.put("/organizations/"+t+"/apikeys/live")}async deleteLiveApiKey(t,n){return this.client.delete("/organizations/"+t+"/apikeys/live/"+n)}listSeriesGroup(t){return this.client.get("/organizations/"+t+"/series-group")}createSeriesGroup(t,n){return this.client.post("/organizations/"+t+"/series-group",{body:n})}updateSeriesGroup(t,n,o){return this.client.put(`/organizations/${t}/series-group/${n}`,{body:o})}deleteSeriesGroup(t,n){return this.client.delete(`/organizations/${t}/series-group/${n}`)}me(){return this.client.get("/organizations/me")}}class Ue{constructor(t){this.client=t}searchProducts(t){return this.client.get("/catalogs/products",{params:t})}searchUnits(t){return this.client.get("/catalogs/units",{params:t})}}class Ge{constructor(t){this.client=t}create(t){return this.client.post("/receipts",{body:t})}list(t){return t||(t={}),this.client.get("/receipts",{params:t})}retrieve(t){return t?this.client.get("/receipts/"+t):Promise.reject(new Error("id is required"))}invoice(t,n){return this.client.post("/receipts/"+t+"/invoice",{body:n})}createGlobalInvoice(t){return this.client.post("/receipts/global-invoice",{body:t})}cancel(t){return this.client.delete("/receipts/"+t)}sendByEmail(t,n){return this.client.post("/receipts/"+t+"/email",{body:n})}downloadPdf(t){return this.client.get("/receipts/"+t+"/pdf")}}class Ve{constructor(t){this.client=t}create(t){return this.client.post("/retentions",{body:t})}list(t){return t||(t={}),this.client.get("/retentions",{params:t})}retrieve(t){return t?this.client.get("/retentions/"+t):Promise.reject(new Error("id is required"))}cancel(t){return this.client.delete("/retentions/"+t)}sendByEmail(t,n){return this.client.post("/retentions/"+t+"/email",{body:n})}downloadPdf(t){return this.client.get("/retentions/"+t+"/pdf")}downloadXml(t){return this.client.get("/retentions/"+t+"/xml")}downloadZip(t){return this.client.get("/retentions/"+t+"/zip")}}class je{constructor(t){this.client=t}create(t){return this.client.post("/webhooks",{body:t})}list(t){return t||(t={}),this.client.get("/webhooks",{params:t})}retrieve(t){return t?this.client.get("/webhooks/"+t):Promise.reject(new Error("id is required"))}update(t,n){return this.client.put("/webhooks/"+t,{body:n})}del(t){return this.client.delete("/webhooks/"+t)}async validateSignature(t){return this.client.post("/webhooks/validate-signature",{body:t})}}class Fe{constructor(t){this.client=t}validateTaxId(t){return this.client.get("/tools/tax_id_validation",{params:{tax_id:t}})}}var L=(e=>(e.EFECTIVO="01",e.CHEQUE_NOMINATIVO="02",e.TRANSFERENCIA_ELECTRONICA_DE_FONDOS="03",e.TARJETA_DE_CREDITO="04",e.MONEDERO_ELECTRONICO="05",e.DINERO_ELECTRONICO="06",e.VALES_DE_DESPENSA="08",e.DACION_EN_PAGO="12",e.PAGO_POR_SUBROGACION="13",e.PAGO_POR_CONSIGNACION="14",e.CONDONACION="15",e.COMPENSACION="17",e.NOVACION="23",e.CONFUSION="24",e.REMISIÓN_DE_DEUDA="25",e.PRESCRIPCION_O_CADUCIDAD="26",e.A_SATISFACCION_DEL_ACREEDOR="27",e.TARJETA_DE_DEBITO="28",e.TARJETA_DE_SERVICIOS="29",e.APLICACION_DE_ANTICIPOS="30",e.INTERMEDIARIO_DE_PAGOS="31",e.POR_DEFINIR="99",e))(L||{});const ke=[{value:"01",label:"Efectivo"},{value:"02",label:"Cheque nominativo"},{value:"03",label:"Transferencia electrónica de fondos"},{value:"04",label:"Tarjeta de crédito"},{value:"05",label:"Monedero electrónico"},{value:"06",label:"Dinero electrónico"},{value:"08",label:"Vales de despensa"},{value:"12",label:"Dación en pago"},{value:"13",label:"Pago por subrogación"},{value:"14",label:"Pago por consignación"},{value:"15",label:"Condonación"},{value:"17",label:"Compensación"},{value:"23",label:"Novación"},{value:"24",label:"Confusión"},{value:"25",label:"Remisión de deuda"},{value:"26",label:"Prescripción o caducidad"},{value:"27",label:"A satisfacción del acreedor"},{value:"28",label:"Tarjeta de débito"},{value:"29",label:"Tarjeta de servicios"},{value:"30",label:"Aplicación de anticipos"},{value:"31",label:"Intermediario de pagos"},{value:"99",label:"Por definir"}];var B=(e=>(e.IVA="IVA",e.IEPS="IEPS",e.ISR="ISR",e))(B||{}),M=(e=>(e.RATE="Tasa",e.QUOTA="Cuota",e))(M||{}),U=(e=>(e.SUM_BEFORE_TAXES="sum_before_taxes",e.UNIT="unit",e.BREAK_DOWN="break_down",e.SUBTRACT_BEFORE_BREAKDOWN="subtract_before_break_down",e))(U||{}),G=(e=>(e.PAGO_EN_UNA_EXHIBICION="PUE",e.PAGO_EN_PARCIALIDADES_DIFERIDO="PPD",e))(G||{}),V=(e=>(e.ADQUISICION_MERCANCIAS="G01",e.DEVOLUCIONES_DESCUENTOS_BONIFICACIONES="G02",e.GASTOS_EN_GENERAL="G03",e.CONSTRUCCIONES="I01",e.MOBILIARIO_Y_EQUIPO_DE_OFICINA="I02",e.EQUIPO_DE_TRANSPORTE="I03",e.EQUIPO_DE_COMPUTO="I04",e.DADOS_TROQUELES_HERRAMENTAL="I05",e.COMUNICACIONES_TELEFONICAS="I06",e.COMUNICACIONES_SATELITALES="I07",e.OTRA_MAQUINARIA="I08",e.HONORARIOS_MEDICOS="D01",e.GASTOS_MEDICOS_POR_INCAPACIDAD="D02",e.GASTOS_FUNERALES="D03",e.DONATIVOS="D04",e.INTERESES_POR_CREDITOS_HIPOTECARIOS="D05",e.APORTACIONES_VOLUNTARIAS_SAR="D06",e.PRIMA_SEGUROS_GASTOS_MEDICOS="D07",e.GASTOS_TRANSPORTACION_ESCOLAR="D08",e.CUENTAS_AHORRO_PENSIONES="D09",e.SERVICIOS_EDUCATIVOS="D10",e.SIN_EFECTOS_FISCALES="S01",e.PAGOS="CP01",e.NOMINA="CN01",e.POR_DEFINIR="P01",e))(V||{}),j=(e=>(e.INGRESO="I",e.EGRESO="E",e.TRASLADO="T",e.NOMINA="N",e.PAGO="P",e))(j||{}),F=(e=>(e.NOTA_DE_CREDITO="01",e.NOTA_DE_DEBITO="02",e.DELOVUCION_DE_MERCANCIA="03",e.SUSTITUCION_DE_CFDI_PREVIOS="04",e.TRASLADOS_DE_MERCANCIA_FACTURADOS_PREVIAMENTE="05",e.FACTURA_POR_TRASLADOS_PREVIOS="06",e.APLICACION_DE_ANTICIPO="07",e))(F||{}),k=(e=>(e.GENERAL_LEY_DE_PERSONAS_MORALES="601",e.PERSONAS_MORALES_CON_FINES_NO_LUCRATIVOS="603",e.SUELDOS_Y_SALARIOS="605",e.ARRENDAMIENTO="606",e.REGIMEN_DE_ENAJENACION_O_ADQUISICION_DE_BIENES="607",e.DEMAS_INGRESOS="608",e.RESIDENTES_EN_EL_EXTRANJERO_SIN_ESTABLECIMIENTO_PERMANENTE_EN_MÉXICO="610",e.RESIDENTES_EN_EL_EXTRANJERO="610",e.INGRESOS_POR_DIVIDENDOS_SOCIOS_Y_ACCIONISTAS="611",e.PERSONAS_FISICAS_CON_ACTIVIDADES_EMPRESARIALES_Y_PROFESIONALES="612",e.INGRESOS_POR_INTERESES="614",e.REGIMEN_DE_LOS_INGRESOS_POR_OBTENCION_DE_PREMIOS="615",e.SIN_OBLIGACIONES_FISCALES="616",e.SOCIEDADES_COOPERATIVAS_DE_PRODUCCION="620",e.REGIMEN_DE_INCORPORACION_FISCAL="621",e.ACTIVIDADES_AGRICOLAS_GANADERAS_SILVICOLAS_Y_PESQUERAS="622",e.OPCIONAL_PARA_GRUPOS_DE_SOCIEDADES="623",e.COORDINADOS="624",e.ACTIVIDADES_EMPRESARIALES_CON_INGRESOS_A_TRAVÉS_DE_PLATAFORMAS_TECNOLÓGICAS="625",e.RÉGIMEN_SIMPLIFICADO_DE_CONFIANZA="626",e))(k||{}),z=(e=>(e.DRAFT="draft",e.PENDING="pending",e.VALID="valid",e.CANCELED="canceled",e.FAILED="failed",e))(z||{}),W=(e=>(e.DAY="day",e.WEEK="week",e.FORTNIGHT="fortnight",e.MONTH="month",e.TWO_MONTHS="two_months",e))(W||{}),$=(e=>(e.OPEN="open",e.CANCELED="canceled",e.INVOICED_TO_CUSTOMER="invoiced_to_customer",e.INVOICED_GLOBALLY="invoiced_globally",e))($||{}),Z=(e=>(e.ISSUING="issuing",e.RECEIVING="receiving",e))(Z||{}),ee=(e=>(e.NONE="none",e.ACCEPTED="accepted",e.PENDING="pending",e.REJECTED="rejected",e.EXPIRED="expired",e))(ee||{}),te=(e=>(e.DAY="day",e.WEEK="week",e.FORTNIGHT="fortnight",e.MONTH="month",e.TWO_MONTHS="two_months",e))(te||{}),re=(e=>(e.CUSTOM="custom",e.PAGO="pago",e.NOMINA="nomina",e))(re||{}),ie=(e=>(e.ERRORES_CON_RELACION="01",e.ERRORES_SIN_RELACION="02",e.NO_SE_CONCRETO="03",e.FACTURA_GLOBAL="04",e))(ie||{}),ne=(e=>(e.RECEIPT_SELF_INVOICE_COMPLETE="receipt.self_invoice_complete",e.INVOICE_CANCELLATION_STATUS_UPDATED="invoice.cancellation_status_updated",e.RECEIPT_STATUS_UPDATED="receipt.status_updated",e.GLOBAL_INVOICE="invoice.global_invoice_created",e.INVOICES_STATUS_UPDATED="invoice.status_updated",e.INVOICES_CREATED_FROM_DASHBOARD="invoice.created_from_dashboard",e.CUSTOMER_EDIT_LINK_COMPLETED="customer.edit_link_completed",e))(ne||{}),se=(e=>(e.RECEIPT="receipt",e.INVOICE="invoice",e.CUSTOMER="customer",e))(se||{}),oe=(e=>(e.ENABLED="enabled",e.DISABLED="disabled",e))(oe||{});const Q=["v1","v2"];class ze{static get TaxType(){return B}static get TaxFactor(){return M}static get IepsMode(){return U}static get PaymentForm(){return L}static get PaymentMethod(){return G}static get InvoiceType(){return j}static get InvoiceUse(){return V}static get InvoiceRelation(){return F}static get TaxSystem(){return k}static get InvoiceStatus(){return z}constructor(t,n={}){if(n.apiVersion){if(!Q.includes(n.apiVersion))throw new Error("Invalid API version. Valid values are: "+Q.join(", "));this.apiVersion=n.apiVersion}else this.apiVersion=Y;const o=Be(t,this.apiVersion);this.customers=new Ne(o),this.products=new Re(o),this.invoices=new De(o),this.organizations=new Me(o),this.catalogs=new Ue(o),this.receipts=new Ge(o),this.retentions=new Ve(o),this.tools=new Fe(o),this.webhooks=new je(o)}}exports.ApiEventDataType=se;exports.ApiEventType=ne;exports.CancellationMotive=ie;exports.CancellationStatus=ee;exports.GlobalInvoicePeriodicity=W;exports.IepsMode=U;exports.InvoiceComplementType=re;exports.InvoiceRelation=F;exports.InvoiceStatus=z;exports.InvoiceType=j;exports.InvoiceUse=V;exports.InvoicingPeriod=te;exports.IssuingType=Z;exports.PaymentForm=L;exports.PaymentFormList=ke;exports.PaymentMethod=G;exports.ReceiptStatus=$;exports.TaxFactor=M;exports.TaxSystem=k;exports.TaxType=B;exports.WebhookEndpointStatus=oe;exports.default=ze;