zenit-sdk 0.0.8 → 0.0.9
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 +32 -0
- package/dist/{chunk-52CLFD4L.mjs → chunk-PCTRVN4O.mjs} +1075 -1004
- package/dist/chunk-PCTRVN4O.mjs.map +1 -0
- package/dist/{index-kGwfqTc_.d.mts → index-DvcYGhqj.d.mts} +70 -4
- package/dist/{index-kGwfqTc_.d.ts → index-DvcYGhqj.d.ts} +70 -4
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1218 -1026
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +119 -1
- package/dist/index.mjs.map +1 -1
- package/dist/react/index.d.mts +1 -1
- package/dist/react/index.d.ts +1 -1
- package/dist/react/index.js +1077 -1006
- package/dist/react/index.js.map +1 -1
- package/dist/react/index.mjs +1 -1
- package/package.json +10 -7
- package/dist/chunk-52CLFD4L.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -69,6 +69,38 @@ async function demoSdk() {
|
|
|
69
69
|
}
|
|
70
70
|
```
|
|
71
71
|
|
|
72
|
+
### Runtime config (WebView / host) + filtros
|
|
73
|
+
El cliente ahora permite actualizar configuración y tokens en runtime sin recrear la app:
|
|
74
|
+
|
|
75
|
+
```ts
|
|
76
|
+
import {
|
|
77
|
+
ZenitClient,
|
|
78
|
+
mergeFilters,
|
|
79
|
+
normalizeFilters,
|
|
80
|
+
resolveRuntimeConfig,
|
|
81
|
+
} from 'zenit-sdk';
|
|
82
|
+
|
|
83
|
+
const runtime = resolveRuntimeConfig(window.__ZENIT_RUNTIME_CONFIG__);
|
|
84
|
+
|
|
85
|
+
const client = new ZenitClient({
|
|
86
|
+
baseUrl: runtime?.baseUrl ?? 'https://mi-zenit.com/api/v1',
|
|
87
|
+
accessToken: runtime?.accessToken,
|
|
88
|
+
sdkToken: runtime?.sdkToken,
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
client.setBaseUrl('https://mi-zenit.com/api/v2');
|
|
92
|
+
client.setAccessToken('token-2');
|
|
93
|
+
client.setSdkToken('sdk-2');
|
|
94
|
+
client.setAuth({ accessToken: 'token-3', sdkToken: 'sdk-3' });
|
|
95
|
+
|
|
96
|
+
client.setDefaultFilters(normalizeFilters({ CODREGION: 10 }));
|
|
97
|
+
const filters = mergeFilters(client.getDefaultFilters(), { CODDEPTO: 7 });
|
|
98
|
+
console.log('filters', filters);
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Todos los requests construyen `Authorization` dinámicamente, así que un `setAccessToken()` afecta a la siguiente
|
|
102
|
+
llamada sin reiniciar el cliente.
|
|
103
|
+
|
|
72
104
|
### Uso básico – Componente React `ZenitMap`
|
|
73
105
|
```tsx
|
|
74
106
|
import React from 'react';
|