@aglyn/plugins-commerce 1.29.1 → 1.29.2
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/checkout-tax-blocked-notice.component.d.ts +18 -0
- package/src/lib/components/console/checkout-tax-blocked-notice.component.js +67 -0
- package/src/lib/components/console/checkout-tax-blocked-notice.component.js.map +1 -0
- package/src/lib/components/console/payments-settings-card.component.d.ts +2 -2
- package/src/lib/components/console/payments-settings-card.component.js +99 -5
- package/src/lib/components/console/payments-settings-card.component.js.map +1 -1
- package/src/lib/components/console/product-editor-dialog.component.js +14 -3
- package/src/lib/components/console/product-editor-dialog.component.js.map +1 -1
- package/src/lib/components/console/stripe-tax-readiness.component.d.ts +45 -0
- package/src/lib/components/console/stripe-tax-readiness.component.js +276 -0
- package/src/lib/components/console/stripe-tax-readiness.component.js.map +1 -0
- package/src/lib/components/console/tax-settings-card.component.js +22 -8
- package/src/lib/components/console/tax-settings-card.component.js.map +1 -1
- package/src/lib/constants/operator-alerts.d.ts +9 -0
- package/src/lib/constants/operator-alerts.js +22 -1
- package/src/lib/constants/operator-alerts.js.map +1 -1
- package/src/lib/declarations.server.js +11 -0
- package/src/lib/declarations.server.js.map +1 -1
- package/src/lib/model/commerce-tax-readiness.d.ts +79 -0
- package/src/lib/model/commerce-tax-readiness.js +99 -0
- package/src/lib/model/commerce-tax-readiness.js.map +1 -0
- package/src/lib/model/commerce.d.ts +7 -0
- package/src/lib/model/commerce.js +17 -4
- package/src/lib/model/commerce.js.map +1 -1
- package/src/lib/model/payments-setup-status.d.ts +68 -0
- package/src/lib/model/payments-setup-status.js +103 -0
- package/src/lib/model/payments-setup-status.js.map +1 -0
- package/src/lib/plan-entitlements.d.ts +2 -1
- package/src/lib/plan-entitlements.js +2 -1
- package/src/lib/plan-entitlements.js.map +1 -1
- package/src/lib/server/cart-checkout.js +3 -0
- package/src/lib/server/cart-checkout.js.map +1 -1
- package/src/lib/server/checkout-tax-refusal.d.ts +51 -0
- package/src/lib/server/checkout-tax-refusal.js +133 -0
- package/src/lib/server/checkout-tax-refusal.js.map +1 -0
- package/src/lib/server/checkout.d.ts +2 -1
- package/src/lib/server/checkout.js +7 -2
- package/src/lib/server/checkout.js.map +1 -1
- package/src/lib/server/connect-prefill.d.ts +65 -0
- package/src/lib/server/connect-prefill.js +85 -0
- package/src/lib/server/connect-prefill.js.map +1 -0
- package/src/lib/server/connect.d.ts +4 -2
- package/src/lib/server/connect.js +117 -37
- package/src/lib/server/connect.js.map +1 -1
- package/src/lib/server/draft-order.js +4 -2
- package/src/lib/server/draft-order.js.map +1 -1
- package/src/lib/server/pos-order.js +1 -1
- package/src/lib/server/pos-order.js.map +1 -1
- package/src/lib/server/product-writer.d.ts +27 -0
- package/src/lib/server/product-writer.js +174 -4
- package/src/lib/server/product-writer.js.map +1 -1
- package/src/lib/server/quote-pay.d.ts +6 -0
- package/src/lib/server/quote-pay.js +8 -2
- package/src/lib/server/quote-pay.js.map +1 -1
- package/src/lib/server/seller-stripe-account.d.ts +19 -0
- package/src/lib/server/seller-stripe-account.js +40 -4
- package/src/lib/server/seller-stripe-account.js.map +1 -1
- package/src/lib/server/site-page-resolver.d.ts +1 -6
- package/src/lib/server/site-page-resolver.js +4 -12
- package/src/lib/server/site-page-resolver.js.map +1 -1
- package/src/lib/server/site-search.d.ts +43 -0
- package/src/lib/server/site-search.js +124 -0
- package/src/lib/server/site-search.js.map +1 -0
- package/src/lib/server/tax-readiness.d.ts +56 -0
- package/src/lib/server/tax-readiness.js +169 -0
- package/src/lib/server/tax-readiness.js.map +1 -0
- package/src/lib/server.js +6 -0
- package/src/lib/server.js.map +1 -1
- package/src/lib/transfer/product-image-copy.server.d.ts +77 -0
- package/src/lib/transfer/product-image-copy.server.js +307 -0
- package/src/lib/transfer/product-image-copy.server.js.map +1 -0
- package/src/lib/transfer/product-images.d.ts +62 -0
- package/src/lib/transfer/product-images.js +143 -0
- package/src/lib/transfer/product-images.js.map +1 -0
- package/src/lib/transfer/product-sources.d.ts +92 -0
- package/src/lib/transfer/product-sources.js +519 -0
- package/src/lib/transfer/product-sources.js.map +1 -0
- package/src/lib/transfer/product-transfer.d.ts +26 -1
- package/src/lib/transfer/product-transfer.js +283 -11
- package/src/lib/transfer/product-transfer.js.map +1 -1
- package/src/lib/transfer/products.server.d.ts +29 -3
- package/src/lib/transfer/products.server.js +289 -13
- package/src/lib/transfer/products.server.js.map +1 -1
|
@@ -242,6 +242,26 @@ export const COMMERCE_FEE_REPRICE_REFUSED = {
|
|
|
242
242
|
dedupeWindowMinutes: 30 * DAY,
|
|
243
243
|
defaultEnabled: true
|
|
244
244
|
};
|
|
245
|
+
/**
|
|
246
|
+
* A shopper was refused at checkout because the store's sales tax is not set
|
|
247
|
+
* up (AGL-4245): no tax option was ever chosen, or the store chose Stripe Tax
|
|
248
|
+
* on its own Stripe account and Stripe Tax is not on there. Raised once per
|
|
249
|
+
* store until the store fixes it (`server/checkout-tax-refusal.ts`); the
|
|
250
|
+
* store's managers are told too, which is the notice that matters. This one
|
|
251
|
+
* is for support, so it rides the daily digest.
|
|
252
|
+
*/ export const COMMERCE_CHECKOUT_TAX_SETUP_REFUSED = {
|
|
253
|
+
type: 'commerce.checkoutTaxSetupRefused',
|
|
254
|
+
pluginId: BUNDLE_ID,
|
|
255
|
+
label: 'Checkout refused for unfinished sales tax setup',
|
|
256
|
+
description: 'A shopper could not check out because the store has not finished its sales tax setup: no tax option chosen, or Stripe Tax chosen but not on in the store’s own Stripe account. The store’s managers are told too, once until it is fixed.',
|
|
257
|
+
tier: 'should',
|
|
258
|
+
category: 'payments',
|
|
259
|
+
title: 'Checkout refused on {{site}}: {{reason}}',
|
|
260
|
+
body: 'A shopper could not check out on site {{site}} because {{reason}}. The store’s managers were told and pointed to Products → Taxes. Every checkout there is refused until it is fixed.',
|
|
261
|
+
delivery: 'digest',
|
|
262
|
+
dedupeWindowMinutes: 30 * DAY,
|
|
263
|
+
defaultEnabled: true
|
|
264
|
+
};
|
|
245
265
|
export const COMMERCE_OPERATOR_ALERTS = [
|
|
246
266
|
COMMERCE_CHARGEBACK_UNROUTABLE,
|
|
247
267
|
COMMERCE_TAX_NOT_REVERSED,
|
|
@@ -255,7 +275,8 @@ export const COMMERCE_OPERATOR_ALERTS = [
|
|
|
255
275
|
COMMERCE_POS_HARDWARE_RETURN_REQUESTED,
|
|
256
276
|
COMMERCE_POS_CELLULAR_CHARGE_FAILED,
|
|
257
277
|
COMMERCE_POS_CELLULAR_TURN_OFF_FAILED,
|
|
258
|
-
COMMERCE_POS_CELLULAR_TURNED_OFF_UNPAID
|
|
278
|
+
COMMERCE_POS_CELLULAR_TURNED_OFF_UNPAID,
|
|
279
|
+
COMMERCE_CHECKOUT_TAX_SETUP_REFUSED
|
|
259
280
|
];
|
|
260
281
|
|
|
261
282
|
//# sourceMappingURL=operator-alerts.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../libs/plugins/commerce/src/lib/constants/operator-alerts.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { OperatorAlertDefinition } from '@aglyn/aglyn/app-utils/operator-alerts'\nimport { BUNDLE_ID } from './bundle-common'\n\n/**\n * The storefront's operator alerts (AGL-3377): the money faults only this\n * plugin can see, declared in the registry's shape and registered from\n * `declarations.server`, so core lists none of them and an install without\n * commerce shows none of them on Staff → Operator alerts.\n *\n * Each is raised through `raiseOperatorAlert` with its definition, which\n * also registers it in a process whose declarations have not loaded yet.\n */\nconst DAY = 24 * 60\n\nexport const COMMERCE_CHARGEBACK_UNROUTABLE: OperatorAlertDefinition = {\n type: 'commerce.chargebackUnroutable',\n pluginId: BUNDLE_ID,\n label: 'Storefront chargeback could not be routed',\n description:\n 'A storefront chargeback matched no order, or more than one, so no order was flagged, no seller share reversed and no merchant told. A missing index means every storefront chargeback is being ignored.',\n tier: 'must',\n category: 'payments',\n title: 'A {{amount}} chargeback could not be routed to an order',\n body: '{{detail}}',\n delivery: 'immediate',\n dedupeWindowMinutes: DAY,\n defaultEnabled: true,\n}\n\nexport const COMMERCE_TAX_NOT_REVERSED: OperatorAlertDefinition = {\n type: 'commerce.taxNotReversed',\n pluginId: BUNDLE_ID,\n label: 'Subscription sales tax not reversed',\n description:\n 'Sales tax collected on a storefront subscription stayed with the merchant instead of coming back to the platform, which files and remits it. The platform may owe tax it does not hold.',\n tier: 'must',\n category: 'payments',\n title: 'Sales tax not reversed on invoice {{invoiceId}}',\n // `{{site}}` is the site's name and id (AGL-3432), so staff need not look\n // it up; the last sentence is the consequence the description states.\n body:\n '{{amount}} of sales tax on invoice {{invoiceId}} for site {{site}} was not pulled back from the merchant: {{reason}}. The platform files and remits that tax, so it may owe tax it does not hold.',\n delivery: 'immediate',\n dedupeWindowMinutes: 7 * DAY,\n defaultEnabled: true,\n}\n\nexport const COMMERCE_SELLER_SHARE_NOT_REVERSED: OperatorAlertDefinition = {\n type: 'commerce.sellerShareNotReversed',\n pluginId: BUNDLE_ID,\n label: 'Seller share not reversed on a lost dispute',\n description:\n 'A storefront dispute was lost and the merchant’s share could not be pulled back, so the platform is out the principal. Recover it by hand in Stripe.',\n tier: 'must',\n category: 'payments',\n title: 'Seller share not reversed on dispute {{disputeId}}',\n body:\n 'The lost dispute {{disputeId}} on order {{orderId}} from site {{site}} cost {{amount}}, and the merchant’s share was not reversed: {{reason}}. The platform is out that share until it is recovered by hand in Stripe.',\n delivery: 'immediate',\n dedupeWindowMinutes: 30 * DAY,\n defaultEnabled: true,\n}\n\nexport const COMMERCE_FEE_REPRICE_REFUSED: OperatorAlertDefinition = {\n type: 'commerce.feeRepriceRefused',\n pluginId: BUNDLE_ID,\n label: 'Platform fee correction refused',\n description:\n 'Stripe refused to change a storefront subscription’s platform fee, or to refund the part of a fee charged on the wrong base. The merchant is being charged a fee the plan does not set.',\n tier: 'must',\n category: 'payments',\n title: 'Platform fee not corrected on {{subject}}',\n body:\n 'The platform fee on {{subject}} for site {{site}} could not be corrected: {{reason}}. Until it is, the merchant is charged a fee its plan does not set.',\n delivery: 'immediate',\n dedupeWindowMinutes: 7 * DAY,\n defaultEnabled: true,\n}\n\n/**\n * A merchant paid for card readers in the POS hardware shop (AGL-4038). In\n * phase 1 a person places the order in Stripe's Terminal hardware shop, so\n * every paid order is work waiting on staff until it is marked ordered.\n */\nexport const COMMERCE_POS_HARDWARE_ORDER: OperatorAlertDefinition = {\n type: 'commerce.posHardwareOrder',\n pluginId: BUNDLE_ID,\n label: 'New hardware order',\n description:\n 'A workspace paid for card readers or accessories in the POS hardware shop. Place the order in the Stripe Dashboard’s Terminal hardware shop, shipping to the merchant’s address, then record the Stripe order id on Staff → Hardware orders.',\n tier: 'should',\n category: 'payments',\n title: 'New hardware order {{orderNumber}} for {{amount}}',\n body:\n 'Site {{site}} ordered {{items}} ({{amount}}, {{shipping}}). Place it in the Stripe Dashboard’s Terminal hardware shop, shipping to the address on the order, and record the Stripe order id on Staff → Hardware orders.',\n link: '/admin/hardware-orders',\n delivery: 'immediate',\n dedupeWindowMinutes: 30 * DAY,\n defaultEnabled: true,\n}\n\n/**\n * A card taken offline on the Aglyn POS app's reader reached Stripe, but the\n * sale it belongs to never synced (AGL-4039). Raised by the hourly sweep once\n * the intent has waited past `POS_OFFLINE_CARD_UNSYNCED_ALERT_MS`, while there\n * is still time to sync it before Stripe's authorization lapses.\n */\nexport const COMMERCE_POS_OFFLINE_CARD_UNSYNCED: OperatorAlertDefinition = {\n type: 'commerce.posOfflineCardUnsynced',\n pluginId: BUNDLE_ID,\n label: 'Offline card sale never synced',\n description:\n 'A card taken offline on a register reached Stripe, but its sale never reached the store. An authorized card is never captured and lapses after about two days; a charged one has no order. The site’s managers are told too.',\n tier: 'should',\n category: 'payments',\n title: 'A {{amount}} card taken offline has no sale',\n body:\n 'Payment {{paymentIntentId}} ({{status}}) for site {{site}} was taken offline on register {{registerId}} {{age}} ago, and its sale never synced. Ask the store to open that register signed in as the member who rang it so the sale syncs. An authorized card that is not captured lapses about two days after it was taken.',\n delivery: 'immediate',\n dedupeWindowMinutes: 30 * DAY,\n defaultEnabled: true,\n}\n\n/**\n * A card taken offline was made out to a Stripe account that is not the\n * store's (AGL-4039): a stale offline kit, or a register that was tampered\n * with. The sync never captures it and records the order unpaid.\n */\nexport const COMMERCE_POS_OFFLINE_CARD_WRONG_ACCOUNT: OperatorAlertDefinition = {\n type: 'commerce.posOfflineCardWrongAccount',\n pluginId: BUNDLE_ID,\n label: 'Offline card made out to another Stripe account',\n description:\n 'A card taken offline on a register was set to pay a Stripe account that is not the store’s. The sale was recorded unpaid and the card was not captured. Check whether the account is the store’s own previous one before capturing it in Stripe, or let the authorization lapse.',\n tier: 'must',\n category: 'payments',\n title: 'A {{amount}} offline card was made out to another Stripe account',\n body:\n 'Payment {{paymentIntentId}} ({{status}}) on order {{orderId}} for site {{site}} pays account {{destination}}, but the store’s account is {{expected}}. The order is recorded unpaid and nothing was captured. If the payment already succeeded, the money is in that other account: recover or refund it in Stripe.',\n delivery: 'immediate',\n dedupeWindowMinutes: 30 * DAY,\n defaultEnabled: true,\n}\n\n/**\n * A hardware order already placed with Stripe was canceled and refunded\n * because its workspace was deleted or the account that placed it closed\n * (AGL-4038). The merchant has their money back; the platform has paid Stripe\n * for hardware that is still on its way unless someone cancels it there.\n */\nexport const COMMERCE_POS_HARDWARE_CANCELED_AFTER_ORDERING: OperatorAlertDefinition = {\n type: 'commerce.posHardwareCanceledAfterOrdering',\n pluginId: BUNDLE_ID,\n label: 'Hardware order canceled after it was placed with Stripe',\n description:\n 'A workspace was deleted, or the account that placed a hardware order was closed, after staff had placed the order with Stripe. The merchant was refunded in full. Cancel the order in the Stripe Dashboard’s Terminal hardware shop before it ships, or arrange its return with Stripe.',\n tier: 'must',\n category: 'payments',\n title: 'Cancel hardware order {{orderNumber}} with Stripe',\n // `{{stripeOrder}}` is ` (Stripe order …)` or blank, so the sentence reads\n // either way.\n body:\n 'Hardware order {{orderNumber}} ({{amount}}: {{items}}) was canceled and refunded in full to the merchant because {{reason}}, but it had already been placed with Stripe{{stripeOrder}}. Cancel it in the Stripe Dashboard’s Terminal hardware shop before it ships; if it has shipped, arrange its return with Stripe.',\n link: '/admin/hardware-orders',\n delivery: 'immediate',\n dedupeWindowMinutes: 30 * DAY,\n defaultEnabled: true,\n}\n\n/**\n * Stripe refused the refund of an unshipped hardware order while its\n * workspace or its buyer's account was closing (AGL-4038). The closure went\n * ahead, as decided, so the order may be gone from the staff page with the\n * merchant's money still held.\n */\nexport const COMMERCE_POS_HARDWARE_REFUND_FAILED: OperatorAlertDefinition = {\n type: 'commerce.posHardwareRefundFailed',\n pluginId: BUNDLE_ID,\n label: 'Hardware refund failed when a workspace or account closed',\n description:\n 'A hardware order had not shipped when its workspace was deleted or the account that placed it was closed, and Stripe refused its refund. The closure went ahead without it. Refund the payment in full in the Stripe Dashboard.',\n tier: 'must',\n category: 'payments',\n title: 'Refund hardware order {{orderNumber}} by hand: {{amount}}',\n body:\n 'Hardware order {{orderNumber}} ({{amount}}) had not shipped when {{reason}}, and Stripe refused its refund: {{error}}. The closure went ahead. Refund payment {{paymentIntentId}} in full in the Stripe Dashboard{{orderedNote}}.',\n delivery: 'immediate',\n dedupeWindowMinutes: 30 * DAY,\n defaultEnabled: true,\n}\n\n/**\n * A buyer asked to return a card reader they bought in person at the\n * platform's own store (AGL-4038), from their own purchase history. Staff\n * refund it from Staff → Hardware orders, or decline it there.\n */\nexport const COMMERCE_POS_HARDWARE_RETURN_REQUESTED: OperatorAlertDefinition = {\n type: 'commerce.posHardwareReturnRequested',\n pluginId: BUNDLE_ID,\n label: 'Card reader return requested',\n description:\n 'A workspace asked to return card reader hardware it bought in person. Arrange the return under Stripe’s hardware terms, then refund it or decline it on Staff → Hardware orders, under Return requested.',\n tier: 'should',\n category: 'payments',\n title: 'Return requested for hardware order {{orderNumber}} ({{amount}})',\n body:\n 'Workspace {{orgId}} asked to return {{items}} from hardware order {{orderNumber}} ({{amount}}), bought in person: “{{reason}}”. Refund it or decline it on Staff → Hardware orders, under Return requested.',\n link: '/admin/hardware-orders',\n delivery: 'immediate',\n dedupeWindowMinutes: 30 * DAY,\n defaultEnabled: true,\n}\n\n/**\n * A workspace's monthly 4G charge for its S710 readers did not\n * collect (AGL-4038): the card declined or asked for authentication (the\n * invoice is left open on their Billing page, which nothing retries), or\n * the workspace has no Stripe customer to bill. Stripe still bills the\n * platform for those readers' cellular service.\n */\nexport const COMMERCE_POS_CELLULAR_CHARGE_FAILED: OperatorAlertDefinition = {\n type: 'commerce.posCellularChargeFailed',\n pluginId: BUNDLE_ID,\n label: '4G charge for card readers not collected',\n description:\n 'A workspace’s monthly charge for 4G on its S710 readers did not collect. Stripe still bills the platform for those readers. Follow up with the workspace, or turn 4G off for its stores.',\n tier: 'should',\n category: 'payments',\n title: '4G charge for {{month}} not collected: {{amount}}',\n body:\n 'Workspace {{orgId}} had 4G on {{readers}} card reader(s) in {{month}}, and its charge of {{amount}} was not collected: {{reason}}. Stripe still bills the platform for those readers.',\n delivery: 'immediate',\n dedupeWindowMinutes: 30 * DAY,\n defaultEnabled: true,\n}\n\n/**\n * 4G could not be turned off at Stripe for a store that is gone (AGL-4038):\n * its workspace was deleted, or the store was, while its S710s had 4G. The\n * readers stay on the platform's Stripe account with cellular on, which\n * Stripe keeps billing the platform for, and nobody is charged for it.\n */\nexport const COMMERCE_POS_CELLULAR_TURN_OFF_FAILED: OperatorAlertDefinition = {\n type: 'commerce.posCellularTurnOffFailed',\n pluginId: BUNDLE_ID,\n label: '4G not turned off for a deleted store',\n description:\n 'A store with 4G on its S710 readers was deleted, with its workspace or on its own, and Stripe refused to turn cellular off on its Terminal configuration. Turn it off in the Stripe Dashboard, or Stripe keeps billing the platform for it.',\n tier: 'must',\n category: 'payments',\n title: 'Turn off 4G on Terminal configuration {{configurationId}}',\n body:\n 'Store {{hostId}} of workspace {{orgId}} was deleted while its card readers had 4G, and Stripe refused to turn cellular off on Terminal configuration {{configurationId}}. Turn it off in the Stripe Dashboard (Terminal → Locations), or Stripe keeps billing the platform for those readers.',\n delivery: 'immediate',\n dedupeWindowMinutes: 30 * DAY,\n defaultEnabled: true,\n}\n\n/**\n * A workspace's monthly 4G charge stayed unpaid past the grace period\n * (AGL-4038), so 4G was turned off at Stripe for every one of its stores and\n * the members who manage its billing were emailed. Paying does not turn it\n * back on; the merchant does, once it is paid.\n */\nexport const COMMERCE_POS_CELLULAR_TURNED_OFF_UNPAID: OperatorAlertDefinition = {\n type: 'commerce.posCellularTurnedOffUnpaid',\n pluginId: BUNDLE_ID,\n label: '4G turned off for an unpaid charge',\n description:\n 'A workspace’s monthly 4G charge for its S710 readers was still unpaid after the grace period, so 4G was turned off for its stores and the people who manage its billing were emailed. Follow up if the workspace asks; it turns 4G on again itself once the invoice is paid.',\n tier: 'should',\n category: 'payments',\n title: '4G turned off for workspace {{orgId}}: {{month}} unpaid ({{amount}})',\n body:\n 'Workspace {{orgId}} left its 4G charge of {{amount}} for {{month}} unpaid for {{graceDays}} days, so 4G was turned off at Stripe for its stores and the people who manage its billing were emailed. The invoice stays open on its Billing page.',\n delivery: 'immediate',\n dedupeWindowMinutes: 30 * DAY,\n defaultEnabled: true,\n}\n\nexport const COMMERCE_OPERATOR_ALERTS: readonly OperatorAlertDefinition[] = [\n COMMERCE_CHARGEBACK_UNROUTABLE,\n COMMERCE_TAX_NOT_REVERSED,\n COMMERCE_SELLER_SHARE_NOT_REVERSED,\n COMMERCE_FEE_REPRICE_REFUSED,\n COMMERCE_POS_HARDWARE_ORDER,\n COMMERCE_POS_OFFLINE_CARD_UNSYNCED,\n COMMERCE_POS_OFFLINE_CARD_WRONG_ACCOUNT,\n COMMERCE_POS_HARDWARE_CANCELED_AFTER_ORDERING,\n COMMERCE_POS_HARDWARE_REFUND_FAILED,\n COMMERCE_POS_HARDWARE_RETURN_REQUESTED,\n COMMERCE_POS_CELLULAR_CHARGE_FAILED,\n COMMERCE_POS_CELLULAR_TURN_OFF_FAILED,\n COMMERCE_POS_CELLULAR_TURNED_OFF_UNPAID,\n]\n"],"names":["BUNDLE_ID","DAY","COMMERCE_CHARGEBACK_UNROUTABLE","type","pluginId","label","description","tier","category","title","body","delivery","dedupeWindowMinutes","defaultEnabled","COMMERCE_TAX_NOT_REVERSED","COMMERCE_SELLER_SHARE_NOT_REVERSED","COMMERCE_FEE_REPRICE_REFUSED","COMMERCE_POS_HARDWARE_ORDER","link","COMMERCE_POS_OFFLINE_CARD_UNSYNCED","COMMERCE_POS_OFFLINE_CARD_WRONG_ACCOUNT","COMMERCE_POS_HARDWARE_CANCELED_AFTER_ORDERING","COMMERCE_POS_HARDWARE_REFUND_FAILED","COMMERCE_POS_HARDWARE_RETURN_REQUESTED","COMMERCE_POS_CELLULAR_CHARGE_FAILED","COMMERCE_POS_CELLULAR_TURN_OFF_FAILED","COMMERCE_POS_CELLULAR_TURNED_OFF_UNPAID","COMMERCE_OPERATOR_ALERTS"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAGD,SAASA,SAAS,QAAQ,qBAAiB;AAE3C;;;;;;;;CAQC,GACD,MAAMC,MAAM,KAAK;AAEjB,OAAO,MAAMC,iCAA0D;IACrEC,MAAM;IACNC,UAAUJ;IACVK,OAAO;IACPC,aACE;IACFC,MAAM;IACNC,UAAU;IACVC,OAAO;IACPC,MAAM;IACNC,UAAU;IACVC,qBAAqBX;IACrBY,gBAAgB;AAClB,EAAC;AAED,OAAO,MAAMC,4BAAqD;IAChEX,MAAM;IACNC,UAAUJ;IACVK,OAAO;IACPC,aACE;IACFC,MAAM;IACNC,UAAU;IACVC,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;IACAC;IACAC;IACAC;IACAC;CACD,CAAA"}
|
|
1
|
+
{"version":3,"sources":["../../../../../../../libs/plugins/commerce/src/lib/constants/operator-alerts.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { OperatorAlertDefinition } from '@aglyn/aglyn/app-utils/operator-alerts'\nimport { BUNDLE_ID } from './bundle-common'\n\n/**\n * The storefront's operator alerts (AGL-3377): the money faults only this\n * plugin can see, declared in the registry's shape and registered from\n * `declarations.server`, so core lists none of them and an install without\n * commerce shows none of them on Staff → Operator alerts.\n *\n * Each is raised through `raiseOperatorAlert` with its definition, which\n * also registers it in a process whose declarations have not loaded yet.\n */\nconst DAY = 24 * 60\n\nexport const COMMERCE_CHARGEBACK_UNROUTABLE: OperatorAlertDefinition = {\n type: 'commerce.chargebackUnroutable',\n pluginId: BUNDLE_ID,\n label: 'Storefront chargeback could not be routed',\n description:\n 'A storefront chargeback matched no order, or more than one, so no order was flagged, no seller share reversed and no merchant told. A missing index means every storefront chargeback is being ignored.',\n tier: 'must',\n category: 'payments',\n title: 'A {{amount}} chargeback could not be routed to an order',\n body: '{{detail}}',\n delivery: 'immediate',\n dedupeWindowMinutes: DAY,\n defaultEnabled: true,\n}\n\nexport const COMMERCE_TAX_NOT_REVERSED: OperatorAlertDefinition = {\n type: 'commerce.taxNotReversed',\n pluginId: BUNDLE_ID,\n label: 'Subscription sales tax not reversed',\n description:\n 'Sales tax collected on a storefront subscription stayed with the merchant instead of coming back to the platform, which files and remits it. The platform may owe tax it does not hold.',\n tier: 'must',\n category: 'payments',\n title: 'Sales tax not reversed on invoice {{invoiceId}}',\n // `{{site}}` is the site's name and id (AGL-3432), so staff need not look\n // it up; the last sentence is the consequence the description states.\n body:\n '{{amount}} of sales tax on invoice {{invoiceId}} for site {{site}} was not pulled back from the merchant: {{reason}}. The platform files and remits that tax, so it may owe tax it does not hold.',\n delivery: 'immediate',\n dedupeWindowMinutes: 7 * DAY,\n defaultEnabled: true,\n}\n\nexport const COMMERCE_SELLER_SHARE_NOT_REVERSED: OperatorAlertDefinition = {\n type: 'commerce.sellerShareNotReversed',\n pluginId: BUNDLE_ID,\n label: 'Seller share not reversed on a lost dispute',\n description:\n 'A storefront dispute was lost and the merchant’s share could not be pulled back, so the platform is out the principal. Recover it by hand in Stripe.',\n tier: 'must',\n category: 'payments',\n title: 'Seller share not reversed on dispute {{disputeId}}',\n body:\n 'The lost dispute {{disputeId}} on order {{orderId}} from site {{site}} cost {{amount}}, and the merchant’s share was not reversed: {{reason}}. The platform is out that share until it is recovered by hand in Stripe.',\n delivery: 'immediate',\n dedupeWindowMinutes: 30 * DAY,\n defaultEnabled: true,\n}\n\nexport const COMMERCE_FEE_REPRICE_REFUSED: OperatorAlertDefinition = {\n type: 'commerce.feeRepriceRefused',\n pluginId: BUNDLE_ID,\n label: 'Platform fee correction refused',\n description:\n 'Stripe refused to change a storefront subscription’s platform fee, or to refund the part of a fee charged on the wrong base. The merchant is being charged a fee the plan does not set.',\n tier: 'must',\n category: 'payments',\n title: 'Platform fee not corrected on {{subject}}',\n body:\n 'The platform fee on {{subject}} for site {{site}} could not be corrected: {{reason}}. Until it is, the merchant is charged a fee its plan does not set.',\n delivery: 'immediate',\n dedupeWindowMinutes: 7 * DAY,\n defaultEnabled: true,\n}\n\n/**\n * A merchant paid for card readers in the POS hardware shop (AGL-4038). In\n * phase 1 a person places the order in Stripe's Terminal hardware shop, so\n * every paid order is work waiting on staff until it is marked ordered.\n */\nexport const COMMERCE_POS_HARDWARE_ORDER: OperatorAlertDefinition = {\n type: 'commerce.posHardwareOrder',\n pluginId: BUNDLE_ID,\n label: 'New hardware order',\n description:\n 'A workspace paid for card readers or accessories in the POS hardware shop. Place the order in the Stripe Dashboard’s Terminal hardware shop, shipping to the merchant’s address, then record the Stripe order id on Staff → Hardware orders.',\n tier: 'should',\n category: 'payments',\n title: 'New hardware order {{orderNumber}} for {{amount}}',\n body:\n 'Site {{site}} ordered {{items}} ({{amount}}, {{shipping}}). Place it in the Stripe Dashboard’s Terminal hardware shop, shipping to the address on the order, and record the Stripe order id on Staff → Hardware orders.',\n link: '/admin/hardware-orders',\n delivery: 'immediate',\n dedupeWindowMinutes: 30 * DAY,\n defaultEnabled: true,\n}\n\n/**\n * A card taken offline on the Aglyn POS app's reader reached Stripe, but the\n * sale it belongs to never synced (AGL-4039). Raised by the hourly sweep once\n * the intent has waited past `POS_OFFLINE_CARD_UNSYNCED_ALERT_MS`, while there\n * is still time to sync it before Stripe's authorization lapses.\n */\nexport const COMMERCE_POS_OFFLINE_CARD_UNSYNCED: OperatorAlertDefinition = {\n type: 'commerce.posOfflineCardUnsynced',\n pluginId: BUNDLE_ID,\n label: 'Offline card sale never synced',\n description:\n 'A card taken offline on a register reached Stripe, but its sale never reached the store. An authorized card is never captured and lapses after about two days; a charged one has no order. The site’s managers are told too.',\n tier: 'should',\n category: 'payments',\n title: 'A {{amount}} card taken offline has no sale',\n body:\n 'Payment {{paymentIntentId}} ({{status}}) for site {{site}} was taken offline on register {{registerId}} {{age}} ago, and its sale never synced. Ask the store to open that register signed in as the member who rang it so the sale syncs. An authorized card that is not captured lapses about two days after it was taken.',\n delivery: 'immediate',\n dedupeWindowMinutes: 30 * DAY,\n defaultEnabled: true,\n}\n\n/**\n * A card taken offline was made out to a Stripe account that is not the\n * store's (AGL-4039): a stale offline kit, or a register that was tampered\n * with. The sync never captures it and records the order unpaid.\n */\nexport const COMMERCE_POS_OFFLINE_CARD_WRONG_ACCOUNT: OperatorAlertDefinition = {\n type: 'commerce.posOfflineCardWrongAccount',\n pluginId: BUNDLE_ID,\n label: 'Offline card made out to another Stripe account',\n description:\n 'A card taken offline on a register was set to pay a Stripe account that is not the store’s. The sale was recorded unpaid and the card was not captured. Check whether the account is the store’s own previous one before capturing it in Stripe, or let the authorization lapse.',\n tier: 'must',\n category: 'payments',\n title: 'A {{amount}} offline card was made out to another Stripe account',\n body:\n 'Payment {{paymentIntentId}} ({{status}}) on order {{orderId}} for site {{site}} pays account {{destination}}, but the store’s account is {{expected}}. The order is recorded unpaid and nothing was captured. If the payment already succeeded, the money is in that other account: recover or refund it in Stripe.',\n delivery: 'immediate',\n dedupeWindowMinutes: 30 * DAY,\n defaultEnabled: true,\n}\n\n/**\n * A hardware order already placed with Stripe was canceled and refunded\n * because its workspace was deleted or the account that placed it closed\n * (AGL-4038). The merchant has their money back; the platform has paid Stripe\n * for hardware that is still on its way unless someone cancels it there.\n */\nexport const COMMERCE_POS_HARDWARE_CANCELED_AFTER_ORDERING: OperatorAlertDefinition = {\n type: 'commerce.posHardwareCanceledAfterOrdering',\n pluginId: BUNDLE_ID,\n label: 'Hardware order canceled after it was placed with Stripe',\n description:\n 'A workspace was deleted, or the account that placed a hardware order was closed, after staff had placed the order with Stripe. The merchant was refunded in full. Cancel the order in the Stripe Dashboard’s Terminal hardware shop before it ships, or arrange its return with Stripe.',\n tier: 'must',\n category: 'payments',\n title: 'Cancel hardware order {{orderNumber}} with Stripe',\n // `{{stripeOrder}}` is ` (Stripe order …)` or blank, so the sentence reads\n // either way.\n body:\n 'Hardware order {{orderNumber}} ({{amount}}: {{items}}) was canceled and refunded in full to the merchant because {{reason}}, but it had already been placed with Stripe{{stripeOrder}}. Cancel it in the Stripe Dashboard’s Terminal hardware shop before it ships; if it has shipped, arrange its return with Stripe.',\n link: '/admin/hardware-orders',\n delivery: 'immediate',\n dedupeWindowMinutes: 30 * DAY,\n defaultEnabled: true,\n}\n\n/**\n * Stripe refused the refund of an unshipped hardware order while its\n * workspace or its buyer's account was closing (AGL-4038). The closure went\n * ahead, as decided, so the order may be gone from the staff page with the\n * merchant's money still held.\n */\nexport const COMMERCE_POS_HARDWARE_REFUND_FAILED: OperatorAlertDefinition = {\n type: 'commerce.posHardwareRefundFailed',\n pluginId: BUNDLE_ID,\n label: 'Hardware refund failed when a workspace or account closed',\n description:\n 'A hardware order had not shipped when its workspace was deleted or the account that placed it was closed, and Stripe refused its refund. The closure went ahead without it. Refund the payment in full in the Stripe Dashboard.',\n tier: 'must',\n category: 'payments',\n title: 'Refund hardware order {{orderNumber}} by hand: {{amount}}',\n body:\n 'Hardware order {{orderNumber}} ({{amount}}) had not shipped when {{reason}}, and Stripe refused its refund: {{error}}. The closure went ahead. Refund payment {{paymentIntentId}} in full in the Stripe Dashboard{{orderedNote}}.',\n delivery: 'immediate',\n dedupeWindowMinutes: 30 * DAY,\n defaultEnabled: true,\n}\n\n/**\n * A buyer asked to return a card reader they bought in person at the\n * platform's own store (AGL-4038), from their own purchase history. Staff\n * refund it from Staff → Hardware orders, or decline it there.\n */\nexport const COMMERCE_POS_HARDWARE_RETURN_REQUESTED: OperatorAlertDefinition = {\n type: 'commerce.posHardwareReturnRequested',\n pluginId: BUNDLE_ID,\n label: 'Card reader return requested',\n description:\n 'A workspace asked to return card reader hardware it bought in person. Arrange the return under Stripe’s hardware terms, then refund it or decline it on Staff → Hardware orders, under Return requested.',\n tier: 'should',\n category: 'payments',\n title: 'Return requested for hardware order {{orderNumber}} ({{amount}})',\n body:\n 'Workspace {{orgId}} asked to return {{items}} from hardware order {{orderNumber}} ({{amount}}), bought in person: “{{reason}}”. Refund it or decline it on Staff → Hardware orders, under Return requested.',\n link: '/admin/hardware-orders',\n delivery: 'immediate',\n dedupeWindowMinutes: 30 * DAY,\n defaultEnabled: true,\n}\n\n/**\n * A workspace's monthly 4G charge for its S710 readers did not\n * collect (AGL-4038): the card declined or asked for authentication (the\n * invoice is left open on their Billing page, which nothing retries), or\n * the workspace has no Stripe customer to bill. Stripe still bills the\n * platform for those readers' cellular service.\n */\nexport const COMMERCE_POS_CELLULAR_CHARGE_FAILED: OperatorAlertDefinition = {\n type: 'commerce.posCellularChargeFailed',\n pluginId: BUNDLE_ID,\n label: '4G charge for card readers not collected',\n description:\n 'A workspace’s monthly charge for 4G on its S710 readers did not collect. Stripe still bills the platform for those readers. Follow up with the workspace, or turn 4G off for its stores.',\n tier: 'should',\n category: 'payments',\n title: '4G charge for {{month}} not collected: {{amount}}',\n body:\n 'Workspace {{orgId}} had 4G on {{readers}} card reader(s) in {{month}}, and its charge of {{amount}} was not collected: {{reason}}. Stripe still bills the platform for those readers.',\n delivery: 'immediate',\n dedupeWindowMinutes: 30 * DAY,\n defaultEnabled: true,\n}\n\n/**\n * 4G could not be turned off at Stripe for a store that is gone (AGL-4038):\n * its workspace was deleted, or the store was, while its S710s had 4G. The\n * readers stay on the platform's Stripe account with cellular on, which\n * Stripe keeps billing the platform for, and nobody is charged for it.\n */\nexport const COMMERCE_POS_CELLULAR_TURN_OFF_FAILED: OperatorAlertDefinition = {\n type: 'commerce.posCellularTurnOffFailed',\n pluginId: BUNDLE_ID,\n label: '4G not turned off for a deleted store',\n description:\n 'A store with 4G on its S710 readers was deleted, with its workspace or on its own, and Stripe refused to turn cellular off on its Terminal configuration. Turn it off in the Stripe Dashboard, or Stripe keeps billing the platform for it.',\n tier: 'must',\n category: 'payments',\n title: 'Turn off 4G on Terminal configuration {{configurationId}}',\n body:\n 'Store {{hostId}} of workspace {{orgId}} was deleted while its card readers had 4G, and Stripe refused to turn cellular off on Terminal configuration {{configurationId}}. Turn it off in the Stripe Dashboard (Terminal → Locations), or Stripe keeps billing the platform for those readers.',\n delivery: 'immediate',\n dedupeWindowMinutes: 30 * DAY,\n defaultEnabled: true,\n}\n\n/**\n * A workspace's monthly 4G charge stayed unpaid past the grace period\n * (AGL-4038), so 4G was turned off at Stripe for every one of its stores and\n * the members who manage its billing were emailed. Paying does not turn it\n * back on; the merchant does, once it is paid.\n */\nexport const COMMERCE_POS_CELLULAR_TURNED_OFF_UNPAID: OperatorAlertDefinition = {\n type: 'commerce.posCellularTurnedOffUnpaid',\n pluginId: BUNDLE_ID,\n label: '4G turned off for an unpaid charge',\n description:\n 'A workspace’s monthly 4G charge for its S710 readers was still unpaid after the grace period, so 4G was turned off for its stores and the people who manage its billing were emailed. Follow up if the workspace asks; it turns 4G on again itself once the invoice is paid.',\n tier: 'should',\n category: 'payments',\n title: '4G turned off for workspace {{orgId}}: {{month}} unpaid ({{amount}})',\n body:\n 'Workspace {{orgId}} left its 4G charge of {{amount}} for {{month}} unpaid for {{graceDays}} days, so 4G was turned off at Stripe for its stores and the people who manage its billing were emailed. The invoice stays open on its Billing page.',\n delivery: 'immediate',\n dedupeWindowMinutes: 30 * DAY,\n defaultEnabled: true,\n}\n\n/**\n * A shopper was refused at checkout because the store's sales tax is not set\n * up (AGL-4245): no tax option was ever chosen, or the store chose Stripe Tax\n * on its own Stripe account and Stripe Tax is not on there. Raised once per\n * store until the store fixes it (`server/checkout-tax-refusal.ts`); the\n * store's managers are told too, which is the notice that matters. This one\n * is for support, so it rides the daily digest.\n */\nexport const COMMERCE_CHECKOUT_TAX_SETUP_REFUSED: OperatorAlertDefinition = {\n type: 'commerce.checkoutTaxSetupRefused',\n pluginId: BUNDLE_ID,\n label: 'Checkout refused for unfinished sales tax setup',\n description:\n 'A shopper could not check out because the store has not finished its sales tax setup: no tax option chosen, or Stripe Tax chosen but not on in the store’s own Stripe account. The store’s managers are told too, once until it is fixed.',\n tier: 'should',\n category: 'payments',\n title: 'Checkout refused on {{site}}: {{reason}}',\n body:\n 'A shopper could not check out on site {{site}} because {{reason}}. The store’s managers were told and pointed to Products → Taxes. Every checkout there is refused until it is fixed.',\n delivery: 'digest',\n dedupeWindowMinutes: 30 * DAY,\n defaultEnabled: true,\n}\n\nexport const COMMERCE_OPERATOR_ALERTS: readonly OperatorAlertDefinition[] = [\n COMMERCE_CHARGEBACK_UNROUTABLE,\n COMMERCE_TAX_NOT_REVERSED,\n COMMERCE_SELLER_SHARE_NOT_REVERSED,\n COMMERCE_FEE_REPRICE_REFUSED,\n COMMERCE_POS_HARDWARE_ORDER,\n COMMERCE_POS_OFFLINE_CARD_UNSYNCED,\n COMMERCE_POS_OFFLINE_CARD_WRONG_ACCOUNT,\n COMMERCE_POS_HARDWARE_CANCELED_AFTER_ORDERING,\n COMMERCE_POS_HARDWARE_REFUND_FAILED,\n COMMERCE_POS_HARDWARE_RETURN_REQUESTED,\n COMMERCE_POS_CELLULAR_CHARGE_FAILED,\n COMMERCE_POS_CELLULAR_TURN_OFF_FAILED,\n COMMERCE_POS_CELLULAR_TURNED_OFF_UNPAID,\n COMMERCE_CHECKOUT_TAX_SETUP_REFUSED,\n]\n"],"names":["BUNDLE_ID","DAY","COMMERCE_CHARGEBACK_UNROUTABLE","type","pluginId","label","description","tier","category","title","body","delivery","dedupeWindowMinutes","defaultEnabled","COMMERCE_TAX_NOT_REVERSED","COMMERCE_SELLER_SHARE_NOT_REVERSED","COMMERCE_FEE_REPRICE_REFUSED","COMMERCE_POS_HARDWARE_ORDER","link","COMMERCE_POS_OFFLINE_CARD_UNSYNCED","COMMERCE_POS_OFFLINE_CARD_WRONG_ACCOUNT","COMMERCE_POS_HARDWARE_CANCELED_AFTER_ORDERING","COMMERCE_POS_HARDWARE_REFUND_FAILED","COMMERCE_POS_HARDWARE_RETURN_REQUESTED","COMMERCE_POS_CELLULAR_CHARGE_FAILED","COMMERCE_POS_CELLULAR_TURN_OFF_FAILED","COMMERCE_POS_CELLULAR_TURNED_OFF_UNPAID","COMMERCE_CHECKOUT_TAX_SETUP_REFUSED","COMMERCE_OPERATOR_ALERTS"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAGD,SAASA,SAAS,QAAQ,qBAAiB;AAE3C;;;;;;;;CAQC,GACD,MAAMC,MAAM,KAAK;AAEjB,OAAO,MAAMC,iCAA0D;IACrEC,MAAM;IACNC,UAAUJ;IACVK,OAAO;IACPC,aACE;IACFC,MAAM;IACNC,UAAU;IACVC,OAAO;IACPC,MA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VC,OAAO;IACPC,MACE;IACFC,UAAU;IACVC,qBAAqB,KAAKX;IAC1BY,gBAAgB;AAClB,EAAC;AAED;;;;;;;CAOC,GACD,OAAO,MAAMc,sCAA+D;IAC1ExB,MAAM;IACNC,UAAUJ;IACVK,OAAO;IACPC,aACE;IACFC,MAAM;IACNC,UAAU;IACVC,OAAO;IACPC,MACE;IACFC,UAAU;IACVC,qBAAqB,KAAKX;IAC1BY,gBAAgB;AAClB,EAAC;AAED,OAAO,MAAMe,2BAA+D;IAC1E1B;IACAY;IACAC;IACAC;IACAC;IACAE;IACAC;IACAC;IACAC;IACAC;IACAC;IACAC;IACAC;IACAC;CACD,CAAA"}
|
|
@@ -21,6 +21,7 @@ import { registerPluginRecordIndex } from "@aglyn/aglyn/plugin-manager/plugin-re
|
|
|
21
21
|
import { registerPluginShipmentRecords } from "@aglyn/aglyn/plugin-manager/plugin-shipment-records";
|
|
22
22
|
import { registerPluginLocalDeliveryRecords } from "@aglyn/aglyn/plugin-manager/plugin-local-deliveries";
|
|
23
23
|
import { registerPluginProductCatalog } from "@aglyn/aglyn/plugin-manager/plugin-product-catalog";
|
|
24
|
+
import { registerPluginSiteSearchSource } from "@aglyn/aglyn/plugin-manager/plugin-site-search";
|
|
24
25
|
import { registerPluginStockLevels } from "@aglyn/aglyn/plugin-manager/plugin-stock-levels";
|
|
25
26
|
import { registerPluginChannelOrders } from "@aglyn/aglyn/plugin-manager/plugin-channel-orders";
|
|
26
27
|
import { registerPluginProductWriter } from "@aglyn/aglyn/plugin-manager/plugin-product-writer";
|
|
@@ -83,6 +84,11 @@ import { registerCommerceEventTriggers } from "./server/order-event-triggers.js"
|
|
|
83
84
|
registerPluginProductCatalog(lazyCatalog, {
|
|
84
85
|
pluginId: BUNDLE_ID
|
|
85
86
|
});
|
|
87
|
+
// The store's products in the site's own search page: what the storefront
|
|
88
|
+
// lists, linked to each product's page. The reads load with the first search.
|
|
89
|
+
registerPluginSiteSearchSource(lazySiteSearch, {
|
|
90
|
+
pluginId: BUNDLE_ID
|
|
91
|
+
});
|
|
86
92
|
// Counts another warehouse keeps, applied as a stock-take (AGL-3634): a
|
|
87
93
|
// fulfillment network says how many it can ship and the products say so.
|
|
88
94
|
registerPluginStockLevels(lazyStockLevels, {
|
|
@@ -127,6 +133,11 @@ const lazyLocalDeliveries = {
|
|
|
127
133
|
store: async (hostId)=>(await import("./server/product-catalog.js")).productCatalog.store(hostId),
|
|
128
134
|
page: async (request)=>(await import("./server/product-catalog.js")).productCatalog.page(request)
|
|
129
135
|
};
|
|
136
|
+
/** Site search, with the Admin SDK and the model arriving on the first search. */ const lazySiteSearch = {
|
|
137
|
+
key: 'products',
|
|
138
|
+
label: 'Products',
|
|
139
|
+
items: async (request)=>(await import("./server/site-search.js")).commerceSiteSearch.items(request)
|
|
140
|
+
};
|
|
130
141
|
function lazyIndex(name) {
|
|
131
142
|
const load = async ()=>(await import("./server/product-record-index.js"))[name];
|
|
132
143
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../libs/plugins/commerce/src/lib/declarations.server.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\n// The seam from its own module, not the plugin-manager barrel: boot needs the\n// registry and nothing else, and the barrel reaches the client contexts.\nimport { registerOperatorAlerts } from '@aglyn/aglyn/plugin-manager/operator-alerts'\nimport { registerPluginEventHandler } from '@aglyn/aglyn/plugin-manager/plugin-events'\nimport {\n registerPluginRecordIndex,\n type PluginRecordIndex,\n} from '@aglyn/aglyn/plugin-manager/plugin-record-index'\nimport {\n registerPluginShipmentRecords,\n type PluginShipmentRecords,\n} from '@aglyn/aglyn/plugin-manager/plugin-shipment-records'\nimport {\n registerPluginLocalDeliveryRecords,\n type PluginLocalDeliveryRecords,\n} from '@aglyn/aglyn/plugin-manager/plugin-local-deliveries'\nimport {\n registerPluginProductCatalog,\n type PluginProductCatalog,\n} from '@aglyn/aglyn/plugin-manager/plugin-product-catalog'\nimport {\n registerPluginStockLevels,\n type PluginStockLevels,\n} from '@aglyn/aglyn/plugin-manager/plugin-stock-levels'\nimport {\n registerPluginChannelOrders,\n type PluginChannelOrders,\n} from '@aglyn/aglyn/plugin-manager/plugin-channel-orders'\nimport {\n registerPluginProductWriter,\n type PluginProductWriter,\n} from '@aglyn/aglyn/plugin-manager/plugin-product-writer'\nimport { BUNDLE_ID } from './constants/bundle-common'\nimport { COMMERCE_OPERATOR_ALERTS } from './constants/operator-alerts'\nimport { registerCommerceEventTriggers } from './server/order-event-triggers'\n\n/**\n * The commerce plugin's server declarations: the light registrations core\n * reads at boot, before any surface loads — among them its orders as a label\n * buyer reads and writes them, through core's `core.shipment-records`.\n *\n * Its operator alerts (AGL-3377), so Staff → Operator alerts lists them and\n * staff can switch them before the first one is ever raised; and the indexes\n * of its products and categories, so another plugin reads them without\n * reaching for this plugin's collections.\n */\nexport function registerCommerceServerDeclarations(): void {\n registerOperatorAlerts(COMMERCE_OPERATOR_ALERTS, { pluginId: BUNDLE_ID })\n // Its order and return events (AGL-3611), and each as a workflow trigger.\n registerCommerceEventTriggers()\n // Products and categories, as another plugin reads them (AGL-3080). The\n // readers and the Admin SDK arrive with the first read, not with the boot.\n registerPluginRecordIndex('product', lazyIndex('productRecordIndex'), { pluginId: BUNDLE_ID })\n registerPluginRecordIndex('productCategory', lazyIndex('productCategoryRecordIndex'), {\n pluginId: BUNDLE_ID,\n })\n // Orders, as a label buyer reads and writes them (AGL-3612): read the\n // lines and the address, write a shipment, record tracking. The module and\n // the Admin SDK load with the first call.\n registerPluginShipmentRecords(lazyShipmentRecords, { pluginId: BUNDLE_ID })\n // Local deliveries, as a courier plugin reads and writes them (AGL-3695):\n // the drop's two ends, and the courier's run and the step it brings.\n registerPluginLocalDeliveryRecords(lazyLocalDeliveries, { pluginId: BUNDLE_ID })\n // A site's domains as Stripe payment method domains (AGL-3629), so Apple\n // Pay and the other wallets show on the merchant's own domain. The Stripe\n // calls arrive with the first event, not with the boot.\n registerPluginEventHandler(\n 'host.domain.attached',\n async (payload) =>\n (await import('./server/payment-method-domains')).onHostDomainAttached(payload),\n { pluginId: BUNDLE_ID },\n )\n registerPluginEventHandler(\n 'host.domain.released',\n async (payload) =>\n (await import('./server/payment-method-domains')).onHostDomainReleased(payload),\n { pluginId: BUNDLE_ID },\n )\n // A logo saved on the workspace's profile or brand reaches its stores'\n // card readers now (AGL-4048), once the save has answered; the\n // `pos-reader-splash-refresh` beat stays the backstop. The drawing and the\n // Stripe calls arrive with the first event, not with the boot.\n registerPluginEventHandler(\n 'org.logo.changed',\n async (payload) => {\n await (await import('./server/pos-reader-splash')).onOrgLogoChanged(payload)\n },\n { pluginId: BUNDLE_ID },\n )\n // The store's catalog, as a shopping-channel feed reads it (AGL-3637).\n registerPluginProductCatalog(lazyCatalog, { pluginId: BUNDLE_ID })\n // Counts another warehouse keeps, applied as a stock-take (AGL-3634): a\n // fulfillment network says how many it can ship and the products say so.\n registerPluginStockLevels(lazyStockLevels, { pluginId: BUNDLE_ID })\n // Products another plugin brings from a source of its own (AGL-3641),\n // written through the store's own rules.\n registerPluginProductWriter(lazyProductWriter, { pluginId: BUNDLE_ID })\n // Orders a marketplace sold (AGL-3638), recorded as this plugin's own:\n // numbered, their units off the same shelf in the same write, announced.\n registerPluginChannelOrders(lazyChannelOrders, { pluginId: BUNDLE_ID })\n}\n\n/** Outside orders, with the Admin SDK and the model arriving on the first call. */\nconst loadChannelOrders = async () => (await import('./server/channel-orders')).commerceChannelOrders\n\nconst lazyChannelOrders: PluginChannelOrders = {\n importOrder: async (order) => (await loadChannelOrders()).importOrder(order),\n cancelOrder: async (request) => (await loadChannelOrders()).cancelOrder(request),\n recordFees: async (request) => (await loadChannelOrders()).recordFees(request),\n}\n\n/** Stock counts, with the Admin SDK and the model arriving on the first call. */\nconst lazyStockLevels: PluginStockLevels = {\n setAvailable: async (request) => (await import('./server/stock-levels')).commerceStockLevels.setAvailable(request),\n}\n\n/** The writer, with the Admin SDK and the model arriving on the first write. */\nconst lazyProductWriter: PluginProductWriter = {\n upsertSourced: async (write) => (await import('./server/product-writer')).commerceProductWriter.upsertSourced(write),\n}\n\nconst loadShipmentRecords = async () =>\n (await import('./server/shipment-records')).commerceShipmentRecords\n\nconst lazyShipmentRecords: PluginShipmentRecords = {\n read: async (hostId, recordId) => (await loadShipmentRecords()).read(hostId, recordId),\n recordShipment: async (write) => (await loadShipmentRecords()).recordShipment(write),\n recordTracking: async (update) => (await loadShipmentRecords()).recordTracking(update),\n shipFromAddresses: async (hostId) => (await loadShipmentRecords()).shipFromAddresses(hostId),\n}\n\nconst loadLocalDeliveries = async () =>\n (await import('./server/local-delivery-records')).commerceLocalDeliveryRecords\n\nconst lazyLocalDeliveries: PluginLocalDeliveryRecords = {\n read: async (hostId, recordId) => (await loadLocalDeliveries()).read(hostId, recordId),\n recordCourier: async (write) => (await loadLocalDeliveries()).recordCourier(write),\n}\n\n/** The catalog, with the Admin SDK and the model arriving on the first read. */\nconst lazyCatalog: PluginProductCatalog = {\n store: async (hostId) => (await import('./server/product-catalog')).productCatalog.store(hostId),\n page: async (request) => (await import('./server/product-catalog')).productCatalog.page(request),\n}\n\ntype IndexName = 'productRecordIndex' | 'productCategoryRecordIndex'\n\nfunction lazyIndex(name: IndexName): PluginRecordIndex {\n const load = async () => (await import('./server/product-record-index'))[name]\n return {\n list: async (request) => (await load()).list(request),\n get: async (request) => (await load()).get(request),\n }\n}\n"],"names":["registerOperatorAlerts","registerPluginEventHandler","registerPluginRecordIndex","registerPluginShipmentRecords","registerPluginLocalDeliveryRecords","registerPluginProductCatalog","registerPluginStockLevels","registerPluginChannelOrders","registerPluginProductWriter","BUNDLE_ID","COMMERCE_OPERATOR_ALERTS","registerCommerceEventTriggers","registerCommerceServerDeclarations","pluginId","lazyIndex","lazyShipmentRecords","lazyLocalDeliveries","payload","onHostDomainAttached","onHostDomainReleased","onOrgLogoChanged","lazyCatalog","lazyStockLevels","lazyProductWriter","lazyChannelOrders","loadChannelOrders","commerceChannelOrders","importOrder","order","cancelOrder","request","recordFees","setAvailable","commerceStockLevels","upsertSourced","write","commerceProductWriter","loadShipmentRecords","commerceShipmentRecords","read","hostId","recordId","recordShipment","recordTracking","update","shipFromAddresses","loadLocalDeliveries","commerceLocalDeliveryRecords","recordCourier","store","productCatalog","page","name","load","list","get"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED,8EAA8E;AAC9E,yEAAyE;AACzE,SAASA,sBAAsB,QAAQ,8CAA6C;AACpF,SAASC,0BAA0B,QAAQ,4CAA2C;AACtF,SACEC,yBAAyB,QAEpB,kDAAiD;AACxD,SACEC,6BAA6B,QAExB,sDAAqD;AAC5D,SACEC,kCAAkC,QAE7B,sDAAqD;AAC5D,SACEC,4BAA4B,QAEvB,qDAAoD;AAC3D,SACEC,yBAAyB,QAEpB,kDAAiD;AACxD,SACEC,2BAA2B,QAEtB,oDAAmD;AAC1D,SACEC,2BAA2B,QAEtB,oDAAmD;AAC1D,SAASC,SAAS,QAAQ,+BAA2B;AACrD,SAASC,wBAAwB,QAAQ,iCAA6B;AACtE,SAASC,6BAA6B,QAAQ,mCAA+B;AAE7E;;;;;;;;;CASC,GACD,OAAO,SAASC;IACdZ,uBAAuBU,0BAA0B;QAAEG,UAAUJ;IAAU;IACvE,0EAA0E;IAC1EE;IACA,wEAAwE;IACxE,2EAA2E;IAC3ET,0BAA0B,WAAWY,UAAU,uBAAuB;QAAED,UAAUJ;IAAU;IAC5FP,0BAA0B,mBAAmBY,UAAU,+BAA+B;QACpFD,UAAUJ;IACZ;IACA,sEAAsE;IACtE,2EAA2E;IAC3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,cAAc,CAACC,IAAI,CAACrB;AAC1F;AAIA,SAAShB,UAAUsC,IAAe;IAChC,MAAMC,OAAO,UAAY,AAAC,CAAA,MAAM,MAAM,CAAC,mCAA+B,CAAE,CAACD,KAAK;IAC9E,OAAO;QACLE,MAAM,OAAOxB,UAAY,AAAC,CAAA,MAAMuB,MAAK,EAAGC,IAAI,CAACxB;QAC7CyB,KAAK,OAAOzB,UAAY,AAAC,CAAA,MAAMuB,MAAK,EAAGE,GAAG,CAACzB;IAC7C;AACF"}
|
|
1
|
+
{"version":3,"sources":["../../../../../../libs/plugins/commerce/src/lib/declarations.server.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\n// The seam from its own module, not the plugin-manager barrel: boot needs the\n// registry and nothing else, and the barrel reaches the client contexts.\nimport { registerOperatorAlerts } from '@aglyn/aglyn/plugin-manager/operator-alerts'\nimport { registerPluginEventHandler } from '@aglyn/aglyn/plugin-manager/plugin-events'\nimport {\n registerPluginRecordIndex,\n type PluginRecordIndex,\n} from '@aglyn/aglyn/plugin-manager/plugin-record-index'\nimport {\n registerPluginShipmentRecords,\n type PluginShipmentRecords,\n} from '@aglyn/aglyn/plugin-manager/plugin-shipment-records'\nimport {\n registerPluginLocalDeliveryRecords,\n type PluginLocalDeliveryRecords,\n} from '@aglyn/aglyn/plugin-manager/plugin-local-deliveries'\nimport {\n registerPluginProductCatalog,\n type PluginProductCatalog,\n} from '@aglyn/aglyn/plugin-manager/plugin-product-catalog'\nimport {\n registerPluginSiteSearchSource,\n type PluginSiteSearchSource,\n} from '@aglyn/aglyn/plugin-manager/plugin-site-search'\nimport {\n registerPluginStockLevels,\n type PluginStockLevels,\n} from '@aglyn/aglyn/plugin-manager/plugin-stock-levels'\nimport {\n registerPluginChannelOrders,\n type PluginChannelOrders,\n} from '@aglyn/aglyn/plugin-manager/plugin-channel-orders'\nimport {\n registerPluginProductWriter,\n type PluginProductWriter,\n} from '@aglyn/aglyn/plugin-manager/plugin-product-writer'\nimport { BUNDLE_ID } from './constants/bundle-common'\nimport { COMMERCE_OPERATOR_ALERTS } from './constants/operator-alerts'\nimport { registerCommerceEventTriggers } from './server/order-event-triggers'\n\n/**\n * The commerce plugin's server declarations: the light registrations core\n * reads at boot, before any surface loads — among them its orders as a label\n * buyer reads and writes them, through core's `core.shipment-records`.\n *\n * Its operator alerts (AGL-3377), so Staff → Operator alerts lists them and\n * staff can switch them before the first one is ever raised; and the indexes\n * of its products and categories, so another plugin reads them without\n * reaching for this plugin's collections.\n */\nexport function registerCommerceServerDeclarations(): void {\n registerOperatorAlerts(COMMERCE_OPERATOR_ALERTS, { pluginId: BUNDLE_ID })\n // Its order and return events (AGL-3611), and each as a workflow trigger.\n registerCommerceEventTriggers()\n // Products and categories, as another plugin reads them (AGL-3080). The\n // readers and the Admin SDK arrive with the first read, not with the boot.\n registerPluginRecordIndex('product', lazyIndex('productRecordIndex'), { pluginId: BUNDLE_ID })\n registerPluginRecordIndex('productCategory', lazyIndex('productCategoryRecordIndex'), {\n pluginId: BUNDLE_ID,\n })\n // Orders, as a label buyer reads and writes them (AGL-3612): read the\n // lines and the address, write a shipment, record tracking. The module and\n // the Admin SDK load with the first call.\n registerPluginShipmentRecords(lazyShipmentRecords, { pluginId: BUNDLE_ID })\n // Local deliveries, as a courier plugin reads and writes them (AGL-3695):\n // the drop's two ends, and the courier's run and the step it brings.\n registerPluginLocalDeliveryRecords(lazyLocalDeliveries, { pluginId: BUNDLE_ID })\n // A site's domains as Stripe payment method domains (AGL-3629), so Apple\n // Pay and the other wallets show on the merchant's own domain. The Stripe\n // calls arrive with the first event, not with the boot.\n registerPluginEventHandler(\n 'host.domain.attached',\n async (payload) =>\n (await import('./server/payment-method-domains')).onHostDomainAttached(payload),\n { pluginId: BUNDLE_ID },\n )\n registerPluginEventHandler(\n 'host.domain.released',\n async (payload) =>\n (await import('./server/payment-method-domains')).onHostDomainReleased(payload),\n { pluginId: BUNDLE_ID },\n )\n // A logo saved on the workspace's profile or brand reaches its stores'\n // card readers now (AGL-4048), once the save has answered; the\n // `pos-reader-splash-refresh` beat stays the backstop. The drawing and the\n // Stripe calls arrive with the first event, not with the boot.\n registerPluginEventHandler(\n 'org.logo.changed',\n async (payload) => {\n await (await import('./server/pos-reader-splash')).onOrgLogoChanged(payload)\n },\n { pluginId: BUNDLE_ID },\n )\n // The store's catalog, as a shopping-channel feed reads it (AGL-3637).\n registerPluginProductCatalog(lazyCatalog, { pluginId: BUNDLE_ID })\n // The store's products in the site's own search page: what the storefront\n // lists, linked to each product's page. The reads load with the first search.\n registerPluginSiteSearchSource(lazySiteSearch, { pluginId: BUNDLE_ID })\n // Counts another warehouse keeps, applied as a stock-take (AGL-3634): a\n // fulfillment network says how many it can ship and the products say so.\n registerPluginStockLevels(lazyStockLevels, { pluginId: BUNDLE_ID })\n // Products another plugin brings from a source of its own (AGL-3641),\n // written through the store's own rules.\n registerPluginProductWriter(lazyProductWriter, { pluginId: BUNDLE_ID })\n // Orders a marketplace sold (AGL-3638), recorded as this plugin's own:\n // numbered, their units off the same shelf in the same write, announced.\n registerPluginChannelOrders(lazyChannelOrders, { pluginId: BUNDLE_ID })\n}\n\n/** Outside orders, with the Admin SDK and the model arriving on the first call. */\nconst loadChannelOrders = async () => (await import('./server/channel-orders')).commerceChannelOrders\n\nconst lazyChannelOrders: PluginChannelOrders = {\n importOrder: async (order) => (await loadChannelOrders()).importOrder(order),\n cancelOrder: async (request) => (await loadChannelOrders()).cancelOrder(request),\n recordFees: async (request) => (await loadChannelOrders()).recordFees(request),\n}\n\n/** Stock counts, with the Admin SDK and the model arriving on the first call. */\nconst lazyStockLevels: PluginStockLevels = {\n setAvailable: async (request) => (await import('./server/stock-levels')).commerceStockLevels.setAvailable(request),\n}\n\n/** The writer, with the Admin SDK and the model arriving on the first write. */\nconst lazyProductWriter: PluginProductWriter = {\n upsertSourced: async (write) => (await import('./server/product-writer')).commerceProductWriter.upsertSourced(write),\n}\n\nconst loadShipmentRecords = async () =>\n (await import('./server/shipment-records')).commerceShipmentRecords\n\nconst lazyShipmentRecords: PluginShipmentRecords = {\n read: async (hostId, recordId) => (await loadShipmentRecords()).read(hostId, recordId),\n recordShipment: async (write) => (await loadShipmentRecords()).recordShipment(write),\n recordTracking: async (update) => (await loadShipmentRecords()).recordTracking(update),\n shipFromAddresses: async (hostId) => (await loadShipmentRecords()).shipFromAddresses(hostId),\n}\n\nconst loadLocalDeliveries = async () =>\n (await import('./server/local-delivery-records')).commerceLocalDeliveryRecords\n\nconst lazyLocalDeliveries: PluginLocalDeliveryRecords = {\n read: async (hostId, recordId) => (await loadLocalDeliveries()).read(hostId, recordId),\n recordCourier: async (write) => (await loadLocalDeliveries()).recordCourier(write),\n}\n\n/** The catalog, with the Admin SDK and the model arriving on the first read. */\nconst lazyCatalog: PluginProductCatalog = {\n store: async (hostId) => (await import('./server/product-catalog')).productCatalog.store(hostId),\n page: async (request) => (await import('./server/product-catalog')).productCatalog.page(request),\n}\n\n/** Site search, with the Admin SDK and the model arriving on the first search. */\nconst lazySiteSearch: PluginSiteSearchSource = {\n key: 'products',\n label: 'Products',\n items: async (request) => (await import('./server/site-search')).commerceSiteSearch.items(request),\n}\n\ntype IndexName = 'productRecordIndex' | 'productCategoryRecordIndex'\n\nfunction lazyIndex(name: IndexName): PluginRecordIndex {\n const load = async () => (await import('./server/product-record-index'))[name]\n return {\n list: async (request) => (await load()).list(request),\n get: async (request) => (await load()).get(request),\n }\n}\n"],"names":["registerOperatorAlerts","registerPluginEventHandler","registerPluginRecordIndex","registerPluginShipmentRecords","registerPluginLocalDeliveryRecords","registerPluginProductCatalog","registerPluginSiteSearchSource","registerPluginStockLevels","registerPluginChannelOrders","registerPluginProductWriter","BUNDLE_ID","COMMERCE_OPERATOR_ALERTS","registerCommerceEventTriggers","registerCommerceServerDeclarations","pluginId","lazyIndex","lazyShipmentRecords","lazyLocalDeliveries","payload","onHostDomainAttached","onHostDomainReleased","onOrgLogoChanged","lazyCatalog","lazySiteSearch","lazyStockLevels","lazyProductWriter","lazyChannelOrders","loadChannelOrders","commerceChannelOrders","importOrder","order","cancelOrder","request","recordFees","setAvailable","commerceStockLevels","upsertSourced","write","commerceProductWriter","loadShipmentRecords","commerceShipmentRecords","read","hostId","recordId","recordShipment","recordTracking","update","shipFromAddresses","loadLocalDeliveries","commerceLocalDeliveryRecords","recordCourier","store","productCatalog","page","key","label","items","commerceSiteSearch","name","load","list","get"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED,8EAA8E;AAC9E,yEAAyE;AACzE,SAASA,sBAAsB,QAAQ,8CAA6C;AACpF,SAASC,0BAA0B,QAAQ,4CAA2C;AACtF,SACEC,yBAAyB,QAEpB,kDAAiD;AACxD,SACEC,6BAA6B,QAExB,sDAAqD;AAC5D,SACEC,kCAAkC,QAE7B,sDAAqD;AAC5D,SACEC,4BAA4B,QAEvB,qDAAoD;AAC3D,SACEC,8BAA8B,QAEzB,iDAAgD;AACvD,SACEC,yBAAyB,QAEpB,kDAAiD;AACxD,SACEC,2BAA2B,QAEtB,oDAAmD;AAC1D,SACEC,2BAA2B,QAEtB,oDAAmD;AAC1D,SAASC,SAAS,QAAQ,+BAA2B;AACrD,SAASC,wBAAwB,QAAQ,iCAA6B;AACtE,SAASC,6BAA6B,QAAQ,mCAA+B;AAE7E;;;;;;;;;CASC,GACD,OAAO,SAASC;IACdb,uBAAuBW,0BAA0B;QAAEG,UAAUJ;IAAU;IACvE,0EAA0E;IAC1EE;IACA,wEAAwE;IACxE,2EAA2E;IAC3EV,0BAA0B,WAAWa,UAAU,uBAAuB;QAAED,UAAU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E,MAAMf,cAAoC;IACxC6B,OAAO,OAAOT,SAAW,AAAC,CAAA,MAAM,MAAM,CAAC,8BAA0B,EAAGU,cAAc,CAACD,KAAK,CAACT;IACzFW,MAAM,OAAOrB,UAAY,AAAC,CAAA,MAAM,MAAM,CAAC,8BAA0B,EAAGoB,cAAc,CAACC,IAAI,CAACrB;AAC1F;AAEA,gFAAgF,GAChF,MAAMT,iBAAyC;IAC7C+B,KAAK;IACLC,OAAO;IACPC,OAAO,OAAOxB,UAAY,AAAC,CAAA,MAAM,MAAM,CAAC,0BAAsB,EAAGyB,kBAAkB,CAACD,KAAK,CAACxB;AAC5F;AAIA,SAASjB,UAAU2C,IAAe;IAChC,MAAMC,OAAO,UAAY,AAAC,CAAA,MAAM,MAAM,CAAC,mCAA+B,CAAE,CAACD,KAAK;IAC9E,OAAO;QACLE,MAAM,OAAO5B,UAAY,AAAC,CAAA,MAAM2B,MAAK,EAAGC,IAAI,CAAC5B;QAC7C6B,KAAK,OAAO7B,UAAY,AAAC,CAAA,MAAM2B,MAAK,EAAGE,GAAG,CAAC7B;IAC7C;AACF"}
|
|
@@ -0,0 +1,79 @@
|
|
|
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 Stripe Tax still needs on the store's own Stripe account. */
|
|
18
|
+
export type StripeTaxSetupStep = 'head-office' | 'tax-code' | 'registration';
|
|
19
|
+
/** Stripe Dashboard → Settings → Tax: the business address and the default tax category. */
|
|
20
|
+
export declare const STRIPE_TAX_SETTINGS_DASHBOARD_URL = "https://dashboard.stripe.com/settings/tax";
|
|
21
|
+
/** Stripe Dashboard → Tax → Registrations: the places the business collects tax. */
|
|
22
|
+
export declare const STRIPE_TAX_REGISTRATIONS_DASHBOARD_URL = "https://dashboard.stripe.com/tax/registrations";
|
|
23
|
+
/** The store's own Stripe Tax, as read from its Stripe account. */
|
|
24
|
+
export interface SellerStripeTaxStatus {
|
|
25
|
+
/** Stripe answered. False when the read failed, which checkout treats as not on. */
|
|
26
|
+
readable: boolean;
|
|
27
|
+
/** Stripe's `tax/settings` status is `active`: checkout may ask Stripe Tax. */
|
|
28
|
+
active: boolean;
|
|
29
|
+
/** What keeps the status from `active`, in the order an owner does it. */
|
|
30
|
+
missing: StripeTaxSetupStep[];
|
|
31
|
+
/**
|
|
32
|
+
* Whether the account has at least one active tax registration. Null when
|
|
33
|
+
* that list could not be read. Not part of `active`: Stripe Tax turns on
|
|
34
|
+
* without one, and then adds no tax anywhere.
|
|
35
|
+
*/
|
|
36
|
+
hasRegistration: boolean | null;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Reads Stripe's `GET /v1/tax/settings` answer (and whether the account has
|
|
40
|
+
* any active registration) into the steps an owner can act on. The steps come
|
|
41
|
+
* from `status_details.pending.missing_fields` where Stripe names them, and
|
|
42
|
+
* from the settings themselves (no head office, no default tax code) where it
|
|
43
|
+
* does not, so a pending account never shows an empty list.
|
|
44
|
+
*/
|
|
45
|
+
export declare function stripeTaxStatusFromSettings(settings: unknown, hasRegistration: boolean | null): SellerStripeTaxStatus;
|
|
46
|
+
/** Why checkout is refusing every shopper because of sales tax, or null. */
|
|
47
|
+
export type CheckoutTaxBlock = 'tax-undecided' | 'stripe-tax-not-active';
|
|
48
|
+
/**
|
|
49
|
+
* The same two refusals checkout makes, from what the console can be told:
|
|
50
|
+
* the saved tax mode (null when none was ever saved), whether the store sells
|
|
51
|
+
* on its own Stripe account, and that account's Stripe Tax.
|
|
52
|
+
*/
|
|
53
|
+
export declare function checkoutTaxBlock(input: {
|
|
54
|
+
mode: string | null | undefined;
|
|
55
|
+
direct: boolean;
|
|
56
|
+
stripeTax: SellerStripeTaxStatus | null;
|
|
57
|
+
}): CheckoutTaxBlock | null;
|
|
58
|
+
/** What `GET /api/commerce/tax-readiness` answers. */
|
|
59
|
+
export interface StoreTaxReadiness {
|
|
60
|
+
/** The saved tax mode; null when none was ever saved. */
|
|
61
|
+
mode: 'manual' | 'stripe' | 'none' | null;
|
|
62
|
+
/** The store takes payments on its own Stripe account (direct charges). */
|
|
63
|
+
direct: boolean;
|
|
64
|
+
/** That account's Stripe Tax; null when the store is not on its own account. */
|
|
65
|
+
stripeTax: SellerStripeTaxStatus | null;
|
|
66
|
+
/** Whether checkout is refusing every shopper because of sales tax. */
|
|
67
|
+
blocked: CheckoutTaxBlock | null;
|
|
68
|
+
/** When a shopper was last refused for that reason, if one was. */
|
|
69
|
+
refusedAtMs: number | null;
|
|
70
|
+
}
|
|
71
|
+
/** One step of the Stripe Tax setup, as the Taxes card lists it. */
|
|
72
|
+
export declare const STRIPE_TAX_STEP_TEXT: Readonly<Record<StripeTaxSetupStep, string>>;
|
|
73
|
+
/** Where in the Stripe Dashboard one step is done. */
|
|
74
|
+
export declare function stripeTaxStepHref(step: StripeTaxSetupStep): string;
|
|
75
|
+
/** What the owner is told when a shopper was refused, by reason. */
|
|
76
|
+
export declare function checkoutTaxRefusalNotice(reason: CheckoutTaxBlock): {
|
|
77
|
+
title: string;
|
|
78
|
+
body: string;
|
|
79
|
+
};
|
|
@@ -0,0 +1,99 @@
|
|
|
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
|
+
* WHETHER SALES TAX LETS SHOPPERS CHECK OUT (AGL-4245)
|
|
18
|
+
*
|
|
19
|
+
* Two tax states refuse every storefront checkout, and the owner was told of
|
|
20
|
+
* neither: a store that never chose how it handles sales tax
|
|
21
|
+
* (`storefrontTaxDecision` → `undecided`), and a store on its own Stripe
|
|
22
|
+
* account (direct charges) that chose Stripe Tax while Stripe Tax is not on
|
|
23
|
+
* in that account (`sellerStripeTaxActive`). The console's Taxes and
|
|
24
|
+
* Payments cards, and the route that answers them
|
|
25
|
+
* (`server/tax-readiness.ts`), read the same answer from here.
|
|
26
|
+
*=========================================*/ /** What Stripe Tax still needs on the store's own Stripe account. */ /** Stripe Dashboard → Settings → Tax: the business address and the default tax category. */ export const STRIPE_TAX_SETTINGS_DASHBOARD_URL = 'https://dashboard.stripe.com/settings/tax';
|
|
27
|
+
/** Stripe Dashboard → Tax → Registrations: the places the business collects tax. */ export const STRIPE_TAX_REGISTRATIONS_DASHBOARD_URL = 'https://dashboard.stripe.com/tax/registrations';
|
|
28
|
+
const STEP_ORDER = [
|
|
29
|
+
'head-office',
|
|
30
|
+
'tax-code',
|
|
31
|
+
'registration'
|
|
32
|
+
];
|
|
33
|
+
/**
|
|
34
|
+
* Reads Stripe's `GET /v1/tax/settings` answer (and whether the account has
|
|
35
|
+
* any active registration) into the steps an owner can act on. The steps come
|
|
36
|
+
* from `status_details.pending.missing_fields` where Stripe names them, and
|
|
37
|
+
* from the settings themselves (no head office, no default tax code) where it
|
|
38
|
+
* does not, so a pending account never shows an empty list.
|
|
39
|
+
*/ export function stripeTaxStatusFromSettings(settings, hasRegistration) {
|
|
40
|
+
if (!settings || typeof settings !== 'object') {
|
|
41
|
+
return {
|
|
42
|
+
readable: false,
|
|
43
|
+
active: false,
|
|
44
|
+
missing: [],
|
|
45
|
+
hasRegistration
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
const read = settings;
|
|
49
|
+
const active = read.status === 'active';
|
|
50
|
+
const missing = new Set();
|
|
51
|
+
if (!active) {
|
|
52
|
+
var _read_status_details_pending, _read_status_details, _read_defaults;
|
|
53
|
+
const named = (_read_status_details = read.status_details) == null ? void 0 : (_read_status_details_pending = _read_status_details.pending) == null ? void 0 : _read_status_details_pending.missing_fields;
|
|
54
|
+
for (const field of Array.isArray(named) ? named : []){
|
|
55
|
+
const text = String(field);
|
|
56
|
+
if (text.startsWith('head_office')) missing.add('head-office');
|
|
57
|
+
else if (text.includes('tax_code')) missing.add('tax-code');
|
|
58
|
+
}
|
|
59
|
+
if (!read.head_office || !read.head_office.address) missing.add('head-office');
|
|
60
|
+
if (!((_read_defaults = read.defaults) == null ? void 0 : _read_defaults.tax_code)) missing.add('tax-code');
|
|
61
|
+
if (hasRegistration === false) missing.add('registration');
|
|
62
|
+
}
|
|
63
|
+
return {
|
|
64
|
+
readable: true,
|
|
65
|
+
active,
|
|
66
|
+
missing: STEP_ORDER.filter((step)=>missing.has(step)),
|
|
67
|
+
hasRegistration
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* The same two refusals checkout makes, from what the console can be told:
|
|
72
|
+
* the saved tax mode (null when none was ever saved), whether the store sells
|
|
73
|
+
* on its own Stripe account, and that account's Stripe Tax.
|
|
74
|
+
*/ export function checkoutTaxBlock(input) {
|
|
75
|
+
var _input_stripeTax;
|
|
76
|
+
const mode = input.mode;
|
|
77
|
+
if (mode !== 'manual' && mode !== 'stripe' && mode !== 'none') return 'tax-undecided';
|
|
78
|
+
if (mode === 'stripe' && input.direct && !((_input_stripeTax = input.stripeTax) == null ? void 0 : _input_stripeTax.active)) return 'stripe-tax-not-active';
|
|
79
|
+
return null;
|
|
80
|
+
}
|
|
81
|
+
/** One step of the Stripe Tax setup, as the Taxes card lists it. */ export const STRIPE_TAX_STEP_TEXT = {
|
|
82
|
+
'head-office': 'Add your business address in Stripe Tax.',
|
|
83
|
+
'tax-code': 'Pick a default product tax category in Stripe Tax.',
|
|
84
|
+
registration: 'Add at least one place you collect tax.'
|
|
85
|
+
};
|
|
86
|
+
/** Where in the Stripe Dashboard one step is done. */ export function stripeTaxStepHref(step) {
|
|
87
|
+
return step === 'registration' ? STRIPE_TAX_REGISTRATIONS_DASHBOARD_URL : STRIPE_TAX_SETTINGS_DASHBOARD_URL;
|
|
88
|
+
}
|
|
89
|
+
/** What the owner is told when a shopper was refused, by reason. */ export function checkoutTaxRefusalNotice(reason) {
|
|
90
|
+
return reason === 'tax-undecided' ? {
|
|
91
|
+
title: 'A shopper couldn’t check out on {site}',
|
|
92
|
+
body: 'Checkout on {site} is off because the store hasn’t chosen how it handles sales tax. ' + 'Choose an option in Products → Taxes and save, and shoppers can check out again.'
|
|
93
|
+
} : {
|
|
94
|
+
title: 'A shopper couldn’t check out on {site}',
|
|
95
|
+
body: 'Checkout on {site} is off because the store uses Stripe Tax, and Stripe Tax isn’t on in your ' + 'Stripe account yet. Open Products → Taxes to see what’s left, or pick another tax option there.'
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
//# sourceMappingURL=commerce-tax-readiness.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../libs/plugins/commerce/src/lib/model/commerce-tax-readiness.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\n/*==========================================\n * WHETHER SALES TAX LETS SHOPPERS CHECK OUT (AGL-4245)\n *\n * Two tax states refuse every storefront checkout, and the owner was told of\n * neither: a store that never chose how it handles sales tax\n * (`storefrontTaxDecision` → `undecided`), and a store on its own Stripe\n * account (direct charges) that chose Stripe Tax while Stripe Tax is not on\n * in that account (`sellerStripeTaxActive`). The console's Taxes and\n * Payments cards, and the route that answers them\n * (`server/tax-readiness.ts`), read the same answer from here.\n *=========================================*/\n\n/** What Stripe Tax still needs on the store's own Stripe account. */\nexport type StripeTaxSetupStep = 'head-office' | 'tax-code' | 'registration'\n\n/** Stripe Dashboard → Settings → Tax: the business address and the default tax category. */\nexport const STRIPE_TAX_SETTINGS_DASHBOARD_URL = 'https://dashboard.stripe.com/settings/tax'\n/** Stripe Dashboard → Tax → Registrations: the places the business collects tax. */\nexport const STRIPE_TAX_REGISTRATIONS_DASHBOARD_URL = 'https://dashboard.stripe.com/tax/registrations'\n\n/** The store's own Stripe Tax, as read from its Stripe account. */\nexport interface SellerStripeTaxStatus {\n /** Stripe answered. False when the read failed, which checkout treats as not on. */\n readable: boolean\n /** Stripe's `tax/settings` status is `active`: checkout may ask Stripe Tax. */\n active: boolean\n /** What keeps the status from `active`, in the order an owner does it. */\n missing: StripeTaxSetupStep[]\n /**\n * Whether the account has at least one active tax registration. Null when\n * that list could not be read. Not part of `active`: Stripe Tax turns on\n * without one, and then adds no tax anywhere.\n */\n hasRegistration: boolean | null\n}\n\nconst STEP_ORDER: readonly StripeTaxSetupStep[] = ['head-office', 'tax-code', 'registration']\n\n/**\n * Reads Stripe's `GET /v1/tax/settings` answer (and whether the account has\n * any active registration) into the steps an owner can act on. The steps come\n * from `status_details.pending.missing_fields` where Stripe names them, and\n * from the settings themselves (no head office, no default tax code) where it\n * does not, so a pending account never shows an empty list.\n */\nexport function stripeTaxStatusFromSettings(\n settings: unknown,\n hasRegistration: boolean | null,\n): SellerStripeTaxStatus {\n if (!settings || typeof settings !== 'object') {\n return { readable: false, active: false, missing: [], hasRegistration }\n }\n const read = settings as {\n status?: unknown\n head_office?: { address?: unknown } | null\n defaults?: { tax_code?: unknown } | null\n status_details?: { pending?: { missing_fields?: unknown } | null } | null\n }\n const active = read.status === 'active'\n const missing = new Set<StripeTaxSetupStep>()\n if (!active) {\n const named = read.status_details?.pending?.missing_fields\n for (const field of Array.isArray(named) ? named : []) {\n const text = String(field)\n if (text.startsWith('head_office')) missing.add('head-office')\n else if (text.includes('tax_code')) missing.add('tax-code')\n }\n if (!read.head_office || !read.head_office.address) missing.add('head-office')\n if (!read.defaults?.tax_code) missing.add('tax-code')\n if (hasRegistration === false) missing.add('registration')\n }\n return {\n readable: true,\n active,\n missing: STEP_ORDER.filter((step) => missing.has(step)),\n hasRegistration,\n }\n}\n\n/** Why checkout is refusing every shopper because of sales tax, or null. */\nexport type CheckoutTaxBlock = 'tax-undecided' | 'stripe-tax-not-active'\n\n/**\n * The same two refusals checkout makes, from what the console can be told:\n * the saved tax mode (null when none was ever saved), whether the store sells\n * on its own Stripe account, and that account's Stripe Tax.\n */\nexport function checkoutTaxBlock(input: {\n mode: string | null | undefined\n direct: boolean\n stripeTax: SellerStripeTaxStatus | null\n}): CheckoutTaxBlock | null {\n const mode = input.mode\n if (mode !== 'manual' && mode !== 'stripe' && mode !== 'none') return 'tax-undecided'\n if (mode === 'stripe' && input.direct && !input.stripeTax?.active) return 'stripe-tax-not-active'\n return null\n}\n\n/** What `GET /api/commerce/tax-readiness` answers. */\nexport interface StoreTaxReadiness {\n /** The saved tax mode; null when none was ever saved. */\n mode: 'manual' | 'stripe' | 'none' | null\n /** The store takes payments on its own Stripe account (direct charges). */\n direct: boolean\n /** That account's Stripe Tax; null when the store is not on its own account. */\n stripeTax: SellerStripeTaxStatus | null\n /** Whether checkout is refusing every shopper because of sales tax. */\n blocked: CheckoutTaxBlock | null\n /** When a shopper was last refused for that reason, if one was. */\n refusedAtMs: number | null\n}\n\n/** One step of the Stripe Tax setup, as the Taxes card lists it. */\nexport const STRIPE_TAX_STEP_TEXT: Readonly<Record<StripeTaxSetupStep, string>> = {\n 'head-office': 'Add your business address in Stripe Tax.',\n 'tax-code': 'Pick a default product tax category in Stripe Tax.',\n registration: 'Add at least one place you collect tax.',\n}\n\n/** Where in the Stripe Dashboard one step is done. */\nexport function stripeTaxStepHref(step: StripeTaxSetupStep): string {\n return step === 'registration'\n ? STRIPE_TAX_REGISTRATIONS_DASHBOARD_URL\n : STRIPE_TAX_SETTINGS_DASHBOARD_URL\n}\n\n/** What the owner is told when a shopper was refused, by reason. */\nexport function checkoutTaxRefusalNotice(reason: CheckoutTaxBlock): { title: string; body: string } {\n return reason === 'tax-undecided'\n ? {\n title: 'A shopper couldn’t check out on {site}',\n body:\n 'Checkout on {site} is off because the store hasn’t chosen how it handles sales tax. ' +\n 'Choose an option in Products → Taxes and save, and shoppers can check out again.',\n }\n : {\n title: 'A shopper couldn’t check out on {site}',\n body:\n 'Checkout on {site} is off because the store uses Stripe Tax, and Stripe Tax isn’t on in your ' +\n 'Stripe account yet. Open Products → Taxes to see what’s left, or pick another tax option there.',\n }\n}\n"],"names":["STRIPE_TAX_SETTINGS_DASHBOARD_URL","STRIPE_TAX_REGISTRATIONS_DASHBOARD_URL","STEP_ORDER","stripeTaxStatusFromSettings","settings","hasRegistration","readable","active","missing","read","status","Set","named","status_details","pending","missing_fields","field","Array","isArray","text","String","startsWith","add","includes","head_office","address","defaults","tax_code","filter","step","has","checkoutTaxBlock","input","mode","direct","stripeTax","STRIPE_TAX_STEP_TEXT","registration","stripeTaxStepHref","checkoutTaxRefusalNotice","reason","title","body"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;;;;;;;;2CAU2C,GAE3C,mEAAmE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AF1C,MAAMC,OAAOD,MAAMC,IAAI;IACvB,IAAIA,SAAS,YAAYA,SAAS,YAAYA,SAAS,QAAQ,OAAO;IACtE,IAAIA,SAAS,YAAYD,MAAME,MAAM,IAAI,GAACF,mBAAAA,MAAMG,SAAS,qBAAfH,iBAAiBzB,MAAM,GAAE,OAAO;IAC1E,OAAO;AACT;AAgBA,kEAAkE,GAClE,OAAO,MAAM6B,uBAAqE;IAChF,eAAe;IACf,YAAY;IACZC,cAAc;AAChB,EAAC;AAED,oDAAoD,GACpD,OAAO,SAASC,kBAAkBT,IAAwB;IACxD,OAAOA,SAAS,iBACZ5B,yCACAD;AACN;AAEA,kEAAkE,GAClE,OAAO,SAASuC,yBAAyBC,MAAwB;IAC/D,OAAOA,WAAW,kBACd;QACEC,OAAO;QACPC,MACE,yFACA;IACJ,IACA;QACED,OAAO;QACPC,MACE,kGACA;IACJ;AACN"}
|
|
@@ -601,6 +601,13 @@ export declare function proposedProductPriceUsd(suggested: unknown): number;
|
|
|
601
601
|
export declare function findVariant(product: Pick<HostProduct, 'variants'>, selections: Record<string, string>): ProductVariant | undefined;
|
|
602
602
|
/** [min, max] price across variants; [0, 0] when there are none. */
|
|
603
603
|
export declare function productPriceRange(product: Pick<HostProduct, 'variants'>): [number, number];
|
|
604
|
+
/**
|
|
605
|
+
* What a product's price says to a shopper: the price, "From" the lowest
|
|
606
|
+
* where variants differ, or "Price coming soon" for a product listed before
|
|
607
|
+
* any variant has one (AGL-3676) — never "$0". `{{product.price}}` on the
|
|
608
|
+
* product page, and the caption on a site search result.
|
|
609
|
+
*/
|
|
610
|
+
export declare function productPriceText(product: Pick<HostProduct, 'variants'>, minPrice: number, maxPrice: number): string;
|
|
604
611
|
/** Sum of tracked inventory; null when every variant is untracked. */
|
|
605
612
|
export declare function productInventory(product: Pick<HostProduct, 'variants'>): number | null;
|
|
606
613
|
/**
|
|
@@ -31,10 +31,11 @@ import { draftProductChannelFacts } from "./product-channel.js";
|
|
|
31
31
|
* (AGL-2295).
|
|
32
32
|
*
|
|
33
33
|
* `COMMERCE_PLATFORM_FEE_PERCENT = 2` lived here with ZERO call sites. It
|
|
34
|
-
* asserted a flat 2% that
|
|
35
|
-
* (Starter, physical) and
|
|
36
|
-
*
|
|
37
|
-
* Starter
|
|
34
|
+
* asserted a flat 2% that agreed with the plan table of the time for exactly
|
|
35
|
+
* one cell (Starter, physical) and disagreed with the other fifteen — Starter
|
|
36
|
+
* digital was 5%, Pro digital 3%, Business 2%, Scale 1%, and every physical
|
|
37
|
+
* rate above Starter 0%. (The ladder has moved since; the table is the
|
|
38
|
+
* answer, which is the point.) Nothing was wrong while nothing read it; the cost was that
|
|
38
39
|
* the next reader wiring it up would silently re-price every plan, and a
|
|
39
40
|
* constant sitting in the model beside the types reads like the answer.
|
|
40
41
|
*
|
|
@@ -568,6 +569,18 @@ export const COMMERCE_SLUG_MAX_LENGTH = 80;
|
|
|
568
569
|
Math.max(...prices)
|
|
569
570
|
];
|
|
570
571
|
}
|
|
572
|
+
/**
|
|
573
|
+
* What a product's price says to a shopper: the price, "From" the lowest
|
|
574
|
+
* where variants differ, or "Price coming soon" for a product listed before
|
|
575
|
+
* any variant has one (AGL-3676) — never "$0". `{{product.price}}` on the
|
|
576
|
+
* product page, and the caption on a site search result.
|
|
577
|
+
*/ export function productPriceText(product, minPrice, maxPrice) {
|
|
578
|
+
var _product_variants;
|
|
579
|
+
if (!((_product_variants = product.variants) != null ? _product_variants : []).some((variant)=>variantHasPrice(variant))) {
|
|
580
|
+
return 'Price coming soon';
|
|
581
|
+
}
|
|
582
|
+
return minPrice === maxPrice ? `$${minPrice}` : `From $${minPrice}`;
|
|
583
|
+
}
|
|
571
584
|
/** Sum of tracked inventory; null when every variant is untracked. */ export function productInventory(product) {
|
|
572
585
|
var _product_variants;
|
|
573
586
|
let total = null;
|