@ecomiq/core 0.1.1 → 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 +14 -4
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.cts +10 -7
- package/dist/client.d.ts +10 -7
- package/dist/client.js +14 -4
- package/dist/client.js.map +1 -1
- package/dist/index.cjs +15 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -2
- package/dist/index.d.ts +6 -2
- package/dist/index.js +15 -5
- package/dist/index.js.map +1 -1
- package/package.json +7 -8
package/dist/index.cjs
CHANGED
|
@@ -858,6 +858,11 @@ async function getCollections(api) {
|
|
|
858
858
|
async function getCollectionBySlug(api, collectionSlug) {
|
|
859
859
|
return api.get(`collections/${encodeURIComponent(collectionSlug)}`, CollectionSchema);
|
|
860
860
|
}
|
|
861
|
+
|
|
862
|
+
// src/services/page.service.ts
|
|
863
|
+
async function getPageBySlug(api, pageSlug) {
|
|
864
|
+
return api.get(`pages/${encodeURIComponent(pageSlug)}`, CmsPageDetailsDtoSchema);
|
|
865
|
+
}
|
|
861
866
|
var CartBuyerParamsSchema = zod.z.object({
|
|
862
867
|
cartId: zod.z.string().uuid(),
|
|
863
868
|
email: zod.z.string().email(),
|
|
@@ -1193,12 +1198,12 @@ async function getDistricts(api, params) {
|
|
|
1193
1198
|
var DEFAULT_SETTINGS_CACHE_TTL_MS = 3e4;
|
|
1194
1199
|
function createClient(options) {
|
|
1195
1200
|
const {
|
|
1196
|
-
|
|
1201
|
+
domain,
|
|
1197
1202
|
settingsCacheTtlMs = DEFAULT_SETTINGS_CACHE_TTL_MS,
|
|
1198
1203
|
...apiOptions
|
|
1199
1204
|
} = options;
|
|
1200
|
-
if (!
|
|
1201
|
-
throw new Error("createClient requiere `
|
|
1205
|
+
if (!domain?.trim()) {
|
|
1206
|
+
throw new Error("createClient requiere `domain` (config.domain de ecomiq.config.js)");
|
|
1202
1207
|
}
|
|
1203
1208
|
if (!Number.isFinite(settingsCacheTtlMs) || settingsCacheTtlMs < 0) {
|
|
1204
1209
|
throw new Error("settingsCacheTtlMs debe ser un n\xFAmero mayor o igual a 0");
|
|
@@ -1226,7 +1231,7 @@ function createClient(options) {
|
|
|
1226
1231
|
if (inflight) return inflight;
|
|
1227
1232
|
const previous = cache?.data;
|
|
1228
1233
|
inflight = api.get("settings", StorefrontSettingsSchema, {
|
|
1229
|
-
headers: { "x-Store-Domain":
|
|
1234
|
+
headers: { "x-Store-Domain": domain }
|
|
1230
1235
|
}).then((data) => {
|
|
1231
1236
|
cache = { data, expiresAt: Date.now() + settingsCacheTtlMs };
|
|
1232
1237
|
return data;
|
|
@@ -1250,6 +1255,10 @@ function createClient(options) {
|
|
|
1250
1255
|
const client = await apiClient();
|
|
1251
1256
|
return getCollectionBySlug(client, collectionSlug);
|
|
1252
1257
|
}
|
|
1258
|
+
async function getPageBySlug2(pageSlug) {
|
|
1259
|
+
const client = await apiClient();
|
|
1260
|
+
return getPageBySlug(client, pageSlug);
|
|
1261
|
+
}
|
|
1253
1262
|
async function getProducts2(params = {}) {
|
|
1254
1263
|
const client = await apiClient();
|
|
1255
1264
|
return getProducts(client, params);
|
|
@@ -1348,6 +1357,7 @@ function createClient(options) {
|
|
|
1348
1357
|
getStoreId,
|
|
1349
1358
|
getCollections: getCollections2,
|
|
1350
1359
|
getCollectionBySlug: getCollectionBySlug2,
|
|
1360
|
+
getPageBySlug: getPageBySlug2,
|
|
1351
1361
|
clearCache,
|
|
1352
1362
|
getProducts: getProducts2,
|
|
1353
1363
|
getProductBySlug: getProductBySlug2,
|
|
@@ -1591,6 +1601,7 @@ exports.getCountries = getCountries;
|
|
|
1591
1601
|
exports.getDepartments = getDepartments;
|
|
1592
1602
|
exports.getDistricts = getDistricts;
|
|
1593
1603
|
exports.getMenuItems = getMenuItems;
|
|
1604
|
+
exports.getPageBySlug = getPageBySlug;
|
|
1594
1605
|
exports.getProductBySlug = getProductBySlug;
|
|
1595
1606
|
exports.getProducts = getProducts;
|
|
1596
1607
|
exports.getProvinces = getProvinces;
|