@tanqory/theme-kit 0.1.0 → 2.0.0-alpha.5

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 (204) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +98 -10
  3. package/dist/abi/canvas-live.d.ts +49 -0
  4. package/dist/abi/canvas-live.js +88 -0
  5. package/dist/abi/cart.d.ts +48 -0
  6. package/dist/abi/cart.js +321 -0
  7. package/dist/abi/convert.d.ts +192 -0
  8. package/dist/abi/convert.js +670 -0
  9. package/dist/abi/data-api.d.ts +15 -0
  10. package/dist/abi/data-api.js +198 -0
  11. package/dist/abi/jcs.d.ts +6 -0
  12. package/dist/abi/jcs.js +28 -0
  13. package/dist/abi/page-data.d.ts +209 -0
  14. package/dist/abi/page-data.js +583 -0
  15. package/dist/abi/page.d.ts +23 -0
  16. package/dist/abi/page.js +46 -0
  17. package/dist/abi/referrals.d.ts +23 -0
  18. package/dist/abi/referrals.js +89 -0
  19. package/dist/abi/rewards.d.ts +27 -0
  20. package/dist/abi/rewards.js +82 -0
  21. package/dist/abi/seo.d.ts +47 -0
  22. package/dist/abi/seo.js +68 -0
  23. package/dist/abi/shell.d.ts +22 -0
  24. package/dist/abi/shell.js +10 -0
  25. package/dist/abi/wire.d.ts +38 -0
  26. package/dist/abi/wire.js +84 -0
  27. package/dist/build.d.ts +113 -0
  28. package/dist/build.js +294 -0
  29. package/dist/client.d.ts +19 -0
  30. package/dist/client.js +76 -0
  31. package/dist/contract.d.ts +6 -0
  32. package/dist/contract.js +6 -0
  33. package/dist/headless/ai.d.ts +132 -0
  34. package/dist/headless/ai.js +99 -0
  35. package/dist/headless/hooks.d.ts +273 -0
  36. package/dist/headless/hooks.js +533 -0
  37. package/dist/headless/i18n.d.ts +13 -0
  38. package/dist/headless/i18n.js +45 -0
  39. package/dist/headless/index.d.ts +36 -0
  40. package/dist/headless/index.js +38 -0
  41. package/dist/headless/money.d.ts +25 -0
  42. package/dist/headless/money.js +61 -0
  43. package/dist/headless/page.d.ts +43 -0
  44. package/dist/headless/page.js +53 -0
  45. package/dist/headless/platform.d.ts +55 -0
  46. package/dist/headless/platform.js +77 -0
  47. package/dist/headless/primitives/cart.d.ts +90 -0
  48. package/dist/headless/primitives/cart.js +153 -0
  49. package/dist/headless/primitives/collection.d.ts +68 -0
  50. package/dist/headless/primitives/collection.js +80 -0
  51. package/dist/headless/primitives/product.d.ts +101 -0
  52. package/dist/headless/primitives/product.js +117 -0
  53. package/dist/headless/primitives/storefront.d.ts +106 -0
  54. package/dist/headless/primitives/storefront.js +186 -0
  55. package/dist/headless/primitives/util.d.ts +19 -0
  56. package/dist/headless/primitives/util.js +42 -0
  57. package/dist/headless/strings.d.ts +9 -0
  58. package/dist/headless/strings.js +186 -0
  59. package/dist/headless/structured-data.d.ts +31 -0
  60. package/dist/headless/structured-data.js +57 -0
  61. package/dist/headless/theme.d.ts +99 -0
  62. package/dist/headless/theme.js +54 -0
  63. package/dist/index.d.ts +20 -0
  64. package/dist/index.js +18 -553
  65. package/dist/runtime/data/StoreProvider.d.ts +56 -0
  66. package/dist/runtime/data/StoreProvider.js +308 -0
  67. package/dist/runtime/data/handle.d.ts +14 -0
  68. package/dist/runtime/data/handle.js +16 -0
  69. package/dist/runtime/data/routes.d.ts +87 -0
  70. package/dist/runtime/data/routes.js +154 -0
  71. package/dist/runtime/data/to-ui.d.ts +258 -0
  72. package/dist/runtime/data/to-ui.js +820 -0
  73. package/dist/runtime/entries/register.d.ts +9 -0
  74. package/dist/runtime/entries/register.js +9 -0
  75. package/dist/runtime/entries/sections.d.ts +16 -0
  76. package/dist/runtime/entries/sections.js +19 -0
  77. package/dist/{types → runtime/kit}/SectionTree.d.ts +2 -1
  78. package/dist/runtime/kit/SectionTree.js +100 -0
  79. package/dist/runtime/kit/analytics.d.ts +63 -0
  80. package/dist/runtime/kit/analytics.js +233 -0
  81. package/dist/runtime/kit/cart.d.ts +186 -0
  82. package/dist/runtime/kit/cart.js +545 -0
  83. package/dist/{types → runtime/kit}/composition.d.ts +1 -1
  84. package/dist/runtime/kit/composition.js +3 -0
  85. package/dist/{types → runtime/kit}/config.d.ts +2 -2
  86. package/dist/runtime/kit/config.js +6 -0
  87. package/dist/runtime/kit/consent.d.ts +29 -0
  88. package/dist/runtime/kit/consent.js +159 -0
  89. package/dist/runtime/kit/contract/content.d.ts +164 -0
  90. package/dist/runtime/kit/contract/content.js +83 -0
  91. package/dist/runtime/kit/contract/field-types.d.ts +290 -0
  92. package/dist/runtime/kit/contract/field-types.js +129 -0
  93. package/dist/runtime/kit/contract/groups.d.ts +230 -0
  94. package/dist/runtime/kit/contract/groups.js +402 -0
  95. package/dist/runtime/kit/contract/index.d.ts +33 -0
  96. package/dist/runtime/kit/contract/index.js +33 -0
  97. package/dist/runtime/kit/contract/transform.d.ts +82 -0
  98. package/dist/runtime/kit/contract/transform.js +133 -0
  99. package/dist/runtime/kit/contract/validate.d.ts +67 -0
  100. package/dist/runtime/kit/contract/validate.js +388 -0
  101. package/dist/runtime/kit/data.d.ts +636 -0
  102. package/dist/runtime/kit/data.js +1117 -0
  103. package/dist/{types → runtime/kit}/defineSection.d.ts +1 -1
  104. package/dist/runtime/kit/defineSection.js +10 -0
  105. package/dist/{types → runtime/kit}/dynamic-source.d.ts +4 -4
  106. package/dist/runtime/kit/dynamic-source.js +143 -0
  107. package/dist/runtime/kit/index.d.ts +24 -0
  108. package/dist/runtime/kit/index.js +24 -0
  109. package/dist/{types → runtime/kit}/jsx-to-json.d.ts +1 -1
  110. package/dist/runtime/kit/jsx-to-json.js +28 -0
  111. package/dist/{types → runtime/kit}/mount.d.ts +25 -4
  112. package/dist/runtime/kit/mount.js +124 -0
  113. package/dist/{types → runtime/kit}/registry.d.ts +1 -1
  114. package/dist/runtime/kit/registry.js +12 -0
  115. package/dist/{types → runtime/kit}/ssg.d.ts +9 -3
  116. package/dist/runtime/kit/ssg.js +56 -0
  117. package/dist/runtime/kit/storefront.d.ts +566 -0
  118. package/dist/runtime/kit/storefront.js +723 -0
  119. package/dist/{types → runtime/kit}/theme-context.d.ts +8 -2
  120. package/dist/runtime/kit/theme-context.js +25 -0
  121. package/dist/runtime/kit/types.d.ts +142 -0
  122. package/dist/runtime/kit/types.js +1 -0
  123. package/dist/runtime/platform/TrackingPixels.d.ts +14 -0
  124. package/dist/runtime/platform/TrackingPixels.js +63 -0
  125. package/dist/runtime/platform/environment.d.ts +68 -0
  126. package/dist/runtime/platform/environment.js +85 -0
  127. package/dist/runtime/platform/locale.d.ts +27 -0
  128. package/dist/runtime/platform/locale.js +42 -0
  129. package/dist/runtime/platform/route-analytics.d.ts +15 -0
  130. package/dist/runtime/platform/route-analytics.js +72 -0
  131. package/dist/runtime/platform/safe-href.d.ts +25 -0
  132. package/dist/runtime/platform/safe-href.js +69 -0
  133. package/dist/runtime/platform/safe-values.d.ts +37 -0
  134. package/dist/runtime/platform/safe-values.js +140 -0
  135. package/dist/runtime/render/SectionRenderer.d.ts +4 -0
  136. package/dist/runtime/render/SectionRenderer.js +111 -0
  137. package/dist/runtime/render/listing-query.d.ts +47 -0
  138. package/dist/runtime/render/listing-query.js +114 -0
  139. package/dist/runtime/render/localized-copy.d.ts +86 -0
  140. package/dist/runtime/render/localized-copy.js +129 -0
  141. package/dist/runtime/render/product-listing.d.ts +11 -0
  142. package/dist/runtime/render/product-listing.js +240 -0
  143. package/dist/runtime/render/section-actions.d.ts +48 -0
  144. package/dist/runtime/render/section-actions.js +170 -0
  145. package/dist/runtime/render/starter.d.ts +11 -0
  146. package/dist/runtime/render/starter.js +81 -0
  147. package/dist/runtime/seo/head.d.ts +87 -0
  148. package/dist/runtime/seo/head.js +224 -0
  149. package/dist/runtime/seo/structured-data.d.ts +22 -0
  150. package/dist/runtime/seo/structured-data.js +115 -0
  151. package/dist/runtime/shell/PageShell.d.ts +18 -0
  152. package/dist/runtime/shell/PageShell.js +113 -0
  153. package/dist/runtime/shell/RuntimeBridge.d.ts +14 -0
  154. package/dist/runtime/shell/RuntimeBridge.js +85 -0
  155. package/dist/runtime/shell/overlay-state.d.ts +31 -0
  156. package/dist/runtime/shell/overlay-state.js +59 -0
  157. package/dist/runtime/shell/preview-mode.d.ts +2 -0
  158. package/dist/runtime/shell/preview-mode.js +11 -0
  159. package/dist/runtime/shell/spa-router.d.ts +14 -0
  160. package/dist/runtime/shell/spa-router.js +76 -0
  161. package/dist/runtime/shell/url-redirects.d.ts +6 -0
  162. package/dist/runtime/shell/url-redirects.js +37 -0
  163. package/dist/runtime/slots.d.ts +74 -0
  164. package/dist/runtime/slots.js +16 -0
  165. package/dist/runtime.d.ts +34 -0
  166. package/dist/runtime.js +40 -0
  167. package/dist/sdk/index.d.ts +24 -0
  168. package/dist/sdk/index.js +24 -0
  169. package/dist/sdk/referrals.d.ts +62 -0
  170. package/dist/sdk/referrals.js +20 -0
  171. package/dist/sdk/rewards.d.ts +85 -0
  172. package/dist/sdk/rewards.js +29 -0
  173. package/dist/sdk/runtime-context.d.ts +135 -0
  174. package/dist/sdk/runtime-context.js +73 -0
  175. package/dist/sdk/schema.d.ts +197 -0
  176. package/dist/sdk/schema.js +121 -0
  177. package/dist/sdk/server-render.d.ts +8 -0
  178. package/dist/sdk/server-render.js +12 -0
  179. package/dist/sdk/store-lookup.d.ts +27 -0
  180. package/dist/sdk/store-lookup.js +29 -0
  181. package/dist/sdk/store.d.ts +115 -0
  182. package/dist/sdk/store.js +1 -0
  183. package/dist/sdk/sx.d.ts +40 -0
  184. package/dist/sdk/sx.js +112 -0
  185. package/dist/sdk/theme.d.ts +152 -0
  186. package/dist/sdk/theme.js +10 -0
  187. package/dist/sdk/types.d.ts +470 -0
  188. package/dist/sdk/types.js +7 -0
  189. package/dist/server.d.ts +65 -0
  190. package/dist/server.js +370 -0
  191. package/docs/headless-api.md +220 -0
  192. package/package.json +77 -23
  193. package/dist/index.js.map +0 -1
  194. package/dist/ssg-BZ5FYTw7.js +0 -1802
  195. package/dist/ssg-BZ5FYTw7.js.map +0 -1
  196. package/dist/ssg.js +0 -8
  197. package/dist/ssg.js.map +0 -1
  198. package/dist/types/cart.d.ts +0 -86
  199. package/dist/types/data.d.ts +0 -357
  200. package/dist/types/editor.d.ts +0 -5
  201. package/dist/types/index.d.ts +0 -20
  202. package/dist/types/preview-bridge.d.ts +0 -9
  203. package/dist/types/storefront.d.ts +0 -333
  204. package/dist/types/types.d.ts +0 -44
@@ -0,0 +1,566 @@
1
+ /**
2
+ * Storefront API extensions for the live data layer.
3
+ *
4
+ * `data.tsx` boots a small homepage prefetch (collections + products + page +
5
+ * localization) and exposes a raw `graphql()` escape hatch. This module layers
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
+ *
9
+ * - Navigation menus (header/footer, recursive)
10
+ * - Blog + articles
11
+ * - Search + predictive search (autocomplete)
12
+ * - Product recommendations
13
+ * - Metaobjects (custom content)
14
+ * - Shop info + legal policies
15
+ * - Full customer account flow (login / register / orders / addresses)
16
+ *
17
+ * Every field hit here ALREADY EXISTS on the platform store API's Storefront
18
+ * GraphQL schema (`POST /api/v1/stores/{id}/graphql`). These methods attach to
19
+ * the LIVE DataApi only — mock data leaves them undefined, so themes feature-
20
+ * detect (`data.search?.(...)`, `data.customer?.login(...)`).
21
+ *
22
+ * Token storage: the customer flow returns/accepts a `customerAccessToken`
23
+ * (commerce-standard). The theme persists it (localStorage) and passes it
24
+ * back — exactly like the cart's `cartId`. `customerTokenStore` is a tiny
25
+ * localStorage helper for the common case.
26
+ */
27
+ import type { Money, Product } from './data.js';
28
+ type GraphqlFn = <T = unknown>(query: string, variables?: Record<string, unknown>) => Promise<T>;
29
+ /** Normalizers injected from data.tsx (avoids a runtime import cycle). */
30
+ export interface StorefrontHelpers {
31
+ normalizeProduct: (node: any) => Product;
32
+ }
33
+ export interface Image {
34
+ url: string;
35
+ altText?: string;
36
+ width?: number | null;
37
+ height?: number | null;
38
+ aspectRatio?: number | null;
39
+ }
40
+ export interface Seo {
41
+ title?: string | null;
42
+ description?: string | null;
43
+ }
44
+ export type MenuItemType = 'FRONTPAGE' | 'COLLECTION' | 'COLLECTIONS' | 'PRODUCT' | 'CATALOG' | 'PAGE' | 'BLOG' | 'ARTICLE' | 'SEARCH' | 'SHOP_POLICY' | 'HTTP';
45
+ export interface MenuItem {
46
+ id: string;
47
+ title: string;
48
+ url: string | null;
49
+ type: MenuItemType;
50
+ resourceId?: string | null;
51
+ items: MenuItem[];
52
+ }
53
+ export interface Menu {
54
+ id: string;
55
+ handle: string;
56
+ title: string;
57
+ items: MenuItem[];
58
+ }
59
+ export interface Article {
60
+ id: string;
61
+ handle: string;
62
+ title: string;
63
+ excerpt?: string | null;
64
+ contentHtml: string;
65
+ image?: Image | null;
66
+ author?: string | null;
67
+ publishedAt?: string;
68
+ tags: string[];
69
+ blogHandle?: string;
70
+ seo?: {
71
+ title?: string | null;
72
+ description?: string | null;
73
+ keywords?: string[] | null;
74
+ } | null;
75
+ templateSuffix?: string | null;
76
+ }
77
+ export interface Blog {
78
+ id: string;
79
+ handle: string;
80
+ title: string;
81
+ articles: Article[];
82
+ seo?: {
83
+ title?: string | null;
84
+ description?: string | null;
85
+ keywords?: string[] | null;
86
+ } | null;
87
+ templateSuffix?: string | null;
88
+ }
89
+ /** Relay-style page info — drives "load more" / infinite scroll. */
90
+ export interface PageInfo {
91
+ hasNextPage: boolean;
92
+ hasPreviousPage: boolean;
93
+ startCursor: string | null;
94
+ endCursor: string | null;
95
+ }
96
+ /** A faceted filter (price / vendor / type / option) available in a result set. */
97
+ export interface Filter {
98
+ id: string;
99
+ label: string;
100
+ type: string;
101
+ /** How to render values (`filter.presentation`): TEXT | IMAGE | SWATCH. */
102
+ presentation?: string | null;
103
+ values: Array<{
104
+ id: string;
105
+ label: string;
106
+ count: number;
107
+ input: string;
108
+ }>;
109
+ }
110
+ export interface SearchResults {
111
+ totalCount: number;
112
+ products: Product[];
113
+ pages: Array<{
114
+ handle: string;
115
+ title: string;
116
+ }>;
117
+ articles: Article[];
118
+ /** Faceted filters available for this result set (product results). */
119
+ filters: Filter[];
120
+ pageInfo: PageInfo;
121
+ }
122
+ /** A page of products from a collection (collection page + faceted filtering). */
123
+ export interface CollectionProductsPage {
124
+ products: Product[];
125
+ filters: Filter[];
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;
133
+ }
134
+ export interface PredictiveSearchResults {
135
+ queries: string[];
136
+ products: Product[];
137
+ collections: Array<{
138
+ handle: string;
139
+ title: string;
140
+ image?: Image | null;
141
+ }>;
142
+ pages: Array<{
143
+ handle: string;
144
+ title: string;
145
+ }>;
146
+ articles: Article[];
147
+ }
148
+ export interface MetaobjectField {
149
+ key: string;
150
+ value: string | null;
151
+ type: string;
152
+ }
153
+ export interface Metaobject {
154
+ id: string;
155
+ handle: string;
156
+ type: string;
157
+ fields: MetaobjectField[];
158
+ /** Convenience map: field key → value. */
159
+ values: Record<string, string | null>;
160
+ }
161
+ export interface ShopPolicy {
162
+ handle: string;
163
+ title: string;
164
+ url: string;
165
+ body?: string;
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
+ }
179
+ export interface Shop {
180
+ name: string;
181
+ description?: string | null;
182
+ /** Store contact (standard `shop.email` / `shop.phone`). */
183
+ email?: string | null;
184
+ phone?: string | null;
185
+ brand?: {
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;
191
+ slogan?: string | null;
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;
210
+ } | null;
211
+ /** Custom shop metafields ("namespace.key" → value) for dynamic sources. */
212
+ metafields?: Record<string, string | null>;
213
+ policies: {
214
+ privacy?: ShopPolicy | null;
215
+ refund?: ShopPolicy | null;
216
+ termsOfService?: ShopPolicy | null;
217
+ shipping?: ShopPolicy | null;
218
+ subscription?: ShopPolicy | null;
219
+ /** Any other published policy, under its own handle (e.g. `data-sharing-opt-out`). */
220
+ [handle: string]: ShopPolicy | null | undefined;
221
+ };
222
+ /** Settings › Taxes › prices include tax, for the shopper's market (Theme ABI `Shop.taxesIncluded`). */
223
+ taxesIncluded?: boolean;
224
+ /** The lowest "free over" shipping threshold for the shopper's country, in the market's currency. */
225
+ freeShippingThreshold?: {
226
+ amount: string;
227
+ currencyCode: string;
228
+ } | null;
229
+ /** Settings › Customer accounts › "Show sign-in links" — false hides the storefront's account links. */
230
+ signInLinks?: boolean;
231
+ /** The store's published policies (title + site path), when the platform listed them for this page. */
232
+ policyLinks?: ShopPolicy[];
233
+ /** Settings › Customer privacy › Cookie banner, as the platform sends it (Theme ABI `Shop.cookieBanner`). */
234
+ consentBanner?: ConsentBannerConfig | null;
235
+ /** Settings › Markets › Currency formatting, when the merchant set it (storefront-query rev 2.31 `shop.moneyFormat`). */
236
+ moneyFormat?: {
237
+ withCurrency?: string;
238
+ withoutCurrency?: string;
239
+ } | null;
240
+ /**
241
+ * Settings › Brand › Business details › Location — the business address the merchant published (storefront-query
242
+ * rev 2.34 `shop.contact.address`). Never the billing address. Each member only when set.
243
+ */
244
+ address?: ShopAddress;
245
+ /**
246
+ * Settings › Locations — the active locations that offer local pickup, default first (storefront-query rev 2.34
247
+ * `shop.locations`, at most 50). No opening hours exist per location.
248
+ */
249
+ locations?: ShopLocation[];
250
+ /** Cookie-consent banner config (Settings → Customer privacy). */
251
+ cookieBanner?: {
252
+ /** EFFECTIVE requirement for THIS shopper (jurisdiction ∨ merchant toggle). */
253
+ enabled: boolean;
254
+ /** 'OPT_IN' | 'OPT_OUT' | 'NONE' — the server's per-buyer consent regime (journey-matrix 0.5). */
255
+ mode?: string | null;
256
+ dataSharingTitle?: string | null;
257
+ dataSharingVisible?: boolean;
258
+ title?: string | null;
259
+ body?: string | null;
260
+ acceptLabel?: string | null;
261
+ declineLabel?: string | null;
262
+ manageLabel?: string | null;
263
+ position?: string | null;
264
+ colorTheme?: string | null;
265
+ } | null;
266
+ /**
267
+ * The home page's search & social settings (Online store → Preferences: title, meta description,
268
+ * social sharing image), when the platform sends them (`Shop.seo`, an optional ABI field).
269
+ */
270
+ seo?: {
271
+ title?: string;
272
+ description?: string;
273
+ image?: {
274
+ url: string;
275
+ altText?: string | null;
276
+ width?: number;
277
+ height?: number;
278
+ };
279
+ };
280
+ /** Primary storefront domain (for canonical URLs / SEO). */
281
+ primaryDomain?: {
282
+ host: string;
283
+ url: string;
284
+ sslEnabled: boolean;
285
+ } | null;
286
+ /** Settings → Social: public profile links, `platform` a lower-case network slug, `url` absolute https:. Absent when the store has none. */
287
+ socialLinks?: {
288
+ platform: string;
289
+ url: string;
290
+ }[] | null;
291
+ /** Accepted payment methods (for footer/checkout payment icons). */
292
+ paymentSettings?: {
293
+ acceptedCardBrands: string[];
294
+ supportedDigitalWallets: string[];
295
+ currencyCode?: string | null;
296
+ } | null;
297
+ }
298
+ /** A postal address the merchant published (rev 2.34 `PostalAddress`). `countryCode` is ISO 3166-1 alpha-2. */
299
+ export interface ShopAddress {
300
+ address1?: string;
301
+ address2?: string;
302
+ city?: string;
303
+ province?: string;
304
+ zip?: string;
305
+ country?: string;
306
+ countryCode?: string;
307
+ }
308
+ /** One store location (rev 2.34 `ShopLocation`). */
309
+ export interface ShopLocation {
310
+ id: string;
311
+ name: string;
312
+ address: ShopAddress;
313
+ phone?: string;
314
+ }
315
+ export interface CustomerAddress {
316
+ id: string;
317
+ firstName?: string | null;
318
+ lastName?: string | null;
319
+ company?: string | null;
320
+ address1?: string | null;
321
+ address2?: string | null;
322
+ city?: string | null;
323
+ province?: string | null;
324
+ country?: string | null;
325
+ zip?: string | null;
326
+ phone?: string | null;
327
+ formatted: string[];
328
+ }
329
+ export interface Customer {
330
+ id: string;
331
+ email?: string | null;
332
+ firstName?: string | null;
333
+ lastName?: string | null;
334
+ displayName: string;
335
+ phone?: string | null;
336
+ acceptsMarketing: boolean;
337
+ numberOfOrders: number;
338
+ /** Merchant-assigned customer tags (`customer.tags`). */
339
+ tags?: string[];
340
+ defaultAddress?: CustomerAddress | null;
341
+ addresses: CustomerAddress[];
342
+ /** Store-credit balances (`store_credit_account`). */
343
+ storeCreditAccounts?: StoreCreditAccount[];
344
+ }
345
+ /** A customer store-credit account balance (`store_credit_account`). */
346
+ export interface StoreCreditAccount {
347
+ id: string;
348
+ balance: Money;
349
+ }
350
+ export interface OrderLineItem {
351
+ title: string;
352
+ variantTitle?: string | null;
353
+ quantity: number;
354
+ image?: Image | null;
355
+ totalPrice: Money;
356
+ }
357
+ export interface Order {
358
+ id: string;
359
+ name: string;
360
+ orderNumber: number;
361
+ processedAt: string;
362
+ financialStatus?: string | null;
363
+ fulfillmentStatus: string;
364
+ totalPrice: Money;
365
+ statusUrl: string;
366
+ /** Contact + cancellation (standard `order.email`/`phone`/`cancelled`/`cancel_reason`). */
367
+ email?: string | null;
368
+ phone?: string | null;
369
+ cancelled?: boolean;
370
+ cancelReason?: string | null;
371
+ /** Price breakdown (standard `order.subtotal_price`/`tax_price`/`shipping_price`). */
372
+ subtotalPrice?: Money | null;
373
+ totalTax?: Money | null;
374
+ totalShippingPrice?: Money | null;
375
+ /** Shipping / billing address (standard `order.shipping_address`/`billing_address`). */
376
+ shippingAddress?: CustomerAddress | null;
377
+ billingAddress?: CustomerAddress | null;
378
+ /** Fulfillments with tracking (`order.fulfillments`). */
379
+ fulfillments?: Array<{
380
+ trackingCompany?: string | null;
381
+ trackingInfo: Array<{
382
+ number?: string | null;
383
+ url?: string | null;
384
+ }>;
385
+ }>;
386
+ /** Payment transactions (`order.transactions`). */
387
+ transactions?: OrderTransaction[];
388
+ /** Gift cards issued by this order (`gift_card`). Code is masked to last 4. */
389
+ giftCards?: OrderGiftCard[];
390
+ lineItems: OrderLineItem[];
391
+ }
392
+ /** A gift card issued by an order (`gift_card`). Full code is never exposed. */
393
+ export interface OrderGiftCard {
394
+ id: string;
395
+ /** Last 4 characters of the code (full code never returned). */
396
+ lastCharacters: string;
397
+ balance: Money;
398
+ initialValue: Money;
399
+ enabled: boolean;
400
+ expiresOn?: string | null;
401
+ }
402
+ /** A payment transaction on an order (standard `order.transactions` / `transaction`). */
403
+ export interface OrderTransaction {
404
+ id: string;
405
+ /** AUTHORIZATION | CAPTURE | SALE | REFUND | VOID */
406
+ kind: string;
407
+ /** PENDING | SUCCESS | FAILURE | ERROR */
408
+ status: string;
409
+ amount: Money;
410
+ gateway?: string | null;
411
+ paymentMethod?: string | null;
412
+ processedAt: string;
413
+ }
414
+ /** A saved payment method on the customer account (`customer_payment_method`). */
415
+ export interface CustomerPaymentMethod {
416
+ id: string;
417
+ isDefault: boolean;
418
+ isActive: boolean;
419
+ /** CARD | BANK_ACCOUNT | PROMPTPAY | TRUEMONEY */
420
+ type: string;
421
+ card?: {
422
+ brand?: string | null;
423
+ lastDigits?: string | null;
424
+ expiryMonth?: number | null;
425
+ expiryYear?: number | null;
426
+ name?: string | null;
427
+ } | null;
428
+ }
429
+ export interface CustomerAddressInput {
430
+ firstName?: string;
431
+ lastName?: string;
432
+ company?: string;
433
+ address1?: string;
434
+ address2?: string;
435
+ city?: string;
436
+ province?: string;
437
+ country?: string;
438
+ zip?: string;
439
+ phone?: string;
440
+ }
441
+ /** Login/register/renew result. `token` present on success; `errors` on failure. */
442
+ export interface AuthResult {
443
+ token: string | null;
444
+ expiresAt: string | null;
445
+ errors: string[];
446
+ }
447
+ export interface MutationResult<T = void> {
448
+ ok: boolean;
449
+ errors: string[];
450
+ data?: T;
451
+ }
452
+ /** Customer account flow — commerce-standard token model. Live-only. */
453
+ export interface CustomerApi {
454
+ /** Email + password → access token. Persist `token` (e.g. via customerTokenStore). */
455
+ login(email: string, password: string): Promise<AuthResult>;
456
+ /** Invalidate the access token server-side. */
457
+ logout(token: string): Promise<void>;
458
+ /** Extend a token nearing expiry. */
459
+ renew(token: string): Promise<AuthResult>;
460
+ /** Create an account. Returns the new customer + (no token — call login next). */
461
+ register(input: {
462
+ email: string;
463
+ password: string;
464
+ firstName?: string;
465
+ lastName?: string;
466
+ phone?: string;
467
+ acceptsMarketing?: boolean;
468
+ }): Promise<MutationResult<Customer>>;
469
+ /** Current customer (account page). null when the token is invalid/expired. */
470
+ get(token: string): Promise<Customer | null>;
471
+ /** Order history. */
472
+ orders(token: string, opts?: {
473
+ first?: number;
474
+ }): Promise<Order[]>;
475
+ /** Saved payment methods (`customer.payment_methods`). */
476
+ paymentMethods(token: string): Promise<CustomerPaymentMethod[]>;
477
+ /** Guest order lookup — orderNumber + email (no account needed). */
478
+ orderByLookup(orderNumber: string, email: string): Promise<Order | null>;
479
+ createAddress(token: string, address: CustomerAddressInput): Promise<MutationResult<{
480
+ id: string;
481
+ }>>;
482
+ updateAddress(token: string, id: string, address: CustomerAddressInput): Promise<MutationResult>;
483
+ deleteAddress(token: string, id: string): Promise<MutationResult>;
484
+ setDefaultAddress(token: string, addressId: string): Promise<MutationResult>;
485
+ }
486
+ /** The full set of live-only methods this module attaches to a DataApi. */
487
+ export interface StorefrontExtensions {
488
+ /** Shop info + legal policies (prefetched at boot). null = mock data. */
489
+ shop?: Shop | null;
490
+ /** A navigation menu by handle. `main-menu` + `footer` are prefetched at boot
491
+ * (sync); other handles return null until `fetchMenu()` caches them. */
492
+ menu?: (handle: string) => Menu | null;
493
+ /** Fetch (and cache) an arbitrary menu by handle. */
494
+ fetchMenu?: (handle: string) => Promise<Menu | null>;
495
+ /** Full-text search across products, pages and articles (paginated + faceted). */
496
+ search?: (query: string, opts?: {
497
+ first?: number;
498
+ after?: string;
499
+ types?: Array<'PRODUCT' | 'PAGE' | 'ARTICLE'>;
500
+ /** Products order: 'price-asc' | 'price-desc' | 'title-asc' | 'created-desc'; absent = relevance. */
501
+ sort?: string;
502
+ }) => Promise<SearchResults>;
503
+ /** Autocomplete suggestions (header search dropdown). */
504
+ predictiveSearch?: (query: string, opts?: {
505
+ limit?: number;
506
+ }) => Promise<PredictiveSearchResults>;
507
+ /** Products in a collection — paginated, sortable, faceted (collection page). */
508
+ collectionProducts?: (handle: string, opts?: {
509
+ first?: number;
510
+ after?: string;
511
+ sortKey?: 'TITLE' | 'PRICE' | 'BEST_SELLING' | 'CREATED' | 'MANUAL' | 'COLLECTION_DEFAULT';
512
+ reverse?: boolean;
513
+ filters?: Array<Record<string, unknown>>;
514
+ }) => Promise<CollectionProductsPage>;
515
+ /**
516
+ * The first filtered page the server already loaded for a shared filtered URL (`filters` is the
517
+ * one request's filter objects), synchronously, or null. Lets the server HTML and the hydrating
518
+ * browser render the same filtered products.
519
+ */
520
+ listingSeed?: (handle: string, filters: Array<Record<string, unknown>>) => {
521
+ products: Product[];
522
+ pageInfo?: {
523
+ hasNextPage?: boolean;
524
+ endCursor?: string | null;
525
+ };
526
+ } | null;
527
+ /** "You may also like" — related products for a product node id. */
528
+ productRecommendations?: (productId: string) => Promise<Product[]>;
529
+ /** A blog with its articles. */
530
+ blogByHandle?: (handle: string, opts?: {
531
+ articles?: number;
532
+ }) => Promise<Blog | null>;
533
+ /** A single article within a blog. */
534
+ articleByHandle?: (blogHandle: string, articleHandle: string) => Promise<Article | null>;
535
+ /** A metaobject (custom content) by type + handle. */
536
+ metaobject?: (type: string, handle: string) => Promise<Metaobject | null>;
537
+ /** All ACTIVE metaobjects of a type. */
538
+ metaobjects?: (type: string, opts?: {
539
+ first?: number;
540
+ }) => Promise<Metaobject[]>;
541
+ /** Customer account flow (login/register/orders/addresses). */
542
+ customer?: CustomerApi;
543
+ }
544
+ /** GraphQL selection for shop + the two standard menus, spliced into the
545
+ * homepage bootstrap so the layout (nav + footer + policies) renders sync. */
546
+ 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";
547
+ /** Fragment defs the bootstrap query must include when it uses BOOTSTRAP_SHOP_MENU. */
548
+ 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";
549
+ /** Pull shop + the prefetched menus out of a bootstrap response. */
550
+ export declare function readBootstrapShopMenu(boot: any): {
551
+ shop: Shop | null;
552
+ menus: Map<string, Menu>;
553
+ };
554
+ /**
555
+ * Build the live storefront extension methods on top of a `graphql()` requester.
556
+ * `menuCache` is shared with the boot-prefetched menus so `fetchMenu()` warms
557
+ * the same map that the sync `menu()` reads.
558
+ */
559
+ export declare function createStorefrontMethods(graphql: GraphqlFn, helpers: StorefrontHelpers, menuCache: Map<string, Menu>): Required<Omit<StorefrontExtensions, 'shop' | 'menu'>>;
560
+ /** Tiny localStorage helper for the customer access token (SSR-safe no-ops). */
561
+ export declare const customerTokenStore: {
562
+ get(): string | null;
563
+ set(token: string): void;
564
+ clear(): void;
565
+ };
566
+ export {};