@ecomiq/core 0.1.9 → 1.0.0
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/LICENSE +21 -0
- package/README.md +39 -2
- package/dist/_virtual/_rolldown/runtime-C6LprzCP.cjs +22 -0
- package/dist/api.cjs +117 -102
- package/dist/api.d.cts +33 -37
- package/dist/api.d.ts +33 -37
- package/dist/api.js +116 -100
- package/dist/client.cjs +499 -1676
- package/dist/client.d.cts +156 -15
- package/dist/client.d.ts +156 -15
- package/dist/client.js +500 -1675
- package/dist/index.cjs +333 -2092
- package/dist/index.d.cts +53 -1127
- package/dist/index.d.ts +53 -1127
- package/dist/index.js +52 -1895
- package/dist/libs/bounded-read-cache-Abmb5VnJ.js +41 -0
- package/dist/libs/bounded-read-cache-D4644LJo.cjs +41 -0
- package/dist/libs/catalog-link-key-B7l5KZsF.js +9 -0
- package/dist/libs/catalog-link-key-CZTHJBGD.cjs +9 -0
- package/dist/libs/catalog-link-key.d.cts +2 -0
- package/dist/libs/catalog-link-key.d.ts +2 -0
- package/dist/libs/graphql-_6Y8lR_Q.js +49 -0
- package/dist/libs/graphql-selection-Cj51WkJn.cjs +21 -0
- package/dist/libs/graphql-selection-H1RMh6VD.js +21 -0
- package/dist/libs/graphql-selection.d.cts +3 -0
- package/dist/libs/graphql-selection.d.ts +3 -0
- package/dist/libs/graphql-wJH7HaQU.cjs +50 -0
- package/dist/libs/graphql.d.cts +24 -0
- package/dist/libs/graphql.d.ts +24 -0
- package/dist/models/amounts-cKBCecl7.js +5 -0
- package/dist/models/amounts-lmg89eJQ.cjs +4 -0
- package/dist/models/articles-C-4JvT2Z.js +27 -0
- package/dist/models/articles-xHCXLKDK.cjs +30 -0
- package/dist/models/articles.d.cts +46 -0
- package/dist/models/articles.d.ts +46 -0
- package/dist/models/catalog-links-BzJeyBy4.js +80 -0
- package/dist/models/catalog-links-c4LADGf_.cjs +88 -0
- package/dist/models/catalog-links.d.cts +39 -0
- package/dist/models/catalog-links.d.ts +39 -0
- package/dist/models/categories-CKkJY8_P.js +42 -0
- package/dist/models/categories-DZ5i5kwi.cjs +45 -0
- package/dist/models/categories.d.cts +54 -0
- package/dist/models/categories.d.ts +54 -0
- package/dist/models/collections.cjs +13 -22
- package/dist/models/collections.d.cts +23 -56
- package/dist/models/collections.d.ts +23 -56
- package/dist/models/collections.js +12 -20
- package/dist/models/complaint-book-D5INpuI2.cjs +64 -0
- package/dist/models/complaint-book-QpQZe7Xl.js +58 -0
- package/dist/models/complaint-book.d.cts +71 -0
- package/dist/models/complaint-book.d.ts +71 -0
- package/dist/models/customer-address.cjs +39 -38
- package/dist/models/customer-address.d.cts +59 -158
- package/dist/models/customer-address.d.ts +59 -158
- package/dist/models/customer-address.js +38 -36
- package/dist/models/customer-order.cjs +181 -142
- package/dist/models/customer-order.d.cts +430 -858
- package/dist/models/customer-order.d.ts +430 -858
- package/dist/models/customer-order.js +178 -141
- package/dist/models/customer-profile.cjs +121 -118
- package/dist/models/customer-profile.d.cts +89 -174
- package/dist/models/customer-profile.d.ts +89 -174
- package/dist/models/customer-profile.js +121 -116
- package/dist/models/customer-registration-C13knqyv.js +28 -0
- package/dist/models/customer-registration-EZ0yZgGr.cjs +31 -0
- package/dist/models/customer-registration.d.cts +66 -0
- package/dist/models/customer-registration.d.ts +66 -0
- package/dist/models/customer-session-BiX0TXhO.js +41 -0
- package/dist/models/customer-session-JeQiC8Yx.cjs +45 -0
- package/dist/models/customer-session.d.cts +61 -0
- package/dist/models/customer-session.d.ts +61 -0
- package/dist/models/geo.cjs +52 -49
- package/dist/models/geo.d.cts +141 -270
- package/dist/models/geo.d.ts +141 -270
- package/dist/models/geo.js +51 -47
- package/dist/models/ids.cjs +8 -11
- package/dist/models/ids.d.cts +7 -10
- package/dist/models/ids.d.ts +7 -10
- package/dist/models/ids.js +7 -9
- package/dist/models/order-draft-CnHJ0btL.js +37 -0
- package/dist/models/order-draft-PFBZfRRR.cjs +39 -0
- package/dist/models/order-draft.d.cts +51 -0
- package/dist/models/order-draft.d.ts +51 -0
- package/dist/models/order-review--xGlZKtS.cjs +18 -0
- package/dist/models/order-review-egGeCaqB.js +17 -0
- package/dist/models/order-review.d.cts +22 -0
- package/dist/models/order-review.d.ts +22 -0
- package/dist/models/order-status-CS_OeSPY.cjs +66 -0
- package/dist/models/order-status-CgaLkU0M.js +60 -0
- package/dist/models/order-status.d.cts +298 -0
- package/dist/models/order-status.d.ts +298 -0
- package/dist/models/payment-methods--VUUZpMz.js +17 -0
- package/dist/models/payment-methods-CmK08zBM.cjs +19 -0
- package/dist/models/payment-methods.d.cts +28 -0
- package/dist/models/payment-methods.d.ts +28 -0
- package/dist/models/products.cjs +215 -194
- package/dist/models/products.d.cts +612 -1354
- package/dist/models/products.d.ts +612 -1354
- package/dist/models/products.js +211 -187
- package/dist/models/search.cjs +13 -23
- package/dist/models/search.d.cts +21 -51
- package/dist/models/search.d.ts +21 -51
- package/dist/models/search.js +12 -21
- package/dist/models/sellers.cjs +44 -0
- package/dist/models/sellers.d.cts +82 -0
- package/dist/models/sellers.d.ts +82 -0
- package/dist/models/sellers.js +38 -0
- package/dist/models/settings.cjs +205 -236
- package/dist/models/settings.d.cts +853 -6940
- package/dist/models/settings.d.ts +853 -6940
- package/dist/models/settings.js +213 -239
- package/dist/models/storefront-cart.cjs +144 -118
- package/dist/models/storefront-cart.d.cts +246 -706
- package/dist/models/storefront-cart.d.ts +246 -706
- package/dist/models/storefront-cart.js +141 -117
- package/dist/models/storefront-checkout.cjs +212 -297
- package/dist/models/storefront-checkout.d.cts +654 -2449
- package/dist/models/storefront-checkout.d.ts +654 -2449
- package/dist/models/storefront-checkout.js +208 -297
- package/dist/models/storefront-reviews.cjs +58 -43
- package/dist/models/storefront-reviews.d.cts +71 -139
- package/dist/models/storefront-reviews.d.ts +71 -139
- package/dist/models/storefront-reviews.js +55 -42
- package/dist/models/tracking-CiIAhQW0.js +33 -0
- package/dist/models/tracking-wNyzQ6Bp.cjs +36 -0
- package/dist/models/tracking.d.cts +26 -0
- package/dist/models/tracking.d.ts +26 -0
- package/dist/models/urls-B0ZODOwH.cjs +35 -0
- package/dist/models/urls-Dt_dTt4Q.js +33 -0
- package/dist/models/urls.d.cts +201 -0
- package/dist/models/urls.d.ts +201 -0
- package/dist/redirects.cjs +113 -0
- package/dist/redirects.d.cts +11 -0
- package/dist/redirects.d.ts +11 -0
- package/dist/redirects.js +108 -0
- package/dist/services/article.service-DBsOvflH.js +10 -0
- package/dist/services/article.service-zmTkbbPV.cjs +11 -0
- package/dist/services/article.service.d.cts +4 -0
- package/dist/services/article.service.d.ts +4 -0
- package/dist/services/cart.service-B0D8s6jI.cjs +37 -0
- package/dist/services/cart.service-yMCz9oQP.js +33 -0
- package/dist/services/cart.service.d.cts +527 -0
- package/dist/services/cart.service.d.ts +527 -0
- package/dist/services/catalog-link.service-BQ2d-EPX.js +8 -0
- package/dist/services/catalog-link.service-DiB-OVjn.cjs +8 -0
- package/dist/services/category.service-8tieYX2r.js +6 -0
- package/dist/services/category.service-BsSJZV2B.cjs +6 -0
- package/dist/services/checkout.service-CC-3tm2y.js +60 -0
- package/dist/services/checkout.service-CG8KrDNY.cjs +69 -0
- package/dist/services/checkout.service.d.cts +439 -0
- package/dist/services/checkout.service.d.ts +439 -0
- package/dist/services/collection.service-C4QETpuI.js +11 -0
- package/dist/services/collection.service-DHGN3rhs.cjs +12 -0
- package/dist/services/complaint-book.service-C7TxltQe.cjs +13 -0
- package/dist/services/complaint-book.service-DXiVyKdD.js +12 -0
- package/dist/services/complaint-book.service.d.cts +4 -0
- package/dist/services/complaint-book.service.d.ts +4 -0
- package/dist/services/customer-address.service-Ca4qla_R.cjs +51 -0
- package/dist/services/customer-address.service-xEThx7cQ.js +47 -0
- package/dist/services/customer-address.service.d.cts +19 -0
- package/dist/services/customer-address.service.d.ts +19 -0
- package/dist/services/customer-order.service-DLGgT0xa.cjs +54 -0
- package/dist/services/customer-order.service-qHoRBuyX.js +51 -0
- package/dist/services/customer-order.service.d.cts +34 -0
- package/dist/services/customer-order.service.d.ts +34 -0
- package/dist/services/customer-registration.service-C3BNyCHP.cjs +10 -0
- package/dist/services/customer-registration.service-CxcWD2hf.js +9 -0
- package/dist/services/customer-registration.service.d.cts +5 -0
- package/dist/services/customer-registration.service.d.ts +5 -0
- package/dist/services/customer-session.service-4YgfbWRB.js +16 -0
- package/dist/services/customer-session.service-Bd8pLC2v.cjs +19 -0
- package/dist/services/customer.service-BM0NrOxP.cjs +26 -0
- package/dist/services/customer.service-BoU6l2-R.js +25 -0
- package/dist/services/customer.service.d.cts +10 -0
- package/dist/services/customer.service.d.ts +10 -0
- package/dist/services/geo.service-C32R7N8W.js +39 -0
- package/dist/services/geo.service-JeTT3Wun.cjs +42 -0
- package/dist/services/geo.service.d.cts +10 -0
- package/dist/services/geo.service.d.ts +10 -0
- package/dist/services/layout.service-BkvLzl1g.cjs +50 -0
- package/dist/services/layout.service-DmbeMOkK.js +50 -0
- package/dist/services/layout.service.d.cts +9 -0
- package/dist/services/layout.service.d.ts +9 -0
- package/dist/services/order-draft.service-D9gy-OPr.cjs +14 -0
- package/dist/services/order-draft.service-DYPR_pcV.js +13 -0
- package/dist/services/order-draft.service.d.cts +4 -0
- package/dist/services/order-draft.service.d.ts +4 -0
- package/dist/services/order-review.service-BEr-FB6_.cjs +11 -0
- package/dist/services/order-review.service-PdBPUsxE.js +11 -0
- package/dist/services/order-review.service.d.cts +7 -0
- package/dist/services/order-review.service.d.ts +7 -0
- package/dist/services/order-status.service-Cn7dsaJo.cjs +26 -0
- package/dist/services/order-status.service-MC9hVpP-.js +23 -0
- package/dist/services/order-status.service.d.cts +16 -0
- package/dist/services/order-status.service.d.ts +16 -0
- package/dist/services/page.service-CWhWCjMQ.js +7 -0
- package/dist/services/page.service-DmCSeMiR.cjs +7 -0
- package/dist/services/page.service.d.cts +4 -0
- package/dist/services/page.service.d.ts +4 -0
- package/dist/services/payment-method.service-CEt_nB4R.cjs +7 -0
- package/dist/services/payment-method.service-CjKbAsOh.js +7 -0
- package/dist/services/payment-method.service.d.cts +4 -0
- package/dist/services/payment-method.service.d.ts +4 -0
- package/dist/services/product.service-B05Qmbuh.js +35 -0
- package/dist/services/product.service-B7OFZWB1.cjs +37 -0
- package/dist/services/product.service.d.cts +231 -0
- package/dist/services/product.service.d.ts +231 -0
- package/dist/services/review.service-CO2icjpu.cjs +46 -0
- package/dist/services/review.service-De1YkhFp.js +43 -0
- package/dist/services/review.service.d.cts +28 -0
- package/dist/services/review.service.d.ts +28 -0
- package/dist/services/search.service-Bx1zbTHJ.cjs +10 -0
- package/dist/services/search.service-DSBMhaSY.js +10 -0
- package/dist/services/search.service.d.cts +9 -0
- package/dist/services/search.service.d.ts +9 -0
- package/dist/services/seller.service-D11WHhbC.cjs +10 -0
- package/dist/services/seller.service-DUptDTv4.js +9 -0
- package/dist/services/seller.service.d.cts +42 -0
- package/dist/services/seller.service.d.ts +42 -0
- package/dist/services/tracking.service-CPK1B69N.js +11 -0
- package/dist/services/tracking.service-DqOoi8qr.cjs +11 -0
- package/dist/services/tracking.service.d.cts +7 -0
- package/dist/services/tracking.service.d.ts +7 -0
- package/dist/services/url.service-B-nC14Ue.cjs +19 -0
- package/dist/services/url.service-CLW0Tc7S.js +18 -0
- package/dist/storefront-cache-revision.cjs +23 -0
- package/dist/storefront-cache-revision.d.cts +16 -0
- package/dist/storefront-cache-revision.d.ts +16 -0
- package/dist/storefront-cache-revision.js +17 -0
- package/dist/storefront-routes.cjs +14 -0
- package/dist/storefront-routes.d.cts +11 -0
- package/dist/storefront-routes.d.ts +11 -0
- package/dist/storefront-routes.js +12 -0
- package/dist/utils-CDEC5xcY.cjs +139 -0
- package/dist/utils-DK7qa54o.js +136 -0
- package/dist/utils.d.cts +3 -0
- package/dist/utils.d.ts +3 -0
- package/dist/video-links-CbRO0m8V.js +47 -0
- package/dist/video-links-ClryQjPH.cjs +47 -0
- package/dist/video-links.d.cts +7 -0
- package/dist/video-links.d.ts +7 -0
- package/package.json +28 -11
- package/dist/api.cjs.map +0 -1
- package/dist/api.js.map +0 -1
- package/dist/client-Ba1r_uiO.d.ts +0 -195
- package/dist/client-Cqcnv2tC.d.cts +0 -195
- package/dist/client.cjs.map +0 -1
- package/dist/client.js.map +0 -1
- package/dist/index.cjs.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/models/collections.cjs.map +0 -1
- package/dist/models/collections.js.map +0 -1
- package/dist/models/customer-address.cjs.map +0 -1
- package/dist/models/customer-address.js.map +0 -1
- package/dist/models/customer-order.cjs.map +0 -1
- package/dist/models/customer-order.js.map +0 -1
- package/dist/models/customer-profile.cjs.map +0 -1
- package/dist/models/customer-profile.js.map +0 -1
- package/dist/models/geo.cjs.map +0 -1
- package/dist/models/geo.js.map +0 -1
- package/dist/models/ids.cjs.map +0 -1
- package/dist/models/ids.js.map +0 -1
- package/dist/models/products.cjs.map +0 -1
- package/dist/models/products.js.map +0 -1
- package/dist/models/search.cjs.map +0 -1
- package/dist/models/search.js.map +0 -1
- package/dist/models/settings.cjs.map +0 -1
- package/dist/models/settings.js.map +0 -1
- package/dist/models/storefront-cart.cjs.map +0 -1
- package/dist/models/storefront-cart.js.map +0 -1
- package/dist/models/storefront-checkout.cjs.map +0 -1
- package/dist/models/storefront-checkout.js.map +0 -1
- package/dist/models/storefront-reviews.cjs.map +0 -1
- package/dist/models/storefront-reviews.js.map +0 -1
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
import { Api } from "../api.js";
|
|
2
|
+
import { ProductBySlugOptions, ProductsParamsInput, RelatedProductsParams } from "../models/products.js";
|
|
3
|
+
export declare function getProducts(api: Api, params?: ProductsParamsInput): Promise<{
|
|
4
|
+
pageIndex: number;
|
|
5
|
+
pageSize: number;
|
|
6
|
+
totalCount: number;
|
|
7
|
+
totalPages: number;
|
|
8
|
+
products: {
|
|
9
|
+
id: string;
|
|
10
|
+
name: string;
|
|
11
|
+
slug: string;
|
|
12
|
+
url: string;
|
|
13
|
+
productType: string;
|
|
14
|
+
imageUrl: string;
|
|
15
|
+
price: number;
|
|
16
|
+
compareAtPrice: number | null;
|
|
17
|
+
variantCount: number;
|
|
18
|
+
isAvailable: boolean;
|
|
19
|
+
totalInventory: number;
|
|
20
|
+
bundleItemsCount: number;
|
|
21
|
+
brand: string;
|
|
22
|
+
category: string;
|
|
23
|
+
status: string;
|
|
24
|
+
collections: string[];
|
|
25
|
+
tags: string[];
|
|
26
|
+
seller: {
|
|
27
|
+
id: string;
|
|
28
|
+
name: string;
|
|
29
|
+
slug: string;
|
|
30
|
+
} | null;
|
|
31
|
+
options: {
|
|
32
|
+
key: string;
|
|
33
|
+
name: string;
|
|
34
|
+
type?: "checkbox" | "colorPicker" | "datePicker" | "dateTimePicker" | "file" | "input" | "number" | "select" | "textArea" | "timePicker" | "url" | undefined;
|
|
35
|
+
values: {
|
|
36
|
+
key: string;
|
|
37
|
+
name: string;
|
|
38
|
+
value: string;
|
|
39
|
+
valueId?: string | null | undefined;
|
|
40
|
+
valueName?: string | null | undefined;
|
|
41
|
+
type?: "checkbox" | "colorPicker" | "datePicker" | "dateTimePicker" | "file" | "input" | "number" | "select" | "textArea" | "timePicker" | "url" | undefined;
|
|
42
|
+
color?: string | null | undefined;
|
|
43
|
+
imageUrl?: string | null | undefined;
|
|
44
|
+
unit?: string | null | undefined;
|
|
45
|
+
}[];
|
|
46
|
+
}[];
|
|
47
|
+
images: {
|
|
48
|
+
url: string;
|
|
49
|
+
name: string;
|
|
50
|
+
order: number;
|
|
51
|
+
type: "image" | "video";
|
|
52
|
+
}[];
|
|
53
|
+
availableVariantId: string | null;
|
|
54
|
+
}[];
|
|
55
|
+
filters: {
|
|
56
|
+
id: string;
|
|
57
|
+
label: string;
|
|
58
|
+
type: "list" | "price_range";
|
|
59
|
+
values: {
|
|
60
|
+
value: string;
|
|
61
|
+
count: number;
|
|
62
|
+
label: string | null;
|
|
63
|
+
selected: boolean;
|
|
64
|
+
}[];
|
|
65
|
+
min: number | null;
|
|
66
|
+
max: number | null;
|
|
67
|
+
selectedMin: number | null;
|
|
68
|
+
selectedMax: number | null;
|
|
69
|
+
}[];
|
|
70
|
+
}>;
|
|
71
|
+
export declare function getProductBySlug(api: Api, slug: string, options?: ProductBySlugOptions): Promise<{
|
|
72
|
+
id: string;
|
|
73
|
+
name: string;
|
|
74
|
+
slug: string;
|
|
75
|
+
url: string;
|
|
76
|
+
description: string;
|
|
77
|
+
productType: string;
|
|
78
|
+
status: string;
|
|
79
|
+
imageUrl: string;
|
|
80
|
+
price: number;
|
|
81
|
+
compareAtPrice: number | null;
|
|
82
|
+
isAvailable: boolean;
|
|
83
|
+
totalInventory: number;
|
|
84
|
+
brand: string;
|
|
85
|
+
category: string;
|
|
86
|
+
categoryId: string | null;
|
|
87
|
+
tags: string[];
|
|
88
|
+
specifications: {
|
|
89
|
+
key: string;
|
|
90
|
+
name: string;
|
|
91
|
+
value: string;
|
|
92
|
+
valueId?: string | null | undefined;
|
|
93
|
+
valueName?: string | null | undefined;
|
|
94
|
+
type?: "checkbox" | "colorPicker" | "datePicker" | "dateTimePicker" | "file" | "input" | "number" | "select" | "textArea" | "timePicker" | "url" | undefined;
|
|
95
|
+
color?: string | null | undefined;
|
|
96
|
+
imageUrl?: string | null | undefined;
|
|
97
|
+
unit?: string | null | undefined;
|
|
98
|
+
}[];
|
|
99
|
+
variants: {
|
|
100
|
+
id: string | null;
|
|
101
|
+
sku: string;
|
|
102
|
+
status: string;
|
|
103
|
+
price: number;
|
|
104
|
+
compareAtPrice: number | null;
|
|
105
|
+
quantity: number;
|
|
106
|
+
isAvailable: boolean | null;
|
|
107
|
+
requiresShipping: boolean;
|
|
108
|
+
options: {
|
|
109
|
+
key: string;
|
|
110
|
+
name: string;
|
|
111
|
+
value: string;
|
|
112
|
+
valueId?: string | null | undefined;
|
|
113
|
+
valueName?: string | null | undefined;
|
|
114
|
+
type?: "checkbox" | "colorPicker" | "datePicker" | "dateTimePicker" | "file" | "input" | "number" | "select" | "textArea" | "timePicker" | "url" | undefined;
|
|
115
|
+
color?: string | null | undefined;
|
|
116
|
+
imageUrl?: string | null | undefined;
|
|
117
|
+
unit?: string | null | undefined;
|
|
118
|
+
}[];
|
|
119
|
+
images: {
|
|
120
|
+
url: string;
|
|
121
|
+
name: string;
|
|
122
|
+
order: number;
|
|
123
|
+
type: "image" | "video";
|
|
124
|
+
}[];
|
|
125
|
+
}[];
|
|
126
|
+
images: {
|
|
127
|
+
url: string;
|
|
128
|
+
name: string;
|
|
129
|
+
order: number;
|
|
130
|
+
type: "image" | "video";
|
|
131
|
+
}[];
|
|
132
|
+
bundleItems: {
|
|
133
|
+
productId: string;
|
|
134
|
+
variantId: string;
|
|
135
|
+
productName: string;
|
|
136
|
+
variantName: string | null;
|
|
137
|
+
sku: string | null;
|
|
138
|
+
brand: string | null;
|
|
139
|
+
imageUrl: string | null;
|
|
140
|
+
quantity: number;
|
|
141
|
+
available: number;
|
|
142
|
+
allowBackorders: boolean;
|
|
143
|
+
requiresShipping: boolean;
|
|
144
|
+
}[];
|
|
145
|
+
sizeGuide: {
|
|
146
|
+
id: string;
|
|
147
|
+
name: string;
|
|
148
|
+
slug: string;
|
|
149
|
+
description: string | null;
|
|
150
|
+
imageUrl: string | null;
|
|
151
|
+
gender: string;
|
|
152
|
+
measurementType: string;
|
|
153
|
+
unit: string;
|
|
154
|
+
notes: string | null;
|
|
155
|
+
rows: {
|
|
156
|
+
label: string;
|
|
157
|
+
sizeKey: string;
|
|
158
|
+
order: number;
|
|
159
|
+
measurements: {
|
|
160
|
+
key: string;
|
|
161
|
+
name: string;
|
|
162
|
+
min: number | null;
|
|
163
|
+
max: number | null;
|
|
164
|
+
value: number | null;
|
|
165
|
+
description: string | null;
|
|
166
|
+
}[];
|
|
167
|
+
}[];
|
|
168
|
+
} | null;
|
|
169
|
+
priceTiers: {
|
|
170
|
+
variantId: string;
|
|
171
|
+
minQuantity: number;
|
|
172
|
+
maxQuantity: number | null;
|
|
173
|
+
unitPrice: number;
|
|
174
|
+
}[];
|
|
175
|
+
createdAt: string | null;
|
|
176
|
+
updatedAt: string | null;
|
|
177
|
+
seller: {
|
|
178
|
+
id: string;
|
|
179
|
+
name: string;
|
|
180
|
+
slug: string;
|
|
181
|
+
} | null;
|
|
182
|
+
isPreview: boolean;
|
|
183
|
+
template: string | null;
|
|
184
|
+
}>;
|
|
185
|
+
export declare function getRelatedProducts(api: Api, params: RelatedProductsParams): Promise<{
|
|
186
|
+
id: string;
|
|
187
|
+
name: string;
|
|
188
|
+
slug: string;
|
|
189
|
+
url: string;
|
|
190
|
+
productType: string;
|
|
191
|
+
imageUrl: string;
|
|
192
|
+
price: number;
|
|
193
|
+
compareAtPrice: number | null;
|
|
194
|
+
variantCount: number;
|
|
195
|
+
isAvailable: boolean;
|
|
196
|
+
totalInventory: number;
|
|
197
|
+
bundleItemsCount: number;
|
|
198
|
+
brand: string;
|
|
199
|
+
category: string;
|
|
200
|
+
status: string;
|
|
201
|
+
collections: string[];
|
|
202
|
+
tags: string[];
|
|
203
|
+
seller: {
|
|
204
|
+
id: string;
|
|
205
|
+
name: string;
|
|
206
|
+
slug: string;
|
|
207
|
+
} | null;
|
|
208
|
+
options: {
|
|
209
|
+
key: string;
|
|
210
|
+
name: string;
|
|
211
|
+
type?: "checkbox" | "colorPicker" | "datePicker" | "dateTimePicker" | "file" | "input" | "number" | "select" | "textArea" | "timePicker" | "url" | undefined;
|
|
212
|
+
values: {
|
|
213
|
+
key: string;
|
|
214
|
+
name: string;
|
|
215
|
+
value: string;
|
|
216
|
+
valueId?: string | null | undefined;
|
|
217
|
+
valueName?: string | null | undefined;
|
|
218
|
+
type?: "checkbox" | "colorPicker" | "datePicker" | "dateTimePicker" | "file" | "input" | "number" | "select" | "textArea" | "timePicker" | "url" | undefined;
|
|
219
|
+
color?: string | null | undefined;
|
|
220
|
+
imageUrl?: string | null | undefined;
|
|
221
|
+
unit?: string | null | undefined;
|
|
222
|
+
}[];
|
|
223
|
+
}[];
|
|
224
|
+
images: {
|
|
225
|
+
url: string;
|
|
226
|
+
name: string;
|
|
227
|
+
order: number;
|
|
228
|
+
type: "image" | "video";
|
|
229
|
+
}[];
|
|
230
|
+
availableVariantId: string | null;
|
|
231
|
+
}[]>;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
const require_models_storefront_reviews = require("../models/storefront-reviews.cjs");
|
|
2
|
+
// src/services/review.service.ts
|
|
3
|
+
async function listProductReviews(api, params) {
|
|
4
|
+
const input = require_models_storefront_reviews.ListProductReviewsParamsSchema.parse(params);
|
|
5
|
+
return api.get(`products/${encodeURIComponent(input.productId)}/reviews`, require_models_storefront_reviews.StorefrontReviewsSchema, { query: {
|
|
6
|
+
limit: input.limit,
|
|
7
|
+
cursor: input.cursor,
|
|
8
|
+
search: input.search,
|
|
9
|
+
sortBy: input.sortBy,
|
|
10
|
+
sortDirection: input.sortDirection,
|
|
11
|
+
rating: input.rating
|
|
12
|
+
} });
|
|
13
|
+
}
|
|
14
|
+
async function listStoreReviews(api, params = {}) {
|
|
15
|
+
const input = require_models_storefront_reviews.ListStoreReviewsParamsSchema.parse(params);
|
|
16
|
+
return api.get("reviews", require_models_storefront_reviews.StorefrontStoreReviewSchema.array(), { query: {
|
|
17
|
+
limit: input.limit,
|
|
18
|
+
minRating: input.minRating
|
|
19
|
+
} });
|
|
20
|
+
}
|
|
21
|
+
async function createProductReview(api, params) {
|
|
22
|
+
const input = require_models_storefront_reviews.CreateProductReviewParamsSchema.parse(params);
|
|
23
|
+
return api.post(`products/${encodeURIComponent(input.productId)}/reviews`, {
|
|
24
|
+
rating: input.rating,
|
|
25
|
+
content: input.content,
|
|
26
|
+
title: input.title,
|
|
27
|
+
reviewerName: input.reviewerName,
|
|
28
|
+
reviewerEmail: input.reviewerEmail,
|
|
29
|
+
orderId: input.orderId,
|
|
30
|
+
reviewToken: input.reviewToken
|
|
31
|
+
}, require_models_storefront_reviews.StorefrontReviewSchema);
|
|
32
|
+
}
|
|
33
|
+
async function createCustomerProductReview(api, params, options) {
|
|
34
|
+
const input = require_models_storefront_reviews.CreateCustomerProductReviewParamsSchema.parse(params);
|
|
35
|
+
return api.post("customer/reviews", {
|
|
36
|
+
productId: input.productId,
|
|
37
|
+
rating: input.rating,
|
|
38
|
+
content: input.content,
|
|
39
|
+
title: input.title,
|
|
40
|
+
reviewerName: input.reviewerName
|
|
41
|
+
}, require_models_storefront_reviews.StorefrontReviewSchema, options);
|
|
42
|
+
}
|
|
43
|
+
exports.createCustomerProductReview = createCustomerProductReview;
|
|
44
|
+
exports.createProductReview = createProductReview;
|
|
45
|
+
exports.listProductReviews = listProductReviews;
|
|
46
|
+
exports.listStoreReviews = listStoreReviews;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { CreateCustomerProductReviewParamsSchema, CreateProductReviewParamsSchema, ListProductReviewsParamsSchema, ListStoreReviewsParamsSchema, StorefrontReviewSchema, StorefrontReviewsSchema, StorefrontStoreReviewSchema } from "../models/storefront-reviews.js";
|
|
2
|
+
// src/services/review.service.ts
|
|
3
|
+
async function listProductReviews(api, params) {
|
|
4
|
+
const input = ListProductReviewsParamsSchema.parse(params);
|
|
5
|
+
return api.get(`products/${encodeURIComponent(input.productId)}/reviews`, StorefrontReviewsSchema, { query: {
|
|
6
|
+
limit: input.limit,
|
|
7
|
+
cursor: input.cursor,
|
|
8
|
+
search: input.search,
|
|
9
|
+
sortBy: input.sortBy,
|
|
10
|
+
sortDirection: input.sortDirection,
|
|
11
|
+
rating: input.rating
|
|
12
|
+
} });
|
|
13
|
+
}
|
|
14
|
+
async function listStoreReviews(api, params = {}) {
|
|
15
|
+
const input = ListStoreReviewsParamsSchema.parse(params);
|
|
16
|
+
return api.get("reviews", StorefrontStoreReviewSchema.array(), { query: {
|
|
17
|
+
limit: input.limit,
|
|
18
|
+
minRating: input.minRating
|
|
19
|
+
} });
|
|
20
|
+
}
|
|
21
|
+
async function createProductReview(api, params) {
|
|
22
|
+
const input = CreateProductReviewParamsSchema.parse(params);
|
|
23
|
+
return api.post(`products/${encodeURIComponent(input.productId)}/reviews`, {
|
|
24
|
+
rating: input.rating,
|
|
25
|
+
content: input.content,
|
|
26
|
+
title: input.title,
|
|
27
|
+
reviewerName: input.reviewerName,
|
|
28
|
+
reviewerEmail: input.reviewerEmail,
|
|
29
|
+
orderId: input.orderId,
|
|
30
|
+
reviewToken: input.reviewToken
|
|
31
|
+
}, StorefrontReviewSchema);
|
|
32
|
+
}
|
|
33
|
+
async function createCustomerProductReview(api, params, options) {
|
|
34
|
+
const input = CreateCustomerProductReviewParamsSchema.parse(params);
|
|
35
|
+
return api.post("customer/reviews", {
|
|
36
|
+
productId: input.productId,
|
|
37
|
+
rating: input.rating,
|
|
38
|
+
content: input.content,
|
|
39
|
+
title: input.title,
|
|
40
|
+
reviewerName: input.reviewerName
|
|
41
|
+
}, StorefrontReviewSchema, options);
|
|
42
|
+
}
|
|
43
|
+
export { createCustomerProductReview, createProductReview, listProductReviews, listStoreReviews };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Api } from "../api.cjs";
|
|
2
|
+
import { CreateProductReviewParams, ListProductReviewsParams } from "../models/storefront-reviews.cjs";
|
|
3
|
+
import "./customer.service.cjs";
|
|
4
|
+
export declare function listProductReviews(api: Api, params: ListProductReviewsParams): Promise<{
|
|
5
|
+
data: {
|
|
6
|
+
id: string;
|
|
7
|
+
productId: string;
|
|
8
|
+
isVerifiedPurchase: boolean;
|
|
9
|
+
rating: number;
|
|
10
|
+
title: string | null;
|
|
11
|
+
content: string;
|
|
12
|
+
reviewerName: string | null;
|
|
13
|
+
createdOn: string;
|
|
14
|
+
}[];
|
|
15
|
+
hasNextPage: boolean;
|
|
16
|
+
nextCursor: string | null;
|
|
17
|
+
totalCount: number | null;
|
|
18
|
+
}>;
|
|
19
|
+
export declare function createProductReview(api: Api, params: CreateProductReviewParams): Promise<{
|
|
20
|
+
id: string;
|
|
21
|
+
productId: string;
|
|
22
|
+
isVerifiedPurchase: boolean;
|
|
23
|
+
rating: number;
|
|
24
|
+
title: string | null;
|
|
25
|
+
content: string;
|
|
26
|
+
reviewerName: string | null;
|
|
27
|
+
createdOn: string;
|
|
28
|
+
}>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Api } from "../api.js";
|
|
2
|
+
import { CreateProductReviewParams, ListProductReviewsParams } from "../models/storefront-reviews.js";
|
|
3
|
+
import "./customer.service.js";
|
|
4
|
+
export declare function listProductReviews(api: Api, params: ListProductReviewsParams): Promise<{
|
|
5
|
+
data: {
|
|
6
|
+
id: string;
|
|
7
|
+
productId: string;
|
|
8
|
+
isVerifiedPurchase: boolean;
|
|
9
|
+
rating: number;
|
|
10
|
+
title: string | null;
|
|
11
|
+
content: string;
|
|
12
|
+
reviewerName: string | null;
|
|
13
|
+
createdOn: string;
|
|
14
|
+
}[];
|
|
15
|
+
hasNextPage: boolean;
|
|
16
|
+
nextCursor: string | null;
|
|
17
|
+
totalCount: number | null;
|
|
18
|
+
}>;
|
|
19
|
+
export declare function createProductReview(api: Api, params: CreateProductReviewParams): Promise<{
|
|
20
|
+
id: string;
|
|
21
|
+
productId: string;
|
|
22
|
+
isVerifiedPurchase: boolean;
|
|
23
|
+
rating: number;
|
|
24
|
+
title: string | null;
|
|
25
|
+
content: string;
|
|
26
|
+
reviewerName: string | null;
|
|
27
|
+
createdOn: string;
|
|
28
|
+
}>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
const require_models_search = require("../models/search.cjs");
|
|
2
|
+
// src/services/search.service.ts
|
|
3
|
+
async function autocompleteProducts(api, params) {
|
|
4
|
+
const input = require_models_search.ProductAutocompleteParamsSchema.parse(params);
|
|
5
|
+
return api.get("search/autocomplete", require_models_search.ProductSuggestionsSchema, { query: {
|
|
6
|
+
search: input.search,
|
|
7
|
+
limit: input.limit
|
|
8
|
+
} });
|
|
9
|
+
}
|
|
10
|
+
exports.autocompleteProducts = autocompleteProducts;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ProductAutocompleteParamsSchema, ProductSuggestionsSchema } from "../models/search.js";
|
|
2
|
+
// src/services/search.service.ts
|
|
3
|
+
async function autocompleteProducts(api, params) {
|
|
4
|
+
const input = ProductAutocompleteParamsSchema.parse(params);
|
|
5
|
+
return api.get("search/autocomplete", ProductSuggestionsSchema, { query: {
|
|
6
|
+
search: input.search,
|
|
7
|
+
limit: input.limit
|
|
8
|
+
} });
|
|
9
|
+
}
|
|
10
|
+
export { autocompleteProducts };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Api } from "../api.cjs";
|
|
2
|
+
import { ProductAutocompleteParams } from "../models/search.cjs";
|
|
3
|
+
export declare function autocompleteProducts(api: Api, params: ProductAutocompleteParams): Promise<{
|
|
4
|
+
id: string;
|
|
5
|
+
name: string;
|
|
6
|
+
slug: string;
|
|
7
|
+
url: string;
|
|
8
|
+
imageUrl: string;
|
|
9
|
+
}[]>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Api } from "../api.js";
|
|
2
|
+
import { ProductAutocompleteParams } from "../models/search.js";
|
|
3
|
+
export declare function autocompleteProducts(api: Api, params: ProductAutocompleteParams): Promise<{
|
|
4
|
+
id: string;
|
|
5
|
+
name: string;
|
|
6
|
+
slug: string;
|
|
7
|
+
url: string;
|
|
8
|
+
imageUrl: string;
|
|
9
|
+
}[]>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
const require_models_sellers = require("../models/sellers.cjs");
|
|
2
|
+
// src/services/seller.service.ts
|
|
3
|
+
async function getSellers(api) {
|
|
4
|
+
return api.get("sellers", require_models_sellers.SellersSchema);
|
|
5
|
+
}
|
|
6
|
+
async function getSellerBySlug(api, slug) {
|
|
7
|
+
return api.get(`sellers/${encodeURIComponent(slug)}`, require_models_sellers.SellerProfileSchema);
|
|
8
|
+
}
|
|
9
|
+
exports.getSellerBySlug = getSellerBySlug;
|
|
10
|
+
exports.getSellers = getSellers;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { SellerProfileSchema, SellersSchema } from "../models/sellers.js";
|
|
2
|
+
// src/services/seller.service.ts
|
|
3
|
+
async function getSellers(api) {
|
|
4
|
+
return api.get("sellers", SellersSchema);
|
|
5
|
+
}
|
|
6
|
+
async function getSellerBySlug(api, slug) {
|
|
7
|
+
return api.get(`sellers/${encodeURIComponent(slug)}`, SellerProfileSchema);
|
|
8
|
+
}
|
|
9
|
+
export { getSellerBySlug, getSellers };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Api } from "../api.cjs";
|
|
2
|
+
export declare function getSellers(api: Api): Promise<{
|
|
3
|
+
id: string;
|
|
4
|
+
name: string;
|
|
5
|
+
slug: string;
|
|
6
|
+
logo: string | null;
|
|
7
|
+
banner: string | null;
|
|
8
|
+
tagline: string | null;
|
|
9
|
+
verified: boolean;
|
|
10
|
+
rating: {
|
|
11
|
+
average: number;
|
|
12
|
+
totalReviews: number;
|
|
13
|
+
};
|
|
14
|
+
}[]>;
|
|
15
|
+
export declare function getSellerBySlug(api: Api, slug: string): Promise<{
|
|
16
|
+
id: string;
|
|
17
|
+
name: string;
|
|
18
|
+
slug: string;
|
|
19
|
+
logo: string | null;
|
|
20
|
+
banner: string | null;
|
|
21
|
+
tagline: string | null;
|
|
22
|
+
verified: boolean;
|
|
23
|
+
rating: {
|
|
24
|
+
average: number;
|
|
25
|
+
totalReviews: number;
|
|
26
|
+
};
|
|
27
|
+
description: string | null;
|
|
28
|
+
links: {
|
|
29
|
+
website: string | null;
|
|
30
|
+
facebook: string | null;
|
|
31
|
+
instagram: string | null;
|
|
32
|
+
tikTok: string | null;
|
|
33
|
+
youTube: string | null;
|
|
34
|
+
twitter: string | null;
|
|
35
|
+
linkedIn: string | null;
|
|
36
|
+
whatsApp: string | null;
|
|
37
|
+
};
|
|
38
|
+
linkStyle: "icons" | "text";
|
|
39
|
+
memberSince: string;
|
|
40
|
+
deliveryPolicy: string | null;
|
|
41
|
+
privacyAndSecurityPolicy: string | null;
|
|
42
|
+
}>;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Api } from "../api.js";
|
|
2
|
+
export declare function getSellers(api: Api): Promise<{
|
|
3
|
+
id: string;
|
|
4
|
+
name: string;
|
|
5
|
+
slug: string;
|
|
6
|
+
logo: string | null;
|
|
7
|
+
banner: string | null;
|
|
8
|
+
tagline: string | null;
|
|
9
|
+
verified: boolean;
|
|
10
|
+
rating: {
|
|
11
|
+
average: number;
|
|
12
|
+
totalReviews: number;
|
|
13
|
+
};
|
|
14
|
+
}[]>;
|
|
15
|
+
export declare function getSellerBySlug(api: Api, slug: string): Promise<{
|
|
16
|
+
id: string;
|
|
17
|
+
name: string;
|
|
18
|
+
slug: string;
|
|
19
|
+
logo: string | null;
|
|
20
|
+
banner: string | null;
|
|
21
|
+
tagline: string | null;
|
|
22
|
+
verified: boolean;
|
|
23
|
+
rating: {
|
|
24
|
+
average: number;
|
|
25
|
+
totalReviews: number;
|
|
26
|
+
};
|
|
27
|
+
description: string | null;
|
|
28
|
+
links: {
|
|
29
|
+
website: string | null;
|
|
30
|
+
facebook: string | null;
|
|
31
|
+
instagram: string | null;
|
|
32
|
+
tikTok: string | null;
|
|
33
|
+
youTube: string | null;
|
|
34
|
+
twitter: string | null;
|
|
35
|
+
linkedIn: string | null;
|
|
36
|
+
whatsApp: string | null;
|
|
37
|
+
};
|
|
38
|
+
linkStyle: "icons" | "text";
|
|
39
|
+
memberSince: string;
|
|
40
|
+
deliveryPolicy: string | null;
|
|
41
|
+
privacyAndSecurityPolicy: string | null;
|
|
42
|
+
}>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { PublicOrderTrackingSchema } from "../models/tracking-CiIAhQW0.js";
|
|
2
|
+
// src/services/tracking.service.ts
|
|
3
|
+
async function getOrderTracking(api, trackingNumber, options = {}) {
|
|
4
|
+
const code = trackingNumber.trim();
|
|
5
|
+
if (!code) throw new Error("trackingNumber requerido");
|
|
6
|
+
return api.get(`tracking/${encodeURIComponent(code)}`, PublicOrderTrackingSchema, {
|
|
7
|
+
headers: options.headers,
|
|
8
|
+
signal: options.signal
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
export { getOrderTracking };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const require_tracking = require("../models/tracking-wNyzQ6Bp.cjs");
|
|
2
|
+
// src/services/tracking.service.ts
|
|
3
|
+
async function getOrderTracking(api, trackingNumber, options = {}) {
|
|
4
|
+
const code = trackingNumber.trim();
|
|
5
|
+
if (!code) throw new Error("trackingNumber requerido");
|
|
6
|
+
return api.get(`tracking/${encodeURIComponent(code)}`, require_tracking.PublicOrderTrackingSchema, {
|
|
7
|
+
headers: options.headers,
|
|
8
|
+
signal: options.signal
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
exports.getOrderTracking = getOrderTracking;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Api } from "../api.cjs";
|
|
2
|
+
import { PublicOrderTracking } from "../models/tracking.cjs";
|
|
3
|
+
export type TrackingRequestOptions = {
|
|
4
|
+
headers?: Record<string, string>;
|
|
5
|
+
signal?: AbortSignal;
|
|
6
|
+
};
|
|
7
|
+
export declare function getOrderTracking(api: Api, trackingNumber: string, options?: TrackingRequestOptions): Promise<PublicOrderTracking>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Api } from "../api.js";
|
|
2
|
+
import { PublicOrderTracking } from "../models/tracking.js";
|
|
3
|
+
export type TrackingRequestOptions = {
|
|
4
|
+
headers?: Record<string, string>;
|
|
5
|
+
signal?: AbortSignal;
|
|
6
|
+
};
|
|
7
|
+
export declare function getOrderTracking(api: Api, trackingNumber: string, options?: TrackingRequestOptions): Promise<PublicOrderTracking>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const require_api = require("../api.cjs");
|
|
2
|
+
const require_urls = require("../models/urls-B0ZODOwH.cjs");
|
|
3
|
+
// src/services/url.service.ts
|
|
4
|
+
async function resolveUrl(api, path, options = {}) {
|
|
5
|
+
try {
|
|
6
|
+
return await api.get("urls/resolve", require_urls.UrlResolutionSchema, { query: {
|
|
7
|
+
path,
|
|
8
|
+
previewKey: options.previewKey
|
|
9
|
+
} });
|
|
10
|
+
} catch (error) {
|
|
11
|
+
if (error instanceof require_api.ApiError && error.status === 404) return null;
|
|
12
|
+
throw error;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
async function getSitemap(api, page) {
|
|
16
|
+
return api.get("sitemap", require_urls.SitemapPageSchema, { query: { page } });
|
|
17
|
+
}
|
|
18
|
+
exports.getSitemap = getSitemap;
|
|
19
|
+
exports.resolveUrl = resolveUrl;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ApiError } from "../api.js";
|
|
2
|
+
import { SitemapPageSchema, UrlResolutionSchema } from "../models/urls-Dt_dTt4Q.js";
|
|
3
|
+
// src/services/url.service.ts
|
|
4
|
+
async function resolveUrl(api, path, options = {}) {
|
|
5
|
+
try {
|
|
6
|
+
return await api.get("urls/resolve", UrlResolutionSchema, { query: {
|
|
7
|
+
path,
|
|
8
|
+
previewKey: options.previewKey
|
|
9
|
+
} });
|
|
10
|
+
} catch (error) {
|
|
11
|
+
if (error instanceof ApiError && error.status === 404) return null;
|
|
12
|
+
throw error;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
async function getSitemap(api, page) {
|
|
16
|
+
return api.get("sitemap", SitemapPageSchema, { query: { page } });
|
|
17
|
+
}
|
|
18
|
+
export { getSitemap, resolveUrl };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
let zod = require("zod");
|
|
3
|
+
// src/storefront-cache-revision.ts
|
|
4
|
+
const STOREFRONT_CACHE_REVISION_HEADER = "x-ecomiq-cache-revision";
|
|
5
|
+
const STOREFRONT_CACHE_TTL_SECONDS = 30;
|
|
6
|
+
const StorefrontCacheRevisionSchema = zod.z.string().regex(/^[1-9]\d{0,18}$/);
|
|
7
|
+
const StorefrontCacheRevisionDocumentSchema = zod.z.object({
|
|
8
|
+
schemaVersion: zod.z.literal(1),
|
|
9
|
+
storeId: zod.z.string().regex(/^[1-9]\d{0,18}$/),
|
|
10
|
+
revision: StorefrontCacheRevisionSchema
|
|
11
|
+
}).strict();
|
|
12
|
+
const StorefrontCacheTokenSchema = zod.z.string().regex(/^[1-9]\d{0,18}\.(?:0|[1-9]\d{0,11})$/);
|
|
13
|
+
function storefrontCacheToken({ storeId, revision, now }) {
|
|
14
|
+
const windowMs = 3e4;
|
|
15
|
+
const offsetMs = Number(BigInt(storeId) % BigInt(windowMs));
|
|
16
|
+
return `${revision}.${Math.floor((now + offsetMs) / windowMs)}`;
|
|
17
|
+
}
|
|
18
|
+
exports.STOREFRONT_CACHE_REVISION_HEADER = STOREFRONT_CACHE_REVISION_HEADER;
|
|
19
|
+
exports.STOREFRONT_CACHE_TTL_SECONDS = STOREFRONT_CACHE_TTL_SECONDS;
|
|
20
|
+
exports.StorefrontCacheRevisionDocumentSchema = StorefrontCacheRevisionDocumentSchema;
|
|
21
|
+
exports.StorefrontCacheRevisionSchema = StorefrontCacheRevisionSchema;
|
|
22
|
+
exports.StorefrontCacheTokenSchema = StorefrontCacheTokenSchema;
|
|
23
|
+
exports.storefrontCacheToken = storefrontCacheToken;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const STOREFRONT_CACHE_REVISION_HEADER = "x-ecomiq-cache-revision";
|
|
3
|
+
export declare const STOREFRONT_CACHE_TTL_SECONDS = 30;
|
|
4
|
+
export declare const StorefrontCacheRevisionSchema: z.ZodString;
|
|
5
|
+
export declare const StorefrontCacheRevisionDocumentSchema: z.ZodObject<{
|
|
6
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
7
|
+
storeId: z.ZodString;
|
|
8
|
+
revision: z.ZodString;
|
|
9
|
+
}, z.core.$strict>;
|
|
10
|
+
export declare const StorefrontCacheTokenSchema: z.ZodString;
|
|
11
|
+
export type StorefrontCacheRevisionDocument = z.infer<typeof StorefrontCacheRevisionDocumentSchema>;
|
|
12
|
+
export declare function storefrontCacheToken({ storeId, revision, now }: {
|
|
13
|
+
storeId: string;
|
|
14
|
+
revision: string;
|
|
15
|
+
now: number;
|
|
16
|
+
}): string;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const STOREFRONT_CACHE_REVISION_HEADER = "x-ecomiq-cache-revision";
|
|
3
|
+
export declare const STOREFRONT_CACHE_TTL_SECONDS = 30;
|
|
4
|
+
export declare const StorefrontCacheRevisionSchema: z.ZodString;
|
|
5
|
+
export declare const StorefrontCacheRevisionDocumentSchema: z.ZodObject<{
|
|
6
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
7
|
+
storeId: z.ZodString;
|
|
8
|
+
revision: z.ZodString;
|
|
9
|
+
}, z.core.$strict>;
|
|
10
|
+
export declare const StorefrontCacheTokenSchema: z.ZodString;
|
|
11
|
+
export type StorefrontCacheRevisionDocument = z.infer<typeof StorefrontCacheRevisionDocumentSchema>;
|
|
12
|
+
export declare function storefrontCacheToken({ storeId, revision, now }: {
|
|
13
|
+
storeId: string;
|
|
14
|
+
revision: string;
|
|
15
|
+
now: number;
|
|
16
|
+
}): string;
|