@aglyn/plugins-commerce 1.11.0 → 1.12.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 (51) hide show
  1. package/package.json +13 -13
  2. package/src/lib/components/console/host-quotes-card.component.js +20 -11
  3. package/src/lib/components/console/host-quotes-card.component.js.map +1 -1
  4. package/src/lib/components/console/pos-kiosk/kiosk-menu.d.ts +10 -3
  5. package/src/lib/components/console/pos-kiosk/kiosk-menu.js +29 -8
  6. package/src/lib/components/console/pos-kiosk/kiosk-menu.js.map +1 -1
  7. package/src/lib/components/console/pos-kiosk/pos-kiosk-api.d.ts +2 -0
  8. package/src/lib/components/console/pos-kiosk/pos-kiosk-api.js +7 -0
  9. package/src/lib/components/console/pos-kiosk/pos-kiosk-api.js.map +1 -1
  10. package/src/lib/components/console/pos-kiosk-page.component.d.ts +2 -0
  11. package/src/lib/components/console/pos-kiosk-page.component.js +54 -3
  12. package/src/lib/components/console/pos-kiosk-page.component.js.map +1 -1
  13. package/src/lib/components/console/product-add-ons-fields.component.d.ts +0 -2
  14. package/src/lib/components/console/product-add-ons-fields.component.js +1 -6
  15. package/src/lib/components/console/product-add-ons-fields.component.js.map +1 -1
  16. package/src/lib/components/console/quote-editor-dialog.component.d.ts +2 -0
  17. package/src/lib/components/console/quote-editor-dialog.component.js +28 -19
  18. package/src/lib/components/console/quote-editor-dialog.component.js.map +1 -1
  19. package/src/lib/components/product-detail.js +1 -1
  20. package/src/lib/components/product-detail.js.map +1 -1
  21. package/src/lib/components/product-grid.js +5 -3
  22. package/src/lib/components/product-grid.js.map +1 -1
  23. package/src/lib/components/product-reviews.js +17 -12
  24. package/src/lib/components/product-reviews.js.map +1 -1
  25. package/src/lib/components/related-products.js +2 -1
  26. package/src/lib/components/related-products.js.map +1 -1
  27. package/src/lib/model/commerce-kiosk-search.d.ts +22 -0
  28. package/src/lib/model/commerce-kiosk-search.js +32 -0
  29. package/src/lib/model/commerce-kiosk-search.js.map +1 -0
  30. package/src/lib/model/commerce-pos-kiosk.d.ts +7 -1
  31. package/src/lib/model/commerce-pos-kiosk.js +1 -1
  32. package/src/lib/model/commerce-pos-kiosk.js.map +1 -1
  33. package/src/lib/model/product-modifiers.d.ts +4 -0
  34. package/src/lib/model/product-modifiers.js +5 -0
  35. package/src/lib/model/product-modifiers.js.map +1 -1
  36. package/src/lib/server/pos-kiosk.js +70 -15
  37. package/src/lib/server/pos-kiosk.js.map +1 -1
  38. package/src/lib/server/quote-proofs.js +8 -3
  39. package/src/lib/server/quote-proofs.js.map +1 -1
  40. package/src/lib/server/site-page-enricher.js +5 -1
  41. package/src/lib/server/site-page-enricher.js.map +1 -1
  42. package/src/lib/testing/fake-firestore.js +34 -5
  43. package/src/lib/testing/fake-firestore.js.map +1 -1
  44. package/src/lib/transfer/product-register-cells.d.ts +75 -0
  45. package/src/lib/transfer/product-register-cells.js +487 -0
  46. package/src/lib/transfer/product-register-cells.js.map +1 -0
  47. package/src/lib/transfer/product-transfer.d.ts +12 -0
  48. package/src/lib/transfer/product-transfer.js +174 -10
  49. package/src/lib/transfer/product-transfer.js.map +1 -1
  50. package/src/lib/transfer/products.server.js +24 -9
  51. package/src/lib/transfer/products.server.js.map +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aglyn/plugins-commerce",
3
- "version": "1.11.0",
3
+ "version": "1.12.0",
4
4
  "license": "Apache-2.0",
5
5
  "homepage": "https://aglyn.com",
6
6
  "repository": {
@@ -25,18 +25,18 @@
25
25
  "./package.json": "./package.json"
26
26
  },
27
27
  "dependencies": {
28
- "@aglyn/aglyn": "1.11.0",
29
- "@aglyn/shared-data-mdi": "1.11.0",
30
- "@aglyn/shared-ui-jsx": "1.11.0",
31
- "@aglyn/shared-ui-next": "1.11.0",
32
- "@aglyn/shared-ui-snackstack": "1.11.0",
33
- "@aglyn/shared-util-email": "1.11.0",
34
- "@aglyn/shared-util-http": "1.11.0",
35
- "@aglyn/shared-util-timestamp": "1.11.0",
36
- "@aglyn/shared-util-tools": "1.11.0",
37
- "@aglyn/tenant-data-admin": "1.11.0",
38
- "@aglyn/tenant-feature-instance": "1.11.0",
39
- "@aglyn/tenant-runtime": "1.11.0",
28
+ "@aglyn/aglyn": "1.12.0",
29
+ "@aglyn/shared-data-mdi": "1.12.0",
30
+ "@aglyn/shared-ui-jsx": "1.12.0",
31
+ "@aglyn/shared-ui-next": "1.12.0",
32
+ "@aglyn/shared-ui-snackstack": "1.12.0",
33
+ "@aglyn/shared-util-email": "1.12.0",
34
+ "@aglyn/shared-util-http": "1.12.0",
35
+ "@aglyn/shared-util-timestamp": "1.12.0",
36
+ "@aglyn/shared-util-tools": "1.12.0",
37
+ "@aglyn/tenant-data-admin": "1.12.0",
38
+ "@aglyn/tenant-feature-instance": "1.12.0",
39
+ "@aglyn/tenant-runtime": "1.12.0",
40
40
  "@stripe/react-stripe-js": "^6.12.0",
41
41
  "@stripe/stripe-js": "^9.17.0",
42
42
  "@swc/helpers": "0.5.23",
@@ -23,9 +23,9 @@ import { pluginDocsHelp } from "@aglyn/aglyn";
23
23
  import { CardDisplay } from "@aglyn/shared-ui-jsx";
24
24
  import { BlockedControl } from "@aglyn/shared-ui-jsx/components/blocked-control.component";
25
25
  import { ListTable } from "@aglyn/shared-ui-jsx/components/list-table.component";
26
- import { ceilingedWindow, collectionCeiling, useFirestore, useFirestoreCollection } from "@aglyn/tenant-feature-instance";
26
+ import { ceilingedWindow, collectionCeiling, useFirestore, useFirestoreCollection, useFirestoreDoc } from "@aglyn/tenant-feature-instance";
27
27
  import { Button, Chip, Stack, Typography } from "@mui/material";
28
- import { collection, limit, query, where } from "firebase/firestore";
28
+ import { collection, doc, limit, query, where } from "firebase/firestore";
29
29
  import { useSearchParams } from "next/navigation";
30
30
  import { useEffect, useMemo, useRef, useState } from "react";
31
31
  import QuoteEditorDialog from "./quote-editor-dialog.component.js";
@@ -35,7 +35,7 @@ import QuoteEditorDialog from "./quote-editor-dialog.component.js";
35
35
  */ const QUOTE_CEILING = 500;
36
36
  /** The products the editor's picker offers. */ const PRODUCT_WINDOW = 200;
37
37
  const REFUSAL = commerceSitePermissionRefusal('commerce.quotes');
38
- /** One quote as its row draws and sorts it. */ function quoteListRow(quote) {
38
+ /** One quote as its row draws and sorts it, under the store's sales tax choice. */ function quoteListRow(quote, store) {
39
39
  var _quote_lineItems, _ref, _ref1, _ref2, _ref3;
40
40
  var _quote_quote, _items_, _quote_totals, _quote_quote1, _CommerceModel_latestQuoteResponse;
41
41
  const customer = (_quote_quote = quote.quote) == null ? void 0 : _quote_quote.customer;
@@ -47,6 +47,9 @@ const REFUSAL = commerceSitePermissionRefusal('commerce.quotes');
47
47
  moreItems: Math.max(0, items.length - 1),
48
48
  statusKey: status.key,
49
49
  statusLabel: status.label,
50
+ // `quotePayTax`, as the pay page reads it (AGL-4162): a quote saved before
51
+ // the store chose its sales tax takes the choice as it stands now.
52
+ taxAtPayment: CommerceModel.isUnpaidQuote(quote) && CommerceModel.quotePayTax(quote.quote, store).basis.kind === 'at-payment',
50
53
  totalCents: Number((_ref1 = (_quote_totals = quote.totals) == null ? void 0 : _quote_totals.totalCents) != null ? _ref1 : 0),
51
54
  // The customer's latest answer counts as an update (AGL-4096), so a quote
52
55
  // they just approved or asked changes to sorts to the top.
@@ -71,8 +74,17 @@ const REFUSAL = commerceSitePermissionRefusal('commerce.quotes');
71
74
  const quotes = useMemo(()=>ceilingedWindow(quoteDocs != null ? quoteDocs : undefined, QUOTE_CEILING), [
72
75
  quoteDocs
73
76
  ]);
74
- const rows = useMemo(()=>Array.from(quotes.rows, quoteListRow), [
75
- quotes
77
+ // One read for the whole list. Until it answers, each quote's saved basis stands.
78
+ const { data: storeSettings } = useFirestoreDoc(()=>doc(firestore, 'hosts', hostId, 'settings', 'store'), [
79
+ firestore,
80
+ hostId
81
+ ]);
82
+ const rows = useMemo(()=>{
83
+ const store = CommerceModel.payLinkStoreOf(storeSettings);
84
+ return quotes.rows.map((quote)=>quoteListRow(quote, store));
85
+ }, [
86
+ quotes,
87
+ storeSettings
76
88
  ]);
77
89
  const { data: productDocs } = useFirestoreCollection(()=>collectionCeiling(collection(firestore, 'hosts', hostId, 'products'), PRODUCT_WINDOW), [
78
90
  firestore,
@@ -143,9 +155,7 @@ const REFUSAL = commerceSitePermissionRefusal('commerce.quotes');
143
155
  width: 140,
144
156
  align: 'right',
145
157
  headerAlign: 'right',
146
- renderCell: ({ row })=>{
147
- var _row_quote_tax, _row_quote;
148
- return /*#__PURE__*/ _jsxs(Stack, {
158
+ renderCell: ({ row })=>/*#__PURE__*/ _jsxs(Stack, {
149
159
  sx: {
150
160
  alignItems: 'flex-end',
151
161
  minWidth: 0,
@@ -156,15 +166,14 @@ const REFUSAL = commerceSitePermissionRefusal('commerce.quotes');
156
166
  variant: "body2",
157
167
  children: posMoney(row.totalCents)
158
168
  }),
159
- ((_row_quote = row.quote) == null ? void 0 : (_row_quote_tax = _row_quote.tax) == null ? void 0 : _row_quote_tax.kind) === 'at-payment' && CommerceModel.isUnpaidQuote(row) ? /*#__PURE__*/ _jsx(Typography, {
169
+ row.taxAtPayment ? /*#__PURE__*/ _jsx(Typography, {
160
170
  variant: "caption",
161
171
  color: "text.secondary",
162
172
  noWrap: true,
163
173
  children: 'plus tax at payment'
164
174
  }) : null
165
175
  ]
166
- });
167
- }
176
+ })
168
177
  },
169
178
  {
170
179
  field: 'statusLabel',
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../../libs/plugins/commerce/src/lib/components/console/host-quotes-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 { posMoney } from '../../model/commerce-pos-ops'\nimport { commerceSitePermissionRefusal } from '../../model/plugin-permissions'\nimport { pluginDocsHelp } from '@aglyn/aglyn'\nimport { CardDisplay } from '@aglyn/shared-ui-jsx'\nimport { BlockedControl } from '@aglyn/shared-ui-jsx/components/blocked-control.component'\nimport { ListTable } from '@aglyn/shared-ui-jsx/components/list-table.component'\nimport {\n ceilingedWindow,\n collectionCeiling,\n useFirestore,\n useFirestoreCollection,\n} from '@aglyn/tenant-feature-instance'\nimport { Button, Chip, Stack, Typography } from '@mui/material'\nimport type { GridColDef } from '@mui/x-data-grid'\nimport { collection, limit, query, where } from 'firebase/firestore'\nimport { useSearchParams } from 'next/navigation'\nimport { useEffect, useMemo, useRef, useState } from 'react'\nimport QuoteEditorDialog, { type QuoteRow } from './quote-editor-dialog.component'\n\nexport interface HostQuotesCardProps {\n hostId: string\n /** Holds \"Create and edit quotes\" (`commerce.quotes`). */\n canEdit: boolean\n /** Holds \"Send quotes and invoices to customers\" (`commerce.quotes.send`). */\n canSend: boolean\n}\n\n/**\n * How many quotes the list reads. The whole set is read and the grid sorts\n * it by any column; a store past this many is told the list stops short.\n */\nconst QUOTE_CEILING = 500\n\n/** The products the editor's picker offers. */\nconst PRODUCT_WINDOW = 200\n\nconst REFUSAL = commerceSitePermissionRefusal('commerce.quotes')\n\ninterface QuoteListRow extends QuoteRow {\n customerLabel: string\n firstItem: string\n moreItems: number\n statusKey: ReturnType<typeof CommerceModel.quoteDisplayStatus>['key']\n statusLabel: string\n totalCents: number\n updatedAtMs: number\n}\n\n/** One quote as its row draws and sorts it. */\nfunction quoteListRow(quote: QuoteRow): QuoteListRow {\n const customer = quote.quote?.customer\n const status = CommerceModel.quoteDisplayStatus(quote)\n const items = quote.lineItems ?? []\n return {\n ...quote,\n customerLabel: customer?.name || customer?.company || customer?.email || '',\n firstItem: items[0]?.name ?? '',\n moreItems: Math.max(0, items.length - 1),\n statusKey: status.key,\n statusLabel: status.label,\n totalCents: Number(quote.totals?.totalCents ?? 0),\n // The customer's latest answer counts as an update (AGL-4096), so a quote\n // they just approved or asked changes to sorts to the top.\n updatedAtMs: Math.max(\n Number(quote.quote?.updatedAtMs ?? 0),\n Number(CommerceModel.latestQuoteResponse(quote.quote)?.atMs ?? 0),\n ),\n }\n}\n\n/**\n * Quotes (AGL-4093): prices put to a customer before they buy, beside the\n * orders they become. A quote is an unpaid order on the `quote` channel, so\n * this reads `hosts/{hostId}/orders` for that channel alone; the Orders list\n * above never shows one until it is paid.\n */\nexport function HostQuotesCard(props: HostQuotesCardProps) {\n const { hostId, canEdit, canSend } = props\n const firestore = useFirestore()\n const { data: quoteDocs, status } = useFirestoreCollection<QuoteRow>(\n () =>\n query(\n collection(firestore, 'hosts', hostId, 'orders'),\n where('channel', '==', 'quote'),\n limit(QUOTE_CEILING + 1),\n ),\n [firestore, hostId],\n { idField: '$id' },\n )\n const quotes = useMemo(() => ceilingedWindow<QuoteRow>(quoteDocs ?? undefined, QUOTE_CEILING), [quoteDocs])\n const rows = useMemo(() => Array.from(quotes.rows, quoteListRow), [quotes])\n\n const { data: productDocs } = useFirestoreCollection<Record<string, any>>(\n () => collectionCeiling(collection(firestore, 'hosts', hostId, 'products'), PRODUCT_WINDOW),\n [firestore, hostId],\n { idField: '$id' },\n )\n const products = useMemo(\n () => ceilingedWindow<Record<string, any>>(productDocs ?? undefined, PRODUCT_WINDOW).rows.filter((product) => !product['deletedAt']),\n [productDocs],\n )\n\n /** The quote open in the editor: its id, or `new`. */\n const [openId, setOpenId] = useState<string | null>(null)\n const openQuote = openId && openId !== 'new' ? (quotes.rows.find((row) => row.$id === openId) ?? null) : null\n\n // A manager notice opens its quote (AGL-4096): `?quote=<id>` on the Orders\n // page, once that quote has loaded. Read from the router, so a notice\n // followed while this page is already open opens its quote too; once per\n // id, so closing the dialog does not reopen it.\n const searchParams = useSearchParams()\n const linkedId = searchParams?.get('quote') ?? ''\n const opened = useRef('')\n useEffect(() => {\n if (!linkedId || opened.current === linkedId || !quotes.rows.some((row) => row.$id === linkedId)) return\n opened.current = linkedId\n setOpenId(linkedId)\n }, [linkedId, quotes.rows])\n\n const columns = useMemo<GridColDef[]>(\n () => [\n {\n field: 'number',\n headerName: 'Quote',\n flex: 1,\n minWidth: 160,\n renderCell: ({ row }: { row: QuoteListRow }) => (\n <Stack sx={{ minWidth: 0 }}>\n <Typography variant=\"body2\" noWrap>\n {CommerceModel.formatQuoteNumber(row, row.$id)}\n </Typography>\n <Typography variant=\"caption\" color=\"text.secondary\" noWrap>\n {row.moreItems ? `${row.firstItem} and more` : row.firstItem}\n </Typography>\n </Stack>\n ),\n },\n {\n field: 'customerLabel',\n headerName: 'Customer',\n flex: 1,\n minWidth: 160,\n renderCell: ({ row }: { row: QuoteListRow }) => (\n <Typography variant=\"body2\" noWrap>\n {row.customerLabel || '—'}\n </Typography>\n ),\n },\n {\n field: 'totalCents',\n headerName: 'Total',\n type: 'number',\n width: 140,\n align: 'right',\n headerAlign: 'right',\n renderCell: ({ row }: { row: QuoteListRow }) => (\n <Stack sx={{ alignItems: 'flex-end', minWidth: 0, width: 1 }}>\n <Typography variant=\"body2\">{posMoney(row.totalCents)}</Typography>\n {row.quote?.tax?.kind === 'at-payment' && CommerceModel.isUnpaidQuote(row) ? (\n <Typography variant=\"caption\" color=\"text.secondary\" noWrap>\n {'plus tax at payment'}\n </Typography>\n ) : null}\n </Stack>\n ),\n },\n {\n field: 'statusLabel',\n headerName: 'Status',\n width: 180,\n renderCell: ({ row }: { row: QuoteListRow }) => (\n <Chip\n size=\"small\"\n variant=\"outlined\"\n label={row.statusLabel}\n color={CommerceModel.QUOTE_STATUS_COLOR[row.statusKey]}\n />\n ),\n },\n {\n field: 'updatedAtMs',\n headerName: 'Updated',\n type: 'number',\n width: 140,\n align: 'left',\n headerAlign: 'left',\n renderCell: ({ row }: { row: QuoteListRow }) => (\n <Typography variant=\"body2\" noWrap>\n {row.updatedAtMs ? new Date(row.updatedAtMs).toLocaleDateString() : '—'}\n </Typography>\n ),\n },\n ],\n [],\n )\n\n const empty = status === 'success' && rows.length === 0\n\n return (\n <CardDisplay\n header={'Quotes'}\n subheader={'Prices for a customer’s order before they buy'}\n help={pluginDocsHelp('quotes', {\n anchor: '#make-a-quote',\n title: 'Quotes',\n excerpt:\n 'Put a price to a customer with your products, items typed for the job and anything ' +\n 'included. A quote becomes an order when it is paid.',\n })}\n HeaderProps={{\n action: (\n <BlockedControl blocked={!canEdit} reason={REFUSAL}>\n <Button size=\"small\" variant=\"contained\" onClick={() => setOpenId('new')}>\n {'New quote'}\n </Button>\n </BlockedControl>\n ),\n }}\n contentGutterX\n contentGutterY\n >\n {empty ? (\n <Typography variant=\"body2\" color=\"text.secondary\">\n {'No quotes yet. A quote prices a customer’s order before they buy: your products, ' +\n 'items typed for the job, and anything you include at no charge.'}\n </Typography>\n ) : (\n <Stack spacing={1}>\n {quotes.truncated ? (\n <Typography variant=\"caption\" color=\"text.secondary\">\n {'This store has more quotes than the list shows at once.'}\n </Typography>\n ) : null}\n <ListTable\n aria-label=\"Quotes\"\n rows={rows}\n columns={columns}\n loading={status === 'loading'}\n onOpen={(id) => setOpenId(id)}\n quickFilter\n initialState={{ sorting: { sortModel: [{ field: 'updatedAtMs', sort: 'desc' }] } }}\n noRowsLabel=\"No quotes match\"\n />\n </Stack>\n )}\n {/* A quote deleted while open closes its editor rather than turn it into a new one. */}\n {openId === 'new' || openQuote ? (\n <QuoteEditorDialog\n key={openId}\n hostId={hostId}\n quote={openQuote}\n products={products}\n canEdit={canEdit}\n canSend={canSend}\n onClose={() => setOpenId(null)}\n />\n ) : null}\n </CardDisplay>\n )\n}\nHostQuotesCard.displayName = 'HostQuotesCard'\n\nexport default HostQuotesCard\n"],"names":["CommerceModel","posMoney","commerceSitePermissionRefusal","pluginDocsHelp","CardDisplay","BlockedControl","ListTable","ceilingedWindow","collectionCeiling","useFirestore","useFirestoreCollection","Button","Chip","Stack","Typography","collection","limit","query","where","useSearchParams","useEffect","useMemo","useRef","useState","QuoteEditorDialog","QUOTE_CEILING","PRODUCT_WINDOW","REFUSAL","quoteListRow","quote","items","customer","status","quoteDisplayStatus","lineItems","customerLabel","name","company","email","firstItem","moreItems","Math","max","length","statusKey","key","statusLabel","label","totalCents","Number","totals","updatedAtMs","latestQuoteResponse","atMs","HostQuotesCard","props","quotes","hostId","canEdit","canSend","firestore","data","quoteDocs","idField","undefined","rows","Array","from","productDocs","products","filter","product","openId","setOpenId","openQuote","find","row","$id","searchParams","linkedId","get","opened","current","some","columns","field","headerName","flex","minWidth","renderCell","sx","variant","noWrap","formatQuoteNumber","color","type","width","align","headerAlign","alignItems","tax","kind","isUnpaidQuote","size","QUOTE_STATUS_COLOR","Date","toLocaleDateString","empty","header","subheader","help","anchor","title","excerpt","HeaderProps","action","blocked","reason","onClick","contentGutterX","contentGutterY","spacing","truncated","aria-label","loading","onOpen","id","quickFilter","initialState","sorting","sortModel","sort","noRowsLabel","onClose","displayName"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;AAEA,YAAYA,mBAAmB,uBAAa;AAC5C,SAASC,QAAQ,QAAQ,kCAA8B;AACvD,SAASC,6BAA6B,QAAQ,oCAAgC;AAC9E,SAASC,cAAc,QAAQ,eAAc;AAC7C,SAASC,WAAW,QAAQ,uBAAsB;AAClD,SAASC,cAAc,QAAQ,4DAA2D;AAC1F,SAASC,SAAS,QAAQ,uDAAsD;AAChF,SACEC,eAAe,EACfC,iBAAiB,EACjBC,YAAY,EACZC,sBAAsB,QACjB,iCAAgC;AACvC,SAASC,MAAM,EAAEC,IAAI,EAAEC,KAAK,EAAEC,UAAU,QAAQ,gBAAe;AAE/D,SAASC,UAAU,EAAEC,KAAK,EAAEC,KAAK,EAAEC,KAAK,QAAQ,qBAAoB;AACpE,SAASC,eAAe,QAAQ,kBAAiB;AACjD,SAASC,SAAS,EAAEC,OAAO,EAAEC,MAAM,EAAEC,Q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CAAEC,WAAW;oCAAC;wCAAE7C,OAAO;wCAAe8C,MAAM;oCAAO;iCAAE;4BAAC;wBAAE;wBACjFC,aAAY;;;;YAKjB5D,WAAW,SAASE,0BACnB,KAAClD;gBAECiC,QAAQA;gBACR5B,OAAO6C;gBACPL,UAAUA;gBACVX,SAASA;gBACTC,SAASA;gBACT0E,SAAS,IAAM5D,UAAU;eANpBD,UAQL;;;AAGV;AACAlB,eAAegF,WAAW,GAAG;AAE7B,eAAehF,eAAc"}
1
+ {"version":3,"sources":["../../../../../../../../libs/plugins/commerce/src/lib/components/console/host-quotes-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 { posMoney } from '../../model/commerce-pos-ops'\nimport { commerceSitePermissionRefusal } from '../../model/plugin-permissions'\nimport { pluginDocsHelp } from '@aglyn/aglyn'\nimport { CardDisplay } from '@aglyn/shared-ui-jsx'\nimport { BlockedControl } from '@aglyn/shared-ui-jsx/components/blocked-control.component'\nimport { ListTable } from '@aglyn/shared-ui-jsx/components/list-table.component'\nimport {\n ceilingedWindow,\n collectionCeiling,\n useFirestore,\n useFirestoreCollection,\n useFirestoreDoc,\n} from '@aglyn/tenant-feature-instance'\nimport { Button, Chip, Stack, Typography } from '@mui/material'\nimport type { GridColDef } from '@mui/x-data-grid'\nimport { collection, doc, limit, query, where } from 'firebase/firestore'\nimport { useSearchParams } from 'next/navigation'\nimport { useEffect, useMemo, useRef, useState } from 'react'\nimport QuoteEditorDialog, { type QuoteRow } from './quote-editor-dialog.component'\n\nexport interface HostQuotesCardProps {\n hostId: string\n /** Holds \"Create and edit quotes\" (`commerce.quotes`). */\n canEdit: boolean\n /** Holds \"Send quotes and invoices to customers\" (`commerce.quotes.send`). */\n canSend: boolean\n}\n\n/**\n * How many quotes the list reads. The whole set is read and the grid sorts\n * it by any column; a store past this many is told the list stops short.\n */\nconst QUOTE_CEILING = 500\n\n/** The products the editor's picker offers. */\nconst PRODUCT_WINDOW = 200\n\nconst REFUSAL = commerceSitePermissionRefusal('commerce.quotes')\n\ninterface QuoteListRow extends QuoteRow {\n customerLabel: string\n firstItem: string\n moreItems: number\n statusKey: ReturnType<typeof CommerceModel.quoteDisplayStatus>['key']\n statusLabel: string\n /** Unpaid, with tax still to be added at payment: the pay page's own answer. */\n taxAtPayment: boolean\n totalCents: number\n updatedAtMs: number\n}\n\n/** One quote as its row draws and sorts it, under the store's sales tax choice. */\nfunction quoteListRow(quote: QuoteRow, store: CommerceModel.PayLinkStore): QuoteListRow {\n const customer = quote.quote?.customer\n const status = CommerceModel.quoteDisplayStatus(quote)\n const items = quote.lineItems ?? []\n return {\n ...quote,\n customerLabel: customer?.name || customer?.company || customer?.email || '',\n firstItem: items[0]?.name ?? '',\n moreItems: Math.max(0, items.length - 1),\n statusKey: status.key,\n statusLabel: status.label,\n // `quotePayTax`, as the pay page reads it (AGL-4162): a quote saved before\n // the store chose its sales tax takes the choice as it stands now.\n taxAtPayment: CommerceModel.isUnpaidQuote(quote) && CommerceModel.quotePayTax(quote.quote, store).basis.kind === 'at-payment',\n totalCents: Number(quote.totals?.totalCents ?? 0),\n // The customer's latest answer counts as an update (AGL-4096), so a quote\n // they just approved or asked changes to sorts to the top.\n updatedAtMs: Math.max(\n Number(quote.quote?.updatedAtMs ?? 0),\n Number(CommerceModel.latestQuoteResponse(quote.quote)?.atMs ?? 0),\n ),\n }\n}\n\n/**\n * Quotes (AGL-4093): prices put to a customer before they buy, beside the\n * orders they become. A quote is an unpaid order on the `quote` channel, so\n * this reads `hosts/{hostId}/orders` for that channel alone; the Orders list\n * above never shows one until it is paid.\n */\nexport function HostQuotesCard(props: HostQuotesCardProps) {\n const { hostId, canEdit, canSend } = props\n const firestore = useFirestore()\n const { data: quoteDocs, status } = useFirestoreCollection<QuoteRow>(\n () =>\n query(\n collection(firestore, 'hosts', hostId, 'orders'),\n where('channel', '==', 'quote'),\n limit(QUOTE_CEILING + 1),\n ),\n [firestore, hostId],\n { idField: '$id' },\n )\n const quotes = useMemo(() => ceilingedWindow<QuoteRow>(quoteDocs ?? undefined, QUOTE_CEILING), [quoteDocs])\n // One read for the whole list. Until it answers, each quote's saved basis stands.\n const { data: storeSettings } = useFirestoreDoc<{ tax?: unknown }>(\n () => doc(firestore, 'hosts', hostId, 'settings', 'store'),\n [firestore, hostId],\n )\n const rows = useMemo(() => {\n const store = CommerceModel.payLinkStoreOf(storeSettings)\n return quotes.rows.map((quote) => quoteListRow(quote, store))\n }, [quotes, storeSettings])\n\n const { data: productDocs } = useFirestoreCollection<Record<string, any>>(\n () => collectionCeiling(collection(firestore, 'hosts', hostId, 'products'), PRODUCT_WINDOW),\n [firestore, hostId],\n { idField: '$id' },\n )\n const products = useMemo(\n () => ceilingedWindow<Record<string, any>>(productDocs ?? undefined, PRODUCT_WINDOW).rows.filter((product) => !product['deletedAt']),\n [productDocs],\n )\n\n /** The quote open in the editor: its id, or `new`. */\n const [openId, setOpenId] = useState<string | null>(null)\n const openQuote = openId && openId !== 'new' ? (quotes.rows.find((row) => row.$id === openId) ?? null) : null\n\n // A manager notice opens its quote (AGL-4096): `?quote=<id>` on the Orders\n // page, once that quote has loaded. Read from the router, so a notice\n // followed while this page is already open opens its quote too; once per\n // id, so closing the dialog does not reopen it.\n const searchParams = useSearchParams()\n const linkedId = searchParams?.get('quote') ?? ''\n const opened = useRef('')\n useEffect(() => {\n if (!linkedId || opened.current === linkedId || !quotes.rows.some((row) => row.$id === linkedId)) return\n opened.current = linkedId\n setOpenId(linkedId)\n }, [linkedId, quotes.rows])\n\n const columns = useMemo<GridColDef[]>(\n () => [\n {\n field: 'number',\n headerName: 'Quote',\n flex: 1,\n minWidth: 160,\n renderCell: ({ row }: { row: QuoteListRow }) => (\n <Stack sx={{ minWidth: 0 }}>\n <Typography variant=\"body2\" noWrap>\n {CommerceModel.formatQuoteNumber(row, row.$id)}\n </Typography>\n <Typography variant=\"caption\" color=\"text.secondary\" noWrap>\n {row.moreItems ? `${row.firstItem} and more` : row.firstItem}\n </Typography>\n </Stack>\n ),\n },\n {\n field: 'customerLabel',\n headerName: 'Customer',\n flex: 1,\n minWidth: 160,\n renderCell: ({ row }: { row: QuoteListRow }) => (\n <Typography variant=\"body2\" noWrap>\n {row.customerLabel || '—'}\n </Typography>\n ),\n },\n {\n field: 'totalCents',\n headerName: 'Total',\n type: 'number',\n width: 140,\n align: 'right',\n headerAlign: 'right',\n renderCell: ({ row }: { row: QuoteListRow }) => (\n <Stack sx={{ alignItems: 'flex-end', minWidth: 0, width: 1 }}>\n <Typography variant=\"body2\">{posMoney(row.totalCents)}</Typography>\n {row.taxAtPayment ? (\n <Typography variant=\"caption\" color=\"text.secondary\" noWrap>\n {'plus tax at payment'}\n </Typography>\n ) : null}\n </Stack>\n ),\n },\n {\n field: 'statusLabel',\n headerName: 'Status',\n width: 180,\n renderCell: ({ row }: { row: QuoteListRow }) => (\n <Chip\n size=\"small\"\n variant=\"outlined\"\n label={row.statusLabel}\n color={CommerceModel.QUOTE_STATUS_COLOR[row.statusKey]}\n />\n ),\n },\n {\n field: 'updatedAtMs',\n headerName: 'Updated',\n type: 'number',\n width: 140,\n align: 'left',\n headerAlign: 'left',\n renderCell: ({ row }: { row: QuoteListRow }) => (\n <Typography variant=\"body2\" noWrap>\n {row.updatedAtMs ? new Date(row.updatedAtMs).toLocaleDateString() : '—'}\n </Typography>\n ),\n },\n ],\n [],\n )\n\n const empty = status === 'success' && rows.length === 0\n\n return (\n <CardDisplay\n header={'Quotes'}\n subheader={'Prices for a customer’s order before they buy'}\n help={pluginDocsHelp('quotes', {\n anchor: '#make-a-quote',\n title: 'Quotes',\n excerpt:\n 'Put a price to a customer with your products, items typed for the job and anything ' +\n 'included. A quote becomes an order when it is paid.',\n })}\n HeaderProps={{\n action: (\n <BlockedControl blocked={!canEdit} reason={REFUSAL}>\n <Button size=\"small\" variant=\"contained\" onClick={() => setOpenId('new')}>\n {'New quote'}\n </Button>\n </BlockedControl>\n ),\n }}\n contentGutterX\n contentGutterY\n >\n {empty ? (\n <Typography variant=\"body2\" color=\"text.secondary\">\n {'No quotes yet. A quote prices a customer’s order before they buy: your products, ' +\n 'items typed for the job, and anything you include at no charge.'}\n </Typography>\n ) : (\n <Stack spacing={1}>\n {quotes.truncated ? (\n <Typography variant=\"caption\" color=\"text.secondary\">\n {'This store has more quotes than the list shows at once.'}\n </Typography>\n ) : null}\n <ListTable\n aria-label=\"Quotes\"\n rows={rows}\n columns={columns}\n loading={status === 'loading'}\n onOpen={(id) => setOpenId(id)}\n quickFilter\n initialState={{ sorting: { sortModel: [{ field: 'updatedAtMs', sort: 'desc' }] } }}\n noRowsLabel=\"No quotes match\"\n />\n </Stack>\n )}\n {/* A quote deleted while open closes its editor rather than turn it into a new one. */}\n {openId === 'new' || openQuote ? (\n <QuoteEditorDialog\n key={openId}\n hostId={hostId}\n quote={openQuote}\n products={products}\n canEdit={canEdit}\n canSend={canSend}\n onClose={() => setOpenId(null)}\n />\n ) : null}\n </CardDisplay>\n )\n}\nHostQuotesCard.displayName = 'HostQuotesCard'\n\nexport default HostQuotesCard\n"],"names":["CommerceModel","posMoney","commerceSitePermissionRefusal","pluginDocsHelp","CardDisplay","BlockedControl","ListTable","ceilingedWindow","collectionCeiling","useFirestore","useFirestoreCollection","useFirestoreDoc","Button","Chip","Stack","Typography","collection","doc","limit","query","where","useSearchParams","useEffect","useMemo","useRef","useState","QuoteEditorDialog","QUOTE_CEILING","PRODUCT_WINDOW","REFUSAL","quoteListRow","quote","store","items","customer","status","quoteDisplayStatus","lineItems","customerLabel","name","company","email","firstItem","moreItems","Math","max","length","statusKey","key","statusLabel","label","taxAtPayment","isUnpaidQuote","quotePayTax","basis","kind","totalCents","Number","totals","updatedAtMs","latestQuoteResponse","atMs","HostQuotesCard","props","quotes","hostId","canEdit","canSend","firestore","data","quoteDocs","idField","undefined","storeSettings","rows","payLinkStoreOf","map","productDocs","products","filter","product","openId","setOpenId","openQuote","find","row","$id","searchParams","linkedId","get","opened","current","some","columns","field","headerName","flex","minWidth","renderCell","sx","variant","noWrap","formatQuoteNumber","color","type","width","align","headerAlign","alignItems","size","QUOTE_STATUS_COLOR","Date","toLocaleDateString","empty","header","subheader","help","anchor","title","excerpt","HeaderProps","action","blocked","reason","onClick","contentGutterX","contentGutterY","spacing","truncated","aria-label","loading","onOpen","id","quickFilter","initialState","sorting","sortModel","sort","noRowsLabel","onClose","displayName"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;AAEA,YAAYA,mBAAmB,uBAAa;AAC5C,SAASC,QAAQ,QAAQ,kCAA8B;AACvD,SAASC,6BAA6B,QAAQ,oCAAgC;AAC9E,SAASC,cAAc,QAAQ,eAAc;AAC7C,SAASC,WAAW,QAAQ,uBAAsB;AAClD,SAASC,cAAc,QAAQ,4DAA2D;AAC1F,SAASC,SAAS,QAAQ,uDAAsD;AAChF,SACEC,eAAe,EACfC,iBAAiB,EACjBC,YAAY,EACZC,sBAAsB,EACtBC,eAAe,QACV,iCAAgC;AACvC,SAASC,MAAM,EAAEC,IAAI,EAAEC,KAAK,EAAEC,UAAU,QAAQ,gBAAe;AAE/D,SAASC,UAAU,EAAEC,GAAG,EAAEC,KAAK,EAAEC,KAAK,EAAEC,KAAK,QAAQ,qBAAoB;AACzE,SAASC,eAAe,QAAQ,kBAAiB;AACjD,SAASC,SAAS,EAAEC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,QAAO;AAC5D,OAAOC,uBAA0C,qCAAiC;AAUlF;;;CAGC,GACD,MAAMC,gBAAgB;AAEtB,6CAA6C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,MAAMA;wBACNmB,SAASA;wBACTqC,SAAS/F,WAAW;wBACpBgG,QAAQ,CAACC,KAAOlD,UAAUkD;wBAC1BC,WAAW;wBACXC,cAAc;4BAAEC,SAAS;gCAAEC,WAAW;oCAAC;wCAAE1C,OAAO;wCAAe2C,MAAM;oCAAO;iCAAE;4BAAC;wBAAE;wBACjFC,aAAY;;;;YAKjBzD,WAAW,SAASE,0BACnB,KAACzD;gBAECuC,QAAQA;gBACRlC,OAAOoD;gBACPL,UAAUA;gBACVZ,SAASA;gBACTC,SAASA;gBACTwE,SAAS,IAAMzD,UAAU;eANpBD,UAQL;;;AAGV;AACAnB,eAAe8E,WAAW,GAAG;AAE7B,eAAe9E,eAAc"}
@@ -13,12 +13,19 @@ export declare function kioskFromCents(product: CommerceModel.PosKioskProduct):
13
13
  export declare function kioskProductSoldOut(product: CommerceModel.PosKioskProduct): boolean;
14
14
  /**
15
15
  * The menu (AGL-3623): category chips, the product tiles, and the cart bar.
16
- * A category chip asks the server for that category; nothing is filtered
17
- * out of a list already loaded.
16
+ * A category chip asks the server for that category, and a word typed in the
17
+ * search asks the server for that word across the whole catalog. The search
18
+ * shows only when the catalog is longer than the menu can list.
18
19
  */
19
- export declare function KioskMenu({ catalog, loading, categoryId, onCategory, onProduct, lines, currency, onReview, onQuantity, cartOpen, onCartOpen, busy, }: {
20
+ export declare function KioskMenu({ catalog, products, loading, search, onSearch, searching, categoryId, onCategory, onProduct, lines, currency, onReview, onQuantity, cartOpen, onCartOpen, busy, }: {
20
21
  catalog: CommerceModel.PosKioskCatalog | null;
22
+ /** What to list: the catalog, or what answers the word typed. */
23
+ products: CommerceModel.PosKioskProduct[];
21
24
  loading: boolean;
25
+ search: string;
26
+ onSearch: (search: string) => void;
27
+ /** The server hasn't answered the word typed yet. */
28
+ searching: boolean;
22
29
  categoryId: string | null;
23
30
  onCategory: (categoryId: string | null) => void;
24
31
  onProduct: (product: CommerceModel.PosKioskProduct) => void;
@@ -27,6 +27,7 @@ import Divider from "@mui/material/Divider";
27
27
  import Drawer from "@mui/material/Drawer";
28
28
  import IconButton from "@mui/material/IconButton";
29
29
  import Stack from "@mui/material/Stack";
30
+ import TextField from "@mui/material/TextField";
30
31
  import Typography from "@mui/material/Typography";
31
32
  import * as CommerceModel from "../../../model/index.js";
32
33
  import { displayMoney } from "../pos-display/pos-display-api.js";
@@ -40,14 +41,14 @@ export function kioskProductSoldOut(product) {
40
41
  }
41
42
  /**
42
43
  * The menu (AGL-3623): category chips, the product tiles, and the cart bar.
43
- * A category chip asks the server for that category; nothing is filtered
44
- * out of a list already loaded.
45
- */ export function KioskMenu({ catalog, loading, categoryId, onCategory, onProduct, lines, currency, onReview, onQuantity, cartOpen, onCartOpen, busy }) {
46
- var _ref, _ref1;
44
+ * A category chip asks the server for that category, and a word typed in the
45
+ * search asks the server for that word across the whole catalog. The search
46
+ * shows only when the catalog is longer than the menu can list.
47
+ */ export function KioskMenu({ catalog, products, loading, search, onSearch, searching, categoryId, onCategory, onProduct, lines, currency, onReview, onQuantity, cartOpen, onCartOpen, busy }) {
48
+ var _ref;
47
49
  const count = lines.reduce((sum, line)=>sum + line.quantity, 0);
48
50
  const estimate = lines.reduce((sum, line)=>sum + line.unitCents * line.quantity, 0);
49
51
  const money = (cents)=>displayMoney(cents, currency);
50
- const products = (_ref = catalog == null ? void 0 : catalog.products) != null ? _ref : [];
51
52
  return /*#__PURE__*/ _jsxs(Box, {
52
53
  sx: {
53
54
  minHeight: '100dvh',
@@ -55,6 +56,26 @@ export function kioskProductSoldOut(product) {
55
56
  flexDirection: 'column'
56
57
  },
57
58
  children: [
59
+ search || (catalog == null ? void 0 : catalog.truncated) ? /*#__PURE__*/ _jsx(Box, {
60
+ sx: {
61
+ px: 2,
62
+ pt: 2
63
+ },
64
+ children: /*#__PURE__*/ _jsx(TextField, {
65
+ fullWidth: true,
66
+ type: "search",
67
+ label: "Search the menu",
68
+ value: search,
69
+ onChange: (event)=>onSearch(event.target.value),
70
+ slotProps: {
71
+ htmlInput: {
72
+ autoComplete: 'off',
73
+ spellCheck: false,
74
+ maxLength: 120
75
+ }
76
+ }
77
+ })
78
+ }) : null,
58
79
  /*#__PURE__*/ _jsxs(Box, {
59
80
  component: "nav",
60
81
  "aria-label": "Categories",
@@ -78,7 +99,7 @@ export function kioskProductSoldOut(product) {
78
99
  px: 1
79
100
  }, theme.typography.subtitle1)
80
101
  }),
81
- ((_ref1 = catalog == null ? void 0 : catalog.categories) != null ? _ref1 : []).map((category)=>/*#__PURE__*/ _jsx(Chip, {
102
+ ((_ref = catalog == null ? void 0 : catalog.categories) != null ? _ref : []).map((category)=>/*#__PURE__*/ _jsx(Chip, {
82
103
  label: category.name,
83
104
  color: categoryId === category.id ? 'primary' : 'default',
84
105
  variant: categoryId === category.id ? 'filled' : 'outlined',
@@ -97,7 +118,7 @@ export function kioskProductSoldOut(product) {
97
118
  p: 2,
98
119
  pb: 14
99
120
  },
100
- children: loading ? /*#__PURE__*/ _jsx(Box, {
121
+ children: loading || searching && products.length === 0 ? /*#__PURE__*/ _jsx(Box, {
101
122
  sx: {
102
123
  display: 'grid',
103
124
  placeItems: 'center',
@@ -113,7 +134,7 @@ export function kioskProductSoldOut(product) {
113
134
  textAlign: 'center',
114
135
  py: 8
115
136
  },
116
- children: 'Nothing here yet. Try another category.'
137
+ children: search.trim() ? 'Nothing on the menu matches that.' : 'Nothing here yet. Try another category.'
117
138
  }) : /*#__PURE__*/ _jsx(Box, {
118
139
  sx: (theme)=>({
119
140
  display: 'grid',
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../../../libs/plugins/commerce/src/lib/components/console/pos-kiosk/kiosk-menu.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 Card from '@mui/material/Card'\nimport CardActionArea from '@mui/material/CardActionArea'\nimport CardContent from '@mui/material/CardContent'\nimport Chip from '@mui/material/Chip'\nimport CircularProgress from '@mui/material/CircularProgress'\nimport Divider from '@mui/material/Divider'\nimport Drawer from '@mui/material/Drawer'\nimport IconButton from '@mui/material/IconButton'\nimport Stack from '@mui/material/Stack'\nimport Typography from '@mui/material/Typography'\nimport * as CommerceModel from '../../../model'\nimport { displayMoney } from '../pos-display/pos-display-api'\n\n/** A cart line on the kiosk: what is sent, plus what the screen shows. */\nexport interface KioskCartLine extends CommerceModel.PosKioskLine {\n /** Merges the same item with the same choices. */\n key: string\n name: string\n label?: string\n /** The catalog's price per unit, modifiers included: an estimate until checkout. */\n unitCents: number\n}\n\n/** The lowest price a product sells at, for its tile. */\nexport function kioskFromCents(product: CommerceModel.PosKioskProduct): number {\n return product.variants.reduce(\n (low, variant) => Math.min(low, variant.priceCents),\n product.variants[0]?.priceCents ?? 0,\n )\n}\n\nexport function kioskProductSoldOut(product: CommerceModel.PosKioskProduct): boolean {\n return product.variants.length > 0 && product.variants.every((variant) => variant.soldOut)\n}\n\n/**\n * The menu (AGL-3623): category chips, the product tiles, and the cart bar.\n * A category chip asks the server for that category; nothing is filtered\n * out of a list already loaded.\n */\nexport function KioskMenu({\n catalog,\n loading,\n categoryId,\n onCategory,\n onProduct,\n lines,\n currency,\n onReview,\n onQuantity,\n cartOpen,\n onCartOpen,\n busy,\n}: {\n catalog: CommerceModel.PosKioskCatalog | null\n loading: boolean\n categoryId: string | null\n onCategory: (categoryId: string | null) => void\n onProduct: (product: CommerceModel.PosKioskProduct) => void\n lines: KioskCartLine[]\n currency: string\n onReview: () => void\n onQuantity: (key: string, quantity: number) => void\n cartOpen: boolean\n onCartOpen: (open: boolean) => void\n busy: boolean\n}) {\n const count = lines.reduce((sum, line) => sum + line.quantity, 0)\n const estimate = lines.reduce((sum, line) => sum + line.unitCents * line.quantity, 0)\n const money = (cents: number) => displayMoney(cents, currency)\n const products = catalog?.products ?? []\n return (\n <Box sx={{ minHeight: '100dvh', display: 'flex', flexDirection: 'column' }}>\n <Box\n component=\"nav\"\n aria-label=\"Categories\"\n sx={{ display: 'flex', gap: 1, overflowX: 'auto', p: 2, borderBottom: 1, borderColor: 'divider' }}\n >\n <Chip\n label=\"All\"\n color={categoryId ? 'default' : 'primary'}\n variant={categoryId ? 'outlined' : 'filled'}\n aria-pressed={!categoryId}\n onClick={() => onCategory(null)}\n sx={(theme) => ({ minHeight: theme.spacing(6), px: 1, ...theme.typography.subtitle1 })}\n />\n {(catalog?.categories ?? []).map((category) => (\n <Chip\n key={category.id}\n label={category.name}\n color={categoryId === category.id ? 'primary' : 'default'}\n variant={categoryId === category.id ? 'filled' : 'outlined'}\n aria-pressed={categoryId === category.id}\n onClick={() => onCategory(category.id)}\n sx={(theme) => ({ minHeight: theme.spacing(6), px: 1, ...theme.typography.subtitle1 })}\n />\n ))}\n </Box>\n <Box sx={{ flex: 1, p: 2, pb: 14 }}>\n {loading ? (\n <Box sx={{ display: 'grid', placeItems: 'center', py: 8 }}>\n <CircularProgress aria-label=\"Loading the menu\" />\n </Box>\n ) : products.length === 0 ? (\n <Typography variant=\"h6\" color=\"text.secondary\" sx={{ textAlign: 'center', py: 8 }}>\n {'Nothing here yet. Try another category.'}\n </Typography>\n ) : (\n <Box\n sx={(theme) => ({\n display: 'grid',\n gap: 2,\n gridTemplateColumns: `repeat(auto-fill, minmax(${theme.spacing(22)}, 1fr))`,\n })}\n >\n {products.map((product) => {\n const soldOut = kioskProductSoldOut(product)\n const several = product.variants.length > 1\n return (\n <Card key={product.id} variant=\"outlined\">\n <CardActionArea\n disabled={soldOut}\n onClick={() => onProduct(product)}\n sx={{ height: '100%', display: 'flex', flexDirection: 'column', alignItems: 'stretch' }}\n >\n {product.imageUrl ? (\n <Box\n component=\"img\"\n src={product.imageUrl}\n alt=\"\"\n loading=\"lazy\"\n sx={{ width: '100%', aspectRatio: '4 / 3', objectFit: 'cover', display: 'block' }}\n />\n ) : null}\n <CardContent sx={{ flex: 1 }}>\n <Typography variant=\"subtitle1\" component=\"h2\">\n {product.name}\n </Typography>\n <Typography variant=\"body2\" color={soldOut ? 'text.disabled' : 'text.secondary'}>\n {soldOut\n ? 'Sold out'\n : `${several ? 'From ' : ''}${money(kioskFromCents(product))}`}\n </Typography>\n </CardContent>\n </CardActionArea>\n </Card>\n )\n })}\n </Box>\n )}\n </Box>\n {count > 0 ? (\n <Box\n sx={(theme) => ({\n position: 'fixed',\n left: 0,\n right: 0,\n bottom: 0,\n p: 2,\n bgcolor: 'background.paper',\n borderTop: 1,\n borderColor: 'divider',\n display: 'flex',\n gap: 2,\n zIndex: theme.zIndex.appBar,\n })}\n >\n <Button\n variant=\"outlined\"\n size=\"large\"\n onClick={() => onCartOpen(true)}\n sx={(theme) => ({ minHeight: theme.spacing(8), ...theme.typography.h6 })}\n >\n {`Cart (${count})`}\n </Button>\n <Button\n variant=\"contained\"\n size=\"large\"\n disabled={busy}\n onClick={onReview}\n sx={(theme) => ({ flex: 1, minHeight: theme.spacing(8), ...theme.typography.h6 })}\n >\n {busy ? 'Getting your total…' : `Checkout · ${money(estimate)}`}\n </Button>\n </Box>\n ) : null}\n <Drawer\n anchor=\"right\"\n open={cartOpen}\n onClose={() => onCartOpen(false)}\n slotProps={{ paper: { sx: (theme) => ({ width: `min(100vw, ${theme.spacing(60)})`, p: 2 }) } }}\n >\n <Stack spacing={2} sx={{ height: '100%' }}>\n <Typography variant=\"h5\" component=\"h2\">\n {'Your order'}\n </Typography>\n <Stack spacing={1} divider={<Divider flexItem />} sx={{ flex: 1, overflowY: 'auto' }}>\n {lines.map((line) => (\n <Stack key={line.key} direction=\"row\" spacing={1} sx={{ alignItems: 'center' }}>\n <Box sx={{ flex: 1, minWidth: 0 }}>\n <Typography variant=\"subtitle1\">{line.name}</Typography>\n {line.label ? (\n <Typography variant=\"body2\" color=\"text.secondary\">\n {line.label}\n </Typography>\n ) : null}\n <Typography variant=\"body2\">{money(line.unitCents * line.quantity)}</Typography>\n </Box>\n <IconButton\n aria-label={`One fewer ${line.name}`}\n onClick={() => onQuantity(line.key, line.quantity - 1)}\n sx={(theme) => ({ width: theme.spacing(7), height: theme.spacing(7), border: 1, borderColor: 'divider' })}\n >\n {'−'}\n </IconButton>\n <Typography variant=\"h6\" component=\"span\" aria-label=\"Quantity\" sx={{ minWidth: (theme) => theme.spacing(4), textAlign: 'center' }}>\n {line.quantity}\n </Typography>\n <IconButton\n aria-label={`One more ${line.name}`}\n disabled={line.quantity >= CommerceModel.POS_KIOSK_MAX_QUANTITY}\n onClick={() => onQuantity(line.key, line.quantity + 1)}\n sx={(theme) => ({ width: theme.spacing(7), height: theme.spacing(7), border: 1, borderColor: 'divider' })}\n >\n {'+'}\n </IconButton>\n </Stack>\n ))}\n {lines.length === 0 ? (\n <Typography color=\"text.secondary\">{'Your cart is empty.'}</Typography>\n ) : null}\n </Stack>\n <Typography variant=\"body2\" color=\"text.secondary\">\n {'Tax is added at checkout.'}\n </Typography>\n <Button\n variant=\"contained\"\n size=\"large\"\n disabled={busy || lines.length === 0}\n onClick={() => {\n onCartOpen(false)\n onReview()\n }}\n sx={(theme) => ({ minHeight: theme.spacing(8), ...theme.typography.h6 })}\n >\n {`Checkout · ${money(estimate)}`}\n </Button>\n <Button onClick={() => onCartOpen(false)} sx={(theme) => ({ minHeight: theme.spacing(7) })}>\n {'Keep ordering'}\n </Button>\n </Stack>\n </Drawer>\n </Box>\n )\n}\n"],"names":["Box","Button","Card","CardActionArea","CardContent","Chip","CircularProgress","Divider","Drawer","IconButton","Stack","Typography","CommerceModel","displayMoney","kioskFromCents","product","variants","reduce","low","variant","Math","min","priceCents","kioskProductSoldOut","length","every","soldOut","KioskMenu","catalog","loading","categoryId","onCategory","onProduct","lines","currency","onReview","onQuantity","cartOpen","onCartOpen","busy","count","sum","line","quantity","estimate","unitCents","money","cents","products","sx","minHeight","display","flexDirection","component","aria-label","gap","overflowX","p","borderBottom","borderColor","label","color","aria-pressed","onClick","theme","spacing","px","typography","subtitle1","categories","map","category","name","id","flex","pb","placeItems","py","textAlign","gridTemplateColumns","several","disabled","height","alignItems","imageUrl","src","alt","width","aspectRatio","objectFit","position","left","right","bottom","bgcolor","borderTop","zIndex","appBar","size","h6","anchor","open","onClose","slotProps","paper","divider","flexItem","overflowY","direction","minWidth","key","border","POS_KIOSK_MAX_QUANTITY"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GACD;;;AAEA,OAAOA,SAAS,oBAAmB;AACnC,OAAOC,YAAY,uBAAsB;AACzC,OAAOC,UAAU,qBAAoB;AACrC,OAAOC,oBAAoB,+BAA8B;AACzD,OAAOC,iBAAiB,4BAA2B;AACnD,OAAOC,UAAU,qBAAoB;AACrC,OAAOC,sBAAsB,iCAAgC;AAC7D,OAAOC,aAAa,wBAAuB;AAC3C,OAAOC,YAAY,uBAAsB;AACzC,OAAOC,gBAAgB,2BAA0B;AACjD,OAAOC,WAAW,sBAAqB;AACvC,OAAOC,gBAAgB,2BAA0B;AACjD,YAAYC,mBAAmB,0BAAgB;AAC/C,SAASC,YAAY,QAAQ,oCAAgC;AAY7D,uDAAuD,GACvD,OAAO,SAASC,eAAeC,OAAsC;;QAGjEA;IAFF,OAAOA,QAAQC,QAAQ,CAACC,MAAM,CAC5B,CAACC,KAAKC,UAAYC,KAAKC,GAAG,CAACH,KAAKC,QAAQG,UAAU,YAClDP,qBAAAA,QAAQC,QAAQ,CAAC,EAAE,qBAAnBD,mBAAqBO,UAAU,mBAAI;AAEvC;AAEA,OAAO,SAASC,oBAAoBR,OAAsC;IACxE,OAAOA,QAAQC,QAAQ,CAACQ,MAAM,GAAG,KAAKT,QAAQC,QAAQ,CAACS,KAAK,CAAC,CAACN,UAAYA,QAAQO,OA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DAC9HpC,KAAKC,QAAQ;;0DAEhB,KAAClC;gDACC6C,cAAY,CAAC,SAAS,EAAEZ,KAAK8B,IAAI,EAAE;gDACnCS,UAAUvC,KAAKC,QAAQ,IAAI/B,cAAcoG,sBAAsB;gDAC/DjD,SAAS,IAAM3B,WAAWM,KAAKoE,GAAG,EAAEpE,KAAKC,QAAQ,GAAG;gDACpDM,IAAI,CAACe,QAAW,CAAA;wDAAEuB,OAAOvB,MAAMC,OAAO,CAAC;wDAAIiB,QAAQlB,MAAMC,OAAO,CAAC;wDAAI8C,QAAQ;wDAAGpD,aAAa;oDAAU,CAAA;0DAEtG;;;uCA1BOjB,KAAKoE,GAAG;gCA8BrB7E,MAAMT,MAAM,KAAK,kBAChB,KAACb;oCAAWkD,OAAM;8CAAkB;qCAClC;;;sCAEN,KAAClD;4BAAWQ,SAAQ;4BAAQ0C,OAAM;sCAC/B;;sCAEH,KAAC5D;4BACCkB,SAAQ;4BACR+E,MAAK;4BACLjB,UAAU1C,QAAQN,MAAMT,MAAM,KAAK;4BACnCuC,SAAS;gCACPzB,WAAW;gCACXH;4BACF;4BACAc,IAAI,CAACe,QAAW;oCAAEd,WAAWc,MAAMC,OAAO,CAAC;mCAAOD,MAAMG,UAAU,CAACgC,EAAE;sCAEpE,CAAC,WAAW,EAAErD,MAAMF,WAAW;;sCAElC,KAAC3C;4BAAO8D,SAAS,IAAMzB,WAAW;4BAAQW,IAAI,CAACe,QAAW,CAAA;oCAAEd,WAAWc,MAAMC,OAAO,CAAC;gCAAG,CAAA;sCACrF;;;;;;;AAMb"}
1
+ {"version":3,"sources":["../../../../../../../../../libs/plugins/commerce/src/lib/components/console/pos-kiosk/kiosk-menu.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 Card from '@mui/material/Card'\nimport CardActionArea from '@mui/material/CardActionArea'\nimport CardContent from '@mui/material/CardContent'\nimport Chip from '@mui/material/Chip'\nimport CircularProgress from '@mui/material/CircularProgress'\nimport Divider from '@mui/material/Divider'\nimport Drawer from '@mui/material/Drawer'\nimport IconButton from '@mui/material/IconButton'\nimport Stack from '@mui/material/Stack'\nimport TextField from '@mui/material/TextField'\nimport Typography from '@mui/material/Typography'\nimport * as CommerceModel from '../../../model'\nimport { displayMoney } from '../pos-display/pos-display-api'\n\n/** A cart line on the kiosk: what is sent, plus what the screen shows. */\nexport interface KioskCartLine extends CommerceModel.PosKioskLine {\n /** Merges the same item with the same choices. */\n key: string\n name: string\n label?: string\n /** The catalog's price per unit, modifiers included: an estimate until checkout. */\n unitCents: number\n}\n\n/** The lowest price a product sells at, for its tile. */\nexport function kioskFromCents(product: CommerceModel.PosKioskProduct): number {\n return product.variants.reduce(\n (low, variant) => Math.min(low, variant.priceCents),\n product.variants[0]?.priceCents ?? 0,\n )\n}\n\nexport function kioskProductSoldOut(product: CommerceModel.PosKioskProduct): boolean {\n return product.variants.length > 0 && product.variants.every((variant) => variant.soldOut)\n}\n\n/**\n * The menu (AGL-3623): category chips, the product tiles, and the cart bar.\n * A category chip asks the server for that category, and a word typed in the\n * search asks the server for that word across the whole catalog. The search\n * shows only when the catalog is longer than the menu can list.\n */\nexport function KioskMenu({\n catalog,\n products,\n loading,\n search,\n onSearch,\n searching,\n categoryId,\n onCategory,\n onProduct,\n lines,\n currency,\n onReview,\n onQuantity,\n cartOpen,\n onCartOpen,\n busy,\n}: {\n catalog: CommerceModel.PosKioskCatalog | null\n /** What to list: the catalog, or what answers the word typed. */\n products: CommerceModel.PosKioskProduct[]\n loading: boolean\n search: string\n onSearch: (search: string) => void\n /** The server hasn't answered the word typed yet. */\n searching: boolean\n categoryId: string | null\n onCategory: (categoryId: string | null) => void\n onProduct: (product: CommerceModel.PosKioskProduct) => void\n lines: KioskCartLine[]\n currency: string\n onReview: () => void\n onQuantity: (key: string, quantity: number) => void\n cartOpen: boolean\n onCartOpen: (open: boolean) => void\n busy: boolean\n}) {\n const count = lines.reduce((sum, line) => sum + line.quantity, 0)\n const estimate = lines.reduce((sum, line) => sum + line.unitCents * line.quantity, 0)\n const money = (cents: number) => displayMoney(cents, currency)\n return (\n <Box sx={{ minHeight: '100dvh', display: 'flex', flexDirection: 'column' }}>\n {search || catalog?.truncated ? (\n <Box sx={{ px: 2, pt: 2 }}>\n <TextField\n fullWidth\n type=\"search\"\n label=\"Search the menu\"\n value={search}\n onChange={(event) => onSearch(event.target.value)}\n slotProps={{ htmlInput: { autoComplete: 'off', spellCheck: false, maxLength: 120 } }}\n />\n </Box>\n ) : null}\n <Box\n component=\"nav\"\n aria-label=\"Categories\"\n sx={{ display: 'flex', gap: 1, overflowX: 'auto', p: 2, borderBottom: 1, borderColor: 'divider' }}\n >\n <Chip\n label=\"All\"\n color={categoryId ? 'default' : 'primary'}\n variant={categoryId ? 'outlined' : 'filled'}\n aria-pressed={!categoryId}\n onClick={() => onCategory(null)}\n sx={(theme) => ({ minHeight: theme.spacing(6), px: 1, ...theme.typography.subtitle1 })}\n />\n {(catalog?.categories ?? []).map((category) => (\n <Chip\n key={category.id}\n label={category.name}\n color={categoryId === category.id ? 'primary' : 'default'}\n variant={categoryId === category.id ? 'filled' : 'outlined'}\n aria-pressed={categoryId === category.id}\n onClick={() => onCategory(category.id)}\n sx={(theme) => ({ minHeight: theme.spacing(6), px: 1, ...theme.typography.subtitle1 })}\n />\n ))}\n </Box>\n <Box sx={{ flex: 1, p: 2, pb: 14 }}>\n {loading || (searching && products.length === 0) ? (\n <Box sx={{ display: 'grid', placeItems: 'center', py: 8 }}>\n <CircularProgress aria-label=\"Loading the menu\" />\n </Box>\n ) : products.length === 0 ? (\n <Typography variant=\"h6\" color=\"text.secondary\" sx={{ textAlign: 'center', py: 8 }}>\n {search.trim() ? 'Nothing on the menu matches that.' : 'Nothing here yet. Try another category.'}\n </Typography>\n ) : (\n <Box\n sx={(theme) => ({\n display: 'grid',\n gap: 2,\n gridTemplateColumns: `repeat(auto-fill, minmax(${theme.spacing(22)}, 1fr))`,\n })}\n >\n {products.map((product) => {\n const soldOut = kioskProductSoldOut(product)\n const several = product.variants.length > 1\n return (\n <Card key={product.id} variant=\"outlined\">\n <CardActionArea\n disabled={soldOut}\n onClick={() => onProduct(product)}\n sx={{ height: '100%', display: 'flex', flexDirection: 'column', alignItems: 'stretch' }}\n >\n {product.imageUrl ? (\n <Box\n component=\"img\"\n src={product.imageUrl}\n alt=\"\"\n loading=\"lazy\"\n sx={{ width: '100%', aspectRatio: '4 / 3', objectFit: 'cover', display: 'block' }}\n />\n ) : null}\n <CardContent sx={{ flex: 1 }}>\n <Typography variant=\"subtitle1\" component=\"h2\">\n {product.name}\n </Typography>\n <Typography variant=\"body2\" color={soldOut ? 'text.disabled' : 'text.secondary'}>\n {soldOut\n ? 'Sold out'\n : `${several ? 'From ' : ''}${money(kioskFromCents(product))}`}\n </Typography>\n </CardContent>\n </CardActionArea>\n </Card>\n )\n })}\n </Box>\n )}\n </Box>\n {count > 0 ? (\n <Box\n sx={(theme) => ({\n position: 'fixed',\n left: 0,\n right: 0,\n bottom: 0,\n p: 2,\n bgcolor: 'background.paper',\n borderTop: 1,\n borderColor: 'divider',\n display: 'flex',\n gap: 2,\n zIndex: theme.zIndex.appBar,\n })}\n >\n <Button\n variant=\"outlined\"\n size=\"large\"\n onClick={() => onCartOpen(true)}\n sx={(theme) => ({ minHeight: theme.spacing(8), ...theme.typography.h6 })}\n >\n {`Cart (${count})`}\n </Button>\n <Button\n variant=\"contained\"\n size=\"large\"\n disabled={busy}\n onClick={onReview}\n sx={(theme) => ({ flex: 1, minHeight: theme.spacing(8), ...theme.typography.h6 })}\n >\n {busy ? 'Getting your total…' : `Checkout · ${money(estimate)}`}\n </Button>\n </Box>\n ) : null}\n <Drawer\n anchor=\"right\"\n open={cartOpen}\n onClose={() => onCartOpen(false)}\n slotProps={{ paper: { sx: (theme) => ({ width: `min(100vw, ${theme.spacing(60)})`, p: 2 }) } }}\n >\n <Stack spacing={2} sx={{ height: '100%' }}>\n <Typography variant=\"h5\" component=\"h2\">\n {'Your order'}\n </Typography>\n <Stack spacing={1} divider={<Divider flexItem />} sx={{ flex: 1, overflowY: 'auto' }}>\n {lines.map((line) => (\n <Stack key={line.key} direction=\"row\" spacing={1} sx={{ alignItems: 'center' }}>\n <Box sx={{ flex: 1, minWidth: 0 }}>\n <Typography variant=\"subtitle1\">{line.name}</Typography>\n {line.label ? (\n <Typography variant=\"body2\" color=\"text.secondary\">\n {line.label}\n </Typography>\n ) : null}\n <Typography variant=\"body2\">{money(line.unitCents * line.quantity)}</Typography>\n </Box>\n <IconButton\n aria-label={`One fewer ${line.name}`}\n onClick={() => onQuantity(line.key, line.quantity - 1)}\n sx={(theme) => ({ width: theme.spacing(7), height: theme.spacing(7), border: 1, borderColor: 'divider' })}\n >\n {'−'}\n </IconButton>\n <Typography variant=\"h6\" component=\"span\" aria-label=\"Quantity\" sx={{ minWidth: (theme) => theme.spacing(4), textAlign: 'center' }}>\n {line.quantity}\n </Typography>\n <IconButton\n aria-label={`One more ${line.name}`}\n disabled={line.quantity >= CommerceModel.POS_KIOSK_MAX_QUANTITY}\n onClick={() => onQuantity(line.key, line.quantity + 1)}\n sx={(theme) => ({ width: theme.spacing(7), height: theme.spacing(7), border: 1, borderColor: 'divider' })}\n >\n {'+'}\n </IconButton>\n </Stack>\n ))}\n {lines.length === 0 ? (\n <Typography color=\"text.secondary\">{'Your cart is empty.'}</Typography>\n ) : null}\n </Stack>\n <Typography variant=\"body2\" color=\"text.secondary\">\n {'Tax is added at checkout.'}\n </Typography>\n <Button\n variant=\"contained\"\n size=\"large\"\n disabled={busy || lines.length === 0}\n onClick={() => {\n onCartOpen(false)\n onReview()\n }}\n sx={(theme) => ({ minHeight: theme.spacing(8), ...theme.typography.h6 })}\n >\n {`Checkout · ${money(estimate)}`}\n </Button>\n <Button onClick={() => onCartOpen(false)} sx={(theme) => ({ minHeight: theme.spacing(7) })}>\n {'Keep ordering'}\n </Button>\n </Stack>\n </Drawer>\n </Box>\n )\n}\n"],"names":["Box","Button","Card","CardActionArea","CardContent","Chip","CircularProgress","Divider","Drawer","IconButton","Stack","TextField","Typography","CommerceModel","displayMoney","kioskFromCents","product","variants","reduce","low","variant","Math","min","priceCents","kioskProductSoldOut","length","every","soldOut","KioskMenu","catalog","products","loading","search","onSearch","searching","categoryId","onCategory","onProduct","lines","currency","onReview","onQuantity","cartOpen","onCartOpen","busy","count","sum","line","quantity","estimate","unitCents","money","cents","sx","minHeight","display","flexDirection","truncated","px","pt","fullWidth","type","label","value","onChange","event","target","slotProps","htmlInput","autoComplete","spellCheck","maxLength","component","aria-label","gap","overflowX","p","borderBottom","borderColor","color","aria-pressed","onClick","theme","spacing","typography","subtitle1","categories","map","category","name","id","flex","pb","placeItems","py","textAlign","trim","gridTemplateColumns","several","disabled","height","alignItems","imageUrl","src","alt","width","aspectRatio","objectFit","position","left","right","bottom","bgcolor","borderTop","zIndex","appBar","size","h6","anchor","open","onClose","paper","divider","flexItem","overflowY","direction","minWidth","key","border","POS_KIOSK_MAX_QUANTITY"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GACD;;;AAEA,OAAOA,SAAS,oBAAmB;AACnC,OAAOC,YAAY,uBAAsB;AACzC,OAAOC,UAAU,qBAAoB;AACrC,OAAOC,oBAAoB,+BAA8B;AACzD,OAAOC,iBAAiB,4BAA2B;AACnD,OAAOC,UAAU,qBAAoB;AACrC,OAAOC,sBAAsB,iCAAgC;AAC7D,OAAOC,aAAa,wBAAuB;AAC3C,OAAOC,YAAY,uBAAsB;AACzC,OAAOC,gBAAgB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I,CAAC6B,QAAW,CAAA;wDAAEuB,OAAOvB,MAAMC,OAAO,CAAC;wDAAIiB,QAAQlB,MAAMC,OAAO,CAAC;wDAAI6C,QAAQ;wDAAGlD,aAAa;oDAAU,CAAA;0DAEtG;;;uCA1BO/B,KAAKgF,GAAG;gCA8BrBzF,MAAMb,MAAM,KAAK,kBAChB,KAACb;oCAAWmE,OAAM;8CAAkB;qCAClC;;;sCAEN,KAACnE;4BAAWQ,SAAQ;4BAAQ2D,OAAM;sCAC/B;;sCAEH,KAAC9E;4BACCmB,SAAQ;4BACRgG,MAAK;4BACLjB,UAAUvD,QAAQN,MAAMb,MAAM,KAAK;4BACnCwD,SAAS;gCACPtC,WAAW;gCACXH;4BACF;4BACAa,IAAI,CAAC6B,QAAW;oCAAE5B,WAAW4B,MAAMC,OAAO,CAAC;mCAAOD,MAAME,UAAU,CAACiC,EAAE;sCAEpE,CAAC,WAAW,EAAElE,MAAMF,WAAW;;sCAElC,KAAChD;4BAAOgF,SAAS,IAAMtC,WAAW;4BAAQU,IAAI,CAAC6B,QAAW,CAAA;oCAAE5B,WAAW4B,MAAMC,OAAO,CAAC;gCAAG,CAAA;sCACrF;;;;;;;AAMb"}
@@ -52,6 +52,8 @@ export declare function clearKioskCustomerStorage(): void;
52
52
  export declare const kioskApi: {
53
53
  context: (token: string) => Promise<PosKioskResult<CommerceModel.PosKioskContext>>;
54
54
  catalog: (token: string, categoryId: string | null) => Promise<PosKioskResult<CommerceModel.PosKioskCatalog>>;
55
+ /** A word typed at the menu, asked of the whole catalog. */
56
+ search: (token: string, search: string) => Promise<PosKioskResult<CommerceModel.PosKioskCatalog>>;
55
57
  sale: (token: string, orderId: string) => Promise<PosKioskResult<{
56
58
  sale: CommerceModel.PosKioskSale;
57
59
  }>>;
@@ -127,6 +127,13 @@ export const kioskApi = {
127
127
  categoryId
128
128
  } : {})
129
129
  }),
130
+ /** A word typed at the menu, asked of the whole catalog. */ search: (token, search)=>call(token, {
131
+ method: 'GET',
132
+ query: {
133
+ action: 'catalog',
134
+ search
135
+ }
136
+ }),
130
137
  sale: (token, orderId)=>call(token, {
131
138
  method: 'GET',
132
139
  query: {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../../../libs/plugins/commerce/src/lib/components/console/pos-kiosk/pos-kiosk-api.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\nimport type * as CommerceModel from '../../../model'\nimport { POS_DISPLAY_TOKEN_HEADER } from '../pos-display/pos-display-api'\n\n/**\n * The self-service kiosk's half of `/api/commerce/pos-kiosk` (AGL-3623).\n *\n * Every call carries the kiosk's device token — the customer display's\n * header, because a kiosk is paired exactly like one — and never a staff\n * session. 401 means the kiosk was unpaired (or its register removed), which\n * the page reads as \"pair again\".\n */\nexport const POS_KIOSK_ENDPOINT = '/api/commerce/pos-kiosk'\n\n/**\n * Where the kiosk's token lives on the device: the ONE thing it stores.\n * Nothing a customer chooses or types is ever written to storage.\n */\nexport const POS_KIOSK_TOKEN_KEY = 'aglyn.posKioskToken'\n\nexport interface PosKioskResult<T> {\n ok: boolean\n /** The HTTP status, or 0 when the request never landed. */\n status: number\n value?: T\n error?: string\n}\n\nexport function readKioskToken(): string | null {\n try {\n return window.localStorage.getItem(POS_KIOSK_TOKEN_KEY) || null\n } catch {\n return null\n }\n}\n\nexport function storeKioskToken(token: string | null): void {\n try {\n if (token) window.localStorage.setItem(POS_KIOSK_TOKEN_KEY, token)\n else window.localStorage.removeItem(POS_KIOSK_TOKEN_KEY)\n } catch {\n // Storage blocked: the kiosk works until it reloads, then asks for a code.\n }\n}\n\n/** Every key the kiosk could own on this origin starts with this. */\nexport const POS_KIOSK_STORAGE_PREFIX = 'aglyn.posKiosk'\n\n/**\n * The idle reset's storage sweep: every kiosk key in local and session\n * storage but the device token. The kiosk keeps a customer's cart, email and\n * phone in memory only, so on a working kiosk this finds nothing; it is the\n * guarantee that nothing a customer chose outlives their turn should a later\n * change ever persist some of it. Other pages' keys on the console origin\n * are not the kiosk's to touch.\n */\nexport function clearKioskCustomerStorage(): void {\n for (const pick of [() => window.localStorage, () => window.sessionStorage]) {\n try {\n const storage = pick()\n const keys: string[] = []\n for (let index = 0; index < storage.length; index++) {\n const key = storage.key(index)\n if (key && key.startsWith(POS_KIOSK_STORAGE_PREFIX) && key !== POS_KIOSK_TOKEN_KEY) keys.push(key)\n }\n for (const key of keys) storage.removeItem(key)\n } catch {\n // Blocked storage holds nothing to clear.\n }\n }\n}\n\nasync function call<T>(\n token: string,\n init: { method: 'GET'; query: Record<string, string> } | { method: 'POST'; body: Record<string, unknown>; attemptKey?: string },\n): Promise<PosKioskResult<T>> {\n const headers: Record<string, string> = { [POS_DISPLAY_TOKEN_HEADER]: token }\n if (init.method === 'POST') {\n headers['Content-Type'] = 'application/json'\n if (init.attemptKey) headers['Idempotency-Key'] = init.attemptKey\n }\n try {\n const response = await fetch(\n init.method === 'GET'\n ? `${POS_KIOSK_ENDPOINT}?${new URLSearchParams(init.query).toString()}`\n : POS_KIOSK_ENDPOINT,\n {\n method: init.method,\n headers,\n cache: 'no-store',\n ...(init.method === 'POST' ? { body: JSON.stringify(init.body) } : {}),\n },\n )\n const payload = (await response.json().catch(() => null)) as Record<string, unknown> | null\n if (!response.ok) {\n return {\n ok: false,\n status: response.status,\n error: String(payload?.['error'] ?? 'Something went wrong. Try again.'),\n }\n }\n return { ok: true, status: response.status, value: (payload ?? {}) as T }\n } catch {\n return { ok: false, status: 0, error: 'No connection. Try again.' }\n }\n}\n\nconst post = <T>(token: string, body: Record<string, unknown>, attemptKey?: string) =>\n call<T>(token, { method: 'POST', body, ...(attemptKey ? { attemptKey } : {}) })\n\nexport const kioskApi = {\n context: (token: string) => call<CommerceModel.PosKioskContext>(token, { method: 'GET', query: { action: 'context' } }),\n catalog: (token: string, categoryId: string | null) =>\n call<CommerceModel.PosKioskCatalog>(token, {\n method: 'GET',\n query: { action: 'catalog', ...(categoryId ? { categoryId } : {}) },\n }),\n sale: (token: string, orderId: string) =>\n call<{ sale: CommerceModel.PosKioskSale }>(token, { method: 'GET', query: { action: 'sale', orderId } }),\n checkout: (token: string, lines: CommerceModel.PosKioskLine[], attemptKey: string) =>\n post<{ sale: CommerceModel.PosKioskSale }>(token, { action: 'checkout', lines }, attemptKey),\n pay: (\n token: string,\n input: {\n orderId: string\n method: 'reader' | 'tap'\n tipChoice: 'percent' | 'custom' | 'none'\n tipPercent?: number\n tipCents?: number\n },\n attemptKey: string,\n ) =>\n post<{ sale: CommerceModel.PosKioskSale; paymentId?: string; clientSecret?: string; paymentIntentId?: string }>(\n token,\n { action: 'pay', ...input },\n attemptKey,\n ),\n paymentStatus: (token: string, orderId: string, paymentId: string) =>\n post<{ sale: CommerceModel.PosKioskSale }>(token, { action: 'payment-status', orderId, paymentId }),\n cancelPayment: (token: string, orderId: string, paymentId: string) =>\n post<{ sale: CommerceModel.PosKioskSale }>(token, { action: 'cancel-payment', orderId, paymentId }),\n simulate: (token: string, orderId: string, paymentId: string) =>\n post<{ sale: CommerceModel.PosKioskSale }>(token, { action: 'simulate', orderId, paymentId }),\n counter: (token: string, orderId: string) =>\n post<{ sale: CommerceModel.PosKioskSale }>(token, { action: 'counter', orderId }),\n receipt: (\n token: string,\n input: { orderId: string; channel: CommerceModel.PosReceiptChannel; to?: string; marketingOptIn?: boolean },\n ) => post<{ ok: true }>(token, { action: 'receipt', ...input }),\n abandon: (token: string, orderId: string) =>\n post<{ sale: CommerceModel.PosKioskSale }>(token, { action: 'abandon', orderId }),\n unlock: (token: string, pin: string) => post<{ unlock: string; expiresAtMs: number }>(token, { action: 'unlock', pin }),\n settings: (token: string, unlock: string) =>\n post<PosKioskSettingsView>(token, { action: 'settings', unlock }),\n setReader: (token: string, unlock: string, readerId: string) =>\n post<PosKioskSettingsView>(token, { action: 'set-reader', unlock, readerId }),\n exit: (token: string, unlock: string) => post<{ ok: true }>(token, { action: 'exit', unlock }),\n}\n\nexport interface PosKioskSettingsView {\n readers: Array<{ id: string; label: string; status: string }>\n readerId: string | null\n label: string\n}\n"],"names":["POS_DISPLAY_TOKEN_HEADER","POS_KIOSK_ENDPOINT","POS_KIOSK_TOKEN_KEY","readKioskToken","window","localStorage","getItem","storeKioskToken","token","setItem","removeItem","POS_KIOSK_STORAGE_PREFIX","clearKioskCustomerStorage","pick","sessionStorage","storage","keys","index","length","key","startsWith","push","call","init","headers","method","attemptKey","response","fetch","URLSearchParams","query","toString","cache","body","JSON","stringify","payload","json","catch","ok","status","error","String","value","post","kioskApi","context","action","catalog","categoryId","sale","orderId","checkout","lines","pay","input","paymentStatus","paymentId","cancelPayment","simulate","counter","receipt","abandon","unlock","pin","settings","setReader","readerId","exit"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC;AAGD,SAASA,wBAAwB,QAAQ,oCAAgC;AAEzE;;;;;;;CAOC,GACD,OAAO,MAAMC,qBAAqB,0BAAyB;AAE3D;;;CAGC,GACD,OAAO,MAAMC,sBAAsB,sBAAqB;AAUxD,OAAO,SAASC;IACd,IAAI;QACF,OAAOC,OAAOC,YAAY,CAACC,OAAO,CAACJ,wBAAwB;IAC7D,EAAE,eAAM;QACN,OAAO;IACT;AACF;AAEA,OAAO,SAASK,gBAAgBC,KAAoB;IAClD,IAAI;QACF,IAAIA,OAAOJ,OAAOC,YAAY,CAACI,OAAO,CAACP,qBAAqBM;aACvDJ,OAAOC,YAAY,CAACK,UAAU,CAACR;IACtC,EAAE,eAAM;IACN,2EAA2E;IAC7E;AACF;AAEA,mEAAmE,GACnE,OAAO,MAAMS,2BAA2B,iBAAgB;AAExD;;;;;;;CAOC,GACD,OAA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Ae2C,UACvBP,KAA2CpC,OAAO;YAAEuC,QAAQ;YAAWI;QAAQ;IACjFU,SAAS,CACPrD,OACA+C,QACGX,KAAmBpC,OAAO;YAAEuC,QAAQ;WAAcQ;IACvDO,SAAS,CAACtD,OAAe2C,UACvBP,KAA2CpC,OAAO;YAAEuC,QAAQ;YAAWI;QAAQ;IACjFY,QAAQ,CAACvD,OAAewD,MAAgBpB,KAA8CpC,OAAO;YAAEuC,QAAQ;YAAUiB;QAAI;IACrHC,UAAU,CAACzD,OAAeuD,SACxBnB,KAA2BpC,OAAO;YAAEuC,QAAQ;YAAYgB;QAAO;IACjEG,WAAW,CAAC1D,OAAeuD,QAAgBI,WACzCvB,KAA2BpC,OAAO;YAAEuC,QAAQ;YAAcgB;YAAQI;QAAS;IAC7EC,MAAM,CAAC5D,OAAeuD,SAAmBnB,KAAmBpC,OAAO;YAAEuC,QAAQ;YAAQgB;QAAO;AAC9F,EAAC"}
1
+ {"version":3,"sources":["../../../../../../../../../libs/plugins/commerce/src/lib/components/console/pos-kiosk/pos-kiosk-api.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\nimport type * as CommerceModel from '../../../model'\nimport { POS_DISPLAY_TOKEN_HEADER } from '../pos-display/pos-display-api'\n\n/**\n * The self-service kiosk's half of `/api/commerce/pos-kiosk` (AGL-3623).\n *\n * Every call carries the kiosk's device token — the customer display's\n * header, because a kiosk is paired exactly like one — and never a staff\n * session. 401 means the kiosk was unpaired (or its register removed), which\n * the page reads as \"pair again\".\n */\nexport const POS_KIOSK_ENDPOINT = '/api/commerce/pos-kiosk'\n\n/**\n * Where the kiosk's token lives on the device: the ONE thing it stores.\n * Nothing a customer chooses or types is ever written to storage.\n */\nexport const POS_KIOSK_TOKEN_KEY = 'aglyn.posKioskToken'\n\nexport interface PosKioskResult<T> {\n ok: boolean\n /** The HTTP status, or 0 when the request never landed. */\n status: number\n value?: T\n error?: string\n}\n\nexport function readKioskToken(): string | null {\n try {\n return window.localStorage.getItem(POS_KIOSK_TOKEN_KEY) || null\n } catch {\n return null\n }\n}\n\nexport function storeKioskToken(token: string | null): void {\n try {\n if (token) window.localStorage.setItem(POS_KIOSK_TOKEN_KEY, token)\n else window.localStorage.removeItem(POS_KIOSK_TOKEN_KEY)\n } catch {\n // Storage blocked: the kiosk works until it reloads, then asks for a code.\n }\n}\n\n/** Every key the kiosk could own on this origin starts with this. */\nexport const POS_KIOSK_STORAGE_PREFIX = 'aglyn.posKiosk'\n\n/**\n * The idle reset's storage sweep: every kiosk key in local and session\n * storage but the device token. The kiosk keeps a customer's cart, email and\n * phone in memory only, so on a working kiosk this finds nothing; it is the\n * guarantee that nothing a customer chose outlives their turn should a later\n * change ever persist some of it. Other pages' keys on the console origin\n * are not the kiosk's to touch.\n */\nexport function clearKioskCustomerStorage(): void {\n for (const pick of [() => window.localStorage, () => window.sessionStorage]) {\n try {\n const storage = pick()\n const keys: string[] = []\n for (let index = 0; index < storage.length; index++) {\n const key = storage.key(index)\n if (key && key.startsWith(POS_KIOSK_STORAGE_PREFIX) && key !== POS_KIOSK_TOKEN_KEY) keys.push(key)\n }\n for (const key of keys) storage.removeItem(key)\n } catch {\n // Blocked storage holds nothing to clear.\n }\n }\n}\n\nasync function call<T>(\n token: string,\n init: { method: 'GET'; query: Record<string, string> } | { method: 'POST'; body: Record<string, unknown>; attemptKey?: string },\n): Promise<PosKioskResult<T>> {\n const headers: Record<string, string> = { [POS_DISPLAY_TOKEN_HEADER]: token }\n if (init.method === 'POST') {\n headers['Content-Type'] = 'application/json'\n if (init.attemptKey) headers['Idempotency-Key'] = init.attemptKey\n }\n try {\n const response = await fetch(\n init.method === 'GET'\n ? `${POS_KIOSK_ENDPOINT}?${new URLSearchParams(init.query).toString()}`\n : POS_KIOSK_ENDPOINT,\n {\n method: init.method,\n headers,\n cache: 'no-store',\n ...(init.method === 'POST' ? { body: JSON.stringify(init.body) } : {}),\n },\n )\n const payload = (await response.json().catch(() => null)) as Record<string, unknown> | null\n if (!response.ok) {\n return {\n ok: false,\n status: response.status,\n error: String(payload?.['error'] ?? 'Something went wrong. Try again.'),\n }\n }\n return { ok: true, status: response.status, value: (payload ?? {}) as T }\n } catch {\n return { ok: false, status: 0, error: 'No connection. Try again.' }\n }\n}\n\nconst post = <T>(token: string, body: Record<string, unknown>, attemptKey?: string) =>\n call<T>(token, { method: 'POST', body, ...(attemptKey ? { attemptKey } : {}) })\n\nexport const kioskApi = {\n context: (token: string) => call<CommerceModel.PosKioskContext>(token, { method: 'GET', query: { action: 'context' } }),\n catalog: (token: string, categoryId: string | null) =>\n call<CommerceModel.PosKioskCatalog>(token, {\n method: 'GET',\n query: { action: 'catalog', ...(categoryId ? { categoryId } : {}) },\n }),\n /** A word typed at the menu, asked of the whole catalog. */\n search: (token: string, search: string) =>\n call<CommerceModel.PosKioskCatalog>(token, { method: 'GET', query: { action: 'catalog', search } }),\n sale: (token: string, orderId: string) =>\n call<{ sale: CommerceModel.PosKioskSale }>(token, { method: 'GET', query: { action: 'sale', orderId } }),\n checkout: (token: string, lines: CommerceModel.PosKioskLine[], attemptKey: string) =>\n post<{ sale: CommerceModel.PosKioskSale }>(token, { action: 'checkout', lines }, attemptKey),\n pay: (\n token: string,\n input: {\n orderId: string\n method: 'reader' | 'tap'\n tipChoice: 'percent' | 'custom' | 'none'\n tipPercent?: number\n tipCents?: number\n },\n attemptKey: string,\n ) =>\n post<{ sale: CommerceModel.PosKioskSale; paymentId?: string; clientSecret?: string; paymentIntentId?: string }>(\n token,\n { action: 'pay', ...input },\n attemptKey,\n ),\n paymentStatus: (token: string, orderId: string, paymentId: string) =>\n post<{ sale: CommerceModel.PosKioskSale }>(token, { action: 'payment-status', orderId, paymentId }),\n cancelPayment: (token: string, orderId: string, paymentId: string) =>\n post<{ sale: CommerceModel.PosKioskSale }>(token, { action: 'cancel-payment', orderId, paymentId }),\n simulate: (token: string, orderId: string, paymentId: string) =>\n post<{ sale: CommerceModel.PosKioskSale }>(token, { action: 'simulate', orderId, paymentId }),\n counter: (token: string, orderId: string) =>\n post<{ sale: CommerceModel.PosKioskSale }>(token, { action: 'counter', orderId }),\n receipt: (\n token: string,\n input: { orderId: string; channel: CommerceModel.PosReceiptChannel; to?: string; marketingOptIn?: boolean },\n ) => post<{ ok: true }>(token, { action: 'receipt', ...input }),\n abandon: (token: string, orderId: string) =>\n post<{ sale: CommerceModel.PosKioskSale }>(token, { action: 'abandon', orderId }),\n unlock: (token: string, pin: string) => post<{ unlock: string; expiresAtMs: number }>(token, { action: 'unlock', pin }),\n settings: (token: string, unlock: string) =>\n post<PosKioskSettingsView>(token, { action: 'settings', unlock }),\n setReader: (token: string, unlock: string, readerId: string) =>\n post<PosKioskSettingsView>(token, { action: 'set-reader', unlock, readerId }),\n exit: (token: string, unlock: string) => post<{ ok: true }>(token, { action: 'exit', unlock }),\n}\n\nexport interface PosKioskSettingsView {\n readers: Array<{ id: string; label: string; status: string }>\n readerId: string | null\n label: string\n}\n"],"names":["POS_DISPLAY_TOKEN_HEADER","POS_KIOSK_ENDPOINT","POS_KIOSK_TOKEN_KEY","readKioskToken","window","localStorage","getItem","storeKioskToken","token","setItem","removeItem","POS_KIOSK_STORAGE_PREFIX","clearKioskCustomerStorage","pick","sessionStorage","storage","keys","index","length","key","startsWith","push","call","init","headers","method","attemptKey","response","fetch","URLSearchParams","query","toString","cache","body","JSON","stringify","payload","json","catch","ok","status","error","String","value","post","kioskApi","context","action","catalog","categoryId","search","sale","orderId","checkout","lines","pay","input","paymentStatus","paymentId","cancelPayment","simulate","counter","receipt","abandon","unlock","pin","settings","setReader","read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,KAAmBpC,OAAO;YAAEuC,QAAQ;YAAQiB;QAAO;AAC9F,EAAC"}
@@ -4,6 +4,8 @@ import { type PosItemChoice } from './pos/pos-item-dialog.component';
4
4
  import { type KioskCartLine } from './pos-kiosk/kiosk-menu';
5
5
  /** How often the kiosk asks after a card payment in flight. */
6
6
  export declare const POS_KIOSK_PAYMENT_POLL_MS = 1500;
7
+ /** How long the typing rests before the word is asked of the catalog. */
8
+ export declare const POS_KIOSK_SEARCH_DEBOUNCE_MS = 400;
7
9
  /** A product as the register's item sheet takes it, from the kiosk's catalog. */
8
10
  export declare function kioskItemProduct(product: CommerceModel.PosKioskProduct): CommerceModel.HostProduct & {
9
11
  $id: string;