@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.
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/product.d.ts CHANGED
@@ -1,7 +1,17 @@
1
1
  import { FileInfo, ImageFileInfo, VideoFileInfo } from "./files.js";
2
+ import { MetafieldMap } from "./metafields.js";
2
3
  import { Money } from "@shop-on/theme-runtime/money";
3
4
  import { ProductOption, ProductVariant } from "@shop-on/theme-runtime/product-variants";
4
- //#region src/product.d.ts
5
+ /** A product's published reviews: the average stars (to one decimal) and how
6
+ * many. `distribution` (the page only) is each star's count, one to five. */
7
+ export type ProductRating = {
8
+ value: number;
9
+ count: number;
10
+ distribution?: {
11
+ rating: number;
12
+ count: number;
13
+ }[];
14
+ };
5
15
  export type ProductData = {
6
16
  id?: string;
7
17
  handle: string;
@@ -22,96 +32,61 @@ export type ProductData = {
22
32
  variantsCount?: number;
23
33
  media: FileInfo[];
24
34
  options?: ProductOption[];
35
+ variantMedia?: FileInfo[];
25
36
  variants?: ProductVariant[];
26
37
  defaultVariant?: ProductVariant;
27
- aggregateRating?: {
28
- value: number;
29
- count: number;
30
- distribution?: {
31
- rating: number;
32
- count: number;
33
- }[];
34
- };
38
+ variantMediaMap?: Record<string, string[]>;
39
+ rating?: ProductRating | null;
35
40
  seo?: {
36
41
  title: string;
37
42
  description: string;
38
43
  };
39
- metafields?: Record<string, {
40
- type: string;
41
- value: string;
42
- }>;
44
+ metafields?: MetafieldMap;
43
45
  finalSale?: boolean;
44
46
  gtin?: string | null;
45
47
  };
46
- export declare const BadgeTagsFragment: import("gql.tada").TadaDocumentNode<{
47
- tags: string[];
48
- }, {}, {
49
- fragment: "BadgeTags";
50
- on: "ShopProduct";
51
- masked: false;
52
- }>;
53
- /** `"namespace.key"` names as the card queries' metafield variables. Nothing
54
- * named ⇒ the selection stays `@include`d out and the variables at their
55
- * defaults, so a caller naming no keys sends exactly the query it always did.
56
- * A name without a dot (or with an empty side) names no key and is dropped. */
57
- export declare function metafieldKeysVariables(keys: readonly string[] | undefined): {
58
- withMetafields?: true;
59
- metafieldFirst?: number;
60
- metafieldKeys?: Array<{
61
- namespace: string;
62
- key: string;
63
- }>;
64
- };
65
- /** The cache-key segment for a key list: sorted, so two callers naming the
66
- * same keys in a different order share one entry. */
67
- export declare function metafieldKeysKey(keys: readonly string[] | undefined): string;
68
- /** Lean fetch for product cards (collection grids, social tiles, shop-the-look).
69
- * Skips description and caps media at 5. Used by the `product_list` resolver.
70
- * `includeOptions` (default true) gates the variant-options payload — pass
71
- * false when the consuming cards render no swatches. */
48
+ /** The product page whole, by handle or `prod_…` id (a bound product
49
+ * reference's value): description, every option, variant and media, every
50
+ * storefront-visible metafield. Null when a buyer may not see it, and on a
51
+ * failed read (not cached). */
52
+ export declare function fetchProductFull(ref: string, opts?: {
53
+ preview?: boolean;
54
+ locale?: string;
55
+ }): Promise<ProductData | null>;
56
+ /** A product card (grids, social tiles, shop-the-look, the `product` and
57
+ * `product_list` settings). `includeOptions` (default true) asks for the
58
+ * options a swatch row draws; `metafieldKeys` for the metafields a bound
59
+ * source on the card reads. */
72
60
  export declare function fetchProduct(ref: string, opts?: {
73
61
  includeOptions?: boolean;
74
62
  locale?: string;
75
63
  metafieldKeys?: readonly string[];
76
64
  }): Promise<ProductData | null>;
77
- /** Lean card fetch with a plain-text description — same footprint as
78
- * {@link fetchProduct}, plus `descriptionPlain`; no options/variants. For cards
79
- * that render a short copy blurb (e.g. editorial "showcase" cards). */
80
- export declare const fetchProductShowcase: (ref: string, locale?: string | undefined) => Promise<ProductData | null>;
81
- export declare function fetchProductFull(handle: string, opts?: {
82
- preview?: boolean;
83
- locale?: string;
84
- }): Promise<ProductData | null>;
85
- export declare const fetchVariantMediaMap: (handle: string) => Promise<Record<string, string[]>>;
86
- /** Card fetch that also carries a truncated plain-text description — for a
87
- * `product_list` whose first product is featured in a detail panel while the
88
- * rest render as cards. `includeOptions` (default true) gates the swatch payload
89
- * exactly as in {@link fetchProduct}. */
65
+ /** A card with its plain-text description and no options, for cards that
66
+ * render a short blurb (editorial "showcase" cards). Three media: the card
67
+ * shows one, the rest cover a video-first list. */
68
+ export declare function fetchProductShowcase(ref: string, locale?: string): Promise<ProductData | null>;
69
+ /** A card with its plain-text description, for a `product_list` whose first
70
+ * product is featured in a detail panel (its description and a small grid of
71
+ * its media) while the rest render as cards. `includeOptions` (default true)
72
+ * as in {@link fetchProduct}. */
90
73
  export declare function fetchProductListDetail(ref: string, opts?: {
91
74
  includeOptions?: boolean;
92
75
  locale?: string;
93
76
  }): Promise<ProductData | null>;
94
- /** "Showcase" media for a product, read from two `file`-type metafields
95
- * (`<namespace>.<imageKey>` / `<namespace>.<videoKey>`) and dereferenced to
96
- * renderable files. Each field is null when its metafield is unset, its
97
- * definition isn't storefront-visible, or it points at a missing / wrong-kind
98
- * file — so a caller can cleanly fall back to the product's own featured media.
99
- * The whole result is null only on a fetch failure (not cached, so a transient
100
- * error can't pin "no showcase media" for the full TTL).
101
- *
102
- * A `file` metafield's `value` is a `Shop::File` GID (`FILE_REFERENCE`); the
103
- * storefront metafield type exposes no resolved `reference`, so the GID is
104
- * dereferenced through the same `node(id:)` path as every other file
105
- * ({@link fetchFileById}). Only the two named metafields are read (not the full
106
- * set), so this stays lean enough for card lists. */
107
77
  export type ProductShowcaseMedia = {
108
78
  image: ImageFileInfo | null;
109
79
  video: VideoFileInfo | null;
110
80
  };
81
+ /** "Showcase" media for a product, from two `file_reference` metafields
82
+ * (`<namespace>.<imageKey>`, `<namespace>.<videoKey>`), each read off the
83
+ * file the value names. Each is null when its metafield is unset, not
84
+ * storefront-visible, or names a file of the other kind, so a caller falls
85
+ * back to the product's own media. The whole is null only on a failed read
86
+ * (not cached). */
111
87
  export declare const fetchProductShowcaseMedia: (args_0: {
112
88
  handle: string;
113
89
  namespace: string;
114
90
  imageKey: string;
115
91
  videoKey: string;
116
- }) => Promise<ProductShowcaseMedia | null>;
117
- //#endregion
92
+ }) => Promise<ProductShowcaseMedia | null>;