@arisnetxsolutions/quantum-core-sdk 1.0.3 → 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 +167 -54
- package/dist/cdn.d.ts +2 -0
- package/dist/cdn.js +5 -0
- package/dist/index.d.ts +77 -6
- package/dist/index.js +92 -12
- package/dist/quantum-core-sdk.min.js +6 -0
- package/dist/types.d.ts +238 -0
- package/package.json +11 -5
- 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
|
@@ -1,78 +1,191 @@
|
|
|
1
|
-
# QuantumCore SDK 📦
|
|
1
|
+
# QuantumCore SDK 📦 🛡️
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+

|
|
4
|
+

|
|
5
|
+

|
|
6
|
+
|
|
7
|
+
Librería oficial de **QuantumCore CMS** para el consumo de contenido de forma tipada, segura y eficiente. Diseñada especialmente para integraciones con React, Next.js, Vue y cualquier entorno Moderno de JavaScript/TypeScript.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## 🔥 Características Principales
|
|
12
|
+
|
|
13
|
+
- 💎 **Type-Safe**: Aprovecha el poder de TypeScript con interfaces completas para todos tus modelos.
|
|
14
|
+
- 🚀 **Zero Config**: Inicialización rápida con solo tu API Key y URL del servidor.
|
|
15
|
+
- 🔐 **Dual Auth**: Soporta tanto el consumo público (API Keys de Proyecto) como la gestión administrativa (JWT).
|
|
16
|
+
- 🖼️ **Asset Management**: Sistema integrado para obtener URLs absolutas de imágenes y archivos.
|
|
17
|
+
- 📑 **Modular**: Separación clara entre Blog, Servicios, Galería y Funciones Administrativas.
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## ⚙️ Instalación
|
|
22
|
+
|
|
23
|
+
Instala el paquete mediante npm:
|
|
4
24
|
|
|
5
|
-
## Installation
|
|
6
25
|
```bash
|
|
7
|
-
|
|
8
|
-
npm install quantum-core-sdk
|
|
26
|
+
npm install @arisnetxsolutions/quantum-core-sdk
|
|
9
27
|
```
|
|
10
28
|
|
|
11
|
-
## Usage
|
|
12
29
|
|
|
13
|
-
|
|
30
|
+
---
|
|
14
31
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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
|
+
|
|
55
|
+
## 🚀 Inicio Rápido
|
|
56
|
+
|
|
57
|
+
### Inicialización del Cliente
|
|
58
|
+
Obtén tu **API Key** desde el panel de administración de QuantumCore en la sección "Proyectos".
|
|
59
|
+
|
|
60
|
+
```typescript
|
|
61
|
+
import { QuantumCore } from '@arisnetxsolutions/quantum-core-sdk';
|
|
62
|
+
|
|
63
|
+
const qc = new QuantumCore({
|
|
64
|
+
baseUrl: 'https://tu-api.com/api/v1',
|
|
65
|
+
apiKey: 'tu_api_key_de_proyecto'
|
|
66
|
+
});
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## 📖 Módulos de Contenido (Público)
|
|
72
|
+
|
|
73
|
+
### 📰 Blog & Posts
|
|
74
|
+
Obtén tus artículos con soporte para paginación y SEO completo.
|
|
75
|
+
|
|
76
|
+
```typescript
|
|
77
|
+
// Listar todos los posts
|
|
78
|
+
const { data, pagination } = await qc.blog.getAll({ page: 1, limit: 12 });
|
|
79
|
+
|
|
80
|
+
// Obtener detalle por slug (Ideal para rutas dinámicas)
|
|
81
|
+
const post = await qc.blog.getBySlug('el-futuro-del-desarrollo-web');
|
|
82
|
+
|
|
83
|
+
// Obtener por ID
|
|
84
|
+
const postById = await qc.blog.getById(42);
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### 🛠️ Servicios
|
|
88
|
+
Gestiona tu catálogo de servicios, planes de precios y FAQs.
|
|
89
|
+
|
|
90
|
+
```typescript
|
|
91
|
+
// Listar servicios
|
|
92
|
+
const { services } = await qc.services.getAll();
|
|
93
|
+
|
|
94
|
+
// Obtener detalle completo
|
|
95
|
+
const service = await qc.services.getBySlug('desarrollo-personalizado');
|
|
18
96
|
```
|
|
19
97
|
|
|
98
|
+
### 🖼️ Galería de Imágenes
|
|
99
|
+
Acceso directo a tus activos visuales organizados por categorías.
|
|
100
|
+
|
|
20
101
|
```typescript
|
|
21
|
-
|
|
102
|
+
// Obtener imágenes de una categoría específica
|
|
103
|
+
const images = await qc.gallery.getAll({ category: 'Proyectos 2024' });
|
|
22
104
|
|
|
23
|
-
//
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
105
|
+
// Obtener URL absoluta de una imagen del CMS
|
|
106
|
+
const imagePath = images[0].url;
|
|
107
|
+
const fullUrl = qc.getImageUrl(imagePath);
|
|
108
|
+
```
|
|
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)
|
|
27
121
|
});
|
|
28
122
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
123
|
+
console.log('ID de entrega:', result.submissionId);
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
## 🔒 Gestión Administrativa (Auth)
|
|
129
|
+
|
|
130
|
+
El SDK permite realizar operaciones que requieren autenticación de administrador (JWT).
|
|
131
|
+
|
|
132
|
+
```typescript
|
|
133
|
+
// 1. Iniciar sesión para obtener el token
|
|
134
|
+
const { token, user } = await qc.admin.login({
|
|
135
|
+
email: 'admin@empresa.com',
|
|
136
|
+
password: 'tu_password_seguro'
|
|
32
137
|
});
|
|
33
138
|
|
|
34
|
-
|
|
35
|
-
|
|
139
|
+
// El SDK guarda el token automáticamente para futuras peticiones Admin
|
|
140
|
+
|
|
141
|
+
// 2. Crear un nuevo post desde el SDK
|
|
142
|
+
const newPost = await qc.admin.posts.create({
|
|
143
|
+
title: 'Anuncio Importante',
|
|
144
|
+
content: '<p>Contenido detallado...</p>',
|
|
145
|
+
status: 'Published'
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
// 3. Subir archivos
|
|
149
|
+
const formData = new FormData();
|
|
150
|
+
formData.append('image', file);
|
|
151
|
+
const uploadedImage = await qc.admin.images.upload(formData);
|
|
152
|
+
|
|
153
|
+
// 4. Obtener estadísticas globales
|
|
154
|
+
const stats = await qc.admin.getStats();
|
|
36
155
|
```
|
|
37
156
|
|
|
38
|
-
|
|
39
|
-
- **Full Type Safety**: All responses are fully typed.
|
|
40
|
-
- **Axios-based**: Reliable and customizable HTTP client.
|
|
41
|
-
- **Simplified API**: Simple methods for blog and gallery content.
|
|
42
|
-
|
|
43
|
-
## Publishing to npm
|
|
44
|
-
1. Ensure the `name` field in `packages/sdk/package.json` reflects the
|
|
45
|
-
package you intend to publish (currently `quantum-core-sdk`).
|
|
46
|
-
Since this is now an **unscoped** package there is no need to create an npm
|
|
47
|
-
organization or worry about scope permissions; simply pick a name that isn’t
|
|
48
|
-
already taken on the registry. If you ever switch back to a scoped name, the
|
|
49
|
-
rules earlier in this document about creating the scope and having publish
|
|
50
|
-
rights apply.
|
|
51
|
-
`quantum-core-sdk` instead.
|
|
52
|
-
2. Update the version (semantic versioning) and commit the change.
|
|
53
|
-
3. Run `npm run build` to regenerate `dist/`.
|
|
54
|
-
4. Authenticate using an OTP or a token with 2FA bypass:
|
|
55
|
-
```bash
|
|
56
|
-
# interactive
|
|
57
|
-
npm login
|
|
58
|
-
# you will be prompted for a 2FA code
|
|
157
|
+
---
|
|
59
158
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
159
|
+
## 🛠️ API Reference
|
|
160
|
+
|
|
161
|
+
### Clase `QuantumCore`
|
|
162
|
+
| Método | Descripción |
|
|
163
|
+
| :--- | :--- |
|
|
164
|
+
| `blog` | Acceso a posts y artículos. |
|
|
165
|
+
| `services` | Acceso a catálogo de servicios. |
|
|
166
|
+
| `gallery` | Acceso a imágenes y media. |
|
|
167
|
+
| `forms` | Envío y captura de datos de formularios. |
|
|
168
|
+
| `admin` | Operaciones CRUD y configuración (Requiere Auth). |
|
|
169
|
+
| `getImageUrl(path)` | Convierte un path relativo en una URL absoluta funcional. |
|
|
170
|
+
|
|
171
|
+
---
|
|
172
|
+
|
|
173
|
+
## 🏗️ Desarrollo & Publicación
|
|
174
|
+
|
|
175
|
+
Para contribuidores o actualizaciones del SDK:
|
|
176
|
+
|
|
177
|
+
1. Modifica el código en `src/`.
|
|
178
|
+
2. Compila el proyecto:
|
|
179
|
+
```bash
|
|
180
|
+
npm run build
|
|
63
181
|
```
|
|
64
|
-
|
|
65
|
-
`--//registry.npmjs.org/:_authToken=$NPM_TOKEN`).
|
|
66
|
-
5. Publish:
|
|
182
|
+
3. Publica en el registro de NPM:
|
|
67
183
|
```bash
|
|
68
|
-
cd packages/sdk
|
|
69
184
|
npm publish --access public
|
|
70
185
|
```
|
|
71
186
|
|
|
72
|
-
|
|
73
|
-
permissions; 403 indicates a 2FA issue.
|
|
74
|
-
The `publish` script in `package.json` currently embeds a token – be
|
|
75
|
-
cautious about committing that to source control.
|
|
187
|
+
---
|
|
76
188
|
|
|
77
|
-
|
|
78
|
-
|
|
189
|
+
## 🛡️ Soporte
|
|
190
|
+
Creado con ❤️ por el equipo de **ArisnetX Solutions**.
|
|
191
|
+
Si encuentras un bug o tienes una sugerencia, contacta con soporte técnico.
|
package/dist/cdn.d.ts
ADDED
package/dist/cdn.js
ADDED
package/dist/index.d.ts
CHANGED
|
@@ -1,26 +1,97 @@
|
|
|
1
|
-
import {
|
|
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);
|
|
5
|
+
getImageUrl(path: string | null | undefined): string;
|
|
5
6
|
blog: {
|
|
6
|
-
getAll: (
|
|
7
|
-
|
|
7
|
+
getAll: (params?: {
|
|
8
|
+
page?: number;
|
|
9
|
+
limit?: number;
|
|
10
|
+
}) => Promise<BlogListResponse>;
|
|
11
|
+
getBySlug: (slug: string) => Promise<BlogDetailResponse>;
|
|
12
|
+
getById: (id: number) => Promise<BlogDetailResponse>;
|
|
8
13
|
};
|
|
9
14
|
gallery: {
|
|
10
|
-
getAll: (
|
|
15
|
+
getAll: (params?: {
|
|
16
|
+
category?: string;
|
|
17
|
+
isVisible?: boolean;
|
|
18
|
+
}) => Promise<Image[]>;
|
|
19
|
+
getById: (id: number) => Promise<Image>;
|
|
20
|
+
};
|
|
21
|
+
services: {
|
|
22
|
+
getAll: (params?: {
|
|
23
|
+
page?: number;
|
|
24
|
+
limit?: number;
|
|
25
|
+
}) => Promise<ServiceListResponse>;
|
|
26
|
+
getBySlug: (slug: string) => Promise<ServiceDetail>;
|
|
27
|
+
};
|
|
28
|
+
forms: {
|
|
29
|
+
submit: (data: FormSubmissionRequest) => Promise<FormSubmissionResponse>;
|
|
11
30
|
};
|
|
12
31
|
admin: {
|
|
13
32
|
posts: {
|
|
14
33
|
getAll: () => Promise<Post[]>;
|
|
34
|
+
getById: (id: number | string) => Promise<Post>;
|
|
15
35
|
create: (data: Partial<Post>) => Promise<Post>;
|
|
16
|
-
|
|
36
|
+
update: (id: number | string, data: Partial<Post>) => Promise<Post>;
|
|
37
|
+
delete: (id: number | string) => Promise<any>;
|
|
38
|
+
publish: (id: number | string) => Promise<any>;
|
|
39
|
+
unpublish: (id: number | string) => Promise<any>;
|
|
40
|
+
duplicate: (id: number | string) => Promise<any>;
|
|
41
|
+
bulkDelete: (ids: (number | string)[]) => Promise<any>;
|
|
42
|
+
};
|
|
43
|
+
services: {
|
|
44
|
+
getAll: () => Promise<Service[]>;
|
|
45
|
+
getById: (id: number | string) => Promise<Service>;
|
|
46
|
+
create: (data: Partial<Service>) => Promise<Service>;
|
|
47
|
+
update: (id: number | string, data: Partial<Service>) => Promise<Service>;
|
|
48
|
+
delete: (id: number | string) => Promise<any>;
|
|
49
|
+
duplicate: (id: number | string) => Promise<any>;
|
|
50
|
+
bulkDelete: (ids: (number | string)[]) => Promise<any>;
|
|
17
51
|
};
|
|
18
52
|
images: {
|
|
19
53
|
getAll: () => Promise<Image[]>;
|
|
54
|
+
getById: (id: number | string) => Promise<Image>;
|
|
20
55
|
upload: (formData: FormData) => Promise<Image>;
|
|
21
|
-
|
|
56
|
+
bulkUpload: (formData: FormData) => Promise<Image[]>;
|
|
57
|
+
update: (id: number | string, formData: FormData) => Promise<Image>;
|
|
58
|
+
delete: (id: number | string) => Promise<any>;
|
|
59
|
+
bulkDelete: (ids: (number | string)[]) => Promise<any>;
|
|
60
|
+
updateVisibility: (ids: (number | string)[], isVisible: boolean) => Promise<any>;
|
|
61
|
+
updateCategory: (ids: (number | string)[], category: string) => Promise<any>;
|
|
62
|
+
};
|
|
63
|
+
projects: {
|
|
64
|
+
getAll: () => Promise<Project[]>;
|
|
65
|
+
getById: (id: number | string) => Promise<Project>;
|
|
66
|
+
create: (data: Partial<Project>) => Promise<Project>;
|
|
67
|
+
update: (id: number | string, data: Partial<Project>) => Promise<Project>;
|
|
68
|
+
delete: (id: number | string) => Promise<any>;
|
|
69
|
+
regenerateKey: (id: number | string) => Promise<any>;
|
|
70
|
+
};
|
|
71
|
+
users: {
|
|
72
|
+
getAll: () => Promise<User[]>;
|
|
73
|
+
getById: (id: number | string) => Promise<User>;
|
|
74
|
+
create: (data: any) => Promise<User>;
|
|
75
|
+
update: (id: number | string, data: any) => Promise<User>;
|
|
76
|
+
delete: (id: number | string) => Promise<any>;
|
|
77
|
+
updatePermissions: (id: number | string, data: any) => Promise<any>;
|
|
78
|
+
};
|
|
79
|
+
settings: {
|
|
80
|
+
get: () => Promise<any>;
|
|
81
|
+
update: (data: any) => Promise<any>;
|
|
22
82
|
};
|
|
23
83
|
getStats: () => Promise<any>;
|
|
84
|
+
login: (credentials: {
|
|
85
|
+
email: string;
|
|
86
|
+
password: string;
|
|
87
|
+
}) => Promise<{
|
|
88
|
+
token: string;
|
|
89
|
+
user: User;
|
|
90
|
+
}>;
|
|
91
|
+
setToken: (token: string) => void;
|
|
92
|
+
getMe: () => Promise<User>;
|
|
93
|
+
backup: () => Promise<any>;
|
|
94
|
+
restore: (formData: FormData) => Promise<any>;
|
|
24
95
|
};
|
|
25
96
|
}
|
|
26
97
|
export * from './types';
|
package/dist/index.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import axios from 'axios';
|
|
2
|
-
import dotenv from 'dotenv';
|
|
3
|
-
// load variables from .env in development or when running locally
|
|
4
|
-
dotenv.config();
|
|
5
2
|
export class QuantumCore {
|
|
6
3
|
constructor(config) {
|
|
7
4
|
this.blog = {
|
|
8
|
-
getAll: async () => {
|
|
9
|
-
const response = await this.api.get('/content/posts');
|
|
5
|
+
getAll: async (params) => {
|
|
6
|
+
const response = await this.api.get('/content/posts', { params });
|
|
7
|
+
return response.data;
|
|
8
|
+
},
|
|
9
|
+
getBySlug: async (slug) => {
|
|
10
|
+
const response = await this.api.get(`/content/posts/${encodeURIComponent(slug)}`);
|
|
10
11
|
return response.data;
|
|
11
12
|
},
|
|
12
13
|
getById: async (id) => {
|
|
@@ -15,29 +16,98 @@ export class QuantumCore {
|
|
|
15
16
|
}
|
|
16
17
|
};
|
|
17
18
|
this.gallery = {
|
|
18
|
-
getAll: async () => {
|
|
19
|
-
const response = await this.api.get('/content/images');
|
|
19
|
+
getAll: async (params) => {
|
|
20
|
+
const response = await this.api.get('/content/images', { params });
|
|
21
|
+
return response.data;
|
|
22
|
+
},
|
|
23
|
+
getById: async (id) => {
|
|
24
|
+
const response = await this.api.get(`/content/images/${id}`);
|
|
20
25
|
return response.data;
|
|
21
26
|
}
|
|
22
27
|
};
|
|
23
|
-
|
|
28
|
+
this.services = {
|
|
29
|
+
getAll: async (params) => {
|
|
30
|
+
const response = await this.api.get('/content/services', { params });
|
|
31
|
+
return response.data;
|
|
32
|
+
},
|
|
33
|
+
getBySlug: async (slug) => {
|
|
34
|
+
const response = await this.api.get(`/content/services/${encodeURIComponent(slug)}`);
|
|
35
|
+
return response.data;
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
this.forms = {
|
|
39
|
+
submit: async (data) => {
|
|
40
|
+
const response = await this.api.post('/forms/submit', data);
|
|
41
|
+
return response.data;
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
// Métodos de administración
|
|
24
45
|
this.admin = {
|
|
25
46
|
posts: {
|
|
26
47
|
getAll: async () => (await this.api.get('/admin/posts')).data,
|
|
48
|
+
getById: async (id) => (await this.api.get(`/admin/posts/${id}`)).data,
|
|
27
49
|
create: async (data) => (await this.api.post('/admin/posts', data)).data,
|
|
50
|
+
update: async (id, data) => (await this.api.put(`/admin/posts/${id}`, data)).data,
|
|
28
51
|
delete: async (id) => (await this.api.delete(`/admin/posts/${id}`)).data,
|
|
52
|
+
publish: async (id) => (await this.api.patch(`/admin/posts/${id}/publish`)).data,
|
|
53
|
+
unpublish: async (id) => (await this.api.patch(`/admin/posts/${id}/unpublish`)).data,
|
|
54
|
+
duplicate: async (id) => (await this.api.post(`/admin/posts/${id}/duplicate`)).data,
|
|
55
|
+
bulkDelete: async (ids) => (await this.api.post('/admin/posts/bulk-delete', { ids })).data,
|
|
56
|
+
},
|
|
57
|
+
services: {
|
|
58
|
+
getAll: async () => (await this.api.get('/admin/services')).data,
|
|
59
|
+
getById: async (id) => (await this.api.get(`/admin/services/${id}`)).data,
|
|
60
|
+
create: async (data) => (await this.api.post('/admin/services', data)).data,
|
|
61
|
+
update: async (id, data) => (await this.api.put(`/admin/services/${id}`, data)).data,
|
|
62
|
+
delete: async (id) => (await this.api.delete(`/admin/services/${id}`)).data,
|
|
63
|
+
duplicate: async (id) => (await this.api.post(`/admin/services/${id}/duplicate`)).data,
|
|
64
|
+
bulkDelete: async (ids) => (await this.api.post('/admin/services/bulk-delete', { ids })).data,
|
|
29
65
|
},
|
|
30
66
|
images: {
|
|
31
67
|
getAll: async () => (await this.api.get('/admin/images')).data,
|
|
68
|
+
getById: async (id) => (await this.api.get(`/admin/images/${id}`)).data,
|
|
32
69
|
upload: async (formData) => (await this.api.post('/admin/images', formData)).data,
|
|
70
|
+
bulkUpload: async (formData) => (await this.api.post('/admin/images/bulk-upload', formData)).data,
|
|
71
|
+
update: async (id, formData) => (await this.api.put(`/admin/images/${id}`, formData)).data,
|
|
33
72
|
delete: async (id) => (await this.api.delete(`/admin/images/${id}`)).data,
|
|
73
|
+
bulkDelete: async (ids) => (await this.api.post('/admin/images/bulk-delete', { ids })).data,
|
|
74
|
+
updateVisibility: async (ids, isVisible) => (await this.api.patch('/admin/images/bulk-visibility', { ids, isVisible })).data,
|
|
75
|
+
updateCategory: async (ids, category) => (await this.api.patch('/admin/images/bulk-category', { ids, category })).data,
|
|
76
|
+
},
|
|
77
|
+
projects: {
|
|
78
|
+
getAll: async () => (await this.api.get('/admin/projects')).data,
|
|
79
|
+
getById: async (id) => (await this.api.get(`/admin/projects/${id}`)).data,
|
|
80
|
+
create: async (data) => (await this.api.post('/admin/projects', data)).data,
|
|
81
|
+
update: async (id, data) => (await this.api.put(`/admin/projects/${id}`, data)).data,
|
|
82
|
+
delete: async (id) => (await this.api.delete(`/admin/projects/${id}`)).data,
|
|
83
|
+
regenerateKey: async (id) => (await this.api.post(`/admin/projects/${id}/regenerate-key`)).data,
|
|
84
|
+
},
|
|
85
|
+
users: {
|
|
86
|
+
getAll: async () => (await this.api.get('/admin/users')).data,
|
|
87
|
+
getById: async (id) => (await this.api.get(`/admin/users/${id}`)).data,
|
|
88
|
+
create: async (data) => (await this.api.post('/admin/users', data)).data,
|
|
89
|
+
update: async (id, data) => (await this.api.put(`/admin/users/${id}`, data)).data,
|
|
90
|
+
delete: async (id) => (await this.api.delete(`/admin/users/${id}`)).data,
|
|
91
|
+
updatePermissions: async (id, data) => (await this.api.patch(`/admin/users/${id}/permissions`, data)).data,
|
|
92
|
+
},
|
|
93
|
+
settings: {
|
|
94
|
+
get: async () => (await this.api.get('/admin/settings')).data,
|
|
95
|
+
update: async (data) => (await this.api.put('/admin/settings', data)).data,
|
|
34
96
|
},
|
|
35
97
|
getStats: async () => (await this.api.get('/admin/stats')).data,
|
|
98
|
+
login: async (credentials) => {
|
|
99
|
+
const response = await this.api.post('/admin/login', credentials);
|
|
100
|
+
this.api.defaults.headers.common['Authorization'] = `Bearer ${response.data.token}`;
|
|
101
|
+
return response.data;
|
|
102
|
+
},
|
|
103
|
+
setToken: (token) => {
|
|
104
|
+
this.api.defaults.headers.common['Authorization'] = `Bearer ${token}`;
|
|
105
|
+
},
|
|
106
|
+
getMe: async () => (await this.api.get('/admin/me')).data,
|
|
107
|
+
backup: async () => (await this.api.post('/admin/backup')).data,
|
|
108
|
+
restore: async (formData) => (await this.api.post('/admin/restore', formData)).data,
|
|
36
109
|
};
|
|
37
|
-
|
|
38
|
-
const baseURL = config.baseUrl ||
|
|
39
|
-
process.env.QUANTUMCORE_API_URL ||
|
|
40
|
-
'http://localhost:3000/api/v1';
|
|
110
|
+
const baseURL = config.baseUrl || 'https://api.quantum.core.arisnetxsolutions.com/api/v1';
|
|
41
111
|
this.api = axios.create({
|
|
42
112
|
baseURL,
|
|
43
113
|
headers: {
|
|
@@ -45,5 +115,15 @@ export class QuantumCore {
|
|
|
45
115
|
}
|
|
46
116
|
});
|
|
47
117
|
}
|
|
118
|
+
getImageUrl(path) {
|
|
119
|
+
if (!path)
|
|
120
|
+
return '';
|
|
121
|
+
if (path.startsWith('http'))
|
|
122
|
+
return path;
|
|
123
|
+
const baseURL = this.api.defaults.baseURL || 'https://api.quantum.core.arisnetxsolutions.com/api/v1';
|
|
124
|
+
const base = baseURL.split('/api/v1')[0];
|
|
125
|
+
const normalizedPath = path.startsWith('/') ? path : `/${path}`;
|
|
126
|
+
return `${base}${normalizedPath}`;
|
|
127
|
+
}
|
|
48
128
|
}
|
|
49
129
|
export * from './types';
|
|
@@ -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
|
@@ -8,10 +8,96 @@ export interface Post {
|
|
|
8
8
|
createdAt: string;
|
|
9
9
|
updatedAt: string;
|
|
10
10
|
}
|
|
11
|
+
export interface BlogCategory {
|
|
12
|
+
id: string;
|
|
13
|
+
name: string;
|
|
14
|
+
}
|
|
15
|
+
export interface BlogAuthor {
|
|
16
|
+
id: string;
|
|
17
|
+
name: string;
|
|
18
|
+
avatar?: string | null;
|
|
19
|
+
bio?: string | null;
|
|
20
|
+
social?: {
|
|
21
|
+
twitter?: string | null;
|
|
22
|
+
linkedin?: string | null;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
export interface BlogListItem {
|
|
26
|
+
id: string;
|
|
27
|
+
title: string;
|
|
28
|
+
slug: string;
|
|
29
|
+
excerpt: string;
|
|
30
|
+
coverImage: string | null;
|
|
31
|
+
category: BlogCategory | null;
|
|
32
|
+
author: Pick<BlogAuthor, 'id' | 'name' | 'avatar'> | null;
|
|
33
|
+
publishedAt: string;
|
|
34
|
+
readingTime: number;
|
|
35
|
+
tags: string[];
|
|
36
|
+
}
|
|
37
|
+
export interface BlogListResponse {
|
|
38
|
+
data: BlogListItem[];
|
|
39
|
+
pagination: {
|
|
40
|
+
page: number;
|
|
41
|
+
limit: number;
|
|
42
|
+
total: number;
|
|
43
|
+
totalPages: number;
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
export interface BlogDetail {
|
|
47
|
+
id: string;
|
|
48
|
+
title: string;
|
|
49
|
+
slug: string;
|
|
50
|
+
content: string;
|
|
51
|
+
coverImage: string | null;
|
|
52
|
+
gallery: string[];
|
|
53
|
+
category: BlogCategory | null;
|
|
54
|
+
author: BlogAuthor | null;
|
|
55
|
+
tags: string[];
|
|
56
|
+
seo: {
|
|
57
|
+
title: string | null;
|
|
58
|
+
description: string | null;
|
|
59
|
+
keywords: string[];
|
|
60
|
+
};
|
|
61
|
+
readingTime: number;
|
|
62
|
+
views: number;
|
|
63
|
+
publishedAt: string;
|
|
64
|
+
updatedAt: string;
|
|
65
|
+
}
|
|
66
|
+
export interface BlogDetailResponse {
|
|
67
|
+
data: BlogDetail;
|
|
68
|
+
}
|
|
11
69
|
export interface Image {
|
|
12
70
|
id: number;
|
|
13
71
|
url: string;
|
|
14
72
|
label?: string;
|
|
73
|
+
alt?: string | null;
|
|
74
|
+
sizes?: {
|
|
75
|
+
thumbnail: {
|
|
76
|
+
url: string | null;
|
|
77
|
+
width: number | null;
|
|
78
|
+
height: number | null;
|
|
79
|
+
};
|
|
80
|
+
small: {
|
|
81
|
+
url: string | null;
|
|
82
|
+
width: number | null;
|
|
83
|
+
height: number | null;
|
|
84
|
+
};
|
|
85
|
+
medium: {
|
|
86
|
+
url: string | null;
|
|
87
|
+
width: number | null;
|
|
88
|
+
height: number | null;
|
|
89
|
+
};
|
|
90
|
+
large: {
|
|
91
|
+
url: string | null;
|
|
92
|
+
width: number | null;
|
|
93
|
+
height: number | null;
|
|
94
|
+
};
|
|
95
|
+
original: {
|
|
96
|
+
url: string | null;
|
|
97
|
+
width: number | null;
|
|
98
|
+
height: number | null;
|
|
99
|
+
};
|
|
100
|
+
} | null;
|
|
15
101
|
metaTitle?: string;
|
|
16
102
|
metaDesc?: string;
|
|
17
103
|
projectId: number;
|
|
@@ -22,3 +108,155 @@ export interface SDKConfig {
|
|
|
22
108
|
apiKey: string;
|
|
23
109
|
baseUrl?: string;
|
|
24
110
|
}
|
|
111
|
+
export interface ServiceCategory {
|
|
112
|
+
id: string;
|
|
113
|
+
name: string;
|
|
114
|
+
}
|
|
115
|
+
export interface ServicePricingPlan {
|
|
116
|
+
name: string;
|
|
117
|
+
price: number;
|
|
118
|
+
features: string[];
|
|
119
|
+
}
|
|
120
|
+
export interface ServicePricing {
|
|
121
|
+
startingPrice?: number;
|
|
122
|
+
currency: string;
|
|
123
|
+
pricingModel: 'fixed' | 'hourly' | 'custom';
|
|
124
|
+
plans?: ServicePricingPlan[];
|
|
125
|
+
}
|
|
126
|
+
export interface ServiceImages {
|
|
127
|
+
cover?: string | null;
|
|
128
|
+
gallery: string[];
|
|
129
|
+
}
|
|
130
|
+
export interface ServiceDuration {
|
|
131
|
+
estimated?: string;
|
|
132
|
+
}
|
|
133
|
+
export interface ServiceFAQ {
|
|
134
|
+
question: string;
|
|
135
|
+
answer: string;
|
|
136
|
+
}
|
|
137
|
+
export interface ServiceTestimonial {
|
|
138
|
+
name: string;
|
|
139
|
+
company?: string;
|
|
140
|
+
rating: number;
|
|
141
|
+
comment: string;
|
|
142
|
+
}
|
|
143
|
+
export interface ServiceCTA {
|
|
144
|
+
label: string;
|
|
145
|
+
url: string;
|
|
146
|
+
}
|
|
147
|
+
export interface ServiceSEO {
|
|
148
|
+
title?: string;
|
|
149
|
+
description?: string;
|
|
150
|
+
keywords: string[];
|
|
151
|
+
}
|
|
152
|
+
export interface ServiceListItem {
|
|
153
|
+
id: string;
|
|
154
|
+
slug: string;
|
|
155
|
+
name: string;
|
|
156
|
+
shortDescription: string;
|
|
157
|
+
icon?: string | null;
|
|
158
|
+
coverImage?: string | null;
|
|
159
|
+
priceFrom?: number;
|
|
160
|
+
currency: string;
|
|
161
|
+
category?: string;
|
|
162
|
+
tags: string[];
|
|
163
|
+
featured: boolean;
|
|
164
|
+
rating: number;
|
|
165
|
+
reviews: number;
|
|
166
|
+
cta: ServiceCTA;
|
|
167
|
+
}
|
|
168
|
+
export interface ServiceListResponse {
|
|
169
|
+
services: ServiceListItem[];
|
|
170
|
+
pagination: {
|
|
171
|
+
total: number;
|
|
172
|
+
page: number;
|
|
173
|
+
limit: number;
|
|
174
|
+
totalPages: number;
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
export interface ServiceDetail {
|
|
178
|
+
id: string;
|
|
179
|
+
slug: string;
|
|
180
|
+
name: string;
|
|
181
|
+
shortDescription: string;
|
|
182
|
+
description?: string;
|
|
183
|
+
category?: ServiceCategory | null;
|
|
184
|
+
images: ServiceImages;
|
|
185
|
+
icon?: string | null;
|
|
186
|
+
features: string[];
|
|
187
|
+
technologies: string[];
|
|
188
|
+
pricing: ServicePricing;
|
|
189
|
+
duration: ServiceDuration;
|
|
190
|
+
faq: ServiceFAQ[];
|
|
191
|
+
testimonials: ServiceTestimonial[];
|
|
192
|
+
cta: ServiceCTA;
|
|
193
|
+
seo: ServiceSEO;
|
|
194
|
+
status: 'active' | 'inactive' | 'draft';
|
|
195
|
+
featured: boolean;
|
|
196
|
+
createdAt: string;
|
|
197
|
+
updatedAt: string;
|
|
198
|
+
}
|
|
199
|
+
export interface Project {
|
|
200
|
+
id: number;
|
|
201
|
+
name: string;
|
|
202
|
+
description: string | null;
|
|
203
|
+
apiKey: string;
|
|
204
|
+
url: string | null;
|
|
205
|
+
status: string;
|
|
206
|
+
createdAt: string;
|
|
207
|
+
updatedAt: string;
|
|
208
|
+
}
|
|
209
|
+
export interface User {
|
|
210
|
+
id: number;
|
|
211
|
+
email: string;
|
|
212
|
+
name: string;
|
|
213
|
+
role: 'owner' | 'admin' | 'editor';
|
|
214
|
+
permissions: any;
|
|
215
|
+
createdAt: string;
|
|
216
|
+
updatedAt: string;
|
|
217
|
+
}
|
|
218
|
+
export interface Service {
|
|
219
|
+
id: number;
|
|
220
|
+
name: string;
|
|
221
|
+
slug: string;
|
|
222
|
+
shortDescription: string;
|
|
223
|
+
description: string | null;
|
|
224
|
+
categoryId: string | null;
|
|
225
|
+
categoryName: string | null;
|
|
226
|
+
icon: string | null;
|
|
227
|
+
coverImage: string | null;
|
|
228
|
+
gallery: string[];
|
|
229
|
+
features: string[];
|
|
230
|
+
technologies: string[];
|
|
231
|
+
priceFrom: number | null;
|
|
232
|
+
currency: string;
|
|
233
|
+
pricingModel: string;
|
|
234
|
+
pricingPlans: any[];
|
|
235
|
+
estimatedDuration: string | null;
|
|
236
|
+
faq: any[];
|
|
237
|
+
testimonials: any[];
|
|
238
|
+
ctaLabel: string;
|
|
239
|
+
ctaUrl: string;
|
|
240
|
+
seoTitle: string | null;
|
|
241
|
+
seoDescription: string | null;
|
|
242
|
+
seoKeywords: string[];
|
|
243
|
+
status: string;
|
|
244
|
+
featured: boolean;
|
|
245
|
+
tags: string[];
|
|
246
|
+
projectId: number;
|
|
247
|
+
createdAt: string;
|
|
248
|
+
updatedAt: string;
|
|
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": "",
|
|
@@ -14,10 +20,10 @@
|
|
|
14
20
|
"type": "module",
|
|
15
21
|
"dependencies": {
|
|
16
22
|
"axios": "^1.13.6",
|
|
17
|
-
"dotenv": "^16.0.0",
|
|
18
23
|
"typescript": "^5.9.3"
|
|
19
24
|
},
|
|
20
25
|
"devDependencies": {
|
|
21
|
-
"@types/node": "^25.4.0"
|
|
26
|
+
"@types/node": "^25.4.0",
|
|
27
|
+
"esbuild": "^0.27.4"
|
|
22
28
|
}
|
|
23
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>
|