@arisnetxsolutions/quantum-core-sdk 1.0.4 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Docs/Forms_Integration.md +50 -0
- package/README.md +41 -0
- package/dist/cdn.d.ts +2 -0
- package/dist/cdn.js +5 -0
- package/dist/index.d.ts +4 -1
- package/dist/index.js +8 -2
- package/dist/quantum-core-sdk.min.js +6 -0
- package/dist/types.d.ts +13 -0
- package/package.json +11 -4
- package/test/cdn-test.html +33 -0
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# Form Integration Guide (QuantumCore SDK)
|
|
2
|
+
|
|
3
|
+
The QuantumCore SDK now supports native form submissions. This allows you to capture user data from your frontend and process it within the QuantumCore CMS (Atom), including triggering email notifications or custom workflows.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
Ensure you are using version `1.2.0` or higher of the `@arisnetxsolutions/quantum-core-sdk`.
|
|
8
|
+
|
|
9
|
+
## Basic Usage
|
|
10
|
+
|
|
11
|
+
1. Initialize the SDK with your Project API Key:
|
|
12
|
+
|
|
13
|
+
```javascript
|
|
14
|
+
import { QuantumCore } from '@arisnetxsolutions/quantum-core-sdk';
|
|
15
|
+
|
|
16
|
+
const sdk = new QuantumCore({
|
|
17
|
+
apiKey: 'YOUR_PROJECT_API_KEY',
|
|
18
|
+
baseUrl: 'https://api.quantum.core.arisnetxsolutions.com/api/v1' // Optional
|
|
19
|
+
});
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
2. Submit form data:
|
|
23
|
+
|
|
24
|
+
```javascript
|
|
25
|
+
const handleSubmit = async (formData) => {
|
|
26
|
+
try {
|
|
27
|
+
const result = await sdk.forms.submit({
|
|
28
|
+
formId: 'contact-form', // Requerido
|
|
29
|
+
name: formData.name, // Requerido (o 'nombre')
|
|
30
|
+
email: formData.email, // Requerido (o 'correo')
|
|
31
|
+
message: formData.message,
|
|
32
|
+
telefono: formData.phone, // Campo personalizado
|
|
33
|
+
empresa: 'ArisNetX' // Otro campo personalizado
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
console.log('Form submitted:', result.submissionId);
|
|
37
|
+
} catch (error) {
|
|
38
|
+
console.error('Submission failed:', error);
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Requerimientos del Payload
|
|
44
|
+
|
|
45
|
+
Para que una entrega sea válida, el objeto debe contener al menos:
|
|
46
|
+
- `formId`: El identificador del formulario.
|
|
47
|
+
- `name` o `nombre`: El nombre del remitente.
|
|
48
|
+
- `email` o `correo`: La dirección de correo electrónico.
|
|
49
|
+
|
|
50
|
+
Cualquier otro campo adicional que envíes será capturado y estará disponible en el panel de administración y en las variables de los Workflows (ej: `{{telefono}}`).
|
package/README.md
CHANGED
|
@@ -26,8 +26,32 @@ Instala el paquete mediante npm:
|
|
|
26
26
|
npm install @arisnetxsolutions/quantum-core-sdk
|
|
27
27
|
```
|
|
28
28
|
|
|
29
|
+
|
|
29
30
|
---
|
|
30
31
|
|
|
32
|
+
## 🌐 CDN (Vanilla JS)
|
|
33
|
+
|
|
34
|
+
Si prefieres usar el SDK directamente en el navegador sin herramientas de construcción, puedes usar **jsDelivr**:
|
|
35
|
+
|
|
36
|
+
```html
|
|
37
|
+
<!-- Carga la última versión 1.1.x -->
|
|
38
|
+
<script src="https://cdn.jsdelivr.net/npm/@arisnetxsolutions/quantum-core-sdk@1.1/dist/quantum-core-sdk.min.js"></script>
|
|
39
|
+
|
|
40
|
+
<!-- O simplemente (usa el campo 'jsdelivr' del package.json) -->
|
|
41
|
+
<script src="https://cdn.jsdelivr.net/npm/@arisnetxsolutions/quantum-core-sdk@1.1"></script>
|
|
42
|
+
|
|
43
|
+
<script>
|
|
44
|
+
const qc = new QuantumCore({
|
|
45
|
+
baseUrl: 'https://tu-api.com/api/v1',
|
|
46
|
+
apiKey: 'tu_api_key_de_proyecto'
|
|
47
|
+
});
|
|
48
|
+
</script>
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
|
|
31
55
|
## 🚀 Inicio Rápido
|
|
32
56
|
|
|
33
57
|
### Inicialización del Cliente
|
|
@@ -83,6 +107,22 @@ const imagePath = images[0].url;
|
|
|
83
107
|
const fullUrl = qc.getImageUrl(imagePath);
|
|
84
108
|
```
|
|
85
109
|
|
|
110
|
+
### 📝 Formularios & Captura de Datos
|
|
111
|
+
Envía datos de contacto, registros o cualquier formulario directamente al CMS.
|
|
112
|
+
|
|
113
|
+
```typescript
|
|
114
|
+
// Enviar datos de un formulario
|
|
115
|
+
const result = await qc.forms.submit({
|
|
116
|
+
formId: 'contacto-web', // Requerido
|
|
117
|
+
nombre: 'Alex Arismendi', // Requerido (o 'name')
|
|
118
|
+
correo: 'alex@example.com', // Requerido (o 'email')
|
|
119
|
+
empresa: 'ArisNetX', // Opcional (abierto)
|
|
120
|
+
mensaje: 'Me interesa...' // Opcional (abierto)
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
console.log('ID de entrega:', result.submissionId);
|
|
124
|
+
```
|
|
125
|
+
|
|
86
126
|
---
|
|
87
127
|
|
|
88
128
|
## 🔒 Gestión Administrativa (Auth)
|
|
@@ -124,6 +164,7 @@ const stats = await qc.admin.getStats();
|
|
|
124
164
|
| `blog` | Acceso a posts y artículos. |
|
|
125
165
|
| `services` | Acceso a catálogo de servicios. |
|
|
126
166
|
| `gallery` | Acceso a imágenes y media. |
|
|
167
|
+
| `forms` | Envío y captura de datos de formularios. |
|
|
127
168
|
| `admin` | Operaciones CRUD y configuración (Requiere Auth). |
|
|
128
169
|
| `getImageUrl(path)` | Convierte un path relativo en una URL absoluta funcional. |
|
|
129
170
|
|
package/dist/cdn.d.ts
ADDED
package/dist/cdn.js
ADDED
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BlogDetailResponse, BlogListResponse, Image, Post, SDKConfig, ServiceListResponse, ServiceDetail, Project, User, Service } from './types';
|
|
1
|
+
import { BlogDetailResponse, BlogListResponse, Image, Post, SDKConfig, ServiceListResponse, ServiceDetail, Project, User, Service, FormSubmissionRequest, FormSubmissionResponse } from './types';
|
|
2
2
|
export declare class QuantumCore {
|
|
3
3
|
private api;
|
|
4
4
|
constructor(config: SDKConfig);
|
|
@@ -25,6 +25,9 @@ export declare class QuantumCore {
|
|
|
25
25
|
}) => Promise<ServiceListResponse>;
|
|
26
26
|
getBySlug: (slug: string) => Promise<ServiceDetail>;
|
|
27
27
|
};
|
|
28
|
+
forms: {
|
|
29
|
+
submit: (data: FormSubmissionRequest) => Promise<FormSubmissionResponse>;
|
|
30
|
+
};
|
|
28
31
|
admin: {
|
|
29
32
|
posts: {
|
|
30
33
|
getAll: () => Promise<Post[]>;
|
package/dist/index.js
CHANGED
|
@@ -35,6 +35,12 @@ export class QuantumCore {
|
|
|
35
35
|
return response.data;
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
|
+
this.forms = {
|
|
39
|
+
submit: async (data) => {
|
|
40
|
+
const response = await this.api.post('/forms/submit', data);
|
|
41
|
+
return response.data;
|
|
42
|
+
}
|
|
43
|
+
};
|
|
38
44
|
// Métodos de administración
|
|
39
45
|
this.admin = {
|
|
40
46
|
posts: {
|
|
@@ -101,7 +107,7 @@ export class QuantumCore {
|
|
|
101
107
|
backup: async () => (await this.api.post('/admin/backup')).data,
|
|
102
108
|
restore: async (formData) => (await this.api.post('/admin/restore', formData)).data,
|
|
103
109
|
};
|
|
104
|
-
const baseURL = config.baseUrl || '
|
|
110
|
+
const baseURL = config.baseUrl || 'https://api.quantum.core.arisnetxsolutions.com/api/v1';
|
|
105
111
|
this.api = axios.create({
|
|
106
112
|
baseURL,
|
|
107
113
|
headers: {
|
|
@@ -114,7 +120,7 @@ export class QuantumCore {
|
|
|
114
120
|
return '';
|
|
115
121
|
if (path.startsWith('http'))
|
|
116
122
|
return path;
|
|
117
|
-
const baseURL = this.api.defaults.baseURL || '
|
|
123
|
+
const baseURL = this.api.defaults.baseURL || 'https://api.quantum.core.arisnetxsolutions.com/api/v1';
|
|
118
124
|
const base = baseURL.split('/api/v1')[0];
|
|
119
125
|
const normalizedPath = path.startsWith('/') ? path : `/${path}`;
|
|
120
126
|
return `${base}${normalizedPath}`;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";(()=>{var zt=Object.defineProperty;var Jt=(t,e)=>{for(var r in e)zt(t,r,{get:e[r],enumerable:!0})};function G(t,e){return function(){return t.apply(e,arguments)}}var{toString:Vt}=Object.prototype,{getPrototypeOf:Ue}=Object,{iterator:de,toStringTag:lt}=Symbol,pe=(t=>e=>{let r=Vt.call(e);return t[r]||(t[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),D=t=>(t=t.toLowerCase(),e=>pe(e)===t),me=t=>e=>typeof e===t,{isArray:M}=Array,v=me("undefined");function Q(t){return t!==null&&!v(t)&&t.constructor!==null&&!v(t.constructor)&&P(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}var ft=D("ArrayBuffer");function Kt(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&ft(t.buffer),e}var Wt=me("string"),P=me("function"),dt=me("number"),Y=t=>t!==null&&typeof t=="object",Xt=t=>t===!0||t===!1,fe=t=>{if(pe(t)!=="object")return!1;let e=Ue(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(lt in t)&&!(de in t)},Gt=t=>{if(!Y(t)||Q(t))return!1;try{return Object.keys(t).length===0&&Object.getPrototypeOf(t)===Object.prototype}catch{return!1}},Qt=D("Date"),Yt=D("File"),Zt=t=>!!(t&&typeof t.uri<"u"),er=t=>t&&typeof t.getParts<"u",tr=D("Blob"),rr=D("FileList"),nr=t=>Y(t)&&P(t.pipe);function sr(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}}var at=sr(),ct=typeof at.FormData<"u"?at.FormData:void 0,or=t=>{let e;return t&&(ct&&t instanceof ct||P(t.append)&&((e=pe(t))==="formdata"||e==="object"&&P(t.toString)&&t.toString()==="[object FormData]"))},ir=D("URLSearchParams"),[ar,cr,ur,lr]=["ReadableStream","Request","Response","Headers"].map(D),fr=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Z(t,e,{allOwnKeys:r=!1}={}){if(t===null||typeof t>"u")return;let n,s;if(typeof t!="object"&&(t=[t]),M(t))for(n=0,s=t.length;n<s;n++)e.call(null,t[n],n,t);else{if(Q(t))return;let o=r?Object.getOwnPropertyNames(t):Object.keys(t),i=o.length,c;for(n=0;n<i;n++)c=o[n],e.call(null,t[c],c,t)}}function pt(t,e){if(Q(t))return null;e=e.toLowerCase();let r=Object.keys(t),n=r.length,s;for(;n-- >0;)if(s=r[n],e===s.toLowerCase())return s;return null}var H=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,mt=t=>!v(t)&&t!==H;function Ne(){let{caseless:t,skipUndefined:e}=mt(this)&&this||{},r={},n=(s,o)=>{if(o==="__proto__"||o==="constructor"||o==="prototype")return;let i=t&&pt(r,o)||o;fe(r[i])&&fe(s)?r[i]=Ne(r[i],s):fe(s)?r[i]=Ne({},s):M(s)?r[i]=s.slice():(!e||!v(s))&&(r[i]=s)};for(let s=0,o=arguments.length;s<o;s++)arguments[s]&&Z(arguments[s],n);return r}var dr=(t,e,r,{allOwnKeys:n}={})=>(Z(e,(s,o)=>{r&&P(s)?Object.defineProperty(t,o,{value:G(s,r),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(t,o,{value:s,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:n}),t),pr=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),mr=(t,e,r,n)=>{t.prototype=Object.create(e.prototype,n),Object.defineProperty(t.prototype,"constructor",{value:t,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(t,"super",{value:e.prototype}),r&&Object.assign(t.prototype,r)},hr=(t,e,r,n)=>{let s,o,i,c={};if(e=e||{},t==null)return e;do{for(s=Object.getOwnPropertyNames(t),o=s.length;o-- >0;)i=s[o],(!n||n(i,t,e))&&!c[i]&&(e[i]=t[i],c[i]=!0);t=r!==!1&&Ue(t)}while(t&&(!r||r(t,e))&&t!==Object.prototype);return e},gr=(t,e,r)=>{t=String(t),(r===void 0||r>t.length)&&(r=t.length),r-=e.length;let n=t.indexOf(e,r);return n!==-1&&n===r},yr=t=>{if(!t)return null;if(M(t))return t;let e=t.length;if(!dt(e))return null;let r=new Array(e);for(;e-- >0;)r[e]=t[e];return r},br=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&Ue(Uint8Array)),wr=(t,e)=>{let n=(t&&t[de]).call(t),s;for(;(s=n.next())&&!s.done;){let o=s.value;e.call(t,o[0],o[1])}},Rr=(t,e)=>{let r,n=[];for(;(r=t.exec(e))!==null;)n.push(r);return n},Er=D("HTMLFormElement"),Sr=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,s){return n.toUpperCase()+s}),ut=(({hasOwnProperty:t})=>(e,r)=>t.call(e,r))(Object.prototype),xr=D("RegExp"),ht=(t,e)=>{let r=Object.getOwnPropertyDescriptors(t),n={};Z(r,(s,o)=>{let i;(i=e(s,o,t))!==!1&&(n[o]=i||s)}),Object.defineProperties(t,n)},Ar=t=>{ht(t,(e,r)=>{if(P(t)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;let n=t[r];if(P(n)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},Or=(t,e)=>{let r={},n=s=>{s.forEach(o=>{r[o]=!0})};return M(t)?n(t):n(String(t).split(e)),r},Tr=()=>{},Pr=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e;function Cr(t){return!!(t&&P(t.append)&&t[lt]==="FormData"&&t[de])}var Nr=t=>{let e=new Array(10),r=(n,s)=>{if(Y(n)){if(e.indexOf(n)>=0)return;if(Q(n))return n;if(!("toJSON"in n)){e[s]=n;let o=M(n)?[]:{};return Z(n,(i,c)=>{let p=r(i,s+1);!v(p)&&(o[c]=p)}),e[s]=void 0,o}}return n};return r(t,0)},Ur=D("AsyncFunction"),_r=t=>t&&(Y(t)||P(t))&&P(t.then)&&P(t.catch),gt=((t,e)=>t?setImmediate:e?((r,n)=>(H.addEventListener("message",({source:s,data:o})=>{s===H&&o===r&&n.length&&n.shift()()},!1),s=>{n.push(s),H.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",P(H.postMessage)),Dr=typeof queueMicrotask<"u"?queueMicrotask.bind(H):typeof process<"u"&&process.nextTick||gt,Fr=t=>t!=null&&P(t[de]),a={isArray:M,isArrayBuffer:ft,isBuffer:Q,isFormData:or,isArrayBufferView:Kt,isString:Wt,isNumber:dt,isBoolean:Xt,isObject:Y,isPlainObject:fe,isEmptyObject:Gt,isReadableStream:ar,isRequest:cr,isResponse:ur,isHeaders:lr,isUndefined:v,isDate:Qt,isFile:Yt,isReactNativeBlob:Zt,isReactNative:er,isBlob:tr,isRegExp:xr,isFunction:P,isStream:nr,isURLSearchParams:ir,isTypedArray:br,isFileList:rr,forEach:Z,merge:Ne,extend:dr,trim:fr,stripBOM:pr,inherits:mr,toFlatObject:hr,kindOf:pe,kindOfTest:D,endsWith:gr,toArray:yr,forEachEntry:wr,matchAll:Rr,isHTMLForm:Er,hasOwnProperty:ut,hasOwnProp:ut,reduceDescriptors:ht,freezeMethods:Ar,toObjectSet:Or,toCamelCase:Sr,noop:Tr,toFiniteNumber:Pr,findKey:pt,global:H,isContextDefined:mt,isSpecCompliantForm:Cr,toJSONObject:Nr,isAsyncFn:Ur,isThenable:_r,setImmediate:gt,asap:Dr,isIterable:Fr};var A=class t extends Error{static from(e,r,n,s,o,i){let c=new t(e.message,r||e.code,n,s,o);return c.cause=e,c.name=e.name,e.status!=null&&c.status==null&&(c.status=e.status),i&&Object.assign(c,i),c}constructor(e,r,n,s,o){super(e),Object.defineProperty(this,"message",{value:e,enumerable:!0,writable:!0,configurable:!0}),this.name="AxiosError",this.isAxiosError=!0,r&&(this.code=r),n&&(this.config=n),s&&(this.request=s),o&&(this.response=o,this.status=o.status)}toJSON(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:a.toJSONObject(this.config),code:this.code,status:this.status}}};A.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE";A.ERR_BAD_OPTION="ERR_BAD_OPTION";A.ECONNABORTED="ECONNABORTED";A.ETIMEDOUT="ETIMEDOUT";A.ERR_NETWORK="ERR_NETWORK";A.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS";A.ERR_DEPRECATED="ERR_DEPRECATED";A.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE";A.ERR_BAD_REQUEST="ERR_BAD_REQUEST";A.ERR_CANCELED="ERR_CANCELED";A.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT";A.ERR_INVALID_URL="ERR_INVALID_URL";var g=A;var he=null;function De(t){return a.isPlainObject(t)||a.isArray(t)}function yt(t){return a.endsWith(t,"[]")?t.slice(0,-2):t}function _e(t,e,r){return t?t.concat(e).map(function(s,o){return s=yt(s),!r&&o?"["+s+"]":s}).join(r?".":""):e}function Lr(t){return a.isArray(t)&&!t.some(De)}var Br=a.toFlatObject(a,{},null,function(e){return/^is[A-Z]/.test(e)});function Ir(t,e,r){if(!a.isObject(t))throw new TypeError("target must be an object");e=e||new(he||FormData),r=a.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(h,d){return!a.isUndefined(d[h])});let n=r.metaTokens,s=r.visitor||u,o=r.dots,i=r.indexes,p=(r.Blob||typeof Blob<"u"&&Blob)&&a.isSpecCompliantForm(e);if(!a.isFunction(s))throw new TypeError("visitor must be a function");function f(l){if(l===null)return"";if(a.isDate(l))return l.toISOString();if(a.isBoolean(l))return l.toString();if(!p&&a.isBlob(l))throw new g("Blob is not supported. Use a Buffer instead.");return a.isArrayBuffer(l)||a.isTypedArray(l)?p&&typeof Blob=="function"?new Blob([l]):Buffer.from(l):l}function u(l,h,d){let w=l;if(a.isReactNative(e)&&a.isReactNativeBlob(l))return e.append(_e(d,h,o),f(l)),!1;if(l&&!d&&typeof l=="object"){if(a.endsWith(h,"{}"))h=n?h:h.slice(0,-2),l=JSON.stringify(l);else if(a.isArray(l)&&Lr(l)||(a.isFileList(l)||a.endsWith(h,"[]"))&&(w=a.toArray(l)))return h=yt(h),w.forEach(function(S,O){!(a.isUndefined(S)||S===null)&&e.append(i===!0?_e([h],O,o):i===null?h:h+"[]",f(S))}),!1}return De(l)?!0:(e.append(_e(d,h,o),f(l)),!1)}let m=[],y=Object.assign(Br,{defaultVisitor:u,convertValue:f,isVisitable:De});function x(l,h){if(!a.isUndefined(l)){if(m.indexOf(l)!==-1)throw Error("Circular reference detected in "+h.join("."));m.push(l),a.forEach(l,function(w,C){(!(a.isUndefined(w)||w===null)&&s.call(e,w,a.isString(C)?C.trim():C,h,y))===!0&&x(w,h?h.concat(C):[C])}),m.pop()}}if(!a.isObject(t))throw new TypeError("data must be an object");return x(t),e}var k=Ir;function bt(t){let e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(n){return e[n]})}function wt(t,e){this._pairs=[],t&&k(t,this,e)}var Rt=wt.prototype;Rt.append=function(e,r){this._pairs.push([e,r])};Rt.toString=function(e){let r=e?function(n){return e.call(this,n,bt)}:bt;return this._pairs.map(function(s){return r(s[0])+"="+r(s[1])},"").join("&")};var ge=wt;function kr(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function ee(t,e,r){if(!e)return t;let n=r&&r.encode||kr,s=a.isFunction(r)?{serialize:r}:r,o=s&&s.serialize,i;if(o?i=o(e,s):i=a.isURLSearchParams(e)?e.toString():new ge(e,s).toString(n),i){let c=t.indexOf("#");c!==-1&&(t=t.slice(0,c)),t+=(t.indexOf("?")===-1?"?":"&")+i}return t}var Fe=class{constructor(){this.handlers=[]}use(e,r,n){return this.handlers.push({fulfilled:e,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){a.forEach(this.handlers,function(n){n!==null&&e(n)})}},Le=Fe;var z={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0};var Et=typeof URLSearchParams<"u"?URLSearchParams:ge;var St=typeof FormData<"u"?FormData:null;var xt=typeof Blob<"u"?Blob:null;var At={isBrowser:!0,classes:{URLSearchParams:Et,FormData:St,Blob:xt},protocols:["http","https","file","blob","url","data"]};var ke={};Jt(ke,{hasBrowserEnv:()=>Ie,hasStandardBrowserEnv:()=>jr,hasStandardBrowserWebWorkerEnv:()=>qr,navigator:()=>Be,origin:()=>Hr});var Ie=typeof window<"u"&&typeof document<"u",Be=typeof navigator=="object"&&navigator||void 0,jr=Ie&&(!Be||["ReactNative","NativeScript","NS"].indexOf(Be.product)<0),qr=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Hr=Ie&&window.location.href||"http://localhost";var b={...ke,...At};function je(t,e){return k(t,new b.classes.URLSearchParams,{visitor:function(r,n,s,o){return b.isNode&&a.isBuffer(r)?(this.append(n,r.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)},...e})}function $r(t){return a.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function vr(t){let e={},r=Object.keys(t),n,s=r.length,o;for(n=0;n<s;n++)o=r[n],e[o]=t[o];return e}function Mr(t){function e(r,n,s,o){let i=r[o++];if(i==="__proto__")return!0;let c=Number.isFinite(+i),p=o>=r.length;return i=!i&&a.isArray(s)?s.length:i,p?(a.hasOwnProp(s,i)?s[i]=[s[i],n]:s[i]=n,!c):((!s[i]||!a.isObject(s[i]))&&(s[i]=[]),e(r,n,s[i],o)&&a.isArray(s[i])&&(s[i]=vr(s[i])),!c)}if(a.isFormData(t)&&a.isFunction(t.entries)){let r={};return a.forEachEntry(t,(n,s)=>{e($r(n),s,r,0)}),r}return null}var ye=Mr;function zr(t,e,r){if(a.isString(t))try{return(e||JSON.parse)(t),a.trim(t)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(t)}var qe={transitional:z,adapter:["xhr","http","fetch"],transformRequest:[function(e,r){let n=r.getContentType()||"",s=n.indexOf("application/json")>-1,o=a.isObject(e);if(o&&a.isHTMLForm(e)&&(e=new FormData(e)),a.isFormData(e))return s?JSON.stringify(ye(e)):e;if(a.isArrayBuffer(e)||a.isBuffer(e)||a.isStream(e)||a.isFile(e)||a.isBlob(e)||a.isReadableStream(e))return e;if(a.isArrayBufferView(e))return e.buffer;if(a.isURLSearchParams(e))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let c;if(o){if(n.indexOf("application/x-www-form-urlencoded")>-1)return je(e,this.formSerializer).toString();if((c=a.isFileList(e))||n.indexOf("multipart/form-data")>-1){let p=this.env&&this.env.FormData;return k(c?{"files[]":e}:e,p&&new p,this.formSerializer)}}return o||s?(r.setContentType("application/json",!1),zr(e)):e}],transformResponse:[function(e){let r=this.transitional||qe.transitional,n=r&&r.forcedJSONParsing,s=this.responseType==="json";if(a.isResponse(e)||a.isReadableStream(e))return e;if(e&&a.isString(e)&&(n&&!this.responseType||s)){let i=!(r&&r.silentJSONParsing)&&s;try{return JSON.parse(e,this.parseReviver)}catch(c){if(i)throw c.name==="SyntaxError"?g.from(c,g.ERR_BAD_RESPONSE,this,null,this.response):c}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:b.classes.FormData,Blob:b.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};a.forEach(["delete","get","head","post","put","patch"],t=>{qe.headers[t]={}});var J=qe;var Jr=a.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),Ot=t=>{let e={},r,n,s;return t&&t.split(`
|
|
2
|
+
`).forEach(function(i){s=i.indexOf(":"),r=i.substring(0,s).trim().toLowerCase(),n=i.substring(s+1).trim(),!(!r||e[r]&&Jr[r])&&(r==="set-cookie"?e[r]?e[r].push(n):e[r]=[n]:e[r]=e[r]?e[r]+", "+n:n)}),e};var Tt=Symbol("internals");function te(t){return t&&String(t).trim().toLowerCase()}function be(t){return t===!1||t==null?t:a.isArray(t)?t.map(be):String(t)}function Vr(t){let e=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g,n;for(;n=r.exec(t);)e[n[1]]=n[2];return e}var Kr=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function He(t,e,r,n,s){if(a.isFunction(n))return n.call(this,e,r);if(s&&(e=r),!!a.isString(e)){if(a.isString(n))return e.indexOf(n)!==-1;if(a.isRegExp(n))return n.test(e)}}function Wr(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,r,n)=>r.toUpperCase()+n)}function Xr(t,e){let r=a.toCamelCase(" "+e);["get","set","has"].forEach(n=>{Object.defineProperty(t,n+r,{value:function(s,o,i){return this[n].call(this,e,s,o,i)},configurable:!0})})}var V=class{constructor(e){e&&this.set(e)}set(e,r,n){let s=this;function o(c,p,f){let u=te(p);if(!u)throw new Error("header name must be a non-empty string");let m=a.findKey(s,u);(!m||s[m]===void 0||f===!0||f===void 0&&s[m]!==!1)&&(s[m||p]=be(c))}let i=(c,p)=>a.forEach(c,(f,u)=>o(f,u,p));if(a.isPlainObject(e)||e instanceof this.constructor)i(e,r);else if(a.isString(e)&&(e=e.trim())&&!Kr(e))i(Ot(e),r);else if(a.isObject(e)&&a.isIterable(e)){let c={},p,f;for(let u of e){if(!a.isArray(u))throw TypeError("Object iterator must return a key-value pair");c[f=u[0]]=(p=c[f])?a.isArray(p)?[...p,u[1]]:[p,u[1]]:u[1]}i(c,r)}else e!=null&&o(r,e,n);return this}get(e,r){if(e=te(e),e){let n=a.findKey(this,e);if(n){let s=this[n];if(!r)return s;if(r===!0)return Vr(s);if(a.isFunction(r))return r.call(this,s,n);if(a.isRegExp(r))return r.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,r){if(e=te(e),e){let n=a.findKey(this,e);return!!(n&&this[n]!==void 0&&(!r||He(this,this[n],n,r)))}return!1}delete(e,r){let n=this,s=!1;function o(i){if(i=te(i),i){let c=a.findKey(n,i);c&&(!r||He(n,n[c],c,r))&&(delete n[c],s=!0)}}return a.isArray(e)?e.forEach(o):o(e),s}clear(e){let r=Object.keys(this),n=r.length,s=!1;for(;n--;){let o=r[n];(!e||He(this,this[o],o,e,!0))&&(delete this[o],s=!0)}return s}normalize(e){let r=this,n={};return a.forEach(this,(s,o)=>{let i=a.findKey(n,o);if(i){r[i]=be(s),delete r[o];return}let c=e?Wr(o):String(o).trim();c!==o&&delete r[o],r[c]=be(s),n[c]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){let r=Object.create(null);return a.forEach(this,(n,s)=>{n!=null&&n!==!1&&(r[s]=e&&a.isArray(n)?n.join(", "):n)}),r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,r])=>e+": "+r).join(`
|
|
3
|
+
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...r){let n=new this(e);return r.forEach(s=>n.set(s)),n}static accessor(e){let n=(this[Tt]=this[Tt]={accessors:{}}).accessors,s=this.prototype;function o(i){let c=te(i);n[c]||(Xr(s,i),n[c]=!0)}return a.isArray(e)?e.forEach(o):o(e),this}};V.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);a.reduceDescriptors(V.prototype,({value:t},e)=>{let r=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(n){this[r]=n}}});a.freezeMethods(V);var E=V;function re(t,e){let r=this||J,n=e||r,s=E.from(n.headers),o=n.data;return a.forEach(t,function(c){o=c.call(r,o,s.normalize(),e?e.status:void 0)}),s.normalize(),o}function ne(t){return!!(t&&t.__CANCEL__)}var $e=class extends g{constructor(e,r,n){super(e??"canceled",g.ERR_CANCELED,r,n),this.name="CanceledError",this.__CANCEL__=!0}},L=$e;function se(t,e,r){let n=r.config.validateStatus;!r.status||!n||n(r.status)?t(r):e(new g("Request failed with status code "+r.status,[g.ERR_BAD_REQUEST,g.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}function ve(t){let e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function Gr(t,e){t=t||10;let r=new Array(t),n=new Array(t),s=0,o=0,i;return e=e!==void 0?e:1e3,function(p){let f=Date.now(),u=n[o];i||(i=f),r[s]=p,n[s]=f;let m=o,y=0;for(;m!==s;)y+=r[m++],m=m%t;if(s=(s+1)%t,s===o&&(o=(o+1)%t),f-i<e)return;let x=u&&f-u;return x?Math.round(y*1e3/x):void 0}}var Pt=Gr;function Qr(t,e){let r=0,n=1e3/e,s,o,i=(f,u=Date.now())=>{r=u,s=null,o&&(clearTimeout(o),o=null),t(...f)};return[(...f)=>{let u=Date.now(),m=u-r;m>=n?i(f,u):(s=f,o||(o=setTimeout(()=>{o=null,i(s)},n-m)))},()=>s&&i(s)]}var Ct=Qr;var K=(t,e,r=3)=>{let n=0,s=Pt(50,250);return Ct(o=>{let i=o.loaded,c=o.lengthComputable?o.total:void 0,p=i-n,f=s(p),u=i<=c;n=i;let m={loaded:i,total:c,progress:c?i/c:void 0,bytes:p,rate:f||void 0,estimated:f&&c&&u?(c-i)/f:void 0,event:o,lengthComputable:c!=null,[e?"download":"upload"]:!0};t(m)},r)},Me=(t,e)=>{let r=t!=null;return[n=>e[0]({lengthComputable:r,total:t,loaded:n}),e[1]]},ze=t=>(...e)=>a.asap(()=>t(...e));var Nt=b.hasStandardBrowserEnv?((t,e)=>r=>(r=new URL(r,b.origin),t.protocol===r.protocol&&t.host===r.host&&(e||t.port===r.port)))(new URL(b.origin),b.navigator&&/(msie|trident)/i.test(b.navigator.userAgent)):()=>!0;var Ut=b.hasStandardBrowserEnv?{write(t,e,r,n,s,o,i){if(typeof document>"u")return;let c=[`${t}=${encodeURIComponent(e)}`];a.isNumber(r)&&c.push(`expires=${new Date(r).toUTCString()}`),a.isString(n)&&c.push(`path=${n}`),a.isString(s)&&c.push(`domain=${s}`),o===!0&&c.push("secure"),a.isString(i)&&c.push(`SameSite=${i}`),document.cookie=c.join("; ")},read(t){if(typeof document>"u")return null;let e=document.cookie.match(new RegExp("(?:^|; )"+t+"=([^;]*)"));return e?decodeURIComponent(e[1]):null},remove(t){this.write(t,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function Je(t){return typeof t!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function Ve(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function oe(t,e,r){let n=!Je(e);return t&&(n||r==!1)?Ve(t,e):e}var _t=t=>t instanceof E?{...t}:t;function F(t,e){e=e||{};let r={};function n(f,u,m,y){return a.isPlainObject(f)&&a.isPlainObject(u)?a.merge.call({caseless:y},f,u):a.isPlainObject(u)?a.merge({},u):a.isArray(u)?u.slice():u}function s(f,u,m,y){if(a.isUndefined(u)){if(!a.isUndefined(f))return n(void 0,f,m,y)}else return n(f,u,m,y)}function o(f,u){if(!a.isUndefined(u))return n(void 0,u)}function i(f,u){if(a.isUndefined(u)){if(!a.isUndefined(f))return n(void 0,f)}else return n(void 0,u)}function c(f,u,m){if(m in e)return n(f,u);if(m in t)return n(void 0,f)}let p={url:o,method:o,data:o,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:c,headers:(f,u,m)=>s(_t(f),_t(u),m,!0)};return a.forEach(Object.keys({...t,...e}),function(u){if(u==="__proto__"||u==="constructor"||u==="prototype")return;let m=a.hasOwnProp(p,u)?p[u]:s,y=m(t[u],e[u],u);a.isUndefined(y)&&m!==c||(r[u]=y)}),r}var we=t=>{let e=F({},t),{data:r,withXSRFToken:n,xsrfHeaderName:s,xsrfCookieName:o,headers:i,auth:c}=e;if(e.headers=i=E.from(i),e.url=ee(oe(e.baseURL,e.url,e.allowAbsoluteUrls),t.params,t.paramsSerializer),c&&i.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):""))),a.isFormData(r)){if(b.hasStandardBrowserEnv||b.hasStandardBrowserWebWorkerEnv)i.setContentType(void 0);else if(a.isFunction(r.getHeaders)){let p=r.getHeaders(),f=["content-type","content-length"];Object.entries(p).forEach(([u,m])=>{f.includes(u.toLowerCase())&&i.set(u,m)})}}if(b.hasStandardBrowserEnv&&(n&&a.isFunction(n)&&(n=n(e)),n||n!==!1&&Nt(e.url))){let p=s&&o&&Ut.read(o);p&&i.set(s,p)}return e};var Yr=typeof XMLHttpRequest<"u",Dt=Yr&&function(t){return new Promise(function(r,n){let s=we(t),o=s.data,i=E.from(s.headers).normalize(),{responseType:c,onUploadProgress:p,onDownloadProgress:f}=s,u,m,y,x,l;function h(){x&&x(),l&&l(),s.cancelToken&&s.cancelToken.unsubscribe(u),s.signal&&s.signal.removeEventListener("abort",u)}let d=new XMLHttpRequest;d.open(s.method.toUpperCase(),s.url,!0),d.timeout=s.timeout;function w(){if(!d)return;let S=E.from("getAllResponseHeaders"in d&&d.getAllResponseHeaders()),_={data:!c||c==="text"||c==="json"?d.responseText:d.response,status:d.status,statusText:d.statusText,headers:S,config:t,request:d};se(function(N){r(N),h()},function(N){n(N),h()},_),d=null}"onloadend"in d?d.onloadend=w:d.onreadystatechange=function(){!d||d.readyState!==4||d.status===0&&!(d.responseURL&&d.responseURL.indexOf("file:")===0)||setTimeout(w)},d.onabort=function(){d&&(n(new g("Request aborted",g.ECONNABORTED,t,d)),d=null)},d.onerror=function(O){let _=O&&O.message?O.message:"Network Error",j=new g(_,g.ERR_NETWORK,t,d);j.event=O||null,n(j),d=null},d.ontimeout=function(){let O=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded",_=s.transitional||z;s.timeoutErrorMessage&&(O=s.timeoutErrorMessage),n(new g(O,_.clarifyTimeoutError?g.ETIMEDOUT:g.ECONNABORTED,t,d)),d=null},o===void 0&&i.setContentType(null),"setRequestHeader"in d&&a.forEach(i.toJSON(),function(O,_){d.setRequestHeader(_,O)}),a.isUndefined(s.withCredentials)||(d.withCredentials=!!s.withCredentials),c&&c!=="json"&&(d.responseType=s.responseType),f&&([y,l]=K(f,!0),d.addEventListener("progress",y)),p&&d.upload&&([m,x]=K(p),d.upload.addEventListener("progress",m),d.upload.addEventListener("loadend",x)),(s.cancelToken||s.signal)&&(u=S=>{d&&(n(!S||S.type?new L(null,t,d):S),d.abort(),d=null)},s.cancelToken&&s.cancelToken.subscribe(u),s.signal&&(s.signal.aborted?u():s.signal.addEventListener("abort",u)));let C=ve(s.url);if(C&&b.protocols.indexOf(C)===-1){n(new g("Unsupported protocol "+C+":",g.ERR_BAD_REQUEST,t));return}d.send(o||null)})};var Zr=(t,e)=>{let{length:r}=t=t?t.filter(Boolean):[];if(e||r){let n=new AbortController,s,o=function(f){if(!s){s=!0,c();let u=f instanceof Error?f:this.reason;n.abort(u instanceof g?u:new L(u instanceof Error?u.message:u))}},i=e&&setTimeout(()=>{i=null,o(new g(`timeout of ${e}ms exceeded`,g.ETIMEDOUT))},e),c=()=>{t&&(i&&clearTimeout(i),i=null,t.forEach(f=>{f.unsubscribe?f.unsubscribe(o):f.removeEventListener("abort",o)}),t=null)};t.forEach(f=>f.addEventListener("abort",o));let{signal:p}=n;return p.unsubscribe=()=>a.asap(c),p}},Ft=Zr;var en=function*(t,e){let r=t.byteLength;if(!e||r<e){yield t;return}let n=0,s;for(;n<r;)s=n+e,yield t.slice(n,s),n=s},tn=async function*(t,e){for await(let r of rn(t))yield*en(r,e)},rn=async function*(t){if(t[Symbol.asyncIterator]){yield*t;return}let e=t.getReader();try{for(;;){let{done:r,value:n}=await e.read();if(r)break;yield n}}finally{await e.cancel()}},Ke=(t,e,r,n)=>{let s=tn(t,e),o=0,i,c=p=>{i||(i=!0,n&&n(p))};return new ReadableStream({async pull(p){try{let{done:f,value:u}=await s.next();if(f){c(),p.close();return}let m=u.byteLength;if(r){let y=o+=m;r(y)}p.enqueue(new Uint8Array(u))}catch(f){throw c(f),f}},cancel(p){return c(p),s.return()}},{highWaterMark:2})};var Lt=64*1024,{isFunction:Re}=a,nn=(({Request:t,Response:e})=>({Request:t,Response:e}))(a.global),{ReadableStream:Bt,TextEncoder:It}=a.global,kt=(t,...e)=>{try{return!!t(...e)}catch{return!1}},sn=t=>{t=a.merge.call({skipUndefined:!0},nn,t);let{fetch:e,Request:r,Response:n}=t,s=e?Re(e):typeof fetch=="function",o=Re(r),i=Re(n);if(!s)return!1;let c=s&&Re(Bt),p=s&&(typeof It=="function"?(l=>h=>l.encode(h))(new It):async l=>new Uint8Array(await new r(l).arrayBuffer())),f=o&&c&&kt(()=>{let l=!1,h=new r(b.origin,{body:new Bt,method:"POST",get duplex(){return l=!0,"half"}}).headers.has("Content-Type");return l&&!h}),u=i&&c&&kt(()=>a.isReadableStream(new n("").body)),m={stream:u&&(l=>l.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach(l=>{!m[l]&&(m[l]=(h,d)=>{let w=h&&h[l];if(w)return w.call(h);throw new g(`Response type '${l}' is not supported`,g.ERR_NOT_SUPPORT,d)})});let y=async l=>{if(l==null)return 0;if(a.isBlob(l))return l.size;if(a.isSpecCompliantForm(l))return(await new r(b.origin,{method:"POST",body:l}).arrayBuffer()).byteLength;if(a.isArrayBufferView(l)||a.isArrayBuffer(l))return l.byteLength;if(a.isURLSearchParams(l)&&(l=l+""),a.isString(l))return(await p(l)).byteLength},x=async(l,h)=>{let d=a.toFiniteNumber(l.getContentLength());return d??y(h)};return async l=>{let{url:h,method:d,data:w,signal:C,cancelToken:S,timeout:O,onDownloadProgress:_,onUploadProgress:j,responseType:N,headers:Pe,withCredentials:ce="same-origin",fetchOptions:tt}=we(l),rt=e||fetch;N=N?(N+"").toLowerCase():"text";let ue=Ft([C,S&&S.toAbortSignal()],O),X=null,q=ue&&ue.unsubscribe&&(()=>{ue.unsubscribe()}),nt;try{if(j&&f&&d!=="get"&&d!=="head"&&(nt=await x(Pe,w))!==0){let I=new r(h,{method:"POST",body:w,duplex:"half"}),$;if(a.isFormData(w)&&($=I.headers.get("content-type"))&&Pe.setContentType($),I.body){let[Ce,le]=Me(nt,K(ze(j)));w=Ke(I.body,Lt,Ce,le)}}a.isString(ce)||(ce=ce?"include":"omit");let T=o&&"credentials"in r.prototype,st={...tt,signal:ue,method:d.toUpperCase(),headers:Pe.normalize().toJSON(),body:w,duplex:"half",credentials:T?ce:void 0};X=o&&new r(h,st);let B=await(o?rt(X,tt):rt(h,st)),ot=u&&(N==="stream"||N==="response");if(u&&(_||ot&&q)){let I={};["status","statusText","headers"].forEach(it=>{I[it]=B[it]});let $=a.toFiniteNumber(B.headers.get("content-length")),[Ce,le]=_&&Me($,K(ze(_),!0))||[];B=new n(Ke(B.body,Lt,Ce,()=>{le&&le(),q&&q()}),I)}N=N||"text";let Mt=await m[a.findKey(m,N)||"text"](B,l);return!ot&&q&&q(),await new Promise((I,$)=>{se(I,$,{data:Mt,headers:E.from(B.headers),status:B.status,statusText:B.statusText,config:l,request:X})})}catch(T){throw q&&q(),T&&T.name==="TypeError"&&/Load failed|fetch/i.test(T.message)?Object.assign(new g("Network Error",g.ERR_NETWORK,l,X,T&&T.response),{cause:T.cause||T}):g.from(T,T&&T.code,l,X,T&&T.response)}}},on=new Map,We=t=>{let e=t&&t.env||{},{fetch:r,Request:n,Response:s}=e,o=[n,s,r],i=o.length,c=i,p,f,u=on;for(;c--;)p=o[c],f=u.get(p),f===void 0&&u.set(p,f=c?new Map:sn(e)),u=f;return f},ho=We();var Xe={http:he,xhr:Dt,fetch:{get:We}};a.forEach(Xe,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});var jt=t=>`- ${t}`,cn=t=>a.isFunction(t)||t===null||t===!1;function un(t,e){t=a.isArray(t)?t:[t];let{length:r}=t,n,s,o={};for(let i=0;i<r;i++){n=t[i];let c;if(s=n,!cn(n)&&(s=Xe[(c=String(n)).toLowerCase()],s===void 0))throw new g(`Unknown adapter '${c}'`);if(s&&(a.isFunction(s)||(s=s.get(e))))break;o[c||"#"+i]=s}if(!s){let i=Object.entries(o).map(([p,f])=>`adapter ${p} `+(f===!1?"is not supported by the environment":"is not available in the build")),c=r?i.length>1?`since :
|
|
4
|
+
`+i.map(jt).join(`
|
|
5
|
+
`):" "+jt(i[0]):"as no adapter specified";throw new g("There is no suitable adapter to dispatch the request "+c,"ERR_NOT_SUPPORT")}return s}var Ee={getAdapter:un,adapters:Xe};function Ge(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new L(null,t)}function Se(t){return Ge(t),t.headers=E.from(t.headers),t.data=re.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),Ee.getAdapter(t.adapter||J.adapter,t)(t).then(function(n){return Ge(t),n.data=re.call(t,t.transformResponse,n),n.headers=E.from(n.headers),n},function(n){return ne(n)||(Ge(t),n&&n.response&&(n.response.data=re.call(t,t.transformResponse,n.response),n.response.headers=E.from(n.response.headers))),Promise.reject(n)})}var xe="1.13.6";var Ae={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{Ae[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});var qt={};Ae.transitional=function(e,r,n){function s(o,i){return"[Axios v"+xe+"] Transitional option '"+o+"'"+i+(n?". "+n:"")}return(o,i,c)=>{if(e===!1)throw new g(s(i," has been removed"+(r?" in "+r:"")),g.ERR_DEPRECATED);return r&&!qt[i]&&(qt[i]=!0,console.warn(s(i," has been deprecated since v"+r+" and will be removed in the near future"))),e?e(o,i,c):!0}};Ae.spelling=function(e){return(r,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};function ln(t,e,r){if(typeof t!="object")throw new g("options must be an object",g.ERR_BAD_OPTION_VALUE);let n=Object.keys(t),s=n.length;for(;s-- >0;){let o=n[s],i=e[o];if(i){let c=t[o],p=c===void 0||i(c,o,t);if(p!==!0)throw new g("option "+o+" must be "+p,g.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new g("Unknown option "+o,g.ERR_BAD_OPTION)}}var ie={assertOptions:ln,validators:Ae};var U=ie.validators,W=class{constructor(e){this.defaults=e||{},this.interceptors={request:new Le,response:new Le}}async request(e,r){try{return await this._request(e,r)}catch(n){if(n instanceof Error){let s={};Error.captureStackTrace?Error.captureStackTrace(s):s=new Error;let o=s.stack?s.stack.replace(/^.+\n/,""):"";try{n.stack?o&&!String(n.stack).endsWith(o.replace(/^.+\n.+\n/,""))&&(n.stack+=`
|
|
6
|
+
`+o):n.stack=o}catch{}}throw n}}_request(e,r){typeof e=="string"?(r=r||{},r.url=e):r=e||{},r=F(this.defaults,r);let{transitional:n,paramsSerializer:s,headers:o}=r;n!==void 0&&ie.assertOptions(n,{silentJSONParsing:U.transitional(U.boolean),forcedJSONParsing:U.transitional(U.boolean),clarifyTimeoutError:U.transitional(U.boolean),legacyInterceptorReqResOrdering:U.transitional(U.boolean)},!1),s!=null&&(a.isFunction(s)?r.paramsSerializer={serialize:s}:ie.assertOptions(s,{encode:U.function,serialize:U.function},!0)),r.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?r.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:r.allowAbsoluteUrls=!0),ie.assertOptions(r,{baseUrl:U.spelling("baseURL"),withXsrfToken:U.spelling("withXSRFToken")},!0),r.method=(r.method||this.defaults.method||"get").toLowerCase();let i=o&&a.merge(o.common,o[r.method]);o&&a.forEach(["delete","get","head","post","put","patch","common"],l=>{delete o[l]}),r.headers=E.concat(i,o);let c=[],p=!0;this.interceptors.request.forEach(function(h){if(typeof h.runWhen=="function"&&h.runWhen(r)===!1)return;p=p&&h.synchronous;let d=r.transitional||z;d&&d.legacyInterceptorReqResOrdering?c.unshift(h.fulfilled,h.rejected):c.push(h.fulfilled,h.rejected)});let f=[];this.interceptors.response.forEach(function(h){f.push(h.fulfilled,h.rejected)});let u,m=0,y;if(!p){let l=[Se.bind(this),void 0];for(l.unshift(...c),l.push(...f),y=l.length,u=Promise.resolve(r);m<y;)u=u.then(l[m++],l[m++]);return u}y=c.length;let x=r;for(;m<y;){let l=c[m++],h=c[m++];try{x=l(x)}catch(d){h.call(this,d);break}}try{u=Se.call(this,x)}catch(l){return Promise.reject(l)}for(m=0,y=f.length;m<y;)u=u.then(f[m++],f[m++]);return u}getUri(e){e=F(this.defaults,e);let r=oe(e.baseURL,e.url,e.allowAbsoluteUrls);return ee(r,e.params,e.paramsSerializer)}};a.forEach(["delete","get","head","options"],function(e){W.prototype[e]=function(r,n){return this.request(F(n||{},{method:e,url:r,data:(n||{}).data}))}});a.forEach(["post","put","patch"],function(e){function r(n){return function(o,i,c){return this.request(F(c||{},{method:e,headers:n?{"Content-Type":"multipart/form-data"}:{},url:o,data:i}))}}W.prototype[e]=r(),W.prototype[e+"Form"]=r(!0)});var ae=W;var Qe=class t{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let r;this.promise=new Promise(function(o){r=o});let n=this;this.promise.then(s=>{if(!n._listeners)return;let o=n._listeners.length;for(;o-- >0;)n._listeners[o](s);n._listeners=null}),this.promise.then=s=>{let o,i=new Promise(c=>{n.subscribe(c),o=c}).then(s);return i.cancel=function(){n.unsubscribe(o)},i},e(function(o,i,c){n.reason||(n.reason=new L(o,i,c),r(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;let r=this._listeners.indexOf(e);r!==-1&&this._listeners.splice(r,1)}toAbortSignal(){let e=new AbortController,r=n=>{e.abort(n)};return this.subscribe(r),e.signal.unsubscribe=()=>this.unsubscribe(r),e.signal}static source(){let e;return{token:new t(function(s){e=s}),cancel:e}}},Ht=Qe;function Ye(t){return function(r){return t.apply(null,r)}}function Ze(t){return a.isObject(t)&&t.isAxiosError===!0}var et={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(et).forEach(([t,e])=>{et[e]=t});var $t=et;function vt(t){let e=new ae(t),r=G(ae.prototype.request,e);return a.extend(r,ae.prototype,e,{allOwnKeys:!0}),a.extend(r,e,null,{allOwnKeys:!0}),r.create=function(s){return vt(F(t,s))},r}var R=vt(J);R.Axios=ae;R.CanceledError=L;R.CancelToken=Ht;R.isCancel=ne;R.VERSION=xe;R.toFormData=k;R.AxiosError=g;R.Cancel=R.CanceledError;R.all=function(e){return Promise.all(e)};R.spread=Ye;R.isAxiosError=Ze;R.mergeConfig=F;R.AxiosHeaders=E;R.formToJSON=t=>ye(a.isHTMLForm(t)?new FormData(t):t);R.getAdapter=Ee.getAdapter;R.HttpStatusCode=$t;R.default=R;var Oe=R;var{Axios:pi,AxiosError:mi,CanceledError:hi,isCancel:gi,CancelToken:yi,VERSION:bi,all:wi,Cancel:Ri,isAxiosError:Ei,spread:Si,toFormData:xi,AxiosHeaders:Ai,HttpStatusCode:Oi,formToJSON:Ti,getAdapter:Pi,mergeConfig:Ci}=Oe;var Te=class{constructor(e){this.blog={getAll:async e=>(await this.api.get("/content/posts",{params:e})).data,getBySlug:async e=>(await this.api.get(`/content/posts/${encodeURIComponent(e)}`)).data,getById:async e=>(await this.api.get(`/content/posts/${e}`)).data};this.gallery={getAll:async e=>(await this.api.get("/content/images",{params:e})).data,getById:async e=>(await this.api.get(`/content/images/${e}`)).data};this.services={getAll:async e=>(await this.api.get("/content/services",{params:e})).data,getBySlug:async e=>(await this.api.get(`/content/services/${encodeURIComponent(e)}`)).data};this.forms={submit:async e=>(await this.api.post("/forms/submit",e)).data};this.admin={posts:{getAll:async()=>(await this.api.get("/admin/posts")).data,getById:async e=>(await this.api.get(`/admin/posts/${e}`)).data,create:async e=>(await this.api.post("/admin/posts",e)).data,update:async(e,r)=>(await this.api.put(`/admin/posts/${e}`,r)).data,delete:async e=>(await this.api.delete(`/admin/posts/${e}`)).data,publish:async e=>(await this.api.patch(`/admin/posts/${e}/publish`)).data,unpublish:async e=>(await this.api.patch(`/admin/posts/${e}/unpublish`)).data,duplicate:async e=>(await this.api.post(`/admin/posts/${e}/duplicate`)).data,bulkDelete:async e=>(await this.api.post("/admin/posts/bulk-delete",{ids:e})).data},services:{getAll:async()=>(await this.api.get("/admin/services")).data,getById:async e=>(await this.api.get(`/admin/services/${e}`)).data,create:async e=>(await this.api.post("/admin/services",e)).data,update:async(e,r)=>(await this.api.put(`/admin/services/${e}`,r)).data,delete:async e=>(await this.api.delete(`/admin/services/${e}`)).data,duplicate:async e=>(await this.api.post(`/admin/services/${e}/duplicate`)).data,bulkDelete:async e=>(await this.api.post("/admin/services/bulk-delete",{ids:e})).data},images:{getAll:async()=>(await this.api.get("/admin/images")).data,getById:async e=>(await this.api.get(`/admin/images/${e}`)).data,upload:async e=>(await this.api.post("/admin/images",e)).data,bulkUpload:async e=>(await this.api.post("/admin/images/bulk-upload",e)).data,update:async(e,r)=>(await this.api.put(`/admin/images/${e}`,r)).data,delete:async e=>(await this.api.delete(`/admin/images/${e}`)).data,bulkDelete:async e=>(await this.api.post("/admin/images/bulk-delete",{ids:e})).data,updateVisibility:async(e,r)=>(await this.api.patch("/admin/images/bulk-visibility",{ids:e,isVisible:r})).data,updateCategory:async(e,r)=>(await this.api.patch("/admin/images/bulk-category",{ids:e,category:r})).data},projects:{getAll:async()=>(await this.api.get("/admin/projects")).data,getById:async e=>(await this.api.get(`/admin/projects/${e}`)).data,create:async e=>(await this.api.post("/admin/projects",e)).data,update:async(e,r)=>(await this.api.put(`/admin/projects/${e}`,r)).data,delete:async e=>(await this.api.delete(`/admin/projects/${e}`)).data,regenerateKey:async e=>(await this.api.post(`/admin/projects/${e}/regenerate-key`)).data},users:{getAll:async()=>(await this.api.get("/admin/users")).data,getById:async e=>(await this.api.get(`/admin/users/${e}`)).data,create:async e=>(await this.api.post("/admin/users",e)).data,update:async(e,r)=>(await this.api.put(`/admin/users/${e}`,r)).data,delete:async e=>(await this.api.delete(`/admin/users/${e}`)).data,updatePermissions:async(e,r)=>(await this.api.patch(`/admin/users/${e}/permissions`,r)).data},settings:{get:async()=>(await this.api.get("/admin/settings")).data,update:async e=>(await this.api.put("/admin/settings",e)).data},getStats:async()=>(await this.api.get("/admin/stats")).data,login:async e=>{let r=await this.api.post("/admin/login",e);return this.api.defaults.headers.common.Authorization=`Bearer ${r.data.token}`,r.data},setToken:e=>{this.api.defaults.headers.common.Authorization=`Bearer ${e}`},getMe:async()=>(await this.api.get("/admin/me")).data,backup:async()=>(await this.api.post("/admin/backup")).data,restore:async e=>(await this.api.post("/admin/restore",e)).data};let r=e.baseUrl||"https://api.quantum.core.arisnetxsolutions.com/api/v1";this.api=Oe.create({baseURL:r,headers:{"X-API-KEY":e.apiKey}})}getImageUrl(e){if(!e)return"";if(e.startsWith("http"))return e;let n=(this.api.defaults.baseURL||"https://api.quantum.core.arisnetxsolutions.com/api/v1").split("/api/v1")[0],s=e.startsWith("/")?e:`/${e}`;return`${n}${s}`}};typeof window<"u"&&(window.QuantumCore=Te);})();
|
package/dist/types.d.ts
CHANGED
|
@@ -247,3 +247,16 @@ export interface Service {
|
|
|
247
247
|
createdAt: string;
|
|
248
248
|
updatedAt: string;
|
|
249
249
|
}
|
|
250
|
+
export interface FormSubmissionRequest {
|
|
251
|
+
formId: string;
|
|
252
|
+
name?: string;
|
|
253
|
+
nombre?: string;
|
|
254
|
+
email?: string;
|
|
255
|
+
correo?: string;
|
|
256
|
+
[key: string]: any;
|
|
257
|
+
}
|
|
258
|
+
export interface FormSubmissionResponse {
|
|
259
|
+
success: boolean;
|
|
260
|
+
message: string;
|
|
261
|
+
submissionId: number;
|
|
262
|
+
}
|
package/package.json
CHANGED
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arisnetxsolutions/quantum-core-sdk",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "",
|
|
3
|
+
"version": "1.2.1",
|
|
4
|
+
"description": "QuantumCore CMS SDK for JavaScript and TypeScript",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
|
+
"jsdelivr": "dist/quantum-core-sdk.min.js",
|
|
6
7
|
"types": "dist/index.d.ts",
|
|
8
|
+
"publishConfig": {
|
|
9
|
+
"access": "public",
|
|
10
|
+
"registry": "https://registry.npmjs.org/"
|
|
11
|
+
},
|
|
7
12
|
"scripts": {
|
|
8
13
|
"build": "npx tsc",
|
|
9
|
-
"
|
|
14
|
+
"build:cdn": "esbuild src/cdn.ts --bundle --minify --format=iife --outfile=dist/quantum-core-sdk.min.js",
|
|
15
|
+
"publish": "npm publish"
|
|
10
16
|
},
|
|
11
17
|
"keywords": [],
|
|
12
18
|
"author": "",
|
|
@@ -17,6 +23,7 @@
|
|
|
17
23
|
"typescript": "^5.9.3"
|
|
18
24
|
},
|
|
19
25
|
"devDependencies": {
|
|
20
|
-
"@types/node": "^25.4.0"
|
|
26
|
+
"@types/node": "^25.4.0",
|
|
27
|
+
"esbuild": "^0.27.4"
|
|
21
28
|
}
|
|
22
29
|
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
|
|
4
|
+
<head>
|
|
5
|
+
<meta charset="UTF-8">
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
7
|
+
<title>QuantumCore SDK CDN Test</title>
|
|
8
|
+
</head>
|
|
9
|
+
|
|
10
|
+
<body>
|
|
11
|
+
<h1>QuantumCore SDK CDN Test</h1>
|
|
12
|
+
<p>Check the console for results.</p>
|
|
13
|
+
|
|
14
|
+
<!-- Load the SDK -->
|
|
15
|
+
<script src="../dist/quantum-core-sdk.min.js"></script>
|
|
16
|
+
|
|
17
|
+
<script>
|
|
18
|
+
console.log('SDK Loaded:', typeof QuantumCore);
|
|
19
|
+
|
|
20
|
+
try {
|
|
21
|
+
const qc = new QuantumCore({
|
|
22
|
+
baseUrl: 'https://api.quantum.core.arisnetxsolutions.com/api/v1',
|
|
23
|
+
apiKey: 'cce598d37b8e1f59e91ab0f709aa8571d20f51d7f8ddadfd6db9df481df1979f'
|
|
24
|
+
});
|
|
25
|
+
console.log('SDK Instance created:', qc);
|
|
26
|
+
console.log('Test method getImageUrl:', qc.getImageUrl('/test.png'));
|
|
27
|
+
} catch (error) {
|
|
28
|
+
console.error('Error during SDK test:', error);
|
|
29
|
+
}
|
|
30
|
+
</script>
|
|
31
|
+
</body>
|
|
32
|
+
|
|
33
|
+
</html>
|