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

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 (233) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +128 -10
  3. package/dist/abi/canvas-live.d.ts +72 -0
  4. package/dist/abi/canvas-live.js +159 -0
  5. package/dist/abi/cart.d.ts +60 -0
  6. package/dist/abi/cart.js +396 -0
  7. package/dist/abi/convert.d.ts +360 -0
  8. package/dist/abi/convert.js +1330 -0
  9. package/dist/abi/data-api.d.ts +15 -0
  10. package/dist/abi/data-api.js +213 -0
  11. package/dist/abi/jcs.d.ts +6 -0
  12. package/dist/abi/jcs.js +28 -0
  13. package/dist/abi/labels.d.ts +3 -0
  14. package/dist/abi/labels.js +34 -0
  15. package/dist/abi/page-data.d.ts +264 -0
  16. package/dist/abi/page-data.js +746 -0
  17. package/dist/abi/page.d.ts +28 -0
  18. package/dist/abi/page.js +57 -0
  19. package/dist/abi/referrals.d.ts +23 -0
  20. package/dist/abi/referrals.js +89 -0
  21. package/dist/abi/rewards.d.ts +27 -0
  22. package/dist/abi/rewards.js +82 -0
  23. package/dist/abi/seo.d.ts +47 -0
  24. package/dist/abi/seo.js +68 -0
  25. package/dist/abi/shell.d.ts +23 -0
  26. package/dist/abi/shell.js +10 -0
  27. package/dist/abi/state-pack.d.ts +17 -0
  28. package/dist/abi/state-pack.js +43 -0
  29. package/dist/abi/wire.d.ts +46 -0
  30. package/dist/abi/wire.js +114 -0
  31. package/dist/build.d.ts +121 -0
  32. package/dist/build.js +401 -0
  33. package/dist/chunks.d.ts +23 -0
  34. package/dist/chunks.js +41 -0
  35. package/dist/client.d.ts +26 -0
  36. package/dist/client.js +101 -0
  37. package/dist/contract.d.ts +6 -0
  38. package/dist/contract.js +6 -0
  39. package/dist/headless/ai.d.ts +132 -0
  40. package/dist/headless/ai.js +99 -0
  41. package/dist/headless/hooks.d.ts +276 -0
  42. package/dist/headless/hooks.js +544 -0
  43. package/dist/headless/i18n.d.ts +13 -0
  44. package/dist/headless/i18n.js +45 -0
  45. package/dist/headless/index.d.ts +44 -0
  46. package/dist/headless/index.js +48 -0
  47. package/dist/headless/lazy-component.d.ts +72 -0
  48. package/dist/headless/lazy-component.js +225 -0
  49. package/dist/headless/lazy-section.d.ts +38 -0
  50. package/dist/headless/lazy-section.js +97 -0
  51. package/dist/headless/model.d.ts +73 -0
  52. package/dist/headless/model.js +115 -0
  53. package/dist/headless/money.d.ts +17 -0
  54. package/dist/headless/money.js +63 -0
  55. package/dist/headless/page.d.ts +45 -0
  56. package/dist/headless/page.js +53 -0
  57. package/dist/headless/platform.d.ts +55 -0
  58. package/dist/headless/platform.js +77 -0
  59. package/dist/headless/primitives/cart.d.ts +90 -0
  60. package/dist/headless/primitives/cart.js +153 -0
  61. package/dist/headless/primitives/collection.d.ts +68 -0
  62. package/dist/headless/primitives/collection.js +80 -0
  63. package/dist/headless/primitives/product.d.ts +101 -0
  64. package/dist/headless/primitives/product.js +117 -0
  65. package/dist/headless/primitives/storefront.d.ts +106 -0
  66. package/dist/headless/primitives/storefront.js +187 -0
  67. package/dist/headless/primitives/util.d.ts +19 -0
  68. package/dist/headless/primitives/util.js +42 -0
  69. package/dist/headless/strings.d.ts +9 -0
  70. package/dist/headless/strings.js +198 -0
  71. package/dist/headless/structured-data.d.ts +31 -0
  72. package/dist/headless/structured-data.js +57 -0
  73. package/dist/headless/tanqory-money.generated.d.ts +493 -0
  74. package/dist/headless/tanqory-money.generated.js +507 -0
  75. package/dist/headless/theme.d.ts +109 -0
  76. package/dist/headless/theme.js +62 -0
  77. package/dist/index.d.ts +21 -0
  78. package/dist/index.js +21 -553
  79. package/dist/runtime/data/StoreProvider.d.ts +84 -0
  80. package/dist/runtime/data/StoreProvider.js +380 -0
  81. package/dist/runtime/data/handle.d.ts +14 -0
  82. package/dist/runtime/data/handle.js +16 -0
  83. package/dist/runtime/data/routes.d.ts +87 -0
  84. package/dist/runtime/data/routes.js +158 -0
  85. package/dist/runtime/data/to-ui.d.ts +286 -0
  86. package/dist/runtime/data/to-ui.js +1009 -0
  87. package/dist/runtime/entries/register.d.ts +9 -0
  88. package/dist/runtime/entries/register.js +9 -0
  89. package/dist/runtime/entries/sections.d.ts +16 -0
  90. package/dist/runtime/entries/sections.js +19 -0
  91. package/dist/{types → runtime/kit}/SectionTree.d.ts +2 -1
  92. package/dist/runtime/kit/SectionTree.js +100 -0
  93. package/dist/runtime/kit/analytics.d.ts +63 -0
  94. package/dist/runtime/kit/analytics.js +250 -0
  95. package/dist/runtime/kit/cart.d.ts +222 -0
  96. package/dist/runtime/kit/cart.js +545 -0
  97. package/dist/{types → runtime/kit}/composition.d.ts +1 -1
  98. package/dist/runtime/kit/composition.js +3 -0
  99. package/dist/{types → runtime/kit}/config.d.ts +2 -2
  100. package/dist/runtime/kit/config.js +6 -0
  101. package/dist/runtime/kit/consent.d.ts +29 -0
  102. package/dist/runtime/kit/consent.js +159 -0
  103. package/dist/runtime/kit/contract/content.d.ts +213 -0
  104. package/dist/runtime/kit/contract/content.js +119 -0
  105. package/dist/runtime/kit/contract/field-types.d.ts +360 -0
  106. package/dist/runtime/kit/contract/field-types.js +216 -0
  107. package/dist/runtime/kit/contract/groups.d.ts +230 -0
  108. package/dist/runtime/kit/contract/groups.js +402 -0
  109. package/dist/runtime/kit/contract/index.d.ts +33 -0
  110. package/dist/runtime/kit/contract/index.js +33 -0
  111. package/dist/runtime/kit/contract/transform.d.ts +82 -0
  112. package/dist/runtime/kit/contract/transform.js +133 -0
  113. package/dist/runtime/kit/contract/validate.d.ts +77 -0
  114. package/dist/runtime/kit/contract/validate.js +520 -0
  115. package/dist/runtime/kit/data.d.ts +732 -0
  116. package/dist/runtime/kit/data.js +1131 -0
  117. package/dist/{types → runtime/kit}/defineSection.d.ts +1 -1
  118. package/dist/runtime/kit/defineSection.js +10 -0
  119. package/dist/runtime/kit/dynamic-source.d.ts +118 -0
  120. package/dist/runtime/kit/dynamic-source.js +311 -0
  121. package/dist/runtime/kit/index.d.ts +24 -0
  122. package/dist/runtime/kit/index.js +24 -0
  123. package/dist/{types → runtime/kit}/jsx-to-json.d.ts +1 -1
  124. package/dist/runtime/kit/jsx-to-json.js +28 -0
  125. package/dist/{types → runtime/kit}/mount.d.ts +25 -4
  126. package/dist/runtime/kit/mount.js +124 -0
  127. package/dist/{types → runtime/kit}/registry.d.ts +1 -1
  128. package/dist/runtime/kit/registry.js +12 -0
  129. package/dist/{types → runtime/kit}/ssg.d.ts +9 -3
  130. package/dist/runtime/kit/ssg.js +56 -0
  131. package/dist/runtime/kit/storefront.d.ts +652 -0
  132. package/dist/runtime/kit/storefront.js +723 -0
  133. package/dist/{types → runtime/kit}/theme-context.d.ts +8 -2
  134. package/dist/runtime/kit/theme-context.js +25 -0
  135. package/dist/runtime/kit/types.d.ts +155 -0
  136. package/dist/runtime/kit/types.js +1 -0
  137. package/dist/runtime/platform/TrackingPixels.d.ts +14 -0
  138. package/dist/runtime/platform/TrackingPixels.js +63 -0
  139. package/dist/runtime/platform/environment.d.ts +68 -0
  140. package/dist/runtime/platform/environment.js +85 -0
  141. package/dist/runtime/platform/locale.d.ts +27 -0
  142. package/dist/runtime/platform/locale.js +42 -0
  143. package/dist/runtime/platform/route-analytics.d.ts +15 -0
  144. package/dist/runtime/platform/route-analytics.js +72 -0
  145. package/dist/runtime/platform/safe-href.d.ts +25 -0
  146. package/dist/runtime/platform/safe-href.js +69 -0
  147. package/dist/runtime/platform/safe-values.d.ts +37 -0
  148. package/dist/runtime/platform/safe-values.js +140 -0
  149. package/dist/runtime/render/SectionRenderer.d.ts +4 -0
  150. package/dist/runtime/render/SectionRenderer.js +199 -0
  151. package/dist/runtime/render/listing-query.d.ts +52 -0
  152. package/dist/runtime/render/listing-query.js +122 -0
  153. package/dist/runtime/render/localized-copy.d.ts +86 -0
  154. package/dist/runtime/render/localized-copy.js +129 -0
  155. package/dist/runtime/render/product-listing.d.ts +11 -0
  156. package/dist/runtime/render/product-listing.js +243 -0
  157. package/dist/runtime/render/resolved.d.ts +47 -0
  158. package/dist/runtime/render/resolved.js +80 -0
  159. package/dist/runtime/render/section-actions.d.ts +67 -0
  160. package/dist/runtime/render/section-actions.js +205 -0
  161. package/dist/runtime/render/starter.d.ts +11 -0
  162. package/dist/runtime/render/starter.js +96 -0
  163. package/dist/runtime/seo/head.d.ts +115 -0
  164. package/dist/runtime/seo/head.js +281 -0
  165. package/dist/runtime/seo/structured-data.d.ts +83 -0
  166. package/dist/runtime/seo/structured-data.js +252 -0
  167. package/dist/runtime/shell/PageShell.d.ts +18 -0
  168. package/dist/runtime/shell/PageShell.js +118 -0
  169. package/dist/runtime/shell/RuntimeBridge.d.ts +18 -0
  170. package/dist/runtime/shell/RuntimeBridge.js +124 -0
  171. package/dist/runtime/shell/overlay-state.d.ts +31 -0
  172. package/dist/runtime/shell/overlay-state.js +59 -0
  173. package/dist/runtime/shell/preview-mode.d.ts +2 -0
  174. package/dist/runtime/shell/preview-mode.js +11 -0
  175. package/dist/runtime/shell/spa-router.d.ts +14 -0
  176. package/dist/runtime/shell/spa-router.js +76 -0
  177. package/dist/runtime/shell/url-redirects.d.ts +6 -0
  178. package/dist/runtime/shell/url-redirects.js +37 -0
  179. package/dist/runtime/slots.d.ts +74 -0
  180. package/dist/runtime/slots.js +16 -0
  181. package/dist/runtime.d.ts +34 -0
  182. package/dist/runtime.js +40 -0
  183. package/dist/sdk/app-block.d.ts +29 -0
  184. package/dist/sdk/app-block.js +22 -0
  185. package/dist/sdk/font-hooks.d.ts +7 -0
  186. package/dist/sdk/font-hooks.js +21 -0
  187. package/dist/sdk/fonts.d.ts +144 -0
  188. package/dist/sdk/fonts.js +241 -0
  189. package/dist/sdk/index.d.ts +32 -0
  190. package/dist/sdk/index.js +36 -0
  191. package/dist/sdk/motion-hooks.d.ts +23 -0
  192. package/dist/sdk/motion-hooks.js +46 -0
  193. package/dist/sdk/motion.d.ts +78 -0
  194. package/dist/sdk/motion.js +292 -0
  195. package/dist/sdk/referrals.d.ts +62 -0
  196. package/dist/sdk/referrals.js +20 -0
  197. package/dist/sdk/rewards.d.ts +85 -0
  198. package/dist/sdk/rewards.js +29 -0
  199. package/dist/sdk/runtime-context.d.ts +230 -0
  200. package/dist/sdk/runtime-context.js +73 -0
  201. package/dist/sdk/schema.d.ts +249 -0
  202. package/dist/sdk/schema.js +168 -0
  203. package/dist/sdk/server-render.d.ts +8 -0
  204. package/dist/sdk/server-render.js +12 -0
  205. package/dist/sdk/store-lookup.d.ts +32 -0
  206. package/dist/sdk/store-lookup.js +48 -0
  207. package/dist/sdk/store.d.ts +164 -0
  208. package/dist/sdk/store.js +5 -0
  209. package/dist/sdk/sx.d.ts +45 -0
  210. package/dist/sdk/sx.js +117 -0
  211. package/dist/sdk/theme.d.ts +212 -0
  212. package/dist/sdk/theme.js +27 -0
  213. package/dist/sdk/types.d.ts +789 -0
  214. package/dist/sdk/types.js +7 -0
  215. package/dist/server.d.ts +112 -0
  216. package/dist/server.js +589 -0
  217. package/dist/vite-chunks.d.ts +10 -0
  218. package/dist/vite-chunks.js +44 -0
  219. package/docs/headless-api.md +250 -0
  220. package/package.json +72 -26
  221. package/dist/index.js.map +0 -1
  222. package/dist/ssg-BZ5FYTw7.js +0 -1802
  223. package/dist/ssg-BZ5FYTw7.js.map +0 -1
  224. package/dist/ssg.js +0 -8
  225. package/dist/ssg.js.map +0 -1
  226. package/dist/types/cart.d.ts +0 -86
  227. package/dist/types/data.d.ts +0 -357
  228. package/dist/types/dynamic-source.d.ts +0 -84
  229. package/dist/types/editor.d.ts +0 -5
  230. package/dist/types/index.d.ts +0 -20
  231. package/dist/types/preview-bridge.d.ts +0 -9
  232. package/dist/types/storefront.d.ts +0 -333
  233. package/dist/types/types.d.ts +0 -44
@@ -0,0 +1,652 @@
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
+ import type { ShopLoyalty, ShopReferrals } from '../../sdk/types.js';
29
+ type GraphqlFn = <T = unknown>(query: string, variables?: Record<string, unknown>) => Promise<T>;
30
+ /** Normalizers injected from data.tsx (avoids a runtime import cycle). */
31
+ export interface StorefrontHelpers {
32
+ normalizeProduct: (node: any) => Product;
33
+ }
34
+ export interface Image {
35
+ url: string;
36
+ altText?: string;
37
+ width?: number | null;
38
+ height?: number | null;
39
+ aspectRatio?: number | null;
40
+ }
41
+ export interface Seo {
42
+ title?: string | null;
43
+ description?: string | null;
44
+ }
45
+ export type MenuItemType = 'FRONTPAGE' | 'COLLECTION' | 'COLLECTIONS' | 'PRODUCT' | 'CATALOG' | 'PAGE' | 'BLOG' | 'ARTICLE' | 'SEARCH' | 'SHOP_POLICY' | 'HTTP';
46
+ export interface MenuItem {
47
+ id: string;
48
+ title: string;
49
+ url: string | null;
50
+ type: MenuItemType;
51
+ resourceId?: string | null;
52
+ /** ABI Menu-1: the image of the store's collection the item links to, when it has one. */
53
+ image?: Image | null;
54
+ items: MenuItem[];
55
+ }
56
+ export interface Menu {
57
+ id: string;
58
+ handle: string;
59
+ title: string;
60
+ items: MenuItem[];
61
+ }
62
+ export interface Article {
63
+ id: string;
64
+ handle: string;
65
+ title: string;
66
+ excerpt?: string | null;
67
+ contentHtml: string;
68
+ image?: Image | null;
69
+ author?: string | null;
70
+ publishedAt?: string;
71
+ tags: string[];
72
+ blogHandle?: string;
73
+ seo?: {
74
+ title?: string | null;
75
+ description?: string | null;
76
+ keywords?: string[] | null;
77
+ } | null;
78
+ templateSuffix?: string | null;
79
+ /** Rev 2.44 (NEW-OS-26): present only when the article's blog accepts comments. */
80
+ comments?: ArticleComments;
81
+ /** Storefront-readable article metafields ("namespace.key" → display value), storefront-query rev 2.45 (O4). */
82
+ metafields?: Record<string, string | null>;
83
+ }
84
+ /** One published comment of an article (storefront-query rev 2.44). `author` is the display name the commenter chose. */
85
+ export interface ArticleComment {
86
+ id: string;
87
+ author: string;
88
+ body: string;
89
+ createdAt: string;
90
+ }
91
+ /**
92
+ * An article's comments (storefront-query rev 2.44, NEW-OS-26): `moderated` = a new comment waits for the merchant's
93
+ * approval; `count` = published comments; `nodes` = the newest published (at most 50, newest first), on the article
94
+ * route only — listings carry `moderated` and `count` alone.
95
+ */
96
+ export interface ArticleComments {
97
+ moderated: boolean;
98
+ count: number;
99
+ nodes?: ArticleComment[];
100
+ }
101
+ export interface Blog {
102
+ id: string;
103
+ handle: string;
104
+ title: string;
105
+ articles: Article[];
106
+ seo?: {
107
+ title?: string | null;
108
+ description?: string | null;
109
+ keywords?: string[] | null;
110
+ } | null;
111
+ templateSuffix?: string | null;
112
+ }
113
+ /** Relay-style page info — drives "load more" / infinite scroll. */
114
+ export interface PageInfo {
115
+ hasNextPage: boolean;
116
+ hasPreviousPage: boolean;
117
+ startCursor: string | null;
118
+ endCursor: string | null;
119
+ }
120
+ /** A faceted filter (price / vendor / type / option) available in a result set. */
121
+ export interface Filter {
122
+ id: string;
123
+ label: string;
124
+ type: string;
125
+ /** How to render values (`filter.presentation`): TEXT | IMAGE | SWATCH. */
126
+ presentation?: string | null;
127
+ values: Array<{
128
+ id: string;
129
+ label: string;
130
+ count: number;
131
+ input: string;
132
+ }>;
133
+ }
134
+ export interface SearchResults {
135
+ totalCount: number;
136
+ products: Product[];
137
+ pages: Array<{
138
+ handle: string;
139
+ title: string;
140
+ }>;
141
+ articles: Article[];
142
+ /** Faceted filters available for this result set (product results). */
143
+ filters: Filter[];
144
+ pageInfo: PageInfo;
145
+ }
146
+ /** A page of products from a collection (collection page + faceted filtering). */
147
+ export interface CollectionProductsPage {
148
+ products: Product[];
149
+ filters: Filter[];
150
+ pageInfo: PageInfo;
151
+ /**
152
+ * True when the storefront has no collection with this handle — deleted,
153
+ * or not published to the online store. Distinct from an existing
154
+ * collection with no products, which a section words differently.
155
+ */
156
+ missing?: boolean;
157
+ }
158
+ export interface PredictiveSearchResults {
159
+ queries: string[];
160
+ products: Product[];
161
+ collections: Array<{
162
+ handle: string;
163
+ title: string;
164
+ image?: Image | null;
165
+ }>;
166
+ pages: Array<{
167
+ handle: string;
168
+ title: string;
169
+ }>;
170
+ articles: Article[];
171
+ }
172
+ export interface MetaobjectField {
173
+ key: string;
174
+ value: string | null;
175
+ type: string;
176
+ }
177
+ export interface Metaobject {
178
+ id: string;
179
+ handle: string;
180
+ type: string;
181
+ fields: MetaobjectField[];
182
+ /** Convenience map: field key → value. */
183
+ values: Record<string, string | null>;
184
+ }
185
+ export interface ShopPolicy {
186
+ handle: string;
187
+ title: string;
188
+ url: string;
189
+ body?: string;
190
+ }
191
+ export interface ConsentBannerConfig {
192
+ enabled: boolean;
193
+ automated: boolean;
194
+ position: 'bottom' | 'bottom-left' | 'bottom-right' | 'bottom-center' | 'center';
195
+ colorTheme: 'light' | 'dark' | 'custom';
196
+ regions: string[];
197
+ privacyLinkUrl?: string;
198
+ text: Partial<Record<'title' | 'body' | 'privacyLinkLabel' | 'acceptLabel' | 'declineLabel' | 'manageLabel', string>>;
199
+ preferences: Partial<Record<'title' | 'introTitle' | 'introBody' | 'acceptAllLabel' | 'declineAllLabel' | 'saveLabel' | 'bulletTitle' | 'requiredTitle' | 'requiredDescription' | 'personalizationTitle' | 'personalizationDescription' | 'marketingTitle' | 'marketingDescription' | 'analyticsTitle' | 'analyticsDescription', string>> & {
200
+ bullets?: string[];
201
+ };
202
+ }
203
+ export interface Shop {
204
+ name: string;
205
+ description?: string | null;
206
+ /** Store contact (standard `shop.email` / `shop.phone`). */
207
+ email?: string | null;
208
+ phone?: string | null;
209
+ brand?: {
210
+ logo?: Image | null;
211
+ squareLogo?: Image | null;
212
+ /** Settings → Brand share banner (`Brand.coverImage`) — the merchant's
213
+ * purpose-built og:image. */
214
+ coverImage?: Image | null;
215
+ slogan?: string | null;
216
+ shortDescription?: string | null;
217
+ /** Settings → Brand. `primary[0]` is the brand colour; themes should treat
218
+ * the rest as an ordered palette. Every field is nullable — an
219
+ * unconfigured store yields nulls, never an error. */
220
+ colors?: {
221
+ primary: {
222
+ background?: string | null;
223
+ foreground?: string | null;
224
+ }[];
225
+ secondary: {
226
+ background?: string | null;
227
+ foreground?: string | null;
228
+ }[];
229
+ } | null;
230
+ /** Settings → Brand fonts (`Brand.fonts: [String!]!`), family names in
231
+ * priority order — e.g. `["Playfair Display", "Inter"]`. Themes map
232
+ * `[0]` → display and `[1]` → body. An unconfigured store returns `[]`. */
233
+ fonts?: string[] | null;
234
+ } | null;
235
+ /** Custom shop metafields ("namespace.key" → value) for dynamic sources. */
236
+ metafields?: Record<string, string | null>;
237
+ policies: {
238
+ privacy?: ShopPolicy | null;
239
+ refund?: ShopPolicy | null;
240
+ termsOfService?: ShopPolicy | null;
241
+ shipping?: ShopPolicy | null;
242
+ subscription?: ShopPolicy | null;
243
+ /** Any other published policy, under its own handle (e.g. `data-sharing-opt-out`). */
244
+ [handle: string]: ShopPolicy | null | undefined;
245
+ };
246
+ /** Settings › Taxes › prices include tax, for the shopper's market (Theme ABI `Shop.taxesIncluded`). */
247
+ taxesIncluded?: boolean;
248
+ /** The lowest "free over" shipping threshold for the shopper's country, in the market's currency. */
249
+ freeShippingThreshold?: {
250
+ amount: string;
251
+ currencyCode: string;
252
+ } | null;
253
+ /** Settings › Customer accounts › "Show sign-in links" — false hides the storefront's account links. */
254
+ signInLinks?: boolean;
255
+ /** The store's published policies (title + site path), when the platform listed them for this page. */
256
+ policyLinks?: ShopPolicy[];
257
+ /** Settings › Customer privacy › Cookie banner, as the platform sends it (Theme ABI `Shop.cookieBanner`). */
258
+ consentBanner?: ConsentBannerConfig | null;
259
+ /** Settings › Markets › Currency formatting, when the merchant set it (storefront-query rev 2.31 `shop.moneyFormat`). */
260
+ moneyFormat?: {
261
+ withCurrency?: string;
262
+ withoutCurrency?: string;
263
+ } | null;
264
+ /**
265
+ * Settings › Brand › Business details › Location — the business address the merchant published (storefront-query
266
+ * rev 2.34 `shop.contact.address`). Never the billing address. Each member only when set.
267
+ */
268
+ address?: ShopAddress;
269
+ /**
270
+ * Settings › Locations — the active locations that offer local pickup, default first (storefront-query rev 2.34
271
+ * `shop.locations`, at most 50). No opening hours exist per location.
272
+ */
273
+ locations?: ShopLocation[];
274
+ /** Marketing › Pop-ups — the pop-ups live now (storefront-query rev 2.37 `shop.popups`, at most 20). */
275
+ popups?: ShopPopup[];
276
+ /** Marketing › Loyalty — the program as any shopper may read it (storefront-query rev 2.48 `shop.loyalty`). */
277
+ loyalty?: ShopLoyalty;
278
+ /** Marketing › Referrals — the friend offer and the advocate reward (storefront-query rev 2.48 `shop.referrals`). */
279
+ referrals?: ShopReferrals;
280
+ /**
281
+ * Settings › Preferences › Spam protection (storefront-query rev 2.44 `shop.spamProtection`, A4). `contactForms` ⇒
282
+ * render the invisible Cloudflare Turnstile widget (action `store_contact_form` / `store_newsletter_subscribe`) in the
283
+ * contact and newsletter forms; `authPages` ⇒ in sign-in, sign-up and password recovery. `siteKey` is the public
284
+ * widget key. Absent ⇒ no widget anywhere.
285
+ */
286
+ spamProtection?: {
287
+ contactForms: boolean;
288
+ authPages: boolean;
289
+ siteKey: string;
290
+ };
291
+ /** Cookie-consent banner config (Settings → Customer privacy). */
292
+ cookieBanner?: {
293
+ /** EFFECTIVE requirement for THIS shopper (jurisdiction ∨ merchant toggle). */
294
+ enabled: boolean;
295
+ /** 'OPT_IN' | 'OPT_OUT' | 'NONE' — the server's per-buyer consent regime (journey-matrix 0.5). */
296
+ mode?: string | null;
297
+ dataSharingTitle?: string | null;
298
+ dataSharingVisible?: boolean;
299
+ title?: string | null;
300
+ body?: string | null;
301
+ acceptLabel?: string | null;
302
+ declineLabel?: string | null;
303
+ manageLabel?: string | null;
304
+ position?: string | null;
305
+ colorTheme?: string | null;
306
+ } | null;
307
+ /**
308
+ * The home page's search & social settings (Online store → Preferences: title, meta description,
309
+ * social sharing image), when the platform sends them (`Shop.seo`, an optional ABI field).
310
+ */
311
+ seo?: {
312
+ title?: string;
313
+ description?: string;
314
+ image?: {
315
+ url: string;
316
+ altText?: string | null;
317
+ width?: number;
318
+ height?: number;
319
+ };
320
+ };
321
+ /** Primary storefront domain (for canonical URLs / SEO). */
322
+ primaryDomain?: {
323
+ host: string;
324
+ url: string;
325
+ sslEnabled: boolean;
326
+ } | null;
327
+ /** Settings → Social: public profile links, `platform` a lower-case network slug, `url` absolute https:. Absent when the store has none. */
328
+ socialLinks?: {
329
+ platform: string;
330
+ url: string;
331
+ }[] | null;
332
+ /** Accepted payment methods (for footer/checkout payment icons). */
333
+ paymentSettings?: {
334
+ acceptedCardBrands: string[];
335
+ supportedDigitalWallets: string[];
336
+ currencyCode?: string | null;
337
+ } | null;
338
+ }
339
+ /** A postal address the merchant published (rev 2.34 `PostalAddress`). `countryCode` is ISO 3166-1 alpha-2. */
340
+ export interface ShopAddress {
341
+ address1?: string;
342
+ address2?: string;
343
+ city?: string;
344
+ province?: string;
345
+ zip?: string;
346
+ country?: string;
347
+ countryCode?: string;
348
+ }
349
+ /** rev 2.52 (O3): a location's expected pickup time, as the merchant chose it. */
350
+ export type PickupReadyIn = '4h' | '24h' | '1-2d' | '2-4d' | '5d+';
351
+ /** rev 2.73 (board 35 #117): one weekly opening period of a location, 24-hour local `HH:MM`. */
352
+ export interface OpeningPeriod {
353
+ day: 'MONDAY' | 'TUESDAY' | 'WEDNESDAY' | 'THURSDAY' | 'FRIDAY' | 'SATURDAY' | 'SUNDAY';
354
+ opens: string;
355
+ /** Earlier than `opens`: closes after midnight. */
356
+ closes: string;
357
+ }
358
+ /** One store location (rev 2.34 `ShopLocation`; rev 2.52 `pickupReadyIn`; rev 2.73 `pickup`, `storefront`, `openingHours`). */
359
+ export interface ShopLocation {
360
+ id: string;
361
+ name: string;
362
+ address: ShopAddress;
363
+ phone?: string;
364
+ pickupReadyIn?: PickupReadyIn;
365
+ /** rev 2.73: offers local pickup; absent ⇒ the rev 2.34 reading (yes). */
366
+ pickup?: boolean;
367
+ /** rev 2.73: Physical storefront on (a store locator lists it); absent ⇒ the rev 2.34 reading (yes). */
368
+ storefront?: boolean;
369
+ /** rev 2.73: weekly hours, Monday first; a day not listed is closed; absent ⇒ not set. */
370
+ openingHours?: OpeningPeriod[];
371
+ }
372
+ /**
373
+ * A merchant pop-up (Marketing › Pop-ups) the store runs now (storefront-query rev 2.37 `Shop.popups`, theme-abi
374
+ * alpha.18): ACTIVE and inside its schedule when the platform projected it. Copy is plain text in `language`.
375
+ * `trigger` `delay` waits `triggerValue` seconds, `scroll` waits for `triggerValue` percent of the page, `exitIntent`
376
+ * fires when a pointer leaves the top of the window. `frequencyDays` 0 = once per browser session, else at most once
377
+ * per that many days after the shopper closed it. `discountOffered`: a newsletter sign-up reveals a code — the code
378
+ * comes back with the sign-up's form result, never here. A theme still shows it only while now is in [startsAt, endsAt).
379
+ */
380
+ export interface ShopPopup {
381
+ id: string;
382
+ kind: 'newsletter' | 'announcement';
383
+ trigger: 'delay' | 'scroll' | 'exitIntent';
384
+ triggerValue: number;
385
+ frequencyDays: number;
386
+ pages: Array<'all' | 'home' | 'product' | 'collection' | 'cart'>;
387
+ startsAt?: string;
388
+ endsAt?: string;
389
+ language: string;
390
+ heading: string;
391
+ body?: string;
392
+ ctaLabel: string;
393
+ consentText?: string;
394
+ image?: {
395
+ url: string;
396
+ altText: string | null;
397
+ };
398
+ ctaUrl?: string;
399
+ discountOffered?: boolean;
400
+ }
401
+ export interface CustomerAddress {
402
+ id: string;
403
+ firstName?: string | null;
404
+ lastName?: string | null;
405
+ company?: string | null;
406
+ address1?: string | null;
407
+ address2?: string | null;
408
+ city?: string | null;
409
+ province?: string | null;
410
+ country?: string | null;
411
+ zip?: string | null;
412
+ phone?: string | null;
413
+ formatted: string[];
414
+ }
415
+ export interface Customer {
416
+ id: string;
417
+ email?: string | null;
418
+ firstName?: string | null;
419
+ lastName?: string | null;
420
+ displayName: string;
421
+ phone?: string | null;
422
+ acceptsMarketing: boolean;
423
+ numberOfOrders: number;
424
+ /** Merchant-assigned customer tags (`customer.tags`). */
425
+ tags?: string[];
426
+ defaultAddress?: CustomerAddress | null;
427
+ addresses: CustomerAddress[];
428
+ /** Store-credit balances (`store_credit_account`). */
429
+ storeCreditAccounts?: StoreCreditAccount[];
430
+ }
431
+ /** A customer store-credit account balance (`store_credit_account`). */
432
+ export interface StoreCreditAccount {
433
+ id: string;
434
+ balance: Money;
435
+ }
436
+ export interface OrderLineItem {
437
+ title: string;
438
+ variantTitle?: string | null;
439
+ quantity: number;
440
+ image?: Image | null;
441
+ totalPrice: Money;
442
+ }
443
+ export interface Order {
444
+ id: string;
445
+ name: string;
446
+ orderNumber: number;
447
+ processedAt: string;
448
+ financialStatus?: string | null;
449
+ fulfillmentStatus: string;
450
+ totalPrice: Money;
451
+ statusUrl: string;
452
+ /** Contact + cancellation (standard `order.email`/`phone`/`cancelled`/`cancel_reason`). */
453
+ email?: string | null;
454
+ phone?: string | null;
455
+ cancelled?: boolean;
456
+ cancelReason?: string | null;
457
+ /** Price breakdown (standard `order.subtotal_price`/`tax_price`/`shipping_price`). */
458
+ subtotalPrice?: Money | null;
459
+ totalTax?: Money | null;
460
+ totalShippingPrice?: Money | null;
461
+ /** Shipping / billing address (standard `order.shipping_address`/`billing_address`). */
462
+ shippingAddress?: CustomerAddress | null;
463
+ billingAddress?: CustomerAddress | null;
464
+ /** Fulfillments with tracking (`order.fulfillments`). */
465
+ fulfillments?: Array<{
466
+ trackingCompany?: string | null;
467
+ trackingInfo: Array<{
468
+ number?: string | null;
469
+ url?: string | null;
470
+ }>;
471
+ }>;
472
+ /** Payment transactions (`order.transactions`). */
473
+ transactions?: OrderTransaction[];
474
+ /** Gift cards issued by this order (`gift_card`). Code is masked to last 4. */
475
+ giftCards?: OrderGiftCard[];
476
+ lineItems: OrderLineItem[];
477
+ }
478
+ /** A gift card issued by an order (`gift_card`). Full code is never exposed. */
479
+ export interface OrderGiftCard {
480
+ id: string;
481
+ /** Last 4 characters of the code (full code never returned). */
482
+ lastCharacters: string;
483
+ balance: Money;
484
+ initialValue: Money;
485
+ enabled: boolean;
486
+ expiresOn?: string | null;
487
+ }
488
+ /** A payment transaction on an order (standard `order.transactions` / `transaction`). */
489
+ export interface OrderTransaction {
490
+ id: string;
491
+ /** AUTHORIZATION | CAPTURE | SALE | REFUND | VOID */
492
+ kind: string;
493
+ /** PENDING | SUCCESS | FAILURE | ERROR */
494
+ status: string;
495
+ amount: Money;
496
+ gateway?: string | null;
497
+ paymentMethod?: string | null;
498
+ processedAt: string;
499
+ }
500
+ /** A saved payment method on the customer account (`customer_payment_method`). */
501
+ export interface CustomerPaymentMethod {
502
+ id: string;
503
+ isDefault: boolean;
504
+ isActive: boolean;
505
+ /** CARD | BANK_ACCOUNT | PROMPTPAY | TRUEMONEY */
506
+ type: string;
507
+ card?: {
508
+ brand?: string | null;
509
+ lastDigits?: string | null;
510
+ expiryMonth?: number | null;
511
+ expiryYear?: number | null;
512
+ name?: string | null;
513
+ } | null;
514
+ }
515
+ export interface CustomerAddressInput {
516
+ firstName?: string;
517
+ lastName?: string;
518
+ company?: string;
519
+ address1?: string;
520
+ address2?: string;
521
+ city?: string;
522
+ province?: string;
523
+ country?: string;
524
+ zip?: string;
525
+ phone?: string;
526
+ }
527
+ /** Login/register/renew result. `token` present on success; `errors` on failure. */
528
+ export interface AuthResult {
529
+ token: string | null;
530
+ expiresAt: string | null;
531
+ errors: string[];
532
+ }
533
+ export interface MutationResult<T = void> {
534
+ ok: boolean;
535
+ errors: string[];
536
+ data?: T;
537
+ }
538
+ /** Customer account flow — commerce-standard token model. Live-only. */
539
+ export interface CustomerApi {
540
+ /** Email + password → access token. Persist `token` (e.g. via customerTokenStore). */
541
+ login(email: string, password: string): Promise<AuthResult>;
542
+ /** Invalidate the access token server-side. */
543
+ logout(token: string): Promise<void>;
544
+ /** Extend a token nearing expiry. */
545
+ renew(token: string): Promise<AuthResult>;
546
+ /** Create an account. Returns the new customer + (no token — call login next). */
547
+ register(input: {
548
+ email: string;
549
+ password: string;
550
+ firstName?: string;
551
+ lastName?: string;
552
+ phone?: string;
553
+ acceptsMarketing?: boolean;
554
+ }): Promise<MutationResult<Customer>>;
555
+ /** Current customer (account page). null when the token is invalid/expired. */
556
+ get(token: string): Promise<Customer | null>;
557
+ /** Order history. */
558
+ orders(token: string, opts?: {
559
+ first?: number;
560
+ }): Promise<Order[]>;
561
+ /** Saved payment methods (`customer.payment_methods`). */
562
+ paymentMethods(token: string): Promise<CustomerPaymentMethod[]>;
563
+ /** Guest order lookup — orderNumber + email (no account needed). */
564
+ orderByLookup(orderNumber: string, email: string): Promise<Order | null>;
565
+ createAddress(token: string, address: CustomerAddressInput): Promise<MutationResult<{
566
+ id: string;
567
+ }>>;
568
+ updateAddress(token: string, id: string, address: CustomerAddressInput): Promise<MutationResult>;
569
+ deleteAddress(token: string, id: string): Promise<MutationResult>;
570
+ setDefaultAddress(token: string, addressId: string): Promise<MutationResult>;
571
+ }
572
+ /** The full set of live-only methods this module attaches to a DataApi. */
573
+ export interface StorefrontExtensions {
574
+ /** Shop info + legal policies (prefetched at boot). null = mock data. */
575
+ shop?: Shop | null;
576
+ /** A navigation menu by handle. `main-menu` + `footer` are prefetched at boot
577
+ * (sync); other handles return null until `fetchMenu()` caches them. */
578
+ menu?: (handle: string) => Menu | null;
579
+ /** Fetch (and cache) an arbitrary menu by handle. */
580
+ fetchMenu?: (handle: string) => Promise<Menu | null>;
581
+ /** Full-text search across products, pages and articles (paginated + faceted). */
582
+ search?: (query: string, opts?: {
583
+ first?: number;
584
+ after?: string;
585
+ types?: Array<'PRODUCT' | 'PAGE' | 'ARTICLE'>;
586
+ /** Products order: 'price-asc' | 'price-desc' | 'title-asc' | 'created-desc'; absent = relevance. */
587
+ sort?: string;
588
+ }) => Promise<SearchResults>;
589
+ /** Autocomplete suggestions (header search dropdown). */
590
+ predictiveSearch?: (query: string, opts?: {
591
+ limit?: number;
592
+ }) => Promise<PredictiveSearchResults>;
593
+ /** Products in a collection — paginated, sortable, faceted (collection page). */
594
+ collectionProducts?: (handle: string, opts?: {
595
+ first?: number;
596
+ after?: string;
597
+ sortKey?: 'TITLE' | 'PRICE' | 'BEST_SELLING' | 'CREATED' | 'MANUAL' | 'COLLECTION_DEFAULT';
598
+ reverse?: boolean;
599
+ filters?: Array<Record<string, unknown>>;
600
+ }) => Promise<CollectionProductsPage>;
601
+ /**
602
+ * The first filtered page the server already loaded for a shared filtered URL (`filters` is the
603
+ * one request's filter objects), synchronously, or null. Lets the server HTML and the hydrating
604
+ * browser render the same filtered products.
605
+ */
606
+ listingSeed?: (handle: string, filters: Array<Record<string, unknown>>) => {
607
+ products: Product[];
608
+ pageInfo?: {
609
+ hasNextPage?: boolean;
610
+ endCursor?: string | null;
611
+ };
612
+ } | null;
613
+ /** "You may also like" — related products for a product node id. */
614
+ productRecommendations?: (productId: string) => Promise<Product[]>;
615
+ /** A blog with its articles. */
616
+ blogByHandle?: (handle: string, opts?: {
617
+ articles?: number;
618
+ }) => Promise<Blog | null>;
619
+ /** A single article within a blog. */
620
+ articleByHandle?: (blogHandle: string, articleHandle: string) => Promise<Article | null>;
621
+ /** A metaobject (custom content) by type + handle. */
622
+ metaobject?: (type: string, handle: string) => Promise<Metaobject | null>;
623
+ /** All ACTIVE metaobjects of a type. */
624
+ metaobjects?: (type: string, opts?: {
625
+ first?: number;
626
+ }) => Promise<Metaobject[]>;
627
+ /** Customer account flow (login/register/orders/addresses). */
628
+ customer?: CustomerApi;
629
+ }
630
+ /** GraphQL selection for shop + the two standard menus, spliced into the
631
+ * homepage bootstrap so the layout (nav + footer + policies) renders sync. */
632
+ 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";
633
+ /** Fragment defs the bootstrap query must include when it uses BOOTSTRAP_SHOP_MENU. */
634
+ 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";
635
+ /** Pull shop + the prefetched menus out of a bootstrap response. */
636
+ export declare function readBootstrapShopMenu(boot: any): {
637
+ shop: Shop | null;
638
+ menus: Map<string, Menu>;
639
+ };
640
+ /**
641
+ * Build the live storefront extension methods on top of a `graphql()` requester.
642
+ * `menuCache` is shared with the boot-prefetched menus so `fetchMenu()` warms
643
+ * the same map that the sync `menu()` reads.
644
+ */
645
+ export declare function createStorefrontMethods(graphql: GraphqlFn, helpers: StorefrontHelpers, menuCache: Map<string, Menu>): Required<Omit<StorefrontExtensions, 'shop' | 'menu'>>;
646
+ /** Tiny localStorage helper for the customer access token (SSR-safe no-ops). */
647
+ export declare const customerTokenStore: {
648
+ get(): string | null;
649
+ set(token: string): void;
650
+ clear(): void;
651
+ };
652
+ export {};