@aglyn/plugins-commerce 1.27.0 → 1.28.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aglyn/plugins-commerce",
3
- "version": "1.27.0",
3
+ "version": "1.28.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.27.0",
29
- "@aglyn/shared-data-mdi": "1.27.0",
30
- "@aglyn/shared-ui-jsx": "1.27.0",
31
- "@aglyn/shared-ui-next": "1.27.0",
32
- "@aglyn/shared-ui-snackstack": "1.27.0",
33
- "@aglyn/shared-util-email": "1.27.0",
34
- "@aglyn/shared-util-http": "1.27.0",
35
- "@aglyn/shared-util-timestamp": "1.27.0",
36
- "@aglyn/shared-util-tools": "1.27.0",
37
- "@aglyn/tenant-data-admin": "1.27.0",
38
- "@aglyn/tenant-feature-instance": "1.27.0",
39
- "@aglyn/tenant-runtime": "1.27.0",
28
+ "@aglyn/aglyn": "1.28.0",
29
+ "@aglyn/shared-data-mdi": "1.28.0",
30
+ "@aglyn/shared-ui-jsx": "1.28.0",
31
+ "@aglyn/shared-ui-next": "1.28.0",
32
+ "@aglyn/shared-ui-snackstack": "1.28.0",
33
+ "@aglyn/shared-util-email": "1.28.0",
34
+ "@aglyn/shared-util-http": "1.28.0",
35
+ "@aglyn/shared-util-timestamp": "1.28.0",
36
+ "@aglyn/shared-util-tools": "1.28.0",
37
+ "@aglyn/tenant-data-admin": "1.28.0",
38
+ "@aglyn/tenant-feature-instance": "1.28.0",
39
+ "@aglyn/tenant-runtime": "1.28.0",
40
40
  "@stripe/react-stripe-js": "^7.0.1",
41
41
  "@stripe/stripe-js": "^10.2.1",
42
42
  "@swc/helpers": "0.5.24",
@@ -25,7 +25,8 @@ import { useUser } from "@aglyn/tenant-feature-instance";
25
25
  import { Alert, Box, Button, Card, CardContent, Checkbox, Chip, Dialog, DialogActions, DialogContent, DialogTitle, FormControlLabel, Link, MenuItem, Stack, TextField, Typography } from "@mui/material";
26
26
  import { useCallback, useEffect, useMemo, useState } from "react";
27
27
  import { formatPosHardwareCents, POS_HARDWARE_ANCHOR, POS_HARDWARE_MAX_PER_LINE, POS_HARDWARE_STATUS_LABELS, posPlanPrompt } from "../../model/pos-hardware.js";
28
- import { POS_HARDWARE_TERMS_SECTIONS, posHardwareTermsUrl } from "../../model/pos-hardware-terms.js";
28
+ import { posHardwareTermsUrl } from "../../model/pos-hardware-terms.js";
29
+ import { POS_HARDWARE_RETURN_LABELS as RETURN_LABELS, POS_HARDWARE_SHOP_TEXT as TEXT, posHardwareArrivedNumbers, posHardwareBasket, posHardwareCheckoutState, posHardwareOrderItems, posHardwareReturnOffered, posHardwareReturnReasonReady, posHardwareReturnTitle } from "../../model/pos-hardware-shop.js";
29
30
  import { EntitlementUpsell, useCommerceEntitlement } from "./entitlement-gate.component.js";
30
31
  import { newAttemptKey } from "./pos/pos-api.js";
31
32
  import { openPosHardwareCheckout, posHardwareCatalog, posHardwareCheckout, posHardwareOrders, posHardwareRequestReturn, PosHardwareRequestError } from "./pos/pos-hardware-api.js";
@@ -39,11 +40,6 @@ export const POS_HARDWARE_STATUS_COLOR = {
39
40
  canceled: 'default',
40
41
  refunded: 'default'
41
42
  };
42
- /** What the buyer reads of their return request. */ const RETURN_LABELS = {
43
- requested: 'Return requested',
44
- declined: 'Return declined',
45
- refunded: 'Returned'
46
- };
47
43
  const QUANTITIES = Array.from({
48
44
  length: POS_HARDWARE_MAX_PER_LINE + 1
49
45
  }, (_, index)=>index);
@@ -52,8 +48,6 @@ const placedOn = (ms)=>ms ? new Date(ms).toLocaleDateString([], {
52
48
  day: 'numeric',
53
49
  year: 'numeric'
54
50
  }) : '—';
55
- /** Why Check out is not offered to someone who works the register. */ const BUY_KEY_REASON = 'Only a member with the "Buy point of sale hardware" permission can place an order. Ask an organization admin.';
56
- /** Why Check out waits on the two boxes below the summary (AGL-4038). */ const TERMS_REASON = 'Accept the hardware terms of sale and confirm the hardware is for your business first.';
57
51
  /**
58
52
  * The Hardware card (AGL-4038): Stripe card readers and accessories sold by
59
53
  * the platform and shipped by Stripe straight to the store, with the store's
@@ -69,7 +63,7 @@ const placedOn = (ms)=>ms ? new Date(ms).toLocaleDateString([], {
69
63
  * payments at the register: above the shop, and once an order has arrived,
70
64
  * naming it. The prompt never switches Check out off.
71
65
  */ export function PosHardwareCard({ hostId, canManagePos = false, canBuyHardware = canManagePos }) {
72
- var _ref, _ref1;
66
+ var _ref, _checkoutState_blockedReason;
73
67
  const { data: user } = useUser();
74
68
  const { enqueueSnackbar } = useSnackbar();
75
69
  const [catalog, setCatalog] = useState(null);
@@ -135,7 +129,7 @@ const placedOn = (ms)=>ms ? new Date(ms).toLocaleDateString([], {
135
129
  setBusy(true);
136
130
  try {
137
131
  await posHardwareRequestReturn(user, hostId, returning.id, returnReason.trim());
138
- enqueueSnackbar('Return requested. Our team arranges it with you.', {
132
+ enqueueSnackbar(TEXT.returnSent, {
139
133
  variant: 'success',
140
134
  persist: false
141
135
  });
@@ -143,7 +137,7 @@ const placedOn = (ms)=>ms ? new Date(ms).toLocaleDateString([], {
143
137
  setReturnReason('');
144
138
  await loadOrders();
145
139
  } catch (error) {
146
- enqueueSnackbar(error instanceof PosHardwareRequestError ? error.message : 'The request did not go through', {
140
+ enqueueSnackbar(error instanceof PosHardwareRequestError ? error.message : TEXT.returnFailed, {
147
141
  variant: 'warning',
148
142
  persist: false
149
143
  });
@@ -182,18 +176,30 @@ const placedOn = (ms)=>ms ? new Date(ms).toLocaleDateString([], {
182
176
  }, [
183
177
  available
184
178
  ]);
185
- const lines = useMemo(()=>Object.entries(quantities).filter(([, quantity])=>quantity > 0).map(([sku, quantity])=>({
186
- sku,
187
- quantity
188
- })), [
189
- quantities
190
- ]);
191
179
  const shipping = (catalog == null ? void 0 : catalog.available) ? catalog.shipping.find((option)=>option.method === shippingMethod) : undefined;
192
- const subtotalCents = (catalog == null ? void 0 : catalog.available) ? lines.reduce((sum, line)=>{
180
+ // The basket and its summary, as the apps work them out (pos-hardware-shop.ts).
181
+ const basket = useMemo(()=>{
193
182
  var _ref;
194
- var _catalog_offers_find;
195
- return sum + ((_ref = (_catalog_offers_find = catalog.offers.find((offer)=>offer.sku === line.sku)) == null ? void 0 : _catalog_offers_find.unitCents) != null ? _ref : 0) * line.quantity;
196
- }, 0) : 0;
183
+ return posHardwareBasket({
184
+ offers: (catalog == null ? void 0 : catalog.available) ? catalog.offers : [],
185
+ quantities,
186
+ shippingCents: (_ref = shipping == null ? void 0 : shipping.cents) != null ? _ref : null,
187
+ automaticTax: (catalog == null ? void 0 : catalog.available) ? catalog.automaticTax : false
188
+ });
189
+ }, [
190
+ catalog,
191
+ quantities,
192
+ shipping
193
+ ]);
194
+ const lines = basket.lines;
195
+ const subtotalCents = basket.itemsCents;
196
+ const checkoutState = posHardwareCheckoutState({
197
+ canBuy: canBuyHardware,
198
+ termsAccepted,
199
+ businessUse,
200
+ hasLines: lines.length > 0,
201
+ hasShipping: Boolean(shipping)
202
+ });
197
203
  // One attempt per basket: a second press of the same basket reaches the
198
204
  // same Checkout Session, and a changed basket is a new one.
199
205
  const basketKey = JSON.stringify([
@@ -219,7 +225,7 @@ const placedOn = (ms)=>ms ? new Date(ms).toLocaleDateString([], {
219
225
  });
220
226
  openPosHardwareCheckout(url);
221
227
  } catch (error) {
222
- enqueueSnackbar(error instanceof PosHardwareRequestError ? error.message : 'Checkout could not be started', {
228
+ enqueueSnackbar(error instanceof PosHardwareRequestError ? error.message : TEXT.checkoutFailed, {
223
229
  variant: 'warning',
224
230
  persist: false
225
231
  });
@@ -229,12 +235,12 @@ const placedOn = (ms)=>ms ? new Date(ms).toLocaleDateString([], {
229
235
  const columns = useMemo(()=>[
230
236
  {
231
237
  field: 'number',
232
- headerName: 'Order',
238
+ headerName: TEXT.columnOrder,
233
239
  minWidth: 110
234
240
  },
235
241
  {
236
242
  field: 'createdAtMs',
237
- headerName: 'Placed',
243
+ headerName: TEXT.columnPlaced,
238
244
  type: 'number',
239
245
  minWidth: 120,
240
246
  align: 'left',
@@ -243,21 +249,21 @@ const placedOn = (ms)=>ms ? new Date(ms).toLocaleDateString([], {
243
249
  },
244
250
  {
245
251
  field: 'items',
246
- headerName: 'Items',
252
+ headerName: TEXT.columnItems,
247
253
  flex: 1,
248
254
  minWidth: 200,
249
- valueGetter: (_value, row)=>row.lines.map((line)=>`${line.name} × ${line.quantity}`).join(', ')
255
+ valueGetter: (_value, row)=>posHardwareOrderItems(row.lines)
250
256
  },
251
257
  {
252
258
  field: 'totalCents',
253
- headerName: 'Total',
259
+ headerName: TEXT.columnTotal,
254
260
  type: 'number',
255
261
  minWidth: 100,
256
262
  valueFormatter: (value)=>formatPosHardwareCents(value)
257
263
  },
258
264
  {
259
265
  field: 'status',
260
- headerName: 'Status',
266
+ headerName: TEXT.columnStatus,
261
267
  minWidth: 130,
262
268
  valueGetter: (_value, row)=>POS_HARDWARE_STATUS_LABELS[row.status],
263
269
  renderCell: ({ row })=>/*#__PURE__*/ _jsx(Chip, {
@@ -270,25 +276,25 @@ const placedOn = (ms)=>ms ? new Date(ms).toLocaleDateString([], {
270
276
  // A reader bought in person, or an order shipped to you once it has
271
277
  // shipped (AGL-4038), can be asked back from here.
272
278
  field: 'returnRequest',
273
- headerName: 'Return',
279
+ headerName: TEXT.columnReturn,
274
280
  minWidth: 170,
275
281
  valueGetter: (_value, row)=>{
276
282
  var _RETURN_LABELS_, _ref;
277
283
  var _row_returnRequest;
278
284
  return (_RETURN_LABELS_ = RETURN_LABELS[(_ref = (_row_returnRequest = row.returnRequest) == null ? void 0 : _row_returnRequest.state) != null ? _ref : '']) != null ? _RETURN_LABELS_ : '';
279
285
  },
280
- renderCell: ({ row })=>row.returnRequest ? RETURN_LABELS[row.returnRequest.state] : row.status === 'delivered' || row.status === 'registered' || row.source !== 'in_person' && row.status === 'shipped' ? /*#__PURE__*/ _jsx(Button, {
286
+ renderCell: ({ row })=>row.returnRequest ? RETURN_LABELS[row.returnRequest.state] : posHardwareReturnOffered(row) ? /*#__PURE__*/ _jsx(Button, {
281
287
  size: "small",
282
288
  onClick: (event)=>{
283
289
  event.stopPropagation();
284
290
  setReturning(row);
285
291
  },
286
- children: 'Request a return'
292
+ children: TEXT.returnAction
287
293
  }) : '—'
288
294
  },
289
295
  {
290
296
  field: 'tracking',
291
- headerName: 'Tracking',
297
+ headerName: TEXT.columnTracking,
292
298
  minWidth: 160,
293
299
  valueGetter: (_value, row)=>{
294
300
  var _ref;
@@ -311,10 +317,7 @@ const placedOn = (ms)=>ms ? new Date(ms).toLocaleDateString([], {
311
317
  * Orders shipped from this card that have arrived, for the prompt. A reader
312
318
  * bought from the platform's own store, at an event or online, is prompted
313
319
  * on the Card readers to set up card instead, so it is not named twice.
314
- */ const arrived = posPlan.locked ? (orders != null ? orders : []).filter((order)=>{
315
- var _order_source;
316
- return ((_order_source = order.source) != null ? _order_source : 'online') === 'online' && (order.status === 'delivered' || order.status === 'registered');
317
- }).map((order)=>order.number) : [];
320
+ */ const arrived = posPlan.locked ? posHardwareArrivedNumbers(orders != null ? orders : []) : [];
318
321
  const planPrompt = (text)=>/*#__PURE__*/ _jsx(EntitlementUpsell, {
319
322
  planLabel: posPlan.planLabel,
320
323
  upgradeHref: posPlan.upgradeHref,
@@ -325,7 +328,7 @@ const placedOn = (ms)=>ms ? new Date(ms).toLocaleDateString([], {
325
328
  children: [
326
329
  /*#__PURE__*/ _jsx(Typography, {
327
330
  variant: "subtitle2",
328
- children: 'Your orders'
331
+ children: TEXT.ordersTitle
329
332
  }),
330
333
  arrived.length ? planPrompt(posPlanPrompt({
331
334
  arrived
@@ -333,7 +336,7 @@ const placedOn = (ms)=>ms ? new Date(ms).toLocaleDateString([], {
333
336
  orders && orders.length === 0 ? /*#__PURE__*/ _jsx(Typography, {
334
337
  variant: "body2",
335
338
  color: "text.secondary",
336
- children: 'No hardware orders yet.'
339
+ children: TEXT.noOrders
337
340
  }) : /*#__PURE__*/ _jsx(ListTable, {
338
341
  rows: (orders != null ? orders : []).map((order)=>_extends({}, order, {
339
342
  $id: order.id
@@ -350,7 +353,7 @@ const placedOn = (ms)=>ms ? new Date(ms).toLocaleDateString([], {
350
353
  fullWidth: true,
351
354
  children: [
352
355
  /*#__PURE__*/ _jsx(DialogTitle, {
353
- children: returning ? `Return ${returning.number}?` : ''
356
+ children: returning ? posHardwareReturnTitle(returning.number) : ''
354
357
  }),
355
358
  /*#__PURE__*/ _jsxs(DialogContent, {
356
359
  sx: {
@@ -362,10 +365,10 @@ const placedOn = (ms)=>ms ? new Date(ms).toLocaleDateString([], {
362
365
  /*#__PURE__*/ _jsx(Typography, {
363
366
  variant: "body2",
364
367
  color: "text.secondary",
365
- children: 'Tell us why. Our team gets your request and arranges the return with you. Returns follow the hardware terms of sale: the return shipping is yours to pay, the original shipping is not refunded, and any restocking fee charged for the return comes off the refund.'
368
+ children: TEXT.returnBody
366
369
  }),
367
370
  /*#__PURE__*/ _jsx(TextField, {
368
- label: "Why are you returning it?",
371
+ label: TEXT.returnField,
369
372
  value: returnReason,
370
373
  onChange: (event)=>setReturnReason(event.target.value),
371
374
  multiline: true,
@@ -378,13 +381,13 @@ const placedOn = (ms)=>ms ? new Date(ms).toLocaleDateString([], {
378
381
  children: [
379
382
  /*#__PURE__*/ _jsx(Button, {
380
383
  onClick: ()=>setReturning(null),
381
- children: 'Cancel'
384
+ children: TEXT.returnCancel
382
385
  }),
383
386
  /*#__PURE__*/ _jsx(Button, {
384
387
  variant: "contained",
385
- disabled: busy || returnReason.trim().length < 3,
388
+ disabled: busy || !posHardwareReturnReasonReady(returnReason),
386
389
  onClick: ()=>void requestReturn(),
387
- children: 'Request return'
390
+ children: TEXT.returnSend
388
391
  })
389
392
  ]
390
393
  })
@@ -398,8 +401,8 @@ const placedOn = (ms)=>ms ? new Date(ms).toLocaleDateString([], {
398
401
  if (!(orders == null ? void 0 : orders.length)) return null;
399
402
  return /*#__PURE__*/ _jsx(CardDisplay, {
400
403
  id: POS_HARDWARE_ANCHOR,
401
- header: 'Hardware',
402
- subheader: 'Your card reader orders',
404
+ header: TEXT.header,
405
+ subheader: TEXT.historySubheader,
403
406
  help: pluginDocsHelp('posHardware', {
404
407
  anchor: '#bought-from-us-in-person'
405
408
  }),
@@ -410,21 +413,21 @@ const placedOn = (ms)=>ms ? new Date(ms).toLocaleDateString([], {
410
413
  }
411
414
  return /*#__PURE__*/ _jsx(CardDisplay, {
412
415
  id: POS_HARDWARE_ANCHOR,
413
- header: 'Hardware',
414
- subheader: 'Card readers and accessories, set up and shipped to you',
416
+ header: TEXT.header,
417
+ subheader: TEXT.subheader,
415
418
  help: pluginDocsHelp('posHardware', {
416
419
  anchor: '#buy-a-reader-from-aglyn'
417
420
  }),
418
421
  HeaderProps: {
419
422
  action: /*#__PURE__*/ _jsx(BlockedControl, {
420
- blocked: !canBuyHardware || !termsAccepted || !businessUse,
421
- reason: !canBuyHardware ? BUY_KEY_REASON : TERMS_REASON,
423
+ blocked: checkoutState.blockedReason !== null,
424
+ reason: (_checkoutState_blockedReason = checkoutState.blockedReason) != null ? _checkoutState_blockedReason : '',
422
425
  children: /*#__PURE__*/ _jsx(Button, {
423
426
  size: "small",
424
427
  variant: "contained",
425
428
  disabled: busy || !lines.length || !shipping,
426
429
  onClick: ()=>void checkout(),
427
- children: 'Check out'
430
+ children: TEXT.checkout
428
431
  })
429
432
  })
430
433
  },
@@ -436,17 +439,17 @@ const placedOn = (ms)=>ms ? new Date(ms).toLocaleDateString([], {
436
439
  returned === 'placed' ? /*#__PURE__*/ _jsx(Alert, {
437
440
  severity: "success",
438
441
  onClose: ()=>setReturned(null),
439
- children: 'Thanks, your order is in. It shows under Your orders within a minute, and we email you as it ships.'
442
+ children: TEXT.placed
440
443
  }) : returned === 'canceled' ? /*#__PURE__*/ _jsx(Alert, {
441
444
  severity: "info",
442
445
  onClose: ()=>setReturned(null),
443
- children: 'Checkout was canceled. Nothing was charged.'
446
+ children: TEXT.canceled
444
447
  }) : null,
445
448
  posPlan.locked && !arrived.length ? planPrompt(posPlanPrompt()) : null,
446
449
  /*#__PURE__*/ _jsx(Typography, {
447
450
  variant: "body2",
448
451
  color: "text.secondary",
449
- children: 'Choose the readers and accessories you need. We set each reader up and ship your order to the address you enter at checkout. The delivery email says how to start taking payments with it.'
452
+ children: TEXT.intro
450
453
  }),
451
454
  /*#__PURE__*/ _jsx(Box, {
452
455
  sx: {
@@ -496,7 +499,7 @@ const placedOn = (ms)=>ms ? new Date(ms).toLocaleDateString([], {
496
499
  /*#__PURE__*/ _jsx(TextField, {
497
500
  select: true,
498
501
  size: "small",
499
- label: "Quantity",
502
+ label: TEXT.quantity,
500
503
  value: (_quantities_offer_sku = quantities[offer.sku]) != null ? _quantities_offer_sku : 0,
501
504
  onChange: (event)=>setQuantities((prev)=>_extends({}, prev, {
502
505
  [offer.sku]: Number(event.target.value)
@@ -534,7 +537,7 @@ const placedOn = (ms)=>ms ? new Date(ms).toLocaleDateString([], {
534
537
  /*#__PURE__*/ _jsx(TextField, {
535
538
  select: true,
536
539
  size: "small",
537
- label: "Shipping",
540
+ label: TEXT.shipping,
538
541
  value: shippingMethod,
539
542
  onChange: (event)=>setShippingMethod(event.target.value),
540
543
  sx: {
@@ -555,20 +558,20 @@ const placedOn = (ms)=>ms ? new Date(ms).toLocaleDateString([], {
555
558
  "aria-label": "Order summary",
556
559
  children: [
557
560
  /*#__PURE__*/ _jsx(SummaryRow, {
558
- label: "Items",
561
+ label: TEXT.items,
559
562
  value: formatPosHardwareCents(subtotalCents)
560
563
  }),
561
564
  /*#__PURE__*/ _jsx(SummaryRow, {
562
- label: "Shipping",
565
+ label: TEXT.shipping,
563
566
  value: shipping ? formatPosHardwareCents(shipping.cents) : '—'
564
567
  }),
565
568
  catalog.automaticTax ? /*#__PURE__*/ _jsx(SummaryRow, {
566
- label: "Tax",
567
- value: "Calculated at checkout"
569
+ label: TEXT.tax,
570
+ value: TEXT.taxAtCheckout
568
571
  }) : null,
569
572
  /*#__PURE__*/ _jsx(SummaryRow, {
570
- label: catalog.automaticTax ? 'Total before tax' : 'Total',
571
- value: formatPosHardwareCents(subtotalCents + ((_ref1 = shipping == null ? void 0 : shipping.cents) != null ? _ref1 : 0)),
573
+ label: basket.totalLabel,
574
+ value: formatPosHardwareCents(basket.totalCents),
572
575
  strong: true
573
576
  })
574
577
  ]
@@ -578,7 +581,7 @@ const placedOn = (ms)=>ms ? new Date(ms).toLocaleDateString([], {
578
581
  /*#__PURE__*/ _jsx(Typography, {
579
582
  variant: "caption",
580
583
  color: "text.secondary",
581
- children: 'Ships to street addresses in the United States. P.O. boxes and military addresses are not accepted.'
584
+ children: TEXT.shipsTo
582
585
  }),
583
586
  /*#__PURE__*/ _jsxs(Stack, {
584
587
  children: [
@@ -590,14 +593,14 @@ const placedOn = (ms)=>ms ? new Date(ms).toLocaleDateString([], {
590
593
  label: /*#__PURE__*/ _jsxs(Typography, {
591
594
  variant: "body2",
592
595
  children: [
593
- 'I accept the ',
596
+ TEXT.termsBefore,
594
597
  /*#__PURE__*/ _jsx(Link, {
595
598
  href: posHardwareTermsUrl(),
596
599
  target: "_blank",
597
600
  rel: "noopener noreferrer",
598
- children: `hardware terms of sale (Terms, Sections ${POS_HARDWARE_TERMS_SECTIONS})`
601
+ children: TEXT.termsLink
599
602
  }),
600
- '.'
603
+ TEXT.termsAfter
601
604
  ]
602
605
  })
603
606
  }),
@@ -608,7 +611,7 @@ const placedOn = (ms)=>ms ? new Date(ms).toLocaleDateString([], {
608
611
  }),
609
612
  label: /*#__PURE__*/ _jsx(Typography, {
610
613
  variant: "body2",
611
- children: 'I am buying this hardware for use in my business.'
614
+ children: TEXT.businessUse
612
615
  })
613
616
  })
614
617
  ]
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../../libs/plugins/commerce/src/lib/components/console/pos-hardware-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'use client'\n\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 { useSnackbar } from '@aglyn/shared-ui-snackstack'\nimport { useUser } from '@aglyn/tenant-feature-instance'\nimport {\n Alert,\n Box,\n Button,\n Card,\n CardContent,\n Checkbox,\n Chip,\n Dialog,\n DialogActions,\n DialogContent,\n DialogTitle,\n FormControlLabel,\n Link,\n MenuItem,\n Stack,\n TextField,\n Typography,\n} from '@mui/material'\nimport type { GridColDef } from '@mui/x-data-grid'\nimport { useCallback, useEffect, useMemo, useState } from 'react'\nimport {\n formatPosHardwareCents,\n POS_HARDWARE_ANCHOR,\n POS_HARDWARE_MAX_PER_LINE,\n POS_HARDWARE_STATUS_LABELS,\n posPlanPrompt,\n type PosHardwareOrderStatus,\n type PosHardwareShippingMethod,\n} from '../../model/pos-hardware'\nimport { POS_HARDWARE_TERMS_SECTIONS, posHardwareTermsUrl } from '../../model/pos-hardware-terms'\nimport { EntitlementUpsell, useCommerceEntitlement } from './entitlement-gate.component'\nimport { newAttemptKey } from './pos/pos-api'\nimport {\n openPosHardwareCheckout,\n posHardwareCatalog,\n posHardwareCheckout,\n posHardwareOrders,\n posHardwareRequestReturn,\n PosHardwareRequestError,\n type PosHardwareCatalog,\n type PosHardwareOrderRow,\n} from './pos/pos-hardware-api'\n\n\nexport const POS_HARDWARE_STATUS_COLOR: Record<\n PosHardwareOrderStatus,\n 'default' | 'info' | 'primary' | 'success'\n> = {\n paid: 'info',\n ordered: 'info',\n received: 'info',\n shipped: 'primary',\n delivered: 'success',\n registered: 'success',\n canceled: 'default',\n refunded: 'default',\n}\n\n/** What the buyer reads of their return request. */\nconst RETURN_LABELS: Record<string, string> = {\n requested: 'Return requested',\n declined: 'Return declined',\n refunded: 'Returned',\n}\n\nconst QUANTITIES = Array.from({ length: POS_HARDWARE_MAX_PER_LINE + 1 }, (_, index) => index)\n\nconst placedOn = (ms: number) =>\n ms ? new Date(ms).toLocaleDateString([], { month: 'short', day: 'numeric', year: 'numeric' }) : '—'\n\nexport interface PosHardwareCardProps {\n hostId: string\n /**\n * Whether the viewer may work this site's register (`managePos`). The shop\n * is the register's hardware, so whoever works it is shown the shop.\n */\n canManagePos?: boolean\n /**\n * Whether the viewer may start a checkout (AGL-4047): the \"Buy point of\n * sale hardware\" key the route asks of a checkout. It stands on its own,\n * so a member who holds it without the register is shown the shop and\n * their orders too. Someone who works the register without it sees the\n * shop with Check out disabled and the reason. Absent follows\n * `canManagePos`.\n */\n canBuyHardware?: boolean\n}\n\n/** Why Check out is not offered to someone who works the register. */\nconst BUY_KEY_REASON =\n 'Only a member with the \"Buy point of sale hardware\" permission can place an order. Ask an organization admin.'\n\n/** Why Check out waits on the two boxes below the summary (AGL-4038). */\nconst TERMS_REASON = 'Accept the hardware terms of sale and confirm the hardware is for your business first.'\n\n/**\n * The Hardware card (AGL-4038): Stripe card readers and accessories sold by\n * the platform and shipped by Stripe straight to the store, with the store's\n * orders and their tracking underneath.\n *\n * HIDDEN, NOT DISABLED, while the deployment has not opened the shop: it is a\n * gate only the platform can lift, so naming it would point at a step nobody\n * on the workspace can take. The route answers `available: false` until\n * every price, the markup and the shipping figures are configured.\n *\n * ANYONE CAN BUY (AGL-4038): the shop is open on every plan. A workspace\n * without the point of sale is prompted to add it, because a reader takes\n * payments at the register: above the shop, and once an order has arrived,\n * naming it. The prompt never switches Check out off.\n */\nexport function PosHardwareCard({\n hostId,\n canManagePos = false,\n canBuyHardware = canManagePos,\n}: PosHardwareCardProps) {\n const { data: user } = useUser()\n const { enqueueSnackbar } = useSnackbar()\n const [catalog, setCatalog] = useState<PosHardwareCatalog | null>(null)\n const [orders, setOrders] = useState<PosHardwareOrderRow[] | null>(null)\n const [quantities, setQuantities] = useState<Record<string, number>>({})\n const [shippingMethod, setShippingMethod] = useState<PosHardwareShippingMethod | ''>('')\n const [busy, setBusy] = useState(false)\n const [returned, setReturned] = useState<'placed' | 'canceled' | null>(null)\n // The terms of sale and business use, ticked before checkout (AGL-4038).\n const [termsAccepted, setTermsAccepted] = useState(false)\n const [businessUse, setBusinessUse] = useState(false)\n const uid = user?.uid ?? ''\n // The route's own door (AGL-4047): the register, or the key to buy.\n const mayVisit = canManagePos || canBuyHardware\n // The point of sale, which a reader takes payments with (AGL-4038). Only\n // `locked` prompts: a plan still loading prompts nobody.\n const posPlan = useCommerceEntitlement(hostId, 'pos')\n\n useEffect(() => {\n if (!user || !mayVisit) return\n let active = true\n void posHardwareCatalog(user, hostId)\n .then((answer) => {\n if (active) setCatalog(answer)\n })\n .catch(() => {\n if (active) setCatalog({ available: false })\n })\n return () => {\n active = false\n }\n // Keyed on the person, not the session object.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [uid, hostId, mayVisit])\n\n const available = catalog?.available === true\n\n const loadOrders = useCallback(async () => {\n if (!user) return\n try {\n setOrders((await posHardwareOrders(user, hostId)).orders)\n } catch {\n setOrders([])\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [uid, hostId])\n\n // The orders load whether or not the shop is open: a reader bought in\n // person (AGL-4038) is the workspace's purchase history too.\n useEffect(() => {\n if (mayVisit) void loadOrders()\n }, [mayVisit, loadOrders])\n\n /** The order whose return is being asked for, and why (AGL-4038). */\n const [returning, setReturning] = useState<PosHardwareOrderRow | null>(null)\n const [returnReason, setReturnReason] = useState('')\n const requestReturn = async () => {\n if (!user || !returning) return\n setBusy(true)\n try {\n await posHardwareRequestReturn(user, hostId, returning.id, returnReason.trim())\n enqueueSnackbar('Return requested. Our team arranges it with you.', { variant: 'success', persist: false })\n setReturning(null)\n setReturnReason('')\n await loadOrders()\n } catch (error) {\n enqueueSnackbar(error instanceof PosHardwareRequestError ? error.message : 'The request did not go through', {\n variant: 'warning',\n persist: false,\n })\n } finally {\n setBusy(false)\n }\n }\n\n // The first shipping speed is the default once the catalog answers.\n useEffect(() => {\n if (catalog?.available && !shippingMethod && catalog.shipping.length) {\n setShippingMethod(catalog.shipping[0].method)\n }\n }, [catalog, shippingMethod])\n\n // Back from Checkout: say what happened, then drop the marker from the URL.\n useEffect(() => {\n if (typeof window === 'undefined') return\n const url = new URL(window.location.href)\n const outcome = url.searchParams.get('hardwareOrder')\n if (outcome === 'placed' || outcome === 'canceled') {\n setReturned(outcome)\n url.searchParams.delete('hardwareOrder')\n window.history.replaceState(window.history.state, '', url.toString())\n }\n }, [])\n\n // Arrived by an email's link or Checkout's return: bring the card into view.\n useEffect(() => {\n if (!available || typeof window === 'undefined') return\n if (window.location.hash !== `#${POS_HARDWARE_ANCHOR}`) return\n document.getElementById(POS_HARDWARE_ANCHOR)?.scrollIntoView?.({ block: 'start' })\n }, [available])\n\n const lines = useMemo(\n () =>\n Object.entries(quantities)\n .filter(([, quantity]) => quantity > 0)\n .map(([sku, quantity]) => ({ sku, quantity })),\n [quantities],\n )\n const shipping = catalog?.available ? catalog.shipping.find((option) => option.method === shippingMethod) : undefined\n const subtotalCents = catalog?.available\n ? lines.reduce(\n (sum, line) => sum + (catalog.offers.find((offer) => offer.sku === line.sku)?.unitCents ?? 0) * line.quantity,\n 0,\n )\n : 0\n\n // One attempt per basket: a second press of the same basket reaches the\n // same Checkout Session, and a changed basket is a new one.\n const basketKey = JSON.stringify([lines, shippingMethod])\n // eslint-disable-next-line react-hooks/exhaustive-deps\n const attemptKey = useMemo(() => newAttemptKey(), [basketKey])\n\n const checkout = async () => {\n if (!user || !shippingMethod || !lines.length || !termsAccepted || !businessUse) return\n setBusy(true)\n try {\n const { url } = await posHardwareCheckout(user, attemptKey, {\n hostId,\n lines,\n shippingMethod,\n hardwareTerms: { accepted: termsAccepted, businessUse },\n })\n openPosHardwareCheckout(url)\n } catch (error) {\n enqueueSnackbar(\n error instanceof PosHardwareRequestError ? error.message : 'Checkout could not be started',\n { variant: 'warning', persist: false },\n )\n setBusy(false)\n }\n }\n\n const columns = useMemo<GridColDef[]>(\n () => [\n { field: 'number', headerName: 'Order', minWidth: 110 },\n {\n field: 'createdAtMs',\n headerName: 'Placed',\n type: 'number',\n minWidth: 120,\n align: 'left',\n headerAlign: 'left',\n valueFormatter: (value: number) => placedOn(value),\n },\n {\n field: 'items',\n headerName: 'Items',\n flex: 1,\n minWidth: 200,\n valueGetter: (_value: unknown, row: PosHardwareOrderRow) =>\n row.lines.map((line) => `${line.name} × ${line.quantity}`).join(', '),\n },\n {\n field: 'totalCents',\n headerName: 'Total',\n type: 'number',\n minWidth: 100,\n valueFormatter: (value: number) => formatPosHardwareCents(value),\n },\n {\n field: 'status',\n headerName: 'Status',\n minWidth: 130,\n valueGetter: (_value: unknown, row: PosHardwareOrderRow) => POS_HARDWARE_STATUS_LABELS[row.status],\n renderCell: ({ row }: { row: PosHardwareOrderRow }) => (\n <Chip size=\"small\" color={POS_HARDWARE_STATUS_COLOR[row.status]} label={POS_HARDWARE_STATUS_LABELS[row.status]} />\n ),\n },\n {\n // A reader bought in person, or an order shipped to you once it has\n // shipped (AGL-4038), can be asked back from here.\n field: 'returnRequest',\n headerName: 'Return',\n minWidth: 170,\n valueGetter: (_value: unknown, row: PosHardwareOrderRow) => RETURN_LABELS[row.returnRequest?.state ?? ''] ?? '',\n renderCell: ({ row }: { row: PosHardwareOrderRow }) =>\n row.returnRequest ? (\n RETURN_LABELS[row.returnRequest.state]\n ) : (row.status === 'delivered' || row.status === 'registered' || (row.source !== 'in_person' && row.status === 'shipped')) ? (\n <Button\n size=\"small\"\n onClick={(event) => {\n event.stopPropagation()\n setReturning(row)\n }}\n >\n {'Request a return'}\n </Button>\n ) : (\n '—'\n ),\n },\n {\n field: 'tracking',\n headerName: 'Tracking',\n minWidth: 160,\n valueGetter: (_value: unknown, row: PosHardwareOrderRow) => row.tracking?.number ?? '',\n renderCell: ({ row }: { row: PosHardwareOrderRow }) =>\n row.tracking?.url ? (\n <Link href={row.tracking.url} target=\"_blank\" rel=\"noopener noreferrer\">\n {row.tracking.number}\n </Link>\n ) : (\n row.tracking?.number ?? '—'\n ),\n },\n ],\n [],\n )\n\n /*\n * Orders shipped from this card that have arrived, for the prompt. A reader\n * bought from the platform's own store, at an event or online, is prompted\n * on the Card readers to set up card instead, so it is not named twice.\n */\n const arrived = posPlan.locked\n ? (orders ?? [])\n .filter((order) => (order.source ?? 'online') === 'online' && (order.status === 'delivered' || order.status === 'registered'))\n .map((order) => order.number)\n : []\n const planPrompt = (text: string) => (\n <EntitlementUpsell planLabel={posPlan.planLabel} upgradeHref={posPlan.upgradeHref}>\n {text}\n </EntitlementUpsell>\n )\n\n const ordersSection = (\n <Stack spacing={1}>\n <Typography variant=\"subtitle2\">{'Your orders'}</Typography>\n {arrived.length ? planPrompt(posPlanPrompt({ arrived })) : null}\n {orders && orders.length === 0 ? (\n <Typography variant=\"body2\" color=\"text.secondary\">\n {'No hardware orders yet.'}\n </Typography>\n ) : (\n <ListTable\n rows={(orders ?? []).map((order) => ({ ...order, $id: order.id }))}\n columns={columns}\n loading={orders === null}\n hideFooter\n quickFilter={false}\n />\n )}\n <Dialog open={Boolean(returning)} onClose={() => setReturning(null)} maxWidth=\"sm\" fullWidth>\n <DialogTitle>{returning ? `Return ${returning.number}?` : ''}</DialogTitle>\n <DialogContent sx={{ display: 'flex', flexDirection: 'column', gap: 2 }}>\n <Typography variant=\"body2\" color=\"text.secondary\">\n {'Tell us why. Our team gets your request and arranges the return with you. Returns follow the hardware terms of sale: the return shipping is yours to pay, the original shipping is not refunded, and any restocking fee charged for the return comes off the refund.'}\n </Typography>\n <TextField\n label=\"Why are you returning it?\"\n value={returnReason}\n onChange={(event) => setReturnReason(event.target.value)}\n multiline\n minRows={2}\n fullWidth\n />\n </DialogContent>\n <DialogActions>\n <Button onClick={() => setReturning(null)}>{'Cancel'}</Button>\n <Button variant=\"contained\" disabled={busy || returnReason.trim().length < 3} onClick={() => void requestReturn()}>\n {'Request return'}\n </Button>\n </DialogActions>\n </Dialog>\n </Stack>\n )\n\n // With the shop closed, the card is the purchase history alone, and only\n // when there is one (AGL-4038): a reader bought in person.\n if (!available || !catalog?.available) {\n if (!orders?.length) return null\n return (\n <CardDisplay\n id={POS_HARDWARE_ANCHOR}\n header={'Hardware'}\n subheader={'Your card reader orders'}\n help={pluginDocsHelp('posHardware', { anchor: '#bought-from-us-in-person' })}\n contentGutterX\n contentGutterY\n >\n {ordersSection}\n </CardDisplay>\n )\n }\n\n return (\n <CardDisplay\n id={POS_HARDWARE_ANCHOR}\n header={'Hardware'}\n subheader={'Card readers and accessories, set up and shipped to you'}\n help={pluginDocsHelp('posHardware', { anchor: '#buy-a-reader-from-aglyn' })}\n HeaderProps={{\n action: (\n <BlockedControl\n blocked={!canBuyHardware || !termsAccepted || !businessUse}\n reason={!canBuyHardware ? BUY_KEY_REASON : TERMS_REASON}\n >\n <Button\n size=\"small\"\n variant=\"contained\"\n disabled={busy || !lines.length || !shipping}\n onClick={() => void checkout()}\n >\n {'Check out'}\n </Button>\n </BlockedControl>\n ),\n }}\n contentGutterX\n contentGutterY\n >\n <Stack spacing={3}>\n {returned === 'placed' ? (\n <Alert severity=\"success\" onClose={() => setReturned(null)}>\n {'Thanks, your order is in. It shows under Your orders within a minute, and we email you as it ships.'}\n </Alert>\n ) : returned === 'canceled' ? (\n <Alert severity=\"info\" onClose={() => setReturned(null)}>\n {'Checkout was canceled. Nothing was charged.'}\n </Alert>\n ) : null}\n {posPlan.locked && !arrived.length ? planPrompt(posPlanPrompt()) : null}\n <Typography variant=\"body2\" color=\"text.secondary\">\n {'Choose the readers and accessories you need. We set each reader up and ship your order to the address you enter at checkout. The delivery email says how to start taking payments with it.'}\n </Typography>\n <Box\n sx={{\n display: 'grid',\n gap: 2,\n gridTemplateColumns: { xs: '1fr', sm: 'repeat(2, 1fr)', md: 'repeat(3, 1fr)' },\n }}\n >\n {catalog.offers.map((offer) => (\n <Card key={offer.sku} variant=\"outlined\">\n <CardContent>\n <Stack spacing={1} sx={{ height: '100%' }}>\n <Typography variant=\"subtitle2\">{offer.name}</Typography>\n <Typography variant=\"body2\" color=\"text.secondary\" sx={{ flex: 1 }}>\n {offer.use}\n </Typography>\n <Stack direction=\"row\" spacing={1} sx={{ alignItems: 'center', justifyContent: 'space-between' }}>\n <Typography variant=\"body1\">{formatPosHardwareCents(offer.unitCents)}</Typography>\n <TextField\n select\n size=\"small\"\n label=\"Quantity\"\n value={quantities[offer.sku] ?? 0}\n onChange={(event) =>\n setQuantities((prev) => ({ ...prev, [offer.sku]: Number(event.target.value) }))\n }\n slotProps={{ htmlInput: { 'aria-label': `Quantity of ${offer.name}` } }}\n >\n {QUANTITIES.map((quantity) => (\n <MenuItem key={quantity} value={quantity}>\n {quantity}\n </MenuItem>\n ))}\n </TextField>\n </Stack>\n </Stack>\n </CardContent>\n </Card>\n ))}\n </Box>\n <Stack direction={{ xs: 'column', sm: 'row' }} spacing={2} sx={{ alignItems: { sm: 'flex-start' } }}>\n <TextField\n select\n size=\"small\"\n label=\"Shipping\"\n value={shippingMethod}\n onChange={(event) => setShippingMethod(event.target.value as PosHardwareShippingMethod)}\n sx={{ minWidth: { sm: '40%' } }}\n >\n {catalog.shipping.map((option) => (\n <MenuItem key={option.method} value={option.method}>\n {`${option.label} · ${formatPosHardwareCents(option.cents)}`}\n </MenuItem>\n ))}\n </TextField>\n <Stack spacing={0.5} sx={{ flex: 1 }} aria-label=\"Order summary\">\n <SummaryRow label=\"Items\" value={formatPosHardwareCents(subtotalCents)} />\n <SummaryRow label=\"Shipping\" value={shipping ? formatPosHardwareCents(shipping.cents) : '—'} />\n {catalog.automaticTax ? <SummaryRow label=\"Tax\" value=\"Calculated at checkout\" /> : null}\n <SummaryRow\n label={catalog.automaticTax ? 'Total before tax' : 'Total'}\n value={formatPosHardwareCents(subtotalCents + (shipping?.cents ?? 0))}\n strong\n />\n </Stack>\n </Stack>\n <Typography variant=\"caption\" color=\"text.secondary\">\n {'Ships to street addresses in the United States. P.O. boxes and military addresses are not accepted.'}\n </Typography>\n <Stack>\n <FormControlLabel\n control={<Checkbox checked={termsAccepted} onChange={(event) => setTermsAccepted(event.target.checked)} />}\n label={\n <Typography variant=\"body2\">\n {'I accept the '}\n <Link href={posHardwareTermsUrl()} target=\"_blank\" rel=\"noopener noreferrer\">\n {`hardware terms of sale (Terms, Sections ${POS_HARDWARE_TERMS_SECTIONS})`}\n </Link>\n {'.'}\n </Typography>\n }\n />\n <FormControlLabel\n control={<Checkbox checked={businessUse} onChange={(event) => setBusinessUse(event.target.checked)} />}\n label={<Typography variant=\"body2\">{'I am buying this hardware for use in my business.'}</Typography>}\n />\n </Stack>\n {ordersSection}\n </Stack>\n </CardDisplay>\n )\n}\nPosHardwareCard.displayName = 'PosHardwareCard'\n\nfunction SummaryRow(props: { label: string; value: string; strong?: boolean }) {\n return (\n <Stack direction=\"row\" sx={{ justifyContent: 'space-between' }}>\n <Typography variant=\"body2\" color={props.strong ? 'text.primary' : 'text.secondary'}>\n {props.label}\n </Typography>\n <Typography variant=\"body2\" sx={props.strong ? { fontWeight: 'fontWeightMedium' } : undefined}>\n {props.value}\n </Typography>\n </Stack>\n )\n}\n\nexport default PosHardwareCard\n"],"names":["pluginDocsHelp","CardDisplay","BlockedControl","ListTable","useSnackbar","useUser","Alert","Box","Button","Card","CardContent","Checkbox","Chip","Dialog","DialogActions","DialogContent","DialogTitle","FormControlLabel","Link","MenuItem","Stack","TextField","Typography","useCallback","useEffect","useMemo","useState","formatPosHardwareCents","POS_HARDWARE_ANCHOR","POS_HARDWARE_MAX_PER_LINE","POS_HARDWARE_STATUS_LABELS","posPlanPrompt","POS_HARDWARE_TERMS_SECTIONS","posHardwareTermsUrl","EntitlementUpsell","useCommerceEntitlement","newAttemptKey","openPosHardwareCheckout","posHardwareCatalog","posHardwareCheckout","posHardwareOrders","posHardwareRequestReturn","PosHardwareRequestError","POS_HARDWARE_STATUS_COLOR","paid","ordered","received","shipped","delivered","registered","canceled","refunded","RETURN_LABELS","requested","declined","QUANTITIES","Array","from","length","_","index","placedOn","ms","Date","toLocaleDateString","month","day","year","BUY_KEY_REASON","TERMS_REASON","PosHardwareCard","hostId","canManagePos","canBuyHardware","data","user","enqueueSnackbar","catalog","setCatalog","orders","setOrders","quantities","setQuantities","shippingMethod","setShippingMethod","busy","setBusy","returned","setReturned","termsAccepted","setTermsAccepted","businessUse","setBusinessUse","uid","mayVisit","posPlan","active","then","answer","catch","available","loadOrders","returning","setReturning","returnReason","setReturnReason","requestReturn","id","trim","variant","persist","error","message","shipping","method","window","url","URL","location","href","outcome","searchParams","get","delete","history","replaceState","state","toString","document","hash","getElementById","scrollIntoView","block","lines","Object","entries","filter","quantity","map","sku","find","option","undefined","subtotalCents","reduce","sum","line","offers","offer","unitCents","basketKey","JSON","stringify","attemptKey","checkout","hardwareTerms","accepted","columns","field","headerName","minWidth","type","align","headerAlign","valueFormatter","value","flex","valueGetter","_value","row","name","join","status","renderCell","size","color","label","returnRequest","source","onClick","event","stopPropagation","tracking","number","target","rel","arrived","locked","order","planPrompt","text","planLabel","upgradeHref","ordersSection","spacing","rows","$id","loading","hideFooter","quickFilter","open","Boolean","onClose","maxWidth","fullWidth","sx","display","flexDirection","gap","onChange","multiline","minRows","disabled","header","subheader","help","anchor","contentGutterX","contentGutterY","HeaderProps","action","blocked","reason","severity","gridTemplateColumns","xs","sm","md","height","use","direction","alignItems","justifyContent","select","prev","Number","slotProps","htmlInput","cents","aria-label","SummaryRow","automaticTax","strong","control","checked","displayName","props","fontWeight"],"mappings":"AAAA;;;;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0BAAiB9B,4BAAAA,SAAU6H,KAAK,oBAAI;oCAClEI,MAAM;;;;;;8BAIZ,KAAC5N;oBAAWuF,SAAQ;oBAAUkE,OAAM;8BACjC;;8BAEH,MAAC3J;;sCACC,KAACH;4BACCkO,uBAAS,KAACxO;gCAASyO,SAAS3J;gCAAewH,UAAU,CAAC7B,QAAU1F,iBAAiB0F,MAAMI,MAAM,CAAC4D,OAAO;;4BACrGpE,qBACE,MAAC1J;gCAAWuF,SAAQ;;oCACjB;kDACD,KAAC3F;wCAAKqG,MAAMtF;wCAAuBuJ,QAAO;wCAASC,KAAI;kDACpD,CAAC,wCAAwC,EAAEzJ,4BAA4B,CAAC,CAAC;;oCAE3E;;;;sCAIP,KAACf;4BACCkO,uBAAS,KAACxO;gCAASyO,SAASzJ;gCAAasH,UAAU,CAAC7B,QAAUxF,eAAewF,MAAMI,MAAM,CAAC4D,OAAO;;4BACjGpE,qBAAO,KAAC1J;gCAAWuF,SAAQ;0CAAS;;;;;gBAGvCoF;;;;AAIT;AACA3H,gBAAgB+K,WAAW,GAAG;AAE9B,SAASL,WAAWM,KAAyD;IAC3E,qBACE,MAAClO;QAAMkN,WAAU;QAAMzB,IAAI;YAAE2B,gBAAgB;QAAgB;;0BAC3D,KAAClN;gBAAWuF,SAAQ;gBAAQkE,OAAOuE,MAAMJ,MAAM,GAAG,iBAAiB;0BAChEI,MAAMtE,KAAK;;0BAEd,KAAC1J;gBAAWuF,SAAQ;gBAAQgG,IAAIyC,MAAMJ,MAAM,GAAG;oBAAEK,YAAY;gBAAmB,IAAIzG;0BACjFwG,MAAMjF,KAAK;;;;AAIpB;AAEA,eAAe/F,gBAAe"}
1
+ {"version":3,"sources":["../../../../../../../../libs/plugins/commerce/src/lib/components/console/pos-hardware-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'use client'\n\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 { useSnackbar } from '@aglyn/shared-ui-snackstack'\nimport { useUser } from '@aglyn/tenant-feature-instance'\nimport {\n Alert,\n Box,\n Button,\n Card,\n CardContent,\n Checkbox,\n Chip,\n Dialog,\n DialogActions,\n DialogContent,\n DialogTitle,\n FormControlLabel,\n Link,\n MenuItem,\n Stack,\n TextField,\n Typography,\n} from '@mui/material'\nimport type { GridColDef } from '@mui/x-data-grid'\nimport { useCallback, useEffect, useMemo, useState } from 'react'\nimport {\n formatPosHardwareCents,\n POS_HARDWARE_ANCHOR,\n POS_HARDWARE_MAX_PER_LINE,\n POS_HARDWARE_STATUS_LABELS,\n posPlanPrompt,\n type PosHardwareOrderStatus,\n type PosHardwareShippingMethod,\n} from '../../model/pos-hardware'\nimport { posHardwareTermsUrl } from '../../model/pos-hardware-terms'\nimport {\n POS_HARDWARE_RETURN_LABELS as RETURN_LABELS,\n POS_HARDWARE_SHOP_TEXT as TEXT,\n posHardwareArrivedNumbers,\n posHardwareBasket,\n posHardwareCheckoutState,\n posHardwareOrderItems,\n posHardwareReturnOffered,\n posHardwareReturnReasonReady,\n posHardwareReturnTitle,\n} from '../../model/pos-hardware-shop'\nimport { EntitlementUpsell, useCommerceEntitlement } from './entitlement-gate.component'\nimport { newAttemptKey } from './pos/pos-api'\nimport {\n openPosHardwareCheckout,\n posHardwareCatalog,\n posHardwareCheckout,\n posHardwareOrders,\n posHardwareRequestReturn,\n PosHardwareRequestError,\n type PosHardwareCatalog,\n type PosHardwareOrderRow,\n} from './pos/pos-hardware-api'\n\n\nexport const POS_HARDWARE_STATUS_COLOR: Record<\n PosHardwareOrderStatus,\n 'default' | 'info' | 'primary' | 'success'\n> = {\n paid: 'info',\n ordered: 'info',\n received: 'info',\n shipped: 'primary',\n delivered: 'success',\n registered: 'success',\n canceled: 'default',\n refunded: 'default',\n}\n\nconst QUANTITIES = Array.from({ length: POS_HARDWARE_MAX_PER_LINE + 1 }, (_, index) => index)\n\nconst placedOn = (ms: number) =>\n ms ? new Date(ms).toLocaleDateString([], { month: 'short', day: 'numeric', year: 'numeric' }) : '—'\n\nexport interface PosHardwareCardProps {\n hostId: string\n /**\n * Whether the viewer may work this site's register (`managePos`). The shop\n * is the register's hardware, so whoever works it is shown the shop.\n */\n canManagePos?: boolean\n /**\n * Whether the viewer may start a checkout (AGL-4047): the \"Buy point of\n * sale hardware\" key the route asks of a checkout. It stands on its own,\n * so a member who holds it without the register is shown the shop and\n * their orders too. Someone who works the register without it sees the\n * shop with Check out disabled and the reason. Absent follows\n * `canManagePos`.\n */\n canBuyHardware?: boolean\n}\n\n/**\n * The Hardware card (AGL-4038): Stripe card readers and accessories sold by\n * the platform and shipped by Stripe straight to the store, with the store's\n * orders and their tracking underneath.\n *\n * HIDDEN, NOT DISABLED, while the deployment has not opened the shop: it is a\n * gate only the platform can lift, so naming it would point at a step nobody\n * on the workspace can take. The route answers `available: false` until\n * every price, the markup and the shipping figures are configured.\n *\n * ANYONE CAN BUY (AGL-4038): the shop is open on every plan. A workspace\n * without the point of sale is prompted to add it, because a reader takes\n * payments at the register: above the shop, and once an order has arrived,\n * naming it. The prompt never switches Check out off.\n */\nexport function PosHardwareCard({\n hostId,\n canManagePos = false,\n canBuyHardware = canManagePos,\n}: PosHardwareCardProps) {\n const { data: user } = useUser()\n const { enqueueSnackbar } = useSnackbar()\n const [catalog, setCatalog] = useState<PosHardwareCatalog | null>(null)\n const [orders, setOrders] = useState<PosHardwareOrderRow[] | null>(null)\n const [quantities, setQuantities] = useState<Record<string, number>>({})\n const [shippingMethod, setShippingMethod] = useState<PosHardwareShippingMethod | ''>('')\n const [busy, setBusy] = useState(false)\n const [returned, setReturned] = useState<'placed' | 'canceled' | null>(null)\n // The terms of sale and business use, ticked before checkout (AGL-4038).\n const [termsAccepted, setTermsAccepted] = useState(false)\n const [businessUse, setBusinessUse] = useState(false)\n const uid = user?.uid ?? ''\n // The route's own door (AGL-4047): the register, or the key to buy.\n const mayVisit = canManagePos || canBuyHardware\n // The point of sale, which a reader takes payments with (AGL-4038). Only\n // `locked` prompts: a plan still loading prompts nobody.\n const posPlan = useCommerceEntitlement(hostId, 'pos')\n\n useEffect(() => {\n if (!user || !mayVisit) return\n let active = true\n void posHardwareCatalog(user, hostId)\n .then((answer) => {\n if (active) setCatalog(answer)\n })\n .catch(() => {\n if (active) setCatalog({ available: false })\n })\n return () => {\n active = false\n }\n // Keyed on the person, not the session object.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [uid, hostId, mayVisit])\n\n const available = catalog?.available === true\n\n const loadOrders = useCallback(async () => {\n if (!user) return\n try {\n setOrders((await posHardwareOrders(user, hostId)).orders)\n } catch {\n setOrders([])\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [uid, hostId])\n\n // The orders load whether or not the shop is open: a reader bought in\n // person (AGL-4038) is the workspace's purchase history too.\n useEffect(() => {\n if (mayVisit) void loadOrders()\n }, [mayVisit, loadOrders])\n\n /** The order whose return is being asked for, and why (AGL-4038). */\n const [returning, setReturning] = useState<PosHardwareOrderRow | null>(null)\n const [returnReason, setReturnReason] = useState('')\n const requestReturn = async () => {\n if (!user || !returning) return\n setBusy(true)\n try {\n await posHardwareRequestReturn(user, hostId, returning.id, returnReason.trim())\n enqueueSnackbar(TEXT.returnSent, { variant: 'success', persist: false })\n setReturning(null)\n setReturnReason('')\n await loadOrders()\n } catch (error) {\n enqueueSnackbar(error instanceof PosHardwareRequestError ? error.message : TEXT.returnFailed, {\n variant: 'warning',\n persist: false,\n })\n } finally {\n setBusy(false)\n }\n }\n\n // The first shipping speed is the default once the catalog answers.\n useEffect(() => {\n if (catalog?.available && !shippingMethod && catalog.shipping.length) {\n setShippingMethod(catalog.shipping[0].method)\n }\n }, [catalog, shippingMethod])\n\n // Back from Checkout: say what happened, then drop the marker from the URL.\n useEffect(() => {\n if (typeof window === 'undefined') return\n const url = new URL(window.location.href)\n const outcome = url.searchParams.get('hardwareOrder')\n if (outcome === 'placed' || outcome === 'canceled') {\n setReturned(outcome)\n url.searchParams.delete('hardwareOrder')\n window.history.replaceState(window.history.state, '', url.toString())\n }\n }, [])\n\n // Arrived by an email's link or Checkout's return: bring the card into view.\n useEffect(() => {\n if (!available || typeof window === 'undefined') return\n if (window.location.hash !== `#${POS_HARDWARE_ANCHOR}`) return\n document.getElementById(POS_HARDWARE_ANCHOR)?.scrollIntoView?.({ block: 'start' })\n }, [available])\n\n const shipping = catalog?.available ? catalog.shipping.find((option) => option.method === shippingMethod) : undefined\n // The basket and its summary, as the apps work them out (pos-hardware-shop.ts).\n const basket = useMemo(\n () =>\n posHardwareBasket({\n offers: catalog?.available ? catalog.offers : [],\n quantities,\n shippingCents: shipping?.cents ?? null,\n automaticTax: catalog?.available ? catalog.automaticTax : false,\n }),\n [catalog, quantities, shipping],\n )\n const lines = basket.lines\n const subtotalCents = basket.itemsCents\n const checkoutState = posHardwareCheckoutState({\n canBuy: canBuyHardware,\n termsAccepted,\n businessUse,\n hasLines: lines.length > 0,\n hasShipping: Boolean(shipping),\n })\n\n // One attempt per basket: a second press of the same basket reaches the\n // same Checkout Session, and a changed basket is a new one.\n const basketKey = JSON.stringify([lines, shippingMethod])\n // eslint-disable-next-line react-hooks/exhaustive-deps\n const attemptKey = useMemo(() => newAttemptKey(), [basketKey])\n\n const checkout = async () => {\n if (!user || !shippingMethod || !lines.length || !termsAccepted || !businessUse) return\n setBusy(true)\n try {\n const { url } = await posHardwareCheckout(user, attemptKey, {\n hostId,\n lines,\n shippingMethod,\n hardwareTerms: { accepted: termsAccepted, businessUse },\n })\n openPosHardwareCheckout(url)\n } catch (error) {\n enqueueSnackbar(\n error instanceof PosHardwareRequestError ? error.message : TEXT.checkoutFailed,\n { variant: 'warning', persist: false },\n )\n setBusy(false)\n }\n }\n\n const columns = useMemo<GridColDef[]>(\n () => [\n { field: 'number', headerName: TEXT.columnOrder, minWidth: 110 },\n {\n field: 'createdAtMs',\n headerName: TEXT.columnPlaced,\n type: 'number',\n minWidth: 120,\n align: 'left',\n headerAlign: 'left',\n valueFormatter: (value: number) => placedOn(value),\n },\n {\n field: 'items',\n headerName: TEXT.columnItems,\n flex: 1,\n minWidth: 200,\n valueGetter: (_value: unknown, row: PosHardwareOrderRow) =>\n posHardwareOrderItems(row.lines),\n },\n {\n field: 'totalCents',\n headerName: TEXT.columnTotal,\n type: 'number',\n minWidth: 100,\n valueFormatter: (value: number) => formatPosHardwareCents(value),\n },\n {\n field: 'status',\n headerName: TEXT.columnStatus,\n minWidth: 130,\n valueGetter: (_value: unknown, row: PosHardwareOrderRow) => POS_HARDWARE_STATUS_LABELS[row.status],\n renderCell: ({ row }: { row: PosHardwareOrderRow }) => (\n <Chip size=\"small\" color={POS_HARDWARE_STATUS_COLOR[row.status]} label={POS_HARDWARE_STATUS_LABELS[row.status]} />\n ),\n },\n {\n // A reader bought in person, or an order shipped to you once it has\n // shipped (AGL-4038), can be asked back from here.\n field: 'returnRequest',\n headerName: TEXT.columnReturn,\n minWidth: 170,\n valueGetter: (_value: unknown, row: PosHardwareOrderRow) => RETURN_LABELS[row.returnRequest?.state ?? ''] ?? '',\n renderCell: ({ row }: { row: PosHardwareOrderRow }) =>\n row.returnRequest ? (\n RETURN_LABELS[row.returnRequest.state]\n ) : posHardwareReturnOffered(row) ? (\n <Button\n size=\"small\"\n onClick={(event) => {\n event.stopPropagation()\n setReturning(row)\n }}\n >\n {TEXT.returnAction}\n </Button>\n ) : (\n '—'\n ),\n },\n {\n field: 'tracking',\n headerName: TEXT.columnTracking,\n minWidth: 160,\n valueGetter: (_value: unknown, row: PosHardwareOrderRow) => row.tracking?.number ?? '',\n renderCell: ({ row }: { row: PosHardwareOrderRow }) =>\n row.tracking?.url ? (\n <Link href={row.tracking.url} target=\"_blank\" rel=\"noopener noreferrer\">\n {row.tracking.number}\n </Link>\n ) : (\n row.tracking?.number ?? '—'\n ),\n },\n ],\n [],\n )\n\n /*\n * Orders shipped from this card that have arrived, for the prompt. A reader\n * bought from the platform's own store, at an event or online, is prompted\n * on the Card readers to set up card instead, so it is not named twice.\n */\n const arrived = posPlan.locked\n ? posHardwareArrivedNumbers(orders ?? [])\n : []\n const planPrompt = (text: string) => (\n <EntitlementUpsell planLabel={posPlan.planLabel} upgradeHref={posPlan.upgradeHref}>\n {text}\n </EntitlementUpsell>\n )\n\n const ordersSection = (\n <Stack spacing={1}>\n <Typography variant=\"subtitle2\">{TEXT.ordersTitle}</Typography>\n {arrived.length ? planPrompt(posPlanPrompt({ arrived })) : null}\n {orders && orders.length === 0 ? (\n <Typography variant=\"body2\" color=\"text.secondary\">\n {TEXT.noOrders}\n </Typography>\n ) : (\n <ListTable\n rows={(orders ?? []).map((order) => ({ ...order, $id: order.id }))}\n columns={columns}\n loading={orders === null}\n hideFooter\n quickFilter={false}\n />\n )}\n <Dialog open={Boolean(returning)} onClose={() => setReturning(null)} maxWidth=\"sm\" fullWidth>\n <DialogTitle>{returning ? posHardwareReturnTitle(returning.number) : ''}</DialogTitle>\n <DialogContent sx={{ display: 'flex', flexDirection: 'column', gap: 2 }}>\n <Typography variant=\"body2\" color=\"text.secondary\">\n {TEXT.returnBody}\n </Typography>\n <TextField\n label={TEXT.returnField}\n value={returnReason}\n onChange={(event) => setReturnReason(event.target.value)}\n multiline\n minRows={2}\n fullWidth\n />\n </DialogContent>\n <DialogActions>\n <Button onClick={() => setReturning(null)}>{TEXT.returnCancel}</Button>\n <Button variant=\"contained\" disabled={busy || !posHardwareReturnReasonReady(returnReason)} onClick={() => void requestReturn()}>\n {TEXT.returnSend}\n </Button>\n </DialogActions>\n </Dialog>\n </Stack>\n )\n\n // With the shop closed, the card is the purchase history alone, and only\n // when there is one (AGL-4038): a reader bought in person.\n if (!available || !catalog?.available) {\n if (!orders?.length) return null\n return (\n <CardDisplay\n id={POS_HARDWARE_ANCHOR}\n header={TEXT.header}\n subheader={TEXT.historySubheader}\n help={pluginDocsHelp('posHardware', { anchor: '#bought-from-us-in-person' })}\n contentGutterX\n contentGutterY\n >\n {ordersSection}\n </CardDisplay>\n )\n }\n\n return (\n <CardDisplay\n id={POS_HARDWARE_ANCHOR}\n header={TEXT.header}\n subheader={TEXT.subheader}\n help={pluginDocsHelp('posHardware', { anchor: '#buy-a-reader-from-aglyn' })}\n HeaderProps={{\n action: (\n <BlockedControl\n blocked={checkoutState.blockedReason !== null}\n reason={checkoutState.blockedReason ?? ''}\n >\n <Button\n size=\"small\"\n variant=\"contained\"\n disabled={busy || !lines.length || !shipping}\n onClick={() => void checkout()}\n >\n {TEXT.checkout}\n </Button>\n </BlockedControl>\n ),\n }}\n contentGutterX\n contentGutterY\n >\n <Stack spacing={3}>\n {returned === 'placed' ? (\n <Alert severity=\"success\" onClose={() => setReturned(null)}>\n {TEXT.placed}\n </Alert>\n ) : returned === 'canceled' ? (\n <Alert severity=\"info\" onClose={() => setReturned(null)}>\n {TEXT.canceled}\n </Alert>\n ) : null}\n {posPlan.locked && !arrived.length ? planPrompt(posPlanPrompt()) : null}\n <Typography variant=\"body2\" color=\"text.secondary\">\n {TEXT.intro}\n </Typography>\n <Box\n sx={{\n display: 'grid',\n gap: 2,\n gridTemplateColumns: { xs: '1fr', sm: 'repeat(2, 1fr)', md: 'repeat(3, 1fr)' },\n }}\n >\n {catalog.offers.map((offer) => (\n <Card key={offer.sku} variant=\"outlined\">\n <CardContent>\n <Stack spacing={1} sx={{ height: '100%' }}>\n <Typography variant=\"subtitle2\">{offer.name}</Typography>\n <Typography variant=\"body2\" color=\"text.secondary\" sx={{ flex: 1 }}>\n {offer.use}\n </Typography>\n <Stack direction=\"row\" spacing={1} sx={{ alignItems: 'center', justifyContent: 'space-between' }}>\n <Typography variant=\"body1\">{formatPosHardwareCents(offer.unitCents)}</Typography>\n <TextField\n select\n size=\"small\"\n label={TEXT.quantity}\n value={quantities[offer.sku] ?? 0}\n onChange={(event) =>\n setQuantities((prev) => ({ ...prev, [offer.sku]: Number(event.target.value) }))\n }\n slotProps={{ htmlInput: { 'aria-label': `Quantity of ${offer.name}` } }}\n >\n {QUANTITIES.map((quantity) => (\n <MenuItem key={quantity} value={quantity}>\n {quantity}\n </MenuItem>\n ))}\n </TextField>\n </Stack>\n </Stack>\n </CardContent>\n </Card>\n ))}\n </Box>\n <Stack direction={{ xs: 'column', sm: 'row' }} spacing={2} sx={{ alignItems: { sm: 'flex-start' } }}>\n <TextField\n select\n size=\"small\"\n label={TEXT.shipping}\n value={shippingMethod}\n onChange={(event) => setShippingMethod(event.target.value as PosHardwareShippingMethod)}\n sx={{ minWidth: { sm: '40%' } }}\n >\n {catalog.shipping.map((option) => (\n <MenuItem key={option.method} value={option.method}>\n {`${option.label} · ${formatPosHardwareCents(option.cents)}`}\n </MenuItem>\n ))}\n </TextField>\n <Stack spacing={0.5} sx={{ flex: 1 }} aria-label=\"Order summary\">\n <SummaryRow label={TEXT.items} value={formatPosHardwareCents(subtotalCents)} />\n <SummaryRow label={TEXT.shipping} value={shipping ? formatPosHardwareCents(shipping.cents) : '—'} />\n {catalog.automaticTax ? <SummaryRow label={TEXT.tax} value={TEXT.taxAtCheckout} /> : null}\n <SummaryRow\n label={basket.totalLabel}\n value={formatPosHardwareCents(basket.totalCents)}\n strong\n />\n </Stack>\n </Stack>\n <Typography variant=\"caption\" color=\"text.secondary\">\n {TEXT.shipsTo}\n </Typography>\n <Stack>\n <FormControlLabel\n control={<Checkbox checked={termsAccepted} onChange={(event) => setTermsAccepted(event.target.checked)} />}\n label={\n <Typography variant=\"body2\">\n {TEXT.termsBefore}\n <Link href={posHardwareTermsUrl()} target=\"_blank\" rel=\"noopener noreferrer\">\n {TEXT.termsLink}\n </Link>\n {TEXT.termsAfter}\n </Typography>\n }\n />\n <FormControlLabel\n control={<Checkbox checked={businessUse} onChange={(event) => setBusinessUse(event.target.checked)} />}\n label={<Typography variant=\"body2\">{TEXT.businessUse}</Typography>}\n />\n </Stack>\n {ordersSection}\n </Stack>\n </CardDisplay>\n )\n}\nPosHardwareCard.displayName = 'PosHardwareCard'\n\nfunction SummaryRow(props: { label: string; value: string; strong?: boolean }) {\n return (\n <Stack direction=\"row\" sx={{ justifyContent: 'space-between' }}>\n <Typography variant=\"body2\" color={props.strong ? 'text.primary' : 'text.secondary'}>\n {props.label}\n </Typography>\n <Typography variant=\"body2\" sx={props.strong ? { fontWeight: 'fontWeightMedium' } : undefined}>\n {props.value}\n </Typography>\n </Stack>\n )\n}\n\nexport default PosHardwareCard\n"],"names":["pluginDocsHelp","CardDisplay","BlockedControl","ListTable","useSnackbar","useUser","Alert","Box","Button","Card","CardContent","Checkbox","Chip","Dialog","DialogActions","DialogContent","DialogTitle","FormControlLabel","Link","MenuItem","Stack","TextField","Typography","useCallback","useEffect","useMemo","useState","formatPosHardwareCents","POS_HARDWARE_ANCHOR","POS_HARDWARE_MAX_PER_LINE","POS_HARDWARE_STATUS_LABELS","posPlanPrompt","posHardwareTermsUrl","POS_HARDWARE_RETURN_LABELS","RETURN_LABELS","POS_HARDWARE_SHOP_TEXT","TEXT","posHardwareArrivedNumbers","posHardwareBasket","posHardwareCheckoutState","posHardwareOrderItems","posHardwareReturnOffered","posHardwareReturnReasonReady","posHardwareReturnTitle","EntitlementUpsell","useCommerceEntitlement","newAttemptKey","openPosHardwareCheckout","posHardwareCatalog","posHardwareCheckout","posHardwareOrders","posHardwareRequestReturn","PosHardwareRequestError","POS_HARDWARE_STATUS_COLOR","paid","ordered","received","shipped","delivered","registered","canceled","refunded","QUANTITIES","Array","from","length","_","index","placedOn","ms","Date","toLocaleDateString","month","day","year","PosHardwareCard","hostId","canManagePos","canBuyHardware","checkoutState","data","user","enqueueSnackbar","catalog","setCatalog","orders","setOrders","quantities","setQuantities","shippingMethod","setShippingMethod","busy","setBusy","returned","setReturned","termsAccepted","setTermsAccepted","businessUse","setBusinessUse","uid","mayVisit","posPlan","active","then","answer","catch","available","loadOrders","returning","setReturning","returnReason","setReturnReason","requestReturn","id","trim","returnSent","variant","persist","error","message","returnFailed","shipping","method","window","url","URL","location","href","outcome","searchParams","get","delete","history","replaceState","state","toString","document","hash","getElementById","scrollIntoView","block","find","option","undefined","basket","offers","shippingCents","cents","automaticTax","lines","subtotalCents","itemsCents","canBuy","hasLines","hasShipping","Boolean","basketKey","JSON","stringify","attemptKey","checkout","hardwareTerms","accepted","checkoutFailed","columns","field","headerName","columnOrder","minWidth","columnPlaced","type","align","headerAlign","valueFormatter","value","columnItems","flex","valueGetter","_value","row","columnTotal","columnStatus","status","renderCell","size","color","label","columnReturn","returnRequest","onClick","event","stopPropagation","returnAction","columnTracking","tracking","number","target","rel","arrived","locked","planPrompt","text","planLabel","upgradeHref","ordersSection","spacing","ordersTitle","noOrders","rows","map","order","$id","loading","hideFooter","quickFilter","open","onClose","maxWidth","fullWidth","sx","display","flexDirection","gap","returnBody","returnField","onChange","multiline","minRows","returnCancel","disabled","returnSend","header","subheader","historySubheader","help","anchor","contentGutterX","contentGutterY","HeaderProps","action","blocked","blockedReason","reason","severity","placed","intro","gridTemplateColumns","xs","sm","md","offer","height","name","use","direction","alignItems","justifyContent","unitCents","select","quantity","sku","prev","Number","slotProps","htmlInput","aria-label","SummaryRow","items","tax","taxAtCheckout","totalLabel","totalCents","strong","shipsTo","control","checked","termsBefore","termsLink","termsAfter","displayName","props","fontWeight"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GACD;;;AAEA,SAASA,cAAc,QAAQ,eAAc;AAC7C,SAASC,WAAW,QAAQ,uBAAsB;AAClD,SAASC,cAAc,QAAQ,4DAA2D;AAC1F,SAASC,SAAS,QAAQ,uDAAsD;AAChF,S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O+H,UAAU;oCAC/CC,MAAM;;;;;;8BAIZ,KAAC1P;oBAAW8F,SAAQ;oBAAUqE,OAAM;8BACjCrJ,KAAK6O,OAAO;;8BAEf,MAAC7P;;sCACC,KAACH;4BACCiQ,uBAAS,KAACvQ;gCAASwQ,SAASpL;gCAAekI,UAAU,CAACnC,QAAU9F,iBAAiB8F,MAAMM,MAAM,CAAC+E,OAAO;;4BACrGzF,qBACE,MAACpK;gCAAW8F,SAAQ;;oCACjBhF,KAAKgP,WAAW;kDACjB,KAAClQ;wCAAK6G,MAAM/F;wCAAuBoK,QAAO;wCAASC,KAAI;kDACpDjK,KAAKiP,SAAS;;oCAEhBjP,KAAKkP,UAAU;;;;sCAItB,KAACrQ;4BACCiQ,uBAAS,KAACvQ;gCAASwQ,SAASlL;gCAAagI,UAAU,CAACnC,QAAU5F,eAAe4F,MAAMM,MAAM,CAAC+E,OAAO;;4BACjGzF,qBAAO,KAACpK;gCAAW8F,SAAQ;0CAAShF,KAAK6D,WAAW;;;;;gBAGvD2G;;;;AAIT;AACAjI,gBAAgB4M,WAAW,GAAG;AAE9B,SAASb,WAAWc,KAAyD;IAC3E,qBACE,MAACpQ;QAAM0O,WAAU;QAAMnC,IAAI;YAAEqC,gBAAgB;QAAgB;;0BAC3D,KAAC1O;gBAAW8F,SAAQ;gBAAQqE,OAAO+F,MAAMR,MAAM,GAAG,iBAAiB;0BAChEQ,MAAM9F,KAAK;;0BAEd,KAACpK;gBAAW8F,SAAQ;gBAAQuG,IAAI6D,MAAMR,MAAM,GAAG;oBAAES,YAAY;gBAAmB,IAAI1I;0BACjFyI,MAAM1G,KAAK;;;;AAIpB;AAEA,eAAenG,gBAAe"}
@@ -23,9 +23,10 @@ import { useSnackbar } from "@aglyn/shared-ui-snackstack";
23
23
  import { useUser } from "@aglyn/tenant-feature-instance";
24
24
  import { Button, Divider, MenuItem, Stack, TextField, Typography } from "@mui/material";
25
25
  import { useCallback, useEffect, useState } from "react";
26
+ import { POS_HARDWARE_WAITING_TEXT as TEXT, posHardwareWaitingItems, posHardwareWaitingNote } from "../../model/pos-hardware-shop.js";
26
27
  import { EntitlementUpsell, useCommerceEntitlement } from "./entitlement-gate.component.js";
27
28
  import { PosHardwareRequestError, posHardwareChooseStore, posHardwareMarkSetUp, posHardwareWaiting } from "./pos/pos-hardware-api.js";
28
- const items = (order)=>order.lines.map((line)=>`${line.quantity} × ${line.name}`).join(', ');
29
+ const items = (order)=>posHardwareWaitingItems(order.lines);
29
30
  /**
30
31
  * Card readers this workspace bought in person, waiting to be set up
31
32
  * (AGL-4038). Each says the one thing it still needs, in order:
@@ -75,7 +76,7 @@ const items = (order)=>order.lines.map((line)=>`${line.quantity} × ${line.name}
75
76
  });
76
77
  await load();
77
78
  } catch (error) {
78
- enqueueSnackbar(error instanceof PosHardwareRequestError ? error.message : 'That did not work. Try again.', {
79
+ enqueueSnackbar(error instanceof PosHardwareRequestError ? error.message : TEXT.failed, {
79
80
  variant: 'warning',
80
81
  persist: false
81
82
  });
@@ -85,10 +86,10 @@ const items = (order)=>order.lines.map((line)=>`${line.quantity} × ${line.name}
85
86
  };
86
87
  if (!user || !(waiting == null ? void 0 : waiting.orders.length)) return null;
87
88
  const devicesReason = devicesBlockedReason || undefined;
88
- const planReason = waiting.posPlan ? undefined : 'Add a plan with the point of sale first.';
89
+ const planReason = waiting.posPlan ? undefined : TEXT.planReason;
89
90
  return /*#__PURE__*/ _jsx(CardDisplay, {
90
- header: 'Card readers to set up',
91
- subheader: 'Bought in person, ready for your store',
91
+ header: TEXT.header,
92
+ subheader: TEXT.subheader,
92
93
  help: pluginDocsHelp('posHardware', {
93
94
  anchor: '#card-readers-to-set-up'
94
95
  }),
@@ -103,7 +104,7 @@ const items = (order)=>order.lines.map((line)=>`${line.quantity} × ${line.name}
103
104
  waiting.posPlan ? null : /*#__PURE__*/ _jsx(EntitlementUpsell, {
104
105
  planLabel: plan.planLabel,
105
106
  upgradeHref: plan.upgradeHref,
106
- children: 'A card reader takes payments at the register, which comes with the point of sale. Add it, then set the reader up here.'
107
+ children: TEXT.planPrompt
107
108
  }),
108
109
  waiting.orders.map((order)=>{
109
110
  var _ref, _chosen_order_id, _ref1, _ref2;
@@ -124,12 +125,13 @@ const items = (order)=>order.lines.map((line)=>`${line.quantity} × ${line.name}
124
125
  }),
125
126
  store ? /*#__PURE__*/ _jsxs(_Fragment, {
126
127
  children: [
127
- /*#__PURE__*/ _jsxs(Typography, {
128
+ /*#__PURE__*/ _jsx(Typography, {
128
129
  variant: "body2",
129
- children: [
130
- order.serialsTaken ? `For ${store.name}. Add it on the POS devices card with the code it shows, and it is set up: we know its serial number.` : `For ${store.name}. Add it on the POS devices card with the code it shows, then mark it set up.`,
131
- store.hasLocation ? '' : ' The first reader asks for the store’s address.'
132
- ]
130
+ children: posHardwareWaitingNote({
131
+ storeName: store.name,
132
+ serialsTaken: order.serialsTaken,
133
+ hasLocation: store.hasLocation
134
+ })
133
135
  }),
134
136
  /*#__PURE__*/ _jsxs(Stack, {
135
137
  direction: "row",
@@ -142,7 +144,7 @@ const items = (order)=>order.lines.map((line)=>`${line.quantity} × ${line.name}
142
144
  variant: "contained",
143
145
  size: "small",
144
146
  href: store.setupUrl,
145
- children: 'Open POS devices'
147
+ children: TEXT.openDevices
146
148
  })
147
149
  }),
148
150
  /*#__PURE__*/ _jsx(BlockedControl, {
@@ -151,8 +153,8 @@ const items = (order)=>order.lines.map((line)=>`${line.quantity} × ${line.name}
151
153
  children: /*#__PURE__*/ _jsx(Button, {
152
154
  size: "small",
153
155
  disabled: busy === order.id,
154
- onClick: ()=>void act(order.id, ()=>posHardwareMarkSetUp(user, order.hostId, order.id), 'Marked set up'),
155
- children: 'Mark set up'
156
+ onClick: ()=>void act(order.id, ()=>posHardwareMarkSetUp(user, order.hostId, order.id), TEXT.marked),
157
+ children: TEXT.markSetUp
156
158
  })
157
159
  })
158
160
  ]
@@ -168,7 +170,7 @@ const items = (order)=>order.lines.map((line)=>`${line.quantity} × ${line.name}
168
170
  /*#__PURE__*/ _jsx(TextField, {
169
171
  select: true,
170
172
  size: "small",
171
- label: "Which store is it for?",
173
+ label: TEXT.whichStore,
172
174
  value: pick,
173
175
  onChange: (event)=>setChosen(_extends({}, chosen, {
174
176
  [order.id]: event.target.value
@@ -187,8 +189,8 @@ const items = (order)=>order.lines.map((line)=>`${line.quantity} × ${line.name}
187
189
  children: /*#__PURE__*/ _jsx(Button, {
188
190
  size: "small",
189
191
  disabled: !pick || busy === order.id,
190
- onClick: ()=>void act(order.id, ()=>posHardwareChooseStore(user, pick, order.id), 'Store chosen'),
191
- children: 'Choose'
192
+ onClick: ()=>void act(order.id, ()=>posHardwareChooseStore(user, pick, order.id), TEXT.chosen),
193
+ children: TEXT.choose
192
194
  })
193
195
  })
194
196
  ]
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../../libs/plugins/commerce/src/lib/components/console/pos-hardware-waiting-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'use client'\n\nimport { pluginDocsHelp } from '@aglyn/aglyn'\nimport { CardDisplay } from '@aglyn/shared-ui-jsx'\nimport { BlockedControl } from '@aglyn/shared-ui-jsx/components/blocked-control.component'\nimport { useSnackbar } from '@aglyn/shared-ui-snackstack'\nimport { useUser } from '@aglyn/tenant-feature-instance'\nimport { Button, Divider, MenuItem, Stack, TextField, Typography } from '@mui/material'\nimport { useCallback, useEffect, useState } from 'react'\nimport { EntitlementUpsell, useCommerceEntitlement } from './entitlement-gate.component'\nimport {\n PosHardwareRequestError,\n posHardwareChooseStore,\n posHardwareMarkSetUp,\n posHardwareWaiting,\n type WaitingReaderOrder,\n type WaitingReaders,\n} from './pos/pos-hardware-api'\n\nexport interface PosHardwareWaitingCardProps {\n hostId: string\n /**\n * Why the member may not set up devices on this store (`posDevices`), or\n * nothing when they may. Passed in, not resolved here: this card is its own\n * chunk, and reaching into the permissions model from it would pull that\n * eagerly loaded module apart.\n */\n devicesBlockedReason?: string\n}\n\nconst items = (order: WaitingReaderOrder) => order.lines.map((line) => `${line.quantity} × ${line.name}`).join(', ')\n\n/**\n * Card readers this workspace bought in person, waiting to be set up\n * (AGL-4038). Each says the one thing it still needs, in order:\n *\n * 1. a plan with the point of sale, which registering a reader needs;\n * 2. the store it is for, when nobody chose one at the sale;\n * 3. adding it on that store's POS devices card by the code it shows —\n * by itself it then moves to Set up when its serial was taken at the\n * sale, and otherwise \"Mark set up\" says it is done.\n *\n * Drawn only while there is such a reader. Loaded on its own.\n */\nfunction PosHardwareWaitingCard(props: PosHardwareWaitingCardProps) {\n const { hostId, devicesBlockedReason } = props\n const { data: user } = useUser()\n const { enqueueSnackbar } = useSnackbar()\n const plan = useCommerceEntitlement(hostId, 'pos')\n const [waiting, setWaiting] = useState<WaitingReaders | null>(null)\n const [chosen, setChosen] = useState<Record<string, string>>({})\n const [busy, setBusy] = useState('')\n const uid = user?.uid ?? ''\n\n const load = useCallback(async () => {\n if (!user) return\n try {\n setWaiting(await posHardwareWaiting(user, hostId))\n } catch {\n setWaiting(null)\n }\n // Keyed on the person, not the session object.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [uid, hostId])\n\n useEffect(() => {\n void load()\n }, [load])\n\n const act = async (orderId: string, run: () => Promise<unknown>, done: string) => {\n setBusy(orderId)\n try {\n await run()\n enqueueSnackbar(done, { variant: 'success', persist: false })\n await load()\n } catch (error) {\n enqueueSnackbar(error instanceof PosHardwareRequestError ? error.message : 'That did not work. Try again.', {\n variant: 'warning',\n persist: false,\n })\n } finally {\n setBusy('')\n }\n }\n\n if (!user || !waiting?.orders.length) return null\n const devicesReason = devicesBlockedReason || undefined\n const planReason = waiting.posPlan ? undefined : 'Add a plan with the point of sale first.'\n\n return (\n <CardDisplay\n header={'Card readers to set up'}\n subheader={'Bought in person, ready for your store'}\n help={pluginDocsHelp('posHardware', { anchor: '#card-readers-to-set-up' })}\n contentGutterX\n contentGutterY\n >\n <Stack spacing={2} divider={<Divider flexItem />}>\n {waiting.posPlan ? null : (\n <EntitlementUpsell planLabel={plan.planLabel} upgradeHref={plan.upgradeHref}>\n {'A card reader takes payments at the register, which comes with the point of sale. Add it, then set the reader up here.'}\n </EntitlementUpsell>\n )}\n {waiting.orders.map((order) => {\n const store = waiting.stores.find((candidate) => candidate.hostId === order.hostId)\n const pick = chosen[order.id] ?? waiting.stores[0]?.hostId ?? ''\n return (\n <Stack key={order.id} spacing={1}>\n <Typography variant=\"subtitle2\">{items(order)}</Typography>\n <Typography variant=\"body2\" color=\"text.secondary\">\n {`Order ${order.number} · bought ${new Date(order.createdAtMs).toLocaleDateString()}`}\n </Typography>\n {store ? (\n <>\n <Typography variant=\"body2\">\n {order.serialsTaken\n ? `For ${store.name}. Add it on the POS devices card with the code it shows, and it is set up: we know its serial number.`\n : `For ${store.name}. Add it on the POS devices card with the code it shows, then mark it set up.`}\n {store.hasLocation ? '' : ' The first reader asks for the store’s address.'}\n </Typography>\n <Stack direction=\"row\" spacing={1}>\n <BlockedControl blocked={Boolean(planReason ?? devicesReason)} reason={planReason ?? devicesReason ?? ''}>\n <Button variant=\"contained\" size=\"small\" href={store.setupUrl}>\n {'Open POS devices'}\n </Button>\n </BlockedControl>\n <BlockedControl blocked={Boolean(planReason ?? devicesReason)} reason={planReason ?? devicesReason ?? ''}>\n <Button\n size=\"small\"\n disabled={busy === order.id}\n onClick={() =>\n void act(order.id, () => posHardwareMarkSetUp(user, order.hostId, order.id), 'Marked set up')\n }\n >\n {'Mark set up'}\n </Button>\n </BlockedControl>\n </Stack>\n </>\n ) : (\n <Stack direction=\"row\" spacing={1} sx={{ alignItems: 'center' }}>\n <TextField\n select\n size=\"small\"\n label=\"Which store is it for?\"\n value={pick}\n onChange={(event) => setChosen({ ...chosen, [order.id]: event.target.value })}\n sx={{ minWidth: (theme) => theme.spacing(30) }}\n >\n {waiting.stores.map((candidate) => (\n <MenuItem key={candidate.hostId} value={candidate.hostId}>\n {candidate.name}\n </MenuItem>\n ))}\n </TextField>\n <BlockedControl blocked={Boolean(planReason)} reason={planReason ?? ''}>\n <Button\n size=\"small\"\n disabled={!pick || busy === order.id}\n onClick={() =>\n void act(order.id, () => posHardwareChooseStore(user, pick, order.id), 'Store chosen')\n }\n >\n {'Choose'}\n </Button>\n </BlockedControl>\n </Stack>\n )}\n </Stack>\n )\n })}\n </Stack>\n </CardDisplay>\n )\n}\n\nexport default PosHardwareWaitingCard\n"],"names":["pluginDocsHelp","CardDisplay","BlockedControl","useSnackbar","useUser","Button","Divider","MenuItem","Stack","TextField","Typography","useCallback","useEffect","useState","EntitlementUpsell","useCommerceEntitlement","PosHardwareRequestError","posHardwareChooseStore","posHardwareMarkSetUp","posHardwareWaiting","items","order","lines","map","line","quantity","name","join","PosHardwareWaitingCard","props","hostId","devicesBlockedReason","data","user","enqueueSnackbar","plan","waiting","setWaiting","chosen","setChosen","busy","setBusy","uid","load","act","orderId","run","done","variant","persist","error","message","orders","length","devicesReason","undefined","planReason","posPlan","header","subheader","help","anchor","contentGutterX","contentGutterY","spacing","divider","flexItem","planLabel","upgradeHref","store","stores","find","candidate","pick","id","color","number","Date","createdAtMs","toLocaleDateString","serialsTaken","hasLocation","direction","blocked","Boolean","reason","size","href","setupUrl","disabled","onClick","sx","alignItems","select","label","value","onChange","event","target","minWidth","theme"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GACD;;;AAEA,SAASA,cAAc,QAAQ,eAAc;AAC7C,SAASC,WAAW,QAAQ,uBAAsB;AAClD,SAASC,cAAc,QAAQ,4DAA2D;AAC1F,SAASC,WAAW,QAAQ,8BAA6B;AACzD,SAASC,OAAO,QAA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UAAU,CAACC,QAAUA,MAAMpC,OAAO,CAAC;wCAAI;kDAE5C5B,QAAQkC,MAAM,CAAC/C,GAAG,CAAC,CAACiD,0BACnB,KAACjE;gDAAgCwF,OAAOvB,UAAU1C,MAAM;0DACrD0C,UAAU9C,IAAI;+CADF8C,UAAU1C,MAAM;;kDAKnC,KAAC5B;wCAAeiF,SAASC,QAAQ5B;wCAAa6B,MAAM,EAAE7B,qBAAAA,aAAc;kDAClE,cAAA,KAACnD;4CACCiF,MAAK;4CACLG,UAAU,CAAChB,QAAQjC,SAASnB,MAAMqD,EAAE;4CACpCgB,SAAS,IACP,KAAK9C,IAAIvB,MAAMqD,EAAE,EAAE,IAAMzD,uBAAuBgB,MAAMwC,MAAMpD,MAAMqD,EAAE,GAAG;sDAGxE;;;;;;uBAxDCrD,MAAMqD,EAAE;gBA+DxB;;;;AAIR;AAEA,eAAe9C,uBAAsB"}
1
+ {"version":3,"sources":["../../../../../../../../libs/plugins/commerce/src/lib/components/console/pos-hardware-waiting-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'use client'\n\nimport { pluginDocsHelp } from '@aglyn/aglyn'\nimport { CardDisplay } from '@aglyn/shared-ui-jsx'\nimport { BlockedControl } from '@aglyn/shared-ui-jsx/components/blocked-control.component'\nimport { useSnackbar } from '@aglyn/shared-ui-snackstack'\nimport { useUser } from '@aglyn/tenant-feature-instance'\nimport { Button, Divider, MenuItem, Stack, TextField, Typography } from '@mui/material'\nimport { useCallback, useEffect, useState } from 'react'\nimport {\n POS_HARDWARE_WAITING_TEXT as TEXT,\n posHardwareWaitingItems,\n posHardwareWaitingNote,\n} from '../../model/pos-hardware-shop'\nimport { EntitlementUpsell, useCommerceEntitlement } from './entitlement-gate.component'\nimport {\n PosHardwareRequestError,\n posHardwareChooseStore,\n posHardwareMarkSetUp,\n posHardwareWaiting,\n type WaitingReaderOrder,\n type WaitingReaders,\n} from './pos/pos-hardware-api'\n\nexport interface PosHardwareWaitingCardProps {\n hostId: string\n /**\n * Why the member may not set up devices on this store (`posDevices`), or\n * nothing when they may. Passed in, not resolved here: this card is its own\n * chunk, and reaching into the permissions model from it would pull that\n * eagerly loaded module apart.\n */\n devicesBlockedReason?: string\n}\n\nconst items = (order: WaitingReaderOrder) => posHardwareWaitingItems(order.lines)\n\n/**\n * Card readers this workspace bought in person, waiting to be set up\n * (AGL-4038). Each says the one thing it still needs, in order:\n *\n * 1. a plan with the point of sale, which registering a reader needs;\n * 2. the store it is for, when nobody chose one at the sale;\n * 3. adding it on that store's POS devices card by the code it shows —\n * by itself it then moves to Set up when its serial was taken at the\n * sale, and otherwise \"Mark set up\" says it is done.\n *\n * Drawn only while there is such a reader. Loaded on its own.\n */\nfunction PosHardwareWaitingCard(props: PosHardwareWaitingCardProps) {\n const { hostId, devicesBlockedReason } = props\n const { data: user } = useUser()\n const { enqueueSnackbar } = useSnackbar()\n const plan = useCommerceEntitlement(hostId, 'pos')\n const [waiting, setWaiting] = useState<WaitingReaders | null>(null)\n const [chosen, setChosen] = useState<Record<string, string>>({})\n const [busy, setBusy] = useState('')\n const uid = user?.uid ?? ''\n\n const load = useCallback(async () => {\n if (!user) return\n try {\n setWaiting(await posHardwareWaiting(user, hostId))\n } catch {\n setWaiting(null)\n }\n // Keyed on the person, not the session object.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [uid, hostId])\n\n useEffect(() => {\n void load()\n }, [load])\n\n const act = async (orderId: string, run: () => Promise<unknown>, done: string) => {\n setBusy(orderId)\n try {\n await run()\n enqueueSnackbar(done, { variant: 'success', persist: false })\n await load()\n } catch (error) {\n enqueueSnackbar(error instanceof PosHardwareRequestError ? error.message : TEXT.failed, {\n variant: 'warning',\n persist: false,\n })\n } finally {\n setBusy('')\n }\n }\n\n if (!user || !waiting?.orders.length) return null\n const devicesReason = devicesBlockedReason || undefined\n const planReason = waiting.posPlan ? undefined : TEXT.planReason\n\n return (\n <CardDisplay\n header={TEXT.header}\n subheader={TEXT.subheader}\n help={pluginDocsHelp('posHardware', { anchor: '#card-readers-to-set-up' })}\n contentGutterX\n contentGutterY\n >\n <Stack spacing={2} divider={<Divider flexItem />}>\n {waiting.posPlan ? null : (\n <EntitlementUpsell planLabel={plan.planLabel} upgradeHref={plan.upgradeHref}>\n {TEXT.planPrompt}\n </EntitlementUpsell>\n )}\n {waiting.orders.map((order) => {\n const store = waiting.stores.find((candidate) => candidate.hostId === order.hostId)\n const pick = chosen[order.id] ?? waiting.stores[0]?.hostId ?? ''\n return (\n <Stack key={order.id} spacing={1}>\n <Typography variant=\"subtitle2\">{items(order)}</Typography>\n <Typography variant=\"body2\" color=\"text.secondary\">\n {`Order ${order.number} · bought ${new Date(order.createdAtMs).toLocaleDateString()}`}\n </Typography>\n {store ? (\n <>\n <Typography variant=\"body2\">\n {posHardwareWaitingNote({\n storeName: store.name,\n serialsTaken: order.serialsTaken,\n hasLocation: store.hasLocation,\n })}\n </Typography>\n <Stack direction=\"row\" spacing={1}>\n <BlockedControl blocked={Boolean(planReason ?? devicesReason)} reason={planReason ?? devicesReason ?? ''}>\n <Button variant=\"contained\" size=\"small\" href={store.setupUrl}>\n {TEXT.openDevices}\n </Button>\n </BlockedControl>\n <BlockedControl blocked={Boolean(planReason ?? devicesReason)} reason={planReason ?? devicesReason ?? ''}>\n <Button\n size=\"small\"\n disabled={busy === order.id}\n onClick={() =>\n void act(order.id, () => posHardwareMarkSetUp(user, order.hostId, order.id), TEXT.marked)\n }\n >\n {TEXT.markSetUp}\n </Button>\n </BlockedControl>\n </Stack>\n </>\n ) : (\n <Stack direction=\"row\" spacing={1} sx={{ alignItems: 'center' }}>\n <TextField\n select\n size=\"small\"\n label={TEXT.whichStore}\n value={pick}\n onChange={(event) => setChosen({ ...chosen, [order.id]: event.target.value })}\n sx={{ minWidth: (theme) => theme.spacing(30) }}\n >\n {waiting.stores.map((candidate) => (\n <MenuItem key={candidate.hostId} value={candidate.hostId}>\n {candidate.name}\n </MenuItem>\n ))}\n </TextField>\n <BlockedControl blocked={Boolean(planReason)} reason={planReason ?? ''}>\n <Button\n size=\"small\"\n disabled={!pick || busy === order.id}\n onClick={() =>\n void act(order.id, () => posHardwareChooseStore(user, pick, order.id), TEXT.chosen)\n }\n >\n {TEXT.choose}\n </Button>\n </BlockedControl>\n </Stack>\n )}\n </Stack>\n )\n })}\n </Stack>\n </CardDisplay>\n )\n}\n\nexport default PosHardwareWaitingCard\n"],"names":["pluginDocsHelp","CardDisplay","BlockedControl","useSnackbar","useUser","Button","Divider","MenuItem","Stack","TextField","Typography","useCallback","useEffect","useState","POS_HARDWARE_WAITING_TEXT","TEXT","posHardwareWaitingItems","posHardwareWaitingNote","EntitlementUpsell","useCommerceEntitlement","PosHardwareRequestError","posHardwareChooseStore","posHardwareMarkSetUp","posHardwareWaiting","items","order","lines","PosHardwareWaitingCard","props","hostId","devicesBlockedReason","data","user","enqueueSnackbar","plan","waiting","setWaiting","chosen","setChosen","busy","setBusy","uid","load","act","orderId","run","done","variant","persist","error","message","failed","orders","length","devicesReason","undefined","planReason","posPlan","header","subheader","help","anchor","contentGutterX","contentGutterY","spacing","divider","flexItem","planLabel","upgradeHref","planPrompt","map","store","stores","find","candidate","pick","id","color","number","Date","createdAtMs","toLocaleDateString","storeName","name","serialsTaken","hasLocation","direction","blocked","Boolean","reason","size","href","setupUrl","openDevices","disabled","onClick","marked","markSetUp","sx","alignItems","select","label","whichStore","value","onChange","event","target","minWidth","theme","choose"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GACD;;;AAEA,SAASA,cAAc,QAAQ,eAAc;AAC7C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AOtF,KAAKuF,UAAU;wCACtBC,OAAO5B;wCACP6B,UAAU,CAACC,QAAUnE,UAAU,aAAKD;gDAAQ,CAACZ,MAAMmD,EAAE,CAAC,EAAE6B,MAAMC,MAAM,CAACH,KAAK;;wCAC1EL,IAAI;4CAAES,UAAU,CAACC,QAAUA,MAAM5C,OAAO,CAAC;wCAAI;kDAE5C7B,QAAQqC,MAAM,CAACF,GAAG,CAAC,CAACI,0BACnB,KAACnE;gDAAgCgG,OAAO7B,UAAU7C,MAAM;0DACrD6C,UAAUS,IAAI;+CADFT,UAAU7C,MAAM;;kDAKnC,KAAC3B;wCAAeqF,SAASC,QAAQhC;wCAAaiC,MAAM,EAAEjC,qBAAAA,aAAc;kDAClE,cAAA,KAACnD;4CACCqF,MAAK;4CACLI,UAAU,CAACnB,QAAQpC,SAASd,MAAMmD,EAAE;4CACpCmB,SAAS,IACP,KAAKpD,IAAIlB,MAAMmD,EAAE,EAAE,IAAMvD,uBAAuBW,MAAM2C,MAAMlD,MAAMmD,EAAE,GAAG7D,KAAKsB,MAAM;sDAGnFtB,KAAK8F,MAAM;;;;;;uBAzDVpF,MAAMmD,EAAE;gBAgExB;;;;AAIR;AAEA,eAAejD,uBAAsB"}
@@ -0,0 +1,152 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Aglyn LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ /** What the buyer reads of their return request. */
18
+ export declare const POS_HARDWARE_RETURN_LABELS: Record<string, string>;
19
+ /** The Hardware card's words. */
20
+ export declare const POS_HARDWARE_SHOP_TEXT: {
21
+ readonly header: "Hardware";
22
+ readonly subheader: "Card readers and accessories, set up and shipped to you";
23
+ /** The card while the shop is closed: the purchase history alone. */
24
+ readonly historySubheader: "Your card reader orders";
25
+ readonly intro: "Choose the readers and accessories you need. We set each reader up and ship your order to the address you enter at checkout. The delivery email says how to start taking payments with it.";
26
+ readonly shipsTo: "Ships to street addresses in the United States. P.O. boxes and military addresses are not accepted.";
27
+ readonly placed: "Thanks, your order is in. It shows under Your orders within a minute, and we email you as it ships.";
28
+ readonly canceled: "Checkout was canceled. Nothing was charged.";
29
+ readonly ordersTitle: "Your orders";
30
+ readonly noOrders: "No hardware orders yet.";
31
+ readonly quantity: "Quantity";
32
+ readonly shipping: "Shipping";
33
+ readonly items: "Items";
34
+ readonly tax: "Tax";
35
+ readonly taxAtCheckout: "Calculated at checkout";
36
+ readonly total: "Total";
37
+ readonly totalBeforeTax: "Total before tax";
38
+ readonly termsBefore: "I accept the ";
39
+ readonly termsLink: "hardware terms of sale (Terms, Sections 4.26–4.32)";
40
+ readonly termsAfter: ".";
41
+ readonly businessUse: "I am buying this hardware for use in my business.";
42
+ readonly checkout: "Check out";
43
+ readonly checkoutFailed: "Checkout could not be started";
44
+ readonly buyKeyReason: "Only a member with the \"Buy point of sale hardware\" permission can place an order. Ask an organization admin.";
45
+ readonly termsReason: "Accept the hardware terms of sale and confirm the hardware is for your business first.";
46
+ readonly returnAction: "Request a return";
47
+ readonly returnBody: "Tell us why. Our team gets your request and arranges the return with you. Returns follow the hardware terms of sale: the return shipping is yours to pay, the original shipping is not refunded, and any restocking fee charged for the return comes off the refund.";
48
+ readonly returnField: "Why are you returning it?";
49
+ readonly returnCancel: "Cancel";
50
+ readonly returnSend: "Request return";
51
+ readonly returnSent: "Return requested. Our team arranges it with you.";
52
+ readonly returnFailed: "The request did not go through";
53
+ readonly columnOrder: "Order";
54
+ readonly columnPlaced: "Placed";
55
+ readonly columnItems: "Items";
56
+ readonly columnTotal: "Total";
57
+ readonly columnStatus: "Status";
58
+ readonly columnReturn: "Return";
59
+ readonly columnTracking: "Tracking";
60
+ };
61
+ /** The Card readers to set up card's words. */
62
+ export declare const POS_HARDWARE_WAITING_TEXT: {
63
+ readonly header: "Card readers to set up";
64
+ readonly subheader: "Bought in person, ready for your store";
65
+ readonly planPrompt: "A card reader takes payments at the register, which comes with the point of sale. Add it, then set the reader up here.";
66
+ readonly planReason: "Add a plan with the point of sale first.";
67
+ readonly openDevices: "Open POS devices";
68
+ readonly markSetUp: "Mark set up";
69
+ readonly marked: "Marked set up";
70
+ readonly whichStore: "Which store is it for?";
71
+ readonly choose: "Choose";
72
+ readonly chosen: "Store chosen";
73
+ readonly failed: "That did not work. Try again.";
74
+ };
75
+ /** The title of the return request: `Return HW-1A2B3C?`. */
76
+ export declare function posHardwareReturnTitle(number: string): string;
77
+ /** Whether a return reason is long enough to send (the route asks the same). */
78
+ export declare function posHardwareReturnReasonReady(reason: string): boolean;
79
+ /**
80
+ * Whether an order offers "Request a return": none asked yet, and a reader
81
+ * bought in person, or an order shipped to you once it has shipped.
82
+ */
83
+ export declare function posHardwareReturnOffered(order: {
84
+ status: string;
85
+ source?: string | null;
86
+ returnRequest?: {
87
+ state: string;
88
+ } | null;
89
+ }): boolean;
90
+ /**
91
+ * The orders shipped from the Hardware card that have arrived, by number, for
92
+ * the point of sale prompt. A reader bought from the platform's own store is
93
+ * prompted on the Card readers to set up card instead, so it is not named twice.
94
+ */
95
+ export declare function posHardwareArrivedNumbers(orders: ReadonlyArray<{
96
+ number: string;
97
+ status: string;
98
+ source?: string | null;
99
+ }>): string[];
100
+ /** An order's items as Your orders lists them: `Pocket reader (M2) × 2, …`. */
101
+ export declare function posHardwareOrderItems(lines: ReadonlyArray<{
102
+ name: string;
103
+ quantity: number;
104
+ }>): string;
105
+ /** A waiting reader's items as its card heads them: `2 × Pocket reader (M2), …`. */
106
+ export declare function posHardwareWaitingItems(lines: ReadonlyArray<{
107
+ name: string;
108
+ quantity: number;
109
+ }>): string;
110
+ /** What a reader waiting for its store still needs, once the store is chosen. */
111
+ export declare function posHardwareWaitingNote(input: {
112
+ storeName: string;
113
+ serialsTaken: number;
114
+ hasLocation: boolean;
115
+ }): string;
116
+ /**
117
+ * The basket's lines and summary, from the quantities chosen: the lines a
118
+ * checkout sends (quantity above 0, in the catalog's order), the items'
119
+ * subtotal, the shipping chosen and the total before any tax.
120
+ */
121
+ export declare function posHardwareBasket(input: {
122
+ offers: ReadonlyArray<{
123
+ sku: string;
124
+ unitCents: number;
125
+ }>;
126
+ quantities: Readonly<Record<string, number>>;
127
+ shippingCents: number | null;
128
+ automaticTax: boolean;
129
+ }): {
130
+ lines: Array<{
131
+ sku: string;
132
+ quantity: number;
133
+ }>;
134
+ itemsCents: number;
135
+ totalCents: number;
136
+ totalLabel: string;
137
+ };
138
+ /**
139
+ * Check out's state: `blocked` with the reason the button names when the
140
+ * member may not buy or has not ticked both boxes, and otherwise whether it
141
+ * is pressable (a basket and a shipping speed).
142
+ */
143
+ export declare function posHardwareCheckoutState(input: {
144
+ canBuy: boolean;
145
+ termsAccepted: boolean;
146
+ businessUse: boolean;
147
+ hasLines: boolean;
148
+ hasShipping: boolean;
149
+ }): {
150
+ blockedReason: string | null;
151
+ enabled: boolean;
152
+ };
@@ -0,0 +1,152 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Aglyn LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */ import { POS_HARDWARE_TERMS_SECTIONS } from "./pos-hardware-terms.js";
17
+ /*==========================================
18
+ * THE HARDWARE SHOP AS A MERCHANT READS IT (AGL-4038): the words and the
19
+ * small rules of the Hardware card and the Card readers to set up card, in
20
+ * one pure module so the console and the native apps (through the native
21
+ * contracts) say and decide the same things. The route
22
+ * (`/api/commerce/pos-hardware`) still decides every one of them again.
23
+ *=========================================*/ /** What the buyer reads of their return request. */ export const POS_HARDWARE_RETURN_LABELS = {
24
+ requested: 'Return requested',
25
+ declined: 'Return declined',
26
+ refunded: 'Returned'
27
+ };
28
+ /** The Hardware card's words. */ export const POS_HARDWARE_SHOP_TEXT = {
29
+ header: 'Hardware',
30
+ subheader: 'Card readers and accessories, set up and shipped to you',
31
+ /** The card while the shop is closed: the purchase history alone. */ historySubheader: 'Your card reader orders',
32
+ intro: 'Choose the readers and accessories you need. We set each reader up and ship your order to the address you enter at checkout. The delivery email says how to start taking payments with it.',
33
+ shipsTo: 'Ships to street addresses in the United States. P.O. boxes and military addresses are not accepted.',
34
+ placed: 'Thanks, your order is in. It shows under Your orders within a minute, and we email you as it ships.',
35
+ canceled: 'Checkout was canceled. Nothing was charged.',
36
+ ordersTitle: 'Your orders',
37
+ noOrders: 'No hardware orders yet.',
38
+ quantity: 'Quantity',
39
+ shipping: 'Shipping',
40
+ items: 'Items',
41
+ tax: 'Tax',
42
+ taxAtCheckout: 'Calculated at checkout',
43
+ total: 'Total',
44
+ totalBeforeTax: 'Total before tax',
45
+ termsBefore: 'I accept the ',
46
+ termsLink: `hardware terms of sale (Terms, Sections ${POS_HARDWARE_TERMS_SECTIONS})`,
47
+ termsAfter: '.',
48
+ businessUse: 'I am buying this hardware for use in my business.',
49
+ checkout: 'Check out',
50
+ checkoutFailed: 'Checkout could not be started',
51
+ buyKeyReason: 'Only a member with the "Buy point of sale hardware" permission can place an order. Ask an organization admin.',
52
+ termsReason: 'Accept the hardware terms of sale and confirm the hardware is for your business first.',
53
+ returnAction: 'Request a return',
54
+ returnBody: 'Tell us why. Our team gets your request and arranges the return with you. Returns follow the hardware terms of sale: the return shipping is yours to pay, the original shipping is not refunded, and any restocking fee charged for the return comes off the refund.',
55
+ returnField: 'Why are you returning it?',
56
+ returnCancel: 'Cancel',
57
+ returnSend: 'Request return',
58
+ returnSent: 'Return requested. Our team arranges it with you.',
59
+ returnFailed: 'The request did not go through',
60
+ columnOrder: 'Order',
61
+ columnPlaced: 'Placed',
62
+ columnItems: 'Items',
63
+ columnTotal: 'Total',
64
+ columnStatus: 'Status',
65
+ columnReturn: 'Return',
66
+ columnTracking: 'Tracking'
67
+ };
68
+ /** The Card readers to set up card's words. */ export const POS_HARDWARE_WAITING_TEXT = {
69
+ header: 'Card readers to set up',
70
+ subheader: 'Bought in person, ready for your store',
71
+ planPrompt: 'A card reader takes payments at the register, which comes with the point of sale. Add it, then set the reader up here.',
72
+ planReason: 'Add a plan with the point of sale first.',
73
+ openDevices: 'Open POS devices',
74
+ markSetUp: 'Mark set up',
75
+ marked: 'Marked set up',
76
+ whichStore: 'Which store is it for?',
77
+ choose: 'Choose',
78
+ chosen: 'Store chosen',
79
+ failed: 'That did not work. Try again.'
80
+ };
81
+ /** The title of the return request: `Return HW-1A2B3C?`. */ export function posHardwareReturnTitle(number) {
82
+ return `Return ${number}?`;
83
+ }
84
+ /** Whether a return reason is long enough to send (the route asks the same). */ export function posHardwareReturnReasonReady(reason) {
85
+ return String(reason != null ? reason : '').trim().length >= 3;
86
+ }
87
+ /**
88
+ * Whether an order offers "Request a return": none asked yet, and a reader
89
+ * bought in person, or an order shipped to you once it has shipped.
90
+ */ export function posHardwareReturnOffered(order) {
91
+ var _order_source;
92
+ if (order.returnRequest) return false;
93
+ return order.status === 'delivered' || order.status === 'registered' || ((_order_source = order.source) != null ? _order_source : 'online') !== 'in_person' && order.status === 'shipped';
94
+ }
95
+ /**
96
+ * The orders shipped from the Hardware card that have arrived, by number, for
97
+ * the point of sale prompt. A reader bought from the platform's own store is
98
+ * prompted on the Card readers to set up card instead, so it is not named twice.
99
+ */ export function posHardwareArrivedNumbers(orders) {
100
+ return orders.filter((order)=>{
101
+ var _order_source;
102
+ return ((_order_source = order.source) != null ? _order_source : 'online') === 'online' && (order.status === 'delivered' || order.status === 'registered');
103
+ }).map((order)=>order.number);
104
+ }
105
+ /** An order's items as Your orders lists them: `Pocket reader (M2) × 2, …`. */ export function posHardwareOrderItems(lines) {
106
+ return lines.map((line)=>`${line.name} × ${line.quantity}`).join(', ');
107
+ }
108
+ /** A waiting reader's items as its card heads them: `2 × Pocket reader (M2), …`. */ export function posHardwareWaitingItems(lines) {
109
+ return lines.map((line)=>`${line.quantity} × ${line.name}`).join(', ');
110
+ }
111
+ /** What a reader waiting for its store still needs, once the store is chosen. */ export function posHardwareWaitingNote(input) {
112
+ const base = input.serialsTaken ? `For ${input.storeName}. Add it on the POS devices card with the code it shows, and it is set up: we know its serial number.` : `For ${input.storeName}. Add it on the POS devices card with the code it shows, then mark it set up.`;
113
+ return input.hasLocation ? base : `${base} The first reader asks for the store’s address.`;
114
+ }
115
+ /**
116
+ * The basket's lines and summary, from the quantities chosen: the lines a
117
+ * checkout sends (quantity above 0, in the catalog's order), the items'
118
+ * subtotal, the shipping chosen and the total before any tax.
119
+ */ export function posHardwareBasket(input) {
120
+ var _input_shippingCents;
121
+ const lines = input.offers.map((offer)=>{
122
+ var _input_quantities_offer_sku;
123
+ return {
124
+ sku: offer.sku,
125
+ quantity: Math.max(0, Math.floor(Number((_input_quantities_offer_sku = input.quantities[offer.sku]) != null ? _input_quantities_offer_sku : 0)))
126
+ };
127
+ }).filter((line)=>line.quantity > 0);
128
+ const itemsCents = lines.reduce((sum, line)=>{
129
+ var _ref;
130
+ var _input_offers_find;
131
+ return sum + ((_ref = (_input_offers_find = input.offers.find((offer)=>offer.sku === line.sku)) == null ? void 0 : _input_offers_find.unitCents) != null ? _ref : 0) * line.quantity;
132
+ }, 0);
133
+ return {
134
+ lines,
135
+ itemsCents,
136
+ totalCents: itemsCents + ((_input_shippingCents = input.shippingCents) != null ? _input_shippingCents : 0),
137
+ totalLabel: input.automaticTax ? POS_HARDWARE_SHOP_TEXT.totalBeforeTax : POS_HARDWARE_SHOP_TEXT.total
138
+ };
139
+ }
140
+ /**
141
+ * Check out's state: `blocked` with the reason the button names when the
142
+ * member may not buy or has not ticked both boxes, and otherwise whether it
143
+ * is pressable (a basket and a shipping speed).
144
+ */ export function posHardwareCheckoutState(input) {
145
+ const blockedReason = !input.canBuy ? POS_HARDWARE_SHOP_TEXT.buyKeyReason : !input.termsAccepted || !input.businessUse ? POS_HARDWARE_SHOP_TEXT.termsReason : null;
146
+ return {
147
+ blockedReason,
148
+ enabled: blockedReason === null && input.hasLines && input.hasShipping
149
+ };
150
+ }
151
+
152
+ //# sourceMappingURL=pos-hardware-shop.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../libs/plugins/commerce/src/lib/model/pos-hardware-shop.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 { POS_HARDWARE_TERMS_SECTIONS } from './pos-hardware-terms'\n\n/*==========================================\n * THE HARDWARE SHOP AS A MERCHANT READS IT (AGL-4038): the words and the\n * small rules of the Hardware card and the Card readers to set up card, in\n * one pure module so the console and the native apps (through the native\n * contracts) say and decide the same things. The route\n * (`/api/commerce/pos-hardware`) still decides every one of them again.\n *=========================================*/\n\n/** What the buyer reads of their return request. */\nexport const POS_HARDWARE_RETURN_LABELS: Record<string, string> = {\n requested: 'Return requested',\n declined: 'Return declined',\n refunded: 'Returned',\n}\n\n/** The Hardware card's words. */\nexport const POS_HARDWARE_SHOP_TEXT = {\n header: 'Hardware',\n subheader: 'Card readers and accessories, set up and shipped to you',\n /** The card while the shop is closed: the purchase history alone. */\n historySubheader: 'Your card reader orders',\n intro:\n 'Choose the readers and accessories you need. We set each reader up and ship your order to the address you enter at checkout. The delivery email says how to start taking payments with it.',\n shipsTo: 'Ships to street addresses in the United States. P.O. boxes and military addresses are not accepted.',\n placed: 'Thanks, your order is in. It shows under Your orders within a minute, and we email you as it ships.',\n canceled: 'Checkout was canceled. Nothing was charged.',\n ordersTitle: 'Your orders',\n noOrders: 'No hardware orders yet.',\n quantity: 'Quantity',\n shipping: 'Shipping',\n items: 'Items',\n tax: 'Tax',\n taxAtCheckout: 'Calculated at checkout',\n total: 'Total',\n totalBeforeTax: 'Total before tax',\n termsBefore: 'I accept the ',\n termsLink: `hardware terms of sale (Terms, Sections ${POS_HARDWARE_TERMS_SECTIONS})`,\n termsAfter: '.',\n businessUse: 'I am buying this hardware for use in my business.',\n checkout: 'Check out',\n checkoutFailed: 'Checkout could not be started',\n buyKeyReason:\n 'Only a member with the \"Buy point of sale hardware\" permission can place an order. Ask an organization admin.',\n termsReason: 'Accept the hardware terms of sale and confirm the hardware is for your business first.',\n returnAction: 'Request a return',\n returnBody:\n 'Tell us why. Our team gets your request and arranges the return with you. Returns follow the hardware terms of sale: the return shipping is yours to pay, the original shipping is not refunded, and any restocking fee charged for the return comes off the refund.',\n returnField: 'Why are you returning it?',\n returnCancel: 'Cancel',\n returnSend: 'Request return',\n returnSent: 'Return requested. Our team arranges it with you.',\n returnFailed: 'The request did not go through',\n columnOrder: 'Order',\n columnPlaced: 'Placed',\n columnItems: 'Items',\n columnTotal: 'Total',\n columnStatus: 'Status',\n columnReturn: 'Return',\n columnTracking: 'Tracking',\n} as const\n\n/** The Card readers to set up card's words. */\nexport const POS_HARDWARE_WAITING_TEXT = {\n header: 'Card readers to set up',\n subheader: 'Bought in person, ready for your store',\n planPrompt:\n 'A card reader takes payments at the register, which comes with the point of sale. Add it, then set the reader up here.',\n planReason: 'Add a plan with the point of sale first.',\n openDevices: 'Open POS devices',\n markSetUp: 'Mark set up',\n marked: 'Marked set up',\n whichStore: 'Which store is it for?',\n choose: 'Choose',\n chosen: 'Store chosen',\n failed: 'That did not work. Try again.',\n} as const\n\n/** The title of the return request: `Return HW-1A2B3C?`. */\nexport function posHardwareReturnTitle(number: string): string {\n return `Return ${number}?`\n}\n\n/** Whether a return reason is long enough to send (the route asks the same). */\nexport function posHardwareReturnReasonReady(reason: string): boolean {\n return String(reason ?? '').trim().length >= 3\n}\n\n/**\n * Whether an order offers \"Request a return\": none asked yet, and a reader\n * bought in person, or an order shipped to you once it has shipped.\n */\nexport function posHardwareReturnOffered(order: {\n status: string\n source?: string | null\n returnRequest?: { state: string } | null\n}): boolean {\n if (order.returnRequest) return false\n return (\n order.status === 'delivered' ||\n order.status === 'registered' ||\n ((order.source ?? 'online') !== 'in_person' && order.status === 'shipped')\n )\n}\n\n/**\n * The orders shipped from the Hardware card that have arrived, by number, for\n * the point of sale prompt. A reader bought from the platform's own store is\n * prompted on the Card readers to set up card instead, so it is not named twice.\n */\nexport function posHardwareArrivedNumbers(\n orders: ReadonlyArray<{ number: string; status: string; source?: string | null }>,\n): string[] {\n return orders\n .filter((order) => (order.source ?? 'online') === 'online' && (order.status === 'delivered' || order.status === 'registered'))\n .map((order) => order.number)\n}\n\n/** An order's items as Your orders lists them: `Pocket reader (M2) × 2, …`. */\nexport function posHardwareOrderItems(lines: ReadonlyArray<{ name: string; quantity: number }>): string {\n return lines.map((line) => `${line.name} × ${line.quantity}`).join(', ')\n}\n\n/** A waiting reader's items as its card heads them: `2 × Pocket reader (M2), …`. */\nexport function posHardwareWaitingItems(lines: ReadonlyArray<{ name: string; quantity: number }>): string {\n return lines.map((line) => `${line.quantity} × ${line.name}`).join(', ')\n}\n\n/** What a reader waiting for its store still needs, once the store is chosen. */\nexport function posHardwareWaitingNote(input: { storeName: string; serialsTaken: number; hasLocation: boolean }): string {\n const base = input.serialsTaken\n ? `For ${input.storeName}. Add it on the POS devices card with the code it shows, and it is set up: we know its serial number.`\n : `For ${input.storeName}. Add it on the POS devices card with the code it shows, then mark it set up.`\n return input.hasLocation ? base : `${base} The first reader asks for the store’s address.`\n}\n\n/**\n * The basket's lines and summary, from the quantities chosen: the lines a\n * checkout sends (quantity above 0, in the catalog's order), the items'\n * subtotal, the shipping chosen and the total before any tax.\n */\nexport function posHardwareBasket(input: {\n offers: ReadonlyArray<{ sku: string; unitCents: number }>\n quantities: Readonly<Record<string, number>>\n shippingCents: number | null\n automaticTax: boolean\n}): {\n lines: Array<{ sku: string; quantity: number }>\n itemsCents: number\n totalCents: number\n totalLabel: string\n} {\n const lines = input.offers\n .map((offer) => ({ sku: offer.sku, quantity: Math.max(0, Math.floor(Number(input.quantities[offer.sku] ?? 0))) }))\n .filter((line) => line.quantity > 0)\n const itemsCents = lines.reduce(\n (sum, line) => sum + (input.offers.find((offer) => offer.sku === line.sku)?.unitCents ?? 0) * line.quantity,\n 0,\n )\n return {\n lines,\n itemsCents,\n totalCents: itemsCents + (input.shippingCents ?? 0),\n totalLabel: input.automaticTax ? POS_HARDWARE_SHOP_TEXT.totalBeforeTax : POS_HARDWARE_SHOP_TEXT.total,\n }\n}\n\n/**\n * Check out's state: `blocked` with the reason the button names when the\n * member may not buy or has not ticked both boxes, and otherwise whether it\n * is pressable (a basket and a shipping speed).\n */\nexport function posHardwareCheckoutState(input: {\n canBuy: boolean\n termsAccepted: boolean\n businessUse: boolean\n hasLines: boolean\n hasShipping: boolean\n}): { blockedReason: string | null; enabled: boolean } {\n const blockedReason = !input.canBuy\n ? POS_HARDWARE_SHOP_TEXT.buyKeyReason\n : !input.termsAccepted || !input.businessUse\n ? POS_HARDWARE_SHOP_TEXT.termsReason\n : null\n return { blockedReason, enabled: blockedReason === null && input.hasLines && input.hasShipping }\n}\n"],"names":["POS_HARDWARE_TERMS_SECTIONS","POS_HARDWARE_RETURN_LABELS","requested","declined","refunded","POS_HARDWARE_SHOP_TEXT","header","subheader","historySubheader","intro","shipsTo","placed","canceled","ordersTitle","noOrders","quantity","shipping","items","tax","taxAtCheckout","total","totalBeforeTax","termsBefore","termsLink","termsAfter","businessUse","checkout","checkoutFailed","buyKeyReason","termsReason","returnAction","returnBody","returnField","returnCancel","returnSend","returnSent","returnFailed","columnOrder","columnPlaced","columnItems","columnTotal","columnStatus","columnReturn","columnTracking","POS_HARDWARE_WAITING_TEXT","planPrompt","planReason","openDevices","markSetUp","marked","whichStore","choose","chosen","failed","posHardwareReturnTitle","number","posHardwareReturnReasonReady","reason","String","trim","length","posHardwareReturnOffered","order","returnRequest","status","source","posHardwareArrivedNumbers","orders","filter","map","posHardwareOrderItems","lines","line","name","join","posHardwareWaitingItems","posHardwareWaitingNote","input","base","serialsTaken","storeName","hasLocation","posHardwareBasket","offers","offer","sku","Math","max","floor","Number","quantities","itemsCents","reduce","sum","find","unitCents","totalCents","shippingCents","totalLabel","automaticTax","posHardwareCheckoutState","blockedReason","canBuy","termsAccepted","enabled","hasLines","hasShipping"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED,SAASA,2BAA2B,QAAQ,0BAAsB;AAElE;;;;;;2CAM2C,GAE3C,kDAAkD,GAClD,OAAO,MAAMC,6BAAqD;IAChEC,WAAW;IACXC,UAAU;IACVC,UAAU;AACZ,EAAC;AAED,+BAA+B,GAC/B,OAAO,MAAMC,yBAAyB;IACpCC,QAAQ;IACRC,WAAW;IACX,mEAAmE,GACnEC,kBAAkB;IAClBC,OACE;IACFC,SAAS;IACTC,QAAQ;IACRC,UAAU;IACVC,aAAa;IACbC,UAAU;IACVC,UAAU;IACVC,UAAU;IACVC,OAAO;IACPC,KAAK;IACLC,eAAe;IACfC,OAAO;IACPC,gBAAgB;IAChBC,aAAa;IACbC,WAAW,CAAC,wCAAwC,EAAEvB,4BAA4B,CAAC,CAAC;IACpFwB,YAAY;IACZC,aAAa;IACbC,UAAU;IACVC,gBAAgB;IAChBC,cACE;IACFC,aAAa;IACbC,cAAc;IACdC,YACE;IACFC,aAAa;IACbC,cAAc;IACdC,YAAY;IACZC,YAAY;I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EA;;;;CAIC,GACD,OAAO,SAASgF,yBAAyBvB,KAMxC;IACC,MAAMwB,gBAAgB,CAACxB,MAAMyB,MAAM,GAC/BjG,uBAAuBuB,YAAY,GACnC,CAACiD,MAAM0B,aAAa,IAAI,CAAC1B,MAAMpD,WAAW,GACxCpB,uBAAuBwB,WAAW,GAClC;IACN,OAAO;QAAEwE;QAAeG,SAASH,kBAAkB,QAAQxB,MAAM4B,QAAQ,IAAI5B,MAAM6B,WAAW;IAAC;AACjG"}
@@ -63,12 +63,14 @@
63
63
  nativeNavHubSection('host', '/products', 'analytics', 'Analytics', 'commerce.sales'),
64
64
  // The console's Settings group (`COMMERCE_CONSOLE_SECTIONS`): each page's own
65
65
  // settings, then the zone where other plugins' cards for that page land.
66
- // Point of sale waits for its registers and hardware screens.
66
+ // Point of sale: natively its hardware shop and the readers waiting to be set up
67
+ // (AGL-4038); the registers and POS devices live in the POS app.
67
68
  nativeNavHubSection('host', '/products', 'payments', 'Payments', 'commerce.settingsPayments'),
68
69
  nativeNavHubSection('host', '/products', 'checkout', 'Checkout', 'commerce.settingsCheckout'),
69
70
  nativeNavHubSection('host', '/products', 'taxes', 'Taxes', 'commerce.settingsTaxes'),
70
71
  nativeNavHubSection('host', '/products', 'shipping', 'Shipping & delivery', 'commerce.settingsShipping'),
71
72
  nativeNavHubSection('host', '/products', 'notifications', 'Notifications', 'commerce.settingsNotifications'),
73
+ nativeNavHubSection('host', '/products', 'pos', 'Point of sale', 'commerce.hardware'),
72
74
  nativeNavHubSection('host', '/products', 'channels', 'Sales channels', 'commerce.settingsChannels'),
73
75
  nativeNavHubSection('host', '/products', 'integrations', 'Integrations', 'commerce.settings')
74
76
  ],
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../libs/plugins/commerce/src/lib/native-nav.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 {\n type NativeNavContribution,\n type NativeNavCreateContribution,\n type NativeNavElsewhere,\n nativeNavHubSection,\n nativeNavIcon,\n nativeNavRef,\n} from '@aglyn/aglyn/app-utils/native-nav'\n\n/**\n * Orders and Products in the native apps' navigation (AGL-3943): the rows this plugin\n * adds to the manifest the shells draw, placed into the core's lists by\n * `order` (`assembleNativeNav`, `generate:native-contracts`). Labels are the\n * console's words, held by `apps/console/specs/native-nav-manifest.spec.ts`.\n *\n * Imports only the core's plain nav module, so the native contracts read it.\n */\n\nexport const NATIVE_NAV_ROWS: readonly NativeNavContribution[] = [\n {\n list: 'site',\n group: 'sell',\n row: {\n id: 'orders',\n label: 'Orders',\n icon: nativeNavIcon('bag', 'shopping_bag'),\n screen: 'commerce.orders',\n pluginId: 'commerce',\n order: 10,\n sections: [\n nativeNavHubSection('host', '/products', 'orders', 'Orders', 'commerce.orders'),\n nativeNavHubSection('host', '/products', 'subscriptions', 'Subscriptions', 'commerce.subscriptions'),\n nativeNavHubSection('host', '/products', 'returns', 'Returns', 'commerce.returns'),\n nativeNavHubSection('host', '/products', 'reservations', 'Reservations', 'commerce.reservations'),\n ],\n docs: '/commerce-and-bookings/commerce/overview',\n console: nativeNavRef('hostPluginSection', '/products/orders'),\n },\n },\n {\n list: 'site',\n group: 'sell',\n row: {\n id: 'products',\n label: 'Products',\n icon: nativeNavIcon('tag', 'sell'),\n screen: 'commerce.products',\n pluginId: 'commerce',\n order: 20,\n keywords: ['catalog', 'stock', 'inventory'],\n sections: [\n nativeNavHubSection('host', '/products', 'catalog', 'Catalog', 'commerce.products'),\n nativeNavHubSection('host', '/products', 'promotions', 'Promotions', 'commerce.promotions'),\n nativeNavHubSection('host', '/products', 'analytics', 'Analytics', 'commerce.sales'),\n // The console's Settings group (`COMMERCE_CONSOLE_SECTIONS`): each page's own\n // settings, then the zone where other plugins' cards for that page land.\n // Point of sale waits for its registers and hardware screens.\n nativeNavHubSection('host', '/products', 'payments', 'Payments', 'commerce.settingsPayments'),\n nativeNavHubSection('host', '/products', 'checkout', 'Checkout', 'commerce.settingsCheckout'),\n nativeNavHubSection('host', '/products', 'taxes', 'Taxes', 'commerce.settingsTaxes'),\n nativeNavHubSection('host', '/products', 'shipping', 'Shipping & delivery', 'commerce.settingsShipping'),\n nativeNavHubSection('host', '/products', 'notifications', 'Notifications', 'commerce.settingsNotifications'),\n nativeNavHubSection('host', '/products', 'channels', 'Sales channels', 'commerce.settingsChannels'),\n nativeNavHubSection('host', '/products', 'integrations', 'Integrations', 'commerce.settings'),\n ],\n actions: [\n {\n id: 'scan',\n label: 'Scan stock',\n icon: nativeNavIcon('barcode.viewfinder', 'qr_code_scanner'),\n screen: 'commerce.scan',\n },\n {\n id: 'newProduct',\n label: 'New product',\n icon: nativeNavIcon('plus', 'add'),\n screen: 'commerce.product',\n params: { new: '1' },\n },\n ],\n docs: '/commerce-and-bookings/commerce/overview',\n console: nativeNavRef('hostPluginTab', '/products'),\n },\n },\n]\n\n/** The console's POS tab is the register app's, not a row of this one. */\nexport const NATIVE_NAV_ELSEWHERE: readonly NativeNavElsewhere[] = [\n { console: nativeNavRef('hostPluginTab', '/pos'), where: 'The POS app' },\n]\n\n/** A product (\"Add product\" on Catalog) and a draft order (\"Draft order\" on Orders). */\nexport const NATIVE_NAV_CREATE: readonly NativeNavCreateContribution[] = [\n {\n scope: 'site',\n item: {\n id: 'product',\n label: 'Product',\n icon: nativeNavIcon('tag', 'sell'),\n screen: 'commerce.product',\n params: { new: '1' },\n pluginId: 'commerce',\n planFeature: 'commerce',\n order: 20,\n console: nativeNavRef('hostPluginSection', '/products/catalog'),\n },\n },\n {\n scope: 'site',\n item: {\n id: 'draftOrder',\n label: 'Draft order',\n icon: nativeNavIcon('link.badge.plus', 'link'),\n screen: 'commerce.orders',\n params: { new: '1' },\n pluginId: 'commerce',\n planFeature: 'commerce',\n order: 30,\n console: nativeNavRef('hostPluginSection', '/products/orders'),\n },\n },\n]\n"],"names":["nativeNavHubSection","nativeNavIcon","nativeNavRef","NATIVE_NAV_ROWS","list","group","row","id","label","icon","screen","pluginId","order","sections","docs","console","keywords","actions","params","new","NATIVE_NAV_ELSEWHERE","where","NATIVE_NAV_CREATE","scope","item","planFeature"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED,SAIEA,mBAAmB,EACnBC,aAAa,EACbC,YAAY,QACP,oCAAmC;AAE1C;;;;;;;CAOC,GAED,OAAO,MAAMC,kBAAoD;IAC/D;QACEC,MAAM;QACNC,OAAO;QACPC,KAAK;YACHC,IAAI;YACJC,OAAO;YACPC,MAAMR,cAAc,OAAO;YAC3BS,QAAQ;YACRC,UAAU;YACVC,OAAO;YACPC,UAAU;gBACRb,oBAAoB,QAAQ,aAAa,UAAU,UAAU;gBAC7DA,oBAAoB,QAAQ,aAAa,iBAAiB,iBAAiB;gBAC3EA,oBAAoB,QAAQ,aAAa,WAAW,WAAW;gBAC/DA,oBAAoB,QAAQ,aAAa,gBAAgB,gBAAgB;aAC1E;YACDc,MAAM;YACNC,SAASb,aAAa,qBAAqB;QAC7C;IACF;IACA;QACEE,MAAM;QACNC,OAAO;QACPC,KAAK;YACHC,IAAI;YACJC,OAAO;YACPC,MAAMR,cAAc,OAAO;YAC3BS,QAAQ;YACRC,UAAU;YACVC,OAAO;YACPI,UAAU;gBAAC;gBAAW;gBAAS;aAAY;YAC3CH,UAAU;gBACRb,oBAAoB,QAAQ,aAAa,WAAW,WAAW;gBAC/DA,oBAAoB,QAAQ,aAAa,cAAc,cAAc;gBACrEA,oBAAoB,QAAQ,aAAa,aAAa,aAAa;gBACnE,8EAA8E;gBAC9E,yEAAyE;gBACzE,8DAA8D;gBAC9DA,oBAAoB,QAAQ,aAAa,YAAY,YAAY;gBACjEA,oBAAoB,QAAQ,aAAa,YAAY,YAAY;gBACjEA,oBAAoB,QAAQ,aAAa,SAAS,SAAS;gBAC3DA,oBAAoB,QAAQ,aAAa,YAAY,uBAAuB;gBAC5EA,oBAAoB,QAAQ,aAAa,iBAAiB,iBAAiB;gBAC3EA,oBAAoB,QAAQ,aAAa,YAAY,kBAAkB;gBACvEA,oBAAoB,QAAQ,aAAa,gBAAgB,gBAAgB;aAC1E;YACDiB,SAAS;gBACP;oBACEV,IAAI;oBACJC,OAAO;oBACPC,MAAMR,cAAc,sBAAsB;oBAC1CS,QAAQ;gBACV;gBACA;oBACEH,IAAI;oBACJC,OAAO;oBACPC,MAAMR,cAAc,QAAQ;oBAC5BS,QAAQ;oBACRQ,QAAQ;wBAAEC,KAAK;oBAAI;gBACrB;aACD;YACDL,MAAM;YACNC,SAASb,aAAa,iBAAiB;QACzC;IACF;CACD,CAAA;AAED,wEAAwE,GACxE,OAAO,MAAMkB,uBAAsD;IACjE;QAAEL,SAASb,aAAa,iBAAiB;QAASmB,OAAO;IAAc;CACxE,CAAA;AAED,sFAAsF,GACtF,OAAO,MAAMC,oBAA4D;IACvE;QACEC,OAAO;QACPC,MAAM;YACJjB,IAAI;YACJC,OAAO;YACPC,MAAMR,cAAc,OAAO;YAC3BS,QAAQ;YACRQ,QAAQ;gBAAEC,KAAK;YAAI;YACnBR,UAAU;YACVc,aAAa;YACbb,OAAO;YACPG,SAASb,aAAa,qBAAqB;QAC7C;IACF;IACA;QACEqB,OAAO;QACPC,MAAM;YACJjB,IAAI;YACJC,OAAO;YACPC,MAAMR,cAAc,mBAAmB;YACvCS,QAAQ;YACRQ,QAAQ;gBAAEC,KAAK;YAAI;YACnBR,UAAU;YACVc,aAAa;YACbb,OAAO;YACPG,SAASb,aAAa,qBAAqB;QAC7C;IACF;CACD,CAAA"}
1
+ {"version":3,"sources":["../../../../../../libs/plugins/commerce/src/lib/native-nav.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 {\n type NativeNavContribution,\n type NativeNavCreateContribution,\n type NativeNavElsewhere,\n nativeNavHubSection,\n nativeNavIcon,\n nativeNavRef,\n} from '@aglyn/aglyn/app-utils/native-nav'\n\n/**\n * Orders and Products in the native apps' navigation (AGL-3943): the rows this plugin\n * adds to the manifest the shells draw, placed into the core's lists by\n * `order` (`assembleNativeNav`, `generate:native-contracts`). Labels are the\n * console's words, held by `apps/console/specs/native-nav-manifest.spec.ts`.\n *\n * Imports only the core's plain nav module, so the native contracts read it.\n */\n\nexport const NATIVE_NAV_ROWS: readonly NativeNavContribution[] = [\n {\n list: 'site',\n group: 'sell',\n row: {\n id: 'orders',\n label: 'Orders',\n icon: nativeNavIcon('bag', 'shopping_bag'),\n screen: 'commerce.orders',\n pluginId: 'commerce',\n order: 10,\n sections: [\n nativeNavHubSection('host', '/products', 'orders', 'Orders', 'commerce.orders'),\n nativeNavHubSection('host', '/products', 'subscriptions', 'Subscriptions', 'commerce.subscriptions'),\n nativeNavHubSection('host', '/products', 'returns', 'Returns', 'commerce.returns'),\n nativeNavHubSection('host', '/products', 'reservations', 'Reservations', 'commerce.reservations'),\n ],\n docs: '/commerce-and-bookings/commerce/overview',\n console: nativeNavRef('hostPluginSection', '/products/orders'),\n },\n },\n {\n list: 'site',\n group: 'sell',\n row: {\n id: 'products',\n label: 'Products',\n icon: nativeNavIcon('tag', 'sell'),\n screen: 'commerce.products',\n pluginId: 'commerce',\n order: 20,\n keywords: ['catalog', 'stock', 'inventory'],\n sections: [\n nativeNavHubSection('host', '/products', 'catalog', 'Catalog', 'commerce.products'),\n nativeNavHubSection('host', '/products', 'promotions', 'Promotions', 'commerce.promotions'),\n nativeNavHubSection('host', '/products', 'analytics', 'Analytics', 'commerce.sales'),\n // The console's Settings group (`COMMERCE_CONSOLE_SECTIONS`): each page's own\n // settings, then the zone where other plugins' cards for that page land.\n // Point of sale: natively its hardware shop and the readers waiting to be set up\n // (AGL-4038); the registers and POS devices live in the POS app.\n nativeNavHubSection('host', '/products', 'payments', 'Payments', 'commerce.settingsPayments'),\n nativeNavHubSection('host', '/products', 'checkout', 'Checkout', 'commerce.settingsCheckout'),\n nativeNavHubSection('host', '/products', 'taxes', 'Taxes', 'commerce.settingsTaxes'),\n nativeNavHubSection('host', '/products', 'shipping', 'Shipping & delivery', 'commerce.settingsShipping'),\n nativeNavHubSection('host', '/products', 'notifications', 'Notifications', 'commerce.settingsNotifications'),\n nativeNavHubSection('host', '/products', 'pos', 'Point of sale', 'commerce.hardware'),\n nativeNavHubSection('host', '/products', 'channels', 'Sales channels', 'commerce.settingsChannels'),\n nativeNavHubSection('host', '/products', 'integrations', 'Integrations', 'commerce.settings'),\n ],\n actions: [\n {\n id: 'scan',\n label: 'Scan stock',\n icon: nativeNavIcon('barcode.viewfinder', 'qr_code_scanner'),\n screen: 'commerce.scan',\n },\n {\n id: 'newProduct',\n label: 'New product',\n icon: nativeNavIcon('plus', 'add'),\n screen: 'commerce.product',\n params: { new: '1' },\n },\n ],\n docs: '/commerce-and-bookings/commerce/overview',\n console: nativeNavRef('hostPluginTab', '/products'),\n },\n },\n]\n\n/** The console's POS tab is the register app's, not a row of this one. */\nexport const NATIVE_NAV_ELSEWHERE: readonly NativeNavElsewhere[] = [\n { console: nativeNavRef('hostPluginTab', '/pos'), where: 'The POS app' },\n]\n\n/** A product (\"Add product\" on Catalog) and a draft order (\"Draft order\" on Orders). */\nexport const NATIVE_NAV_CREATE: readonly NativeNavCreateContribution[] = [\n {\n scope: 'site',\n item: {\n id: 'product',\n label: 'Product',\n icon: nativeNavIcon('tag', 'sell'),\n screen: 'commerce.product',\n params: { new: '1' },\n pluginId: 'commerce',\n planFeature: 'commerce',\n order: 20,\n console: nativeNavRef('hostPluginSection', '/products/catalog'),\n },\n },\n {\n scope: 'site',\n item: {\n id: 'draftOrder',\n label: 'Draft order',\n icon: nativeNavIcon('link.badge.plus', 'link'),\n screen: 'commerce.orders',\n params: { new: '1' },\n pluginId: 'commerce',\n planFeature: 'commerce',\n order: 30,\n console: nativeNavRef('hostPluginSection', '/products/orders'),\n },\n },\n]\n"],"names":["nativeNavHubSection","nativeNavIcon","nativeNavRef","NATIVE_NAV_ROWS","list","group","row","id","label","icon","screen","pluginId","order","sections","docs","console","keywords","actions","params","new","NATIVE_NAV_ELSEWHERE","where","NATIVE_NAV_CREATE","scope","item","planFeature"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED,SAIEA,mBAAmB,EACnBC,aAAa,EACbC,YAAY,QACP,oCAAmC;AAE1C;;;;;;;CAOC,GAED,OAAO,MAAMC,kBAAoD;IAC/D;QACEC,MAAM;QACNC,OAAO;QACPC,KAAK;YACHC,IAAI;YACJC,OAAO;YACPC,MAAMR,cAAc,OAAO;YAC3BS,QAAQ;YACRC,UAAU;YACVC,OAAO;YACPC,UAAU;gBACRb,oBAAoB,QAAQ,aAAa,UAAU,UAAU;gBAC7DA,oBAAoB,QAAQ,aAAa,iBAAiB,iBAAiB;gBAC3EA,oBAAoB,QAAQ,aAAa,WAAW,WAAW;gBAC/DA,oBAAoB,QAAQ,aAAa,gBAAgB,gBAAgB;aAC1E;YACDc,MAAM;YACNC,SAASb,aAAa,qBAAqB;QAC7C;IACF;IACA;QACEE,MAAM;QACNC,OAAO;QACPC,KAAK;YACHC,IAAI;YACJC,OAAO;YACPC,MAAMR,cAAc,OAAO;YAC3BS,QAAQ;YACRC,UAAU;YACVC,OAAO;YACPI,UAAU;gBAAC;gBAAW;gBAAS;aAAY;YAC3CH,UAAU;gBACRb,oBAAoB,QAAQ,aAAa,WAAW,WA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