@aglyn/plugins-commerce 1.0.0-beta.261 → 1.0.0-beta.263
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 +13 -13
- package/src/lib/components/console/order-detail-dialog.component.js +17 -45
- package/src/lib/components/console/order-detail-dialog.component.js.map +1 -1
- package/src/lib/components/console/order-fulfillment-panel.component.js +12 -25
- package/src/lib/components/console/order-fulfillment-panel.component.js.map +1 -1
- package/src/lib/components/console/order-invoice.component.js +2 -10
- package/src/lib/components/console/order-invoice.component.js.map +1 -1
- package/src/lib/components/console/order-shipping-actions.component.d.ts +1 -15
- package/src/lib/components/console/order-shipping-actions.component.js +3 -23
- package/src/lib/components/console/order-shipping-actions.component.js.map +1 -1
- package/src/lib/components/console/product-labels-dialog.component.d.ts +2 -5
- package/src/lib/components/console/product-labels-dialog.component.js +6 -24
- package/src/lib/components/console/product-labels-dialog.component.js.map +1 -1
- package/src/lib/components/console/products-hub-card.component.js +7 -20
- package/src/lib/components/console/products-hub-card.component.js.map +1 -1
- package/src/lib/model/commerce-shipping.d.ts +2 -0
- package/src/lib/model/commerce-shipping.js +1 -0
- package/src/lib/model/commerce-shipping.js.map +1 -1
- package/src/lib/model/order-dialog.d.ts +52 -0
- package/src/lib/model/order-dialog.js +85 -0
- package/src/lib/model/order-dialog.js.map +1 -0
- package/src/lib/model/product-write.d.ts +71 -0
- package/src/lib/model/product-write.js +28 -0
- package/src/lib/model/product-write.js.map +1 -1
- package/src/lib/printing/product-labels.d.ts +22 -0
- package/src/lib/printing/product-labels.js +39 -2
- package/src/lib/printing/product-labels.js.map +1 -1
- package/src/lib/server/billing-webhook.js +3 -3
- package/src/lib/server/billing-webhook.js.map +1 -1
- package/src/lib/server/order-figures.js +37 -0
- package/src/lib/server/order-figures.js.map +1 -1
- package/src/lib/server/order-print.d.ts +40 -0
- package/src/lib/server/order-print.js +113 -0
- package/src/lib/server/order-print.js.map +1 -0
- package/src/lib/server/products-write.d.ts +26 -0
- package/src/lib/server/products-write.js +184 -1
- package/src/lib/server/products-write.js.map +1 -1
- package/src/lib/server.js +8 -0
- package/src/lib/server.js.map +1 -1
- package/src/lib/transfer/shipping-presets.d.ts +16 -0
- package/src/lib/transfer/shipping-presets.js +34 -1
- package/src/lib/transfer/shipping-presets.js.map +1 -1
- package/src/lib/utils/order-invoice.d.ts +5 -0
- package/src/lib/utils/order-invoice.js +14 -0
- package/src/lib/utils/order-invoice.js.map +1 -1
- package/src/lib/utils/order-packing-slip.d.ts +31 -0
- package/src/lib/utils/order-packing-slip.js +46 -0
- package/src/lib/utils/order-packing-slip.js.map +1 -0
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { _ as _extends } from "@swc/helpers/_/_extends";
|
|
1
2
|
/**
|
|
2
3
|
* @license
|
|
3
4
|
* Copyright 2026 Aglyn LLC
|
|
@@ -37,10 +38,46 @@ export function labelSize(id) {
|
|
|
37
38
|
return (_LABEL_SIZES_find = LABEL_SIZES.find((size)=>size.id === id)) != null ? _LABEL_SIZES_find : LABEL_SIZES[0];
|
|
38
39
|
}
|
|
39
40
|
const copiesOf = (label)=>Math.max(0, Math.min(MAX_LABEL_COPIES, Math.floor(Number(label.copies) || 0)));
|
|
40
|
-
const priceText = (label)=>
|
|
41
|
+
const priceText = (label)=>labelPriceText(label);
|
|
42
|
+
/**
|
|
43
|
+
* The labels a product prints: one row per variant, its options as the
|
|
44
|
+
* detail, its price and the code the register looks up (the barcode, else
|
|
45
|
+
* the SKU). A row with no code prints nothing until one is added. One copy
|
|
46
|
+
* each to start; the person changes the counts before printing.
|
|
47
|
+
*/ export function productLabelRows(product) {
|
|
48
|
+
return product.variants.map((variant)=>{
|
|
49
|
+
var _variant_options;
|
|
50
|
+
const options = Object.values((_variant_options = variant.options) != null ? _variant_options : {}).filter(Boolean);
|
|
51
|
+
return _extends({
|
|
52
|
+
variantId: variant.id,
|
|
53
|
+
name: product.name
|
|
54
|
+
}, options.length ? {
|
|
55
|
+
detail: options.join(' / ')
|
|
56
|
+
} : {}, Number.isFinite(Number(variant.priceUsd)) ? {
|
|
57
|
+
priceCents: Math.round(Number(variant.priceUsd) * 100)
|
|
58
|
+
} : {}, {
|
|
59
|
+
currency: 'usd',
|
|
60
|
+
code: String(variant.barcode || variant.sku || '').trim(),
|
|
61
|
+
copies: 1
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
/** The rows that print: a code and at least one copy, each count kept within {@link MAX_LABEL_COPIES}. */ export function printableLabelRows(rows) {
|
|
66
|
+
return rows.filter((row)=>row.code && copiesOf(row) > 0);
|
|
67
|
+
}
|
|
68
|
+
/** How many labels the rows print in all. */ export function labelCopiesTotal(rows) {
|
|
69
|
+
return printableLabelRows(rows).reduce((sum, row)=>sum + copiesOf(row), 0);
|
|
70
|
+
}
|
|
71
|
+
/** A typed copy count as the dialog keeps it: whole, at least 0, at most {@link MAX_LABEL_COPIES}. */ export function labelCopiesFromInput(value) {
|
|
72
|
+
return Math.max(0, Math.min(MAX_LABEL_COPIES, Math.floor(Number(value) || 0)));
|
|
73
|
+
}
|
|
74
|
+
/** The label's price line, empty when it has no price. */ export function labelPriceText(label) {
|
|
41
75
|
var _label_currency;
|
|
42
76
|
return label.priceCents != null && Number.isFinite(label.priceCents) ? formatReceiptMoney(Math.round(label.priceCents), (_label_currency = label.currency) != null ? _label_currency : 'usd') : '';
|
|
43
|
-
}
|
|
77
|
+
}
|
|
78
|
+
/** The file name the ZPL download is saved under. */ export function labelsZplFileName(productName) {
|
|
79
|
+
return `labels-${(productName != null ? productName : 'product').replace(/[^A-Za-z0-9]+/g, '-').toLowerCase()}.zpl`;
|
|
80
|
+
}
|
|
44
81
|
/*==========================================
|
|
45
82
|
* The printable page
|
|
46
83
|
*=========================================*/ export function productLabelsHtml(labels, sizeId) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../libs/plugins/commerce/src/lib/printing/product-labels.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 { escapeHtml } from '../utils/escape-html'\nimport { barcodeSvg, encodeBarcode, type EncodedBarcode } from '../barcode/barcode-encode'\nimport { formatReceiptMoney } from '../model/commerce-receipt'\nimport { toPrintable } from './print-document'\n\n/**\n * Product and shelf labels (AGL-3619): a product's name, its options, its\n * price and a barcode the register scans back, on the small thermal labels\n * a Zebra, Rollo, DYMO or Brother label printer takes.\n *\n * Two outputs from one description. A printable page (one label per page,\n * the page sized to the label) prints through the label printer's own\n * driver from any browser. ZPL is the Zebra printer language, sent to a\n * Zebra as a file; it prints sharper and faster and needs no driver\n * settings, so a store with a Zebra can skip the print dialog altogether.\n */\n\nexport interface ProductLabel {\n name: string\n /** A variant's options, e.g. `Large / Blue`. */\n detail?: string\n priceCents?: number\n currency?: string\n /** The variant's barcode, else its SKU: what the register looks up. */\n code: string\n copies: number\n}\n\nexport interface LabelSize {\n id: string\n label: string\n widthIn: number\n heightIn: number\n}\n\n/** The two sizes almost every label printer stocks for product labels. */\nexport const LABEL_SIZES: readonly LabelSize[] = [\n { id: '2.25x1.25', label: '2.25 x 1.25 in (57 x 32 mm)', widthIn: 2.25, heightIn: 1.25 },\n { id: '2x1', label: '2 x 1 in (51 x 25 mm)', widthIn: 2, heightIn: 1 },\n]\n\n/** One print run is capped; a typo of 5000 copies should not drain a roll. */\nexport const MAX_LABEL_COPIES = 500\n\nexport function labelSize(id: string | undefined): LabelSize {\n return LABEL_SIZES.find((size) => size.id === id) ?? LABEL_SIZES[0]\n}\n\nconst copiesOf = (label: ProductLabel) => Math.max(0, Math.min(MAX_LABEL_COPIES, Math.floor(Number(label.copies) || 0)))\n\nconst priceText = (label: ProductLabel) =>\n label.priceCents != null && Number.isFinite(label.priceCents)\n ? formatReceiptMoney(Math.round(label.priceCents), label.currency ?? 'usd')\n : ''\n\n/*==========================================\n * The printable page\n *=========================================*/\n\nexport function productLabelsHtml(labels: ProductLabel[], sizeId?: string): string {\n const size = labelSize(sizeId)\n const pages: string[] = []\n for (const label of labels) {\n const encoded = encodeBarcode(label.code)\n const page =\n '<section class=\"label\">' +\n `<div class=\"name\">${escapeHtml(label.name)}</div>` +\n (label.detail ? `<div class=\"detail\">${escapeHtml(label.detail)}</div>` : '') +\n (priceText(label) ? `<div class=\"price\">${escapeHtml(priceText(label))}</div>` : '') +\n (encoded\n ? `<div class=\"bars\">${barcodeSvg(encoded)}</div><div class=\"code\">${escapeHtml(encoded.text)}</div>`\n : '') +\n '</section>'\n for (let copy = 0; copy < copiesOf(label); copy += 1) pages.push(page)\n }\n const width = `${size.widthIn}in`\n const height = `${size.heightIn}in`\n return (\n '<!doctype html><html><head><meta charset=\"utf-8\"><title>Labels</title><style>' +\n `@page{size:${width} ${height};margin:0}` +\n '*{box-sizing:border-box}html,body{margin:0;padding:0;font-family:Arial,Helvetica,sans-serif}' +\n `.label{width:${width};height:${height};padding:0.06in 0.08in;overflow:hidden;display:flex;flex-direction:column;page-break-after:always;break-after:page}` +\n '.label:last-child{page-break-after:auto;break-after:auto}' +\n '.name{font-size:9pt;font-weight:700;line-height:1.1;max-height:2.2em;overflow:hidden}' +\n '.detail{font-size:7pt;line-height:1.1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}' +\n '.price{font-size:11pt;font-weight:700;line-height:1.2}' +\n '.bars{flex:1;min-height:0.3in}.bars svg{width:100%;height:100%;display:block}' +\n '.code{font-size:7pt;text-align:center;letter-spacing:0.05em}' +\n '</style></head><body>' +\n pages.join('') +\n '</body></html>'\n )\n}\n\n/*==========================================\n * ZPL\n *=========================================*/\n\n/** Zebra's desktop printers print at 203 dpi; the 300 dpi models are listed by name. */\nexport type ZplDpi = 203 | 300\n\n/**\n * Field text for ZPL. `^FH` makes `_` the escape, so the three characters\n * ZPL treats as commands or that escape (`^`, `~`, `_`) are written as hex,\n * and the rest is folded to the printer's ASCII font.\n */\nexport function zplText(value: unknown): string {\n return toPrintable(value).replace(/[_^~]/g, (char) => `_${char.charCodeAt(0).toString(16).toUpperCase()}`)\n}\n\nfunction zplBarcode(encoded: EncodedBarcode, x: number, y: number, height: number, moduleDots: number): string {\n const at = `^FO${x},${y}^BY${moduleDots}`\n switch (encoded.format) {\n case 'ean_13':\n // ZPL takes the 12 data digits and adds the check digit itself.\n return `${at}^BEN,${height},Y,N^FD${encoded.text.slice(0, 12)}^FS`\n case 'upc_a':\n return `${at}^BUN,${height},Y,N,Y^FD${encoded.text.slice(0, 11)}^FS`\n case 'ean_8':\n return `${at}^B8N,${height},Y,N^FD${encoded.text.slice(0, 7)}^FS`\n default:\n // Mode A: the printer picks sets B and C itself, as the page does.\n return `${at}^BCN,${height},Y,N,N,A^FH^FD${zplText(encoded.text)}^FS`\n }\n}\n\nexport function productLabelsZpl(labels: ProductLabel[], sizeId?: string, dpi: ZplDpi = 203): string {\n const size = labelSize(sizeId)\n const width = Math.round(size.widthIn * dpi)\n const height = Math.round(size.heightIn * dpi)\n const margin = Math.round(0.08 * dpi)\n const font = Math.round(dpi / 9)\n const small = Math.round(dpi / 12)\n const moduleDots = dpi >= 300 ? 3 : 2\n const out: string[] = []\n for (const label of labels) {\n const copies = copiesOf(label)\n if (!copies) continue\n const encoded = encodeBarcode(label.code)\n let y = margin\n const fields: string[] = []\n fields.push(`^FO${margin},${y}^A0N,${font},${font}^FB${width - margin * 2},2,0,L^FH^FD${zplText(label.name)}^FS`)\n y += font * 2 + 2\n if (label.detail) {\n fields.push(`^FO${margin},${y}^A0N,${small},${small}^FB${width - margin * 2},1,0,L^FH^FD${zplText(label.detail)}^FS`)\n y += small + 2\n }\n const price = priceText(label)\n if (price) {\n fields.push(`^FO${margin},${y}^A0N,${font},${font}^FH^FD${zplText(price)}^FS`)\n y += font + 4\n }\n if (encoded) {\n // What is left of the label, less the printed digits under the bars.\n const barHeight = Math.max(Math.round(dpi * 0.2), height - y - margin - small - 4)\n fields.push(zplBarcode(encoded, margin, y, barHeight, moduleDots))\n }\n out.push(`^XA^CI0^PW${width}^LL${height}^LH0,0${fields.join('')}^PQ${copies},0,1,Y^XZ`)\n }\n return out.join('\\n')\n}\n"],"names":["escapeHtml","barcodeSvg","encodeBarcode","formatReceiptMoney","toPrintable","LABEL_SIZES","id","label","widthIn","heightIn","MAX_LABEL_COPIES","labelSize","find","size","copiesOf","Math","max","min","floor","Number","copies","priceText","priceCents","isFinite","round","currency","productLabelsHtml","labels","sizeId","pages","encoded","code","page","name","detail","text","copy","push","width","height","join","zplText","value","replace","char","charCodeAt","toString","toUpperCase","zplBarcode","x","y","moduleDots","at","format","slice","productLabelsZpl","dpi","margin","font","small","out","fields","price","barHeight"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED,SAASA,UAAU,QAAQ,0BAAsB;AACjD,SAASC,UAAU,EAAEC,aAAa,QAA6B,+BAA2B;AAC1F,SAASC,kBAAkB,QAAQ,+BAA2B;AAC9D,SAASC,WAAW,QAAQ,sBAAkB;AAgC9C,wEAAwE,GACxE,OAAO,MAAMC,cAAoC;IAC/C;QAAEC,IAAI;QAAaC,OAAO;QAA+BC,SAAS;QAAMC,UAAU;IAAK;IACvF;QAAEH,IAAI;QAAOC,OAAO;QAAyBC,SAAS;QAAGC,UAAU;IAAE;CACtE,CAAA;AAED,4EAA4E,GAC5E,OAAO,MAAMC,mBAAmB,IAAG;AAEnC,OAAO,SAASC,UAAUL,EAAsB;QACvCD;IAAP,QAAOA,oBAAAA,YAAYO,IAAI,CAAC,CAACC,OAASA,KAAKP,EAAE,KAAKA,eAAvCD,oBAA8CA,WAAW,CAAC,EAAE;AACrE;AAEA,MAAMS,WAAW,CA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AAKC,GAAG,CAACD,KAAKS,KAAK,CAACgC,MAAM,MAAMjB,SAASW,IAAIO,SAASE,QAAQ;YAChFE,OAAOxB,IAAI,CAACW,WAAWlB,SAAS2B,QAAQP,GAAGa,WAAWZ;QACxD;QACAS,IAAIvB,IAAI,CAAC,CAAC,UAAU,EAAEC,MAAM,GAAG,EAAEC,OAAO,MAAM,EAAEsB,OAAOrB,IAAI,CAAC,IAAI,GAAG,EAAEpB,OAAO,SAAS,CAAC;IACxF;IACA,OAAOwC,IAAIpB,IAAI,CAAC;AAClB"}
|
|
1
|
+
{"version":3,"sources":["../../../../../../../libs/plugins/commerce/src/lib/printing/product-labels.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 { escapeHtml } from '../utils/escape-html'\nimport { barcodeSvg, encodeBarcode, type EncodedBarcode } from '../barcode/barcode-encode'\nimport { formatReceiptMoney } from '../model/commerce-receipt'\nimport type { HostProduct } from '../model/commerce'\nimport { toPrintable } from './print-document'\n\n/**\n * Product and shelf labels (AGL-3619): a product's name, its options, its\n * price and a barcode the register scans back, on the small thermal labels\n * a Zebra, Rollo, DYMO or Brother label printer takes.\n *\n * Two outputs from one description. A printable page (one label per page,\n * the page sized to the label) prints through the label printer's own\n * driver from any browser. ZPL is the Zebra printer language, sent to a\n * Zebra as a file; it prints sharper and faster and needs no driver\n * settings, so a store with a Zebra can skip the print dialog altogether.\n */\n\nexport interface ProductLabel {\n name: string\n /** A variant's options, e.g. `Large / Blue`. */\n detail?: string\n priceCents?: number\n currency?: string\n /** The variant's barcode, else its SKU: what the register looks up. */\n code: string\n copies: number\n}\n\nexport interface LabelSize {\n id: string\n label: string\n widthIn: number\n heightIn: number\n}\n\n/** The two sizes almost every label printer stocks for product labels. */\nexport const LABEL_SIZES: readonly LabelSize[] = [\n { id: '2.25x1.25', label: '2.25 x 1.25 in (57 x 32 mm)', widthIn: 2.25, heightIn: 1.25 },\n { id: '2x1', label: '2 x 1 in (51 x 25 mm)', widthIn: 2, heightIn: 1 },\n]\n\n/** One print run is capped; a typo of 5000 copies should not drain a roll. */\nexport const MAX_LABEL_COPIES = 500\n\nexport function labelSize(id: string | undefined): LabelSize {\n return LABEL_SIZES.find((size) => size.id === id) ?? LABEL_SIZES[0]\n}\n\nconst copiesOf = (label: ProductLabel) => Math.max(0, Math.min(MAX_LABEL_COPIES, Math.floor(Number(label.copies) || 0)))\n\nconst priceText = (label: ProductLabel) => labelPriceText(label)\n\n/** A label the products list prints for one variant, with the variant it is for. */\nexport type ProductLabelRow = ProductLabel & { variantId: string }\n\n/**\n * The labels a product prints: one row per variant, its options as the\n * detail, its price and the code the register looks up (the barcode, else\n * the SKU). A row with no code prints nothing until one is added. One copy\n * each to start; the person changes the counts before printing.\n */\nexport function productLabelRows(product: Pick<HostProduct, 'name' | 'variants'>): ProductLabelRow[] {\n return product.variants.map((variant) => {\n const options = Object.values(variant.options ?? {}).filter(Boolean)\n return {\n variantId: variant.id,\n name: product.name,\n ...(options.length ? { detail: options.join(' / ') } : {}),\n ...(Number.isFinite(Number(variant.priceUsd))\n ? { priceCents: Math.round(Number(variant.priceUsd) * 100) }\n : {}),\n currency: 'usd',\n code: String(variant.barcode || variant.sku || '').trim(),\n copies: 1,\n }\n })\n}\n\n/** The rows that print: a code and at least one copy, each count kept within {@link MAX_LABEL_COPIES}. */\nexport function printableLabelRows<T extends ProductLabel>(rows: readonly T[]): T[] {\n return rows.filter((row) => row.code && copiesOf(row) > 0)\n}\n\n/** How many labels the rows print in all. */\nexport function labelCopiesTotal(rows: readonly ProductLabel[]): number {\n return printableLabelRows(rows).reduce((sum, row) => sum + copiesOf(row), 0)\n}\n\n/** A typed copy count as the dialog keeps it: whole, at least 0, at most {@link MAX_LABEL_COPIES}. */\nexport function labelCopiesFromInput(value: unknown): number {\n return Math.max(0, Math.min(MAX_LABEL_COPIES, Math.floor(Number(value) || 0)))\n}\n\n/** The label's price line, empty when it has no price. */\nexport function labelPriceText(label: Pick<ProductLabel, 'priceCents' | 'currency'>): string {\n return label.priceCents != null && Number.isFinite(label.priceCents)\n ? formatReceiptMoney(Math.round(label.priceCents), label.currency ?? 'usd')\n : ''\n}\n\n/** The file name the ZPL download is saved under. */\nexport function labelsZplFileName(productName: string | undefined): string {\n return `labels-${(productName ?? 'product').replace(/[^A-Za-z0-9]+/g, '-').toLowerCase()}.zpl`\n}\n\n/*==========================================\n * The printable page\n *=========================================*/\n\nexport function productLabelsHtml(labels: ProductLabel[], sizeId?: string): string {\n const size = labelSize(sizeId)\n const pages: string[] = []\n for (const label of labels) {\n const encoded = encodeBarcode(label.code)\n const page =\n '<section class=\"label\">' +\n `<div class=\"name\">${escapeHtml(label.name)}</div>` +\n (label.detail ? `<div class=\"detail\">${escapeHtml(label.detail)}</div>` : '') +\n (priceText(label) ? `<div class=\"price\">${escapeHtml(priceText(label))}</div>` : '') +\n (encoded\n ? `<div class=\"bars\">${barcodeSvg(encoded)}</div><div class=\"code\">${escapeHtml(encoded.text)}</div>`\n : '') +\n '</section>'\n for (let copy = 0; copy < copiesOf(label); copy += 1) pages.push(page)\n }\n const width = `${size.widthIn}in`\n const height = `${size.heightIn}in`\n return (\n '<!doctype html><html><head><meta charset=\"utf-8\"><title>Labels</title><style>' +\n `@page{size:${width} ${height};margin:0}` +\n '*{box-sizing:border-box}html,body{margin:0;padding:0;font-family:Arial,Helvetica,sans-serif}' +\n `.label{width:${width};height:${height};padding:0.06in 0.08in;overflow:hidden;display:flex;flex-direction:column;page-break-after:always;break-after:page}` +\n '.label:last-child{page-break-after:auto;break-after:auto}' +\n '.name{font-size:9pt;font-weight:700;line-height:1.1;max-height:2.2em;overflow:hidden}' +\n '.detail{font-size:7pt;line-height:1.1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}' +\n '.price{font-size:11pt;font-weight:700;line-height:1.2}' +\n '.bars{flex:1;min-height:0.3in}.bars svg{width:100%;height:100%;display:block}' +\n '.code{font-size:7pt;text-align:center;letter-spacing:0.05em}' +\n '</style></head><body>' +\n pages.join('') +\n '</body></html>'\n )\n}\n\n/*==========================================\n * ZPL\n *=========================================*/\n\n/** Zebra's desktop printers print at 203 dpi; the 300 dpi models are listed by name. */\nexport type ZplDpi = 203 | 300\n\n/**\n * Field text for ZPL. `^FH` makes `_` the escape, so the three characters\n * ZPL treats as commands or that escape (`^`, `~`, `_`) are written as hex,\n * and the rest is folded to the printer's ASCII font.\n */\nexport function zplText(value: unknown): string {\n return toPrintable(value).replace(/[_^~]/g, (char) => `_${char.charCodeAt(0).toString(16).toUpperCase()}`)\n}\n\nfunction zplBarcode(encoded: EncodedBarcode, x: number, y: number, height: number, moduleDots: number): string {\n const at = `^FO${x},${y}^BY${moduleDots}`\n switch (encoded.format) {\n case 'ean_13':\n // ZPL takes the 12 data digits and adds the check digit itself.\n return `${at}^BEN,${height},Y,N^FD${encoded.text.slice(0, 12)}^FS`\n case 'upc_a':\n return `${at}^BUN,${height},Y,N,Y^FD${encoded.text.slice(0, 11)}^FS`\n case 'ean_8':\n return `${at}^B8N,${height},Y,N^FD${encoded.text.slice(0, 7)}^FS`\n default:\n // Mode A: the printer picks sets B and C itself, as the page does.\n return `${at}^BCN,${height},Y,N,N,A^FH^FD${zplText(encoded.text)}^FS`\n }\n}\n\nexport function productLabelsZpl(labels: ProductLabel[], sizeId?: string, dpi: ZplDpi = 203): string {\n const size = labelSize(sizeId)\n const width = Math.round(size.widthIn * dpi)\n const height = Math.round(size.heightIn * dpi)\n const margin = Math.round(0.08 * dpi)\n const font = Math.round(dpi / 9)\n const small = Math.round(dpi / 12)\n const moduleDots = dpi >= 300 ? 3 : 2\n const out: string[] = []\n for (const label of labels) {\n const copies = copiesOf(label)\n if (!copies) continue\n const encoded = encodeBarcode(label.code)\n let y = margin\n const fields: string[] = []\n fields.push(`^FO${margin},${y}^A0N,${font},${font}^FB${width - margin * 2},2,0,L^FH^FD${zplText(label.name)}^FS`)\n y += font * 2 + 2\n if (label.detail) {\n fields.push(`^FO${margin},${y}^A0N,${small},${small}^FB${width - margin * 2},1,0,L^FH^FD${zplText(label.detail)}^FS`)\n y += small + 2\n }\n const price = priceText(label)\n if (price) {\n fields.push(`^FO${margin},${y}^A0N,${font},${font}^FH^FD${zplText(price)}^FS`)\n y += font + 4\n }\n if (encoded) {\n // What is left of the label, less the printed digits under the bars.\n const barHeight = Math.max(Math.round(dpi * 0.2), height - y - margin - small - 4)\n fields.push(zplBarcode(encoded, margin, y, barHeight, moduleDots))\n }\n out.push(`^XA^CI0^PW${width}^LL${height}^LH0,0${fields.join('')}^PQ${copies},0,1,Y^XZ`)\n }\n return out.join('\\n')\n}\n"],"names":["escapeHtml","barcodeSvg","encodeBarcode","formatReceiptMoney","toPrintable","LABEL_SIZES","id","label","widthIn","heightIn","MAX_LABEL_COPIES","labelSize","find","size","copiesOf","Math","max","min","floor","Number","copies","priceText","labelPriceText","productLabelRows","product","variants","map","variant","options","Object","values","filter","Boolean","variantId","name","length","detail","join","isFinite","priceUsd","priceCents","round","currency","code","String","barcode","sku","trim","printableLabelRows","rows","row","labelCopiesTotal","reduce","sum","labelCopiesFromInput","value","labelsZplFileName","productName","replace","toLowerCase","productLabelsHtml","labels","sizeId","pages","encoded","page","text","copy","push","width","height","zplText","char","charCodeAt","toString","toUpperCase","zplBarcode","x","y","moduleDots","at","format","slice","productLabelsZpl","dpi","margin","font","small","out","fields","price","barHeight"],"mappings":";AAAA;;;;;;;;;;;;;;;CAeC,GAED,SAASA,UAAU,QAAQ,0BAAsB;AACjD,SAASC,UAAU,EAAEC,aAAa,QAA6B,+BAA2B;AAC1F,SAASC,kBAAkB,QA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AKQ,OAAO,IAAI;QAChB,IAAI/E,MAAM6B,MAAM,EAAE;YAChBqD,OAAOrB,IAAI,CAAC,CAAC,GAAG,EAAEiB,OAAO,CAAC,EAAEP,EAAE,KAAK,EAAES,MAAM,CAAC,EAAEA,MAAM,GAAG,EAAElB,QAAQgB,SAAS,EAAE,YAAY,EAAEd,QAAQhE,MAAM6B,MAAM,EAAE,GAAG,CAAC;YACpH0C,KAAKS,QAAQ;QACf;QACA,MAAMG,QAAQrE,UAAUd;QACxB,IAAImF,OAAO;YACTD,OAAOrB,IAAI,CAAC,CAAC,GAAG,EAAEiB,OAAO,CAAC,EAAEP,EAAE,KAAK,EAAEQ,KAAK,CAAC,EAAEA,KAAK,MAAM,EAAEf,QAAQmB,OAAO,GAAG,CAAC;YAC7EZ,KAAKQ,OAAO;QACd;QACA,IAAItB,SAAS;YACX,qEAAqE;YACrE,MAAM2B,YAAY5E,KAAKC,GAAG,CAACD,KAAK0B,KAAK,CAAC2C,MAAM,MAAMd,SAASQ,IAAIO,SAASE,QAAQ;YAChFE,OAAOrB,IAAI,CAACQ,WAAWZ,SAASqB,QAAQP,GAAGa,WAAWZ;QACxD;QACAS,IAAIpB,IAAI,CAAC,CAAC,UAAU,EAAEC,MAAM,GAAG,EAAEC,OAAO,MAAM,EAAEmB,OAAOpD,IAAI,CAAC,IAAI,GAAG,EAAEjB,OAAO,SAAS,CAAC;IACxF;IACA,OAAOoE,IAAInD,IAAI,CAAC;AAClB"}
|
|
@@ -3701,7 +3701,7 @@ async function findOrderForDispute(paymentIntentId) {
|
|
|
3701
3701
|
type: 'content.order',
|
|
3702
3702
|
title: 'A canceled order was paid',
|
|
3703
3703
|
body: `Order ${canceledOrderLabel || orderId} on {site} was canceled, ` + 'but its payment link was still live and has been paid. The ' + 'money is in Stripe and no sale was recorded — refund it in ' + 'Stripe or reconcile it by hand.',
|
|
3704
|
-
link: `/${hostId}/orders`
|
|
3704
|
+
link: `/${hostId}/products/orders`
|
|
3705
3705
|
});
|
|
3706
3706
|
}
|
|
3707
3707
|
if (flipped) {
|
|
@@ -4640,7 +4640,7 @@ async function findOrderForDispute(paymentIntentId) {
|
|
|
4640
4640
|
type: 'content.order',
|
|
4641
4641
|
title: settled.lost ? `Chargeback lost — order ${disputedOrderLabel}` : 'Chargeback resolved in your favor',
|
|
4642
4642
|
body: settled.lost ? `The chargeback on order ${disputedOrderLabel} on {site} was ` + 'decided in the shopper\'s favor, and their bank took back ' + `$${(settled.reversedCents / 100).toFixed(2)}. If part of the ` + 'sale had been paid out to you, a separate notice says what ' + 'is taken back from your balance.' : `The chargeback on order ${disputedOrderLabel} on {site} ` + 'closed in your favor. Nothing is taken back from you for it.',
|
|
4643
|
-
link: `/${hostId}/orders`
|
|
4643
|
+
link: `/${hostId}/products/orders`
|
|
4644
4644
|
});
|
|
4645
4645
|
// The customer's side of the ledger (AGL-1754), through the same
|
|
4646
4646
|
// seam a refund uses and with the reason set so the person's
|
|
@@ -4712,7 +4712,7 @@ async function findOrderForDispute(paymentIntentId) {
|
|
|
4712
4712
|
type: 'content.order',
|
|
4713
4713
|
title: `Payout adjusted — $${(pulledBackCents / 100).toFixed(2)} recovered for a lost chargeback`,
|
|
4714
4714
|
body: `Because the chargeback on order ${disputedOrderLabel} on ` + `{site} was lost, the $${(pulledBackCents / 100).toFixed(2)} ` + 'transferred to you for that sale has been taken back. If ' + 'your balance does not cover it, Stripe recovers the rest ' + 'from your future payouts.',
|
|
4715
|
-
link: `/${hostId}/orders`
|
|
4715
|
+
link: `/${hostId}/products/orders`
|
|
4716
4716
|
});
|
|
4717
4717
|
}
|
|
4718
4718
|
}
|