@shop-on/theme-server 0.9.0 → 0.11.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/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/search.d.ts
CHANGED
|
@@ -1,49 +1,35 @@
|
|
|
1
|
-
import { FileInfo } from "./files.js";
|
|
2
1
|
import { CollectionFacet, CollectionListItem, CollectionProductData, PriceBounds } from "./collection.js";
|
|
2
|
+
import { FileInfo } from "./files.js";
|
|
3
3
|
import { Money } from "@shop-on/theme-runtime/money";
|
|
4
|
-
|
|
4
|
+
import { ListingFilters } from "@shop-on/theme-runtime/listing-filters";
|
|
5
5
|
export type SearchPageData = {
|
|
6
6
|
query: string;
|
|
7
7
|
total_count: number;
|
|
8
|
-
page_info: {
|
|
9
|
-
end_cursor: string | null;
|
|
10
|
-
has_next_page: boolean;
|
|
11
|
-
};
|
|
12
8
|
products: CollectionProductData[];
|
|
13
9
|
facets: CollectionFacet[];
|
|
14
10
|
price_bounds: PriceBounds;
|
|
15
11
|
};
|
|
16
|
-
|
|
17
|
-
namespace: string;
|
|
18
|
-
key: string;
|
|
19
|
-
values: string[];
|
|
20
|
-
};
|
|
21
|
-
/** Mirrors `CollectionFilterInput` — backed by the same GraphQL input
|
|
22
|
-
* type (`CollectionProductFilterInput`). Re-typed locally so consumers of
|
|
23
|
-
* `/search` don't have to import from `./collection`. */
|
|
24
|
-
export type ProductSearchFilterInput = {
|
|
25
|
-
metafields?: ProductSearchMetafieldFilter[];
|
|
26
|
-
priceMin?: string;
|
|
27
|
-
priceMax?: string;
|
|
28
|
-
};
|
|
12
|
+
/** A theme's sort vocabulary for `/search` (`?sort=`). */
|
|
29
13
|
export type ProductSearchSort = "RELEVANCE" | "CREATED_DESC" | "TITLE_ASC" | "TITLE_DESC" | "PRICE_ASC" | "PRICE_DESC" | "BEST_SELLING";
|
|
30
14
|
type FetchProductSearchPageInput = {
|
|
31
15
|
query: string;
|
|
32
|
-
|
|
16
|
+
/** The search URL's filters (`parseListingFilters`). */
|
|
17
|
+
filter?: ListingFilters;
|
|
33
18
|
sort?: ProductSearchSort;
|
|
34
|
-
|
|
19
|
+
/** 1-based; a page past the last lists nothing. */
|
|
20
|
+
page?: number;
|
|
35
21
|
first?: number;
|
|
36
22
|
mediaFirst?: number;
|
|
37
23
|
includeOptions?: boolean;
|
|
38
|
-
includeVariants?: boolean;
|
|
39
24
|
locale?: string;
|
|
40
25
|
/** Storefront-visible metafields (`"namespace.key"`) each card carries, for
|
|
41
26
|
* the `closest_product_metafield` sources bound on it. Omitted ⇒ none. */
|
|
42
27
|
metafieldKeys?: readonly string[];
|
|
43
28
|
};
|
|
44
|
-
/** Server-driven /search page
|
|
45
|
-
* route renders the empty
|
|
46
|
-
* filter/sort/
|
|
29
|
+
/** Server-driven /search page: one page of the matches with their facets.
|
|
30
|
+
* `null` for a blank query (the route renders the empty prompt) and on a
|
|
31
|
+
* failed read. Uncached because query/filter/sort/page permutations would
|
|
32
|
+
* blow the TTL cache. */
|
|
47
33
|
export declare const fetchProductSearchPage: (data: FetchProductSearchPageInput) => Promise<SearchPageData | null>;
|
|
48
34
|
/** A page or a blog article that matched, in ONE ranked list. `kind` is the
|
|
49
35
|
* badge a theme draws and what tells it how to build the URL. */
|
|
@@ -52,7 +38,7 @@ export type SearchContentItem = {
|
|
|
52
38
|
handle: string;
|
|
53
39
|
title: string;
|
|
54
40
|
excerpt: string;
|
|
55
|
-
publishedAt: string
|
|
41
|
+
publishedAt: string;
|
|
56
42
|
} | {
|
|
57
43
|
kind: "article";
|
|
58
44
|
handle: string;
|
|
@@ -61,9 +47,8 @@ export type SearchContentItem = {
|
|
|
61
47
|
blogTitle: string;
|
|
62
48
|
title: string;
|
|
63
49
|
excerpt: string;
|
|
64
|
-
publishedAt: string
|
|
65
|
-
/** Only when the caller asked for a thumbnail (`imageWidth`)
|
|
66
|
-
* that draws none never downloads one. */
|
|
50
|
+
publishedAt: string;
|
|
51
|
+
/** Only when the caller asked for a thumbnail (`imageWidth`). */
|
|
67
52
|
image?: FileInfo | null;
|
|
68
53
|
};
|
|
69
54
|
export type ResourceSearchPage<T> = {
|
|
@@ -81,12 +66,13 @@ export type SearchCounts = {
|
|
|
81
66
|
type ResourceSearchInput = {
|
|
82
67
|
query: string;
|
|
83
68
|
first: number;
|
|
84
|
-
|
|
69
|
+
/** 1-based. */
|
|
70
|
+
page?: number;
|
|
85
71
|
locale?: string;
|
|
86
72
|
};
|
|
87
|
-
/**
|
|
88
|
-
* Null when the
|
|
89
|
-
*
|
|
73
|
+
/** How many products, collections, and pages and articles a query matches.
|
|
74
|
+
* Null when the read fails — a theme then draws no tab row rather than a row
|
|
75
|
+
* of zeroes it can't stand behind. */
|
|
90
76
|
export declare function fetchSearchCounts(data: {
|
|
91
77
|
query: string;
|
|
92
78
|
locale?: string;
|
|
@@ -95,38 +81,11 @@ export declare function fetchSearchCounts(data: {
|
|
|
95
81
|
* already renders (`CollectionListItem`), best match first. */
|
|
96
82
|
export declare function fetchCollectionSearchPage(data: ResourceSearchInput): Promise<ResourceSearchPage<CollectionListItem>>;
|
|
97
83
|
/** One page of matching pages and articles as a single ranked list. An
|
|
98
|
-
* article's excerpt is its summary,
|
|
99
|
-
* `imageWidth` for a thumbnail on each article; without it none is
|
|
84
|
+
* article's excerpt is its summary, else its body's opening. Pass
|
|
85
|
+
* `imageWidth` for a thumbnail on each article; without it none is drawn. */
|
|
100
86
|
export declare function fetchContentSearchPage(data: ResourceSearchInput & {
|
|
101
87
|
imageWidth?: number;
|
|
102
88
|
}): Promise<ResourceSearchPage<SearchContentItem>>;
|
|
103
|
-
/** The typeahead's collection and content groups: titles and the handles to
|
|
104
|
-
* link them by, nothing a row doesn't draw. */
|
|
105
|
-
export type ResourceSuggestions = {
|
|
106
|
-
collections: {
|
|
107
|
-
handle: string;
|
|
108
|
-
title: string;
|
|
109
|
-
}[];
|
|
110
|
-
content: ({
|
|
111
|
-
kind: "page";
|
|
112
|
-
handle: string;
|
|
113
|
-
title: string;
|
|
114
|
-
} | {
|
|
115
|
-
kind: "article";
|
|
116
|
-
handle: string;
|
|
117
|
-
blogHandle: string;
|
|
118
|
-
title: string;
|
|
119
|
-
})[];
|
|
120
|
-
};
|
|
121
|
-
/** Top matching collections, pages and articles for a typeahead — its own
|
|
122
|
-
* lean operation, issued in the same tick as `fetchProductSuggestions` so the
|
|
123
|
-
* pair rides one POST. Hit per keystroke, so a failure (or a tripped rate
|
|
124
|
-
* limit, which nulls a field) is simply two empty groups: the product rows
|
|
125
|
-
* must not go down with it. */
|
|
126
|
-
export declare function fetchResourceSuggestions(data: {
|
|
127
|
-
query: string;
|
|
128
|
-
locale?: string;
|
|
129
|
-
}): Promise<ResourceSuggestions>;
|
|
130
89
|
export type ProductSuggestion = {
|
|
131
90
|
handle: string;
|
|
132
91
|
title: string;
|
|
@@ -139,17 +98,53 @@ export type ProductSuggestion = {
|
|
|
139
98
|
available?: boolean;
|
|
140
99
|
variantsCount?: number;
|
|
141
100
|
};
|
|
101
|
+
/** The typeahead: product rows, the collection and content groups when the
|
|
102
|
+
* caller asked for them (`resources`), and the term completions that go above
|
|
103
|
+
* them. `terms` is `null` when the terms read failed (transient: the caller
|
|
104
|
+
* may retry), `[]` when the shop genuinely has none. */
|
|
142
105
|
export type SearchSuggestionsResponse = {
|
|
143
106
|
suggestions: ProductSuggestion[];
|
|
107
|
+
collections: {
|
|
108
|
+
handle: string;
|
|
109
|
+
title: string;
|
|
110
|
+
}[];
|
|
111
|
+
content: ({
|
|
112
|
+
kind: "page";
|
|
113
|
+
handle: string;
|
|
114
|
+
title: string;
|
|
115
|
+
} | {
|
|
116
|
+
kind: "article";
|
|
117
|
+
handle: string;
|
|
118
|
+
blogHandle: string;
|
|
119
|
+
blogTitle: string;
|
|
120
|
+
title: string;
|
|
121
|
+
})[];
|
|
144
122
|
terms: string[] | null;
|
|
145
123
|
};
|
|
146
|
-
|
|
124
|
+
/**
|
|
125
|
+
* Storefront typeahead, hit per keystroke (debounced by the caller): one
|
|
126
|
+
* `search.suggest` for the rows of every kind and, beside it, one
|
|
127
|
+
* `search.terms` for the completions. Terms are read unless the theme says
|
|
128
|
+
* `terms: false` (one that draws them only for a blank query passes it on a
|
|
129
|
+
* matched one) — a blank query is the empty field's "most searched" list —
|
|
130
|
+
* and are the optional half: a terms failure (or `terms: false`) is
|
|
131
|
+
* `terms: null`, a rows failure no rows, neither takes the other down. The
|
|
132
|
+
* server is the trust boundary for every number.
|
|
133
|
+
*
|
|
134
|
+
* A plain function, not a `createServerFn`: a server fn declared in a package
|
|
135
|
+
* and reached only through a theme handler's dynamic import never makes
|
|
136
|
+
* Start's server-fn manifest, so calling it fails at runtime with "Server
|
|
137
|
+
* function info not found". A theme wraps this in its own server fn.
|
|
138
|
+
*/
|
|
139
|
+
export declare function fetchSearchSuggestions(data: {
|
|
147
140
|
query: string;
|
|
148
141
|
first?: number;
|
|
142
|
+
/** The collection and content groups too. */
|
|
143
|
+
resources?: boolean;
|
|
149
144
|
mediaWidth?: number;
|
|
150
145
|
hover?: boolean;
|
|
151
146
|
quickAdd?: boolean;
|
|
147
|
+
terms?: boolean;
|
|
152
148
|
locale?: string;
|
|
153
149
|
}): Promise<SearchSuggestionsResponse>;
|
|
154
|
-
//#endregion
|
|
155
150
|
export {};
|