@usethrottle/storefront-react 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (122) hide show
  1. package/CLAUDE.md +67 -0
  2. package/README.md +119 -2
  3. package/dist/StorefrontProvider-Br4wUHui.d.cts +559 -0
  4. package/dist/StorefrontProvider-DLEPEjg6.d.ts +559 -0
  5. package/dist/account/index.cjs +69 -0
  6. package/dist/account/index.cjs.map +1 -0
  7. package/dist/account/index.d.cts +23 -0
  8. package/dist/account/index.d.ts +23 -0
  9. package/dist/account/index.js +68 -0
  10. package/dist/account/index.js.map +1 -0
  11. package/dist/chunk-2LCPIY2P.cjs +16 -0
  12. package/dist/chunk-2LCPIY2P.cjs.map +1 -0
  13. package/dist/chunk-3A72UY6T.js +2126 -0
  14. package/dist/chunk-3A72UY6T.js.map +1 -0
  15. package/dist/chunk-3JMIVAHN.js +185 -0
  16. package/dist/chunk-3JMIVAHN.js.map +1 -0
  17. package/dist/chunk-4J6AGWNC.cjs +24 -0
  18. package/dist/chunk-4J6AGWNC.cjs.map +1 -0
  19. package/dist/chunk-4U6MYDZV.js +17 -0
  20. package/dist/chunk-4U6MYDZV.js.map +1 -0
  21. package/dist/chunk-66HDJVPS.js +22 -0
  22. package/dist/chunk-66HDJVPS.js.map +1 -0
  23. package/dist/chunk-6X2OZSNV.cjs +83 -0
  24. package/dist/chunk-6X2OZSNV.cjs.map +1 -0
  25. package/dist/chunk-6ZMMZ245.cjs +2127 -0
  26. package/dist/chunk-6ZMMZ245.cjs.map +1 -0
  27. package/dist/chunk-7R37CVAB.cjs +23 -0
  28. package/dist/chunk-7R37CVAB.cjs.map +1 -0
  29. package/dist/chunk-A3IFWQUV.js +368 -0
  30. package/dist/chunk-A3IFWQUV.js.map +1 -0
  31. package/dist/chunk-AYC2YK4E.cjs +95 -0
  32. package/dist/chunk-AYC2YK4E.cjs.map +1 -0
  33. package/dist/chunk-AZV5U7YB.cjs +18 -0
  34. package/dist/chunk-AZV5U7YB.cjs.map +1 -0
  35. package/dist/chunk-CE2SKNQP.cjs +71 -0
  36. package/dist/chunk-CE2SKNQP.cjs.map +1 -0
  37. package/dist/chunk-D76CRI4X.js +2175 -0
  38. package/dist/chunk-D76CRI4X.js.map +1 -0
  39. package/dist/chunk-DOAII637.cjs +186 -0
  40. package/dist/chunk-DOAII637.cjs.map +1 -0
  41. package/dist/chunk-DYHHAOMG.cjs +17 -0
  42. package/dist/chunk-DYHHAOMG.cjs.map +1 -0
  43. package/dist/chunk-EYSVU5SJ.js +196 -0
  44. package/dist/chunk-EYSVU5SJ.js.map +1 -0
  45. package/dist/chunk-HSUUDZWS.js +37 -0
  46. package/dist/chunk-HSUUDZWS.js.map +1 -0
  47. package/dist/chunk-HZ6VEN6Q.cjs +101 -0
  48. package/dist/chunk-HZ6VEN6Q.cjs.map +1 -0
  49. package/dist/chunk-IJOTLGPT.js +16 -0
  50. package/dist/chunk-IJOTLGPT.js.map +1 -0
  51. package/dist/chunk-ISDATHVC.js +219 -0
  52. package/dist/chunk-ISDATHVC.js.map +1 -0
  53. package/dist/chunk-LW2A6USV.js +100 -0
  54. package/dist/chunk-LW2A6USV.js.map +1 -0
  55. package/dist/chunk-M4YXSLRG.cjs +369 -0
  56. package/dist/chunk-M4YXSLRG.cjs.map +1 -0
  57. package/dist/chunk-NDUEJJLP.cjs +2176 -0
  58. package/dist/chunk-NDUEJJLP.cjs.map +1 -0
  59. package/dist/chunk-NNE4FYRT.js +820 -0
  60. package/dist/chunk-NNE4FYRT.js.map +1 -0
  61. package/dist/chunk-NW3EFHY2.js +15 -0
  62. package/dist/chunk-NW3EFHY2.js.map +1 -0
  63. package/dist/chunk-NZRUQUN5.js +167 -0
  64. package/dist/chunk-NZRUQUN5.js.map +1 -0
  65. package/dist/chunk-P6HHE57S.cjs +38 -0
  66. package/dist/chunk-P6HHE57S.cjs.map +1 -0
  67. package/dist/chunk-PHY7AY27.cjs +197 -0
  68. package/dist/chunk-PHY7AY27.cjs.map +1 -0
  69. package/dist/chunk-PNJOFFTL.cjs +128 -0
  70. package/dist/chunk-PNJOFFTL.cjs.map +1 -0
  71. package/dist/chunk-PXZQ4ONA.js +127 -0
  72. package/dist/chunk-PXZQ4ONA.js.map +1 -0
  73. package/dist/chunk-Q3VTUBPP.js +82 -0
  74. package/dist/chunk-Q3VTUBPP.js.map +1 -0
  75. package/dist/chunk-Q3XFD5UI.js +45 -0
  76. package/dist/chunk-Q3XFD5UI.js.map +1 -0
  77. package/dist/chunk-QM7KTT7F.js +94 -0
  78. package/dist/chunk-QM7KTT7F.js.map +1 -0
  79. package/dist/chunk-RLWZOLXL.js +70 -0
  80. package/dist/chunk-RLWZOLXL.js.map +1 -0
  81. package/dist/chunk-SV53BRP2.js +23 -0
  82. package/dist/chunk-SV53BRP2.js.map +1 -0
  83. package/dist/chunk-VWXJO427.cjs +821 -0
  84. package/dist/chunk-VWXJO427.cjs.map +1 -0
  85. package/dist/chunk-WIIOJDHR.cjs +220 -0
  86. package/dist/chunk-WIIOJDHR.cjs.map +1 -0
  87. package/dist/chunk-XQHGFWLG.cjs +46 -0
  88. package/dist/chunk-XQHGFWLG.cjs.map +1 -0
  89. package/dist/chunk-ZHCXI2ZZ.cjs +168 -0
  90. package/dist/chunk-ZHCXI2ZZ.cjs.map +1 -0
  91. package/dist/index-RSj2Rg62.d.cts +8 -0
  92. package/dist/index-RSj2Rg62.d.ts +8 -0
  93. package/dist/index.cjs +2829 -0
  94. package/dist/index.cjs.map +1 -0
  95. package/dist/index.d.cts +1718 -0
  96. package/dist/index.d.ts +1718 -0
  97. package/dist/index.js +2828 -0
  98. package/dist/index.js.map +1 -0
  99. package/dist/metadata-QhKw-tvz.d.cts +188 -0
  100. package/dist/metadata-QhKw-tvz.d.ts +188 -0
  101. package/dist/next/client.cjs +84 -0
  102. package/dist/next/client.cjs.map +1 -0
  103. package/dist/next/client.d.cts +40 -0
  104. package/dist/next/client.d.ts +40 -0
  105. package/dist/next/client.js +83 -0
  106. package/dist/next/client.js.map +1 -0
  107. package/dist/next/index.cjs +1090 -0
  108. package/dist/next/index.cjs.map +1 -0
  109. package/dist/next/index.d.cts +218 -0
  110. package/dist/next/index.d.ts +218 -0
  111. package/dist/next/index.js +1049 -0
  112. package/dist/next/index.js.map +1 -0
  113. package/dist/server/index.cjs +994 -0
  114. package/dist/server/index.cjs.map +1 -0
  115. package/dist/server/index.d.cts +229 -0
  116. package/dist/server/index.d.ts +229 -0
  117. package/dist/server/index.js +951 -0
  118. package/dist/server/index.js.map +1 -0
  119. package/dist/styles.css +2111 -0
  120. package/dist/use-part-DCfFk7kf.d.ts +24 -0
  121. package/dist/use-part-DgjPBL_O.d.cts +24 -0
  122. package/package.json +121 -3
@@ -0,0 +1,559 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { ResolvedStorefrontSettings, StringKey, CatalogClient } from '@usethrottle/catalog';
3
+ import { CartStorage, CatalogProviderProps, CartUrls } from '@usethrottle/catalog/react';
4
+ import { DeepPartial, SiteDesign, PresetName, ThemeTokens, SiteMenuItem, SlotRenderer, ThrottleAppearance, IconOverrides } from '@usethrottle/ui';
5
+ import { ComponentType, AnchorHTMLAttributes, ReactNode } from 'react';
6
+ import { a as StorefrontPartKey } from './index-RSj2Rg62.js';
7
+
8
+ /** What a link renders as: a plain `<a>` by default, `next/link` through `StorefrontNextProvider`. */
9
+ type LinkComponent = ComponentType<AnchorHTMLAttributes<HTMLAnchorElement> & {
10
+ href: string;
11
+ prefetch?: boolean;
12
+ }>;
13
+ /** The default `linkComponent`: a plain anchor (`prefetch` has no meaning here). */
14
+ declare const DefaultLink: LinkComponent;
15
+
16
+ /** The settings a component reads: the catalog's resolved document with every field present. */
17
+ type NormalizedSettings = ResolvedStorefrontSettings;
18
+ /**
19
+ * Settings from whatever the catalog answered (or nothing): deep-filled from
20
+ * `DEFAULT_SETTINGS`, an unknown enum value replaced by its default with one
21
+ * development warning. Never throws, so a partial or newer answer renders.
22
+ */
23
+ declare function normalizeSettings(raw: unknown): NormalizedSettings;
24
+
25
+ /** The package's own English text, one object per area; a key reads `<area>.<name>`, such as `shop.resultsAnnounce`. */
26
+ declare const SF_STRINGS_EN: {
27
+ pieces: {
28
+ readonly rating: {
29
+ readonly label: "{value} out of 5 stars";
30
+ readonly labelWithCount: "{value} out of 5 stars, {count} reviews";
31
+ readonly labelWithOne: "{value} out of 5 stars, 1 review";
32
+ readonly count: "({count})";
33
+ };
34
+ readonly price: {
35
+ readonly customer: "Your price";
36
+ readonly verifyEmail: "Verify your email to see your price";
37
+ readonly compareAt: "Original price";
38
+ readonly from: "From";
39
+ readonly unavailable: "Not sold in this currency";
40
+ };
41
+ readonly card: {
42
+ readonly moreSwatches: "+{count}";
43
+ readonly moreSwatchesLabel: "{count} more colours";
44
+ };
45
+ };
46
+ shop: {
47
+ readonly resultsAnnounce: "{count} results";
48
+ readonly countOne: "{count} product";
49
+ readonly moreFilters: "More filters";
50
+ readonly showResults: "Show {count} results";
51
+ readonly showResultsLoading: "Show results";
52
+ readonly closeFilters: "Close filters";
53
+ readonly showAll: "Show all ({count})";
54
+ readonly showFewer: "Show fewer";
55
+ readonly searchFacet: "Search {name}";
56
+ readonly noFacetMatch: "No matches";
57
+ readonly valueCount: "{count} products";
58
+ readonly selectedCount: "{count} selected";
59
+ readonly removeFilter: "Remove filter: {label}";
60
+ readonly rangeBetween: "{min} to {max}";
61
+ readonly rangeFrom: "{min} and up";
62
+ readonly rangeUpTo: "up to {max}";
63
+ readonly rangeMin: "Min";
64
+ readonly rangeMax: "Max";
65
+ readonly rangeInvalid: "Enter numbers only.";
66
+ readonly rangeClear: "Clear";
67
+ readonly any: "Any";
68
+ readonly breadcrumbs: "Breadcrumb";
69
+ readonly paginationLabel: "Pagination";
70
+ readonly pageLabel: "Page {page}";
71
+ readonly errorLoading: "We could not load the products.";
72
+ readonly retry: "Try again";
73
+ readonly loadingProducts: "Loading products";
74
+ readonly pastEnd: "There are no products on this page.";
75
+ };
76
+ product: {
77
+ readonly gallery: {
78
+ readonly label: "{title}: photos";
79
+ readonly photoAlt: "{title}, photo {n}";
80
+ readonly thumbs: "Photo thumbnails";
81
+ readonly showPhoto: "Show photo {n} of {count}";
82
+ readonly previous: "Previous photo";
83
+ readonly next: "Next photo";
84
+ readonly enlarge: "Enlarge photo";
85
+ readonly close: "Close";
86
+ readonly counter: "{n} / {count}";
87
+ readonly lightboxTitle: "{title}: enlarged photos";
88
+ readonly video: "{title}, video";
89
+ };
90
+ readonly options: {
91
+ readonly soldOut: ", sold out";
92
+ readonly unavailableWith: ", not made with {others}";
93
+ readonly chooseOne: "Choose {option}";
94
+ };
95
+ readonly stockStatus: {
96
+ readonly noCurrency: "Not available in {currency}";
97
+ readonly noCurrencyAny: "Not available";
98
+ readonly noCombination: "This combination is not available";
99
+ };
100
+ readonly quantityInput: {
101
+ readonly decrease: "One fewer";
102
+ readonly increase: "One more";
103
+ };
104
+ readonly cartAdd: {
105
+ readonly adding: "Adding…";
106
+ readonly added: "Added {quantity} × {title} to your cart";
107
+ readonly onlyLeft: "Only {count} left";
108
+ readonly outOfStock: "Out of stock";
109
+ readonly failed: "We could not add this to your cart. Try again in a moment.";
110
+ };
111
+ readonly sections: {
112
+ readonly label: "Product details";
113
+ };
114
+ readonly crumbs: {
115
+ readonly label: "Breadcrumb";
116
+ readonly home: "Home";
117
+ };
118
+ readonly sticky: {
119
+ readonly label: "Add to cart";
120
+ };
121
+ readonly reviewList: {
122
+ readonly ratingsByStars: "Ratings by stars";
123
+ readonly filterRating: "Show {rating}-star reviews, {count} in all";
124
+ readonly clearFilter: "Show all reviews";
125
+ readonly sortLabel: "Sort by";
126
+ readonly sortNewest: "Newest";
127
+ readonly sortHighest: "Highest rated";
128
+ readonly sortLowest: "Lowest rated";
129
+ readonly loadMore: "Load more reviews";
130
+ readonly loading: "Loading reviews";
131
+ readonly loadFailed: "We could not load the reviews. Try again in a moment.";
132
+ readonly verified: "Verified buyer";
133
+ readonly reply: "Reply from the store";
134
+ readonly noneForRating: "No reviews with this rating.";
135
+ readonly average: "{value} out of 5";
136
+ readonly ratingLabel: "Rated {rating} out of 5";
137
+ readonly gateSignIn: "Sign in to write a review.";
138
+ readonly gateReviewsDisabled: "Reviews are closed for this shop.";
139
+ readonly gateEmailNotVerified: "Verify your email address to write a review.";
140
+ readonly gateAlreadyReviewed: "You have reviewed this one already. Thank you.";
141
+ readonly gateNotVerifiedBuyer: "Reviews come from customers who bought this. Once your order is paid, you can write one.";
142
+ readonly gateUnknown: "You cannot review this product.";
143
+ readonly gateFailed: "We could not check whether you can review this just now.";
144
+ };
145
+ readonly reviewForm: {
146
+ readonly rating: "Your rating";
147
+ readonly star: "{n} stars";
148
+ readonly starOne: "1 star";
149
+ readonly title: "Title (optional)";
150
+ readonly body: "Your review";
151
+ readonly name: "Name shown";
152
+ readonly submit: "Send review";
153
+ readonly sending: "Sending…";
154
+ readonly thanksPending: "Thanks, your review is awaiting moderation.";
155
+ readonly thanksLive: "Thanks, your review is live.";
156
+ readonly needRating: "Choose a rating from 1 to 5 stars.";
157
+ readonly needBody: "Write a few words about it.";
158
+ readonly needName: "Add the name to show with your review.";
159
+ readonly errorAlready: "You have reviewed this one already.";
160
+ readonly errorNotBuyer: "Only customers who bought this can review it.";
161
+ readonly errorEmail: "Verify your email address first.";
162
+ readonly errorBusy: "Too many reviews at once. Try again in a few minutes.";
163
+ readonly errorGeneric: "Your review did not send. Try again in a moment.";
164
+ };
165
+ };
166
+ frame: {
167
+ readonly skipLink: "Skip to main content";
168
+ readonly announcement: {
169
+ readonly label: "Announcement";
170
+ readonly dismiss: "Dismiss announcement";
171
+ };
172
+ readonly header: {
173
+ readonly mainNav: "Main";
174
+ readonly categoriesNav: "Categories";
175
+ readonly closeMenu: "Close menu";
176
+ readonly home: "{store}, home";
177
+ readonly homeNoName: "Home";
178
+ };
179
+ readonly nav: {
180
+ readonly submenu: "{name} submenu";
181
+ };
182
+ readonly search: {
183
+ readonly label: "Search the shop";
184
+ readonly suggestions: "Search suggestions";
185
+ readonly products: "Products";
186
+ readonly categories: "Categories";
187
+ readonly brands: "Brands";
188
+ readonly tags: "Tags";
189
+ readonly collections: "Collections";
190
+ readonly searchFor: "Search for “{q}”";
191
+ readonly none: "No quick matches for “{q}”.";
192
+ readonly announceNone: "No quick matches.";
193
+ readonly announceOne: "1 suggestion";
194
+ readonly announceMany: "{count} suggestions";
195
+ readonly productCount: "{count} products";
196
+ readonly productCountOne: "1 product";
197
+ };
198
+ readonly locale: {
199
+ readonly label: "Language";
200
+ };
201
+ readonly currency: {
202
+ readonly label: "Currency";
203
+ };
204
+ readonly cart: {
205
+ readonly label: "Cart, {count} items";
206
+ readonly labelOne: "Cart, 1 item";
207
+ };
208
+ readonly footer: {
209
+ readonly label: "Footer";
210
+ };
211
+ };
212
+ merch: {
213
+ readonly viewAll: "View all";
214
+ readonly viewAllNamed: "View all {title}";
215
+ readonly viewProduct: "View product";
216
+ readonly carousel: {
217
+ readonly label: "Products";
218
+ readonly previous: "Previous products";
219
+ readonly next: "Next products";
220
+ readonly slide: "{n} of {total}";
221
+ };
222
+ readonly categories: {
223
+ readonly label: "Categories";
224
+ readonly count: "{count} products";
225
+ readonly countOne: "1 product";
226
+ };
227
+ readonly reviews: {
228
+ readonly label: "Reviews";
229
+ readonly verified: "Verified purchase";
230
+ readonly reply: "Reply from the store";
231
+ readonly forProduct: "on {product}";
232
+ };
233
+ };
234
+ shopper: {
235
+ readonly cart: {
236
+ readonly close: "Close cart";
237
+ readonly lines: "Items in your cart";
238
+ readonly loading: "Loading your cart";
239
+ readonly subtotal: "Subtotal";
240
+ readonly decrease: "Decrease quantity of {name}";
241
+ readonly increase: "Increase quantity of {name}";
242
+ readonly quantity: "Quantity of {name}";
243
+ readonly remove: "Remove {name}";
244
+ readonly removeText: "Remove";
245
+ readonly removed: "Removed {name} from your cart.";
246
+ readonly updated: "Quantity of {name} is now {quantity}.";
247
+ readonly onlyLeft: "Only {count} available";
248
+ readonly unavailable: "No longer available";
249
+ readonly updateFailed: "We could not update your cart. Try again.";
250
+ readonly checkoutFailed: "We could not start checkout. Try again.";
251
+ readonly pricesChanged: "Some prices changed. Review your cart, then check out again.";
252
+ readonly checkingOut: "Taking you to checkout";
253
+ };
254
+ readonly quickAdd: {
255
+ readonly button: "Quick add";
256
+ readonly buttonFor: "Quick add {title}";
257
+ readonly choose: "Choose options";
258
+ readonly chooseFor: "Choose options for {title}";
259
+ readonly panelFor: "Options for {title}";
260
+ readonly added: "Added {title} to your cart.";
261
+ readonly failed: "We could not add this. Try again.";
262
+ readonly unavailable: "This product is not available.";
263
+ };
264
+ readonly quickView: {
265
+ readonly title: "Quick view: {title}";
266
+ readonly loadingTitle: "Quick view";
267
+ readonly viewDetails: "View full details";
268
+ readonly closeLabel: "Close quick view";
269
+ readonly notFound: "This product is not available.";
270
+ };
271
+ readonly recent: {
272
+ readonly title: "Recently viewed";
273
+ };
274
+ readonly compare: {
275
+ readonly button: "Compare";
276
+ readonly buttonFor: "Compare {title}";
277
+ readonly full: "You can compare up to {max} products.";
278
+ readonly title: "Compare products";
279
+ readonly caption: "Comparison of {count} products";
280
+ readonly clear: "Clear all";
281
+ readonly remove: "Remove {title} from the comparison";
282
+ readonly needMore: "Choose at least 2 products to compare.";
283
+ readonly spec: "Specification";
284
+ readonly price: "Price";
285
+ readonly availability: "Availability";
286
+ readonly brand: "Brand";
287
+ readonly rating: "Rating";
288
+ readonly none: "–";
289
+ readonly loadFailed: "We could not load these products. Try again.";
290
+ };
291
+ };
292
+ pages: {
293
+ readonly notFound: {
294
+ readonly code: "404";
295
+ readonly body: "It may have moved, or it may never have existed.";
296
+ readonly shop: "Browse the shop";
297
+ readonly home: "Home";
298
+ };
299
+ readonly search: {
300
+ readonly prompt: "Type something to search the shop.";
301
+ };
302
+ readonly account: {
303
+ readonly signIn: "Sign in";
304
+ readonly signUp: "Create an account";
305
+ readonly setupTitle: "Account pages are not set up yet";
306
+ readonly setupBody: "Sign-in and account pages need your Throttle publishable key. Add it under Connections in the Builder, or pass throttlePublishableKey to the StorefrontProvider.";
307
+ };
308
+ };
309
+ };
310
+ /** The English table with every leaf widened from its literal, so a translation is any string. */
311
+ type SfStrings = Widen<typeof SF_STRINGS_EN>;
312
+ type Widen<T> = {
313
+ -readonly [K in keyof T]: T[K] extends string ? string : Widen<T[K]>;
314
+ };
315
+ type Leaves<T, Prefix extends string = ''> = {
316
+ [K in keyof T & string]: T[K] extends string ? `${Prefix}${K}` : Leaves<T[K], `${Prefix}${K}.`>;
317
+ }[keyof T & string];
318
+ /** The dotted leaf paths of `SF_STRINGS_EN`, for example `'shop.resultsAnnounce'`. */
319
+ type SfLocalKey = Leaves<typeof SF_STRINGS_EN>;
320
+ /** A catalog string (`cart.title`) or one of this package's own. */
321
+ type SfStringKey = StringKey | SfLocalKey;
322
+ type Head<K> = K extends `${infer H}.${string}` ? H : never;
323
+ /** A catalog key's override, nested by its dotted path: `{ cart: { title: 'Basket' } }`. */
324
+ type CatalogLocalization = {
325
+ [H in Head<StringKey>]?: {
326
+ [K in StringKey as K extends `${H}.${infer T}` ? T : never]?: string;
327
+ };
328
+ };
329
+ /** What the `localization` prop takes: any subset of the English table, plus any catalog string by its dotted path. */
330
+ type StorefrontLocalization = DeepPartial<SfStrings> & CatalogLocalization;
331
+
332
+ /** The GA4 ecommerce events the storefront reports. `begin_checkout` is the hand-off to checkout. */
333
+ declare const GA4_EVENTS: readonly ["view_item_list", "select_item", "view_item", "add_to_cart", "remove_from_cart", "view_cart", "begin_checkout"];
334
+ /** A GA4 ecommerce event name the storefront reports. */
335
+ type Ga4EventName = (typeof GA4_EVENTS)[number];
336
+ /** One product line of a GA4 event. `price` is a decimal amount (`19.99`), never minor units. */
337
+ type Ga4Item = {
338
+ item_id: string;
339
+ item_name: string;
340
+ item_brand?: string;
341
+ item_variant?: string;
342
+ item_list_name?: string;
343
+ index?: number;
344
+ price?: number;
345
+ quantity?: number;
346
+ };
347
+ /** The payload of a GA4 ecommerce event: a currency, an optional value and the items. */
348
+ type Ga4Payload = {
349
+ currency: string;
350
+ value?: number;
351
+ item_list_name?: string;
352
+ items: Ga4Item[];
353
+ };
354
+ /** Where analytics events go: the `analytics` prop of `StorefrontProvider`. */
355
+ type StorefrontAnalytics = {
356
+ track(event: Ga4EventName, payload: Ga4Payload): void;
357
+ };
358
+
359
+ /** A site design with every field decided (R11): what the components read. */
360
+ type ResolvedSiteDesign = {
361
+ source: 'builder' | 'catalog-adapter';
362
+ preset: PresetName;
363
+ scheme: 'light' | 'dark' | 'auto';
364
+ theme: ThemeTokens;
365
+ brand: {
366
+ storeName: string;
367
+ logo: {
368
+ light?: string;
369
+ dark?: string;
370
+ } | null;
371
+ };
372
+ menus: Record<string, SiteMenuItem[]>;
373
+ announcement: {
374
+ message: string;
375
+ href?: string;
376
+ } | null;
377
+ /** The site strings: the Builder's over the catalog adapter's. */
378
+ strings: Record<string, string>;
379
+ /** Only what the Builder provided. It outranks the `localization` prop; the adapter's strings are catalog text and do not. */
380
+ builderStrings: Record<string, string>;
381
+ seo: {
382
+ titleTemplate: string;
383
+ defaultDescription?: string;
384
+ shareImage?: string;
385
+ };
386
+ routes: {
387
+ page: string;
388
+ };
389
+ throttlePublishableKey: string | null;
390
+ pageOutlet: ((handle: string) => SlotRenderer | null) | null;
391
+ };
392
+ /**
393
+ * The inputs of `resolveSiteDesign`: the Builder's site (or `null`), the catalog's settings and the developer's props. The theme group resolves Builder, props, catalog, defaults; every other field Builder, then catalog.
394
+ */
395
+ type ResolveSiteDesignInput = {
396
+ site: SiteDesign | null;
397
+ settings: NormalizedSettings;
398
+ preset?: PresetName;
399
+ theme?: Partial<ThemeTokens>;
400
+ scheme?: 'light' | 'dark' | 'auto';
401
+ throttlePublishableKey?: string;
402
+ };
403
+ /**
404
+ * Decides every site-design field (R11, owner ruling 2026-11-15). Pure and
405
+ * server-safe.
406
+ *
407
+ * - **Theme group** (`preset`, tokens, colour scheme): Builder, then the
408
+ * developer's `preset` / `theme` / `scheme` props, then the catalog adapter,
409
+ * then the defaults (`clean`, `auto`). An explicit `preset` or `theme` prop
410
+ * skips the adapter's theme. A Builder with `customized: false` contributes
411
+ * only its preset and colour scheme. Tokens are `PRESET_TOKENS[preset]`, then
412
+ * the `theme` prop, then the winning source's values, deep-merged.
413
+ * - **Every other field**: Builder, then the catalog adapter, field by field; a
414
+ * field a source leaves `undefined` falls through and `null` is a value.
415
+ * - **Account key**: the `throttlePublishableKey` prop, then the Builder's
416
+ * `connections`, then `null`.
417
+ *
418
+ * A `preset` / `theme` / `scheme` prop that a Builder theme shadows logs one
419
+ * development warning naming the prop.
420
+ */
421
+ declare function resolveSiteDesign(input: ResolveSiteDesignInput): ResolvedSiteDesign;
422
+
423
+ /** Navigation as the components use it. Next's router is adapted to this by `StorefrontNextProvider`. */
424
+ type StorefrontRouter = {
425
+ pathname: string;
426
+ searchParams: URLSearchParams;
427
+ push(href: string, options?: {
428
+ scroll?: boolean;
429
+ }): void;
430
+ replace(href: string, options?: {
431
+ scroll?: boolean;
432
+ }): void;
433
+ };
434
+ /**
435
+ * The default router (plain React, Vite): the browser's History API. It
436
+ * re-renders on `popstate` and after its own `push` / `replace`. On the server
437
+ * it answers `/` with no query; a Next store uses `StorefrontNextProvider`.
438
+ */
439
+ declare function useHistoryRouter(): StorefrontRouter;
440
+
441
+ /** Appearance for the storefront: `parts` take storefront part keys, `elements` reach auth components inside. Its `variables` / `darkVariables` override the theme mapping. */
442
+ type StorefrontAppearance = ThrottleAppearance<string, StorefrontPartKey>;
443
+ /** Where analytics events go. */
444
+ type AnalyticsSink = StorefrontAnalytics;
445
+ /** Everything `StorefrontProvider` resolved, as `useStorefront()` returns it. */
446
+ type StorefrontContextValue = {
447
+ settings: NormalizedSettings;
448
+ site: ResolvedSiteDesign;
449
+ preset: ResolvedSiteDesign['preset'];
450
+ scheme: ResolvedSiteDesign['scheme'];
451
+ dir: 'ltr' | 'rtl';
452
+ locale: string;
453
+ currency: string | undefined;
454
+ client: CatalogClient;
455
+ router: StorefrontRouter;
456
+ analytics: AnalyticsSink;
457
+ Link: LinkComponent;
458
+ /** Whether the catalog's lists carry ratings; a card shows its rating only when this and `card.showRating` hold. */
459
+ reviewsOnLists: boolean;
460
+ throttlePublishableKey: string | null;
461
+ };
462
+ /** Everything the provider resolved. Throws outside a `StorefrontProvider`. */
463
+ declare function useStorefront(): StorefrontContextValue;
464
+
465
+ /** The props of `StorefrontProvider`. Give it a `catalogKey` (or a `client`) and everything else has a default. */
466
+ type StorefrontProviderProps = {
467
+ /** The catalog's publishable key. Give this or `client`. */
468
+ catalogKey?: string;
469
+ /** A ready catalog client (a server-built one, or a fixture in tests). */
470
+ client?: CatalogClient;
471
+ /** The settings answered on the server (`loadSettings`); the first render uses them with no request. */
472
+ settings?: NormalizedSettings;
473
+ /** Whether the catalog's lists carry ratings (`/config` `reviews`; the server loaders return it). Default true. */
474
+ reviewsOnLists?: boolean;
475
+ /** A preset's name. A Builder's theme wins over it; it wins over the catalog's theme (R11). */
476
+ preset?: PresetName;
477
+ /** Token overrides, merged over the preset. */
478
+ theme?: Partial<ThemeTokens>;
479
+ /** Colour scheme. Default: the site design's, else `'auto'` (follows the visitor's system setting). */
480
+ scheme?: 'light' | 'dark' | 'auto';
481
+ /**
482
+ * BCP 47 locale (`'en'`, `'de'`, `'ar'`), sent to the catalog when the provider makes the client; picks `dir` when
483
+ * that is not given. Default `'en'`.
484
+ */
485
+ locale?: string;
486
+ /**
487
+ * ISO 4217 code prices are read in (`'EUR'`), sent to the catalog when the provider makes the client. Default: the
488
+ * catalog's. Every amount is shown by `formatMoney` in its own record's currency.
489
+ */
490
+ currency?: string;
491
+ /** Default: from `locale`. */
492
+ dir?: 'ltr' | 'rtl';
493
+ /**
494
+ * Style overrides: `parts` (class names per part key), `variables` / `darkVariables` (token overrides that win over every other theme source).
495
+ */
496
+ appearance?: StorefrontAppearance;
497
+ /**
498
+ * Text overrides keyed by string key, for any language. Site-design and catalog-settings strings win over it; the package's English is the last fallback.
499
+ */
500
+ localization?: StorefrontLocalization;
501
+ /** Replacement icons by name (a shared `@usethrottle/ui` icon override map). */
502
+ icons?: IconOverrides;
503
+ /** Where GA4-shaped ecommerce events go: `{ track(event, payload) }`. Default: nothing is sent. */
504
+ analytics?: AnalyticsSink;
505
+ /**
506
+ * How the storefront reads and changes the URL. Default: the History API (client-only apps). `StorefrontNextProvider` supplies Next's.
507
+ */
508
+ router?: StorefrontRouter;
509
+ /**
510
+ * The component every storefront link renders through. Default: a plain `<a>`. `StorefrontNextProvider` supplies `next/link`.
511
+ */
512
+ linkComponent?: LinkComponent;
513
+ /** Default true. Set false and import `@usethrottle/storefront-react/styles.css` for a flash-free SSR paint. */
514
+ injectStyles?: boolean;
515
+ /**
516
+ * An opaque, stable id of the signed-in customer (not a token), `null` when signed out. The catalog
517
+ * cache is partitioned by it: when it changes, every list and product is read again. The prices come
518
+ * from the catalog client's own `customerToken` source (`createCatalogClient({ customerToken })`);
519
+ * this prop only says whose cache entries these are.
520
+ */
521
+ customerKey?: string | null;
522
+ /**
523
+ * Cart wiring, handed to the `CatalogProvider` this component creates, so the storefront's add-to-cart,
524
+ * cart button and drawer read the app's one cart. Never mount a second `CatalogProvider` around it: two
525
+ * providers never share a cart. `cartStorage` is where the cart session id is kept (default: memory only),
526
+ * `customerCart` resumes a signed-in customer's cart on any device.
527
+ */
528
+ cartStorage?: CartStorage;
529
+ /** Resumes a signed-in customer's cart on any device; passed to the `CatalogProvider` unchanged. */
530
+ customerCart?: CatalogProviderProps['customerCart'];
531
+ /** The store's own URLs, sent on every cart created and used by `checkout()`: `returnUrl`, `cancelUrl` (and `storefrontUrl`). */
532
+ cartUrls?: CartUrls;
533
+ /** Where the checkout lives, when it is not Throttle's own. */
534
+ throttleBaseUrl?: string;
535
+ /** Throttle's hosted pages, used to build a cart link. Default `https://checkout.usethrottle.dev`. */
536
+ throttleCheckoutUrl?: string;
537
+ /** The account key; a Builder's connections may supply it instead. */
538
+ throttlePublishableKey?: string;
539
+ /** Called when the catalog's generation changes (a merchant published). */
540
+ onGenerationChange?: (generation: number) => void;
541
+ /**
542
+ * The open tab's check for a new catalog generation (a conditional read, a `304` when nothing changed).
543
+ * Default on, every 60 s; `intervalMs` is never below 60 s. `false` turns it off: the signed webhook
544
+ * then is the only way a change reaches an open tab.
545
+ */
546
+ generationWatch?: boolean | {
547
+ intervalMs?: number;
548
+ };
549
+ /** The storefront tree. */
550
+ children?: ReactNode;
551
+ };
552
+ /**
553
+ * The storefront root: the catalog provider, the ui provider (class prefix
554
+ * `tsf-`), the resolved site design, strings and router, and the one wrapper
555
+ * element that carries the theme.
556
+ */
557
+ declare function StorefrontProvider(props: StorefrontProviderProps): react_jsx_runtime.JSX.Element;
558
+
559
+ export { DefaultLink as D, GA4_EVENTS as G, type LinkComponent as L, type NormalizedSettings as N, type ResolveSiteDesignInput as R, SF_STRINGS_EN as S, type Ga4EventName as a, type Ga4Item as b, type Ga4Payload as c, type ResolvedSiteDesign as d, type SfLocalKey as e, type SfStringKey as f, type SfStrings as g, type StorefrontAnalytics as h, type StorefrontAppearance as i, type StorefrontContextValue as j, type StorefrontLocalization as k, StorefrontProvider as l, type StorefrontProviderProps as m, type StorefrontRouter as n, normalizeSettings as o, useStorefront as p, resolveSiteDesign as r, useHistoryRouter as u };
@@ -0,0 +1,69 @@
1
+ "use client";
2
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }"use client";
3
+
4
+
5
+ var _chunk4J6AGWNCcjs = require('../chunk-4J6AGWNC.cjs');
6
+
7
+
8
+ var _chunkXQHGFWLGcjs = require('../chunk-XQHGFWLG.cjs');
9
+
10
+
11
+
12
+ var _chunkVWXJO427cjs = require('../chunk-VWXJO427.cjs');
13
+
14
+ // src/account/AccountPage.tsx
15
+
16
+
17
+
18
+
19
+
20
+
21
+
22
+ var _components = require('@usethrottle/auth/components');
23
+ var _ui = require('@usethrottle/ui');
24
+ var _react = require('react');
25
+ var _jsxruntime = require('react/jsx-runtime');
26
+ function useAuthAppearance() {
27
+ const ambient = _react.useContext.call(void 0, _ui.AppearanceContext);
28
+ const prefersDark = _chunk4J6AGWNCcjs.useMediaQuery.call(void 0, "(prefers-color-scheme: dark)");
29
+ return _react.useMemo.call(void 0, () => {
30
+ const scheme = _nullishCoalesce(_optionalChain([ambient, 'optionalAccess', _ => _.theme]), () => ( "light"));
31
+ const dark = scheme === "dark" || scheme === "auto" && prefersDark;
32
+ const variables = dark ? { ..._optionalChain([ambient, 'optionalAccess', _2 => _2.variables]), ..._optionalChain([ambient, 'optionalAccess', _3 => _3.darkVariables]) } : { ..._optionalChain([ambient, 'optionalAccess', _4 => _4.variables]) };
33
+ const value = { theme: dark ? "dark" : "light", variables };
34
+ if (_optionalChain([ambient, 'optionalAccess', _5 => _5.darkVariables])) value.darkVariables = ambient.darkVariables;
35
+ if (_optionalChain([ambient, 'optionalAccess', _6 => _6.elements])) value.elements = ambient.elements;
36
+ if (_optionalChain([ambient, 'optionalAccess', _7 => _7.components])) value.components = ambient.components;
37
+ return value;
38
+ }, [ambient, prefersDark]);
39
+ }
40
+ function AccountPage(props) {
41
+ const { view = "dashboard", onSuccess } = props;
42
+ const { throttlePublishableKey } = _chunkVWXJO427cjs.useStorefront.call(void 0, );
43
+ const { t } = _chunkXQHGFWLGcjs.useStrings.call(void 0, );
44
+ const appearance = useAuthAppearance();
45
+ const root = _chunkVWXJO427cjs.usePart.call(void 0, "account-page", props);
46
+ const title = _chunkVWXJO427cjs.usePart.call(void 0, "account-page-title", props);
47
+ const notice = _chunkVWXJO427cjs.usePart.call(void 0, "account-page-setup-notice", props);
48
+ const noticeTitle = _chunkVWXJO427cjs.usePart.call(void 0, "account-page-setup-title", props);
49
+ const noticeBody = _chunkVWXJO427cjs.usePart.call(void 0, "account-page-setup-body", props);
50
+ if (!throttlePublishableKey) {
51
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "section", { ...notice, role: "note", children: [
52
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h1", { ...noticeTitle, children: t("pages.account.setupTitle") }),
53
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { ...noticeBody, children: t("pages.account.setupBody") })
54
+ ] });
55
+ }
56
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _components.ThrottleProvider, { publishableKey: throttlePublishableKey, appearance, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { ...root, "data-view": view, children: [
57
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h1", { ...title, children: t(view === "sign-in" ? "pages.account.signIn" : view === "sign-up" ? "pages.account.signUp" : "nav.account") }),
58
+ view === "sign-in" ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _components.SignIn, { onSuccess }) : null,
59
+ view === "sign-up" ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _components.SignUp, { onSuccess }) : null,
60
+ view === "dashboard" ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
61
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _components.SignedIn, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _components.AccountDashboard, {}) }),
62
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _components.SignedOut, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _components.SignIn, { onSuccess }) })
63
+ ] }) : null
64
+ ] }) });
65
+ }
66
+
67
+
68
+ exports.AccountPage = AccountPage;
69
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/home/runner/work/app-throttle/app-throttle/packages/storefront-react/dist/account/index.cjs","../../src/account/AccountPage.tsx"],"names":[],"mappings":"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","file":"/home/runner/work/app-throttle/app-throttle/packages/storefront-react/dist/account/index.cjs","sourcesContent":[null,"import {\n AccountDashboard,\n SignedIn,\n SignedOut,\n SignIn,\n SignUp,\n ThrottleProvider,\n type ThrottleAppearance as AuthAppearance,\n} from '@usethrottle/auth/components';\nimport { AppearanceContext } from '@usethrottle/ui';\nimport { useContext, useMemo } from 'react';\nimport { useMediaQuery } from '../frame/use-media-query';\nimport { usePart, type UsePartLocal } from '../parts';\nimport { useStorefront } from '../provider/context';\nimport { useStrings } from '../strings';\n\n/** The account page of `@usethrottle/auth`, drawn with the storefront's theme. */\nexport type AccountPageProps = UsePartLocal & {\n /**\n * `dashboard` (default): the account for a signed-in shopper, sign-in for a signed-out one.\n * `sign-in` and `sign-up`: that form.\n */\n view?: 'dashboard' | 'sign-in' | 'sign-up';\n /** Called after a successful sign-in or sign-up. */\n onSuccess?(): void;\n};\n\n/**\n * The storefront's appearance as auth takes it. Auth's components do not read `darkVariables` (it keeps\n * its own dark rule for its default palette), so the scheme is resolved here: the dark palette when the\n * site is dark, or auto and the shopper's system is dark. `darkVariables` is still passed, for the\n * day auth reads it.\n */\nfunction useAuthAppearance(): AuthAppearance {\n const ambient = useContext(AppearanceContext);\n const prefersDark = useMediaQuery('(prefers-color-scheme: dark)');\n return useMemo(() => {\n const scheme = ambient?.theme ?? 'light';\n const dark = scheme === 'dark' || (scheme === 'auto' && prefersDark);\n const variables = dark ? { ...ambient?.variables, ...ambient?.darkVariables } : { ...ambient?.variables };\n const value: Record<string, unknown> = { theme: dark ? 'dark' : 'light', variables };\n if (ambient?.darkVariables) value.darkVariables = ambient.darkVariables;\n if (ambient?.elements) value.elements = ambient.elements;\n if (ambient?.components) value.components = ambient.components;\n return value as AuthAppearance;\n }, [ambient, prefersDark]);\n}\n\n/**\n * The account page: auth's `AccountDashboard`, `SignIn` or `SignUp` under a `ThrottleProvider` keyed by\n * the storefront's publishable key (the `throttlePublishableKey` prop of `StorefrontProvider`, else the\n * Builder's connections). With no key it shows a set-up notice. The storefront's theme reaches the auth\n * components through `appearance`; auth keeps its own `throttle-` classes, so its styles stay its own.\n */\nexport function AccountPage(props: AccountPageProps) {\n const { view = 'dashboard', onSuccess } = props;\n const { throttlePublishableKey } = useStorefront();\n const { t } = useStrings();\n const appearance = useAuthAppearance();\n const root = usePart('account-page', props);\n const title = usePart('account-page-title', props);\n const notice = usePart('account-page-setup-notice', props);\n const noticeTitle = usePart('account-page-setup-title', props);\n const noticeBody = usePart('account-page-setup-body', props);\n\n if (!throttlePublishableKey) {\n return (\n <section {...notice} role=\"note\">\n <h1 {...noticeTitle}>{t('pages.account.setupTitle')}</h1>\n <p {...noticeBody}>{t('pages.account.setupBody')}</p>\n </section>\n );\n }\n return (\n <ThrottleProvider publishableKey={throttlePublishableKey} appearance={appearance}>\n <div {...root} data-view={view}>\n <h1 {...title}>{t(view === 'sign-in' ? 'pages.account.signIn' : view === 'sign-up' ? 'pages.account.signUp' : 'nav.account')}</h1>\n {view === 'sign-in' ? <SignIn onSuccess={onSuccess} /> : null}\n {view === 'sign-up' ? <SignUp onSuccess={onSuccess} /> : null}\n {view === 'dashboard' ? (\n <>\n <SignedIn>\n <AccountDashboard />\n </SignedIn>\n <SignedOut>\n <SignIn onSuccess={onSuccess} />\n </SignedOut>\n </>\n ) : null}\n </div>\n </ThrottleProvider>\n );\n}\n"]}
@@ -0,0 +1,23 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { U as UsePartLocal } from '../use-part-DgjPBL_O.cjs';
3
+ import '../index-RSj2Rg62.cjs';
4
+
5
+ /** The account page of `@usethrottle/auth`, drawn with the storefront's theme. */
6
+ type AccountPageProps = UsePartLocal & {
7
+ /**
8
+ * `dashboard` (default): the account for a signed-in shopper, sign-in for a signed-out one.
9
+ * `sign-in` and `sign-up`: that form.
10
+ */
11
+ view?: 'dashboard' | 'sign-in' | 'sign-up';
12
+ /** Called after a successful sign-in or sign-up. */
13
+ onSuccess?(): void;
14
+ };
15
+ /**
16
+ * The account page: auth's `AccountDashboard`, `SignIn` or `SignUp` under a `ThrottleProvider` keyed by
17
+ * the storefront's publishable key (the `throttlePublishableKey` prop of `StorefrontProvider`, else the
18
+ * Builder's connections). With no key it shows a set-up notice. The storefront's theme reaches the auth
19
+ * components through `appearance`; auth keeps its own `throttle-` classes, so its styles stay its own.
20
+ */
21
+ declare function AccountPage(props: AccountPageProps): react_jsx_runtime.JSX.Element;
22
+
23
+ export { AccountPage, type AccountPageProps };