@shop-on/theme-server 0.10.0 → 0.11.1
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/account-state.js +1 -2
- package/dist/account.d.ts +1 -3
- package/dist/account.js +1 -3
- package/dist/activity.d.ts +1 -3
- package/dist/activity.js +1 -2
- package/dist/analytics-proxy.d.ts +8 -14
- package/dist/analytics-proxy.js +111 -28
- package/dist/analytics-script-proxy.d.ts +1 -5
- package/dist/analytics-script-proxy.js +4 -14
- package/dist/api-contract/src/addresses.js +32 -0
- package/dist/api-contract/src/areas.js +49 -0
- package/dist/api-contract/src/custom-data.d.ts +31 -0
- package/dist/api-contract/src/custom-data.js +303 -0
- package/dist/api-contract/src/ids.js +110 -0
- package/dist/api-contract/src/image.js +65 -0
- package/dist/api-contract/src/limits.js +44 -0
- package/dist/api-contract/src/media.js +13 -0
- package/dist/api-contract/src/pickup.js +11 -0
- package/dist/api-contract/src/recommendations.js +4 -0
- package/dist/api-contract/src/shops.js +27 -0
- package/dist/api-contract/src/storefront/analytics.d.ts +100 -0
- package/dist/api-contract/src/storefront/analytics.js +138 -0
- package/dist/api-contract/src/storefront/areas.d.ts +2 -0
- package/dist/api-contract/src/storefront/cart.d.ts +132 -0
- package/dist/api-contract/src/storefront/cart.js +248 -0
- package/dist/api-contract/src/storefront/catalog.d.ts +3 -0
- package/dist/api-contract/src/storefront/checkout-analytics.d.ts +2 -0
- package/dist/api-contract/src/storefront/checkout.d.ts +2 -0
- package/dist/api-contract/src/storefront/checkout.js +624 -0
- package/dist/api-contract/src/storefront/client.d.ts +3 -0
- package/dist/api-contract/src/storefront/client.js +6 -0
- package/dist/api-contract/src/storefront/content.d.ts +3 -0
- package/dist/api-contract/src/storefront/custom-data.d.ts +2 -0
- package/dist/api-contract/src/storefront/custom-data.js +27 -0
- package/dist/api-contract/src/storefront/customer.d.ts +2 -0
- package/dist/api-contract/src/storefront/customer.js +261 -0
- package/dist/api-contract/src/storefront/downloads.d.ts +2 -0
- package/dist/api-contract/src/storefront/draft-order-invoice.d.ts +2 -0
- package/dist/api-contract/src/storefront/forms.d.ts +2 -0
- package/dist/api-contract/src/storefront/forms.js +82 -0
- package/dist/api-contract/src/storefront/index.d.ts +20956 -0
- package/dist/api-contract/src/storefront/orders.d.ts +2 -0
- package/dist/api-contract/src/storefront/policies.d.ts +2 -0
- package/dist/api-contract/src/storefront/procedure.d.ts +2 -0
- package/dist/api-contract/src/storefront/procedure.js +29 -0
- package/dist/api-contract/src/storefront/reviews.d.ts +20 -0
- package/dist/api-contract/src/storefront/search.d.ts +3 -0
- package/dist/api-contract/src/storefront/seo.d.ts +2 -0
- package/dist/api-contract/src/storefront/seo.js +132 -0
- package/dist/api-contract/src/storefront/shop.d.ts +2 -0
- package/dist/api-contract/src/storefront/shop.js +101 -0
- package/dist/api-contract/src/taxonomy.js +5 -0
- package/dist/api-contract/src/text.js +15 -0
- package/dist/api-contract/src/theme-documents.js +13 -0
- package/dist/api-contract/src/theme-translations.d.ts +14 -0
- package/dist/api-contract/src/theme-translations.js +30 -0
- package/dist/api-contract/src/video.js +19 -0
- package/dist/availability.d.ts +6 -3
- package/dist/availability.js +11 -5
- package/dist/blog.d.ts +53 -59
- package/dist/blog.js +197 -497
- package/dist/cache.d.ts +5 -6
- package/dist/cache.js +1 -2
- package/dist/canonical-host.d.ts +4 -6
- package/dist/canonical-host.js +5 -6
- package/dist/card.js +159 -0
- package/dist/cart-customer.d.ts +1 -3
- package/dist/cart-customer.js +64 -105
- package/dist/cart-mutations.d.ts +43 -77
- package/dist/cart-mutations.js +106 -232
- package/dist/cart-recommendations.d.ts +1 -3
- package/dist/cart-recommendations.js +1 -2
- package/dist/cart-session.d.ts +1 -3
- package/dist/cart-session.js +1 -2
- package/dist/cart.d.ts +63 -224
- package/dist/cart.js +70 -197
- package/dist/checkout.d.ts +13 -17
- package/dist/checkout.js +75 -101
- package/dist/coalesce.js +57 -0
- package/dist/collection.d.ts +89 -298
- package/dist/collection.js +210 -656
- package/dist/contact.d.ts +20 -10
- package/dist/contact.js +36 -30
- package/dist/content-version.d.ts +37 -21
- package/dist/content-version.js +64 -42
- package/dist/contract-kit/src/client.d.ts +12 -0
- package/dist/contract-kit/src/client.js +156 -0
- package/dist/contract-kit/src/errors.d.ts +1 -0
- package/dist/contract-kit/src/errors.js +81 -0
- package/dist/contract-kit/src/ids.d.ts +1 -0
- package/dist/contract-kit/src/ids.js +118 -0
- package/dist/contract-kit/src/index.d.ts +7 -0
- package/dist/contract-kit/src/money.d.ts +1 -0
- package/dist/contract-kit/src/money.js +10 -0
- package/dist/contract-kit/src/pagination.d.ts +1 -0
- package/dist/contract-kit/src/procedure.d.ts +69 -0
- package/dist/contract-kit/src/procedure.js +16 -0
- package/dist/contract-kit/src/realtime.d.ts +1 -0
- package/dist/cookie-secret.js +1 -2
- package/dist/csrf.js +1 -2
- package/dist/customer-handoff.d.ts +1 -3
- package/dist/customer-handoff.js +10 -25
- package/dist/customer-session.d.ts +1 -3
- package/dist/customer-session.js +1 -2
- package/dist/customer.d.ts +2 -3
- package/dist/customer.js +27 -44
- package/dist/files.d.ts +49 -10
- package/dist/files.js +106 -89
- package/dist/fonts.d.ts +3 -5
- package/dist/fonts.js +16 -35
- package/dist/html.d.ts +1 -3
- package/dist/html.js +1 -2
- package/dist/liquid.d.ts +4 -10
- package/dist/liquid.js +25 -32
- package/dist/listing.js +79 -0
- package/dist/marketing-cookies.d.ts +1 -3
- package/dist/marketing-cookies.js +1 -2
- package/dist/menu.d.ts +46 -155
- package/dist/menu.js +51 -61
- package/dist/metafields.d.ts +9 -5
- package/dist/metafields.js +10 -38
- package/dist/metaobject.d.ts +10 -5
- package/dist/metaobject.js +43 -66
- package/dist/money.d.ts +7 -0
- package/dist/money.js +18 -0
- package/dist/newsletter.d.ts +19 -10
- package/dist/newsletter.js +31 -25
- package/dist/page.d.ts +13 -17
- package/dist/page.js +49 -105
- package/dist/password-session.d.ts +1 -3
- package/dist/password-session.js +1 -2
- package/dist/password.d.ts +25 -18
- package/dist/password.js +41 -59
- package/dist/policy.d.ts +7 -7
- package/dist/policy.js +19 -55
- package/dist/product.d.ts +42 -67
- package/dist/product.js +144 -644
- package/dist/read-ahead.d.ts +18 -0
- package/dist/read-ahead.js +32 -0
- package/dist/recommendations.d.ts +6 -12
- package/dist/recommendations.js +36 -60
- package/dist/review.d.ts +134 -94
- package/dist/review.js +257 -469
- package/dist/search.d.ts +59 -64
- package/dist/search.js +170 -469
- package/dist/seo-context.d.ts +1 -3
- package/dist/seo-context.js +4 -5
- package/dist/seo-documents.d.ts +50 -0
- package/dist/seo-documents.js +149 -0
- package/dist/shop-seo.d.ts +3 -5
- package/dist/shop-seo.js +7 -26
- package/dist/shop.d.ts +38 -42
- package/dist/shop.js +37 -51
- package/dist/store-availability.d.ts +12 -14
- package/dist/store-availability.js +18 -56
- package/dist/storefront.js +199 -0
- package/dist/structured-data.d.ts +3 -28
- package/dist/structured-data.js +19 -49
- package/dist/trace.js +1 -2
- package/dist/translations.d.ts +26 -31
- package/dist/translations.js +55 -28
- package/package.json +16 -14
- package/dist/graphql-env.d.ts +0 -22778
- package/dist/graphql.d.ts +0 -64
- package/dist/graphql.js +0 -344
- package/dist/schema.storefront.graphql +0 -10483
- package/dist/seo-proxy.d.ts +0 -11
- package/dist/seo-proxy.js +0 -26
package/dist/collection.d.ts
CHANGED
|
@@ -1,19 +1,16 @@
|
|
|
1
1
|
import { FileInfo } from "./files.js";
|
|
2
2
|
import { MetafieldMap } from "./metafields.js";
|
|
3
|
-
import {
|
|
3
|
+
import { ProductRating } from "./product.js";
|
|
4
4
|
import { Money } from "@shop-on/theme-runtime/money";
|
|
5
|
+
import { ListingFilters } from "@shop-on/theme-runtime/listing-filters";
|
|
5
6
|
import { ProductOption } from "@shop-on/theme-runtime/product-variants";
|
|
6
|
-
//#region src/collection.d.ts
|
|
7
7
|
export type CollectionProductData = {
|
|
8
8
|
id?: string;
|
|
9
9
|
handle: string;
|
|
10
10
|
title: string;
|
|
11
11
|
vendor?: string | null;
|
|
12
12
|
product_type?: string | null;
|
|
13
|
-
|
|
14
|
-
value: number;
|
|
15
|
-
count: number;
|
|
16
|
-
};
|
|
13
|
+
rating?: ProductRating | null;
|
|
17
14
|
price: Money;
|
|
18
15
|
compare_at: Money | null;
|
|
19
16
|
tags?: string[];
|
|
@@ -24,10 +21,7 @@ export type CollectionProductData = {
|
|
|
24
21
|
media: FileInfo[];
|
|
25
22
|
options?: ProductOption[];
|
|
26
23
|
variantMedia?: FileInfo[];
|
|
27
|
-
metafields?:
|
|
28
|
-
type: string;
|
|
29
|
-
value: string;
|
|
30
|
-
}>;
|
|
24
|
+
metafields?: MetafieldMap;
|
|
31
25
|
};
|
|
32
26
|
export type CollectionData = {
|
|
33
27
|
title: string;
|
|
@@ -37,225 +31,84 @@ export type CollectionData = {
|
|
|
37
31
|
products_count: number;
|
|
38
32
|
products: CollectionProductData[];
|
|
39
33
|
};
|
|
40
|
-
export
|
|
41
|
-
aggregateRating: {
|
|
42
|
-
count: number;
|
|
43
|
-
value: number;
|
|
44
|
-
};
|
|
45
|
-
defaultVariant: {
|
|
46
|
-
availableForSale: boolean;
|
|
47
|
-
compareAtV2: {
|
|
48
|
-
amount: string;
|
|
49
|
-
currencyCode: "CNY" | "EUR" | "GBP" | "JPY" | "KRW" | "MNT" | "RUB" | "USD";
|
|
50
|
-
} | null;
|
|
51
|
-
id: string;
|
|
52
|
-
priceV2: {
|
|
53
|
-
amount: string;
|
|
54
|
-
currencyCode: "CNY" | "EUR" | "GBP" | "JPY" | "KRW" | "MNT" | "RUB" | "USD";
|
|
55
|
-
};
|
|
56
|
-
sku: string | null;
|
|
57
|
-
};
|
|
34
|
+
export type CollectionMeta = {
|
|
58
35
|
handle: string;
|
|
59
|
-
id: string;
|
|
60
|
-
media: {
|
|
61
|
-
nodes: ({
|
|
62
|
-
__typename: "ShopFont";
|
|
63
|
-
alt: string | null;
|
|
64
|
-
id: string;
|
|
65
|
-
thumbhash: string | null;
|
|
66
|
-
} | {
|
|
67
|
-
__typename: "ShopMediaImage";
|
|
68
|
-
alt: string | null;
|
|
69
|
-
focalPoint: {
|
|
70
|
-
x: number;
|
|
71
|
-
y: number;
|
|
72
|
-
} | null;
|
|
73
|
-
height: number | null;
|
|
74
|
-
id: string;
|
|
75
|
-
thumbUrl: string | null;
|
|
76
|
-
thumbhash: string | null;
|
|
77
|
-
url: string | null;
|
|
78
|
-
url2x: string | null;
|
|
79
|
-
width: number | null;
|
|
80
|
-
} | {
|
|
81
|
-
__typename: "ShopVideo";
|
|
82
|
-
alt: string | null;
|
|
83
|
-
duration: number | null;
|
|
84
|
-
height: number | null;
|
|
85
|
-
hlsUrl: string | null;
|
|
86
|
-
id: string;
|
|
87
|
-
preview: {
|
|
88
|
-
url: string | null;
|
|
89
|
-
} | null;
|
|
90
|
-
thumbhash: string | null;
|
|
91
|
-
url: string | null;
|
|
92
|
-
width: number | null;
|
|
93
|
-
})[];
|
|
94
|
-
};
|
|
95
|
-
metafields?: {
|
|
96
|
-
nodes: {
|
|
97
|
-
key: string;
|
|
98
|
-
namespace: string;
|
|
99
|
-
type: "BOOLEAN" | "COLLECTION_REFERENCE" | "COLOR" | "DATE" | "DATE_TIME" | "DECIMAL" | "FILE_REFERENCE" | "INTEGER" | "JSON" | "LIST_BOOLEAN" | "LIST_COLLECTION_REFERENCE" | "LIST_COLOR" | "LIST_DATE" | "LIST_DATE_TIME" | "LIST_DECIMAL" | "LIST_INTEGER" | "LIST_METAOBJECT_REFERENCE" | "LIST_MULTI_LINE_TEXT" | "LIST_PRODUCT_REFERENCE" | "LIST_SINGLE_LINE_TEXT" | "LIST_TAXONOMY_VALUE_REFERENCE" | "LIST_URL" | "LIST_VARIANT_REFERENCE" | "METAOBJECT_REFERENCE" | "MULTI_LINE_TEXT" | "PAGE_REFERENCE" | "PRODUCT_REFERENCE" | "RICH_TEXT" | "SINGLE_LINE_TEXT" | "TAXONOMY_CATEGORY_REFERENCE" | "TAXONOMY_VALUE_REFERENCE" | "URL" | "VARIANT_REFERENCE";
|
|
100
|
-
value: string;
|
|
101
|
-
}[];
|
|
102
|
-
} | undefined;
|
|
103
|
-
options?: {
|
|
104
|
-
id: string;
|
|
105
|
-
linkedMetafield: {
|
|
106
|
-
key: string;
|
|
107
|
-
namespace: string;
|
|
108
|
-
} | null;
|
|
109
|
-
name: string;
|
|
110
|
-
position: number;
|
|
111
|
-
values: {
|
|
112
|
-
firstSelectableVariant?: {
|
|
113
|
-
availableForSale: boolean;
|
|
114
|
-
compareAtV2: {
|
|
115
|
-
amount: string;
|
|
116
|
-
currencyCode: "CNY" | "EUR" | "GBP" | "JPY" | "KRW" | "MNT" | "RUB" | "USD";
|
|
117
|
-
} | null;
|
|
118
|
-
featuredMedia: {
|
|
119
|
-
__typename?: "ShopFont" | undefined;
|
|
120
|
-
id: string;
|
|
121
|
-
} | {
|
|
122
|
-
__typename?: "ShopMediaImage" | undefined;
|
|
123
|
-
id: string;
|
|
124
|
-
} | {
|
|
125
|
-
__typename?: "ShopVideo" | undefined;
|
|
126
|
-
id: string;
|
|
127
|
-
} | null;
|
|
128
|
-
id: string;
|
|
129
|
-
priceV2: {
|
|
130
|
-
amount: string;
|
|
131
|
-
currencyCode: "CNY" | "EUR" | "GBP" | "JPY" | "KRW" | "MNT" | "RUB" | "USD";
|
|
132
|
-
};
|
|
133
|
-
sku: string | null;
|
|
134
|
-
} | null | undefined;
|
|
135
|
-
hasVariants: boolean;
|
|
136
|
-
id: string;
|
|
137
|
-
linkedMetaobject: {
|
|
138
|
-
fields: {
|
|
139
|
-
key: string;
|
|
140
|
-
reference: {
|
|
141
|
-
__typename: "ShopFont";
|
|
142
|
-
} | {
|
|
143
|
-
__typename: "ShopMediaImage";
|
|
144
|
-
url: string | null;
|
|
145
|
-
} | {
|
|
146
|
-
__typename: "ShopVideo";
|
|
147
|
-
} | null;
|
|
148
|
-
value: string | null;
|
|
149
|
-
}[];
|
|
150
|
-
id: string;
|
|
151
|
-
} | null;
|
|
152
|
-
name: string;
|
|
153
|
-
position: number;
|
|
154
|
-
}[];
|
|
155
|
-
}[] | undefined;
|
|
156
|
-
productType: string | null;
|
|
157
|
-
tags: string[];
|
|
158
36
|
title: string;
|
|
159
|
-
|
|
160
|
-
__typename: "ShopFont";
|
|
161
|
-
alt: string | null;
|
|
162
|
-
id: string;
|
|
163
|
-
} | {
|
|
164
|
-
__typename: "ShopMediaImage";
|
|
165
|
-
alt: string | null;
|
|
166
|
-
height: number | null;
|
|
167
|
-
id: string;
|
|
168
|
-
url: string | null;
|
|
169
|
-
url2x: string | null;
|
|
170
|
-
width: number | null;
|
|
171
|
-
} | {
|
|
172
|
-
__typename: "ShopVideo";
|
|
173
|
-
alt: string | null;
|
|
174
|
-
id: string;
|
|
175
|
-
})[] | undefined;
|
|
176
|
-
variantsCount: number;
|
|
177
|
-
vendor: string | null;
|
|
178
|
-
}, {}, {
|
|
179
|
-
fragment: "CollectionProductNode";
|
|
180
|
-
on: "ShopProduct";
|
|
181
|
-
masked: false;
|
|
182
|
-
}>;
|
|
183
|
-
export declare const CollectionImageFragment: import("gql.tada").TadaDocumentNode<{
|
|
184
|
-
__typename: "ShopFont";
|
|
185
|
-
alt: string | null;
|
|
186
|
-
id: string;
|
|
187
|
-
thumbhash: string | null;
|
|
188
|
-
} | {
|
|
189
|
-
__typename: "ShopMediaImage";
|
|
190
|
-
alt: string | null;
|
|
191
|
-
focalPoint: {
|
|
192
|
-
x: number;
|
|
193
|
-
y: number;
|
|
194
|
-
} | null;
|
|
195
|
-
height: number | null;
|
|
196
|
-
id: string;
|
|
197
|
-
thumbUrl: string | null;
|
|
198
|
-
thumbhash: string | null;
|
|
199
|
-
url: string | null;
|
|
200
|
-
url1_5x: string | null;
|
|
201
|
-
url2x: string | null;
|
|
202
|
-
url3x: string | null;
|
|
203
|
-
width: number | null;
|
|
204
|
-
} | {
|
|
205
|
-
__typename: "ShopVideo";
|
|
206
|
-
alt: string | null;
|
|
207
|
-
id: string;
|
|
208
|
-
thumbhash: string | null;
|
|
209
|
-
}, {}, {
|
|
210
|
-
fragment: "CollectionImage";
|
|
211
|
-
on: "FileInterface";
|
|
212
|
-
masked: false;
|
|
213
|
-
}>;
|
|
214
|
-
/** A `CollectionProductNode` as the card shape every product grid renders. */
|
|
215
|
-
export declare function toCollectionProduct(p: ResultOf<typeof CollectionProductNodeFragment>): CollectionProductData;
|
|
216
|
-
/** `$includeVariants` defaults to false in every query that declares it, so
|
|
217
|
-
* it is only sent when it is on — a caller that never asks for variants sends
|
|
218
|
-
* exactly the variables it always did. */
|
|
219
|
-
export declare function variantsVariable(includeVariants: boolean | undefined): {
|
|
220
|
-
includeVariants?: true;
|
|
37
|
+
themeTemplate: string;
|
|
221
38
|
};
|
|
39
|
+
/** Lean collection lookup for breadcrumbs / contextual labels, and for
|
|
40
|
+
* resolving a collection's assigned theme template. Null for a collection a
|
|
41
|
+
* buyer may not see, and on a failed read. */
|
|
42
|
+
export declare function fetchCollectionMeta(ref: string, locale?: string): Promise<CollectionMeta | null>;
|
|
43
|
+
/** The collection's description HTML alone — the `collection_attribute:description`
|
|
44
|
+
* dynamic source; the theme loader calls it only when a template binds the
|
|
45
|
+
* description. null on a miss, a failure, or an empty description. */
|
|
46
|
+
export declare function fetchCollectionDescriptionHtml(handle: string, locale?: string): Promise<string | null>;
|
|
47
|
+
/** The collection's storefront-visible metafields keyed `"namespace.key"` —
|
|
48
|
+
* the `collection_metafield` dynamic source, off the same record read. `{}`
|
|
49
|
+
* on a miss or a failure, so the literal renders. */
|
|
50
|
+
export declare function fetchCollectionMetafields(handle: string, locale?: string): Promise<MetafieldMap>;
|
|
51
|
+
/** The liquid pass's `collection` drop source. The drop is metadata only
|
|
52
|
+
* (`liquidCollection` maps no products; the grid's own page fetch stays the
|
|
53
|
+
* product source), so it carries none. */
|
|
54
|
+
export declare const fetchLiquidCollection: (handle: string, locale?: string) => Promise<CollectionData | null>;
|
|
55
|
+
/** The route collection as the theme loader's dynamic sources read it
|
|
56
|
+
* (`DynamicSourceCollection` in `@shop-on/theme-loader`): the title off the
|
|
57
|
+
* lean meta read the theme already made, and a lazy provider for each source
|
|
58
|
+
* the loader fetches only when a template binds it. One builder so a theme
|
|
59
|
+
* passes `routeCollectionSource(meta, locale)` and picks up a new provider on
|
|
60
|
+
* upgrade, instead of every theme re-listing them. */
|
|
61
|
+
export declare function routeCollectionSource(meta: Pick<CollectionMeta, "handle" | "title">, locale?: string): {
|
|
62
|
+
title: string;
|
|
63
|
+
getDescriptionHtml: () => Promise<string | null>;
|
|
64
|
+
getMetafields: () => Promise<MetafieldMap>;
|
|
65
|
+
};
|
|
66
|
+
/** A collection as a card draws it: meta plus Shopify's `featured_image`,
|
|
67
|
+
* with no products. `image` carries the featured image (its own, else its
|
|
68
|
+
* first visible product's first media), so a reader written as
|
|
69
|
+
* `image ?? products[0].media[0]` (canvas, modern and volt spell it so)
|
|
70
|
+
* resolves the same picture from an empty `products`. */
|
|
71
|
+
export declare const fetchCollectionCard: (h: string, locale?: string | undefined) => Promise<CollectionData | null>;
|
|
72
|
+
/** A collection with its first `first` products in its own order, for the
|
|
73
|
+
* `collection` settings that render a grid of it. Null for a collection a
|
|
74
|
+
* buyer may not see, and on a failed read. */
|
|
222
75
|
export declare const fetchCollection: (data: {
|
|
223
76
|
handle: string;
|
|
224
77
|
first: number;
|
|
225
78
|
mediaFirst?: number;
|
|
226
79
|
includeOptions?: boolean;
|
|
227
|
-
includeVariants?: boolean;
|
|
228
80
|
locale?: string;
|
|
229
81
|
/** Storefront-visible metafields (`"namespace.key"`) each card carries, for
|
|
230
82
|
* the `closest_product_metafield` sources bound on it. Omitted ⇒ none. */
|
|
231
83
|
metafieldKeys?: readonly string[];
|
|
232
84
|
}) => Promise<CollectionData | null>;
|
|
233
|
-
/** The liquid pass's `collection` drop source. The drop is metadata only
|
|
234
|
-
* (`liquidCollection` maps no products; the grid's own page fetch stays the
|
|
235
|
-
* product source), so it asks for none. */
|
|
236
|
-
export declare const fetchLiquidCollection: (handle: string, locale?: string) => Promise<CollectionData | null>;
|
|
237
|
-
/** A collection as a card draws it: meta plus Shopify's `featured_image`,
|
|
238
|
-
* with no products. `image` carries the featured image, so a reader written
|
|
239
|
-
* as `image ?? products[0].media[0]` (canvas, modern and volt spell it so)
|
|
240
|
-
* resolves the same picture from an empty `products`. A product page per
|
|
241
|
-
* card was what `fetchCollection` at one product cost for that fallback. */
|
|
242
|
-
export declare const fetchCollectionCard: (h: string, locale?: string | undefined) => Promise<CollectionData | null>;
|
|
243
85
|
export type CollectionFacetValue = {
|
|
244
86
|
value: string;
|
|
245
87
|
label: string;
|
|
246
88
|
count: number;
|
|
89
|
+
/** Ticked in the listing's URL. */
|
|
247
90
|
selected: boolean;
|
|
248
|
-
swatch
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
91
|
+
/** A swatch's colour (a CSS colour) and image (a URL at swatch size); a
|
|
92
|
+
* swatch shows the image over the colour. Null on a value without one. */
|
|
93
|
+
color: string | null;
|
|
94
|
+
image: string | null;
|
|
252
95
|
};
|
|
96
|
+
/** A storefront filter's facet on a listing, at the merchant's place among
|
|
97
|
+
* them, labelled in the read's language. `key` is what its selection writes in
|
|
98
|
+
* the URL (`filter.<key>`, `@shop-on/theme-runtime/listing-filters`); a
|
|
99
|
+
* `swatch` facet draws its values as `color` / `image` chips. A `price_range`
|
|
100
|
+
* facet is the price filter: no values, its bounds the listing's
|
|
101
|
+
* `price_bounds`, its selection the URL's `price_min` / `price_max`; it is
|
|
102
|
+
* there only while the merchant has it and a price above zero matches. */
|
|
253
103
|
export type CollectionFacet = {
|
|
254
|
-
namespace: string;
|
|
255
104
|
key: string;
|
|
256
105
|
label: string;
|
|
106
|
+
presentation: "text" | "swatch" | "price_range";
|
|
257
107
|
values: CollectionFacetValue[];
|
|
258
|
-
|
|
108
|
+
};
|
|
109
|
+
export type PriceBounds = {
|
|
110
|
+
min: number | null;
|
|
111
|
+
max: number | null;
|
|
259
112
|
};
|
|
260
113
|
export type CollectionPageData = {
|
|
261
114
|
id: string;
|
|
@@ -268,139 +121,77 @@ export type CollectionPageData = {
|
|
|
268
121
|
image: FileInfo | null;
|
|
269
122
|
products_count: number;
|
|
270
123
|
total_count: number;
|
|
271
|
-
page_info: {
|
|
272
|
-
end_cursor: string | null;
|
|
273
|
-
has_next_page: boolean;
|
|
274
|
-
};
|
|
275
124
|
products: CollectionProductData[];
|
|
276
125
|
facets: CollectionFacet[];
|
|
277
|
-
price_bounds:
|
|
278
|
-
min: number | null;
|
|
279
|
-
max: number | null;
|
|
280
|
-
};
|
|
126
|
+
price_bounds: PriceBounds;
|
|
281
127
|
seo: {
|
|
282
128
|
title: string;
|
|
283
129
|
description: string;
|
|
284
130
|
};
|
|
285
131
|
};
|
|
286
|
-
|
|
287
|
-
min: number | null;
|
|
288
|
-
max: number | null;
|
|
289
|
-
};
|
|
290
|
-
/** Maps the GraphQL `ProductPriceRange` (Decimal serialized as string, or
|
|
291
|
-
* null) to numeric bounds. Must guard null explicitly: a bare `Number(null)`
|
|
292
|
-
* is `0`, which is NOT nullish and would defeat the `?? defaultPriceMaxBound`
|
|
293
|
-
* fallback the sections rely on for empty catalogs. */
|
|
294
|
-
export declare function toPriceBounds(range: {
|
|
295
|
-
min: string | null;
|
|
296
|
-
max: string | null;
|
|
297
|
-
}): PriceBounds;
|
|
298
|
-
export type CollectionMetafieldFilter = {
|
|
299
|
-
namespace: string;
|
|
300
|
-
key: string;
|
|
301
|
-
values: string[];
|
|
302
|
-
};
|
|
303
|
-
export type CollectionFilterInput = {
|
|
304
|
-
metafields?: CollectionMetafieldFilter[];
|
|
305
|
-
priceMin?: string;
|
|
306
|
-
priceMax?: string;
|
|
307
|
-
};
|
|
132
|
+
/** A theme's sort vocabulary (`?sort=` on its listings). */
|
|
308
133
|
export type CollectionSort = "FEATURED" | "CREATED_DESC" | "TITLE_ASC" | "TITLE_DESC" | "PRICE_ASC" | "PRICE_DESC" | "BEST_SELLING";
|
|
309
134
|
type FetchCollectionPageInput = {
|
|
310
135
|
handle: string;
|
|
311
|
-
|
|
136
|
+
/** The listing URL's filters (`parseListingFilters`). */
|
|
137
|
+
filter?: ListingFilters;
|
|
312
138
|
sort?: CollectionSort;
|
|
313
|
-
|
|
139
|
+
/** 1-based; a page past the last lists nothing. */
|
|
140
|
+
page?: number;
|
|
314
141
|
first?: number;
|
|
315
142
|
mediaFirst?: number;
|
|
316
143
|
includeOptions?: boolean;
|
|
317
|
-
includeVariants?: boolean;
|
|
318
144
|
locale?: string;
|
|
319
145
|
/** Storefront-visible metafields (`"namespace.key"`) each card carries, for
|
|
320
146
|
* the `closest_product_metafield` sources bound on it. Omitted ⇒ none. */
|
|
321
147
|
metafieldKeys?: readonly string[];
|
|
322
148
|
};
|
|
323
|
-
/** Server-driven collection listing
|
|
324
|
-
*
|
|
325
|
-
* `notFound()`.
|
|
326
|
-
* blow the TTL cache;
|
|
149
|
+
/** Server-driven collection listing: the collection's record and one page
|
|
150
|
+
* of its listing, read together. `null` on a collection a buyer may not see
|
|
151
|
+
* and on a failed read, so the route loader can map it to `notFound()`.
|
|
152
|
+
* Uncached because filter/sort/page permutations would blow the TTL cache;
|
|
153
|
+
* the record under it is cached. */
|
|
327
154
|
export declare const fetchCollectionPage: (data: FetchCollectionPageInput) => Promise<CollectionPageData | null>;
|
|
328
|
-
/** Shopify's `collections.all` — the shop's whole
|
|
329
|
-
* product list,
|
|
330
|
-
*
|
|
331
|
-
*
|
|
332
|
-
* callers, so it is the same set the automatic "all" collection would hold,
|
|
333
|
-
* newest first.
|
|
155
|
+
/** Shopify's `collections.all` — the shop's whole catalogue a buyer may see
|
|
156
|
+
* as a product list, newest first (`products.list`'s featured order), for
|
|
157
|
+
* the surfaces a theme falls back to when the merchant has picked no
|
|
158
|
+
* collection (Horizon's search empty states).
|
|
334
159
|
*
|
|
335
|
-
* Cached, unlike the collection listing
|
|
336
|
-
*
|
|
337
|
-
*
|
|
160
|
+
* Cached, unlike the collection listing: this read takes no filter, sort or
|
|
161
|
+
* page, so there is exactly one result per (size, locale) — and the search
|
|
162
|
+
* modal's copy of it rides along on every page load. An EMPTY catalogue
|
|
338
163
|
* caches like any other answer; only a thrown read skips the store, which is
|
|
339
|
-
* why the failure is caught out here rather than inside the memo.
|
|
340
|
-
* catalog is genuinely empty would otherwise re-ask on every render, forever.
|
|
164
|
+
* why the failure is caught out here rather than inside the memo.
|
|
341
165
|
*
|
|
342
166
|
* `[]` on a failure, so an empty-state grid renders empty rather than breaking
|
|
343
167
|
* the page it garnishes. */
|
|
344
|
-
export declare function fetchAllProducts(first: number, mediaFirst: number, includeOptions: boolean, locale?: string
|
|
168
|
+
export declare function fetchAllProducts(first: number, mediaFirst: number, includeOptions: boolean, locale?: string): Promise<CollectionProductData[]>;
|
|
345
169
|
export type CollectionListItem = {
|
|
346
170
|
handle: string;
|
|
347
171
|
title: string;
|
|
172
|
+
/** Plain text, cut at a word within 320 characters. */
|
|
348
173
|
description: string;
|
|
349
|
-
|
|
350
|
-
/** The collection's own picture, else its first product's first media, which may be a video (`featuredImage`). */
|
|
174
|
+
/** The collection's own picture, else its first product's first media (a video's poster). */
|
|
351
175
|
image: FileInfo | null;
|
|
352
176
|
products_count: number;
|
|
353
177
|
};
|
|
354
178
|
export type CollectionsListData = {
|
|
355
179
|
total_count: number;
|
|
356
|
-
page_info: {
|
|
357
|
-
end_cursor: string | null;
|
|
358
|
-
has_next_page: boolean;
|
|
359
|
-
};
|
|
360
180
|
items: CollectionListItem[];
|
|
361
181
|
};
|
|
182
|
+
/** A theme's sort vocabulary for the collections index. PRODUCTS_COUNT_*
|
|
183
|
+
* count the members a collection holds, whether a buyer sees them or not. */
|
|
362
184
|
export type CollectionsSortKey = "TITLE_ASC" | "TITLE_DESC" | "CREATED_DESC" | "CREATED_ASC" | "PRODUCTS_COUNT_DESC" | "PRODUCTS_COUNT_ASC";
|
|
363
185
|
type FetchCollectionsPageInput = {
|
|
364
|
-
|
|
186
|
+
/** 1-based. */
|
|
187
|
+
page?: number;
|
|
365
188
|
first?: number;
|
|
366
189
|
sort?: CollectionsSortKey;
|
|
367
190
|
locale?: string;
|
|
368
191
|
};
|
|
369
|
-
/** Server-driven collection list
|
|
370
|
-
*
|
|
371
|
-
*
|
|
192
|
+
/** Server-driven collection list, newest first unless `sort` names another
|
|
193
|
+
* order (legacy `collections`' default, which a theme asking for no sort got).
|
|
194
|
+
* `null` on a failed read so the route loader can map the failure to
|
|
195
|
+
* `notFound()`. Uncached because page permutations would blow the TTL cache. */
|
|
372
196
|
export declare const fetchCollectionsPage: (data: FetchCollectionsPageInput) => Promise<CollectionsListData | null>;
|
|
373
|
-
export type CollectionMeta = {
|
|
374
|
-
handle: string;
|
|
375
|
-
title: string;
|
|
376
|
-
themeTemplate: string;
|
|
377
|
-
};
|
|
378
|
-
/** Lean collection lookup for breadcrumbs / contextual labels, and for
|
|
379
|
-
* resolving a collection's assigned theme template. Skips products and image —
|
|
380
|
-
* pays only for `handle` + `title` + `themeTemplate`. */
|
|
381
|
-
export declare const fetchCollectionMeta: (h: string, locale?: string | undefined) => Promise<CollectionMeta | null>;
|
|
382
|
-
/** The collection's description HTML alone — the `collection_attribute:description`
|
|
383
|
-
* dynamic source. Kept out of `fetchCollectionMeta` so breadcrumbs and template
|
|
384
|
-
* resolution stay lean; the theme loader calls it only when a template binds the
|
|
385
|
-
* description. null on a miss, a failure, or an empty description. */
|
|
386
|
-
export declare function fetchCollectionDescriptionHtml(handle: string, locale?: string): Promise<string | null>;
|
|
387
|
-
/** The collection's storefront metafields keyed `"namespace.key"` — the
|
|
388
|
-
* `collection_metafield` dynamic source. Kept out of `fetchCollectionMeta` for
|
|
389
|
-
* the same reason as the description: that lean read is also what every
|
|
390
|
-
* collection list asks for, so metafields there would be fetched for every
|
|
391
|
-
* listed collection. The theme loader calls this only when a template binds a
|
|
392
|
-
* collection metafield. `{}` on a miss or a failure, so the literal renders. */
|
|
393
|
-
export declare const fetchCollectionMetafields: (ref: string, locale?: string) => Promise<MetafieldMap>;
|
|
394
|
-
/** The route collection as the theme loader's dynamic sources read it
|
|
395
|
-
* (`DynamicSourceCollection` in `@shop-on/theme-loader`): the title off the
|
|
396
|
-
* lean meta read the theme already made, and a lazy provider for each source
|
|
397
|
-
* the loader fetches only when a template binds it. One builder so a theme
|
|
398
|
-
* passes `routeCollectionSource(meta, locale)` and picks up a new provider on
|
|
399
|
-
* upgrade, instead of every theme re-listing them. */
|
|
400
|
-
export declare function routeCollectionSource(meta: Pick<CollectionMeta, "handle" | "title">, locale?: string): {
|
|
401
|
-
title: string;
|
|
402
|
-
getDescriptionHtml: () => Promise<string | null>;
|
|
403
|
-
getMetafields: () => Promise<MetafieldMap>;
|
|
404
|
-
};
|
|
405
|
-
//#endregion
|
|
406
197
|
export {};
|