@aglyn/plugins-commerce 1.15.1 → 1.16.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 (212) 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/product-add-ons-fields.component.d.ts +13 -0
  15. package/src/lib/components/console/product-add-ons-fields.component.js +96 -3
  16. package/src/lib/components/console/product-add-ons-fields.component.js.map +1 -1
  17. package/src/lib/components/console/product-builder-fields.component.d.ts +39 -0
  18. package/src/lib/components/console/product-builder-fields.component.js +195 -0
  19. package/src/lib/components/console/product-builder-fields.component.js.map +1 -0
  20. package/src/lib/components/console/product-editor-dialog.component.js +35 -2
  21. package/src/lib/components/console/product-editor-dialog.component.js.map +1 -1
  22. package/src/lib/components/console/quote-editor-dialog.component.js +43 -6
  23. package/src/lib/components/console/quote-editor-dialog.component.js.map +1 -1
  24. package/src/lib/components/console/quote-messages.component.d.ts +21 -0
  25. package/src/lib/components/console/quote-messages.component.js +185 -0
  26. package/src/lib/components/console/quote-messages.component.js.map +1 -0
  27. package/src/lib/components/console/quote-pay-link.component.js +1 -1
  28. package/src/lib/components/console/quote-pay-link.component.js.map +1 -1
  29. package/src/lib/components/console/quote-proofs.component.js +30 -3
  30. package/src/lib/components/console/quote-proofs.component.js.map +1 -1
  31. package/src/lib/components/console/quote-settings-card.component.d.ts +7 -3
  32. package/src/lib/components/console/quote-settings-card.component.js +154 -24
  33. package/src/lib/components/console/quote-settings-card.component.js.map +1 -1
  34. package/src/lib/components/product-builder-context.d.ts +22 -0
  35. package/src/lib/components/product-builder-context.js +21 -0
  36. package/src/lib/components/product-builder-context.js.map +1 -0
  37. package/src/lib/components/product-builder-mockup.d.ts +42 -0
  38. package/src/lib/components/product-builder-mockup.js +120 -0
  39. package/src/lib/components/product-builder-mockup.js.map +1 -0
  40. package/src/lib/components/product-builder-sample.d.ts +63 -0
  41. package/src/lib/components/product-builder-sample.js +96 -0
  42. package/src/lib/components/product-builder-sample.js.map +1 -0
  43. package/src/lib/components/product-choice-cards.d.ts +51 -0
  44. package/src/lib/components/product-choice-cards.js +311 -0
  45. package/src/lib/components/product-choice-cards.js.map +1 -0
  46. package/src/lib/components/product-detail-panels.d.ts +42 -0
  47. package/src/lib/components/product-detail-panels.js +185 -0
  48. package/src/lib/components/product-detail-panels.js.map +1 -0
  49. package/src/lib/components/product-detail.d.ts +20 -12
  50. package/src/lib/components/product-detail.js +136 -221
  51. package/src/lib/components/product-detail.js.map +1 -1
  52. package/src/lib/components/product-grid.d.ts +7 -0
  53. package/src/lib/components/product-grid.js +11 -8
  54. package/src/lib/components/product-grid.js.map +1 -1
  55. package/src/lib/components/product-options-field-body.d.ts +9 -8
  56. package/src/lib/components/product-options-field-body.js +152 -3
  57. package/src/lib/components/product-options-field-body.js.map +1 -1
  58. package/src/lib/components/product-options-field.js +1 -1
  59. package/src/lib/components/product-options-field.js.map +1 -1
  60. package/src/lib/components/product-photo-fit.d.ts +49 -0
  61. package/src/lib/components/product-photo-fit.js +58 -0
  62. package/src/lib/components/product-photo-fit.js.map +1 -0
  63. package/src/lib/components/product-restock-notify.d.ts +12 -0
  64. package/src/lib/components/product-restock-notify.js +86 -0
  65. package/src/lib/components/product-restock-notify.js.map +1 -0
  66. package/src/lib/components/quote-messages-panel.d.ts +21 -0
  67. package/src/lib/components/quote-messages-panel.js +191 -0
  68. package/src/lib/components/quote-messages-panel.js.map +1 -0
  69. package/src/lib/components/quote-page-body.js +15 -1
  70. package/src/lib/components/quote-page-body.js.map +1 -1
  71. package/src/lib/components/quote-proof-panel.d.ts +6 -3
  72. package/src/lib/components/quote-proof-panel.js +139 -14
  73. package/src/lib/components/quote-proof-panel.js.map +1 -1
  74. package/src/lib/components/related-products.d.ts +7 -0
  75. package/src/lib/components/related-products.js +8 -6
  76. package/src/lib/components/related-products.js.map +1 -1
  77. package/src/lib/constants/quote-page.d.ts +8 -0
  78. package/src/lib/constants/quote-page.js +11 -0
  79. package/src/lib/constants/quote-page.js.map +1 -1
  80. package/src/lib/model/commerce-cart.d.ts +6 -1
  81. package/src/lib/model/commerce-cart.js +5 -1
  82. package/src/lib/model/commerce-cart.js.map +1 -1
  83. package/src/lib/model/commerce-invoices.js +5 -1
  84. package/src/lib/model/commerce-invoices.js.map +1 -1
  85. package/src/lib/model/commerce-pos-ops.d.ts +3 -0
  86. package/src/lib/model/commerce-pos-ops.js +3 -0
  87. package/src/lib/model/commerce-pos-ops.js.map +1 -1
  88. package/src/lib/model/commerce-pos.d.ts +8 -0
  89. package/src/lib/model/commerce-pos.js.map +1 -1
  90. package/src/lib/model/commerce-quote-messages.d.ts +106 -0
  91. package/src/lib/model/commerce-quote-messages.js +146 -0
  92. package/src/lib/model/commerce-quote-messages.js.map +1 -0
  93. package/src/lib/model/commerce-quote-pay.d.ts +31 -2
  94. package/src/lib/model/commerce-quote-pay.js +31 -7
  95. package/src/lib/model/commerce-quote-pay.js.map +1 -1
  96. package/src/lib/model/commerce-quote-proofs.d.ts +47 -8
  97. package/src/lib/model/commerce-quote-proofs.js +73 -18
  98. package/src/lib/model/commerce-quote-proofs.js.map +1 -1
  99. package/src/lib/model/commerce-quote-request.d.ts +14 -4
  100. package/src/lib/model/commerce-quote-request.js +25 -2
  101. package/src/lib/model/commerce-quote-request.js.map +1 -1
  102. package/src/lib/model/commerce-quotes.d.ts +56 -3
  103. package/src/lib/model/commerce-quotes.js +47 -2
  104. package/src/lib/model/commerce-quotes.js.map +1 -1
  105. package/src/lib/model/commerce.d.ts +12 -1
  106. package/src/lib/model/commerce.js.map +1 -1
  107. package/src/lib/model/index.d.ts +1 -0
  108. package/src/lib/model/index.js +1 -0
  109. package/src/lib/model/index.js.map +1 -1
  110. package/src/lib/model/pos-cellular.d.ts +5 -0
  111. package/src/lib/model/pos-cellular.js.map +1 -1
  112. package/src/lib/model/product-card-rules.d.ts +41 -0
  113. package/src/lib/model/product-card-rules.js +90 -0
  114. package/src/lib/model/product-card-rules.js.map +1 -0
  115. package/src/lib/model/product-modifiers.d.ts +11 -0
  116. package/src/lib/model/product-modifiers.js +10 -0
  117. package/src/lib/model/product-modifiers.js.map +1 -1
  118. package/src/lib/model/product-write.d.ts +3 -0
  119. package/src/lib/server/billing-webhook.js +6 -2
  120. package/src/lib/server/billing-webhook.js.map +1 -1
  121. package/src/lib/server/cancel-order.js +15 -0
  122. package/src/lib/server/cancel-order.js.map +1 -1
  123. package/src/lib/server/channel-order-updates.js +15 -1
  124. package/src/lib/server/channel-order-updates.js.map +1 -1
  125. package/src/lib/server/channel-orders.js +20 -0
  126. package/src/lib/server/channel-orders.js.map +1 -1
  127. package/src/lib/server/checkout.js +1 -1
  128. package/src/lib/server/checkout.js.map +1 -1
  129. package/src/lib/server/local-fulfillment.js +1 -1
  130. package/src/lib/server/local-fulfillment.js.map +1 -1
  131. package/src/lib/server/pos-cellular-billing.d.ts +1 -1
  132. package/src/lib/server/pos-cellular-billing.js +2 -1
  133. package/src/lib/server/pos-cellular-billing.js.map +1 -1
  134. package/src/lib/server/pos-cellular.d.ts +3 -1
  135. package/src/lib/server/pos-cellular.js +15 -8
  136. package/src/lib/server/pos-cellular.js.map +1 -1
  137. package/src/lib/server/pos-offline-sync.d.ts +3 -3
  138. package/src/lib/server/pos-offline-sync.js +17 -4
  139. package/src/lib/server/pos-offline-sync.js.map +1 -1
  140. package/src/lib/server/pos-order.js +17 -6
  141. package/src/lib/server/pos-order.js.map +1 -1
  142. package/src/lib/server/pos-payment.js +27 -11
  143. package/src/lib/server/pos-payment.js.map +1 -1
  144. package/src/lib/server/pos-reader-splash.js +10 -5
  145. package/src/lib/server/pos-reader-splash.js.map +1 -1
  146. package/src/lib/server/pos-readers.js +34 -10
  147. package/src/lib/server/pos-readers.js.map +1 -1
  148. package/src/lib/server/pos-return.js +19 -3
  149. package/src/lib/server/pos-return.js.map +1 -1
  150. package/src/lib/server/pos-stripe.d.ts +14 -0
  151. package/src/lib/server/pos-stripe.js +6 -2
  152. package/src/lib/server/pos-stripe.js.map +1 -1
  153. package/src/lib/server/pos-terminal-connection-token.js +23 -9
  154. package/src/lib/server/pos-terminal-connection-token.js.map +1 -1
  155. package/src/lib/server/pos-terminal.d.ts +80 -14
  156. package/src/lib/server/pos-terminal.js +393 -123
  157. package/src/lib/server/pos-terminal.js.map +1 -1
  158. package/src/lib/server/product-drafts.d.ts +1 -1
  159. package/src/lib/server/product-drafts.js +4 -3
  160. package/src/lib/server/product-drafts.js.map +1 -1
  161. package/src/lib/server/product-writer.js +5 -4
  162. package/src/lib/server/product-writer.js.map +1 -1
  163. package/src/lib/server/product.d.ts +11 -0
  164. package/src/lib/server/product.js +18 -3
  165. package/src/lib/server/product.js.map +1 -1
  166. package/src/lib/server/products-write.js +4 -3
  167. package/src/lib/server/products-write.js.map +1 -1
  168. package/src/lib/server/quote-email.d.ts +26 -0
  169. package/src/lib/server/quote-email.js +73 -7
  170. package/src/lib/server/quote-email.js.map +1 -1
  171. package/src/lib/server/quote-messages.d.ts +72 -0
  172. package/src/lib/server/quote-messages.js +356 -0
  173. package/src/lib/server/quote-messages.js.map +1 -0
  174. package/src/lib/server/quote-pay.d.ts +42 -0
  175. package/src/lib/server/quote-pay.js +81 -4
  176. package/src/lib/server/quote-pay.js.map +1 -1
  177. package/src/lib/server/quote-proofs.d.ts +1 -1
  178. package/src/lib/server/quote-proofs.js +63 -19
  179. package/src/lib/server/quote-proofs.js.map +1 -1
  180. package/src/lib/server/quote.d.ts +12 -0
  181. package/src/lib/server/quote.js +44 -14
  182. package/src/lib/server/quote.js.map +1 -1
  183. package/src/lib/server/refund.js +3 -1
  184. package/src/lib/server/refund.js.map +1 -1
  185. package/src/lib/server/reserve-stock.js +9 -0
  186. package/src/lib/server/reserve-stock.js.map +1 -1
  187. package/src/lib/server/returns.js +15 -1
  188. package/src/lib/server/returns.js.map +1 -1
  189. package/src/lib/server/reviews.js +15 -0
  190. package/src/lib/server/reviews.js.map +1 -1
  191. package/src/lib/server/sold-out-drop.d.ts +58 -0
  192. package/src/lib/server/sold-out-drop.js +81 -0
  193. package/src/lib/server/sold-out-drop.js.map +1 -0
  194. package/src/lib/server/stock-levels.js +9 -0
  195. package/src/lib/server/stock-levels.js.map +1 -1
  196. package/src/lib/server/stripe-refund.d.ts +7 -0
  197. package/src/lib/server/stripe-refund.js +26 -7
  198. package/src/lib/server/stripe-refund.js.map +1 -1
  199. package/src/lib/server.js +2 -0
  200. package/src/lib/server.js.map +1 -1
  201. package/src/lib/tenant-emails.js +85 -2
  202. package/src/lib/tenant-emails.js.map +1 -1
  203. package/src/lib/testing/fake-seller-payment-account.d.ts +29 -0
  204. package/src/lib/testing/fake-seller-payment-account.js +40 -0
  205. package/src/lib/testing/fake-seller-payment-account.js.map +1 -0
  206. package/src/lib/transfer/product-transfer.js +6 -5
  207. package/src/lib/transfer/product-transfer.js.map +1 -1
  208. package/src/lib/transfer/products.server.js +4 -3
  209. package/src/lib/transfer/products.server.js.map +1 -1
  210. package/src/lib/utils/quote-email-content.d.ts +6 -0
  211. package/src/lib/utils/quote-email-content.js +6 -3
  212. package/src/lib/utils/quote-email-content.js.map +1 -1
@@ -14,34 +14,52 @@
14
14
  * See the License for the specific language governing permissions and
15
15
  * limitations under the License.
16
16
  */ 'use client';
17
+ import { _ as _extends } from "@swc/helpers/_/_extends";
17
18
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
18
19
  import * as CommerceModel from "../../model/index.js";
19
20
  import { pluginDocsHelp } from "@aglyn/aglyn";
20
21
  import { CardDisplay } from "@aglyn/shared-ui-jsx";
21
22
  import { useSnackbar } from "@aglyn/shared-ui-snackstack";
22
23
  import { useFirestore, useFirestoreDoc, writeGuardedBySeed } from "@aglyn/tenant-feature-instance";
23
- import { Button, FormControlLabel, FormHelperText, Stack, Switch } from "@mui/material";
24
+ import { Box, Button, Divider, FormControlLabel, FormHelperText, Stack, Switch, TextField, Tooltip, Typography } from "@mui/material";
24
25
  import { doc, setDoc } from "firebase/firestore";
25
26
  import { useCallback, useState } from "react";
26
27
  /**
27
- * The store's quote defaults (AGL-4093), on `hosts/{hostId}/settings/store`
28
- * under `quotes`: whether a new quote starts out asking the customer to
29
- * approve the proof before they can pay. Each quote keeps its own setting.
28
+ * The store's quote defaults, on `hosts/{hostId}/settings/store` under
29
+ * `quotes`: whether a new quote starts out asking the customer to approve the
30
+ * proof before they can pay (AGL-4093), whether it starts out asking a
31
+ * customer with a site account to sign in to see the proof (AGL-4206), and
32
+ * what every customer ticks before Approve works (AGL-4206). Each quote keeps
33
+ * its own switches; the statements are the store's, read when the customer
34
+ * opens the quote.
30
35
  */ export function QuoteSettingsCard(props) {
31
36
  const { hostId } = props;
32
37
  const firestore = useFirestore();
33
38
  const { enqueueSnackbar } = useSnackbar();
34
- const { data: store, status, // The switch is seeded from this document; a seed the server never
35
- // confirmed must not be written back over the saved setting (AGL-1358).
39
+ const { data: store, status, // The switches are seeded from this document; a seed the server never
40
+ // confirmed must not be written back over the saved settings (AGL-1358).
36
41
  fromCache, listen } = useFirestoreDoc(()=>doc(firestore, 'hosts', hostId, 'settings', 'store'), [
37
42
  firestore,
38
43
  hostId
39
44
  ]);
40
- const saved = CommerceModel.quoteRequiresProofApprovalByDefault(store == null ? void 0 : store.quotes);
45
+ const saved = {
46
+ requireProofApproval: CommerceModel.quoteRequiresProofApprovalByDefault(store == null ? void 0 : store.quotes),
47
+ requireProofSignIn: CommerceModel.quoteRequiresProofSignInByDefault(store == null ? void 0 : store.quotes),
48
+ approvalStatements: CommerceModel.quoteApprovalStatements(store == null ? void 0 : store.quotes)
49
+ };
41
50
  const [draft, setDraft] = useState(null);
42
- const current = draft != null ? draft : saved;
51
+ const form = draft != null ? draft : saved;
43
52
  const [busy, setBusy] = useState(false);
53
+ const loading = status === 'loading';
54
+ const edit = (patch)=>setDraft(_extends({}, form, patch));
55
+ const statements = form.approvalStatements;
56
+ const cleaned = CommerceModel.cleanQuoteApprovalStatements(statements);
44
57
  const save = useCallback(async ()=>{
58
+ const current = {
59
+ requireProofApproval: form.requireProofApproval,
60
+ requireProofSignIn: form.requireProofSignIn,
61
+ approvalStatements: CommerceModel.cleanQuoteApprovalStatements(form.approvalStatements)
62
+ };
45
63
  setBusy(true);
46
64
  try {
47
65
  const verdict = await writeGuardedBySeed({
@@ -51,9 +69,7 @@ import { useCallback, useState } from "react";
51
69
  listen
52
70
  }, async ()=>{
53
71
  await setDoc(doc(firestore, 'hosts', hostId, 'settings', 'store'), {
54
- quotes: {
55
- requireProofApproval: current
56
- }
72
+ quotes: current
57
73
  }, {
58
74
  merge: true
59
75
  });
@@ -73,7 +89,7 @@ import { useCallback, useState } from "react";
73
89
  setBusy(false);
74
90
  }
75
91
  }, [
76
- current,
92
+ form,
77
93
  firestore,
78
94
  hostId,
79
95
  status,
@@ -86,13 +102,13 @@ import { useCallback, useState } from "react";
86
102
  help: pluginDocsHelp('quotes', {
87
103
  anchor: '#quote-defaults',
88
104
  title: 'Quotes',
89
- excerpt: 'What every new quote starts with. Each quote can change it.'
105
+ excerpt: 'What every new quote starts with, and what customers confirm before they approve a proof.'
90
106
  }),
91
107
  HeaderProps: {
92
108
  action: /*#__PURE__*/ _jsx(Button, {
93
109
  size: "small",
94
110
  variant: "contained",
95
- disabled: busy || draft === null || status === 'loading',
111
+ disabled: busy || draft === null || loading || cleaned.length === 0,
96
112
  onClick: ()=>void save(),
97
113
  children: 'Save'
98
114
  })
@@ -100,18 +116,132 @@ import { useCallback, useState } from "react";
100
116
  contentGutterX: true,
101
117
  contentGutterY: true,
102
118
  children: /*#__PURE__*/ _jsxs(Stack, {
103
- spacing: 0.5,
119
+ spacing: 2,
104
120
  children: [
105
- /*#__PURE__*/ _jsx(FormControlLabel, {
106
- control: /*#__PURE__*/ _jsx(Switch, {
107
- checked: current,
108
- disabled: busy || status === 'loading',
109
- onChange: (event)=>setDraft(event.target.checked)
110
- }),
111
- label: "Customers approve the proof before they can pay"
121
+ /*#__PURE__*/ _jsxs(Stack, {
122
+ spacing: 0.5,
123
+ children: [
124
+ /*#__PURE__*/ _jsx(FormControlLabel, {
125
+ control: /*#__PURE__*/ _jsx(Switch, {
126
+ checked: form.requireProofApproval,
127
+ disabled: busy || loading,
128
+ onChange: (event)=>edit({
129
+ requireProofApproval: event.target.checked
130
+ })
131
+ }),
132
+ label: "Customers approve the proof before they can pay"
133
+ }),
134
+ /*#__PURE__*/ _jsx(FormControlLabel, {
135
+ control: /*#__PURE__*/ _jsx(Switch, {
136
+ checked: form.requireProofSignIn,
137
+ disabled: busy || loading,
138
+ onChange: (event)=>edit({
139
+ requireProofSignIn: event.target.checked
140
+ })
141
+ }),
142
+ label: "Customers sign in to see and approve proofs"
143
+ }),
144
+ /*#__PURE__*/ _jsx(FormHelperText, {
145
+ children: 'New quotes start with these settings, and you can change them on each quote. Signing in applies to a ' + 'customer with an account on your site; a customer without one, like a phone or walk-in customer, keeps ' + 'using the private link.'
146
+ })
147
+ ]
112
148
  }),
113
- /*#__PURE__*/ _jsx(FormHelperText, {
114
- children: 'New quotes start with this setting. You can change it on each quote.'
149
+ /*#__PURE__*/ _jsx(Divider, {}),
150
+ /*#__PURE__*/ _jsxs(Stack, {
151
+ spacing: 1.5,
152
+ children: [
153
+ /*#__PURE__*/ _jsxs(Stack, {
154
+ spacing: 0.5,
155
+ children: [
156
+ /*#__PURE__*/ _jsx(Typography, {
157
+ variant: "subtitle2",
158
+ children: 'Before a customer approves a proof'
159
+ }),
160
+ /*#__PURE__*/ _jsx(Typography, {
161
+ variant: "body2",
162
+ color: "text.secondary",
163
+ children: 'They tick each of these, then type their name. The quote keeps what they confirmed, with their name and the time.'
164
+ })
165
+ ]
166
+ }),
167
+ statements.map((statement, index)=>/*#__PURE__*/ _jsxs(Stack, {
168
+ direction: "row",
169
+ spacing: 1,
170
+ sx: {
171
+ alignItems: 'flex-start'
172
+ },
173
+ children: [
174
+ /*#__PURE__*/ _jsx(TextField, {
175
+ fullWidth: true,
176
+ size: "small",
177
+ multiline: true,
178
+ label: `Statement ${index + 1}`,
179
+ value: statement,
180
+ disabled: busy || loading,
181
+ onChange: (event)=>edit({
182
+ approvalStatements: statements.map((entry, at)=>at === index ? event.target.value : entry)
183
+ }),
184
+ slotProps: {
185
+ htmlInput: {
186
+ maxLength: CommerceModel.QUOTE_MAX_APPROVAL_STATEMENT
187
+ }
188
+ }
189
+ }),
190
+ /*#__PURE__*/ _jsx(Tooltip, {
191
+ title: statements.length <= 1 ? 'Customers confirm at least one statement' : '',
192
+ children: /*#__PURE__*/ _jsx("span", {
193
+ children: /*#__PURE__*/ _jsx(Button, {
194
+ size: "small",
195
+ "aria-label": `Remove statement ${index + 1}`,
196
+ disabled: busy || loading || statements.length <= 1,
197
+ onClick: ()=>edit({
198
+ approvalStatements: statements.filter((_entry, at)=>at !== index)
199
+ }),
200
+ sx: {
201
+ mt: 0.5
202
+ },
203
+ children: 'Remove'
204
+ })
205
+ })
206
+ })
207
+ ]
208
+ }, index)),
209
+ cleaned.length === 0 ? /*#__PURE__*/ _jsx(FormHelperText, {
210
+ error: true,
211
+ children: 'Write at least one statement for customers to confirm.'
212
+ }) : null,
213
+ /*#__PURE__*/ _jsxs(Box, {
214
+ sx: {
215
+ display: 'flex',
216
+ gap: 1,
217
+ flexWrap: 'wrap'
218
+ },
219
+ children: [
220
+ /*#__PURE__*/ _jsx(Button, {
221
+ size: "small",
222
+ variant: "outlined",
223
+ disabled: busy || loading || statements.length >= CommerceModel.QUOTE_MAX_APPROVAL_STATEMENTS,
224
+ onClick: ()=>edit({
225
+ approvalStatements: [
226
+ ...statements,
227
+ ''
228
+ ]
229
+ }),
230
+ children: 'Add a statement'
231
+ }),
232
+ /*#__PURE__*/ _jsx(Button, {
233
+ size: "small",
234
+ disabled: busy || loading,
235
+ onClick: ()=>edit({
236
+ approvalStatements: [
237
+ ...CommerceModel.QUOTE_DEFAULT_APPROVAL_STATEMENTS
238
+ ]
239
+ }),
240
+ children: 'Use the suggested statements'
241
+ })
242
+ ]
243
+ })
244
+ ]
115
245
  })
116
246
  ]
117
247
  })
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../../libs/plugins/commerce/src/lib/components/console/quote-settings-card.component.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\n'use client'\n\nimport * as CommerceModel from '../../model'\nimport { pluginDocsHelp } from '@aglyn/aglyn'\nimport { CardDisplay } from '@aglyn/shared-ui-jsx'\nimport { useSnackbar } from '@aglyn/shared-ui-snackstack'\nimport { useFirestore, useFirestoreDoc, writeGuardedBySeed } from '@aglyn/tenant-feature-instance'\nimport { Button, FormControlLabel, FormHelperText, Stack, Switch } from '@mui/material'\nimport { doc, setDoc } from 'firebase/firestore'\nimport { useCallback, useState } from 'react'\n\nexport interface QuoteSettingsCardProps {\n hostId: string\n}\n\n/**\n * The store's quote defaults (AGL-4093), on `hosts/{hostId}/settings/store`\n * under `quotes`: whether a new quote starts out asking the customer to\n * approve the proof before they can pay. Each quote keeps its own setting.\n */\nexport function QuoteSettingsCard(props: QuoteSettingsCardProps) {\n const { hostId } = props\n const firestore = useFirestore()\n const { enqueueSnackbar } = useSnackbar()\n const {\n data: store,\n status,\n // The switch is seeded from this document; a seed the server never\n // confirmed must not be written back over the saved setting (AGL-1358).\n fromCache,\n listen,\n } = useFirestoreDoc<any>(() => doc(firestore, 'hosts', hostId, 'settings', 'store'), [firestore, hostId])\n const saved = CommerceModel.quoteRequiresProofApprovalByDefault(store?.quotes)\n const [draft, setDraft] = useState<boolean | null>(null)\n const current = draft ?? saved\n const [busy, setBusy] = useState(false)\n\n const save = useCallback(async () => {\n setBusy(true)\n try {\n const verdict = await writeGuardedBySeed(\n { subject: 'quote settings', unreadable: status === 'error', fromCache, listen },\n async () => {\n await setDoc(\n doc(firestore, 'hosts', hostId, 'settings', 'store'),\n { quotes: { requireProofApproval: current } },\n { merge: true },\n )\n },\n )\n if (!verdict.ok) {\n return void enqueueSnackbar(verdict.message, { variant: 'warning', persist: false })\n }\n setDraft(null)\n enqueueSnackbar('Quote settings saved', { variant: 'success', persist: false })\n } finally {\n setBusy(false)\n }\n }, [current, firestore, hostId, status, fromCache, listen, enqueueSnackbar])\n\n return (\n <CardDisplay\n header={'Quotes'}\n help={pluginDocsHelp('quotes', {\n anchor: '#quote-defaults',\n title: 'Quotes',\n excerpt: 'What every new quote starts with. Each quote can change it.',\n })}\n HeaderProps={{\n action: (\n <Button size=\"small\" variant=\"contained\" disabled={busy || draft === null || status === 'loading'} onClick={() => void save()}>\n {'Save'}\n </Button>\n ),\n }}\n contentGutterX\n contentGutterY\n >\n <Stack spacing={0.5}>\n <FormControlLabel\n control={\n <Switch\n checked={current}\n disabled={busy || status === 'loading'}\n onChange={(event) => setDraft(event.target.checked)}\n />\n }\n label=\"Customers approve the proof before they can pay\"\n />\n <FormHelperText>{'New quotes start with this setting. You can change it on each quote.'}</FormHelperText>\n </Stack>\n </CardDisplay>\n )\n}\nQuoteSettingsCard.displayName = 'QuoteSettingsCard'\n\nexport default QuoteSettingsCard\n"],"names":["CommerceModel","pluginDocsHelp","CardDisplay","useSnackbar","useFirestore","useFirestoreDoc","writeGuardedBySeed","Button","FormControlLabel","FormHelperText","Stack","Switch","doc","setDoc","useCallback","useState","QuoteSettingsCard","props","hostId","firestore","enqueueSnackbar","data","store","status","fromCache","listen","saved","quoteRequiresProofApprovalByDefault","quotes","draft","setDraft","current","busy","setBusy","save","verdict","subject","unreadable","requireProofApproval","merge","ok","message","variant","persist","header","help","anchor","title","excerpt","HeaderProps","action","size","disabled","onClick","contentGutterX","contentGutterY","spacing","control","checked","onChange","event","target","label","displayName"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED;;AAEA,YAAYA,mBAAmB,uBAAa;AAC5C,SAASC,cAAc,QAAQ,eAAc;AAC7C,SAASC,WAAW,QAAQ,uBAAsB;AAClD,SAASC,WAAW,QAAQ,8BAA6B;AACzD,SAASC,YAAY,EAAEC,eAAe,EAAEC,kBAAkB,QAAQ,iCAAgC;AAClG,SAASC,MAAM,EAAEC,gBAAgB,EAAEC,cAAc,EAAEC,KAAK,EAAEC,MAAM,QAAQ,gBAAe;AACvF,SAASC,GAAG,EAAEC,MAAM,QAAQ,qBAAoB;AAChD,SAASC,WAAW,EAAEC,QAAQ,QAAQ,QAAO;AAM7C;;;;CAIC,GACD,OAAO,SAASC,kBAAkBC,KAA6B;IAC7D,MAAM,EAAEC,MAAM,EAAE,GAAGD;IACnB,MAAME,YAAYf;IAClB,MAAM,EAAEgB,eAAe,EAAE,GAAGjB;IAC5B,MAAM,EACJkB,MAAMC,KAAK,EACXC,MAAM,EACN,mEAAmE;IACnE,wEAAwE;IACxEC,SAAS,EACTC,MAAM,EACP,GAAGpB,gBAAqB,IAAMO,IAAIO,WAAW,SAASD,QAAQ,YAAY,UAAU;QAACC;QAAWD;KAAO;IACxG,MAAMQ,QAAQ1B,cAAc2B,mCAAmC,CAACL,yBAAAA,MAAOM,MAAM;IAC7E,MA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;;;AAIzB;AACAO,kBAAkB+C,WAAW,GAAG;AAEhC,eAAe/C,kBAAiB"}
1
+ {"version":3,"sources":["../../../../../../../../libs/plugins/commerce/src/lib/components/console/quote-settings-card.component.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\n'use client'\n\nimport * as CommerceModel from '../../model'\nimport { pluginDocsHelp } from '@aglyn/aglyn'\nimport { CardDisplay } from '@aglyn/shared-ui-jsx'\nimport { useSnackbar } from '@aglyn/shared-ui-snackstack'\nimport { useFirestore, useFirestoreDoc, writeGuardedBySeed } from '@aglyn/tenant-feature-instance'\nimport {\n Box,\n Button,\n Divider,\n FormControlLabel,\n FormHelperText,\n Stack,\n Switch,\n TextField,\n Tooltip,\n Typography,\n} from '@mui/material'\nimport { doc, setDoc } from 'firebase/firestore'\nimport { useCallback, useState } from 'react'\n\nexport interface QuoteSettingsCardProps {\n hostId: string\n}\n\n/** The card's settings as the form holds them. */\ninterface QuoteSettingsDraft {\n requireProofApproval: boolean\n requireProofSignIn: boolean\n /** As typed; blanks are dropped when saved. */\n approvalStatements: string[]\n}\n\n/**\n * The store's quote defaults, on `hosts/{hostId}/settings/store` under\n * `quotes`: whether a new quote starts out asking the customer to approve the\n * proof before they can pay (AGL-4093), whether it starts out asking a\n * customer with a site account to sign in to see the proof (AGL-4206), and\n * what every customer ticks before Approve works (AGL-4206). Each quote keeps\n * its own switches; the statements are the store's, read when the customer\n * opens the quote.\n */\nexport function QuoteSettingsCard(props: QuoteSettingsCardProps) {\n const { hostId } = props\n const firestore = useFirestore()\n const { enqueueSnackbar } = useSnackbar()\n const {\n data: store,\n status,\n // The switches are seeded from this document; a seed the server never\n // confirmed must not be written back over the saved settings (AGL-1358).\n fromCache,\n listen,\n } = useFirestoreDoc<any>(() => doc(firestore, 'hosts', hostId, 'settings', 'store'), [firestore, hostId])\n const saved: QuoteSettingsDraft = {\n requireProofApproval: CommerceModel.quoteRequiresProofApprovalByDefault(store?.quotes),\n requireProofSignIn: CommerceModel.quoteRequiresProofSignInByDefault(store?.quotes),\n approvalStatements: CommerceModel.quoteApprovalStatements(store?.quotes),\n }\n const [draft, setDraft] = useState<QuoteSettingsDraft | null>(null)\n const form = draft ?? saved\n const [busy, setBusy] = useState(false)\n const loading = status === 'loading'\n const edit = (patch: Partial<QuoteSettingsDraft>) => setDraft({ ...form, ...patch })\n const statements = form.approvalStatements\n const cleaned = CommerceModel.cleanQuoteApprovalStatements(statements)\n\n const save = useCallback(async () => {\n const current: CommerceModel.QuoteStoreSettings = {\n requireProofApproval: form.requireProofApproval,\n requireProofSignIn: form.requireProofSignIn,\n approvalStatements: CommerceModel.cleanQuoteApprovalStatements(form.approvalStatements),\n }\n setBusy(true)\n try {\n const verdict = await writeGuardedBySeed(\n { subject: 'quote settings', unreadable: status === 'error', fromCache, listen },\n async () => {\n await setDoc(doc(firestore, 'hosts', hostId, 'settings', 'store'), { quotes: current }, { merge: true })\n },\n )\n if (!verdict.ok) {\n return void enqueueSnackbar(verdict.message, { variant: 'warning', persist: false })\n }\n setDraft(null)\n enqueueSnackbar('Quote settings saved', { variant: 'success', persist: false })\n } finally {\n setBusy(false)\n }\n }, [form, firestore, hostId, status, fromCache, listen, enqueueSnackbar])\n\n return (\n <CardDisplay\n header={'Quotes'}\n help={pluginDocsHelp('quotes', {\n anchor: '#quote-defaults',\n title: 'Quotes',\n excerpt: 'What every new quote starts with, and what customers confirm before they approve a proof.',\n })}\n HeaderProps={{\n action: (\n <Button\n size=\"small\"\n variant=\"contained\"\n disabled={busy || draft === null || loading || cleaned.length === 0}\n onClick={() => void save()}\n >\n {'Save'}\n </Button>\n ),\n }}\n contentGutterX\n contentGutterY\n >\n <Stack spacing={2}>\n <Stack spacing={0.5}>\n <FormControlLabel\n control={\n <Switch\n checked={form.requireProofApproval}\n disabled={busy || loading}\n onChange={(event) => edit({ requireProofApproval: event.target.checked })}\n />\n }\n label=\"Customers approve the proof before they can pay\"\n />\n <FormControlLabel\n control={\n <Switch\n checked={form.requireProofSignIn}\n disabled={busy || loading}\n onChange={(event) => edit({ requireProofSignIn: event.target.checked })}\n />\n }\n label=\"Customers sign in to see and approve proofs\"\n />\n <FormHelperText>\n {'New quotes start with these settings, and you can change them on each quote. Signing in applies to a ' +\n 'customer with an account on your site; a customer without one, like a phone or walk-in customer, keeps ' +\n 'using the private link.'}\n </FormHelperText>\n </Stack>\n\n <Divider />\n\n <Stack spacing={1.5}>\n <Stack spacing={0.5}>\n <Typography variant=\"subtitle2\">{'Before a customer approves a proof'}</Typography>\n <Typography variant=\"body2\" color=\"text.secondary\">\n {'They tick each of these, then type their name. The quote keeps what they confirmed, with their name and the time.'}\n </Typography>\n </Stack>\n {statements.map((statement, index) => (\n <Stack key={index} direction=\"row\" spacing={1} sx={{ alignItems: 'flex-start' }}>\n <TextField\n fullWidth\n size=\"small\"\n multiline\n label={`Statement ${index + 1}`}\n value={statement}\n disabled={busy || loading}\n onChange={(event) =>\n edit({ approvalStatements: statements.map((entry, at) => (at === index ? event.target.value : entry)) })\n }\n slotProps={{ htmlInput: { maxLength: CommerceModel.QUOTE_MAX_APPROVAL_STATEMENT } }}\n />\n <Tooltip title={statements.length <= 1 ? 'Customers confirm at least one statement' : ''}>\n <span>\n <Button\n size=\"small\"\n aria-label={`Remove statement ${index + 1}`}\n disabled={busy || loading || statements.length <= 1}\n onClick={() => edit({ approvalStatements: statements.filter((_entry, at) => at !== index) })}\n sx={{ mt: 0.5 }}\n >\n {'Remove'}\n </Button>\n </span>\n </Tooltip>\n </Stack>\n ))}\n {cleaned.length === 0 ? (\n <FormHelperText error>{'Write at least one statement for customers to confirm.'}</FormHelperText>\n ) : null}\n <Box sx={{ display: 'flex', gap: 1, flexWrap: 'wrap' }}>\n <Button\n size=\"small\"\n variant=\"outlined\"\n disabled={busy || loading || statements.length >= CommerceModel.QUOTE_MAX_APPROVAL_STATEMENTS}\n onClick={() => edit({ approvalStatements: [...statements, ''] })}\n >\n {'Add a statement'}\n </Button>\n <Button\n size=\"small\"\n disabled={busy || loading}\n onClick={() => edit({ approvalStatements: [...CommerceModel.QUOTE_DEFAULT_APPROVAL_STATEMENTS] })}\n >\n {'Use the suggested statements'}\n </Button>\n </Box>\n </Stack>\n </Stack>\n </CardDisplay>\n )\n}\nQuoteSettingsCard.displayName = 'QuoteSettingsCard'\n\nexport default QuoteSettingsCard\n"],"names":["CommerceModel","pluginDocsHelp","CardDisplay","useSnackbar","useFirestore","useFirestoreDoc","writeGuardedBySeed","Box","Button","Divider","FormControlLabel","FormHelperText","Stack","Switch","TextField","Tooltip","Typography","doc","setDoc","useCallback","useState","QuoteSettingsCard","props","hostId","firestore","enqueueSnackbar","data","store","status","fromCache","listen","saved","requireProofApproval","quoteRequiresProofApprovalByDefault","quotes","requireProofSignIn","quoteRequiresProofSignInByDefault","approvalStatements","quoteApprovalStatements","draft","setDraft","form","busy","setBusy","loading","edit","patch","statements","cleaned","cleanQuoteApprovalStatements","save","current","verdict","subject","unreadable","merge","ok","message","variant","persist","header","help","anchor","title","excerpt","HeaderProps","action","size","disabled","length","onClick","contentGutterX","contentGutterY","spacing","control","checked","onChange","event","target","label","color","map","statement","index","direction","sx","alignItems","fullWidth","multiline","value","entry","at","slotProps","htmlInput","maxLength","QUOTE_MAX_APPROVAL_STATEMENT","span","aria-label","filter","_entry","mt","error","display","gap","flexWrap","QUOTE_MAX_APPROVAL_STATEMENTS","QUOTE_DEFAULT_APPROVAL_STATEMENTS","displayName"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;AAEA,YAAYA,mBAAmB,uBAAa;AAC5C,SAAS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K;wDAAER,oBAAoBU,WAAWmD,MAAM,CAAC,CAACC,QAAQR,KAAOA,OAAOR;oDAAO;gDAC1FE,IAAI;oDAAEe,IAAI;gDAAI;0DAEb;;;;;+BAtBGjB;wBA4BbnC,QAAQqB,MAAM,KAAK,kBAClB,KAAC1D;4BAAe0F,KAAK;sCAAE;6BACrB;sCACJ,MAAC9F;4BAAI8E,IAAI;gCAAEiB,SAAS;gCAAQC,KAAK;gCAAGC,UAAU;4BAAO;;8CACnD,KAAChG;oCACC2D,MAAK;oCACLT,SAAQ;oCACRU,UAAU1B,QAAQE,WAAWG,WAAWsB,MAAM,IAAIrE,cAAcyG,6BAA6B;oCAC7FnC,SAAS,IAAMzB,KAAK;4CAAER,oBAAoB;mDAAIU;gDAAY;6CAAG;wCAAC;8CAE7D;;8CAEH,KAACvC;oCACC2D,MAAK;oCACLC,UAAU1B,QAAQE;oCAClB0B,SAAS,IAAMzB,KAAK;4CAAER,oBAAoB;mDAAIrC,cAAc0G,iCAAiC;6CAAC;wCAAC;8CAE9F;;;;;;;;;AAOf;AACArF,kBAAkBsF,WAAW,GAAG;AAEhC,eAAetF,kBAAiB"}
@@ -0,0 +1,22 @@
1
+ import type { ModifierSelection } from '../model/product-modifiers';
2
+ export interface ProductBuilderPicks {
3
+ productId: string;
4
+ productName: string;
5
+ /** The variant the options make; absent for a product with one variant. */
6
+ variantId?: string;
7
+ /** The options as picked, by option name. */
8
+ options: Record<string, string>;
9
+ /** The add-ons picked, ids only. */
10
+ modifiers: ModifierSelection[];
11
+ /** The add-ons' names, in the order picked, for the readable line. */
12
+ addOnNames: string[];
13
+ quantity: number;
14
+ /** Every required choice is answered. */
15
+ ready: boolean;
16
+ /** What is still to choose, when not ready. */
17
+ problem?: string;
18
+ /** What the picks come to, formatted (`$1,250.00`); absent before a price is set. */
19
+ total?: string;
20
+ }
21
+ /** The picks of the Product detail block around a node; null outside one. */
22
+ export declare const ProductBuilderContext: import("react").Context<ProductBuilderPicks>;
@@ -0,0 +1,21 @@
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 { createContext } from "react";
18
+ /** The picks of the Product detail block around a node; null outside one. */ export const ProductBuilderContext = createContext(null);
19
+ ProductBuilderContext.displayName = 'ProductBuilderContext';
20
+
21
+ //# sourceMappingURL=product-builder-context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../libs/plugins/commerce/src/lib/components/product-builder-context.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'use client'\n\nimport { createContext } from 'react'\nimport type { ModifierSelection } from '../model/product-modifiers'\n\n/*\n * WHAT A PRODUCT PAGE'S SHOPPER HAS PICKED (AGL-4205).\n *\n * The Product detail block holds the picks; anything the site builder drops\n * into the block — a request form with a Product and options field, for a\n * free mockup — reads them here instead of asking the shopper again. Plain\n * ids and words only: every price is worked out again from the product when\n * a quote is started from the request.\n */\nexport interface ProductBuilderPicks {\n productId: string\n productName: string\n /** The variant the options make; absent for a product with one variant. */\n variantId?: string\n /** The options as picked, by option name. */\n options: Record<string, string>\n /** The add-ons picked, ids only. */\n modifiers: ModifierSelection[]\n /** The add-ons' names, in the order picked, for the readable line. */\n addOnNames: string[]\n quantity: number\n /** Every required choice is answered. */\n ready: boolean\n /** What is still to choose, when not ready. */\n problem?: string\n /** What the picks come to, formatted (`$1,250.00`); absent before a price is set. */\n total?: string\n}\n\n/** The picks of the Product detail block around a node; null outside one. */\nexport const ProductBuilderContext = createContext<ProductBuilderPicks | null>(null)\nProductBuilderContext.displayName = 'ProductBuilderContext'\n"],"names":["createContext","ProductBuilderContext","displayName"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GACD;AAEA,SAASA,aAAa,QAAQ,QAAO;AAgCrC,2EAA2E,GAC3E,OAAO,MAAMC,wBAAwBD,cAA0C,MAAK;AACpFC,sBAAsBC,WAAW,GAAG"}
@@ -0,0 +1,42 @@
1
+ import { type ReactNode } from 'react';
2
+ import type { ModifierSelection, ProductModifierGroup } from '../model/product-modifiers';
3
+ import { type ProductBuilderPicks } from './product-builder-context';
4
+ /** The free-mockup button's words when the site builder typed none. */
5
+ export declare const MOCKUP_LABEL_DEFAULT = "Get a free mockup";
6
+ /**
7
+ * The picks a request form in the block reads: ids and words only, and
8
+ * whether every required choice is answered.
9
+ */
10
+ export declare function productBuilderPicks(input: {
11
+ product: {
12
+ id: string;
13
+ name: string;
14
+ modifierGroups?: readonly ProductModifierGroup[];
15
+ };
16
+ variant: {
17
+ id: string;
18
+ options?: Record<string, string>;
19
+ } | undefined;
20
+ addOns: readonly ModifierSelection[];
21
+ quantity: number;
22
+ ready: boolean;
23
+ problem?: string;
24
+ total?: string;
25
+ }): ProductBuilderPicks;
26
+ export interface ProductBuilderMockupProps {
27
+ picks: Parameters<typeof productBuilderPicks>[0];
28
+ /** The button's words; the default when blank. */
29
+ label?: string;
30
+ /** A priced product's button sits under Buy now; an unpriced one's is the main action. */
31
+ priced: boolean;
32
+ /** On the canvas the form stays open, and an empty block says what to drop in. */
33
+ canvas: boolean;
34
+ hasRequestForm: boolean;
35
+ children?: ReactNode;
36
+ }
37
+ /** "Get a free mockup" and the request form it opens. */
38
+ export declare function ProductBuilderMockup(props: ProductBuilderMockupProps): import("react").JSX.Element;
39
+ export declare namespace ProductBuilderMockup {
40
+ var displayName: string;
41
+ }
42
+ export default ProductBuilderMockup;
@@ -0,0 +1,120 @@
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 Box from "@mui/material/Box";
20
+ import Button from "@mui/material/Button";
21
+ import Collapse from "@mui/material/Collapse";
22
+ import Paper from "@mui/material/Paper";
23
+ import Typography from "@mui/material/Typography";
24
+ import { useRef, useState } from "react";
25
+ import { ProductBuilderContext } from "./product-builder-context.js";
26
+ /*
27
+ * THE FREE MOCKUP ON A PRODUCT PAGE (AGL-4205), in its own chunk: only a
28
+ * product that offers one, or the canvas, downloads it. The button opens
29
+ * what the site builder dropped into the Product detail block, a request
30
+ * form whose Product and options field reads the picks from the context.
31
+ */ /** The free-mockup button's words when the site builder typed none. */ export const MOCKUP_LABEL_DEFAULT = 'Get a free mockup';
32
+ /**
33
+ * The picks a request form in the block reads: ids and words only, and
34
+ * whether every required choice is answered.
35
+ */ export function productBuilderPicks(input) {
36
+ var _product_modifierGroups, _ref;
37
+ const { product, variant, addOns, quantity, ready, problem, total } = input;
38
+ const names = [];
39
+ for (const group of (_product_modifierGroups = product.modifierGroups) != null ? _product_modifierGroups : []){
40
+ for (const option of group.options){
41
+ if (addOns.some((pick)=>pick.groupId === group.id && pick.optionId === option.id)) {
42
+ names.push(option.name);
43
+ }
44
+ }
45
+ }
46
+ const options = Object.fromEntries(Object.entries((_ref = variant == null ? void 0 : variant.options) != null ? _ref : {}).filter(([, value])=>Boolean(value)));
47
+ return _extends({
48
+ productId: product.id,
49
+ productName: product.name
50
+ }, variant && variant.id !== 'default' ? {
51
+ variantId: variant.id
52
+ } : {}, {
53
+ options,
54
+ modifiers: addOns.map((pick)=>({
55
+ groupId: pick.groupId,
56
+ optionId: pick.optionId
57
+ })),
58
+ addOnNames: names,
59
+ quantity,
60
+ ready: ready && Boolean(variant)
61
+ }, problem ? {
62
+ problem
63
+ } : {}, total ? {
64
+ total
65
+ } : {});
66
+ }
67
+ /** "Get a free mockup" and the request form it opens. */ export function ProductBuilderMockup(props) {
68
+ const { picks, label, priced, canvas, hasRequestForm, children } = props;
69
+ const [open, setOpen] = useState(false);
70
+ const formRef = useRef(null);
71
+ const shown = open || canvas;
72
+ return /*#__PURE__*/ _jsxs(Box, {
73
+ sx: {
74
+ mb: 2
75
+ },
76
+ children: [
77
+ /*#__PURE__*/ _jsx(Button, {
78
+ variant: priced ? 'text' : 'contained',
79
+ color: "primary",
80
+ size: "large",
81
+ "aria-expanded": shown,
82
+ onClick: ()=>{
83
+ setOpen(true);
84
+ // After the form has opened, so it is where the page scrolls to.
85
+ window.setTimeout(()=>{
86
+ var _formRef_current_scrollIntoView, _formRef_current;
87
+ return (_formRef_current = formRef.current) == null ? void 0 : (_formRef_current_scrollIntoView = _formRef_current.scrollIntoView) == null ? void 0 : _formRef_current_scrollIntoView.call(_formRef_current, {
88
+ behavior: 'smooth',
89
+ block: 'start'
90
+ });
91
+ }, 50);
92
+ },
93
+ children: (label == null ? void 0 : label.trim()) || MOCKUP_LABEL_DEFAULT
94
+ }),
95
+ /*#__PURE__*/ _jsx(Collapse, {
96
+ in: shown,
97
+ ref: formRef,
98
+ children: /*#__PURE__*/ _jsx(Paper, {
99
+ variant: "outlined",
100
+ sx: {
101
+ p: 2,
102
+ mt: 1
103
+ },
104
+ children: /*#__PURE__*/ _jsx(ProductBuilderContext.Provider, {
105
+ value: productBuilderPicks(picks),
106
+ children: hasRequestForm ? children : /*#__PURE__*/ _jsx(Typography, {
107
+ variant: "body2",
108
+ color: "text.secondary",
109
+ children: 'Drop a request form here: a form with a Product and options field, the ' + 'contact fields and a File upload for artwork. It opens with the shopper’s picks.'
110
+ })
111
+ })
112
+ })
113
+ })
114
+ ]
115
+ });
116
+ }
117
+ ProductBuilderMockup.displayName = 'ProductBuilderMockup';
118
+ export default ProductBuilderMockup;
119
+
120
+ //# sourceMappingURL=product-builder-mockup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../libs/plugins/commerce/src/lib/components/product-builder-mockup.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 Box from '@mui/material/Box'\nimport Button from '@mui/material/Button'\nimport Collapse from '@mui/material/Collapse'\nimport Paper from '@mui/material/Paper'\nimport Typography from '@mui/material/Typography'\nimport { useRef, useState, type ReactNode } from 'react'\nimport type { ModifierSelection, ProductModifierGroup } from '../model/product-modifiers'\nimport { ProductBuilderContext, type ProductBuilderPicks } from './product-builder-context'\n\n/*\n * THE FREE MOCKUP ON A PRODUCT PAGE (AGL-4205), in its own chunk: only a\n * product that offers one, or the canvas, downloads it. The button opens\n * what the site builder dropped into the Product detail block, a request\n * form whose Product and options field reads the picks from the context.\n */\n\n/** The free-mockup button's words when the site builder typed none. */\nexport const MOCKUP_LABEL_DEFAULT = 'Get a free mockup'\n\n/**\n * The picks a request form in the block reads: ids and words only, and\n * whether every required choice is answered.\n */\nexport function productBuilderPicks(input: {\n product: { id: string; name: string; modifierGroups?: readonly ProductModifierGroup[] }\n variant: { id: string; options?: Record<string, string> } | undefined\n addOns: readonly ModifierSelection[]\n quantity: number\n ready: boolean\n problem?: string\n total?: string\n}): ProductBuilderPicks {\n const { product, variant, addOns, quantity, ready, problem, total } = input\n const names: string[] = []\n for (const group of product.modifierGroups ?? []) {\n for (const option of group.options) {\n if (addOns.some((pick) => pick.groupId === group.id && pick.optionId === option.id)) {\n names.push(option.name)\n }\n }\n }\n const options = Object.fromEntries(\n Object.entries(variant?.options ?? {}).filter(([, value]) => Boolean(value)),\n )\n return {\n productId: product.id,\n productName: product.name,\n ...(variant && variant.id !== 'default' ? { variantId: variant.id } : {}),\n options,\n modifiers: addOns.map((pick) => ({ groupId: pick.groupId, optionId: pick.optionId })),\n addOnNames: names,\n quantity,\n ready: ready && Boolean(variant),\n ...(problem ? { problem } : {}),\n ...(total ? { total } : {}),\n }\n}\n\nexport interface ProductBuilderMockupProps {\n picks: Parameters<typeof productBuilderPicks>[0]\n /** The button's words; the default when blank. */\n label?: string\n /** A priced product's button sits under Buy now; an unpriced one's is the main action. */\n priced: boolean\n /** On the canvas the form stays open, and an empty block says what to drop in. */\n canvas: boolean\n hasRequestForm: boolean\n children?: ReactNode\n}\n\n/** \"Get a free mockup\" and the request form it opens. */\nexport function ProductBuilderMockup(props: ProductBuilderMockupProps) {\n const { picks, label, priced, canvas, hasRequestForm, children } = props\n const [open, setOpen] = useState(false)\n const formRef = useRef<HTMLDivElement>(null)\n const shown = open || canvas\n return (\n <Box sx={{ mb: 2 }}>\n <Button\n variant={priced ? 'text' : 'contained'}\n color=\"primary\"\n size=\"large\"\n aria-expanded={shown}\n onClick={() => {\n setOpen(true)\n // After the form has opened, so it is where the page scrolls to.\n window.setTimeout(() => formRef.current?.scrollIntoView?.({ behavior: 'smooth', block: 'start' }), 50)\n }}\n >\n {label?.trim() || MOCKUP_LABEL_DEFAULT}\n </Button>\n <Collapse in={shown} ref={formRef}>\n <Paper variant=\"outlined\" sx={{ p: 2, mt: 1 }}>\n <ProductBuilderContext.Provider value={productBuilderPicks(picks)}>\n {hasRequestForm ? (\n children\n ) : (\n <Typography variant=\"body2\" color=\"text.secondary\">\n {'Drop a request form here: a form with a Product and options field, the ' +\n 'contact fields and a File upload for artwork. It opens with the shopper’s picks.'}\n </Typography>\n )}\n </ProductBuilderContext.Provider>\n </Paper>\n </Collapse>\n </Box>\n )\n}\n\nProductBuilderMockup.displayName = 'ProductBuilderMockup'\n\nexport default ProductBuilderMockup\n"],"names":["Box","Button","Collapse","Paper","Typography","useRef","useState","ProductBuilderContext","MOCKUP_LABEL_DEFAULT","productBuilderPicks","input","product","variant","addOns","quantity","ready","problem","total","names","group","modifierGroups","option","options","some","pick","groupId","id","optionId","push","name","Object","fromEntries","entries","filter","value","Boolean","productId","productName","variantId","modifiers","map","addOnNames","ProductBuilderMockup","props","picks","label","priced","canvas","hasRequestForm","children","open","setOpen","formRef","shown","sx","mb","color","size","aria-expanded","onClick","window","setTimeout","current","scrollIntoView","behavior","block","trim","in","ref","p","mt","Provider","displayName"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GACD;;;AAEA,OAAOA,SAAS,oBAAmB;AACnC,OAAOC,YAAY,uBAAsB;AACzC,OAAOC,cAAc,yBAAwB;AAC7C,OAAOC,WAAW,sBAAqB;AACvC,OAAOC,gBAAgB,2BAA0B;AACjD,SAASC,MAAM,EAAEC,QAAQ,QAAwB,QAAO;AAExD,SAASC,qBAAqB,QAAkC,+BAA2B;AAE3F;;;;;CAKC,GAED,qEAAqE,GACrE,OAAO,MAAMC,uBAAuB,oBAAmB;AAEvD;;;CAGC,GACD,OAAO,SAASC,oBAAoBC,KAQnC;QAGqBC;IAFpB,MAAM,EAAEA,OAAO,EAAEC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B;IACvC,MAAMgD,QAAQH,QAAQH;IACtB,qBACE,MAAC/C;QAAIsD,IAAI;YAAEC,IAAI;QAAE;;0BACf,KAACtD;gBACCW,SAASkC,SAAS,SAAS;gBAC3BU,OAAM;gBACNC,MAAK;gBACLC,iBAAeL;gBACfM,SAAS;oBACPR,QAAQ;oBACR,iEAAiE;oBACjES,OAAOC,UAAU,CAAC;4BAAMT,iCAAAA;gCAAAA,mBAAAA,QAAQU,OAAO,sBAAfV,kCAAAA,iBAAiBW,cAAc,qBAA/BX,qCAAAA,kBAAkC;4BAAEY,UAAU;4BAAUC,OAAO;wBAAQ;uBAAI;gBACrG;0BAECpB,CAAAA,yBAAAA,MAAOqB,IAAI,OAAM1D;;0BAEpB,KAACN;gBAASiE,IAAId;gBAAOe,KAAKhB;0BACxB,cAAA,KAACjD;oBAAMS,SAAQ;oBAAW0C,IAAI;wBAAEe,GAAG;wBAAGC,IAAI;oBAAE;8BAC1C,cAAA,KAAC/D,sBAAsBgE,QAAQ;wBAACrC,OAAOzB,oBAAoBmC;kCACxDI,iBACCC,yBAEA,KAAC7C;4BAAWQ,SAAQ;4BAAQ4C,OAAM;sCAC/B,4EACC;;;;;;;AAQlB;AAEAd,qBAAqB8B,WAAW,GAAG;AAEnC,eAAe9B,qBAAoB"}
@@ -0,0 +1,63 @@
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
+ /**
18
+ * The canvas's sample for a Product detail block that shows picture cards
19
+ * (AGL-4205): an add-on group with a combo, and a free mockup offered, so the
20
+ * site builder sees every part the builder draws and can design the request
21
+ * form. Its own chunk: only the canvas loads it.
22
+ */
23
+ export declare const SAMPLE_BUILDER: {
24
+ id: string;
25
+ name: string;
26
+ slug: string;
27
+ description: string;
28
+ mediaUrls: string[];
29
+ options: {
30
+ name: string;
31
+ values: string[];
32
+ }[];
33
+ variants: {
34
+ id: string;
35
+ options: {
36
+ Size: string;
37
+ };
38
+ priceUsd: number;
39
+ soldOut: boolean;
40
+ note: string;
41
+ }[];
42
+ modifierGroups: {
43
+ id: string;
44
+ name: string;
45
+ min: number;
46
+ max: number;
47
+ online: boolean;
48
+ options: ({
49
+ id: string;
50
+ name: string;
51
+ priceCents: number;
52
+ note: string;
53
+ includes?: undefined;
54
+ } | {
55
+ id: string;
56
+ name: string;
57
+ priceCents: number;
58
+ includes: string[];
59
+ note?: undefined;
60
+ })[];
61
+ }[];
62
+ mockupRequests: true;
63
+ };