@ecomiq/core 0.1.2 → 0.1.3
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/dist/client.cjs +4 -4
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.cts +7 -6
- package/dist/client.d.ts +7 -6
- package/dist/client.js +4 -4
- package/dist/client.js.map +1 -1
- package/dist/index.cjs +4 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +319 -319
- package/dist/index.d.ts +319 -319
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/dist/models/collections.d.cts +4 -4
- package/dist/models/collections.d.ts +4 -4
- package/dist/models/geo.d.cts +14 -14
- package/dist/models/geo.d.ts +14 -14
- package/dist/models/products.d.cts +130 -130
- package/dist/models/products.d.ts +130 -130
- package/dist/models/search.d.cts +4 -4
- package/dist/models/search.d.ts +4 -4
- package/dist/models/settings.d.cts +512 -512
- package/dist/models/settings.d.ts +512 -512
- package/dist/models/storefront-cart.d.cts +80 -80
- package/dist/models/storefront-cart.d.ts +80 -80
- package/dist/models/storefront-checkout.d.cts +384 -384
- package/dist/models/storefront-checkout.d.ts +384 -384
- package/dist/models/storefront-reviews.d.cts +8 -8
- package/dist/models/storefront-reviews.d.ts +8 -8
- package/package.json +1 -1
package/dist/client.d.cts
CHANGED
|
@@ -11,10 +11,11 @@ import 'zod';
|
|
|
11
11
|
|
|
12
12
|
interface CreateClientOptions extends CreateApiOptions {
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
15
|
-
* Debe venir de ecomiq.config.js (`config.
|
|
14
|
+
* Dominio/slug de la tienda (header x-Store-Domain).
|
|
15
|
+
* Debe venir de ecomiq.config.js (`config.domain`).
|
|
16
|
+
* Acepta `marketplace`, `marketplace.ecomiq.app` o `marketplace.pe`.
|
|
16
17
|
*/
|
|
17
|
-
|
|
18
|
+
domain: string;
|
|
18
19
|
settingsCacheTtlMs?: number;
|
|
19
20
|
}
|
|
20
21
|
interface StorefrontClient extends Api {
|
|
@@ -69,11 +70,11 @@ interface StorefrontClient extends Api {
|
|
|
69
70
|
getDistricts(params: GetDistrictsParams): Promise<Districts>;
|
|
70
71
|
}
|
|
71
72
|
/**
|
|
72
|
-
* Crea el cliente storefront de bajo nivel (requiere
|
|
73
|
-
* En apps Ecomiq usa `createClient()` de `@ecomiq/storefront`, que toma el
|
|
73
|
+
* Crea el cliente storefront de bajo nivel (requiere domain).
|
|
74
|
+
* En apps Ecomiq usa `createClient()` de `@ecomiq/storefront`, que toma el domain del config.
|
|
74
75
|
*
|
|
75
76
|
* ```ts
|
|
76
|
-
* const api = createClient({
|
|
77
|
+
* const api = createClient({ domain: 'marketplace' })
|
|
77
78
|
* const collections = await api.getCollections()
|
|
78
79
|
* ```
|
|
79
80
|
*/
|
package/dist/client.d.ts
CHANGED
|
@@ -11,10 +11,11 @@ import 'zod';
|
|
|
11
11
|
|
|
12
12
|
interface CreateClientOptions extends CreateApiOptions {
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
15
|
-
* Debe venir de ecomiq.config.js (`config.
|
|
14
|
+
* Dominio/slug de la tienda (header x-Store-Domain).
|
|
15
|
+
* Debe venir de ecomiq.config.js (`config.domain`).
|
|
16
|
+
* Acepta `marketplace`, `marketplace.ecomiq.app` o `marketplace.pe`.
|
|
16
17
|
*/
|
|
17
|
-
|
|
18
|
+
domain: string;
|
|
18
19
|
settingsCacheTtlMs?: number;
|
|
19
20
|
}
|
|
20
21
|
interface StorefrontClient extends Api {
|
|
@@ -69,11 +70,11 @@ interface StorefrontClient extends Api {
|
|
|
69
70
|
getDistricts(params: GetDistrictsParams): Promise<Districts>;
|
|
70
71
|
}
|
|
71
72
|
/**
|
|
72
|
-
* Crea el cliente storefront de bajo nivel (requiere
|
|
73
|
-
* En apps Ecomiq usa `createClient()` de `@ecomiq/storefront`, que toma el
|
|
73
|
+
* Crea el cliente storefront de bajo nivel (requiere domain).
|
|
74
|
+
* En apps Ecomiq usa `createClient()` de `@ecomiq/storefront`, que toma el domain del config.
|
|
74
75
|
*
|
|
75
76
|
* ```ts
|
|
76
|
-
* const api = createClient({
|
|
77
|
+
* const api = createClient({ domain: 'marketplace' })
|
|
77
78
|
* const collections = await api.getCollections()
|
|
78
79
|
* ```
|
|
79
80
|
*/
|
package/dist/client.js
CHANGED
|
@@ -1157,12 +1157,12 @@ async function getDistricts(api, params) {
|
|
|
1157
1157
|
var DEFAULT_SETTINGS_CACHE_TTL_MS = 3e4;
|
|
1158
1158
|
function createClient(options) {
|
|
1159
1159
|
const {
|
|
1160
|
-
|
|
1160
|
+
domain,
|
|
1161
1161
|
settingsCacheTtlMs = DEFAULT_SETTINGS_CACHE_TTL_MS,
|
|
1162
1162
|
...apiOptions
|
|
1163
1163
|
} = options;
|
|
1164
|
-
if (!
|
|
1165
|
-
throw new Error("createClient requiere `
|
|
1164
|
+
if (!domain?.trim()) {
|
|
1165
|
+
throw new Error("createClient requiere `domain` (config.domain de ecomiq.config.js)");
|
|
1166
1166
|
}
|
|
1167
1167
|
if (!Number.isFinite(settingsCacheTtlMs) || settingsCacheTtlMs < 0) {
|
|
1168
1168
|
throw new Error("settingsCacheTtlMs debe ser un n\xFAmero mayor o igual a 0");
|
|
@@ -1190,7 +1190,7 @@ function createClient(options) {
|
|
|
1190
1190
|
if (inflight) return inflight;
|
|
1191
1191
|
const previous = cache?.data;
|
|
1192
1192
|
inflight = api.get("settings", StorefrontSettingsSchema, {
|
|
1193
|
-
headers: { "x-Store-Domain":
|
|
1193
|
+
headers: { "x-Store-Domain": domain }
|
|
1194
1194
|
}).then((data) => {
|
|
1195
1195
|
cache = { data, expiresAt: Date.now() + settingsCacheTtlMs };
|
|
1196
1196
|
return data;
|