@aglyn/plugins-commerce 1.11.0 → 1.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (122) hide show
  1. package/package.json +13 -13
  2. package/src/lib/components/console/catalog-organization-card.component.js +1 -1
  3. package/src/lib/components/console/catalog-organization-card.component.js.map +1 -1
  4. package/src/lib/components/console/host-quotes-card.component.js +23 -13
  5. package/src/lib/components/console/host-quotes-card.component.js.map +1 -1
  6. package/src/lib/components/console/order-detail-dialog.component.js +1 -1
  7. package/src/lib/components/console/order-detail-dialog.component.js.map +1 -1
  8. package/src/lib/components/console/pay-link-readiness-notice.component.d.ts +1 -1
  9. package/src/lib/components/console/pay-link-readiness-notice.component.js.map +1 -1
  10. package/src/lib/components/console/pos-devices-card.component.js +2 -2
  11. package/src/lib/components/console/pos-devices-card.component.js.map +1 -1
  12. package/src/lib/components/console/pos-kiosk/kiosk-menu.d.ts +10 -3
  13. package/src/lib/components/console/pos-kiosk/kiosk-menu.js +29 -8
  14. package/src/lib/components/console/pos-kiosk/kiosk-menu.js.map +1 -1
  15. package/src/lib/components/console/pos-kiosk/pos-kiosk-api.d.ts +2 -0
  16. package/src/lib/components/console/pos-kiosk/pos-kiosk-api.js +7 -0
  17. package/src/lib/components/console/pos-kiosk/pos-kiosk-api.js.map +1 -1
  18. package/src/lib/components/console/pos-kiosk-page.component.d.ts +2 -0
  19. package/src/lib/components/console/pos-kiosk-page.component.js +54 -3
  20. package/src/lib/components/console/pos-kiosk-page.component.js.map +1 -1
  21. package/src/lib/components/console/pos-ops/pos-check-ins-card.component.js +1 -1
  22. package/src/lib/components/console/pos-ops/pos-check-ins-card.component.js.map +1 -1
  23. package/src/lib/components/console/pos-ops/pos-day-totals-card.component.js +1 -1
  24. package/src/lib/components/console/pos-ops/pos-day-totals-card.component.js.map +1 -1
  25. package/src/lib/components/console/pos-reader-splash-setting.component.js +1 -1
  26. package/src/lib/components/console/pos-reader-splash-setting.component.js.map +1 -1
  27. package/src/lib/components/console/product-add-ons-fields.component.d.ts +0 -2
  28. package/src/lib/components/console/product-add-ons-fields.component.js +1 -6
  29. package/src/lib/components/console/product-add-ons-fields.component.js.map +1 -1
  30. package/src/lib/components/console/quote-editor-dialog.component.d.ts +7 -0
  31. package/src/lib/components/console/quote-editor-dialog.component.js +129 -32
  32. package/src/lib/components/console/quote-editor-dialog.component.js.map +1 -1
  33. package/src/lib/components/console/quote-pay-link.component.d.ts +4 -1
  34. package/src/lib/components/console/quote-pay-link.component.js +23 -12
  35. package/src/lib/components/console/quote-pay-link.component.js.map +1 -1
  36. package/src/lib/components/console/quote-proofs.component.d.ts +3 -2
  37. package/src/lib/components/console/quote-proofs.component.js +73 -5
  38. package/src/lib/components/console/quote-proofs.component.js.map +1 -1
  39. package/src/lib/components/console/quote-send.component.js +9 -6
  40. package/src/lib/components/console/quote-send.component.js.map +1 -1
  41. package/src/lib/components/console/site-member-purchases.component.js +1 -1
  42. package/src/lib/components/console/site-member-purchases.component.js.map +1 -1
  43. package/src/lib/components/product-detail.js +1 -1
  44. package/src/lib/components/product-detail.js.map +1 -1
  45. package/src/lib/components/product-grid.js +5 -3
  46. package/src/lib/components/product-grid.js.map +1 -1
  47. package/src/lib/components/product-reviews.js +17 -12
  48. package/src/lib/components/product-reviews.js.map +1 -1
  49. package/src/lib/components/quote-page-body.js +14 -8
  50. package/src/lib/components/quote-page-body.js.map +1 -1
  51. package/src/lib/components/related-products.js +2 -1
  52. package/src/lib/components/related-products.js.map +1 -1
  53. package/src/lib/model/commerce-invoices.d.ts +1 -1
  54. package/src/lib/model/commerce-invoices.js +4 -1
  55. package/src/lib/model/commerce-invoices.js.map +1 -1
  56. package/src/lib/model/commerce-kiosk-search.d.ts +22 -0
  57. package/src/lib/model/commerce-kiosk-search.js +32 -0
  58. package/src/lib/model/commerce-kiosk-search.js.map +1 -0
  59. package/src/lib/model/commerce-pos-kiosk.d.ts +7 -1
  60. package/src/lib/model/commerce-pos-kiosk.js +1 -1
  61. package/src/lib/model/commerce-pos-kiosk.js.map +1 -1
  62. package/src/lib/model/commerce-quote-email.d.ts +7 -6
  63. package/src/lib/model/commerce-quote-email.js +11 -6
  64. package/src/lib/model/commerce-quote-email.js.map +1 -1
  65. package/src/lib/model/commerce-quote-pay.d.ts +6 -1
  66. package/src/lib/model/commerce-quote-pay.js +18 -8
  67. package/src/lib/model/commerce-quote-pay.js.map +1 -1
  68. package/src/lib/model/commerce-quote-proofs.d.ts +28 -1
  69. package/src/lib/model/commerce-quote-proofs.js +58 -2
  70. package/src/lib/model/commerce-quote-proofs.js.map +1 -1
  71. package/src/lib/model/commerce-quotes.d.ts +22 -1
  72. package/src/lib/model/commerce-quotes.js +25 -5
  73. package/src/lib/model/commerce-quotes.js.map +1 -1
  74. package/src/lib/model/plugin-permissions.d.ts +1 -1
  75. package/src/lib/model/plugin-permissions.js +10 -0
  76. package/src/lib/model/plugin-permissions.js.map +1 -1
  77. package/src/lib/model/product-modifiers.d.ts +4 -0
  78. package/src/lib/model/product-modifiers.js +5 -0
  79. package/src/lib/model/product-modifiers.js.map +1 -1
  80. package/src/lib/server/commerce-pdf.d.ts +1 -1
  81. package/src/lib/server/commerce-pdf.js +1 -1
  82. package/src/lib/server/commerce-pdf.js.map +1 -1
  83. package/src/lib/server/paid-media-delivery.js +1 -1
  84. package/src/lib/server/paid-media-delivery.js.map +1 -1
  85. package/src/lib/server/pos-kiosk.js +70 -15
  86. package/src/lib/server/pos-kiosk.js.map +1 -1
  87. package/src/lib/server/quote-email.js +29 -25
  88. package/src/lib/server/quote-email.js.map +1 -1
  89. package/src/lib/server/quote-pay.js +6 -2
  90. package/src/lib/server/quote-pay.js.map +1 -1
  91. package/src/lib/server/quote-proof-media.d.ts +63 -0
  92. package/src/lib/server/quote-proof-media.js +96 -0
  93. package/src/lib/server/quote-proof-media.js.map +1 -0
  94. package/src/lib/server/quote-proofs.js +17 -8
  95. package/src/lib/server/quote-proofs.js.map +1 -1
  96. package/src/lib/server/quote-uploads.d.ts +3 -1
  97. package/src/lib/server/quote-uploads.js +2 -1
  98. package/src/lib/server/quote-uploads.js.map +1 -1
  99. package/src/lib/server/quote.d.ts +3 -0
  100. package/src/lib/server/quote.js +127 -20
  101. package/src/lib/server/quote.js.map +1 -1
  102. package/src/lib/server/site-page-enricher.js +5 -1
  103. package/src/lib/server/site-page-enricher.js.map +1 -1
  104. package/src/lib/tenant-emails.js +16 -9
  105. package/src/lib/tenant-emails.js.map +1 -1
  106. package/src/lib/testing/fake-firestore.js +34 -5
  107. package/src/lib/testing/fake-firestore.js.map +1 -1
  108. package/src/lib/transfer/gift-cards.server.js +9 -11
  109. package/src/lib/transfer/gift-cards.server.js.map +1 -1
  110. package/src/lib/transfer/product-register-cells.d.ts +75 -0
  111. package/src/lib/transfer/product-register-cells.js +487 -0
  112. package/src/lib/transfer/product-register-cells.js.map +1 -0
  113. package/src/lib/transfer/product-transfer.d.ts +12 -0
  114. package/src/lib/transfer/product-transfer.js +174 -10
  115. package/src/lib/transfer/product-transfer.js.map +1 -1
  116. package/src/lib/transfer/products.server.js +24 -9
  117. package/src/lib/transfer/products.server.js.map +1 -1
  118. package/src/lib/utils/commerce-document-pdf.js +12 -9
  119. package/src/lib/utils/commerce-document-pdf.js.map +1 -1
  120. package/src/lib/utils/quote-email-content.d.ts +2 -0
  121. package/src/lib/utils/quote-email-content.js +20 -10
  122. package/src/lib/utils/quote-email-content.js.map +1 -1
@@ -15,10 +15,11 @@
15
15
  * limitations under the License.
16
16
  */ 'use client';
17
17
  import { _ as _extends } from "@swc/helpers/_/_extends";
18
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
18
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
19
19
  import * as CommerceModel from "../../model/index.js";
20
20
  import { posMoney } from "../../model/commerce-pos-ops.js";
21
21
  import { commerceSitePermissionRefusal } from "../../model/plugin-permissions.js";
22
+ import { useMediaPicker } from "@aglyn/aglyn/app-utils/media-picker-context";
22
23
  import { BlockedControl } from "@aglyn/shared-ui-jsx/components/blocked-control.component";
23
24
  import { useSnackbar } from "@aglyn/shared-ui-snackstack";
24
25
  import { authorizedFetch } from "@aglyn/shared-util-http/authorized-token";
@@ -187,6 +188,8 @@ function addressBody(address) {
187
188
  /** What the server is sent: choices, never what a product costs. */ function quoteBody(form) {
188
189
  var _centsOf;
189
190
  const discountCents = centsOf(form.discountValue);
191
+ // With no lines there is nothing to discount or ship (AGL-4184).
192
+ const priced = form.lines.length > 0;
190
193
  return {
191
194
  lines: form.lines.map(lineRequest),
192
195
  customer: _extends({}, form.customer.record ? {
@@ -199,14 +202,14 @@ function addressBody(address) {
199
202
  }),
200
203
  shipTo: addressBody(form.shipTo),
201
204
  billTo: addressBody(form.billTo),
202
- discount: form.discountKind === 'amount' ? {
205
+ discount: !priced ? null : form.discountKind === 'amount' ? {
203
206
  kind: 'amount',
204
207
  amountCents: discountCents != null ? discountCents : Number.NaN
205
208
  } : form.discountKind === 'percent' ? {
206
209
  kind: 'percent',
207
210
  pct: Number(form.discountValue || 0)
208
211
  } : null,
209
- shipping: form.shipping.trim() ? {
212
+ shipping: priced && form.shipping.trim() ? {
210
213
  amountCents: (_centsOf = centsOf(form.shipping)) != null ? _centsOf : Number.NaN
211
214
  } : null,
212
215
  notes: form.notes,
@@ -220,14 +223,23 @@ function addressBody(address) {
220
223
  * shipping, notes and terms, with the totals worked out as it is edited. The
221
224
  * server prices and saves it; the totals here are the same function's answer
222
225
  * over the same inputs, and a connected tax service's figure arrives on save.
226
+ * A saved quote left as it is shows what its customer's page shows instead
227
+ * (AGL-4162): that is what the customer is charged until a save re-prices it.
228
+ *
229
+ * A quote may be saved with no items when it has a proof (AGL-4184), which is
230
+ * how a design goes out before it has a price: the editor then has no money to
231
+ * show, and an item added later makes it a normal quote. A new quote has
232
+ * nothing to upload a proof for yet, so it takes its first from the media library.
223
233
  */ export function QuoteEditorDialog(props) {
224
- var _props_start, _centsOf, _ref, _start_files, _ref1;
225
- var _quote_quote_tax, _quote_quote, _quote_quote1, _quote_quote2, _quote_quote3;
234
+ var _props_start, _centsOf, _ref, _start_files, _ref1, _ref2, _ref3;
235
+ var _quote_quote, _quote_quote1, _quote_quote2;
226
236
  const { hostId, quote, products, canEdit, canSend, onClose } = props;
227
237
  const start = quote ? null : (_props_start = props.start) != null ? _props_start : null;
228
238
  const firestore = useFirestore();
229
239
  const { data: user } = useUser();
230
240
  const { enqueueSnackbar } = useSnackbar();
241
+ const { pickMedia } = useMediaPicker();
242
+ /** A new quote's proofs, chosen from the media library and kept when it is created. */ const [libraryProofs, setLibraryProofs] = useState([]);
231
243
  const { data: store } = useFirestoreDoc(()=>doc(firestore, 'hosts', hostId, 'settings', 'store'), [
232
244
  firestore,
233
245
  hostId
@@ -267,7 +279,28 @@ function addressBody(address) {
267
279
  useEffect(()=>{
268
280
  attemptKey.current = '';
269
281
  }, [
270
- form
282
+ form,
283
+ libraryProofs
284
+ ]);
285
+ const proofOnly = form.lines.length === 0 && (libraryProofs.length > 0 || CommerceModel.currentQuoteProofs(quote == null ? void 0 : quote.quote).length > 0);
286
+ const chooseLibraryProof = useCallback(async ()=>{
287
+ const picked = await (pickMedia == null ? void 0 : pickMedia({
288
+ allowPrivate: true
289
+ }));
290
+ if (!picked) return;
291
+ const problem = CommerceModel.quoteLibraryProofProblem(picked);
292
+ if (problem) return void enqueueSnackbar(problem, {
293
+ variant: 'error',
294
+ allowDuplicate: true
295
+ });
296
+ setEdited(true);
297
+ setLibraryProofs((prev)=>prev.some((entry)=>entry.mediaId === picked.mediaId && entry.mediaScope === picked.mediaScope) ? prev : [
298
+ ...prev,
299
+ picked
300
+ ]);
301
+ }, [
302
+ pickMedia,
303
+ enqueueSnackbar
271
304
  ]);
272
305
  const productsById = useMemo(()=>new Map(products.map((product)=>[
273
306
  String(product.$id),
@@ -330,7 +363,17 @@ function addressBody(address) {
330
363
  tax: taxBasis
331
364
  });
332
365
  const problems = priced.some((entry)=>'error' in entry);
333
- const savedService = (quote == null ? void 0 : (_quote_quote = quote.quote) == null ? void 0 : (_quote_quote_tax = _quote_quote.tax) == null ? void 0 : _quote_quote_tax.kind) === 'service' ? quote.quote.tax : null;
366
+ // Every save re-prices the lines and re-bases the tax on the store's settings
367
+ // (`priceQuote` in `server/quote.ts`), so any edit shows what that save will
368
+ // store. Until then a saved quote is what its customer's page says, from the
369
+ // stored lines under `quotePayTax`, and a paid one its recorded totals.
370
+ const asSaved = quote && !edited ? CommerceModel.buildQuotePageView({
371
+ order: quote,
372
+ orderId: quote.$id,
373
+ storeName: '',
374
+ currency: '',
375
+ store: CommerceModel.payLinkStoreOf(store)
376
+ }) : null;
334
377
  const save = useCallback(async ()=>{
335
378
  setBusy(true);
336
379
  try {
@@ -358,7 +401,12 @@ function addressBody(address) {
358
401
  quote: quoteBody(_extends({}, form, {
359
402
  requireProofApproval
360
403
  }))
361
- }))
404
+ }, !quote && libraryProofs.length ? {
405
+ libraryProofs: libraryProofs.map(({ mediaScope, mediaId })=>({
406
+ mediaScope,
407
+ mediaId
408
+ }))
409
+ } : {}))
362
410
  });
363
411
  const payload = await response.json().catch(()=>({}));
364
412
  if (!response.ok) {
@@ -386,6 +434,7 @@ function addressBody(address) {
386
434
  start,
387
435
  form,
388
436
  requireProofApproval,
437
+ libraryProofs,
389
438
  enqueueSnackbar,
390
439
  onClose
391
440
  ]);
@@ -462,7 +511,7 @@ function addressBody(address) {
462
511
  const paid = quote ? !CommerceModel.isUnpaidQuote(quote) : false;
463
512
  const title = quote ? CommerceModel.formatQuoteNumber(quote, quote.$id) : 'New quote';
464
513
  const status = quote ? CommerceModel.quoteDisplayStatus(quote) : null;
465
- const deletable = Boolean(quote) && !paid && ((_ref = quote == null ? void 0 : (_quote_quote1 = quote.quote) == null ? void 0 : _quote_quote1.stage) != null ? _ref : 'draft') === 'draft';
514
+ const deletable = Boolean(quote) && !paid && ((_ref = quote == null ? void 0 : (_quote_quote = quote.quote) == null ? void 0 : _quote_quote.stage) != null ? _ref : 'draft') === 'draft';
466
515
  return /*#__PURE__*/ _jsxs(Dialog, {
467
516
  open: true,
468
517
  onClose: busy ? undefined : onClose,
@@ -488,6 +537,11 @@ function addressBody(address) {
488
537
  variant: "outlined",
489
538
  label: status.label,
490
539
  color: CommerceModel.QUOTE_STATUS_COLOR[status.key]
540
+ }) : null,
541
+ proofOnly ? /*#__PURE__*/ _jsx(Chip, {
542
+ size: "small",
543
+ variant: "outlined",
544
+ label: "Proof only"
491
545
  }) : null
492
546
  ]
493
547
  })
@@ -499,7 +553,7 @@ function addressBody(address) {
499
553
  children: [
500
554
  paid ? /*#__PURE__*/ _jsx(Alert, {
501
555
  severity: "success",
502
- children: (quote == null ? void 0 : (_quote_quote2 = quote.quote) == null ? void 0 : _quote_quote2.paidAtMs) ? `Paid ${new Date(quote.quote.paidAtMs).toLocaleDateString()}. It is an order now and can no longer be changed.` : 'This quote has been paid, so it is an order now and can no longer be changed.'
556
+ children: (quote == null ? void 0 : (_quote_quote1 = quote.quote) == null ? void 0 : _quote_quote1.paidAtMs) ? `Paid ${new Date(quote.quote.paidAtMs).toLocaleDateString()}. It is an order now and can no longer be changed.` : 'This quote has been paid, so it is an order now and can no longer be changed.'
503
557
  }) : null,
504
558
  quote ? /*#__PURE__*/ _jsx(QuoteSendSection, {
505
559
  hostId: hostId,
@@ -530,12 +584,12 @@ function addressBody(address) {
530
584
  files: (_start_files = start.files) != null ? _start_files : [],
531
585
  threaded: start.threaded === true
532
586
  }) : null,
533
- (quote == null ? void 0 : (_quote_quote3 = quote.quote) == null ? void 0 : _quote_quote3.request) ? /*#__PURE__*/ _jsx(QuoteRequestFilesSection, {
587
+ (quote == null ? void 0 : (_quote_quote2 = quote.quote) == null ? void 0 : _quote_quote2.request) ? /*#__PURE__*/ _jsx(QuoteRequestFilesSection, {
534
588
  hostId: hostId,
535
589
  quoteId: quote.$id,
536
590
  quote: quote
537
591
  }) : null,
538
- quote ? null : /*#__PURE__*/ _jsx(PayLinkReadinessNoticeFor, {
592
+ quote || proofOnly ? null : /*#__PURE__*/ _jsx(PayLinkReadinessNoticeFor, {
539
593
  hostId: hostId,
540
594
  order: null,
541
595
  noun: "quote"
@@ -548,6 +602,48 @@ function addressBody(address) {
548
602
  customer
549
603
  })
550
604
  }),
605
+ !quote && pickMedia ? /*#__PURE__*/ _jsxs(Stack, {
606
+ spacing: 1,
607
+ children: [
608
+ /*#__PURE__*/ _jsx(Typography, {
609
+ variant: "subtitle2",
610
+ children: 'Proofs'
611
+ }),
612
+ /*#__PURE__*/ _jsx(Typography, {
613
+ variant: "body2",
614
+ color: "text.secondary",
615
+ children: 'Sending a design before it has a price? Choose a proof and leave the items empty. ' + 'Your customer sees the proof with no prices, and can approve it or ask for changes. Add items whenever you’re ready.'
616
+ }),
617
+ libraryProofs.length ? /*#__PURE__*/ _jsx(Stack, {
618
+ direction: "row",
619
+ spacing: 1,
620
+ useFlexGap: true,
621
+ sx: {
622
+ flexWrap: 'wrap'
623
+ },
624
+ children: libraryProofs.map((proof)=>/*#__PURE__*/ _jsx(Chip, {
625
+ size: "small",
626
+ variant: "outlined",
627
+ label: proof.fileName || 'Proof',
628
+ onDelete: readOnly ? undefined : ()=>setLibraryProofs((prev)=>prev.filter((entry)=>entry !== proof))
629
+ }, `${proof.mediaScope}-${proof.mediaId}`))
630
+ }) : null,
631
+ /*#__PURE__*/ _jsx(BlockedControl, {
632
+ blocked: !canEdit,
633
+ reason: REFUSAL,
634
+ children: /*#__PURE__*/ _jsx(Button, {
635
+ size: "small",
636
+ variant: "outlined",
637
+ disabled: busy || libraryProofs.length >= CommerceModel.QUOTE_MAX_PROOFS,
638
+ onClick: ()=>void chooseLibraryProof(),
639
+ sx: {
640
+ alignSelf: 'flex-start'
641
+ },
642
+ children: 'From media library'
643
+ })
644
+ })
645
+ ]
646
+ }) : null,
551
647
  /*#__PURE__*/ _jsxs(Stack, {
552
648
  spacing: 1.5,
553
649
  children: [
@@ -623,7 +719,7 @@ function addressBody(address) {
623
719
  })
624
720
  ]
625
721
  }),
626
- /*#__PURE__*/ _jsxs(Stack, {
722
+ proofOnly ? null : /*#__PURE__*/ _jsxs(Stack, {
627
723
  direction: {
628
724
  xs: 'column',
629
725
  sm: 'row'
@@ -728,7 +824,7 @@ function addressBody(address) {
728
824
  terms: event.target.value
729
825
  })
730
826
  }),
731
- /*#__PURE__*/ _jsx(FormControlLabel, {
827
+ proofOnly ? null : /*#__PURE__*/ _jsx(FormControlLabel, {
732
828
  control: /*#__PURE__*/ _jsx(Switch, {
733
829
  checked: requireProofApproval,
734
830
  disabled: readOnly || paid,
@@ -740,12 +836,15 @@ function addressBody(address) {
740
836
  })
741
837
  ]
742
838
  }),
743
- /*#__PURE__*/ _jsx(Divider, {}),
744
- /*#__PURE__*/ _jsx(QuoteTotalsSummary, {
745
- totals: totals,
746
- tax: taxBasis,
747
- savedService: edited ? null : savedService,
748
- savedTotals: edited ? null : (_ref1 = quote == null ? void 0 : quote.totals) != null ? _ref1 : null
839
+ proofOnly ? null : /*#__PURE__*/ _jsxs(_Fragment, {
840
+ children: [
841
+ /*#__PURE__*/ _jsx(Divider, {}),
842
+ /*#__PURE__*/ _jsx(QuoteTotalsSummary, {
843
+ totals: (_ref1 = asSaved == null ? void 0 : asSaved.totals) != null ? _ref1 : totals,
844
+ taxLabel: (_ref2 = asSaved == null ? void 0 : asSaved.taxLabel) != null ? _ref2 : CommerceModel.describeQuoteTax(taxBasis),
845
+ taxAtPayment: (_ref3 = asSaved == null ? void 0 : asSaved.taxAtPayment) != null ? _ref3 : totals.taxAtPayment
846
+ })
847
+ ]
749
848
  })
750
849
  ]
751
850
  })
@@ -769,7 +868,7 @@ function addressBody(address) {
769
868
  children: 'Delete'
770
869
  })
771
870
  }) : null,
772
- quote ? /*#__PURE__*/ _jsx(BlockedControl, {
871
+ quote && !proofOnly ? /*#__PURE__*/ _jsx(BlockedControl, {
773
872
  blocked: !canEdit || edited,
774
873
  reason: edited ? 'Save your changes first: the PDF shows the quote as it was last saved.' : REFUSAL,
775
874
  children: /*#__PURE__*/ _jsx(Button, {
@@ -788,9 +887,9 @@ function addressBody(address) {
788
887
  reason: REFUSAL,
789
888
  children: /*#__PURE__*/ _jsx(Button, {
790
889
  variant: "contained",
791
- disabled: busy || form.lines.length === 0 || problems,
890
+ disabled: busy || form.lines.length === 0 && !proofOnly || problems,
792
891
  onClick: ()=>void save(),
793
- children: quote ? 'Save' : 'Create quote'
892
+ children: quote ? 'Save' : proofOnly ? 'Create proof' : 'Create quote'
794
893
  })
795
894
  })
796
895
  ]
@@ -1366,9 +1465,7 @@ QuoteEditorDialog.displayName = 'QuoteEditorDialog';
1366
1465
  });
1367
1466
  }
1368
1467
  /** The quote's totals, as the customer will read them. */ function QuoteTotalsSummary(props) {
1369
- const { totals, tax, savedService, savedTotals } = props;
1370
- const shown = savedService && savedTotals ? _extends({}, totals, savedTotals) : totals;
1371
- const taxLabel = CommerceModel.describeQuoteTax(savedService != null ? savedService : tax);
1468
+ const { totals, taxLabel, taxAtPayment } = props;
1372
1469
  const row = (label, value, strong = false)=>/*#__PURE__*/ _jsxs(Stack, {
1373
1470
  direction: "row",
1374
1471
  sx: {
@@ -1397,15 +1494,15 @@ QuoteEditorDialog.displayName = 'QuoteEditorDialog';
1397
1494
  }
1398
1495
  }),
1399
1496
  children: [
1400
- row('Items', money(shown.itemsCents)),
1401
- shown.discountCents ? row('Discount', `−${money(shown.discountCents)}`) : null,
1402
- shown.shippingCents ? row('Shipping', money(shown.shippingCents)) : null,
1403
- tax.kind === 'at-payment' && !savedService ? /*#__PURE__*/ _jsx(Typography, {
1497
+ row('Items', money(totals.itemsCents)),
1498
+ totals.discountCents ? row('Discount', `−${money(totals.discountCents)}`) : null,
1499
+ totals.shippingCents ? row('Shipping', money(totals.shippingCents)) : null,
1500
+ taxAtPayment ? /*#__PURE__*/ _jsx(Typography, {
1404
1501
  variant: "body2",
1405
1502
  color: "text.secondary",
1406
1503
  children: taxLabel
1407
- }) : row(taxLabel, money(shown.taxCents)),
1408
- row(totals.taxAtPayment && !savedService ? 'Total before tax' : 'Total', money(shown.totalCents), true)
1504
+ }) : row(taxLabel, money(totals.taxCents)),
1505
+ row(taxAtPayment ? 'Total before tax' : 'Total', money(totals.totalCents), true)
1409
1506
  ]
1410
1507
  });
1411
1508
  }