webs-sdk 0.2.2 → 0.2.4

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/README.md CHANGED
@@ -1,398 +1,398 @@
1
- # WebsSDK
2
-
3
- SDK completo para aplicaciones web que proporciona funcionalidades esenciales para el desarrollo de aplicaciones modernas.
4
-
5
- ## Instalación
6
-
7
- ```bash
8
- npm install webs-sdk
9
- ```
10
-
11
- ## Uso Básico
12
-
13
- ```javascript
14
- import WebsSDK from 'webs-sdk';
15
-
16
- // Inicializar el SDK
17
- await WebsSDK.Session.init();
18
-
19
- // Realizar una petición de red
20
- const response = await WebsSDK.Networking.request('https://api.example.com/data');
21
-
22
- // Almacenar datos
23
- await WebsSDK.Storage.storeData('user_preferences', { theme: 'dark' });
24
-
25
- // Obtener datos
26
- const preferences = await WebsSDK.Storage.getData('user_preferences');
27
- ```
28
-
29
- ## Librerías Disponibles
30
-
31
- ### 🌐 Networking
32
- Manejo avanzado de peticiones HTTP y comunicación con APIs.
33
-
34
- ```javascript
35
- // Petición básica
36
- const data = await WebsSDK.Networking.request('/api/endpoint', { param: 'value' });
37
-
38
- // Inicialización del SDK
39
- await WebsSDK.Networking.executeInit();
40
-
41
- // Envío de eventos
42
- await WebsSDK.Networking.sendEvent('action', 'button_click', { button_id: 'submit' });
43
-
44
- // Verificar conectividad
45
- const isOnline = await WebsSDK.Networking.checkConnection();
46
-
47
- // Gestión de suscripciones
48
- const subscription = await WebsSDK.Networking.createSubscription(subscriptionData);
49
- const isActive = await WebsSDK.Networking.checkSubscription();
50
- ```
51
-
52
- ### 💾 Storage
53
- Almacenamiento local avanzado con soporte para datos complejos.
54
-
55
- ```javascript
56
- // Métodos básicos
57
- WebsSDK.Storage.set('key', 'value');
58
- const value = WebsSDK.Storage.get('key');
59
-
60
- // Almacenamiento de datos complejos
61
- await WebsSDK.Storage.storeData('complex_data', { user: 'john', age: 30 });
62
- const data = await WebsSDK.Storage.getData('complex_data');
63
-
64
- // Manejo de creaciones (imágenes, archivos)
65
- await WebsSDK.Storage.handleDownloadImageToCreations(base64Image, 'creation_1', metadata);
66
- const creations = await WebsSDK.Storage.getCreations();
67
-
68
- // Compresión de imágenes
69
- const compressedImage = await WebsSDK.Storage.compressImage(imageUri, 2); // 2MB max
70
-
71
- // Descarga de archivos
72
- await WebsSDK.Storage.handleDownloadImage(base64, 'imagen');
73
-
74
- // Compartir archivos
75
- await WebsSDK.Storage.handleShareFile(fileUrl);
76
- ```
77
-
78
- ### 👤 Session
79
- Gestión completa de sesiones de usuario y datos del dispositivo.
80
-
81
- ```javascript
82
- // Inicializar sesión
83
- await WebsSDK.Session.init();
84
-
85
- // Obtener datos de sesión
86
- const sessionData = WebsSDK.Session.getSessionData();
87
- const userID = WebsSDK.Session.getUserID();
88
- const sessionID = WebsSDK.Session.getSessionID();
89
-
90
- // Gestión de suscripciones
91
- await WebsSDK.Session.setIsSubscribed(true);
92
- const isSubscribed = WebsSDK.Session.getIsSubscribed();
93
-
94
- // Información del dispositivo y usuario
95
- const language = WebsSDK.Session.getDeviceLanguage();
96
- const languageRegion = WebsSDK.Session.getDeviceLanguageAndRegion();
97
- const isFirstOpen = WebsSDK.Session.getIsFirstOpen();
98
-
99
- // Gestión de usuarios
100
- WebsSDK.Session.setUserID('user_123');
101
- await WebsSDK.Session.setIsDevUser(true);
102
- ```
103
-
104
- ### 🔧 Utils
105
- Amplia colección de utilidades para desarrollo web.
106
-
107
- ```javascript
108
- // Utilidades de fecha y ID
109
- const id = WebsSDK.Utils.generateId();
110
- const formattedDate = WebsSDK.Utils.formatDate(new Date(), 'DD/MM/YYYY');
111
-
112
- // Validaciones
113
- const isValidEmail = WebsSDK.Utils.isValidEmail('user@example.com');
114
- const isValidUrl = WebsSDK.Utils.isValidUrl('https://example.com');
115
-
116
- // Manipulación de strings
117
- const truncated = WebsSDK.Utils.truncateText('Long text...', 10);
118
- const capitalized = WebsSDK.Utils.capitalizeFirst('hello world');
119
-
120
- // Funciones de tiempo
121
- await WebsSDK.Utils.sleep(1000); // Esperar 1 segundo
122
- const randomNum = WebsSDK.Utils.getRandomInt(1, 100);
123
-
124
- // Manipulación de arrays y objetos
125
- const chunks = WebsSDK.Utils.arrayChunk([1,2,3,4,5], 2);
126
- const unique = WebsSDK.Utils.arrayUnique([1,1,2,3,3]);
127
- const picked = WebsSDK.Utils.objectPick(obj, ['key1', 'key2']);
128
-
129
- // Funciones específicas para web
130
- const deviceInfo = WebsSDK.Utils.getDeviceInfo();
131
- const isMobile = WebsSDK.Utils.isMobile();
132
- const isTablet = WebsSDK.Utils.isTablet();
133
- const isDesktop = WebsSDK.Utils.isDesktop();
134
- const browserInfo = WebsSDK.Utils.getBrowserInfo();
135
-
136
- // Manejo de archivos y datos
137
- const isBase64 = WebsSDK.Utils.isBase64(string);
138
- const isBase64Image = WebsSDK.Utils.isBase64Image(dataUri);
139
- WebsSDK.Utils.downloadFile(data, 'filename.txt', 'text/plain');
140
- await WebsSDK.Utils.copyToClipboard('texto a copiar');
141
-
142
- // Utilidades de formato
143
- const formattedBytes = WebsSDK.Utils.formatBytes(1024); // "1 KB"
144
- const queryParams = WebsSDK.Utils.parseQueryString('?a=1&b=2');
145
- const queryString = WebsSDK.Utils.buildQueryString({a: 1, b: 2});
146
- ```
147
-
148
- ### 📊 MixPanel
149
- Sistema completo de análisis y tracking de eventos.
150
-
151
- ```javascript
152
- // Inicializar MixPanel
153
- await WebsSDK.MixPanel.initialize('your_token', false, false, false);
154
-
155
- // Tracking de eventos
156
- await WebsSDK.MixPanel.trackEvent('page_view', { page: 'home' });
157
- await WebsSDK.MixPanel.trackEventIfExist('special_event', { data: 'value' });
158
-
159
- // Gestión de usuarios
160
- await WebsSDK.MixPanel.identifyUser('user_123');
161
- await WebsSDK.MixPanel.setUserProperties({ plan: 'premium' });
162
- await WebsSDK.MixPanel.resetUserID();
163
-
164
- // Super propiedades
165
- await WebsSDK.MixPanel.superProperties({ app_version: '1.0.0' });
166
- await WebsSDK.MixPanel.superPropertiesAppend({ session_id: 'abc123' });
167
-
168
- // Control de tracking
169
- WebsSDK.MixPanel.disableTracking();
170
- WebsSDK.MixPanel.enableTracking();
171
- const isInitialized = WebsSDK.MixPanel.isMixpanelInitialized();
172
- ```
173
-
174
- ### 🔐 AuthManager
175
- Gestión de autenticación (en desarrollo).
176
-
177
- ### 🌍 I18nManager
178
- Sistema de internacionalización (en desarrollo).
179
-
180
- ### 🚀 Andromeda
181
- Funcionalidades avanzadas (en desarrollo).
182
-
183
- ### 📝 ContentManager
184
- Gestión y obtención de contenido dinámico.
185
-
186
- ```javascript
187
- const content = await WebsSDK.ContentManager.getContentByPreset('homepage', { lang: 'es' });
188
- ```
189
-
190
- ## Configuración
191
-
192
- El SDK incluye configuración completa que puede ser personalizada según tus necesidades:
193
-
194
- ```javascript
195
- // Acceder a la configuración
196
- const config = WebsSDK.Config;
197
-
198
- // Configurar endpoints de API
199
- config.endpoints.CONFIG = 'https://mi-api.com/config';
200
- config.endpoints.USER_CREATE_ID = 'https://mi-api.com/user/create';
201
-
202
- // Configurar MixPanel
203
- config.MIXPANEL.TOKEN = 'tu_token_mixpanel';
204
-
205
- // Configuración de desarrollo
206
- config.DEBUG_MODE = true;
207
-
208
- // Configuración de eventos especiales
209
- config.SPECIAL_EVENTS = ['first_open', 'subscription_purchased'];
210
-
211
- // Configuración de compresión de imágenes
212
- config.IMAGE_COMPRESSION.COMPRESSION = 0.8;
213
- config.IMAGE_COMPRESSION.WIDTH = 1024;
214
- config.IMAGE_COMPRESSION.ACTIVE = true;
215
- ```
216
-
217
- ## Funcionalidades Avanzadas
218
-
219
- ### Gestión de Eventos
220
- ```javascript
221
- // Configurar y enviar eventos personalizados
222
- await WebsSDK.Networking.sendEvent('user_action', 'button_click', {
223
- button_id: 'cta_primary',
224
- page: 'landing',
225
- timestamp: Date.now()
226
- });
227
-
228
- // Eventos pendientes (para cuando no hay conexión)
229
- WebsSDK.Networking.addPendingEvent({
230
- eventType: 'action',
231
- eventKeyword: 'offline_action',
232
- eventData: { action: 'save_draft' }
233
- });
234
-
235
- // Enviar eventos pendientes cuando se restaure la conexión
236
- await WebsSDK.Networking.sendPendingEvents();
237
- ```
238
-
239
- ### Gestión de Archivos e Imágenes
240
- ```javascript
241
- // Comprimir y guardar imágenes
242
- const compressedImage = await WebsSDK.Storage.compressImage(imageFile, 2);
243
- await WebsSDK.Storage.handleDownloadImageToCreations(compressedImage, 'photo_1', {
244
- timestamp: Date.now(),
245
- location: 'homepage'
246
- });
247
-
248
- // Obtener todas las creaciones guardadas
249
- const allCreations = await WebsSDK.Storage.getCreations();
250
-
251
- // Eliminar creaciones específicas
252
- await WebsSDK.Storage.deleteCreation('photo_1');
253
- ```
254
-
255
- ### Información del Dispositivo
256
- ```javascript
257
- // Obtener información completa del dispositivo
258
- const deviceInfo = WebsSDK.Utils.getDeviceInfo();
259
- console.log(deviceInfo);
260
- // {
261
- // userAgent: "Mozilla/5.0...",
262
- // platform: "MacIntel",
263
- // language: "es-ES",
264
- // screenWidth: 1920,
265
- // screenHeight: 1080,
266
- // timezone: "Europe/Madrid"
267
- // }
268
-
269
- // Detectar tipo de dispositivo
270
- if (WebsSDK.Utils.isMobile()) {
271
- // Lógica específica para móviles
272
- } else if (WebsSDK.Utils.isTablet()) {
273
- // Lógica específica para tablets
274
- } else {
275
- // Lógica para desktop
276
- }
277
- ```
278
-
279
- ## Estructura del Proyecto
280
-
281
- ```
282
- src/
283
- ├── config.ts # Configuración central del SDK
284
- ├── index.ts # Punto de entrada principal
285
- ├── libraries/
286
- │ ├── networking.ts # Peticiones HTTP y comunicación
287
- │ ├── storage.ts # Almacenamiento local avanzado
288
- │ ├── session.ts # Gestión de sesiones
289
- │ ├── utils.ts # Utilidades generales
290
- │ ├── mixpanel.ts # Analytics y tracking
291
- │ ├── auth.ts # Autenticación
292
- │ ├── i18n.ts # Internacionalización
293
- │ ├── andromeda.ts # Funcionalidades avanzadas
294
- │ ├── content.ts # Gestión de contenido
295
- │ └── index.ts # Exports de librerías
296
- └── types/
297
- └── index.d.ts # Definiciones de tipos TypeScript
298
- ```
299
-
300
- ## Desarrollo
301
-
302
- ```bash
303
- # Instalar dependencias
304
- npm install
305
-
306
- # Compilar en modo desarrollo con watch
307
- npm run build:watch
308
-
309
- # Compilar para producción
310
- npm run build
311
-
312
- # Ejecutar linting
313
- npm run lint
314
-
315
- # Ejecutar servidor de desarrollo
316
- npm run dev
317
- ```
318
-
319
- ## Publicación
320
-
321
- El proyecto está configurado para ser publicado como módulo npm:
322
-
323
- ```bash
324
- # Compilar y preparar para publicación
325
- npm run prepublishOnly
326
-
327
- # Publicar en npm
328
- npm publish
329
- ```
330
-
331
- ## Compatibilidad
332
-
333
- - **Navegadores**: Chrome 60+, Firefox 55+, Safari 12+, Edge 79+
334
- - **Node.js**: 16+ (para desarrollo)
335
- - **TypeScript**: 5+
336
- - **Frameworks**: Compatible con React, Vue, Angular, Vanilla JS
337
-
338
- ## Ejemplos de Uso
339
-
340
- ### Aplicación Básica
341
- ```javascript
342
- import WebsSDK from 'webs-sdk';
343
-
344
- async function initApp() {
345
- // Inicializar el SDK
346
- await WebsSDK.Session.init();
347
-
348
- // Configurar tracking
349
- await WebsSDK.MixPanel.initialize(process.env.MIXPANEL_TOKEN);
350
-
351
- // Obtener configuración del servidor
352
- const config = await WebsSDK.Networking.request('/api/config');
353
-
354
- // Guardar preferencias del usuario
355
- await WebsSDK.Storage.storeData('app_config', config);
356
-
357
- console.log('App inicializada correctamente');
358
- }
359
-
360
- initApp();
361
- ```
362
-
363
- ### E-commerce
364
- ```javascript
365
- // Tracking de eventos de e-commerce
366
- await WebsSDK.MixPanel.trackEvent('product_viewed', {
367
- product_id: 'ABC123',
368
- category: 'electronics',
369
- price: 299.99
370
- });
371
-
372
- // Gestión de carrito
373
- await WebsSDK.Storage.storeData('cart_items', cartItems);
374
- const savedCart = await WebsSDK.Storage.getData('cart_items');
375
- ```
376
-
377
- ### Aplicación con Suscripciones
378
- ```javascript
379
- // Verificar estado de suscripción
380
- const isSubscribed = await WebsSDK.Session.getIsSubscribed();
381
-
382
- if (!isSubscribed) {
383
- // Mostrar paywall
384
- await WebsSDK.MixPanel.trackEvent('paywall_shown', {
385
- source: 'premium_feature'
386
- });
387
- }
388
-
389
- // Crear nueva suscripción
390
- const subscription = await WebsSDK.Networking.createSubscription({
391
- plan: 'premium_monthly',
392
- user_id: WebsSDK.Session.getUserID()
393
- });
394
- ```
395
-
396
- ## Licencia
397
-
398
- MIT License
1
+ # WebsSDK
2
+
3
+ SDK completo para aplicaciones web que proporciona funcionalidades esenciales para el desarrollo de aplicaciones modernas.
4
+
5
+ ## Instalación
6
+
7
+ ```bash
8
+ npm install webs-sdk
9
+ ```
10
+
11
+ ## Uso Básico
12
+
13
+ ```javascript
14
+ import WebsSDK from 'webs-sdk';
15
+
16
+ // Inicializar el SDK
17
+ await WebsSDK.Session.init();
18
+
19
+ // Realizar una petición de red
20
+ const response = await WebsSDK.Networking.request('https://api.example.com/data');
21
+
22
+ // Almacenar datos
23
+ await WebsSDK.Storage.storeData('user_preferences', { theme: 'dark' });
24
+
25
+ // Obtener datos
26
+ const preferences = await WebsSDK.Storage.getData('user_preferences');
27
+ ```
28
+
29
+ ## Librerías Disponibles
30
+
31
+ ### 🌐 Networking
32
+ Manejo avanzado de peticiones HTTP y comunicación con APIs.
33
+
34
+ ```javascript
35
+ // Petición básica
36
+ const data = await WebsSDK.Networking.request('/api/endpoint', { param: 'value' });
37
+
38
+ // Inicialización del SDK
39
+ await WebsSDK.Networking.executeInit();
40
+
41
+ // Envío de eventos
42
+ await WebsSDK.Networking.sendEvent('action', 'button_click', { button_id: 'submit' });
43
+
44
+ // Verificar conectividad
45
+ const isOnline = await WebsSDK.Networking.checkConnection();
46
+
47
+ // Gestión de suscripciones
48
+ const subscription = await WebsSDK.Networking.createSubscription(subscriptionData);
49
+ const isActive = await WebsSDK.Networking.checkSubscription();
50
+ ```
51
+
52
+ ### 💾 Storage
53
+ Almacenamiento local avanzado con soporte para datos complejos.
54
+
55
+ ```javascript
56
+ // Métodos básicos
57
+ WebsSDK.Storage.set('key', 'value');
58
+ const value = WebsSDK.Storage.get('key');
59
+
60
+ // Almacenamiento de datos complejos
61
+ await WebsSDK.Storage.storeData('complex_data', { user: 'john', age: 30 });
62
+ const data = await WebsSDK.Storage.getData('complex_data');
63
+
64
+ // Manejo de creaciones (imágenes, archivos)
65
+ await WebsSDK.Storage.handleDownloadImageToCreations(base64Image, 'creation_1', metadata);
66
+ const creations = await WebsSDK.Storage.getCreations();
67
+
68
+ // Compresión de imágenes
69
+ const compressedImage = await WebsSDK.Storage.compressImage(imageUri, 2); // 2MB max
70
+
71
+ // Descarga de archivos
72
+ await WebsSDK.Storage.handleDownloadImage(base64, 'imagen');
73
+
74
+ // Compartir archivos
75
+ await WebsSDK.Storage.handleShareFile(fileUrl);
76
+ ```
77
+
78
+ ### 👤 Session
79
+ Gestión completa de sesiones de usuario y datos del dispositivo.
80
+
81
+ ```javascript
82
+ // Inicializar sesión
83
+ await WebsSDK.Session.init();
84
+
85
+ // Obtener datos de sesión
86
+ const sessionData = WebsSDK.Session.getSessionData();
87
+ const userID = WebsSDK.Session.getUserID();
88
+ const sessionID = WebsSDK.Session.getSessionID();
89
+
90
+ // Gestión de suscripciones
91
+ await WebsSDK.Session.setIsSubscribed(true);
92
+ const isSubscribed = WebsSDK.Session.getIsSubscribed();
93
+
94
+ // Información del dispositivo y usuario
95
+ const language = WebsSDK.Session.getDeviceLanguage();
96
+ const languageRegion = WebsSDK.Session.getDeviceLanguageAndRegion();
97
+ const isFirstOpen = WebsSDK.Session.getIsFirstOpen();
98
+
99
+ // Gestión de usuarios
100
+ WebsSDK.Session.setUserID('user_123');
101
+ await WebsSDK.Session.setIsDevUser(true);
102
+ ```
103
+
104
+ ### 🔧 Utils
105
+ Amplia colección de utilidades para desarrollo web.
106
+
107
+ ```javascript
108
+ // Utilidades de fecha y ID
109
+ const id = WebsSDK.Utils.generateId();
110
+ const formattedDate = WebsSDK.Utils.formatDate(new Date(), 'DD/MM/YYYY');
111
+
112
+ // Validaciones
113
+ const isValidEmail = WebsSDK.Utils.isValidEmail('user@example.com');
114
+ const isValidUrl = WebsSDK.Utils.isValidUrl('https://example.com');
115
+
116
+ // Manipulación de strings
117
+ const truncated = WebsSDK.Utils.truncateText('Long text...', 10);
118
+ const capitalized = WebsSDK.Utils.capitalizeFirst('hello world');
119
+
120
+ // Funciones de tiempo
121
+ await WebsSDK.Utils.sleep(1000); // Esperar 1 segundo
122
+ const randomNum = WebsSDK.Utils.getRandomInt(1, 100);
123
+
124
+ // Manipulación de arrays y objetos
125
+ const chunks = WebsSDK.Utils.arrayChunk([1,2,3,4,5], 2);
126
+ const unique = WebsSDK.Utils.arrayUnique([1,1,2,3,3]);
127
+ const picked = WebsSDK.Utils.objectPick(obj, ['key1', 'key2']);
128
+
129
+ // Funciones específicas para web
130
+ const deviceInfo = WebsSDK.Utils.getDeviceInfo();
131
+ const isMobile = WebsSDK.Utils.isMobile();
132
+ const isTablet = WebsSDK.Utils.isTablet();
133
+ const isDesktop = WebsSDK.Utils.isDesktop();
134
+ const browserInfo = WebsSDK.Utils.getBrowserInfo();
135
+
136
+ // Manejo de archivos y datos
137
+ const isBase64 = WebsSDK.Utils.isBase64(string);
138
+ const isBase64Image = WebsSDK.Utils.isBase64Image(dataUri);
139
+ WebsSDK.Utils.downloadFile(data, 'filename.txt', 'text/plain');
140
+ await WebsSDK.Utils.copyToClipboard('texto a copiar');
141
+
142
+ // Utilidades de formato
143
+ const formattedBytes = WebsSDK.Utils.formatBytes(1024); // "1 KB"
144
+ const queryParams = WebsSDK.Utils.parseQueryString('?a=1&b=2');
145
+ const queryString = WebsSDK.Utils.buildQueryString({a: 1, b: 2});
146
+ ```
147
+
148
+ ### 📊 MixPanel
149
+ Sistema completo de análisis y tracking de eventos.
150
+
151
+ ```javascript
152
+ // Inicializar MixPanel
153
+ await WebsSDK.MixPanel.initialize('your_token', false, false, false);
154
+
155
+ // Tracking de eventos
156
+ await WebsSDK.MixPanel.trackEvent('page_view', { page: 'home' });
157
+ await WebsSDK.MixPanel.trackEventIfExist('special_event', { data: 'value' });
158
+
159
+ // Gestión de usuarios
160
+ await WebsSDK.MixPanel.identifyUser('user_123');
161
+ await WebsSDK.MixPanel.setUserProperties({ plan: 'premium' });
162
+ await WebsSDK.MixPanel.resetUserID();
163
+
164
+ // Super propiedades
165
+ await WebsSDK.MixPanel.superProperties({ app_version: '1.0.0' });
166
+ await WebsSDK.MixPanel.superPropertiesAppend({ session_id: 'abc123' });
167
+
168
+ // Control de tracking
169
+ WebsSDK.MixPanel.disableTracking();
170
+ WebsSDK.MixPanel.enableTracking();
171
+ const isInitialized = WebsSDK.MixPanel.isMixpanelInitialized();
172
+ ```
173
+
174
+ ### 🔐 AuthManager
175
+ Gestión de autenticación (en desarrollo).
176
+
177
+ ### 🌍 I18nManager
178
+ Sistema de internacionalización (en desarrollo).
179
+
180
+ ### 🚀 Andromeda
181
+ Funcionalidades avanzadas (en desarrollo).
182
+
183
+ ### 📝 ContentManager
184
+ Gestión y obtención de contenido dinámico.
185
+
186
+ ```javascript
187
+ const content = await WebsSDK.ContentManager.getContentByPreset('homepage', { lang: 'es' });
188
+ ```
189
+
190
+ ## Configuración
191
+
192
+ El SDK incluye configuración completa que puede ser personalizada según tus necesidades:
193
+
194
+ ```javascript
195
+ // Acceder a la configuración
196
+ const config = WebsSDK.Config;
197
+
198
+ // Configurar endpoints de API
199
+ config.endpoints.CONFIG = 'https://mi-api.com/config';
200
+ config.endpoints.USER_CREATE_ID = 'https://mi-api.com/user/create';
201
+
202
+ // Configurar MixPanel
203
+ config.MIXPANEL.TOKEN = 'tu_token_mixpanel';
204
+
205
+ // Configuración de desarrollo
206
+ config.DEBUG_MODE = true;
207
+
208
+ // Configuración de eventos especiales
209
+ config.SPECIAL_EVENTS = ['first_open', 'subscription_purchased'];
210
+
211
+ // Configuración de compresión de imágenes
212
+ config.IMAGE_COMPRESSION.COMPRESSION = 0.8;
213
+ config.IMAGE_COMPRESSION.WIDTH = 1024;
214
+ config.IMAGE_COMPRESSION.ACTIVE = true;
215
+ ```
216
+
217
+ ## Funcionalidades Avanzadas
218
+
219
+ ### Gestión de Eventos
220
+ ```javascript
221
+ // Configurar y enviar eventos personalizados
222
+ await WebsSDK.Networking.sendEvent('user_action', 'button_click', {
223
+ button_id: 'cta_primary',
224
+ page: 'landing',
225
+ timestamp: Date.now()
226
+ });
227
+
228
+ // Eventos pendientes (para cuando no hay conexión)
229
+ WebsSDK.Networking.addPendingEvent({
230
+ eventType: 'action',
231
+ eventKeyword: 'offline_action',
232
+ eventData: { action: 'save_draft' }
233
+ });
234
+
235
+ // Enviar eventos pendientes cuando se restaure la conexión
236
+ await WebsSDK.Networking.sendPendingEvents();
237
+ ```
238
+
239
+ ### Gestión de Archivos e Imágenes
240
+ ```javascript
241
+ // Comprimir y guardar imágenes
242
+ const compressedImage = await WebsSDK.Storage.compressImage(imageFile, 2);
243
+ await WebsSDK.Storage.handleDownloadImageToCreations(compressedImage, 'photo_1', {
244
+ timestamp: Date.now(),
245
+ location: 'homepage'
246
+ });
247
+
248
+ // Obtener todas las creaciones guardadas
249
+ const allCreations = await WebsSDK.Storage.getCreations();
250
+
251
+ // Eliminar creaciones específicas
252
+ await WebsSDK.Storage.deleteCreation('photo_1');
253
+ ```
254
+
255
+ ### Información del Dispositivo
256
+ ```javascript
257
+ // Obtener información completa del dispositivo
258
+ const deviceInfo = WebsSDK.Utils.getDeviceInfo();
259
+ console.log(deviceInfo);
260
+ // {
261
+ // userAgent: "Mozilla/5.0...",
262
+ // platform: "MacIntel",
263
+ // language: "es-ES",
264
+ // screenWidth: 1920,
265
+ // screenHeight: 1080,
266
+ // timezone: "Europe/Madrid"
267
+ // }
268
+
269
+ // Detectar tipo de dispositivo
270
+ if (WebsSDK.Utils.isMobile()) {
271
+ // Lógica específica para móviles
272
+ } else if (WebsSDK.Utils.isTablet()) {
273
+ // Lógica específica para tablets
274
+ } else {
275
+ // Lógica para desktop
276
+ }
277
+ ```
278
+
279
+ ## Estructura del Proyecto
280
+
281
+ ```
282
+ src/
283
+ ├── config.ts # Configuración central del SDK
284
+ ├── index.ts # Punto de entrada principal
285
+ ├── libraries/
286
+ │ ├── networking.ts # Peticiones HTTP y comunicación
287
+ │ ├── storage.ts # Almacenamiento local avanzado
288
+ │ ├── session.ts # Gestión de sesiones
289
+ │ ├── utils.ts # Utilidades generales
290
+ │ ├── mixpanel.ts # Analytics y tracking
291
+ │ ├── auth.ts # Autenticación
292
+ │ ├── i18n.ts # Internacionalización
293
+ │ ├── andromeda.ts # Funcionalidades avanzadas
294
+ │ ├── content.ts # Gestión de contenido
295
+ │ └── index.ts # Exports de librerías
296
+ └── types/
297
+ └── index.d.ts # Definiciones de tipos TypeScript
298
+ ```
299
+
300
+ ## Desarrollo
301
+
302
+ ```bash
303
+ # Instalar dependencias
304
+ npm install
305
+
306
+ # Compilar en modo desarrollo con watch
307
+ npm run build:watch
308
+
309
+ # Compilar para producción
310
+ npm run build
311
+
312
+ # Ejecutar linting
313
+ npm run lint
314
+
315
+ # Ejecutar servidor de desarrollo
316
+ npm run dev
317
+ ```
318
+
319
+ ## Publicación
320
+
321
+ El proyecto está configurado para ser publicado como módulo npm:
322
+
323
+ ```bash
324
+ # Compilar y preparar para publicación
325
+ npm run prepublishOnly
326
+
327
+ # Publicar en npm
328
+ npm publish
329
+ ```
330
+
331
+ ## Compatibilidad
332
+
333
+ - **Navegadores**: Chrome 60+, Firefox 55+, Safari 12+, Edge 79+
334
+ - **Node.js**: 16+ (para desarrollo)
335
+ - **TypeScript**: 5+
336
+ - **Frameworks**: Compatible con React, Vue, Angular, Vanilla JS
337
+
338
+ ## Ejemplos de Uso
339
+
340
+ ### Aplicación Básica
341
+ ```javascript
342
+ import WebsSDK from 'webs-sdk';
343
+
344
+ async function initApp() {
345
+ // Inicializar el SDK
346
+ await WebsSDK.Session.init();
347
+
348
+ // Configurar tracking
349
+ await WebsSDK.MixPanel.initialize(process.env.MIXPANEL_TOKEN);
350
+
351
+ // Obtener configuración del servidor
352
+ const config = await WebsSDK.Networking.request('/api/config');
353
+
354
+ // Guardar preferencias del usuario
355
+ await WebsSDK.Storage.storeData('app_config', config);
356
+
357
+ console.log('App inicializada correctamente');
358
+ }
359
+
360
+ initApp();
361
+ ```
362
+
363
+ ### E-commerce
364
+ ```javascript
365
+ // Tracking de eventos de e-commerce
366
+ await WebsSDK.MixPanel.trackEvent('product_viewed', {
367
+ product_id: 'ABC123',
368
+ category: 'electronics',
369
+ price: 299.99
370
+ });
371
+
372
+ // Gestión de carrito
373
+ await WebsSDK.Storage.storeData('cart_items', cartItems);
374
+ const savedCart = await WebsSDK.Storage.getData('cart_items');
375
+ ```
376
+
377
+ ### Aplicación con Suscripciones
378
+ ```javascript
379
+ // Verificar estado de suscripción
380
+ const isSubscribed = await WebsSDK.Session.getIsSubscribed();
381
+
382
+ if (!isSubscribed) {
383
+ // Mostrar paywall
384
+ await WebsSDK.MixPanel.trackEvent('paywall_shown', {
385
+ source: 'premium_feature'
386
+ });
387
+ }
388
+
389
+ // Crear nueva suscripción
390
+ const subscription = await WebsSDK.Networking.createSubscription({
391
+ plan: 'premium_monthly',
392
+ user_id: WebsSDK.Session.getUserID()
393
+ });
394
+ ```
395
+
396
+ ## Licencia
397
+
398
+ MIT License