@tanqory/theme-kit 0.1.0 → 2.0.0-alpha.3
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/LICENSE +21 -0
- package/README.md +98 -10
- package/dist/abi/canvas-live.d.ts +49 -0
- package/dist/abi/canvas-live.js +88 -0
- package/dist/abi/cart.d.ts +48 -0
- package/dist/abi/cart.js +256 -0
- package/dist/abi/convert.d.ts +126 -0
- package/dist/abi/convert.js +493 -0
- package/dist/abi/data-api.d.ts +11 -0
- package/dist/abi/data-api.js +178 -0
- package/dist/abi/jcs.d.ts +6 -0
- package/dist/abi/jcs.js +28 -0
- package/dist/abi/page-data.d.ts +198 -0
- package/dist/abi/page-data.js +577 -0
- package/dist/abi/page.d.ts +23 -0
- package/dist/abi/page.js +46 -0
- package/dist/abi/referrals.d.ts +23 -0
- package/dist/abi/referrals.js +89 -0
- package/dist/abi/rewards.d.ts +27 -0
- package/dist/abi/rewards.js +82 -0
- package/dist/abi/seo.d.ts +47 -0
- package/dist/abi/seo.js +68 -0
- package/dist/abi/shell.d.ts +22 -0
- package/dist/abi/shell.js +10 -0
- package/dist/abi/wire.d.ts +38 -0
- package/dist/abi/wire.js +84 -0
- package/dist/build.d.ts +113 -0
- package/dist/build.js +294 -0
- package/dist/client.d.ts +19 -0
- package/dist/client.js +76 -0
- package/dist/contract.d.ts +6 -0
- package/dist/contract.js +6 -0
- package/dist/headless/ai.d.ts +132 -0
- package/dist/headless/ai.js +99 -0
- package/dist/headless/hooks.d.ts +273 -0
- package/dist/headless/hooks.js +533 -0
- package/dist/headless/i18n.d.ts +13 -0
- package/dist/headless/i18n.js +45 -0
- package/dist/headless/index.d.ts +36 -0
- package/dist/headless/index.js +38 -0
- package/dist/headless/money.d.ts +25 -0
- package/dist/headless/money.js +61 -0
- package/dist/headless/page.d.ts +43 -0
- package/dist/headless/page.js +53 -0
- package/dist/headless/platform.d.ts +55 -0
- package/dist/headless/platform.js +77 -0
- package/dist/headless/primitives/cart.d.ts +90 -0
- package/dist/headless/primitives/cart.js +153 -0
- package/dist/headless/primitives/collection.d.ts +68 -0
- package/dist/headless/primitives/collection.js +80 -0
- package/dist/headless/primitives/product.d.ts +101 -0
- package/dist/headless/primitives/product.js +117 -0
- package/dist/headless/primitives/storefront.d.ts +106 -0
- package/dist/headless/primitives/storefront.js +186 -0
- package/dist/headless/primitives/util.d.ts +19 -0
- package/dist/headless/primitives/util.js +42 -0
- package/dist/headless/strings.d.ts +9 -0
- package/dist/headless/strings.js +186 -0
- package/dist/headless/structured-data.d.ts +31 -0
- package/dist/headless/structured-data.js +57 -0
- package/dist/headless/theme.d.ts +99 -0
- package/dist/headless/theme.js +54 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.js +18 -553
- package/dist/runtime/data/StoreProvider.d.ts +56 -0
- package/dist/runtime/data/StoreProvider.js +308 -0
- package/dist/runtime/data/handle.d.ts +14 -0
- package/dist/runtime/data/handle.js +16 -0
- package/dist/runtime/data/routes.d.ts +87 -0
- package/dist/runtime/data/routes.js +154 -0
- package/dist/runtime/data/to-ui.d.ts +237 -0
- package/dist/runtime/data/to-ui.js +759 -0
- package/dist/runtime/entries/register.d.ts +9 -0
- package/dist/runtime/entries/register.js +9 -0
- package/dist/runtime/entries/sections.d.ts +16 -0
- package/dist/runtime/entries/sections.js +19 -0
- package/dist/{types → runtime/kit}/SectionTree.d.ts +2 -1
- package/dist/runtime/kit/SectionTree.js +100 -0
- package/dist/runtime/kit/analytics.d.ts +63 -0
- package/dist/runtime/kit/analytics.js +233 -0
- package/dist/runtime/kit/cart.d.ts +167 -0
- package/dist/runtime/kit/cart.js +544 -0
- package/dist/{types → runtime/kit}/composition.d.ts +1 -1
- package/dist/runtime/kit/composition.js +3 -0
- package/dist/{types → runtime/kit}/config.d.ts +2 -2
- package/dist/runtime/kit/config.js +6 -0
- package/dist/runtime/kit/consent.d.ts +29 -0
- package/dist/runtime/kit/consent.js +159 -0
- package/dist/runtime/kit/contract/content.d.ts +164 -0
- package/dist/runtime/kit/contract/content.js +83 -0
- package/dist/runtime/kit/contract/field-types.d.ts +290 -0
- package/dist/runtime/kit/contract/field-types.js +129 -0
- package/dist/runtime/kit/contract/groups.d.ts +230 -0
- package/dist/runtime/kit/contract/groups.js +402 -0
- package/dist/runtime/kit/contract/index.d.ts +33 -0
- package/dist/runtime/kit/contract/index.js +33 -0
- package/dist/runtime/kit/contract/transform.d.ts +82 -0
- package/dist/runtime/kit/contract/transform.js +133 -0
- package/dist/runtime/kit/contract/validate.d.ts +67 -0
- package/dist/runtime/kit/contract/validate.js +388 -0
- package/dist/{types → runtime/kit}/data.d.ts +276 -7
- package/dist/runtime/kit/data.js +1117 -0
- package/dist/{types → runtime/kit}/defineSection.d.ts +1 -1
- package/dist/runtime/kit/defineSection.js +10 -0
- package/dist/{types → runtime/kit}/dynamic-source.d.ts +4 -4
- package/dist/runtime/kit/dynamic-source.js +143 -0
- package/dist/runtime/kit/index.d.ts +24 -0
- package/dist/runtime/kit/index.js +24 -0
- package/dist/{types → runtime/kit}/jsx-to-json.d.ts +1 -1
- package/dist/runtime/kit/jsx-to-json.js +28 -0
- package/dist/{types → runtime/kit}/mount.d.ts +25 -4
- package/dist/runtime/kit/mount.js +124 -0
- package/dist/{types → runtime/kit}/registry.d.ts +1 -1
- package/dist/runtime/kit/registry.js +12 -0
- package/dist/{types → runtime/kit}/ssg.d.ts +9 -3
- package/dist/runtime/kit/ssg.js +56 -0
- package/dist/{types → runtime/kit}/storefront.d.ts +206 -7
- package/dist/runtime/kit/storefront.js +723 -0
- package/dist/{types → runtime/kit}/theme-context.d.ts +8 -2
- package/dist/runtime/kit/theme-context.js +25 -0
- package/dist/runtime/kit/types.d.ts +142 -0
- package/dist/runtime/kit/types.js +1 -0
- package/dist/runtime/platform/TrackingPixels.d.ts +14 -0
- package/dist/runtime/platform/TrackingPixels.js +63 -0
- package/dist/runtime/platform/environment.d.ts +68 -0
- package/dist/runtime/platform/environment.js +85 -0
- package/dist/runtime/platform/locale.d.ts +27 -0
- package/dist/runtime/platform/locale.js +42 -0
- package/dist/runtime/platform/route-analytics.d.ts +15 -0
- package/dist/runtime/platform/route-analytics.js +72 -0
- package/dist/runtime/platform/safe-href.d.ts +25 -0
- package/dist/runtime/platform/safe-href.js +69 -0
- package/dist/runtime/platform/safe-values.d.ts +37 -0
- package/dist/runtime/platform/safe-values.js +140 -0
- package/dist/runtime/render/SectionRenderer.d.ts +4 -0
- package/dist/runtime/render/SectionRenderer.js +111 -0
- package/dist/runtime/render/listing-query.d.ts +47 -0
- package/dist/runtime/render/listing-query.js +114 -0
- package/dist/runtime/render/localized-copy.d.ts +86 -0
- package/dist/runtime/render/localized-copy.js +129 -0
- package/dist/runtime/render/product-listing.d.ts +11 -0
- package/dist/runtime/render/product-listing.js +240 -0
- package/dist/runtime/render/section-actions.d.ts +44 -0
- package/dist/runtime/render/section-actions.js +169 -0
- package/dist/runtime/render/starter.d.ts +11 -0
- package/dist/runtime/render/starter.js +81 -0
- package/dist/runtime/seo/head.d.ts +87 -0
- package/dist/runtime/seo/head.js +224 -0
- package/dist/runtime/seo/structured-data.d.ts +22 -0
- package/dist/runtime/seo/structured-data.js +115 -0
- package/dist/runtime/shell/PageShell.d.ts +18 -0
- package/dist/runtime/shell/PageShell.js +113 -0
- package/dist/runtime/shell/RuntimeBridge.d.ts +14 -0
- package/dist/runtime/shell/RuntimeBridge.js +82 -0
- package/dist/runtime/shell/overlay-state.d.ts +31 -0
- package/dist/runtime/shell/overlay-state.js +59 -0
- package/dist/runtime/shell/preview-mode.d.ts +2 -0
- package/dist/runtime/shell/preview-mode.js +11 -0
- package/dist/runtime/shell/spa-router.d.ts +14 -0
- package/dist/runtime/shell/spa-router.js +76 -0
- package/dist/runtime/shell/url-redirects.d.ts +6 -0
- package/dist/runtime/shell/url-redirects.js +37 -0
- package/dist/runtime/slots.d.ts +74 -0
- package/dist/runtime/slots.js +16 -0
- package/dist/runtime.d.ts +34 -0
- package/dist/runtime.js +40 -0
- package/dist/sdk/index.d.ts +24 -0
- package/dist/sdk/index.js +24 -0
- package/dist/sdk/referrals.d.ts +62 -0
- package/dist/sdk/referrals.js +20 -0
- package/dist/sdk/rewards.d.ts +85 -0
- package/dist/sdk/rewards.js +29 -0
- package/dist/sdk/runtime-context.d.ts +120 -0
- package/dist/sdk/runtime-context.js +73 -0
- package/dist/sdk/schema.d.ts +197 -0
- package/dist/sdk/schema.js +121 -0
- package/dist/sdk/server-render.d.ts +8 -0
- package/dist/sdk/server-render.js +12 -0
- package/dist/sdk/store-lookup.d.ts +27 -0
- package/dist/sdk/store-lookup.js +29 -0
- package/dist/sdk/store.d.ts +115 -0
- package/dist/sdk/store.js +1 -0
- package/dist/sdk/sx.d.ts +40 -0
- package/dist/sdk/sx.js +112 -0
- package/dist/sdk/theme.d.ts +152 -0
- package/dist/sdk/theme.js +10 -0
- package/dist/sdk/types.d.ts +395 -0
- package/dist/sdk/types.js +7 -0
- package/dist/server.d.ts +65 -0
- package/dist/server.js +370 -0
- package/docs/headless-api.md +220 -0
- package/package.json +77 -23
- package/dist/index.js.map +0 -1
- package/dist/ssg-BZ5FYTw7.js +0 -1802
- package/dist/ssg-BZ5FYTw7.js.map +0 -1
- package/dist/ssg.js +0 -8
- package/dist/ssg.js.map +0 -1
- package/dist/types/cart.d.ts +0 -86
- package/dist/types/editor.d.ts +0 -5
- package/dist/types/index.d.ts +0 -20
- package/dist/types/preview-bridge.d.ts +0 -9
- package/dist/types/types.d.ts +0 -44
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
*
|
|
4
4
|
* `data.tsx` boots a small homepage prefetch (collections + products + page +
|
|
5
5
|
* localization) and exposes a raw `graphql()` escape hatch. This module layers
|
|
6
|
-
* the REST of the
|
|
7
|
-
* requester so a theme can build
|
|
6
|
+
* the REST of the storefront-standard surface on top of that same
|
|
7
|
+
* requester so a theme can build every standard storefront page:
|
|
8
8
|
*
|
|
9
9
|
* - Navigation menus (header/footer, recursive)
|
|
10
10
|
* - Blog + articles
|
|
@@ -14,17 +14,17 @@
|
|
|
14
14
|
* - Shop info + legal policies
|
|
15
15
|
* - Full customer account flow (login / register / orders / addresses)
|
|
16
16
|
*
|
|
17
|
-
* Every field hit here ALREADY EXISTS on
|
|
17
|
+
* Every field hit here ALREADY EXISTS on the platform store API's Storefront
|
|
18
18
|
* GraphQL schema (`POST /api/v1/stores/{id}/graphql`). These methods attach to
|
|
19
19
|
* the LIVE DataApi only — mock data leaves them undefined, so themes feature-
|
|
20
20
|
* detect (`data.search?.(...)`, `data.customer?.login(...)`).
|
|
21
21
|
*
|
|
22
22
|
* Token storage: the customer flow returns/accepts a `customerAccessToken`
|
|
23
|
-
* (
|
|
23
|
+
* (commerce-standard). The theme persists it (localStorage) and passes it
|
|
24
24
|
* back — exactly like the cart's `cartId`. `customerTokenStore` is a tiny
|
|
25
25
|
* localStorage helper for the common case.
|
|
26
26
|
*/
|
|
27
|
-
import type { Money, Product } from './data';
|
|
27
|
+
import type { Money, Product } from './data.js';
|
|
28
28
|
type GraphqlFn = <T = unknown>(query: string, variables?: Record<string, unknown>) => Promise<T>;
|
|
29
29
|
/** Normalizers injected from data.tsx (avoids a runtime import cycle). */
|
|
30
30
|
export interface StorefrontHelpers {
|
|
@@ -33,6 +33,9 @@ export interface StorefrontHelpers {
|
|
|
33
33
|
export interface Image {
|
|
34
34
|
url: string;
|
|
35
35
|
altText?: string;
|
|
36
|
+
width?: number | null;
|
|
37
|
+
height?: number | null;
|
|
38
|
+
aspectRatio?: number | null;
|
|
36
39
|
}
|
|
37
40
|
export interface Seo {
|
|
38
41
|
title?: string | null;
|
|
@@ -64,12 +67,24 @@ export interface Article {
|
|
|
64
67
|
publishedAt?: string;
|
|
65
68
|
tags: string[];
|
|
66
69
|
blogHandle?: string;
|
|
70
|
+
seo?: {
|
|
71
|
+
title?: string | null;
|
|
72
|
+
description?: string | null;
|
|
73
|
+
keywords?: string[] | null;
|
|
74
|
+
} | null;
|
|
75
|
+
templateSuffix?: string | null;
|
|
67
76
|
}
|
|
68
77
|
export interface Blog {
|
|
69
78
|
id: string;
|
|
70
79
|
handle: string;
|
|
71
80
|
title: string;
|
|
72
81
|
articles: Article[];
|
|
82
|
+
seo?: {
|
|
83
|
+
title?: string | null;
|
|
84
|
+
description?: string | null;
|
|
85
|
+
keywords?: string[] | null;
|
|
86
|
+
} | null;
|
|
87
|
+
templateSuffix?: string | null;
|
|
73
88
|
}
|
|
74
89
|
/** Relay-style page info — drives "load more" / infinite scroll. */
|
|
75
90
|
export interface PageInfo {
|
|
@@ -83,6 +98,8 @@ export interface Filter {
|
|
|
83
98
|
id: string;
|
|
84
99
|
label: string;
|
|
85
100
|
type: string;
|
|
101
|
+
/** How to render values (`filter.presentation`): TEXT | IMAGE | SWATCH. */
|
|
102
|
+
presentation?: string | null;
|
|
86
103
|
values: Array<{
|
|
87
104
|
id: string;
|
|
88
105
|
label: string;
|
|
@@ -107,6 +124,12 @@ export interface CollectionProductsPage {
|
|
|
107
124
|
products: Product[];
|
|
108
125
|
filters: Filter[];
|
|
109
126
|
pageInfo: PageInfo;
|
|
127
|
+
/**
|
|
128
|
+
* True when the storefront has no collection with this handle — deleted,
|
|
129
|
+
* or not published to the online store. Distinct from an existing
|
|
130
|
+
* collection with no products, which a section words differently.
|
|
131
|
+
*/
|
|
132
|
+
missing?: boolean;
|
|
110
133
|
}
|
|
111
134
|
export interface PredictiveSearchResults {
|
|
112
135
|
queries: string[];
|
|
@@ -141,13 +164,49 @@ export interface ShopPolicy {
|
|
|
141
164
|
url: string;
|
|
142
165
|
body?: string;
|
|
143
166
|
}
|
|
167
|
+
export interface ConsentBannerConfig {
|
|
168
|
+
enabled: boolean;
|
|
169
|
+
automated: boolean;
|
|
170
|
+
position: 'bottom' | 'bottom-left' | 'bottom-right' | 'bottom-center' | 'center';
|
|
171
|
+
colorTheme: 'light' | 'dark' | 'custom';
|
|
172
|
+
regions: string[];
|
|
173
|
+
privacyLinkUrl?: string;
|
|
174
|
+
text: Partial<Record<'title' | 'body' | 'privacyLinkLabel' | 'acceptLabel' | 'declineLabel' | 'manageLabel', string>>;
|
|
175
|
+
preferences: Partial<Record<'title' | 'introTitle' | 'introBody' | 'acceptAllLabel' | 'declineAllLabel' | 'saveLabel' | 'bulletTitle' | 'requiredTitle' | 'requiredDescription' | 'personalizationTitle' | 'personalizationDescription' | 'marketingTitle' | 'marketingDescription' | 'analyticsTitle' | 'analyticsDescription', string>> & {
|
|
176
|
+
bullets?: string[];
|
|
177
|
+
};
|
|
178
|
+
}
|
|
144
179
|
export interface Shop {
|
|
145
180
|
name: string;
|
|
146
181
|
description?: string | null;
|
|
182
|
+
/** Store contact (standard `shop.email` / `shop.phone`). */
|
|
183
|
+
email?: string | null;
|
|
184
|
+
phone?: string | null;
|
|
147
185
|
brand?: {
|
|
148
186
|
logo?: Image | null;
|
|
187
|
+
squareLogo?: Image | null;
|
|
188
|
+
/** Settings → Brand share banner (`Brand.coverImage`) — the merchant's
|
|
189
|
+
* purpose-built og:image. */
|
|
190
|
+
coverImage?: Image | null;
|
|
149
191
|
slogan?: string | null;
|
|
150
192
|
shortDescription?: string | null;
|
|
193
|
+
/** Settings → Brand. `primary[0]` is the brand colour; themes should treat
|
|
194
|
+
* the rest as an ordered palette. Every field is nullable — an
|
|
195
|
+
* unconfigured store yields nulls, never an error. */
|
|
196
|
+
colors?: {
|
|
197
|
+
primary: {
|
|
198
|
+
background?: string | null;
|
|
199
|
+
foreground?: string | null;
|
|
200
|
+
}[];
|
|
201
|
+
secondary: {
|
|
202
|
+
background?: string | null;
|
|
203
|
+
foreground?: string | null;
|
|
204
|
+
}[];
|
|
205
|
+
} | null;
|
|
206
|
+
/** Settings → Brand fonts (`Brand.fonts: [String!]!`), family names in
|
|
207
|
+
* priority order — e.g. `["Playfair Display", "Inter"]`. Themes map
|
|
208
|
+
* `[0]` → display and `[1]` → body. An unconfigured store returns `[]`. */
|
|
209
|
+
fonts?: string[] | null;
|
|
151
210
|
} | null;
|
|
152
211
|
/** Custom shop metafields ("namespace.key" → value) for dynamic sources. */
|
|
153
212
|
metafields?: Record<string, string | null>;
|
|
@@ -158,11 +217,65 @@ export interface Shop {
|
|
|
158
217
|
shipping?: ShopPolicy | null;
|
|
159
218
|
subscription?: ShopPolicy | null;
|
|
160
219
|
};
|
|
220
|
+
/** Settings › Taxes › prices include tax, for the shopper's market (Theme ABI `Shop.taxesIncluded`). */
|
|
221
|
+
taxesIncluded?: boolean;
|
|
222
|
+
/** The lowest "free over" shipping threshold for the shopper's country, in the market's currency. */
|
|
223
|
+
freeShippingThreshold?: {
|
|
224
|
+
amount: string;
|
|
225
|
+
currencyCode: string;
|
|
226
|
+
} | null;
|
|
227
|
+
/** Settings › Customer accounts › "Show sign-in links" — false hides the storefront's account links. */
|
|
228
|
+
signInLinks?: boolean;
|
|
229
|
+
/** The store's published policies (title + site path), when the platform listed them for this page. */
|
|
230
|
+
policyLinks?: ShopPolicy[];
|
|
231
|
+
/** Settings › Customer privacy › Cookie banner, as the platform sends it (Theme ABI `Shop.cookieBanner`). */
|
|
232
|
+
consentBanner?: ConsentBannerConfig | null;
|
|
161
233
|
/** Cookie-consent banner config (Settings → Customer privacy). */
|
|
162
234
|
cookieBanner?: {
|
|
235
|
+
/** EFFECTIVE requirement for THIS shopper (jurisdiction ∨ merchant toggle). */
|
|
163
236
|
enabled: boolean;
|
|
237
|
+
/** 'OPT_IN' | 'OPT_OUT' | 'NONE' — the server's per-buyer consent regime (journey-matrix 0.5). */
|
|
238
|
+
mode?: string | null;
|
|
164
239
|
dataSharingTitle?: string | null;
|
|
165
240
|
dataSharingVisible?: boolean;
|
|
241
|
+
title?: string | null;
|
|
242
|
+
body?: string | null;
|
|
243
|
+
acceptLabel?: string | null;
|
|
244
|
+
declineLabel?: string | null;
|
|
245
|
+
manageLabel?: string | null;
|
|
246
|
+
position?: string | null;
|
|
247
|
+
colorTheme?: string | null;
|
|
248
|
+
} | null;
|
|
249
|
+
/**
|
|
250
|
+
* The home page's search & social settings (Online store → Preferences: title, meta description,
|
|
251
|
+
* social sharing image), when the platform sends them (`Shop.seo`, an optional ABI field).
|
|
252
|
+
*/
|
|
253
|
+
seo?: {
|
|
254
|
+
title?: string;
|
|
255
|
+
description?: string;
|
|
256
|
+
image?: {
|
|
257
|
+
url: string;
|
|
258
|
+
altText?: string | null;
|
|
259
|
+
width?: number;
|
|
260
|
+
height?: number;
|
|
261
|
+
};
|
|
262
|
+
};
|
|
263
|
+
/** Primary storefront domain (for canonical URLs / SEO). */
|
|
264
|
+
primaryDomain?: {
|
|
265
|
+
host: string;
|
|
266
|
+
url: string;
|
|
267
|
+
sslEnabled: boolean;
|
|
268
|
+
} | null;
|
|
269
|
+
/** Settings → Social: public profile links, `platform` a lower-case network slug, `url` absolute https:. Absent when the store has none. */
|
|
270
|
+
socialLinks?: {
|
|
271
|
+
platform: string;
|
|
272
|
+
url: string;
|
|
273
|
+
}[] | null;
|
|
274
|
+
/** Accepted payment methods (for footer/checkout payment icons). */
|
|
275
|
+
paymentSettings?: {
|
|
276
|
+
acceptedCardBrands: string[];
|
|
277
|
+
supportedDigitalWallets: string[];
|
|
278
|
+
currencyCode?: string | null;
|
|
166
279
|
} | null;
|
|
167
280
|
}
|
|
168
281
|
export interface CustomerAddress {
|
|
@@ -188,8 +301,17 @@ export interface Customer {
|
|
|
188
301
|
phone?: string | null;
|
|
189
302
|
acceptsMarketing: boolean;
|
|
190
303
|
numberOfOrders: number;
|
|
304
|
+
/** Merchant-assigned customer tags (`customer.tags`). */
|
|
305
|
+
tags?: string[];
|
|
191
306
|
defaultAddress?: CustomerAddress | null;
|
|
192
307
|
addresses: CustomerAddress[];
|
|
308
|
+
/** Store-credit balances (`store_credit_account`). */
|
|
309
|
+
storeCreditAccounts?: StoreCreditAccount[];
|
|
310
|
+
}
|
|
311
|
+
/** A customer store-credit account balance (`store_credit_account`). */
|
|
312
|
+
export interface StoreCreditAccount {
|
|
313
|
+
id: string;
|
|
314
|
+
balance: Money;
|
|
193
315
|
}
|
|
194
316
|
export interface OrderLineItem {
|
|
195
317
|
title: string;
|
|
@@ -207,8 +329,69 @@ export interface Order {
|
|
|
207
329
|
fulfillmentStatus: string;
|
|
208
330
|
totalPrice: Money;
|
|
209
331
|
statusUrl: string;
|
|
332
|
+
/** Contact + cancellation (standard `order.email`/`phone`/`cancelled`/`cancel_reason`). */
|
|
333
|
+
email?: string | null;
|
|
334
|
+
phone?: string | null;
|
|
335
|
+
cancelled?: boolean;
|
|
336
|
+
cancelReason?: string | null;
|
|
337
|
+
/** Price breakdown (standard `order.subtotal_price`/`tax_price`/`shipping_price`). */
|
|
338
|
+
subtotalPrice?: Money | null;
|
|
339
|
+
totalTax?: Money | null;
|
|
340
|
+
totalShippingPrice?: Money | null;
|
|
341
|
+
/** Shipping / billing address (standard `order.shipping_address`/`billing_address`). */
|
|
342
|
+
shippingAddress?: CustomerAddress | null;
|
|
343
|
+
billingAddress?: CustomerAddress | null;
|
|
344
|
+
/** Fulfillments with tracking (`order.fulfillments`). */
|
|
345
|
+
fulfillments?: Array<{
|
|
346
|
+
trackingCompany?: string | null;
|
|
347
|
+
trackingInfo: Array<{
|
|
348
|
+
number?: string | null;
|
|
349
|
+
url?: string | null;
|
|
350
|
+
}>;
|
|
351
|
+
}>;
|
|
352
|
+
/** Payment transactions (`order.transactions`). */
|
|
353
|
+
transactions?: OrderTransaction[];
|
|
354
|
+
/** Gift cards issued by this order (`gift_card`). Code is masked to last 4. */
|
|
355
|
+
giftCards?: OrderGiftCard[];
|
|
210
356
|
lineItems: OrderLineItem[];
|
|
211
357
|
}
|
|
358
|
+
/** A gift card issued by an order (`gift_card`). Full code is never exposed. */
|
|
359
|
+
export interface OrderGiftCard {
|
|
360
|
+
id: string;
|
|
361
|
+
/** Last 4 characters of the code (full code never returned). */
|
|
362
|
+
lastCharacters: string;
|
|
363
|
+
balance: Money;
|
|
364
|
+
initialValue: Money;
|
|
365
|
+
enabled: boolean;
|
|
366
|
+
expiresOn?: string | null;
|
|
367
|
+
}
|
|
368
|
+
/** A payment transaction on an order (standard `order.transactions` / `transaction`). */
|
|
369
|
+
export interface OrderTransaction {
|
|
370
|
+
id: string;
|
|
371
|
+
/** AUTHORIZATION | CAPTURE | SALE | REFUND | VOID */
|
|
372
|
+
kind: string;
|
|
373
|
+
/** PENDING | SUCCESS | FAILURE | ERROR */
|
|
374
|
+
status: string;
|
|
375
|
+
amount: Money;
|
|
376
|
+
gateway?: string | null;
|
|
377
|
+
paymentMethod?: string | null;
|
|
378
|
+
processedAt: string;
|
|
379
|
+
}
|
|
380
|
+
/** A saved payment method on the customer account (`customer_payment_method`). */
|
|
381
|
+
export interface CustomerPaymentMethod {
|
|
382
|
+
id: string;
|
|
383
|
+
isDefault: boolean;
|
|
384
|
+
isActive: boolean;
|
|
385
|
+
/** CARD | BANK_ACCOUNT | PROMPTPAY | TRUEMONEY */
|
|
386
|
+
type: string;
|
|
387
|
+
card?: {
|
|
388
|
+
brand?: string | null;
|
|
389
|
+
lastDigits?: string | null;
|
|
390
|
+
expiryMonth?: number | null;
|
|
391
|
+
expiryYear?: number | null;
|
|
392
|
+
name?: string | null;
|
|
393
|
+
} | null;
|
|
394
|
+
}
|
|
212
395
|
export interface CustomerAddressInput {
|
|
213
396
|
firstName?: string;
|
|
214
397
|
lastName?: string;
|
|
@@ -232,7 +415,7 @@ export interface MutationResult<T = void> {
|
|
|
232
415
|
errors: string[];
|
|
233
416
|
data?: T;
|
|
234
417
|
}
|
|
235
|
-
/** Customer account flow —
|
|
418
|
+
/** Customer account flow — commerce-standard token model. Live-only. */
|
|
236
419
|
export interface CustomerApi {
|
|
237
420
|
/** Email + password → access token. Persist `token` (e.g. via customerTokenStore). */
|
|
238
421
|
login(email: string, password: string): Promise<AuthResult>;
|
|
@@ -255,6 +438,8 @@ export interface CustomerApi {
|
|
|
255
438
|
orders(token: string, opts?: {
|
|
256
439
|
first?: number;
|
|
257
440
|
}): Promise<Order[]>;
|
|
441
|
+
/** Saved payment methods (`customer.payment_methods`). */
|
|
442
|
+
paymentMethods(token: string): Promise<CustomerPaymentMethod[]>;
|
|
258
443
|
/** Guest order lookup — orderNumber + email (no account needed). */
|
|
259
444
|
orderByLookup(orderNumber: string, email: string): Promise<Order | null>;
|
|
260
445
|
createAddress(token: string, address: CustomerAddressInput): Promise<MutationResult<{
|
|
@@ -278,6 +463,8 @@ export interface StorefrontExtensions {
|
|
|
278
463
|
first?: number;
|
|
279
464
|
after?: string;
|
|
280
465
|
types?: Array<'PRODUCT' | 'PAGE' | 'ARTICLE'>;
|
|
466
|
+
/** Products order: 'price-asc' | 'price-desc' | 'title-asc' | 'created-desc'; absent = relevance. */
|
|
467
|
+
sort?: string;
|
|
281
468
|
}) => Promise<SearchResults>;
|
|
282
469
|
/** Autocomplete suggestions (header search dropdown). */
|
|
283
470
|
predictiveSearch?: (query: string, opts?: {
|
|
@@ -291,6 +478,18 @@ export interface StorefrontExtensions {
|
|
|
291
478
|
reverse?: boolean;
|
|
292
479
|
filters?: Array<Record<string, unknown>>;
|
|
293
480
|
}) => Promise<CollectionProductsPage>;
|
|
481
|
+
/**
|
|
482
|
+
* The first filtered page the server already loaded for a shared filtered URL (`filters` is the
|
|
483
|
+
* one request's filter objects), synchronously, or null. Lets the server HTML and the hydrating
|
|
484
|
+
* browser render the same filtered products.
|
|
485
|
+
*/
|
|
486
|
+
listingSeed?: (handle: string, filters: Array<Record<string, unknown>>) => {
|
|
487
|
+
products: Product[];
|
|
488
|
+
pageInfo?: {
|
|
489
|
+
hasNextPage?: boolean;
|
|
490
|
+
endCursor?: string | null;
|
|
491
|
+
};
|
|
492
|
+
} | null;
|
|
294
493
|
/** "You may also like" — related products for a product node id. */
|
|
295
494
|
productRecommendations?: (productId: string) => Promise<Product[]>;
|
|
296
495
|
/** A blog with its articles. */
|
|
@@ -310,7 +509,7 @@ export interface StorefrontExtensions {
|
|
|
310
509
|
}
|
|
311
510
|
/** GraphQL selection for shop + the two standard menus, spliced into the
|
|
312
511
|
* homepage bootstrap so the layout (nav + footer + policies) renders sync. */
|
|
313
|
-
export declare const BOOTSTRAP_SHOP_MENU = "\n shop {\n name\n description\n brand
|
|
512
|
+
export declare const BOOTSTRAP_SHOP_MENU = "\n shop {\n name\n description\n email\n phone\n # Ask for the whole brand, not a third of it. Settings \u2192 Brand persists a\n # logo, a square logo and brand colours; the SDL has carried them all along\n # and this selection took only logo/slogan/shortDescription, so a merchant\n # could upload a logo and set colours and their storefront never changed.\n # Nullable throughout (BrandColorGroup.background/foreground are String),\n # so an unconfigured store returns nulls rather than failing the query.\n brand {\n logo { url altText width height }\n squareLogo { url altText width height }\n coverImage { url altText width height }\n slogan\n shortDescription\n colors {\n primary { background foreground }\n secondary { background foreground }\n }\n # Settings \u2192 Brand typography. Selected here because a theme cannot fetch\n # it separately without a second bootstrap round-trip, and without it a\n # merchant who picks brand fonts sees no change on their storefront.\n fonts\n }\n privacyPolicy { handle title url }\n refundPolicy { handle title url }\n termsOfService { handle title url }\n shippingPolicy { handle title url }\n subscriptionPolicy { handle title url }\n cookieBanner { enabled mode dataSharingTitle dataSharingVisible title body acceptLabel declineLabel manageLabel position colorTheme }\n primaryDomain { host url sslEnabled }\n paymentSettings { acceptedCardBrands supportedDigitalWallets currencyCode }\n }\n mainMenu: menu(handle: \"main-menu\") { ...MenuFields }\n footerMenu: menu(handle: \"footer\") { ...MenuFields }\n";
|
|
314
513
|
/** Fragment defs the bootstrap query must include when it uses BOOTSTRAP_SHOP_MENU. */
|
|
315
514
|
export declare const BOOTSTRAP_SHOP_MENU_FRAGMENTS = "\n fragment MenuFields on Menu {\n id\n handle\n title\n items {\n ...MenuItemFields\n items { ...MenuItemFields items { ...MenuItemFields } }\n }\n }\n fragment MenuItemFields on MenuItem { id title url type resourceId }\n";
|
|
316
515
|
/** Pull shop + the prefetched menus out of a bootstrap response. */
|