@thorprovider/storefront 0.6.3 → 0.9.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 (161) hide show
  1. package/README.md +22 -2
  2. package/assets/templates/AGENTS.md +14 -2
  3. package/assets/templates/app/app/[[...slug]]/page.tsx +9 -2
  4. package/assets/templates/app/lib/__STOREFRONT__/account-address.ts +129 -0
  5. package/assets/templates/app/lib/__STOREFRONT__/account-lifecycle.client.tsx +2 -2
  6. package/assets/templates/app/lib/__STOREFRONT__/account-private.core.ts +143 -0
  7. package/assets/templates/app/lib/__STOREFRONT__/account-profile.ts +220 -0
  8. package/assets/templates/app/lib/__STOREFRONT__/actions.ts +1234 -75
  9. package/assets/templates/app/lib/__STOREFRONT__/addresses-port.ts +107 -0
  10. package/assets/templates/app/lib/__STOREFRONT__/checkout-shipping.core.ts +37 -0
  11. package/assets/templates/app/lib/__STOREFRONT__/commerce.ts +460 -35
  12. package/assets/templates/app/lib/__STOREFRONT__/confirmation.core.ts +240 -0
  13. package/assets/templates/app/lib/__STOREFRONT__/customer-profile-port.ts +103 -0
  14. package/assets/templates/app/lib/__STOREFRONT__/order-detail-port.ts +26 -0
  15. package/assets/templates/app/lib/__STOREFRONT__/orders-port.ts +30 -0
  16. package/assets/templates/app/lib/__STOREFRONT__/ports.ts +18 -0
  17. package/assets/templates/app/lib/__STOREFRONT__/projection-ownership.client.tsx +4 -4
  18. package/assets/templates/app/lib/__STOREFRONT__/session.ts +24 -6
  19. package/assets/templates/app/lib/__STOREFRONT__/state.core.ts +28 -1
  20. package/assets/templates/app/lib/__STOREFRONT__/views/sections/address-book-advanced.client.tsx +29 -0
  21. package/assets/templates/app/lib/__STOREFRONT__/views/sections/checkout-commerce-v1.client.tsx +19 -0
  22. package/assets/templates/app/lib/__STOREFRONT__/views/sections/checkout-commerce-v1.tsx +16 -0
  23. package/assets/templates/app/lib/__STOREFRONT__/views/sections/customer-profile.client.tsx +27 -0
  24. package/assets/templates/app/lib/__STOREFRONT__/views/sections/index.ts +5 -1
  25. package/assets/templates/app/lib/__STOREFRONT__/views/sections/marketplace-product-card.client.tsx +19 -0
  26. package/assets/templates/app/lib/__STOREFRONT__/views/sections/marketplace-product-card.tsx +16 -0
  27. package/assets/templates/app/lib/__STOREFRONT__/views/sections/mega-menu-universal.client.tsx +19 -0
  28. package/assets/templates/app/lib/__STOREFRONT__/views/sections/mega-menu-universal.tsx +16 -0
  29. package/assets/templates/app/lib/__STOREFRONT__/views/sections/schema.address-book-advanced.ts +437 -0
  30. package/assets/templates/app/lib/__STOREFRONT__/views/sections/schema.checkout-commerce-v1.ts +398 -0
  31. package/assets/templates/app/lib/__STOREFRONT__/views/sections/schema.customer-profile.ts +138 -0
  32. package/assets/templates/app/lib/__STOREFRONT__/views/sections/schema.marketplace-product-card.ts +67 -0
  33. package/assets/templates/app/lib/__STOREFRONT__/views/sections/schema.mega-menu-universal.ts +76 -0
  34. package/assets/templates/app/lib/__STOREFRONT__/views/sections/schema.universal-banner.ts +217 -0
  35. package/assets/templates/app/lib/__STOREFRONT__/views/sections/universal-banner.client.tsx +24 -0
  36. package/assets/templates/app/lib/__STOREFRONT__/views/sections/universal-banner.tsx +16 -0
  37. package/assets/templates/features/checkout/handlers.ts +348 -33
  38. package/assets/templates/features/checkout/state.ts +79 -3
  39. package/assets/templates/features/customer-addresses/handlers.ts +11 -0
  40. package/assets/templates/features/customer-addresses/state.ts +33 -0
  41. package/assets/templates/features/customer-auth/state.ts +10 -0
  42. package/assets/templates/features/customer-profile/handlers.ts +11 -0
  43. package/assets/templates/features/customer-profile/state.ts +18 -0
  44. package/assets/templates/views/account/address-book-advanced.defaults.ts +534 -0
  45. package/assets/templates/views/account/assembly/assembly.json +41 -0
  46. package/assets/templates/views/account/assembly/index.skeleton.tsx +229 -0
  47. package/assets/templates/views/account/assembly/registry.skeleton.tsx +1116 -0
  48. package/assets/templates/views/account/assembly/slots/addresses/AddressBookAdvanced/binding.json +5 -0
  49. package/assets/templates/views/account/assembly/slots/addresses/AddressBookAdvanced/catalog.part +4 -0
  50. package/assets/templates/views/account/assembly/slots/addresses/AddressBookAdvanced/element.part +5 -0
  51. package/assets/templates/views/account/assembly/slots/addresses/AddressBookAdvanced/registry.part +1 -0
  52. package/assets/templates/views/account/assembly/slots/addresses/cards/catalog.part +5 -0
  53. package/assets/templates/views/account/assembly/slots/addresses/cards/element.part +10 -0
  54. package/assets/templates/views/account/assembly/slots/addresses/cards/registry.part +1 -0
  55. package/assets/templates/views/account/assembly/slots/boot/AccountBoot/catalog.part +5 -0
  56. package/assets/templates/views/account/assembly/slots/boot/AccountBoot/element.part +5 -0
  57. package/assets/templates/views/account/assembly/slots/boot/AccountBoot/registry.part +1 -0
  58. package/assets/templates/views/account/assembly/slots/login/card/catalog.part +4 -0
  59. package/assets/templates/views/account/assembly/slots/login/card/element.part +13 -0
  60. package/assets/templates/views/account/assembly/slots/login/card/registry.part +1 -0
  61. package/assets/templates/views/account/assembly/slots/orders/OrderHistory/catalog.part +5 -0
  62. package/assets/templates/views/account/assembly/slots/orders/OrderHistory/element.part +5 -0
  63. package/assets/templates/views/account/assembly/slots/orders/OrderHistory/registry.part +2 -0
  64. package/assets/templates/views/account/assembly/slots/orders/OrderHistoryAdvanced/binding.json +5 -0
  65. package/assets/templates/views/account/assembly/slots/orders/OrderHistoryAdvanced/catalog.part +5 -0
  66. package/assets/templates/views/account/assembly/slots/orders/OrderHistoryAdvanced/element.part +5 -0
  67. package/assets/templates/views/account/assembly/slots/orders/OrderHistoryAdvanced/registry.part +1 -0
  68. package/assets/templates/views/account/assembly/slots/profile/CustomerProfileAdvanced/binding.json +5 -0
  69. package/assets/templates/views/account/assembly/slots/profile/CustomerProfileAdvanced/catalog.part +4 -0
  70. package/assets/templates/views/account/assembly/slots/profile/CustomerProfileAdvanced/element.part +5 -0
  71. package/assets/templates/views/account/assembly/slots/profile/CustomerProfileAdvanced/registry.part +1 -0
  72. package/assets/templates/views/account/assembly/slots/profile/form/catalog.part +5 -0
  73. package/assets/templates/views/account/assembly/slots/profile/form/element.part +10 -0
  74. package/assets/templates/views/account/assembly/slots/profile/form/registry.part +1 -0
  75. package/assets/templates/views/account/assembly/slots/register/SignUpPage1/catalog.part +4 -0
  76. package/assets/templates/views/account/assembly/slots/register/SignUpPage1/element.part +13 -0
  77. package/assets/templates/views/account/assembly/slots/register/SignUpPage1/registry.part +1 -0
  78. package/assets/templates/views/account/assembly/slots/summary/stack/catalog.part +5 -0
  79. package/assets/templates/views/account/assembly/slots/summary/stack/element.part +5 -0
  80. package/assets/templates/views/account/assembly/slots/summary/stack/registry.part +1 -0
  81. package/assets/templates/views/account/assembly/slots/summary/tabs/catalog.part +5 -0
  82. package/assets/templates/views/account/assembly/slots/summary/tabs/element.part +5 -0
  83. package/assets/templates/views/account/assembly/slots/summary/tabs/registry.part +1 -0
  84. package/assets/templates/views/account/content.ts +326 -0
  85. package/assets/templates/views/account/customer-profile.defaults.ts +136 -0
  86. package/assets/templates/views/account/index.tsx +218 -35
  87. package/assets/templates/views/account/order-detail.client.tsx +35 -0
  88. package/assets/templates/views/account/order-detail.defaults.ts +457 -0
  89. package/assets/templates/views/account/orders-advanced.client.tsx +166 -0
  90. package/assets/templates/views/account/orders-advanced.defaults.ts +230 -0
  91. package/assets/templates/views/account/registry.tsx +944 -369
  92. package/assets/templates/views/account/schema.ts +50 -0
  93. package/assets/templates/views/account/sections-data.ts +2 -0
  94. package/assets/templates/views/cart/content.ts +1 -0
  95. package/assets/templates/views/category/assembly/index.skeleton.tsx +1 -0
  96. package/assets/templates/views/category/assembly/slots/filter/CategoryListing/element.part +1 -0
  97. package/assets/templates/views/category/content.ts +2 -0
  98. package/assets/templates/views/category/index.tsx +2 -0
  99. package/assets/templates/views/category/sections-data.ts +2 -0
  100. package/assets/templates/views/checkout/checkout-commerce-hosted.tsx +1089 -0
  101. package/assets/templates/views/checkout/content.ts +114 -2
  102. package/assets/templates/views/checkout/index.tsx +7 -1
  103. package/assets/templates/views/checkout/props.ts +70 -22
  104. package/assets/templates/views/checkout/registry.tsx +400 -71
  105. package/assets/templates/views/checkout/schema.ts +260 -9
  106. package/assets/templates/views/home/assembly/assembly.json +28 -0
  107. package/assets/templates/views/home/assembly/index.skeleton.tsx +1 -0
  108. package/assets/templates/views/home/content.ts +2 -0
  109. package/assets/templates/views/home/index.tsx +1 -0
  110. package/assets/templates/views/home/sections-data.ts +2 -0
  111. package/assets/templates/views/product/content.ts +1 -0
  112. package/assets/templates/views/static/content.ts +1 -0
  113. package/bin/storefront.js +343 -13
  114. package/package.json +2 -1
  115. package/recipes/adapter-surface.json +158 -0
  116. package/recipes/archetypes.json +38 -3
  117. package/recipes/catalog.json +138 -1
  118. package/recipes/feature.schema.json +9 -0
  119. package/recipes/features.json +72 -1
  120. package/recipes/manifest.schema.json +5 -0
  121. package/recipes/recipe.schema.json +14 -2
  122. package/recipes/recipes.json +35 -5
  123. package/recipes/section.schema.json +112 -0
  124. package/recipes/sections.json +289 -3
  125. package/recipes/validate.mjs +83 -1
  126. package/scripts/adapter-surface.mjs +41 -0
  127. package/scripts/agent-blocks.mjs +700 -0
  128. package/scripts/block-validator.mjs +45 -0
  129. package/scripts/candidate.mjs +5 -4
  130. package/scripts/composers.mjs +7 -2
  131. package/scripts/default-sections.mjs +78 -0
  132. package/scripts/file-classes.mjs +15 -0
  133. package/scripts/generate-adapter-surface.mjs +148 -0
  134. package/scripts/operations.mjs +100 -0
  135. package/scripts/reconcile.mjs +67 -39
  136. package/scripts/section-configure.mjs +316 -0
  137. package/scripts/sync-assets.mjs +1 -0
  138. package/scripts/view-assembly.mjs +101 -14
  139. package/skills/sf-feature/SKILL.md +19 -0
  140. package/skills/sf-view-gen/SKILL.md +79 -7
  141. package/skills/sf-view-gen/assets/recipes/archetypes.json +38 -3
  142. package/skills/sf-view-gen/assets/recipes/catalog.json +138 -1
  143. package/skills/sf-view-gen/assets/recipes/features.json +72 -1
  144. package/skills/sf-view-gen/assets/recipes/recipes.json +35 -5
  145. package/skills/sf-view-gen/assets/recipes/section.schema.json +112 -0
  146. package/skills/sf-view-gen/assets/recipes/sections.json +289 -3
  147. package/skills/sf-view-gen/assets/templates/views/sections/checkout-commerce-v1.client.tsx +19 -0
  148. package/skills/sf-view-gen/assets/templates/views/sections/checkout-commerce-v1.tsx +16 -0
  149. package/skills/sf-view-gen/assets/templates/views/sections/marketplace-product-card.client.tsx +19 -0
  150. package/skills/sf-view-gen/assets/templates/views/sections/marketplace-product-card.tsx +16 -0
  151. package/skills/sf-view-gen/assets/templates/views/sections/mega-menu-universal.client.tsx +19 -0
  152. package/skills/sf-view-gen/assets/templates/views/sections/mega-menu-universal.tsx +16 -0
  153. package/skills/sf-view-gen/assets/templates/views/sections/schema.checkout-commerce-v1.ts +398 -0
  154. package/skills/sf-view-gen/assets/templates/views/sections/schema.marketplace-product-card.ts +67 -0
  155. package/skills/sf-view-gen/assets/templates/views/sections/schema.mega-menu-universal.ts +76 -0
  156. package/skills/sf-view-gen/assets/templates/views/sections/schema.universal-banner.ts +217 -0
  157. package/skills/sf-view-gen/assets/templates/views/sections/universal-banner.client.tsx +24 -0
  158. package/skills/sf-view-gen/assets/templates/views/sections/universal-banner.tsx +16 -0
  159. package/skills/sf-view-gen/scripts/validate.mjs +83 -1
  160. package/skills/storefront-workflow/SKILL.md +5 -0
  161. package/skills/storefront-workflow/references/mobile-responsiveness.md +1 -1
@@ -105,23 +105,199 @@ export const paymentMethodSchema = z.object({
105
105
  .optional(),
106
106
  })
107
107
 
108
+ const checkoutReadStateSchema = z.enum(['idle', 'pending', 'error', 'unavailable'])
109
+ const checkoutAddressOptionSchema = z.object({ value: z.string(), label: z.string() })
110
+ const checkoutAddressLevelSchema = z.enum(['countries', 'provinces', 'cities'])
111
+ const checkoutLocationOptionsSchema = z.object({
112
+ countries: z.array(checkoutAddressOptionSchema),
113
+ provinces: z.array(checkoutAddressOptionSchema),
114
+ cities: z.array(checkoutAddressOptionSchema),
115
+ countriesState: checkoutReadStateSchema.optional(),
116
+ provincesState: checkoutReadStateSchema.optional(),
117
+ citiesState: checkoutReadStateSchema.optional(),
118
+ countriesError: z.string().optional(),
119
+ provincesError: z.string().optional(),
120
+ citiesError: z.string().optional(),
121
+ })
122
+ const checkoutAddressValuesSchema = z.object({
123
+ firstName: z.string(),
124
+ lastName: z.string(),
125
+ address1: z.string(),
126
+ address2: z.string().optional(),
127
+ company: z.string().optional(),
128
+ city: z.string(),
129
+ province: z.string().optional(),
130
+ postalCode: z.string().optional(),
131
+ countryCode: z.string(),
132
+ phone: z.string().optional(),
133
+ })
134
+ const checkoutContactValuesSchema = z.object({
135
+ email: z.string(),
136
+ firstName: z.string(),
137
+ lastName: z.string(),
138
+ phone: z.string(),
139
+ })
140
+ const checkoutCustomerIdentitySchema = z.object({
141
+ id: z.string(),
142
+ email: z.string(),
143
+ firstName: z.string().optional(),
144
+ lastName: z.string().optional(),
145
+ })
146
+ const checkoutSavedAddressSchema = z.object({
147
+ id: z.string(),
148
+ label: z.string().optional(),
149
+ address: checkoutAddressValuesSchema,
150
+ isDefaultShipping: z.boolean().optional(),
151
+ isDefaultBilling: z.boolean().optional(),
152
+ })
153
+ const checkoutSavedAddressStateSchema = z.object({
154
+ pendingId: z.string().optional(),
155
+ error: z
156
+ .object({
157
+ id: z.string().optional(),
158
+ message: z.string(),
159
+ })
160
+ .optional(),
161
+ lastSavedId: z.string().optional(),
162
+ lastAction: z.enum(['saved', 'deleted']).optional(),
163
+ })
164
+ const checkoutShippingOptionSchema = z.object({
165
+ id: z.string(),
166
+ name: z.string(),
167
+ price: moneySchema.optional(),
168
+ description: z.string().optional(),
169
+ estimatedDays: z.string().optional(),
170
+ pickup: z.boolean().optional(),
171
+ locationName: z.string().optional(),
172
+ disabled: z.boolean().optional(),
173
+ disabledReason: z.string().optional(),
174
+ })
175
+ const checkoutShippingGroupSchema = z.object({
176
+ id: z.string(),
177
+ label: z.string().optional(),
178
+ // Mirrors `CheckoutShippingGroupItem`: backend line membership, present only
179
+ // when the host mapped every backend variant to one cart line.
180
+ items: z
181
+ .array(z.object({ lineId: z.string(), quantity: z.number().optional() }))
182
+ .optional(),
183
+ itemCount: z.number().optional(),
184
+ options: z.array(checkoutShippingOptionSchema),
185
+ selectedOptionId: z.string().optional(),
186
+ unavailableReason: z.string().optional(),
187
+ })
188
+ const checkoutAdjustmentPaymentSchema = z.object({
189
+ id: z.string(),
190
+ kind: z.enum(['gift-card', 'store-credit']),
191
+ label: z.string(),
192
+ amount: moneySchema,
193
+ })
194
+ const checkoutInterruptionSchema = z.object({
195
+ kind: z.enum([
196
+ 'totals-changed',
197
+ 'price-changed',
198
+ 'stock-reduced',
199
+ 'item-unavailable',
200
+ 'session-expired',
201
+ 'payment-failed',
202
+ ]),
203
+ severity: z.enum(['info', 'blocking']),
204
+ title: z.string(),
205
+ message: z.string(),
206
+ changes: z
207
+ .array(
208
+ z.object({
209
+ lineId: z.string().optional(),
210
+ label: z.string(),
211
+ previous: z.string().optional(),
212
+ next: z.string().optional(),
213
+ }),
214
+ )
215
+ .optional(),
216
+ actions: z.array(z.enum(['acknowledge', 'refresh', 'return-to-cart', 'retry'])),
217
+ })
218
+ const checkoutAvailabilitySchema = z.object({
219
+ status: z.enum(['available', 'empty', 'unavailable', 'error']),
220
+ reason: z.string().optional(),
221
+ actionLabel: z.string().optional(),
222
+ })
223
+
108
224
  export const checkoutPropsSchema = z.object({
109
225
  title: z.string().optional(),
110
226
  description: z.string().optional(),
111
- presentation: z.enum(['single-page', 'stepper']).optional(),
227
+ presentation: z.enum(['single-page', 'accordion', 'stepper']).optional(),
112
228
  showReviewStep: z.boolean().optional(),
229
+ requireContactPhone: z.boolean().optional(),
230
+ requireShippingPhone: z.boolean().optional(),
113
231
  labels: z.record(z.string(), z.string()).optional(),
114
- orderSummary: orderSummarySchema.optional(),
115
- countries: z.array(countryOptionSchema).optional(),
116
- shippingOptions: z.array(shippingOptionSchema).optional(),
117
- // Nullable: the state initializes to `null` and the block prop is optional.
118
- selectedShippingOptionId: z.string().nullable().optional(),
232
+ contact: checkoutContactValuesSchema,
233
+ shippingAddress: checkoutAddressValuesSchema,
234
+ billingAddress: checkoutAddressValuesSchema.optional(),
235
+ sameAsShipping: z.boolean(),
236
+ paymentMethod: z.string(),
237
+ customer: checkoutCustomerIdentitySchema.nullish(),
238
+ savedAddresses: z.array(checkoutSavedAddressSchema).optional(),
239
+ savedAddressState: checkoutSavedAddressStateSchema.optional(),
240
+ shippingLocations: checkoutLocationOptionsSchema.optional(),
241
+ billingLocations: checkoutLocationOptionsSchema.optional(),
242
+ shippingGroups: z.array(checkoutShippingGroupSchema).optional(),
243
+ shippingState: checkoutReadStateSchema.optional(),
244
+ paymentState: checkoutReadStateSchema.optional(),
119
245
  paymentMethods: z.array(paymentMethodSchema).optional(),
120
- values: checkoutFormDataSchema,
121
- fieldErrors: checkoutFieldErrorsSchema.optional(),
246
+ adjustmentPayments: z.array(checkoutAdjustmentPaymentSchema).optional(),
247
+ orderSummary: orderSummarySchema.optional(),
248
+ totalsState: z.enum(['idle', 'pending', 'error']).optional(),
249
+ promoCode: z.string().optional(),
250
+ fieldErrors: z.record(z.string(), z.unknown()).optional(),
122
251
  fieldDescriptions: z.record(z.string(), z.string()).optional(),
252
+ availability: checkoutAvailabilitySchema.optional(),
253
+ interruption: checkoutInterruptionSchema.optional(),
123
254
  })
124
255
 
256
+ /**
257
+ * Local step gate for the shipping address. The backend remains authoritative;
258
+ * this keeps a missing first street line from advancing or submitting before the
259
+ * server sync can reject it.
260
+ */
261
+ export function validateCheckoutShippingAddress(address: {
262
+ firstName: string
263
+ lastName: string
264
+ address1: string
265
+ city: string
266
+ countryCode: string
267
+ phone?: string
268
+ }, requirePhone = false): Record<string, Array<{ message: string }>> {
269
+ const errors: Record<string, Array<{ message: string }>> = {}
270
+ if (!address.firstName.trim()) {
271
+ errors.firstName = [{ message: 'El nombre es obligatorio.' }]
272
+ }
273
+ if (!address.lastName.trim()) {
274
+ errors.lastName = [{ message: 'Los apellidos son obligatorios.' }]
275
+ }
276
+ if (!address.address1.trim()) {
277
+ errors.address1 = [{ message: 'La línea 1 de dirección es obligatoria.' }]
278
+ }
279
+ if (!address.city.trim()) {
280
+ errors.city = [{ message: 'La ciudad es obligatoria.' }]
281
+ }
282
+ if (!address.countryCode.trim()) {
283
+ errors.countryCode = [{ message: 'El país es obligatorio.' }]
284
+ }
285
+ if (requirePhone && !address.phone?.trim()) {
286
+ errors.phone = [{ message: 'El teléfono es obligatorio.' }]
287
+ }
288
+ return errors
289
+ }
290
+
291
+ export function validateCheckoutContactPhone(
292
+ contact: { phone: string },
293
+ requirePhone: boolean,
294
+ ): Record<string, Array<{ message: string }>> {
295
+ if (requirePhone && !contact.phone.trim()) {
296
+ return { phone: [{ message: 'El teléfono es obligatorio.' }] }
297
+ }
298
+ return {}
299
+ }
300
+
125
301
  // The empty-cart surface has no props; declared so the catalog is complete.
126
302
  export const checkoutEmptyPropsSchema = z.object({})
127
303
 
@@ -173,10 +349,83 @@ export const fulfilmentStageDetailSchema = z.object({
173
349
  at: z.string().nullable(),
174
350
  })
175
351
 
176
- // The atomic receipt: the order and its backend lines arrive together.
352
+ // The designer confirmation view model. It is built from the host-confirmed
353
+ // order, never from browser-only checkout state, so a reload/reconcile renders
354
+ // the same screen. Optional sections are omitted by the view when absent.
355
+ export const confirmationAddressSchema = z.object({
356
+ id: z.string(),
357
+ isDefault: z.boolean(),
358
+ label: z.string(),
359
+ recipient: z.string(),
360
+ line1: z.string(),
361
+ line2: z.string().optional(),
362
+ company: z.string().optional(),
363
+ city: z.string(),
364
+ province: z.string().optional(),
365
+ countryCode: z.string().optional(),
366
+ postalCode: z.string().optional(),
367
+ phone: z.string().optional(),
368
+ })
369
+
370
+ export const confirmationLineSchema = z.object({
371
+ lineId: z.string(),
372
+ title: z.string(),
373
+ variant: z.string().optional(),
374
+ image: z.string().optional(),
375
+ unitCents: z.number().optional(),
376
+ quantity: z.number(),
377
+ netTotalCents: z.number().optional(),
378
+ })
379
+
380
+ export const confirmationGroupSchema = z.object({
381
+ id: z.string(),
382
+ title: z.string(),
383
+ modeLabel: z.string(),
384
+ methodLabel: z.string(),
385
+ detailLabel: z.string(),
386
+ feeCents: z.number(),
387
+ lines: z.array(confirmationLineSchema),
388
+ })
389
+
390
+ export const confirmationPromotionSchema = z.object({
391
+ id: z.string(),
392
+ label: z.string(),
393
+ kind: z.string(),
394
+ amountCents: z.number(),
395
+ code: z.string().optional(),
396
+ })
397
+
398
+ export const storefrontConfirmationSchema = z.object({
399
+ reference: z.string(),
400
+ totalCents: z.number(),
401
+ subtotalCents: z.number(),
402
+ unitCount: z.number().optional(),
403
+ promotions: z.array(confirmationPromotionSchema).optional(),
404
+ taxCents: z.number().optional(),
405
+ taxRateBps: z.number().optional(),
406
+ shippingCents: z.number().optional(),
407
+ pickupCents: z.number().optional(),
408
+ extraCents: z.number().optional(),
409
+ extraLabel: z.string().optional(),
410
+ groups: z.array(confirmationGroupSchema),
411
+ address: confirmationAddressSchema.nullable(),
412
+ paymentLabel: z.string(),
413
+ paymentDetail: z.string(),
414
+ billingLabel: z.string(),
415
+ billingDetail: z.string(),
416
+ customerName: z.string(),
417
+ customerEmail: z.string(),
418
+ locale: z.string(),
419
+ currencyCode: z.string(),
420
+ })
421
+
422
+ // The atomic receipt: the order, its backend lines and the host-confirmed
423
+ // confirmation model arrive together. `confirmation` is optional only for
424
+ // receipts created before this contract; those use the canonical fallback.
177
425
  export const receiptSchema = z.object({
178
426
  order: storefrontOrderSchema,
179
427
  lines: z.array(orderLineSchema),
428
+ confirmation: storefrontConfirmationSchema.optional(),
180
429
  })
181
430
 
182
431
  // Mirrors the CheckoutConfirmation props, including every neutral label the
@@ -184,6 +433,7 @@ export const receiptSchema = z.object({
184
433
  // the registry forwards them to the block instead of relying on its defaults.
185
434
  export const checkoutConfirmationPropsSchema = z.object({
186
435
  receipt: receiptSchema,
436
+ labels: z.record(z.string(), z.string()).optional(),
187
437
  fulfilmentDetails: z.record(z.string(), fulfilmentStageDetailSchema).optional(),
188
438
  titleLabel: z.string().optional(),
189
439
  orderPlacedLabel: z.string().optional(),
@@ -220,4 +470,5 @@ export type OrderSummary = z.infer<typeof orderSummarySchema>
220
470
  export type CheckoutProps = z.infer<typeof checkoutPropsSchema>
221
471
  export type StorefrontOrder = z.infer<typeof storefrontOrderSchema>
222
472
  export type OrderLine = z.infer<typeof orderLineSchema>
473
+ export type StorefrontConfirmation = z.infer<typeof storefrontConfirmationSchema>
223
474
  export type CheckoutConfirmationProps = z.infer<typeof checkoutConfirmationPropsSchema>