@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.
Files changed (168) hide show
  1. package/dist/account-state.js +1 -2
  2. package/dist/account.d.ts +1 -3
  3. package/dist/account.js +1 -3
  4. package/dist/activity.d.ts +1 -3
  5. package/dist/activity.js +1 -2
  6. package/dist/analytics-proxy.d.ts +8 -14
  7. package/dist/analytics-proxy.js +111 -28
  8. package/dist/analytics-script-proxy.d.ts +1 -5
  9. package/dist/analytics-script-proxy.js +4 -14
  10. package/dist/api-contract/src/addresses.js +32 -0
  11. package/dist/api-contract/src/areas.js +49 -0
  12. package/dist/api-contract/src/custom-data.d.ts +31 -0
  13. package/dist/api-contract/src/custom-data.js +303 -0
  14. package/dist/api-contract/src/ids.js +110 -0
  15. package/dist/api-contract/src/image.js +65 -0
  16. package/dist/api-contract/src/limits.js +44 -0
  17. package/dist/api-contract/src/media.js +13 -0
  18. package/dist/api-contract/src/pickup.js +11 -0
  19. package/dist/api-contract/src/recommendations.js +4 -0
  20. package/dist/api-contract/src/shops.js +27 -0
  21. package/dist/api-contract/src/storefront/analytics.d.ts +100 -0
  22. package/dist/api-contract/src/storefront/analytics.js +138 -0
  23. package/dist/api-contract/src/storefront/areas.d.ts +2 -0
  24. package/dist/api-contract/src/storefront/cart.d.ts +132 -0
  25. package/dist/api-contract/src/storefront/cart.js +248 -0
  26. package/dist/api-contract/src/storefront/catalog.d.ts +3 -0
  27. package/dist/api-contract/src/storefront/checkout-analytics.d.ts +2 -0
  28. package/dist/api-contract/src/storefront/checkout.d.ts +2 -0
  29. package/dist/api-contract/src/storefront/checkout.js +624 -0
  30. package/dist/api-contract/src/storefront/client.d.ts +3 -0
  31. package/dist/api-contract/src/storefront/client.js +6 -0
  32. package/dist/api-contract/src/storefront/content.d.ts +3 -0
  33. package/dist/api-contract/src/storefront/custom-data.d.ts +2 -0
  34. package/dist/api-contract/src/storefront/custom-data.js +27 -0
  35. package/dist/api-contract/src/storefront/customer.d.ts +2 -0
  36. package/dist/api-contract/src/storefront/customer.js +261 -0
  37. package/dist/api-contract/src/storefront/downloads.d.ts +2 -0
  38. package/dist/api-contract/src/storefront/draft-order-invoice.d.ts +2 -0
  39. package/dist/api-contract/src/storefront/forms.d.ts +2 -0
  40. package/dist/api-contract/src/storefront/forms.js +82 -0
  41. package/dist/api-contract/src/storefront/index.d.ts +20956 -0
  42. package/dist/api-contract/src/storefront/orders.d.ts +2 -0
  43. package/dist/api-contract/src/storefront/policies.d.ts +2 -0
  44. package/dist/api-contract/src/storefront/procedure.d.ts +2 -0
  45. package/dist/api-contract/src/storefront/procedure.js +29 -0
  46. package/dist/api-contract/src/storefront/reviews.d.ts +20 -0
  47. package/dist/api-contract/src/storefront/search.d.ts +3 -0
  48. package/dist/api-contract/src/storefront/seo.d.ts +2 -0
  49. package/dist/api-contract/src/storefront/seo.js +132 -0
  50. package/dist/api-contract/src/storefront/shop.d.ts +2 -0
  51. package/dist/api-contract/src/storefront/shop.js +101 -0
  52. package/dist/api-contract/src/taxonomy.js +5 -0
  53. package/dist/api-contract/src/text.js +15 -0
  54. package/dist/api-contract/src/theme-documents.js +13 -0
  55. package/dist/api-contract/src/theme-translations.d.ts +14 -0
  56. package/dist/api-contract/src/theme-translations.js +30 -0
  57. package/dist/api-contract/src/video.js +19 -0
  58. package/dist/availability.d.ts +6 -3
  59. package/dist/availability.js +11 -5
  60. package/dist/blog.d.ts +53 -59
  61. package/dist/blog.js +197 -497
  62. package/dist/cache.d.ts +5 -6
  63. package/dist/cache.js +1 -2
  64. package/dist/canonical-host.d.ts +4 -6
  65. package/dist/canonical-host.js +5 -6
  66. package/dist/card.js +159 -0
  67. package/dist/cart-customer.d.ts +1 -3
  68. package/dist/cart-customer.js +64 -105
  69. package/dist/cart-mutations.d.ts +43 -77
  70. package/dist/cart-mutations.js +106 -232
  71. package/dist/cart-recommendations.d.ts +1 -3
  72. package/dist/cart-recommendations.js +1 -2
  73. package/dist/cart-session.d.ts +1 -3
  74. package/dist/cart-session.js +1 -2
  75. package/dist/cart.d.ts +63 -224
  76. package/dist/cart.js +70 -197
  77. package/dist/checkout.d.ts +13 -17
  78. package/dist/checkout.js +75 -101
  79. package/dist/coalesce.js +57 -0
  80. package/dist/collection.d.ts +89 -298
  81. package/dist/collection.js +210 -656
  82. package/dist/contact.d.ts +20 -10
  83. package/dist/contact.js +36 -30
  84. package/dist/content-version.d.ts +37 -21
  85. package/dist/content-version.js +64 -42
  86. package/dist/contract-kit/src/client.d.ts +12 -0
  87. package/dist/contract-kit/src/client.js +156 -0
  88. package/dist/contract-kit/src/errors.d.ts +1 -0
  89. package/dist/contract-kit/src/errors.js +81 -0
  90. package/dist/contract-kit/src/ids.d.ts +1 -0
  91. package/dist/contract-kit/src/ids.js +118 -0
  92. package/dist/contract-kit/src/index.d.ts +7 -0
  93. package/dist/contract-kit/src/money.d.ts +1 -0
  94. package/dist/contract-kit/src/money.js +10 -0
  95. package/dist/contract-kit/src/pagination.d.ts +1 -0
  96. package/dist/contract-kit/src/procedure.d.ts +69 -0
  97. package/dist/contract-kit/src/procedure.js +16 -0
  98. package/dist/contract-kit/src/realtime.d.ts +1 -0
  99. package/dist/cookie-secret.js +1 -2
  100. package/dist/csrf.js +1 -2
  101. package/dist/customer-handoff.d.ts +1 -3
  102. package/dist/customer-handoff.js +10 -25
  103. package/dist/customer-session.d.ts +1 -3
  104. package/dist/customer-session.js +1 -2
  105. package/dist/customer.d.ts +2 -3
  106. package/dist/customer.js +27 -44
  107. package/dist/files.d.ts +49 -10
  108. package/dist/files.js +106 -89
  109. package/dist/fonts.d.ts +3 -5
  110. package/dist/fonts.js +16 -35
  111. package/dist/html.d.ts +1 -3
  112. package/dist/html.js +1 -2
  113. package/dist/liquid.d.ts +4 -10
  114. package/dist/liquid.js +25 -32
  115. package/dist/listing.js +79 -0
  116. package/dist/marketing-cookies.d.ts +1 -3
  117. package/dist/marketing-cookies.js +1 -2
  118. package/dist/menu.d.ts +46 -155
  119. package/dist/menu.js +51 -61
  120. package/dist/metafields.d.ts +9 -5
  121. package/dist/metafields.js +10 -38
  122. package/dist/metaobject.d.ts +10 -5
  123. package/dist/metaobject.js +43 -66
  124. package/dist/money.d.ts +7 -0
  125. package/dist/money.js +18 -0
  126. package/dist/newsletter.d.ts +19 -10
  127. package/dist/newsletter.js +31 -25
  128. package/dist/page.d.ts +13 -17
  129. package/dist/page.js +49 -105
  130. package/dist/password-session.d.ts +1 -3
  131. package/dist/password-session.js +1 -2
  132. package/dist/password.d.ts +25 -18
  133. package/dist/password.js +41 -59
  134. package/dist/policy.d.ts +7 -7
  135. package/dist/policy.js +19 -55
  136. package/dist/product.d.ts +42 -67
  137. package/dist/product.js +144 -644
  138. package/dist/read-ahead.d.ts +18 -0
  139. package/dist/read-ahead.js +32 -0
  140. package/dist/recommendations.d.ts +6 -12
  141. package/dist/recommendations.js +36 -60
  142. package/dist/review.d.ts +134 -94
  143. package/dist/review.js +257 -469
  144. package/dist/search.d.ts +59 -64
  145. package/dist/search.js +170 -469
  146. package/dist/seo-context.d.ts +1 -3
  147. package/dist/seo-context.js +4 -5
  148. package/dist/seo-documents.d.ts +50 -0
  149. package/dist/seo-documents.js +149 -0
  150. package/dist/shop-seo.d.ts +3 -5
  151. package/dist/shop-seo.js +7 -26
  152. package/dist/shop.d.ts +38 -42
  153. package/dist/shop.js +37 -51
  154. package/dist/store-availability.d.ts +12 -14
  155. package/dist/store-availability.js +18 -56
  156. package/dist/storefront.js +199 -0
  157. package/dist/structured-data.d.ts +3 -28
  158. package/dist/structured-data.js +19 -49
  159. package/dist/trace.js +1 -2
  160. package/dist/translations.d.ts +26 -31
  161. package/dist/translations.js +55 -28
  162. package/package.json +16 -14
  163. package/dist/graphql-env.d.ts +0 -22778
  164. package/dist/graphql.d.ts +0 -64
  165. package/dist/graphql.js +0 -344
  166. package/dist/schema.storefront.graphql +0 -10483
  167. package/dist/seo-proxy.d.ts +0 -11
  168. 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
- //#region src/search.d.ts
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
- export type ProductSearchMetafieldFilter = {
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
- filter?: ProductSearchFilterInput;
16
+ /** The search URL's filters (`parseListingFilters`). */
17
+ filter?: ListingFilters;
33
18
  sort?: ProductSearchSort;
34
- after?: string;
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. Returns `null` for blank query (caller
45
- * route renders the empty-prompt UI) or on GraphQL error. Uncached because
46
- * filter/sort/cursor permutations would blow the TTL cache. */
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 | null;
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 | null;
65
- /** Only when the caller asked for a thumbnail (`imageWidth`); a list
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
- after?: string;
69
+ /** 1-based. */
70
+ page?: number;
85
71
  locale?: string;
86
72
  };
87
- /** Count-only read of all three search fields (`first: 0` loads no record).
88
- * Null when the request fails — a theme then draws no tab row rather than a
89
- * row of zeroes it can't stand behind. */
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, falling back to the body's opening. Pass
99
- * `imageWidth` for a thumbnail on each article; without it none is fetched. */
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
- export declare function fetchProductSuggestions(data: {
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 {};