@aglyn/plugins-commerce 1.15.2 → 1.17.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 (220) hide show
  1. package/README.md +1 -1
  2. package/package.json +13 -13
  3. package/src/lib/components/cart.js +2 -1
  4. package/src/lib/components/cart.js.map +1 -1
  5. package/src/lib/components/console/payments-settings-card.component.js +6 -1
  6. package/src/lib/components/console/payments-settings-card.component.js.map +1 -1
  7. package/src/lib/components/console/pos/pos-api.d.ts +5 -0
  8. package/src/lib/components/console/pos/pos-api.js.map +1 -1
  9. package/src/lib/components/console/pos/pos-tender-dialogs.component.d.ts +2 -0
  10. package/src/lib/components/console/pos/pos-tender-dialogs.component.js +13 -6
  11. package/src/lib/components/console/pos/pos-tender-dialogs.component.js.map +1 -1
  12. package/src/lib/components/console/pos/pos-tender-panel.component.js +7 -4
  13. package/src/lib/components/console/pos/pos-tender-panel.component.js.map +1 -1
  14. package/src/lib/components/console/pos-cellular-control.component.d.ts +5 -0
  15. package/src/lib/components/console/pos-cellular-control.component.js +29 -15
  16. package/src/lib/components/console/pos-cellular-control.component.js.map +1 -1
  17. package/src/lib/components/console/product-add-ons-fields.component.d.ts +13 -0
  18. package/src/lib/components/console/product-add-ons-fields.component.js +96 -3
  19. package/src/lib/components/console/product-add-ons-fields.component.js.map +1 -1
  20. package/src/lib/components/console/product-builder-fields.component.d.ts +39 -0
  21. package/src/lib/components/console/product-builder-fields.component.js +195 -0
  22. package/src/lib/components/console/product-builder-fields.component.js.map +1 -0
  23. package/src/lib/components/console/product-editor-dialog.component.js +35 -2
  24. package/src/lib/components/console/product-editor-dialog.component.js.map +1 -1
  25. package/src/lib/components/console/quote-editor-dialog.component.js +43 -6
  26. package/src/lib/components/console/quote-editor-dialog.component.js.map +1 -1
  27. package/src/lib/components/console/quote-messages.component.d.ts +21 -0
  28. package/src/lib/components/console/quote-messages.component.js +185 -0
  29. package/src/lib/components/console/quote-messages.component.js.map +1 -0
  30. package/src/lib/components/console/quote-pay-link.component.js +1 -1
  31. package/src/lib/components/console/quote-pay-link.component.js.map +1 -1
  32. package/src/lib/components/console/quote-proofs.component.js +30 -3
  33. package/src/lib/components/console/quote-proofs.component.js.map +1 -1
  34. package/src/lib/components/console/quote-settings-card.component.d.ts +7 -3
  35. package/src/lib/components/console/quote-settings-card.component.js +154 -24
  36. package/src/lib/components/console/quote-settings-card.component.js.map +1 -1
  37. package/src/lib/components/product-builder-context.d.ts +22 -0
  38. package/src/lib/components/product-builder-context.js +21 -0
  39. package/src/lib/components/product-builder-context.js.map +1 -0
  40. package/src/lib/components/product-builder-mockup.d.ts +42 -0
  41. package/src/lib/components/product-builder-mockup.js +120 -0
  42. package/src/lib/components/product-builder-mockup.js.map +1 -0
  43. package/src/lib/components/product-builder-sample.d.ts +63 -0
  44. package/src/lib/components/product-builder-sample.js +96 -0
  45. package/src/lib/components/product-builder-sample.js.map +1 -0
  46. package/src/lib/components/product-choice-cards.d.ts +51 -0
  47. package/src/lib/components/product-choice-cards.js +311 -0
  48. package/src/lib/components/product-choice-cards.js.map +1 -0
  49. package/src/lib/components/product-detail-panels.d.ts +42 -0
  50. package/src/lib/components/product-detail-panels.js +185 -0
  51. package/src/lib/components/product-detail-panels.js.map +1 -0
  52. package/src/lib/components/product-detail.d.ts +20 -12
  53. package/src/lib/components/product-detail.js +136 -221
  54. package/src/lib/components/product-detail.js.map +1 -1
  55. package/src/lib/components/product-grid.d.ts +7 -0
  56. package/src/lib/components/product-grid.js +13 -9
  57. package/src/lib/components/product-grid.js.map +1 -1
  58. package/src/lib/components/product-name-lines.d.ts +37 -0
  59. package/src/lib/components/product-name-lines.js +36 -0
  60. package/src/lib/components/product-name-lines.js.map +1 -0
  61. package/src/lib/components/product-options-field-body.d.ts +9 -8
  62. package/src/lib/components/product-options-field-body.js +152 -3
  63. package/src/lib/components/product-options-field-body.js.map +1 -1
  64. package/src/lib/components/product-options-field.js +1 -1
  65. package/src/lib/components/product-options-field.js.map +1 -1
  66. package/src/lib/components/product-photo-fit.d.ts +49 -0
  67. package/src/lib/components/product-photo-fit.js +58 -0
  68. package/src/lib/components/product-photo-fit.js.map +1 -0
  69. package/src/lib/components/product-restock-notify.d.ts +12 -0
  70. package/src/lib/components/product-restock-notify.js +86 -0
  71. package/src/lib/components/product-restock-notify.js.map +1 -0
  72. package/src/lib/components/quote-messages-panel.d.ts +21 -0
  73. package/src/lib/components/quote-messages-panel.js +191 -0
  74. package/src/lib/components/quote-messages-panel.js.map +1 -0
  75. package/src/lib/components/quote-page-body.js +15 -1
  76. package/src/lib/components/quote-page-body.js.map +1 -1
  77. package/src/lib/components/quote-proof-panel.d.ts +6 -3
  78. package/src/lib/components/quote-proof-panel.js +139 -14
  79. package/src/lib/components/quote-proof-panel.js.map +1 -1
  80. package/src/lib/components/related-products.d.ts +7 -0
  81. package/src/lib/components/related-products.js +10 -7
  82. package/src/lib/components/related-products.js.map +1 -1
  83. package/src/lib/constants/quote-page.d.ts +8 -0
  84. package/src/lib/constants/quote-page.js +11 -0
  85. package/src/lib/constants/quote-page.js.map +1 -1
  86. package/src/lib/model/commerce-cart.d.ts +6 -1
  87. package/src/lib/model/commerce-cart.js +5 -1
  88. package/src/lib/model/commerce-cart.js.map +1 -1
  89. package/src/lib/model/commerce-invoices.js +5 -1
  90. package/src/lib/model/commerce-invoices.js.map +1 -1
  91. package/src/lib/model/commerce-pos-ops.d.ts +3 -0
  92. package/src/lib/model/commerce-pos-ops.js +3 -0
  93. package/src/lib/model/commerce-pos-ops.js.map +1 -1
  94. package/src/lib/model/commerce-pos.d.ts +8 -0
  95. package/src/lib/model/commerce-pos.js.map +1 -1
  96. package/src/lib/model/commerce-quote-messages.d.ts +106 -0
  97. package/src/lib/model/commerce-quote-messages.js +146 -0
  98. package/src/lib/model/commerce-quote-messages.js.map +1 -0
  99. package/src/lib/model/commerce-quote-pay.d.ts +31 -2
  100. package/src/lib/model/commerce-quote-pay.js +31 -7
  101. package/src/lib/model/commerce-quote-pay.js.map +1 -1
  102. package/src/lib/model/commerce-quote-proofs.d.ts +47 -8
  103. package/src/lib/model/commerce-quote-proofs.js +73 -18
  104. package/src/lib/model/commerce-quote-proofs.js.map +1 -1
  105. package/src/lib/model/commerce-quote-request.d.ts +14 -4
  106. package/src/lib/model/commerce-quote-request.js +25 -2
  107. package/src/lib/model/commerce-quote-request.js.map +1 -1
  108. package/src/lib/model/commerce-quotes.d.ts +56 -3
  109. package/src/lib/model/commerce-quotes.js +47 -2
  110. package/src/lib/model/commerce-quotes.js.map +1 -1
  111. package/src/lib/model/commerce.d.ts +12 -1
  112. package/src/lib/model/commerce.js.map +1 -1
  113. package/src/lib/model/index.d.ts +1 -0
  114. package/src/lib/model/index.js +1 -0
  115. package/src/lib/model/index.js.map +1 -1
  116. package/src/lib/model/pos-cellular.d.ts +36 -4
  117. package/src/lib/model/pos-cellular.js +39 -4
  118. package/src/lib/model/pos-cellular.js.map +1 -1
  119. package/src/lib/model/product-card-rules.d.ts +41 -0
  120. package/src/lib/model/product-card-rules.js +90 -0
  121. package/src/lib/model/product-card-rules.js.map +1 -0
  122. package/src/lib/model/product-modifiers.d.ts +11 -0
  123. package/src/lib/model/product-modifiers.js +10 -0
  124. package/src/lib/model/product-modifiers.js.map +1 -1
  125. package/src/lib/model/product-write.d.ts +3 -0
  126. package/src/lib/server/billing-webhook.js +6 -2
  127. package/src/lib/server/billing-webhook.js.map +1 -1
  128. package/src/lib/server/cancel-order.js +15 -0
  129. package/src/lib/server/cancel-order.js.map +1 -1
  130. package/src/lib/server/channel-order-updates.js +15 -1
  131. package/src/lib/server/channel-order-updates.js.map +1 -1
  132. package/src/lib/server/channel-orders.js +20 -0
  133. package/src/lib/server/channel-orders.js.map +1 -1
  134. package/src/lib/server/checkout.js +1 -1
  135. package/src/lib/server/checkout.js.map +1 -1
  136. package/src/lib/server/local-fulfillment.js +1 -1
  137. package/src/lib/server/local-fulfillment.js.map +1 -1
  138. package/src/lib/server/pos-cellular-billing.d.ts +5 -4
  139. package/src/lib/server/pos-cellular-billing.js +24 -12
  140. package/src/lib/server/pos-cellular-billing.js.map +1 -1
  141. package/src/lib/server/pos-cellular.d.ts +3 -1
  142. package/src/lib/server/pos-cellular.js +55 -33
  143. package/src/lib/server/pos-cellular.js.map +1 -1
  144. package/src/lib/server/pos-offline-sync.d.ts +3 -3
  145. package/src/lib/server/pos-offline-sync.js +17 -4
  146. package/src/lib/server/pos-offline-sync.js.map +1 -1
  147. package/src/lib/server/pos-order.js +17 -6
  148. package/src/lib/server/pos-order.js.map +1 -1
  149. package/src/lib/server/pos-payment.js +27 -11
  150. package/src/lib/server/pos-payment.js.map +1 -1
  151. package/src/lib/server/pos-reader-splash.js +10 -5
  152. package/src/lib/server/pos-reader-splash.js.map +1 -1
  153. package/src/lib/server/pos-readers.js +42 -12
  154. package/src/lib/server/pos-readers.js.map +1 -1
  155. package/src/lib/server/pos-return.js +19 -3
  156. package/src/lib/server/pos-return.js.map +1 -1
  157. package/src/lib/server/pos-stripe.d.ts +14 -0
  158. package/src/lib/server/pos-stripe.js +6 -2
  159. package/src/lib/server/pos-stripe.js.map +1 -1
  160. package/src/lib/server/pos-terminal-connection-token.js +23 -9
  161. package/src/lib/server/pos-terminal-connection-token.js.map +1 -1
  162. package/src/lib/server/pos-terminal.d.ts +80 -14
  163. package/src/lib/server/pos-terminal.js +393 -123
  164. package/src/lib/server/pos-terminal.js.map +1 -1
  165. package/src/lib/server/product-drafts.d.ts +1 -1
  166. package/src/lib/server/product-drafts.js +4 -3
  167. package/src/lib/server/product-drafts.js.map +1 -1
  168. package/src/lib/server/product-writer.js +5 -4
  169. package/src/lib/server/product-writer.js.map +1 -1
  170. package/src/lib/server/product.d.ts +11 -0
  171. package/src/lib/server/product.js +18 -3
  172. package/src/lib/server/product.js.map +1 -1
  173. package/src/lib/server/products-write.js +4 -3
  174. package/src/lib/server/products-write.js.map +1 -1
  175. package/src/lib/server/quote-email.d.ts +26 -0
  176. package/src/lib/server/quote-email.js +73 -7
  177. package/src/lib/server/quote-email.js.map +1 -1
  178. package/src/lib/server/quote-messages.d.ts +72 -0
  179. package/src/lib/server/quote-messages.js +356 -0
  180. package/src/lib/server/quote-messages.js.map +1 -0
  181. package/src/lib/server/quote-pay.d.ts +42 -0
  182. package/src/lib/server/quote-pay.js +81 -4
  183. package/src/lib/server/quote-pay.js.map +1 -1
  184. package/src/lib/server/quote-proofs.d.ts +1 -1
  185. package/src/lib/server/quote-proofs.js +63 -19
  186. package/src/lib/server/quote-proofs.js.map +1 -1
  187. package/src/lib/server/quote.d.ts +12 -0
  188. package/src/lib/server/quote.js +69 -16
  189. package/src/lib/server/quote.js.map +1 -1
  190. package/src/lib/server/refund.js +3 -1
  191. package/src/lib/server/refund.js.map +1 -1
  192. package/src/lib/server/reserve-stock.js +9 -0
  193. package/src/lib/server/reserve-stock.js.map +1 -1
  194. package/src/lib/server/returns.js +15 -1
  195. package/src/lib/server/returns.js.map +1 -1
  196. package/src/lib/server/reviews.js +15 -0
  197. package/src/lib/server/reviews.js.map +1 -1
  198. package/src/lib/server/sold-out-drop.d.ts +58 -0
  199. package/src/lib/server/sold-out-drop.js +81 -0
  200. package/src/lib/server/sold-out-drop.js.map +1 -0
  201. package/src/lib/server/stock-levels.js +9 -0
  202. package/src/lib/server/stock-levels.js.map +1 -1
  203. package/src/lib/server/stripe-refund.d.ts +7 -0
  204. package/src/lib/server/stripe-refund.js +26 -7
  205. package/src/lib/server/stripe-refund.js.map +1 -1
  206. package/src/lib/server.d.ts +15 -0
  207. package/src/lib/server.js +30 -1
  208. package/src/lib/server.js.map +1 -1
  209. package/src/lib/tenant-emails.js +85 -2
  210. package/src/lib/tenant-emails.js.map +1 -1
  211. package/src/lib/testing/fake-seller-payment-account.d.ts +29 -0
  212. package/src/lib/testing/fake-seller-payment-account.js +40 -0
  213. package/src/lib/testing/fake-seller-payment-account.js.map +1 -0
  214. package/src/lib/transfer/product-transfer.js +6 -5
  215. package/src/lib/transfer/product-transfer.js.map +1 -1
  216. package/src/lib/transfer/products.server.js +4 -3
  217. package/src/lib/transfer/products.server.js.map +1 -1
  218. package/src/lib/utils/quote-email-content.d.ts +6 -0
  219. package/src/lib/utils/quote-email-content.js +6 -3
  220. package/src/lib/utils/quote-email-content.js.map +1 -1
@@ -0,0 +1,96 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Aglyn LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */ /**
17
+ * The canvas's sample for a Product detail block that shows picture cards
18
+ * (AGL-4205): an add-on group with a combo, and a free mockup offered, so the
19
+ * site builder sees every part the builder draws and can design the request
20
+ * form. Its own chunk: only the canvas loads it.
21
+ */ export const SAMPLE_BUILDER = {
22
+ id: 'sample',
23
+ name: 'Sample product',
24
+ slug: '#',
25
+ description: 'Drop this block on your product page template.',
26
+ mediaUrls: [],
27
+ options: [
28
+ {
29
+ name: 'Size',
30
+ values: [
31
+ 'Small',
32
+ 'Medium',
33
+ 'Large'
34
+ ]
35
+ }
36
+ ],
37
+ variants: [
38
+ {
39
+ id: 'a',
40
+ options: {
41
+ Size: 'Small'
42
+ },
43
+ priceUsd: 299,
44
+ soldOut: false,
45
+ note: 'Fits one table'
46
+ },
47
+ {
48
+ id: 'b',
49
+ options: {
50
+ Size: 'Medium'
51
+ },
52
+ priceUsd: 399,
53
+ soldOut: false,
54
+ note: 'Fits two tables'
55
+ },
56
+ {
57
+ id: 'c',
58
+ options: {
59
+ Size: 'Large'
60
+ },
61
+ priceUsd: 549,
62
+ soldOut: false,
63
+ note: 'Fits a booth'
64
+ }
65
+ ],
66
+ modifierGroups: [
67
+ {
68
+ id: 'g',
69
+ name: 'Add-ons',
70
+ min: 0,
71
+ max: 2,
72
+ online: true,
73
+ options: [
74
+ {
75
+ id: 'o1',
76
+ name: 'Side wall',
77
+ priceCents: 8900,
78
+ note: 'Blocks wind on one side'
79
+ },
80
+ {
81
+ id: 'o2',
82
+ name: 'Weekend kit',
83
+ priceCents: 19900,
84
+ includes: [
85
+ 'Side wall ×2',
86
+ 'Weights ×4',
87
+ 'Carry bag'
88
+ ]
89
+ }
90
+ ]
91
+ }
92
+ ],
93
+ mockupRequests: true
94
+ };
95
+
96
+ //# sourceMappingURL=product-builder-sample.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../libs/plugins/commerce/src/lib/components/product-builder-sample.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * The canvas's sample for a Product detail block that shows picture cards\n * (AGL-4205): an add-on group with a combo, and a free mockup offered, so the\n * site builder sees every part the builder draws and can design the request\n * form. Its own chunk: only the canvas loads it.\n */\nexport const SAMPLE_BUILDER = {\n id: 'sample',\n name: 'Sample product',\n slug: '#',\n description: 'Drop this block on your product page template.',\n mediaUrls: [] as string[],\n options: [{ name: 'Size', values: ['Small', 'Medium', 'Large'] }],\n variants: [\n { id: 'a', options: { Size: 'Small' }, priceUsd: 299, soldOut: false, note: 'Fits one table' },\n { id: 'b', options: { Size: 'Medium' }, priceUsd: 399, soldOut: false, note: 'Fits two tables' },\n { id: 'c', options: { Size: 'Large' }, priceUsd: 549, soldOut: false, note: 'Fits a booth' },\n ],\n modifierGroups: [\n {\n id: 'g',\n name: 'Add-ons',\n min: 0,\n max: 2,\n online: true,\n options: [\n { id: 'o1', name: 'Side wall', priceCents: 8900, note: 'Blocks wind on one side' },\n { id: 'o2', name: 'Weekend kit', priceCents: 19900, includes: ['Side wall ×2', 'Weights ×4', 'Carry bag'] },\n ],\n },\n ],\n mockupRequests: true as const,\n}\n"],"names":["SAMPLE_BUILDER","id","name","slug","description","mediaUrls","options","values","variants","Size","priceUsd","soldOut","note","modifierGroups","min","max","online","priceCents","includes","mockupRequests"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;;;CAKC,GACD,OAAO,MAAMA,iBAAiB;IAC5BC,IAAI;IACJC,MAAM;IACNC,MAAM;IACNC,aAAa;IACbC,WAAW,EAAE;IACbC,SAAS;QAAC;YAAEJ,MAAM;YAAQK,QAAQ;gBAAC;gBAAS;gBAAU;aAAQ;QAAC;KAAE;IACjEC,UAAU;QACR;YAAEP,IAAI;YAAKK,SAAS;gBAAEG,MAAM;YAAQ;YAAGC,UAAU;YAAKC,SAAS;YAAOC,MAAM;QAAiB;QAC7F;YAAEX,IAAI;YAAKK,SAAS;gBAAEG,MAAM;YAAS;YAAGC,UAAU;YAAKC,SAAS;YAAOC,MAAM;QAAkB;QAC/F;YAAEX,IAAI;YAAKK,SAAS;gBAAEG,MAAM;YAAQ;YAAGC,UAAU;YAAKC,SAAS;YAAOC,MAAM;QAAe;KAC5F;IACDC,gBAAgB;QACd;YACEZ,IAAI;YACJC,MAAM;YACNY,KAAK;YACLC,KAAK;YACLC,QAAQ;YACRV,SAAS;gBACP;oBAAEL,IAAI;oBAAMC,MAAM;oBAAae,YAAY;oBAAML,MAAM;gBAA0B;gBACjF;oBAAEX,IAAI;oBAAMC,MAAM;oBAAee,YAAY;oBAAOC,UAAU;wBAAC;wBAAgB;wBAAc;qBAAY;gBAAC;aAC3G;QACH;KACD;IACDC,gBAAgB;AAClB,EAAC"}
@@ -0,0 +1,51 @@
1
+ import { type ModifierSelection, type ProductModifierGroup } from '../model/product-modifiers';
2
+ /** A variant as the cards read it. */
3
+ export interface CardVariant {
4
+ id: string;
5
+ options?: Record<string, string>;
6
+ priceUsd: number | null;
7
+ soldOut?: boolean;
8
+ imageUrl?: string;
9
+ note?: string;
10
+ }
11
+ /**
12
+ * The variant a card for one option value stands for: the one the shopper's
13
+ * other picks make with this value, else the first that carries the value.
14
+ */
15
+ export declare function variantForOptionValue<V extends CardVariant>(variants: readonly V[], selections: Readonly<Record<string, string>>, optionName: string, value: string): V | undefined;
16
+ /**
17
+ * A group's answer after a card is pressed. One-choice groups act as radio
18
+ * buttons (an optional one can be cleared by pressing its pick again); a
19
+ * several-choice group adds or removes the choice, never past its maximum.
20
+ * The answer keeps the group's own order.
21
+ */
22
+ export declare function pressChoice(group: Pick<ProductModifierGroup, 'min' | 'max' | 'options'>, chosen: readonly string[], optionId: string): string[];
23
+ /** What a card says a choice adds: its price, or that it adds nothing. */
24
+ export declare function addOnPriceLabel(cents: number, formatCents: (cents: number) => string): string;
25
+ export interface ProductChoiceCardsProps {
26
+ /** The options the shopper chooses among (size, style), with their values. */
27
+ options: ReadonlyArray<{
28
+ name: string;
29
+ values: readonly string[];
30
+ }>;
31
+ variants: readonly CardVariant[];
32
+ selections: Readonly<Record<string, string>>;
33
+ onSelect: (optionName: string, value: string) => void;
34
+ /** The add-on groups the website offers; empty draws none. */
35
+ groups: readonly ProductModifierGroup[];
36
+ /** The variant picked: a choice priced by variant shows its price on it. */
37
+ variantId?: string;
38
+ value: readonly ModifierSelection[];
39
+ onChange: (next: ModifierSelection[]) => void;
40
+ /** The store's money, e.g. `$1,250.00`. */
41
+ formatCents: (cents: number) => string;
42
+ /** What a card says where a variant has no price yet. */
43
+ unpricedLabel: string;
44
+ disabled?: boolean;
45
+ }
46
+ /** The product's options and add-ons as picture cards (AGL-4205). */
47
+ export declare function ProductChoiceCards(props: ProductChoiceCardsProps): import("react").JSX.Element;
48
+ export declare namespace ProductChoiceCards {
49
+ var displayName: string;
50
+ }
51
+ export default ProductChoiceCards;
@@ -0,0 +1,311 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Aglyn LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */ 'use client';
17
+ import { _ as _extends } from "@swc/helpers/_/_extends";
18
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
19
+ import * as Aglyn from "@aglyn/aglyn";
20
+ import Box from "@mui/material/Box";
21
+ import Button from "@mui/material/Button";
22
+ import Card from "@mui/material/Card";
23
+ import CardActionArea from "@mui/material/CardActionArea";
24
+ import CardContent from "@mui/material/CardContent";
25
+ import CardMedia from "@mui/material/CardMedia";
26
+ import Chip from "@mui/material/Chip";
27
+ import Collapse from "@mui/material/Collapse";
28
+ import List from "@mui/material/List";
29
+ import ListItem from "@mui/material/ListItem";
30
+ import ListItemText from "@mui/material/ListItemText";
31
+ import Stack from "@mui/material/Stack";
32
+ import Typography from "@mui/material/Typography";
33
+ import { useId, useState } from "react";
34
+ import { modifierGroupRequired, modifierOptionIsCombo, modifierOptionPriceCents } from "../model/product-modifiers.js";
35
+ import { addOnGroupHint, withGroupAnswer } from "./product-add-ons.js";
36
+ /**
37
+ * The variant a card for one option value stands for: the one the shopper's
38
+ * other picks make with this value, else the first that carries the value.
39
+ */ export function variantForOptionValue(variants, selections, optionName, value) {
40
+ var _variants_find;
41
+ const wanted = _extends({}, selections, {
42
+ [optionName]: value
43
+ });
44
+ return (_variants_find = variants.find((variant)=>Object.entries(wanted).every(([name, picked])=>{
45
+ var _ref;
46
+ var _variant_options;
47
+ return ((_ref = (_variant_options = variant.options) == null ? void 0 : _variant_options[name]) != null ? _ref : picked) === picked;
48
+ }))) != null ? _variants_find : variants.find((variant)=>{
49
+ var _variant_options;
50
+ return ((_variant_options = variant.options) == null ? void 0 : _variant_options[optionName]) === value;
51
+ });
52
+ }
53
+ /**
54
+ * A group's answer after a card is pressed. One-choice groups act as radio
55
+ * buttons (an optional one can be cleared by pressing its pick again); a
56
+ * several-choice group adds or removes the choice, never past its maximum.
57
+ * The answer keeps the group's own order.
58
+ */ export function pressChoice(group, chosen, optionId) {
59
+ const picked = chosen.includes(optionId);
60
+ if (group.max === 1) {
61
+ if (picked) return group.min > 0 ? [
62
+ ...chosen
63
+ ] : [];
64
+ return [
65
+ optionId
66
+ ];
67
+ }
68
+ if (picked) return chosen.filter((id)=>id !== optionId);
69
+ if (chosen.length >= group.max) return [
70
+ ...chosen
71
+ ];
72
+ return group.options.map((option)=>option.id).filter((id)=>id === optionId || chosen.includes(id));
73
+ }
74
+ /** What a card says a choice adds: its price, or that it adds nothing. */ export function addOnPriceLabel(cents, formatCents) {
75
+ return cents > 0 ? `+${formatCents(cents)}` : 'No extra charge';
76
+ }
77
+ /** One card: picture, name, price and note, pressed to pick; a combo's contents fold out below. */ function ChoiceCard(props) {
78
+ const { name, price, note, imageUrl, selected, disabled, role, onPress, badge, includes } = props;
79
+ const { hostId } = Aglyn.useSite();
80
+ const [open, setOpen] = useState(false);
81
+ const contentsId = useId();
82
+ const src = imageUrl ? Aglyn.siteRelativeMediaSrc(imageUrl, {
83
+ hostId
84
+ }) : undefined;
85
+ return /*#__PURE__*/ _jsxs(Card, {
86
+ variant: "outlined",
87
+ sx: {
88
+ display: 'flex',
89
+ flexDirection: 'column',
90
+ borderWidth: 2,
91
+ borderColor: selected ? 'primary.main' : 'divider',
92
+ bgcolor: selected ? 'action.selected' : 'background.paper',
93
+ opacity: disabled && !selected ? 0.6 : 1
94
+ },
95
+ children: [
96
+ /*#__PURE__*/ _jsxs(CardActionArea, {
97
+ role: role,
98
+ "aria-checked": selected,
99
+ disabled: disabled,
100
+ onClick: onPress,
101
+ sx: {
102
+ flex: 1,
103
+ display: 'flex',
104
+ flexDirection: 'column',
105
+ alignItems: 'stretch'
106
+ },
107
+ children: [
108
+ src ? /*#__PURE__*/ _jsx(CardMedia, _extends({
109
+ component: "img",
110
+ image: src,
111
+ alt: "",
112
+ sx: {
113
+ aspectRatio: '4 / 3',
114
+ objectFit: 'cover'
115
+ }
116
+ }, Aglyn.DEFERRED_IMAGE_ATTRIBUTES)) : null,
117
+ /*#__PURE__*/ _jsxs(CardContent, {
118
+ sx: {
119
+ flex: 1,
120
+ p: 1.5,
121
+ '&:last-child': {
122
+ pb: 1.5
123
+ }
124
+ },
125
+ children: [
126
+ /*#__PURE__*/ _jsxs(Stack, {
127
+ direction: "row",
128
+ spacing: 1,
129
+ sx: {
130
+ alignItems: 'flex-start',
131
+ justifyContent: 'space-between'
132
+ },
133
+ children: [
134
+ /*#__PURE__*/ _jsx(Typography, {
135
+ variant: "subtitle2",
136
+ component: "span",
137
+ children: name
138
+ }),
139
+ badge
140
+ ]
141
+ }),
142
+ /*#__PURE__*/ _jsx(Typography, {
143
+ variant: "body2",
144
+ color: selected ? 'primary' : 'text.primary',
145
+ sx: {
146
+ fontWeight: 600
147
+ },
148
+ children: price
149
+ }),
150
+ note ? /*#__PURE__*/ _jsx(Typography, {
151
+ variant: "caption",
152
+ color: "text.secondary",
153
+ component: "p",
154
+ children: note
155
+ }) : null
156
+ ]
157
+ })
158
+ ]
159
+ }),
160
+ (includes == null ? void 0 : includes.length) ? /*#__PURE__*/ _jsxs(Box, {
161
+ sx: {
162
+ px: 1,
163
+ pb: 1
164
+ },
165
+ children: [
166
+ /*#__PURE__*/ _jsx(Button, {
167
+ size: "small",
168
+ "aria-expanded": open,
169
+ "aria-controls": contentsId,
170
+ onClick: ()=>setOpen((was)=>!was),
171
+ children: open ? 'Hide what’s included' : 'What’s included'
172
+ }),
173
+ /*#__PURE__*/ _jsx(Collapse, {
174
+ in: open,
175
+ id: contentsId,
176
+ children: /*#__PURE__*/ _jsx(List, {
177
+ dense: true,
178
+ disablePadding: true,
179
+ "aria-label": `${name} includes`,
180
+ children: includes.map((item)=>/*#__PURE__*/ _jsx(ListItem, {
181
+ disableGutters: true,
182
+ sx: {
183
+ py: 0
184
+ },
185
+ children: /*#__PURE__*/ _jsx(ListItemText, {
186
+ primary: item,
187
+ slotProps: {
188
+ primary: {
189
+ variant: 'body2'
190
+ }
191
+ }
192
+ })
193
+ }, item))
194
+ })
195
+ })
196
+ ]
197
+ }) : null
198
+ ]
199
+ });
200
+ }
201
+ /** A heading, its hint, and the grid of cards under it. */ function CardGroup(props) {
202
+ const { label, hint, required, role, children } = props;
203
+ const labelId = useId();
204
+ return /*#__PURE__*/ _jsxs(Box, {
205
+ component: "section",
206
+ "aria-labelledby": labelId,
207
+ children: [
208
+ /*#__PURE__*/ _jsxs(Stack, {
209
+ direction: "row",
210
+ spacing: 1,
211
+ sx: {
212
+ alignItems: 'center',
213
+ mb: 1
214
+ },
215
+ children: [
216
+ /*#__PURE__*/ _jsx(Typography, {
217
+ id: labelId,
218
+ variant: "subtitle1",
219
+ component: "h2",
220
+ children: label
221
+ }),
222
+ /*#__PURE__*/ _jsx(Chip, {
223
+ size: "small",
224
+ variant: "outlined",
225
+ color: required ? 'primary' : 'default',
226
+ label: hint
227
+ })
228
+ ]
229
+ }),
230
+ /*#__PURE__*/ _jsx(Box, {
231
+ role: role,
232
+ "aria-labelledby": labelId,
233
+ "aria-required": required || undefined,
234
+ sx: {
235
+ display: 'grid',
236
+ gridTemplateColumns: (theme)=>`repeat(auto-fill, minmax(${theme.spacing(19)}, 1fr))`,
237
+ gap: 1.5
238
+ },
239
+ children: children
240
+ })
241
+ ]
242
+ });
243
+ }
244
+ /** The product's options and add-ons as picture cards (AGL-4205). */ export function ProductChoiceCards(props) {
245
+ const { options, variants, selections, onSelect, groups, variantId, value, onChange, formatCents, unpricedLabel, disabled } = props;
246
+ const addOnCard = (group, option, chosen)=>{
247
+ const selected = chosen.includes(option.id);
248
+ const full = group.max > 1 && chosen.length >= group.max;
249
+ return /*#__PURE__*/ _jsx(ChoiceCard, {
250
+ name: option.name,
251
+ price: addOnPriceLabel(modifierOptionPriceCents(option, variantId), formatCents),
252
+ note: option.note,
253
+ imageUrl: option.imageUrl,
254
+ selected: selected,
255
+ disabled: disabled || !selected && full,
256
+ role: group.max === 1 ? 'radio' : 'checkbox',
257
+ badge: modifierOptionIsCombo(option) ? /*#__PURE__*/ _jsx(Chip, {
258
+ size: "small",
259
+ color: "secondary",
260
+ label: "Combo"
261
+ }) : null,
262
+ includes: modifierOptionIsCombo(option) ? option.includes : undefined,
263
+ onPress: ()=>onChange(withGroupAnswer(groups, value, group.id, pressChoice(group, chosen, option.id)))
264
+ }, option.id);
265
+ };
266
+ return /*#__PURE__*/ _jsxs(Stack, {
267
+ spacing: 3,
268
+ sx: {
269
+ mb: 2
270
+ },
271
+ children: [
272
+ options.map((option)=>/*#__PURE__*/ _jsx(CardGroup, {
273
+ label: option.name,
274
+ hint: "Choose one",
275
+ required: true,
276
+ role: "radiogroup",
277
+ children: option.values.map((choice)=>{
278
+ const variant = variantForOptionValue(variants, selections, option.name, choice);
279
+ return /*#__PURE__*/ _jsx(ChoiceCard, {
280
+ name: choice,
281
+ price: typeof (variant == null ? void 0 : variant.priceUsd) === 'number' ? formatCents(Math.round(variant.priceUsd * 100)) : unpricedLabel,
282
+ note: variant == null ? void 0 : variant.note,
283
+ imageUrl: variant == null ? void 0 : variant.imageUrl,
284
+ selected: selections[option.name] === choice,
285
+ role: "radio",
286
+ badge: (variant == null ? void 0 : variant.soldOut) ? /*#__PURE__*/ _jsx(Chip, {
287
+ size: "small",
288
+ variant: "outlined",
289
+ label: "Sold out"
290
+ }) : null,
291
+ onPress: ()=>onSelect(option.name, choice)
292
+ }, choice);
293
+ })
294
+ }, option.name)),
295
+ groups.map((group)=>{
296
+ const chosen = value.filter((pick)=>pick.groupId === group.id).map((pick)=>pick.optionId);
297
+ return /*#__PURE__*/ _jsx(CardGroup, {
298
+ label: group.name,
299
+ hint: addOnGroupHint(group),
300
+ required: modifierGroupRequired(group),
301
+ role: group.max === 1 ? 'radiogroup' : 'group',
302
+ children: group.options.map((option)=>addOnCard(group, option, chosen))
303
+ }, group.id);
304
+ })
305
+ ]
306
+ });
307
+ }
308
+ ProductChoiceCards.displayName = 'ProductChoiceCards';
309
+ export default ProductChoiceCards;
310
+
311
+ //# sourceMappingURL=product-choice-cards.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../libs/plugins/commerce/src/lib/components/product-choice-cards.tsx"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n'use client'\n\nimport * as Aglyn from '@aglyn/aglyn'\nimport Box from '@mui/material/Box'\nimport Button from '@mui/material/Button'\nimport Card from '@mui/material/Card'\nimport CardActionArea from '@mui/material/CardActionArea'\nimport CardContent from '@mui/material/CardContent'\nimport CardMedia from '@mui/material/CardMedia'\nimport Chip from '@mui/material/Chip'\nimport Collapse from '@mui/material/Collapse'\nimport List from '@mui/material/List'\nimport ListItem from '@mui/material/ListItem'\nimport ListItemText from '@mui/material/ListItemText'\nimport Stack from '@mui/material/Stack'\nimport Typography from '@mui/material/Typography'\nimport { useId, useState, type ReactNode } from 'react'\nimport {\n modifierGroupRequired,\n modifierOptionIsCombo,\n modifierOptionPriceCents,\n type ModifierSelection,\n type ProductModifierGroup,\n type ProductModifierOption,\n} from '../model/product-modifiers'\nimport { addOnGroupHint, withGroupAnswer } from './product-add-ons'\n\n/*\n * THE PRODUCT BUILDER'S PICTURE CARDS (AGL-4205).\n *\n * A Product detail block set to show its choices as picture cards draws each\n * of the product's options (size, style) and each of its add-on groups as a\n * row of cards: the choice's picture, its name, what it costs, and the\n * owner's short note. A combo's card folds out what it includes. A group\n * that takes one choice behaves as radio buttons, one that takes several as\n * check boxes up to its maximum, and a required group is marked and cannot\n * be emptied. Its own chunk: only a page that shows cards downloads it.\n */\n\n/** A variant as the cards read it. */\nexport interface CardVariant {\n id: string\n options?: Record<string, string>\n priceUsd: number | null\n soldOut?: boolean\n imageUrl?: string\n note?: string\n}\n\n/**\n * The variant a card for one option value stands for: the one the shopper's\n * other picks make with this value, else the first that carries the value.\n */\nexport function variantForOptionValue<V extends CardVariant>(\n variants: readonly V[],\n selections: Readonly<Record<string, string>>,\n optionName: string,\n value: string,\n): V | undefined {\n const wanted = { ...selections, [optionName]: value }\n return (\n variants.find((variant) =>\n Object.entries(wanted).every(([name, picked]) => (variant.options?.[name] ?? picked) === picked),\n ) ?? variants.find((variant) => variant.options?.[optionName] === value)\n )\n}\n\n/**\n * A group's answer after a card is pressed. One-choice groups act as radio\n * buttons (an optional one can be cleared by pressing its pick again); a\n * several-choice group adds or removes the choice, never past its maximum.\n * The answer keeps the group's own order.\n */\nexport function pressChoice(\n group: Pick<ProductModifierGroup, 'min' | 'max' | 'options'>,\n chosen: readonly string[],\n optionId: string,\n): string[] {\n const picked = chosen.includes(optionId)\n if (group.max === 1) {\n if (picked) return group.min > 0 ? [...chosen] : []\n return [optionId]\n }\n if (picked) return chosen.filter((id) => id !== optionId)\n if (chosen.length >= group.max) return [...chosen]\n return group.options.map((option) => option.id).filter((id) => id === optionId || chosen.includes(id))\n}\n\n/** What a card says a choice adds: its price, or that it adds nothing. */\nexport function addOnPriceLabel(cents: number, formatCents: (cents: number) => string): string {\n return cents > 0 ? `+${formatCents(cents)}` : 'No extra charge'\n}\n\ninterface ChoiceCardProps {\n name: string\n price: string\n note?: string\n imageUrl?: string\n selected: boolean\n disabled?: boolean\n role: 'radio' | 'checkbox'\n onPress: () => void\n badge?: ReactNode\n includes?: readonly string[]\n}\n\n/** One card: picture, name, price and note, pressed to pick; a combo's contents fold out below. */\nfunction ChoiceCard(props: ChoiceCardProps) {\n const { name, price, note, imageUrl, selected, disabled, role, onPress, badge, includes } = props\n const { hostId } = Aglyn.useSite()\n const [open, setOpen] = useState(false)\n const contentsId = useId()\n const src = imageUrl ? Aglyn.siteRelativeMediaSrc(imageUrl, { hostId }) : undefined\n return (\n <Card\n variant=\"outlined\"\n sx={{\n display: 'flex',\n flexDirection: 'column',\n borderWidth: 2,\n borderColor: selected ? 'primary.main' : 'divider',\n bgcolor: selected ? 'action.selected' : 'background.paper',\n opacity: disabled && !selected ? 0.6 : 1,\n }}\n >\n <CardActionArea\n role={role}\n aria-checked={selected}\n disabled={disabled}\n onClick={onPress}\n sx={{ flex: 1, display: 'flex', flexDirection: 'column', alignItems: 'stretch' }}\n >\n {src ? (\n <CardMedia\n component=\"img\"\n image={src}\n alt=\"\"\n sx={{ aspectRatio: '4 / 3', objectFit: 'cover' }}\n {...Aglyn.DEFERRED_IMAGE_ATTRIBUTES}\n />\n ) : null}\n <CardContent sx={{ flex: 1, p: 1.5, '&:last-child': { pb: 1.5 } }}>\n <Stack direction=\"row\" spacing={1} sx={{ alignItems: 'flex-start', justifyContent: 'space-between' }}>\n <Typography variant=\"subtitle2\" component=\"span\">\n {name}\n </Typography>\n {badge}\n </Stack>\n <Typography variant=\"body2\" color={selected ? 'primary' : 'text.primary'} sx={{ fontWeight: 600 }}>\n {price}\n </Typography>\n {note ? (\n <Typography variant=\"caption\" color=\"text.secondary\" component=\"p\">\n {note}\n </Typography>\n ) : null}\n </CardContent>\n </CardActionArea>\n {includes?.length ? (\n <Box sx={{ px: 1, pb: 1 }}>\n <Button\n size=\"small\"\n aria-expanded={open}\n aria-controls={contentsId}\n onClick={() => setOpen((was) => !was)}\n >\n {open ? 'Hide what’s included' : 'What’s included'}\n </Button>\n <Collapse in={open} id={contentsId}>\n <List dense disablePadding aria-label={`${name} includes`}>\n {includes.map((item) => (\n <ListItem key={item} disableGutters sx={{ py: 0 }}>\n <ListItemText primary={item} slotProps={{ primary: { variant: 'body2' } }} />\n </ListItem>\n ))}\n </List>\n </Collapse>\n </Box>\n ) : null}\n </Card>\n )\n}\n\n/** A heading, its hint, and the grid of cards under it. */\nfunction CardGroup(props: {\n label: string\n hint: string\n required: boolean\n role: 'radiogroup' | 'group'\n children: ReactNode\n}) {\n const { label, hint, required, role, children } = props\n const labelId = useId()\n return (\n <Box component=\"section\" aria-labelledby={labelId}>\n <Stack direction=\"row\" spacing={1} sx={{ alignItems: 'center', mb: 1 }}>\n <Typography id={labelId} variant=\"subtitle1\" component=\"h2\">\n {label}\n </Typography>\n <Chip\n size=\"small\"\n variant=\"outlined\"\n color={required ? 'primary' : 'default'}\n label={hint}\n />\n </Stack>\n <Box\n role={role}\n aria-labelledby={labelId}\n aria-required={required || undefined}\n sx={{\n display: 'grid',\n gridTemplateColumns: (theme) => `repeat(auto-fill, minmax(${theme.spacing(19)}, 1fr))`,\n gap: 1.5,\n }}\n >\n {children}\n </Box>\n </Box>\n )\n}\n\nexport interface ProductChoiceCardsProps {\n /** The options the shopper chooses among (size, style), with their values. */\n options: ReadonlyArray<{ name: string; values: readonly string[] }>\n variants: readonly CardVariant[]\n selections: Readonly<Record<string, string>>\n onSelect: (optionName: string, value: string) => void\n /** The add-on groups the website offers; empty draws none. */\n groups: readonly ProductModifierGroup[]\n /** The variant picked: a choice priced by variant shows its price on it. */\n variantId?: string\n value: readonly ModifierSelection[]\n onChange: (next: ModifierSelection[]) => void\n /** The store's money, e.g. `$1,250.00`. */\n formatCents: (cents: number) => string\n /** What a card says where a variant has no price yet. */\n unpricedLabel: string\n disabled?: boolean\n}\n\n/** The product's options and add-ons as picture cards (AGL-4205). */\nexport function ProductChoiceCards(props: ProductChoiceCardsProps) {\n const {\n options,\n variants,\n selections,\n onSelect,\n groups,\n variantId,\n value,\n onChange,\n formatCents,\n unpricedLabel,\n disabled,\n } = props\n const addOnCard = (group: ProductModifierGroup, option: ProductModifierOption, chosen: string[]) => {\n const selected = chosen.includes(option.id)\n const full = group.max > 1 && chosen.length >= group.max\n return (\n <ChoiceCard\n key={option.id}\n name={option.name}\n price={addOnPriceLabel(modifierOptionPriceCents(option, variantId), formatCents)}\n note={option.note}\n imageUrl={option.imageUrl}\n selected={selected}\n disabled={disabled || (!selected && full)}\n role={group.max === 1 ? 'radio' : 'checkbox'}\n badge={modifierOptionIsCombo(option) ? <Chip size=\"small\" color=\"secondary\" label=\"Combo\" /> : null}\n includes={modifierOptionIsCombo(option) ? option.includes : undefined}\n onPress={() => onChange(withGroupAnswer(groups, value, group.id, pressChoice(group, chosen, option.id)))}\n />\n )\n }\n return (\n <Stack spacing={3} sx={{ mb: 2 }}>\n {options.map((option) => (\n <CardGroup key={option.name} label={option.name} hint=\"Choose one\" required role=\"radiogroup\">\n {option.values.map((choice) => {\n const variant = variantForOptionValue(variants, selections, option.name, choice)\n return (\n <ChoiceCard\n key={choice}\n name={choice}\n price={\n typeof variant?.priceUsd === 'number'\n ? formatCents(Math.round(variant.priceUsd * 100))\n : unpricedLabel\n }\n note={variant?.note}\n imageUrl={variant?.imageUrl}\n selected={selections[option.name] === choice}\n role=\"radio\"\n badge={variant?.soldOut ? <Chip size=\"small\" variant=\"outlined\" label=\"Sold out\" /> : null}\n onPress={() => onSelect(option.name, choice)}\n />\n )\n })}\n </CardGroup>\n ))}\n {groups.map((group) => {\n const chosen = value.filter((pick) => pick.groupId === group.id).map((pick) => pick.optionId)\n return (\n <CardGroup\n key={group.id}\n label={group.name}\n hint={addOnGroupHint(group)}\n required={modifierGroupRequired(group)}\n role={group.max === 1 ? 'radiogroup' : 'group'}\n >\n {group.options.map((option) => addOnCard(group, option, chosen))}\n </CardGroup>\n )\n })}\n </Stack>\n )\n}\n\nProductChoiceCards.displayName = 'ProductChoiceCards'\n\nexport default ProductChoiceCards\n"],"names":["Aglyn","Box","Button","Card","CardActionArea","CardContent","CardMedia","Chip","Collapse","List","ListItem","ListItemText","Stack","Typography","useId","useState","modifierGroupRequired","modifierOptionIsCombo","modifierOptionPriceCents","addOnGroupHint","withGroupAnswer","variantForOptionValue","variants","selections","optionName","value","wanted","find","variant","Object","entries","every","name","picked","options","pressChoice","group","chosen","optionId","includes","max","min","filter","id","length","map","option","addOnPriceLabel","cents","formatCents","ChoiceCard","props","price","note","imageUrl","selected","disabled","role","onPress","badge","hostId","useSite","open","setOpen","contentsId","src","siteRelativeMediaSrc","undefined","sx","display","flexDirection","borderWidth","borderColor","bgcolor","opacity","aria-checked","onClick","flex","alignItems","component","image","alt","aspectRatio","objectFit","DEFERRED_IMAGE_ATTRIBUTES","p","pb","direction","spacing","justifyContent","color","fontWeight","px","size","aria-expanded","aria-controls","was","in","dense","disablePadding","aria-label","item","disableGutters","py","primary","slotProps","CardGroup","label","hint","required","children","labelId","aria-labelledby","mb","aria-required","gridTemplateColumns","theme","gap","ProductChoiceCards","onSelect","groups","variantId","onChange","unpricedLabel","addOnCard","full","values","choice","priceUsd","Math","round","soldOut","pick","groupId","displayName"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GACD;;;AAEA,YAAYA,WAAW,eAAc;AACrC,OAAOC,SAAS,oBAAmB;AACnC,OAAOC,YAAY,uBAAsB;AACzC,OAAOC,UAAU,qBAAoB;AACrC,OAAOC,oBAAoB,+BAA8B;AACzD,OAAOC,iBAAiB,4BAA2B;AACnD,OAAOC,eAAe,0BAAyB;AAC/C,OAAOC,UAAU,qBAAoB;AACrC,OAAOC,cAAc,yBAAwB;AAC7C,OAAOC,UAAU,qBAAoB;AACrC,OAAOC,cAAc,yBAAwB;AAC7C,OAAOC,kBAAkB,6BAA4B;AACrD,OAAOC,WAAW,sBAAqB;AACvC,OAAOC,gBAAgB,2BAA0B;AACjD,SAASC,KAAK,EAAEC,QAAQ,QAAwB,QAAO;AACvD,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GAAG,CAAC,CAACC,SAAW8E,UAAUxF,OAAOU,QAAQT;mBANnDD,MAAMO,EAAE;YASnB;;;AAGN;AAEA2E,mBAAmBgB,WAAW,GAAG;AAEjC,eAAehB,mBAAkB"}
@@ -0,0 +1,42 @@
1
+ import type { OptionPresentation } from './product-detail';
2
+ /** What the Details panel lists: only facts the product record holds. */
3
+ export declare function productDetailFacts(product: {
4
+ type?: string;
5
+ tags?: string[];
6
+ }, variant: {
7
+ sku?: string;
8
+ } | undefined, presented: readonly OptionPresentation[]): Array<{
9
+ label: string;
10
+ value: string;
11
+ }>;
12
+ /**
13
+ * What the Shipping & returns panel says, from the product's kind and the
14
+ * store's own return settings — never a policy the store has not set.
15
+ */
16
+ export declare function productShippingLines(product: {
17
+ type?: string;
18
+ }, returns: {
19
+ windowDays: number;
20
+ } | undefined): string[];
21
+ export interface ProductDetailPanelsProps {
22
+ product: {
23
+ type?: string;
24
+ tags?: string[];
25
+ };
26
+ variant: {
27
+ sku?: string;
28
+ } | undefined;
29
+ presented: readonly OptionPresentation[];
30
+ /** The store's return window, when it takes returns of this kind. */
31
+ returns: {
32
+ windowDays: number;
33
+ } | undefined;
34
+ showDetails: boolean;
35
+ showShipping: boolean;
36
+ }
37
+ /** The folds under the buy box: the facts the product holds, and how it ships. */
38
+ export declare function ProductDetailPanels(props: ProductDetailPanelsProps): import("react").JSX.Element;
39
+ export declare namespace ProductDetailPanels {
40
+ var displayName: string;
41
+ }
42
+ export default ProductDetailPanels;