@shoppexio/storefront 1.0.58 → 1.0.60

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 (99) hide show
  1. package/CHANGELOG.md +103 -0
  2. package/LICENSE +21 -0
  3. package/README.md +96 -180
  4. package/dist/chunk-ZVOFFURI.js +15364 -0
  5. package/dist/chunk-ZVOFFURI.js.map +1 -0
  6. package/dist/customer.cjs +16013 -1
  7. package/dist/customer.cjs.map +1 -1
  8. package/dist/{headless-customer.d.ts → customer.d.cts} +71 -62
  9. package/dist/customer.d.ts +336 -10
  10. package/dist/customer.js +726 -2
  11. package/dist/customer.js.map +1 -1
  12. package/dist/index.cjs +21533 -0
  13. package/dist/index.cjs.map +1 -0
  14. package/dist/index.d.cts +1979 -0
  15. package/dist/index.d.ts +1857 -49
  16. package/dist/index.js +6139 -0
  17. package/dist/index.js.map +1 -0
  18. package/package.json +18 -37
  19. package/dist/core/attribution.d.ts +0 -26
  20. package/dist/core/attribution.d.ts.map +0 -1
  21. package/dist/core/cache.d.ts +0 -26
  22. package/dist/core/cache.d.ts.map +0 -1
  23. package/dist/core/client.d.ts +0 -18
  24. package/dist/core/client.d.ts.map +0 -1
  25. package/dist/core/config.d.ts +0 -10
  26. package/dist/core/config.d.ts.map +0 -1
  27. package/dist/core/endpoint.d.ts +0 -2
  28. package/dist/core/endpoint.d.ts.map +0 -1
  29. package/dist/core/errors.d.ts +0 -34
  30. package/dist/core/errors.d.ts.map +0 -1
  31. package/dist/core/telemetry.d.ts +0 -20
  32. package/dist/core/telemetry.d.ts.map +0 -1
  33. package/dist/core/typed-client.d.ts +0 -15
  34. package/dist/core/typed-client.d.ts.map +0 -1
  35. package/dist/customer.d.ts.map +0 -1
  36. package/dist/headless-customer.d.ts.map +0 -1
  37. package/dist/index.d.ts.map +0 -1
  38. package/dist/modules/affiliates.d.ts +0 -32
  39. package/dist/modules/affiliates.d.ts.map +0 -1
  40. package/dist/modules/analytics.d.ts +0 -2
  41. package/dist/modules/analytics.d.ts.map +0 -1
  42. package/dist/modules/cart.d.ts +0 -62
  43. package/dist/modules/cart.d.ts.map +0 -1
  44. package/dist/modules/checkout.d.ts +0 -133
  45. package/dist/modules/checkout.d.ts.map +0 -1
  46. package/dist/modules/coupons.d.ts +0 -3
  47. package/dist/modules/coupons.d.ts.map +0 -1
  48. package/dist/modules/customer.d.ts +0 -148
  49. package/dist/modules/customer.d.ts.map +0 -1
  50. package/dist/modules/invoices.d.ts +0 -6
  51. package/dist/modules/invoices.d.ts.map +0 -1
  52. package/dist/modules/navigation.d.ts +0 -20
  53. package/dist/modules/navigation.d.ts.map +0 -1
  54. package/dist/modules/pages.d.ts +0 -10
  55. package/dist/modules/pages.d.ts.map +0 -1
  56. package/dist/modules/presence.d.ts +0 -12
  57. package/dist/modules/presence.d.ts.map +0 -1
  58. package/dist/modules/products.d.ts +0 -16
  59. package/dist/modules/products.d.ts.map +0 -1
  60. package/dist/modules/reviews.d.ts +0 -4
  61. package/dist/modules/reviews.d.ts.map +0 -1
  62. package/dist/modules/search.d.ts +0 -10
  63. package/dist/modules/search.d.ts.map +0 -1
  64. package/dist/modules/store.d.ts +0 -11
  65. package/dist/modules/store.d.ts.map +0 -1
  66. package/dist/modules/theme.d.ts +0 -27
  67. package/dist/modules/theme.d.ts.map +0 -1
  68. package/dist/shoppex.esm.js +0 -3
  69. package/dist/shoppex.esm.js.map +0 -1
  70. package/dist/shoppex.umd.js +0 -2
  71. package/dist/shoppex.umd.js.map +0 -1
  72. package/dist/types/api.d.ts +0 -766
  73. package/dist/types/api.d.ts.map +0 -1
  74. package/dist/types/cart.d.ts +0 -239
  75. package/dist/types/cart.d.ts.map +0 -1
  76. package/dist/types/config.d.ts +0 -18
  77. package/dist/types/config.d.ts.map +0 -1
  78. package/dist/types/index.d.ts +0 -7
  79. package/dist/types/index.d.ts.map +0 -1
  80. package/dist/types/theme-config.d.ts +0 -109
  81. package/dist/types/theme-config.d.ts.map +0 -1
  82. package/dist/utils/cart-line-id.d.ts +0 -5
  83. package/dist/utils/cart-line-id.d.ts.map +0 -1
  84. package/dist/utils/format.d.ts +0 -6
  85. package/dist/utils/format.d.ts.map +0 -1
  86. package/dist/utils/requested-currency.d.ts +0 -3
  87. package/dist/utils/requested-currency.d.ts.map +0 -1
  88. package/dist/utils/storage.d.ts +0 -10
  89. package/dist/utils/storage.d.ts.map +0 -1
  90. package/dist/utils/storefront-catalog.d.ts +0 -5
  91. package/dist/utils/storefront-catalog.d.ts.map +0 -1
  92. package/dist/utils/storefront-contact.d.ts +0 -32
  93. package/dist/utils/storefront-contact.d.ts.map +0 -1
  94. package/dist/utils/storefront-custom-fields.d.ts +0 -13
  95. package/dist/utils/storefront-custom-fields.d.ts.map +0 -1
  96. package/dist/utils/storefront-search.d.ts +0 -22
  97. package/dist/utils/storefront-search.d.ts.map +0 -1
  98. package/dist/utils/storefront-stock.d.ts +0 -14
  99. package/dist/utils/storefront-stock.d.ts.map +0 -1
@@ -1,766 +0,0 @@
1
- import { NavigationMenuSlot } from '@shoppex/contracts/navigation';
2
- /**
3
- * API Response Types
4
- *
5
- * Backend returns: { status: number, data: T, error: string | null }
6
- * SDK maps to: { success: boolean, data?: T, message?: string }
7
- */
8
- export interface ApiResponse<T> {
9
- status: number;
10
- data: T;
11
- error: string | null;
12
- message?: string | null;
13
- /**
14
- * Machine-readable refusal identifier (e.g. `errors.checkout.coupon_no_longer_valid`).
15
- * Emitted by every localized backend error; the localized `error` sentence is
16
- * for humans, this is what code branches on.
17
- */
18
- error_code?: string | null;
19
- error_params?: Record<string, unknown> | null;
20
- }
21
- export interface ApiChallenge {
22
- provider: 'turnstile';
23
- siteKey: string;
24
- }
25
- export interface SDKResponse<T> {
26
- success: boolean;
27
- data?: T;
28
- message?: string;
29
- /**
30
- * The backend's `error_code`, preserved verbatim on every failure the server
31
- * answered — including non-2xx HTTP responses. `message` is localized display
32
- * copy and must never be pattern-matched; branch on `code` instead.
33
- * Absent when the failure never reached the server (transport, timeout) or
34
- * when the endpoint emits no machine-readable code.
35
- */
36
- code?: string;
37
- errorParams?: Record<string, unknown>;
38
- /**
39
- * HTTP status of the server's answer, when there was one.
40
- *
41
- * Needed to tell "not signed in" (401) apart from "the server broke" (5xx) or
42
- * a transport failure, which are otherwise indistinguishable. Without it a
43
- * client has to treat every failure as no-session and show a sign-in form to
44
- * someone who is signed in — a silent downgrade of the very state it is
45
- * trying to report.
46
- *
47
- * Absent when the request never reached the server.
48
- */
49
- status?: number;
50
- /**
51
- * Whether the request received an HTTP response from the server.
52
- *
53
- * `false` identifies an ambiguous transport failure: the browser cannot
54
- * know whether a mutation committed before the connection was lost. Public
55
- * mutation helpers use this signal to retain their idempotency key for the
56
- * buyer's retry. Absent on successful responses and older SDK results.
57
- */
58
- responseReceived?: boolean;
59
- /**
60
- * True only when a parsed server refusal proves that the mutation did not
61
- * commit (currently a JSON 4xx other than timeout). Mutation helpers may
62
- * rotate an idempotency key on this signal. A response whose body is
63
- * truncated, malformed, or a 5xx remains ambiguous even though headers were
64
- * received.
65
- */
66
- responseDefinitive?: boolean;
67
- /** A renewable human-verification challenge returned with a refusal. */
68
- challenge?: ApiChallenge;
69
- }
70
- export interface Shop {
71
- id: string;
72
- name: string;
73
- slug: string;
74
- domain?: string;
75
- description?: string;
76
- title?: string;
77
- message?: string;
78
- url?: string;
79
- logo?: string;
80
- banner?: string;
81
- avatar?: string;
82
- average_score?: number | null;
83
- rating?: number | null;
84
- products_sold_count?: number;
85
- customers_count?: number;
86
- hide_products_sold?: boolean;
87
- currency: string;
88
- tos_enabled?: boolean;
89
- dark_mode?: boolean;
90
- search_enabled?: boolean;
91
- sort_enabled?: boolean;
92
- cart_enabled?: boolean;
93
- contact_form_enabled?: boolean;
94
- require_invoice_for_contact?: boolean;
95
- hide_out_of_stock?: boolean;
96
- hide_stock_counter?: boolean;
97
- center_product_titles?: boolean;
98
- center_group_titles?: boolean;
99
- default_sort?: string;
100
- social?: Record<string, string | null>;
101
- discord_link?: string | null;
102
- twitter_link?: string | null;
103
- instagram_link?: string | null;
104
- facebook_link?: string | null;
105
- telegram_link?: string | null;
106
- youtube_link?: string | null;
107
- reddit_link?: string | null;
108
- tiktok_link?: string | null;
109
- verified?: boolean;
110
- on_hold?: boolean;
111
- theme?: ShopTheme | null;
112
- builder_settings?: Record<string, unknown> | null;
113
- feedback?: ShopFeedback;
114
- trusted_checks?: TrustedChecks | null;
115
- available_gateways?: string[];
116
- payment_gateways_fees?: unknown[];
117
- reward_program_summary?: RewardProgramSummary | null;
118
- }
119
- export interface RewardProgramTeaserItem {
120
- trigger_type: RewardReason;
121
- action_type: RewardActionType;
122
- label: string;
123
- }
124
- export interface RewardProgramSummary {
125
- enabled: boolean;
126
- headline: string;
127
- items: RewardProgramTeaserItem[];
128
- }
129
- export interface ShopTheme {
130
- primary_color?: string;
131
- secondary_color?: string;
132
- font?: string;
133
- logo?: string | null;
134
- logo_cloudflare_image_id?: string | null;
135
- background_image?: string | null;
136
- background_image_cloudflare_image_id?: string | null;
137
- cards_in_row?: number | string;
138
- cards_align?: string;
139
- card_animation?: string;
140
- dark_color?: string;
141
- light_color?: string;
142
- border_color?: string;
143
- button_color?: string;
144
- }
145
- export interface ShopFeedback {
146
- positive: number;
147
- neutral: number;
148
- negative: number;
149
- total: number;
150
- }
151
- export interface TrustedChecks {
152
- identity_verified?: boolean;
153
- feedback_score?: string | null;
154
- trusted_score?: number;
155
- sales_last14days_metric?: string;
156
- }
157
- export interface ProductCategory {
158
- uniqid: string;
159
- title: string;
160
- description?: string | null;
161
- image_attachment?: string | null;
162
- image_name?: string | null;
163
- image_storage?: string | null;
164
- cloudflare_image_id?: string | null;
165
- cdn_image_url?: string | null;
166
- }
167
- export interface ProductDescriptionTab {
168
- title: string;
169
- content: string;
170
- }
171
- export interface Product {
172
- id?: string;
173
- uniqid: string;
174
- title: string;
175
- slug?: string | null;
176
- description?: string | null;
177
- /** Merchant-defined description tabs; present when the shop configured them. */
178
- description_tabs?: ProductDescriptionTab[];
179
- product_highlights?: string[];
180
- /**
181
- * Merchant-defined public key/value pairs, set in the dashboard and readable
182
- * here without a theme rebuild. Always present on storefront catalog reads —
183
- * `{}` when the merchant set nothing — and values are always strings.
184
- *
185
- * Optional on this type because the older bound/legacy product payloads do not
186
- * carry it; read it as `product.metadata?.status` on those paths.
187
- */
188
- metadata?: Record<string, string>;
189
- price: string;
190
- price_display?: string;
191
- price_discount?: number;
192
- currency: string;
193
- /**
194
- * RAW local stock only. `-1` (or any negative value) means unlimited, `0` means
195
- * no local units. This is NEVER on its own a purchasable cap: a supplier-backed
196
- * product reports `stock: 0` by design and is still buyable. Gate buying on
197
- * {@link Product.orderable}, and use `resolveDisplayStock` / `isProductInStock`
198
- * rather than reading this field directly.
199
- */
200
- stock?: number;
201
- /**
202
- * Per-product override for the shop's stock-counter setting; `null` inherits.
203
- * Consumers must resolve it against the shop default rather than reading it
204
- * alone.
205
- *
206
- * Both spellings are declared because both are really sent: the storefront
207
- * catalog (`getStorefront`) emits camelCase alongside its other product
208
- * fields, while `getProducts`, `getProduct` and `getStorefrontProductsPage`
209
- * go through transformStorefrontCatalogProduct, which emits snake_case, and
210
- * nothing normalizes between them. Declaring only one would have left readers
211
- * of the other silently seeing `undefined` and falling back to the shop
212
- * setting — showing a count the merchant hid, or hiding one they wanted shown.
213
- */
214
- hideStockCounter?: boolean | null;
215
- hide_stock_counter?: boolean | null;
216
- /**
217
- * Authoritative buyability predicate, mirrored from the backend's order-time
218
- * gate: `local stock covers one unit OR an eligible supplier source can fulfil
219
- * the line`. This — not `stock` — is what a storefront must gate the buy button,
220
- * the quantity cap and the sold-out badge on.
221
- *
222
- * Absent on payloads that predate Dynamic Delivery. When absent, treat
223
- * availability exactly as `stock` alone dictates; a missing field must never
224
- * turn a genuinely sold-out product into a buyable one.
225
- */
226
- orderable?: boolean;
227
- /**
228
- * True when an enabled supplier source fulfils this product instead of local
229
- * stock. `orderable` remains the buy/sold-out gate; this field decides the
230
- * QUANTITY CAP: the supplier purchase — not the local counter — fulfils the line
231
- * and the completion excludes it from the local decrement, so residual local
232
- * units bound nothing and the cap is unlimited even at `stock: 1`. Absent on
233
- * payloads that predate Dynamic Delivery; when absent, the cap stays exactly
234
- * what `stock` alone dictates.
235
- */
236
- supplier_backed?: boolean;
237
- quantity_min?: number;
238
- quantity_max?: number;
239
- min_quantity?: number;
240
- max_quantity?: number;
241
- on_hold?: boolean | number;
242
- unlisted?: boolean | number;
243
- private?: boolean | number;
244
- bestseller?: boolean | number;
245
- type?: string;
246
- subtype?: string | null;
247
- isSubscription?: boolean;
248
- isGroup?: boolean;
249
- images: ProductImage[];
250
- image_name?: string | null;
251
- image_storage?: string | null;
252
- cloudflare_image_id?: string | null;
253
- image_attachment?: string | null;
254
- sold_count?: number;
255
- soldCount?: number;
256
- variants?: ProductVariant[];
257
- addons?: ProductAddon[];
258
- price_variants?: PriceVariant[];
259
- volume_discounts?: unknown;
260
- custom_fields?: string | unknown[] | null;
261
- categories?: ProductCategory[];
262
- bundles?: ProductBundle[];
263
- faqs?: ProductFaq[];
264
- subscription?: Subscription;
265
- feedbacks?: Feedback[];
266
- feedback?: ProductFeedback;
267
- cdn_image_url?: string;
268
- detail_image_url?: string | null;
269
- recurring_interval?: string | null;
270
- recurring_interval_count?: number | null;
271
- trial_period?: number | null;
272
- setup_cost?: string;
273
- licensing_enabled?: boolean | number;
274
- license_period?: string | number | null;
275
- delivery_text?: string;
276
- service_text?: string;
277
- terms_of_service?: string | null;
278
- warranty?: number;
279
- warranty_text?: string | null;
280
- sort_priority?: number;
281
- pay_what_you_want?: boolean | number;
282
- video_link?: string | null;
283
- }
284
- export interface ProductFeedback {
285
- total: number;
286
- positive: number;
287
- neutral: number;
288
- negative: number;
289
- numbers?: Record<number, number>;
290
- list?: Array<{
291
- score: number;
292
- message: string | null;
293
- reply: string | null;
294
- created_at: string | null;
295
- createdAt?: string | null;
296
- updated_at: string | null;
297
- updatedAt?: string | null;
298
- is_automated?: boolean;
299
- isAutomated?: boolean;
300
- }>;
301
- }
302
- export interface ProductImage {
303
- id: string;
304
- url: string;
305
- cloudflare_image_id?: string;
306
- alt?: string;
307
- }
308
- export interface ProductVariant {
309
- id: string;
310
- title: string;
311
- price?: number;
312
- /**
313
- * RAW local stock for this option only. `-1` (or any negative value) means
314
- * unlimited, `0` means no local units — which a supplier-backed option reports
315
- * by design. Never render this as a purchasable cap on its own; gate on
316
- * {@link ProductVariant.orderable}.
317
- */
318
- stock?: number;
319
- /**
320
- * Authoritative buyability predicate for this option: `local stock covers one
321
- * unit OR an eligible supplier source can fulfil the line`. The backend resolves
322
- * a product-wide supplier mapping onto every variant's own flag, so this alone
323
- * is authoritative for a selected variant.
324
- *
325
- * Absent on payloads that predate Dynamic Delivery; when absent, availability
326
- * follows `stock` alone, exactly as before.
327
- */
328
- orderable?: boolean;
329
- /**
330
- * True when an enabled supplier source fulfils this option instead of local
331
- * stock. `orderable` remains the buy/sold-out gate; this field decides the
332
- * QUANTITY CAP — a supplier-backed row is unbounded even when it still holds a
333
- * few local units, because the supplier purchase fulfils the line and the
334
- * completion excludes it from the local decrement. Absent on payloads that
335
- * predate Dynamic Delivery.
336
- */
337
- supplier_backed?: boolean;
338
- quantity_min?: number;
339
- quantity_max?: number;
340
- quantityMin?: number;
341
- quantityMax?: number;
342
- image_id?: string | null;
343
- imageId?: string | null;
344
- cloudflare_image_id?: string | null;
345
- cloudflareImageId?: string | null;
346
- image_url?: string | null;
347
- imageUrl?: string | null;
348
- /** Merchant-selected storefront highlight. It does not affect selection or availability. */
349
- is_featured?: boolean;
350
- isFeatured?: boolean;
351
- /** License validity in days for this option. Zero means lifetime. */
352
- license_period?: number | null;
353
- }
354
- export interface ProductAddon {
355
- id: string;
356
- name?: string;
357
- title?: string;
358
- price: number;
359
- required?: boolean;
360
- }
361
- export interface PriceVariant {
362
- id: string;
363
- label?: string;
364
- title?: string;
365
- price: number;
366
- /**
367
- * RAW local stock for this price variant only. `-1` (or any negative value)
368
- * means unlimited, `0` means no local units — which a supplier-backed variant
369
- * reports by design. Never render this as a purchasable cap on its own; gate on
370
- * {@link PriceVariant.orderable}.
371
- */
372
- stock?: number;
373
- /**
374
- * Authoritative buyability predicate for this price variant: `local stock covers
375
- * one unit OR an eligible supplier source can fulfil the line`. The backend
376
- * resolves a product-wide supplier mapping onto every variant's own flag, so
377
- * this alone is authoritative for a selected variant.
378
- *
379
- * Absent on payloads that predate Dynamic Delivery; when absent, availability
380
- * follows `stock` alone, exactly as before.
381
- */
382
- orderable?: boolean;
383
- /**
384
- * True when an enabled supplier source fulfils this price variant instead of
385
- * local stock. `orderable` remains the buy/sold-out gate; this field decides the
386
- * QUANTITY CAP — a supplier-backed row is unbounded even when it still holds a
387
- * few local units, because the supplier purchase fulfils the line and the
388
- * completion excludes it from the local decrement. Absent on payloads that
389
- * predate Dynamic Delivery.
390
- */
391
- supplier_backed?: boolean;
392
- quantity_min?: number;
393
- quantity_max?: number;
394
- quantityMin?: number;
395
- quantityMax?: number;
396
- image_id?: string | null;
397
- imageId?: string | null;
398
- cloudflare_image_id?: string | null;
399
- cloudflareImageId?: string | null;
400
- image_url?: string | null;
401
- imageUrl?: string | null;
402
- /** Merchant-selected storefront highlight. It does not affect selection or availability. */
403
- is_featured?: boolean;
404
- isFeatured?: boolean;
405
- /** License validity in days for this option. Zero means lifetime. */
406
- license_period?: number | null;
407
- }
408
- export interface CustomFieldDefinition {
409
- id: string;
410
- name: string;
411
- type: 'text' | 'textarea' | 'select' | 'checkbox';
412
- required?: boolean;
413
- options?: string[];
414
- }
415
- export interface Feedback {
416
- id: string;
417
- rating: number;
418
- score?: number;
419
- author?: string;
420
- customer_name?: string;
421
- comment?: string;
422
- message?: string | null;
423
- reply?: string | null;
424
- is_automated?: boolean;
425
- isAutomated?: boolean;
426
- product_id?: string | null;
427
- product_title?: string | null;
428
- cloudflare_image_id?: string | null;
429
- created_at: string;
430
- updated_at?: string | number | null;
431
- }
432
- export interface ShopReviewsSummary {
433
- total: number;
434
- positive: number;
435
- neutral: number;
436
- negative: number;
437
- average_score: number | null;
438
- }
439
- export interface ShopReviewsPage {
440
- feedback: Feedback[];
441
- pagination: CursorPagination;
442
- summary: ShopReviewsSummary;
443
- }
444
- export interface ProductBundle {
445
- id?: string;
446
- uniqid?: string;
447
- title?: string;
448
- discount_type?: 'PERCENTAGE' | 'FIXED';
449
- discount_amount?: number;
450
- products?: ProductBundleProduct[];
451
- }
452
- export interface ProductBundleProduct {
453
- id?: string;
454
- uniqid: string;
455
- title?: string | null;
456
- default_variant_id?: string;
457
- }
458
- export interface ProductFaq {
459
- id?: string;
460
- uniqid?: string;
461
- question: string;
462
- answer: string;
463
- }
464
- export interface SubscriptionInterval {
465
- unit?: string;
466
- count?: number;
467
- label?: string;
468
- }
469
- export interface SubscriptionFlags {
470
- cancel_anytime?: boolean;
471
- }
472
- export interface Subscription {
473
- id?: string;
474
- name?: string;
475
- description?: string;
476
- badge?: string;
477
- interval?: SubscriptionInterval;
478
- flags?: SubscriptionFlags;
479
- }
480
- export interface Invoice {
481
- uniqid: string;
482
- status: string;
483
- total: number;
484
- currency: string;
485
- gateway?: string;
486
- products: InvoiceProduct[];
487
- created_at: string;
488
- rewards?: BuyerRewards | null;
489
- }
490
- export interface InvoiceProduct {
491
- product_id: string;
492
- title: string;
493
- quantity: number;
494
- price: number;
495
- }
496
- export type RewardActionType = 'WALLET_CREDIT' | 'COUPON';
497
- export type RewardGrantStatus = 'PENDING' | 'FULFILLED' | 'FAILED' | 'REVOKED';
498
- export type RewardReason = 'ORDER_COMPLETED' | 'ORDER_COUNT_REACHED' | 'SPEND_AMOUNT_REACHED' | 'POSITIVE_REVIEW_LEFT' | 'FIRST_PURCHASE_COMPLETED';
499
- export interface BuyerRewardActivityItem {
500
- id: string;
501
- type: RewardActionType;
502
- status: RewardGrantStatus;
503
- amount: string | null;
504
- currency: string | null;
505
- coupon_code: string | null;
506
- reason: RewardReason;
507
- trigger_reference_type: string;
508
- trigger_reference_id: string;
509
- created_at: number;
510
- fulfilled_at: number | null;
511
- expires_at: number | null;
512
- }
513
- export interface BuyerRewards {
514
- summary: {
515
- available: string;
516
- pending: string;
517
- lifetime_earned: string;
518
- redeemed: string | null;
519
- currency: string;
520
- };
521
- activity: BuyerRewardActivityItem[];
522
- earned_after_invoice: BuyerRewardActivityItem[];
523
- pending_after_invoice: BuyerRewardActivityItem[];
524
- }
525
- export interface CouponValidation {
526
- valid: boolean;
527
- discount?: number;
528
- discount_type?: 'percentage' | 'fixed';
529
- first_order_only?: boolean;
530
- source?: 'COUPON' | 'AFFILIATE';
531
- product_restricted?: boolean;
532
- variant_restricted?: boolean;
533
- restriction_scope?: 'all' | 'products' | 'variants' | 'products_and_variants';
534
- allowed_product_ids?: string[];
535
- allowed_variant_ids?: string[];
536
- message?: string;
537
- }
538
- export interface CouponValidationOptions {
539
- productId?: string;
540
- variantId?: string;
541
- }
542
- export interface AffiliateValidation {
543
- valid: boolean;
544
- program_enabled?: boolean;
545
- affiliate_code: string | null;
546
- discount_active: boolean;
547
- discount_percent: number;
548
- message?: string;
549
- }
550
- export interface ProductGroup {
551
- id?: string;
552
- uniqid: string;
553
- category_id?: string | null;
554
- slug?: string | null;
555
- name?: string | null;
556
- title: string;
557
- description?: string | null;
558
- product_uniqids?: string[];
559
- products_count?: number;
560
- image_attachment?: string | null;
561
- image_name?: string | null;
562
- image_storage?: string | null;
563
- cloudflare_image_id?: string | null;
564
- cdn_image_url?: string | null;
565
- sort_priority?: number | null;
566
- }
567
- export interface Category {
568
- uniqid: string;
569
- title: string;
570
- description?: string | null;
571
- image_attachment?: string | null;
572
- image_name?: string | null;
573
- image_storage?: string | null;
574
- cloudflare_image_id?: string | null;
575
- cdn_image_url?: string | null;
576
- product_uniqids?: string[];
577
- products_bound?: Product[];
578
- products_count?: number;
579
- groups_bound?: ProductGroup[];
580
- groups_count?: number;
581
- }
582
- export interface CursorPagination {
583
- next_cursor: string | null;
584
- has_more: boolean;
585
- }
586
- export interface StorefrontAnnouncementBarAddon {
587
- id: string;
588
- type: 'announcement_bar';
589
- slot: string;
590
- component: 'announcement_bar';
591
- sort_order: number;
592
- props: {
593
- addon_id: string;
594
- text: string;
595
- link_label?: string | null;
596
- link_url?: string | null;
597
- dismissible: boolean;
598
- display_mode: 'static' | 'marquee';
599
- theme_preset: 'brand_blue' | 'emerald' | 'sunset' | 'rose' | 'charcoal' | 'custom';
600
- animation_speed_seconds: number;
601
- background_color: string;
602
- text_color: string;
603
- };
604
- }
605
- export interface StorefrontCountdownBarAddon {
606
- id: string;
607
- type: 'countdown_bar';
608
- slot: string;
609
- component: 'countdown_bar';
610
- sort_order: number;
611
- props: {
612
- addon_id: string;
613
- text: string;
614
- end_at: string;
615
- link_label?: string | null;
616
- link_url?: string | null;
617
- dismissible: boolean;
618
- theme_preset: 'brand_blue' | 'emerald' | 'sunset' | 'rose' | 'charcoal' | 'custom';
619
- expired_behavior: 'hide' | 'message';
620
- expired_message?: string | null;
621
- density: 'compact' | 'comfortable';
622
- cta_style: 'subtle' | 'outline' | 'solid';
623
- timer_style: 'minimal' | 'boxed';
624
- background_color: string;
625
- text_color: string;
626
- };
627
- }
628
- export interface StorefrontPromoInfoCardAddon {
629
- id: string;
630
- type: 'promo_info_card';
631
- slot: string;
632
- component: 'promo_info_card';
633
- sort_order: number;
634
- props: {
635
- addon_id: string;
636
- eyebrow?: string | null;
637
- title: string;
638
- body: string;
639
- link_label?: string | null;
640
- link_url?: string | null;
641
- theme_preset: 'indigo' | 'emerald' | 'amber' | 'rose' | 'slate' | 'custom';
642
- layout_style: 'compact' | 'feature' | 'alert';
643
- density: 'compact' | 'comfortable';
644
- cta_style: 'subtle' | 'outline' | 'solid';
645
- icon: 'sparkles' | 'megaphone' | 'gift' | 'truck' | 'shield' | 'support' | 'none';
646
- icon_visibility: 'show' | 'hide';
647
- background_color: string;
648
- text_color: string;
649
- accent_color: string;
650
- };
651
- }
652
- export interface StorefrontRecentPurchasePopupAddon {
653
- id: string;
654
- type: 'recent_purchase_popup';
655
- slot: string;
656
- component: 'recent_purchase_popup';
657
- sort_order: number;
658
- props: {
659
- addon_id: string;
660
- title: string;
661
- cooldown_seconds: number;
662
- items: Array<{
663
- customer_label: string;
664
- product_title: string;
665
- created_at: string;
666
- }>;
667
- };
668
- }
669
- export interface StorefrontCouponPopupModalAddon {
670
- id: string;
671
- type: 'coupon_popup_modal';
672
- slot: string;
673
- component: 'coupon_popup_modal';
674
- sort_order: number;
675
- props: {
676
- addon_id: string;
677
- eyebrow?: string | null;
678
- title: string;
679
- body: string;
680
- coupon_code: string;
681
- primary_button_label: string;
682
- secondary_button_label: string;
683
- disclaimer?: string | null;
684
- theme_preset: 'midnight' | 'ocean' | 'ember' | 'forest' | 'custom';
685
- trigger: 'delay' | 'exit_intent';
686
- delay_seconds: number;
687
- show_once_per_session: boolean;
688
- reminder_hours: number;
689
- background_color: string;
690
- text_color: string;
691
- accent_color: string;
692
- hero_image_url?: string | null;
693
- discount_display?: string | null;
694
- expires_at?: string | null;
695
- };
696
- }
697
- export type StorefrontAddon = StorefrontAnnouncementBarAddon | StorefrontCountdownBarAddon | StorefrontPromoInfoCardAddon | StorefrontRecentPurchasePopupAddon | StorefrontCouponPopupModalAddon;
698
- export interface StorefrontAddonBootstrap {
699
- items: StorefrontAddon[];
700
- }
701
- export interface StorefrontOnlineUsers {
702
- count: number;
703
- window_seconds: number;
704
- }
705
- export interface StorefrontRecentSaleEntry {
706
- product_title: string;
707
- seconds_ago: number;
708
- }
709
- export interface StorefrontRecentSales {
710
- items: StorefrontRecentSaleEntry[];
711
- window_hours: number;
712
- }
713
- export type StorefrontItem = {
714
- item_type: 'PRODUCT' | 'GROUP';
715
- uniqid: string;
716
- sort_priority?: number | null;
717
- title?: string | null;
718
- };
719
- export interface StorefrontData {
720
- shop: Shop;
721
- products: Product[];
722
- products_pagination?: CursorPagination | null;
723
- groups: ProductGroup[];
724
- items: StorefrontItem[];
725
- categories: Category[];
726
- addons: StorefrontAddonBootstrap;
727
- }
728
- export interface Page {
729
- id: string;
730
- shop_id?: string;
731
- slug: string;
732
- name: string;
733
- content: string | null;
734
- template_type: string;
735
- is_system: boolean;
736
- settings: Record<string, unknown> | null;
737
- visible_after: string | null;
738
- created_at: number;
739
- updated_at: number;
740
- }
741
- export interface Menu {
742
- id: string;
743
- shop_id: string;
744
- title: string;
745
- slot?: NavigationMenuSlot | null;
746
- item_count?: number | null;
747
- items?: MenuItem[];
748
- created_at: number;
749
- updated_at: number;
750
- }
751
- export interface MenuItem {
752
- id: string;
753
- shop_id?: string;
754
- menu_id: string;
755
- page_id: string | null;
756
- title: string;
757
- url?: string | null;
758
- link_type?: 'LINK' | 'PAGE' | 'link' | 'page' | null;
759
- target?: '_self' | '_blank' | null;
760
- sort_order: number;
761
- page_slug: string | null;
762
- created_at: number;
763
- updated_at: number;
764
- children?: MenuItem[];
765
- }
766
- //# sourceMappingURL=api.d.ts.map