@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/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
|
-
|
|
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
|
-
|
|
28
|
-
|
|
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?:
|
|
40
|
-
type: string;
|
|
41
|
-
value: string;
|
|
42
|
-
}>;
|
|
44
|
+
metafields?: MetafieldMap;
|
|
43
45
|
finalSale?: boolean;
|
|
44
46
|
gtin?: string | null;
|
|
45
47
|
};
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
|
|
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
|
-
/**
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
export declare
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
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>;
|