platform-types 1.10.689 → 1.10.691
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/dist/cjs/order.js +27 -4
- package/dist/cjs/storefrontWebLiteralKeys.js +21 -1
- package/dist/order.d.ts +28 -5
- package/dist/order.js +27 -4
- package/dist/store.d.ts +10 -2
- package/dist/storefrontWebLiteralKeys.d.ts +7 -0
- package/dist/storefrontWebLiteralKeys.js +19 -0
- package/package.json +1 -1
package/dist/cjs/order.js
CHANGED
|
@@ -344,10 +344,28 @@ exports.orderFulfilmentProgress = orderFulfilmentProgress;
|
|
|
344
344
|
* `data.shiftId`. Logged; reconcile the queued sale by hand.
|
|
345
345
|
* - `ORDER_CURRENCY_NOT_SUBSCRIBED` · 400 — the sale's currency has no
|
|
346
346
|
* subscription in the store's `currencies`. Logged.
|
|
347
|
-
* - `PAYMENT_METHODS_NOT_CONFIGURED` · 409 — `tenders` sent
|
|
348
|
-
* has no payment methods at
|
|
349
|
-
*
|
|
350
|
-
*
|
|
347
|
+
* - `PAYMENT_METHODS_NOT_CONFIGURED` · 409 — `tenders` sent, or storefront/
|
|
348
|
+
* WhatsApp checkout attempted, while the store has no payment methods at
|
|
349
|
+
* all. Storefront checkout carries `data: {}` and refuses before the cart read.
|
|
350
|
+
* - `PAYMENT_METHOD_NOT_FOUND` · 400 — a tender leg's `method`, or storefront
|
|
351
|
+
* checkout's `paymentMethod`, names none of the store's payment methods.
|
|
352
|
+
* Storefront checkout carries `data: {}` and refuses before the cart read.
|
|
353
|
+
*
|
|
354
|
+
* Storefront and WhatsApp checkout business refusals. None allocates an order
|
|
355
|
+
* id, redeems a coupon or writes an order; none is logged as an error:
|
|
356
|
+
* - `DELIVERY_METHOD_NOT_FOUND` · 400 — `deliveryMethod` is not in the store's
|
|
357
|
+
* delivery catalogue, including an absent/empty catalogue. `data: {}`;
|
|
358
|
+
* refused before reading the cart.
|
|
359
|
+
* - `ORDER_INVALID_CART` · 400 — the normalized cart has no finite numeric
|
|
360
|
+
* `totals.grandTotal`. `data: {}`; refused before repricing/allocation.
|
|
361
|
+
* - `ORDER_BELOW_MINIMUM_PURCHASE` · 400 — after repricing has confirmed the
|
|
362
|
+
* cart, its grand total is below a finite positive `Number(customer.minBuy)`.
|
|
363
|
+
* Equality passes. `data: OrderBelowMinimumPurchaseData` carries minBuy,
|
|
364
|
+
* grandTotal and the cart display currency, with no currency conversion.
|
|
365
|
+
* - `EMAIL_VERIFICATION_REQUIRED` · 403 — the store requires email verification
|
|
366
|
+
* and the live customer has not verified. No data payload; before cart read.
|
|
367
|
+
* - `ACCOUNT_DISABLED` · 403 — the live customer is disabled. No data payload;
|
|
368
|
+
* before cart read. This is distinct from the staff `CUSTOMER_DISABLED` code.
|
|
351
369
|
*
|
|
352
370
|
* Commit-time drawer refusals, on a create whose cash tender books into a
|
|
353
371
|
* drawer shift. No order committed, but a coupon redeemed before the commit
|
|
@@ -552,6 +570,11 @@ exports.ORDER_ERROR_CODES = [
|
|
|
552
570
|
'ORDER_CURRENCY_NOT_SUBSCRIBED',
|
|
553
571
|
'PAYMENT_METHODS_NOT_CONFIGURED',
|
|
554
572
|
'PAYMENT_METHOD_NOT_FOUND',
|
|
573
|
+
'DELIVERY_METHOD_NOT_FOUND',
|
|
574
|
+
'ORDER_BELOW_MINIMUM_PURCHASE',
|
|
575
|
+
'ORDER_INVALID_CART',
|
|
576
|
+
'EMAIL_VERIFICATION_REQUIRED',
|
|
577
|
+
'ACCOUNT_DISABLED',
|
|
555
578
|
// Commit-time drawer refusals; `CURRENCY_MISMATCH` carries its fields at the body's top level.
|
|
556
579
|
'CURRENCY_MISMATCH',
|
|
557
580
|
'SHIFT_NOT_OPEN',
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isStorefrontLiteralKey = exports.STOREFRONT_WEB_LITERAL_KEYS = void 0;
|
|
3
|
+
exports.isAllowedStorefrontLiteralValue = exports.isStorefrontLiteralKey = exports.STOREFRONT_WEB_LITERAL_KEYS = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* Every storefront `WEB` literal key a shop may override, in code-unit order.
|
|
6
6
|
*
|
|
@@ -1113,3 +1113,23 @@ const STOREFRONT_WEB_LITERAL_KEY_SET = new Set(exports.STOREFRONT_WEB_LITERAL_KE
|
|
|
1113
1113
|
/** Whether a shop may override `key` — membership in {@link STOREFRONT_WEB_LITERAL_KEYS}. */
|
|
1114
1114
|
const isStorefrontLiteralKey = (key) => STOREFRONT_WEB_LITERAL_KEY_SET.has(key);
|
|
1115
1115
|
exports.isStorefrontLiteralKey = isStorefrontLiteralKey;
|
|
1116
|
+
/** Keys whose value is a storefront route the storefront renders as a link target. */
|
|
1117
|
+
const STOREFRONT_NAVIGATE_LITERAL_PREFIX = 'NAVIGATE_';
|
|
1118
|
+
/**
|
|
1119
|
+
* A same-origin path: a leading `/`, a second character that is neither `/` nor `\`
|
|
1120
|
+
* (`//host` and `/\host` are protocol-relative to a browser), and no whitespace or
|
|
1121
|
+
* backslash anywhere — a browser strips tab and newline before parsing, so `/\t/host`
|
|
1122
|
+
* becomes `//host`. A value with a scheme cannot start with `/`.
|
|
1123
|
+
*
|
|
1124
|
+
* The storefront is to apply this identical pattern in `src/app/slices/literals.ts`
|
|
1125
|
+
* `resolveLayer` (its change is pending there); keep the two the same.
|
|
1126
|
+
*/
|
|
1127
|
+
const STOREFRONT_SAME_ORIGIN_PATH_RE = /^\/(?![/\\])[^\s\\]*$/;
|
|
1128
|
+
/**
|
|
1129
|
+
* Whether `value` may be stored, published or served for `key`. A `NAVIGATE_*` key is
|
|
1130
|
+
* rendered as a link, so it must be a same-origin path — otherwise an override could
|
|
1131
|
+
* send a shop's customers to an off-site look-alike login page. Every other key is
|
|
1132
|
+
* unconstrained here (key membership, well-formedness and length are checked apart).
|
|
1133
|
+
*/
|
|
1134
|
+
const isAllowedStorefrontLiteralValue = (key, value) => !key.startsWith(STOREFRONT_NAVIGATE_LITERAL_PREFIX) || STOREFRONT_SAME_ORIGIN_PATH_RE.test(value);
|
|
1135
|
+
exports.isAllowedStorefrontLiteralValue = isAllowedStorefrontLiteralValue;
|
package/dist/order.d.ts
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import type { MoneyOutAttribution } from './terminal.ts';
|
|
2
2
|
declare global {
|
|
3
|
+
interface OrderBelowMinimumPurchaseData {
|
|
4
|
+
minBuy: number;
|
|
5
|
+
grandTotal: number;
|
|
6
|
+
currency: string;
|
|
7
|
+
}
|
|
3
8
|
/**
|
|
4
9
|
* A coupon as it was redeemed onto an order — the grant frozen at
|
|
5
10
|
* consumption, plus the money it actually took.
|
|
@@ -2576,10 +2581,28 @@ export declare const orderFulfilmentProgress: (order: OrderFulfilmentProgressInp
|
|
|
2576
2581
|
* `data.shiftId`. Logged; reconcile the queued sale by hand.
|
|
2577
2582
|
* - `ORDER_CURRENCY_NOT_SUBSCRIBED` · 400 — the sale's currency has no
|
|
2578
2583
|
* subscription in the store's `currencies`. Logged.
|
|
2579
|
-
* - `PAYMENT_METHODS_NOT_CONFIGURED` · 409 — `tenders` sent
|
|
2580
|
-
* has no payment methods at
|
|
2581
|
-
*
|
|
2582
|
-
*
|
|
2584
|
+
* - `PAYMENT_METHODS_NOT_CONFIGURED` · 409 — `tenders` sent, or storefront/
|
|
2585
|
+
* WhatsApp checkout attempted, while the store has no payment methods at
|
|
2586
|
+
* all. Storefront checkout carries `data: {}` and refuses before the cart read.
|
|
2587
|
+
* - `PAYMENT_METHOD_NOT_FOUND` · 400 — a tender leg's `method`, or storefront
|
|
2588
|
+
* checkout's `paymentMethod`, names none of the store's payment methods.
|
|
2589
|
+
* Storefront checkout carries `data: {}` and refuses before the cart read.
|
|
2590
|
+
*
|
|
2591
|
+
* Storefront and WhatsApp checkout business refusals. None allocates an order
|
|
2592
|
+
* id, redeems a coupon or writes an order; none is logged as an error:
|
|
2593
|
+
* - `DELIVERY_METHOD_NOT_FOUND` · 400 — `deliveryMethod` is not in the store's
|
|
2594
|
+
* delivery catalogue, including an absent/empty catalogue. `data: {}`;
|
|
2595
|
+
* refused before reading the cart.
|
|
2596
|
+
* - `ORDER_INVALID_CART` · 400 — the normalized cart has no finite numeric
|
|
2597
|
+
* `totals.grandTotal`. `data: {}`; refused before repricing/allocation.
|
|
2598
|
+
* - `ORDER_BELOW_MINIMUM_PURCHASE` · 400 — after repricing has confirmed the
|
|
2599
|
+
* cart, its grand total is below a finite positive `Number(customer.minBuy)`.
|
|
2600
|
+
* Equality passes. `data: OrderBelowMinimumPurchaseData` carries minBuy,
|
|
2601
|
+
* grandTotal and the cart display currency, with no currency conversion.
|
|
2602
|
+
* - `EMAIL_VERIFICATION_REQUIRED` · 403 — the store requires email verification
|
|
2603
|
+
* and the live customer has not verified. No data payload; before cart read.
|
|
2604
|
+
* - `ACCOUNT_DISABLED` · 403 — the live customer is disabled. No data payload;
|
|
2605
|
+
* before cart read. This is distinct from the staff `CUSTOMER_DISABLED` code.
|
|
2583
2606
|
*
|
|
2584
2607
|
* Commit-time drawer refusals, on a create whose cash tender books into a
|
|
2585
2608
|
* drawer shift. No order committed, but a coupon redeemed before the commit
|
|
@@ -2677,6 +2700,6 @@ export declare const orderFulfilmentProgress: (order: OrderFulfilmentProgressInp
|
|
|
2677
2700
|
* `SUBSCRIPTION_READONLY`) sit on the order CREATE leg only: an edit is not a new
|
|
2678
2701
|
* order, so `bareOrderPostHandler` routes past `requireMetered` entirely.
|
|
2679
2702
|
*/
|
|
2680
|
-
export declare const ORDER_ERROR_CODES: readonly ["ORDER_COST_DENOMINATION_UNKNOWN", "SERVICE_ORDER_DELIVERY_MANAGED", "ORDER_NOT_FOUND", "ORDER_LOCKED", "ORDER_NOT_READY", "ORDER_DELIVERED_ANOTHER_DAY", "ORDER_DELIVERY_STATE_UNCHANGED", "ORDER_ILLEGAL_TRANSITION", "ORDER_VERSION_CONFLICT", "CUSTOMER_NOT_FOUND", "CUSTOMER_MERGED", "ORDER_HAS_NO_CUSTOMER", "CUSTOMER_ANONYMIZED", "FX_CONVERSION_UNAVAILABLE", "ROLE_FORBIDDEN", "ORDER_CANCELLED", "PAYMENT_SETTLED_ON_ANOTHER_ORDER", "ORDER_HAS_SHIPMENTS", "ORDER_HAS_RETURNS", "SHIPMENT_QUANTITY_EXCEEDED", "SHIPMENT_LINE_MISMATCH", "SHIPMENT_NOT_FOUND", "SHIPMENT_LIMIT_REACHED", "SHIPMENT_TOO_LARGE", "ORDER_FULFILMENT_EXTERNAL", "SHIPMENT_FAILED", "ADMIN_REQUIRED", "IDEMPOTENCY_KEY_REQUIRED", "INVALID_IDEMPOTENCY_KEY", "IDEMPOTENCY_KEY_REUSE", "IDEMPOTENCY_IN_PROGRESS", "IDEMPOTENCY_LOCK_CONTENTION", "IDEMPOTENCY_KEY_FAILED", "IDEMPOTENT_RESPONSE_NOT_CACHED", "ORDER_CANCELLATION_NOT_PROTECTED", "ORDER_CANCELLATION_COMMITTED", "ORDER_CANCELLATION_LOCKED", "ORDER_CANCELLATION_TOO_LARGE", "ORDER_CANCELLATION_FAILED", "SALE_LEDGER_RETRACTION_REFUSED", "SALE_LEDGER_ROW_NOT_OWNED", "PRODUCT_NOT_FOUND", "PRODUCT_SALE_LIMIT_EXCEEDED", "PRODUCT_SALE_LIMIT_INVALID", "DEPOSIT_SOURCE_NOT_ALLOWED", "DEPOSIT_CURRENCY_MISMATCH", "DEPOSIT_EXCEEDS_TOTAL", "DEPOSIT_FREEZE_REQUIRES_INVOICE", "DEPOSIT_FREEZE_INVOICE_PENDING", "DEPOSIT_CHARACTERIZATION_CONFLICT", "DEPOSIT_FREEZE_INVOICE_NOT_QUALIFYING", "DEPOSIT_INVOICED_ORDER_MUST_FREEZE", "DEPOSIT_REFERENCE_IS_LINKED_PAYMENT", "DEPOSIT_DUPLICATE_REFERENCE", "PAYMENT_REFERENCED_BY_DEPOSIT", "ORDER_HAS_UNREFUNDED_DEPOSIT", "DEPOSIT_NOT_FOUND", "DEPOSIT_ALREADY_REFUNDED", "UNIT_QUANTITY_NOT_WHOLE", "UNIT_REVISION_STALE", "UNIT_QUANTITY_UNREPRESENTABLE", "KIT_RECIPE_CHANGED", "CART_PROMOTION_UNAVAILABLE", "ORDER_HAS_KIT_LINES", "ORDER_TARGET_REQUIRED", "ORDER_SOURCE_CONFLICT", "ORDER_CUSTOMER_REQUIRED", "BASKET_EMPTY", "BASKET_CHANGED_DURING_CHECKOUT", "CART_VERSION_CREATE_ONLY", "CART_VERSION_REQUIRES_CART_ID", "CART_REVISION_STALE", "CART_CUSTOMER_MISMATCH", "COUNTER_SALE_CREATE_ONLY", "SOLD_AT_CREATE_ONLY", "SOLD_AT_IN_FUTURE", "ORDER_TENDER_CREATE_ONLY", "CREDIT_OVERRIDE_CREATE_ONLY", "ON_ACCOUNT_CREATE_ONLY", "ON_ACCOUNT_WITH_TENDERS", "TENDERS_REQUIRE_COUNTER_SALE", "LINES_REQUIRE_COUNTER_SALE", "PRODUCT_COST_UNKNOWN", "PRICE_CHANGE_DISABLED", "LINE_DISCOUNT_EXCEEDS_MAX", "CUSTOMER_DISABLED", "SHIFT_NOT_AVAILABLE", "SOLD_AT_OUTSIDE_SHIFT", "ORDER_CURRENCY_NOT_SUBSCRIBED", "PAYMENT_METHODS_NOT_CONFIGURED", "PAYMENT_METHOD_NOT_FOUND", "CURRENCY_MISMATCH", "SHIFT_NOT_OPEN", "ORDER_DISCOUNT_AFTER_INVOICE", "ORDER_DISCOUNT_ON_SERVICE_ORDER", "ORDER_DISCOUNT_ON_MARKETPLACE_ORDER", "ORDER_INVOICE_METHOD_OUTSTANDING_FACTURA", "ORDER_SERVICE_PERIOD_AFTER_INVOICE", "ORDER_ATTEMPT_COMMITTED", "ORDER_ATTEMPT_ABANDONED", "ORDER_ATTEMPT_KEY_EXPIRED", "ORDER_ATTEMPT_KEY_SCOPE_MISMATCH"];
|
|
2703
|
+
export declare const ORDER_ERROR_CODES: readonly ["ORDER_COST_DENOMINATION_UNKNOWN", "SERVICE_ORDER_DELIVERY_MANAGED", "ORDER_NOT_FOUND", "ORDER_LOCKED", "ORDER_NOT_READY", "ORDER_DELIVERED_ANOTHER_DAY", "ORDER_DELIVERY_STATE_UNCHANGED", "ORDER_ILLEGAL_TRANSITION", "ORDER_VERSION_CONFLICT", "CUSTOMER_NOT_FOUND", "CUSTOMER_MERGED", "ORDER_HAS_NO_CUSTOMER", "CUSTOMER_ANONYMIZED", "FX_CONVERSION_UNAVAILABLE", "ROLE_FORBIDDEN", "ORDER_CANCELLED", "PAYMENT_SETTLED_ON_ANOTHER_ORDER", "ORDER_HAS_SHIPMENTS", "ORDER_HAS_RETURNS", "SHIPMENT_QUANTITY_EXCEEDED", "SHIPMENT_LINE_MISMATCH", "SHIPMENT_NOT_FOUND", "SHIPMENT_LIMIT_REACHED", "SHIPMENT_TOO_LARGE", "ORDER_FULFILMENT_EXTERNAL", "SHIPMENT_FAILED", "ADMIN_REQUIRED", "IDEMPOTENCY_KEY_REQUIRED", "INVALID_IDEMPOTENCY_KEY", "IDEMPOTENCY_KEY_REUSE", "IDEMPOTENCY_IN_PROGRESS", "IDEMPOTENCY_LOCK_CONTENTION", "IDEMPOTENCY_KEY_FAILED", "IDEMPOTENT_RESPONSE_NOT_CACHED", "ORDER_CANCELLATION_NOT_PROTECTED", "ORDER_CANCELLATION_COMMITTED", "ORDER_CANCELLATION_LOCKED", "ORDER_CANCELLATION_TOO_LARGE", "ORDER_CANCELLATION_FAILED", "SALE_LEDGER_RETRACTION_REFUSED", "SALE_LEDGER_ROW_NOT_OWNED", "PRODUCT_NOT_FOUND", "PRODUCT_SALE_LIMIT_EXCEEDED", "PRODUCT_SALE_LIMIT_INVALID", "DEPOSIT_SOURCE_NOT_ALLOWED", "DEPOSIT_CURRENCY_MISMATCH", "DEPOSIT_EXCEEDS_TOTAL", "DEPOSIT_FREEZE_REQUIRES_INVOICE", "DEPOSIT_FREEZE_INVOICE_PENDING", "DEPOSIT_CHARACTERIZATION_CONFLICT", "DEPOSIT_FREEZE_INVOICE_NOT_QUALIFYING", "DEPOSIT_INVOICED_ORDER_MUST_FREEZE", "DEPOSIT_REFERENCE_IS_LINKED_PAYMENT", "DEPOSIT_DUPLICATE_REFERENCE", "PAYMENT_REFERENCED_BY_DEPOSIT", "ORDER_HAS_UNREFUNDED_DEPOSIT", "DEPOSIT_NOT_FOUND", "DEPOSIT_ALREADY_REFUNDED", "UNIT_QUANTITY_NOT_WHOLE", "UNIT_REVISION_STALE", "UNIT_QUANTITY_UNREPRESENTABLE", "KIT_RECIPE_CHANGED", "CART_PROMOTION_UNAVAILABLE", "ORDER_HAS_KIT_LINES", "ORDER_TARGET_REQUIRED", "ORDER_SOURCE_CONFLICT", "ORDER_CUSTOMER_REQUIRED", "BASKET_EMPTY", "BASKET_CHANGED_DURING_CHECKOUT", "CART_VERSION_CREATE_ONLY", "CART_VERSION_REQUIRES_CART_ID", "CART_REVISION_STALE", "CART_CUSTOMER_MISMATCH", "COUNTER_SALE_CREATE_ONLY", "SOLD_AT_CREATE_ONLY", "SOLD_AT_IN_FUTURE", "ORDER_TENDER_CREATE_ONLY", "CREDIT_OVERRIDE_CREATE_ONLY", "ON_ACCOUNT_CREATE_ONLY", "ON_ACCOUNT_WITH_TENDERS", "TENDERS_REQUIRE_COUNTER_SALE", "LINES_REQUIRE_COUNTER_SALE", "PRODUCT_COST_UNKNOWN", "PRICE_CHANGE_DISABLED", "LINE_DISCOUNT_EXCEEDS_MAX", "CUSTOMER_DISABLED", "SHIFT_NOT_AVAILABLE", "SOLD_AT_OUTSIDE_SHIFT", "ORDER_CURRENCY_NOT_SUBSCRIBED", "PAYMENT_METHODS_NOT_CONFIGURED", "PAYMENT_METHOD_NOT_FOUND", "DELIVERY_METHOD_NOT_FOUND", "ORDER_BELOW_MINIMUM_PURCHASE", "ORDER_INVALID_CART", "EMAIL_VERIFICATION_REQUIRED", "ACCOUNT_DISABLED", "CURRENCY_MISMATCH", "SHIFT_NOT_OPEN", "ORDER_DISCOUNT_AFTER_INVOICE", "ORDER_DISCOUNT_ON_SERVICE_ORDER", "ORDER_DISCOUNT_ON_MARKETPLACE_ORDER", "ORDER_INVOICE_METHOD_OUTSTANDING_FACTURA", "ORDER_SERVICE_PERIOD_AFTER_INVOICE", "ORDER_ATTEMPT_COMMITTED", "ORDER_ATTEMPT_ABANDONED", "ORDER_ATTEMPT_KEY_EXPIRED", "ORDER_ATTEMPT_KEY_SCOPE_MISMATCH"];
|
|
2681
2704
|
export type OrderErrorCode = (typeof ORDER_ERROR_CODES)[number];
|
|
2682
2705
|
export {};
|
package/dist/order.js
CHANGED
|
@@ -337,10 +337,28 @@ export const orderFulfilmentProgress = (order) => {
|
|
|
337
337
|
* `data.shiftId`. Logged; reconcile the queued sale by hand.
|
|
338
338
|
* - `ORDER_CURRENCY_NOT_SUBSCRIBED` · 400 — the sale's currency has no
|
|
339
339
|
* subscription in the store's `currencies`. Logged.
|
|
340
|
-
* - `PAYMENT_METHODS_NOT_CONFIGURED` · 409 — `tenders` sent
|
|
341
|
-
* has no payment methods at
|
|
342
|
-
*
|
|
343
|
-
*
|
|
340
|
+
* - `PAYMENT_METHODS_NOT_CONFIGURED` · 409 — `tenders` sent, or storefront/
|
|
341
|
+
* WhatsApp checkout attempted, while the store has no payment methods at
|
|
342
|
+
* all. Storefront checkout carries `data: {}` and refuses before the cart read.
|
|
343
|
+
* - `PAYMENT_METHOD_NOT_FOUND` · 400 — a tender leg's `method`, or storefront
|
|
344
|
+
* checkout's `paymentMethod`, names none of the store's payment methods.
|
|
345
|
+
* Storefront checkout carries `data: {}` and refuses before the cart read.
|
|
346
|
+
*
|
|
347
|
+
* Storefront and WhatsApp checkout business refusals. None allocates an order
|
|
348
|
+
* id, redeems a coupon or writes an order; none is logged as an error:
|
|
349
|
+
* - `DELIVERY_METHOD_NOT_FOUND` · 400 — `deliveryMethod` is not in the store's
|
|
350
|
+
* delivery catalogue, including an absent/empty catalogue. `data: {}`;
|
|
351
|
+
* refused before reading the cart.
|
|
352
|
+
* - `ORDER_INVALID_CART` · 400 — the normalized cart has no finite numeric
|
|
353
|
+
* `totals.grandTotal`. `data: {}`; refused before repricing/allocation.
|
|
354
|
+
* - `ORDER_BELOW_MINIMUM_PURCHASE` · 400 — after repricing has confirmed the
|
|
355
|
+
* cart, its grand total is below a finite positive `Number(customer.minBuy)`.
|
|
356
|
+
* Equality passes. `data: OrderBelowMinimumPurchaseData` carries minBuy,
|
|
357
|
+
* grandTotal and the cart display currency, with no currency conversion.
|
|
358
|
+
* - `EMAIL_VERIFICATION_REQUIRED` · 403 — the store requires email verification
|
|
359
|
+
* and the live customer has not verified. No data payload; before cart read.
|
|
360
|
+
* - `ACCOUNT_DISABLED` · 403 — the live customer is disabled. No data payload;
|
|
361
|
+
* before cart read. This is distinct from the staff `CUSTOMER_DISABLED` code.
|
|
344
362
|
*
|
|
345
363
|
* Commit-time drawer refusals, on a create whose cash tender books into a
|
|
346
364
|
* drawer shift. No order committed, but a coupon redeemed before the commit
|
|
@@ -545,6 +563,11 @@ export const ORDER_ERROR_CODES = [
|
|
|
545
563
|
'ORDER_CURRENCY_NOT_SUBSCRIBED',
|
|
546
564
|
'PAYMENT_METHODS_NOT_CONFIGURED',
|
|
547
565
|
'PAYMENT_METHOD_NOT_FOUND',
|
|
566
|
+
'DELIVERY_METHOD_NOT_FOUND',
|
|
567
|
+
'ORDER_BELOW_MINIMUM_PURCHASE',
|
|
568
|
+
'ORDER_INVALID_CART',
|
|
569
|
+
'EMAIL_VERIFICATION_REQUIRED',
|
|
570
|
+
'ACCOUNT_DISABLED',
|
|
548
571
|
// Commit-time drawer refusals; `CURRENCY_MISMATCH` carries its fields at the body's top level.
|
|
549
572
|
'CURRENCY_MISMATCH',
|
|
550
573
|
'SHIFT_NOT_OPEN',
|
package/dist/store.d.ts
CHANGED
|
@@ -115,6 +115,11 @@ declare global {
|
|
|
115
115
|
deactivatesAt?: number | null;
|
|
116
116
|
config?: Partial<StorefrontLiveSettings> & {
|
|
117
117
|
showDefaultPriceList?: number;
|
|
118
|
+
/** New self-registrants use this list; absent means PUBLICO (1).
|
|
119
|
+
* Zero is refused and writes validate membership in store.priceLists.
|
|
120
|
+
* Never sent to shoppers.
|
|
121
|
+
*/
|
|
122
|
+
newCustomerPriceList?: number;
|
|
118
123
|
showStocks?: boolean;
|
|
119
124
|
};
|
|
120
125
|
sidebar?: {
|
|
@@ -152,9 +157,12 @@ declare global {
|
|
|
152
157
|
appVersion?: number;
|
|
153
158
|
stats?: Record<string, string>;
|
|
154
159
|
}
|
|
155
|
-
/** Sparse tenant PATCH shape; live null values reset to registry defaults and are never stored.
|
|
160
|
+
/** Sparse tenant PATCH shape; live null values reset to registry defaults and are never stored.
|
|
161
|
+
* An unknown newCustomerPriceList refuses 400 PRICE_LIST_NOT_FOUND with
|
|
162
|
+
* data: { field: 'ecommerce.config.newCustomerPriceList', value: number }; nothing written.
|
|
163
|
+
*/
|
|
156
164
|
interface EcommercePatchInput {
|
|
157
|
-
config?: Pick<NonNullable<Ecommerce['config']>, 'showDefaultPriceList'> & StorefrontLiveSettingsPatch;
|
|
165
|
+
config?: Pick<NonNullable<Ecommerce['config']>, 'showDefaultPriceList' | 'newCustomerPriceList'> & StorefrontLiveSettingsPatch;
|
|
158
166
|
sidebar?: Ecommerce['sidebar'];
|
|
159
167
|
home?: Omit<NonNullable<Ecommerce['home']>, 'displayOrders' | 'displayProfile'>;
|
|
160
168
|
themeColors?: Ecommerce['themeColors'];
|
|
@@ -21,3 +21,10 @@
|
|
|
21
21
|
export declare const STOREFRONT_WEB_LITERAL_KEYS: readonly string[];
|
|
22
22
|
/** Whether a shop may override `key` — membership in {@link STOREFRONT_WEB_LITERAL_KEYS}. */
|
|
23
23
|
export declare const isStorefrontLiteralKey: (key: string) => boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Whether `value` may be stored, published or served for `key`. A `NAVIGATE_*` key is
|
|
26
|
+
* rendered as a link, so it must be a same-origin path — otherwise an override could
|
|
27
|
+
* send a shop's customers to an off-site look-alike login page. Every other key is
|
|
28
|
+
* unconstrained here (key membership, well-formedness and length are checked apart).
|
|
29
|
+
*/
|
|
30
|
+
export declare const isAllowedStorefrontLiteralValue: (key: string, value: string) => boolean;
|
|
@@ -1109,3 +1109,22 @@ export const STOREFRONT_WEB_LITERAL_KEYS = Object.freeze([
|
|
|
1109
1109
|
const STOREFRONT_WEB_LITERAL_KEY_SET = new Set(STOREFRONT_WEB_LITERAL_KEYS);
|
|
1110
1110
|
/** Whether a shop may override `key` — membership in {@link STOREFRONT_WEB_LITERAL_KEYS}. */
|
|
1111
1111
|
export const isStorefrontLiteralKey = (key) => STOREFRONT_WEB_LITERAL_KEY_SET.has(key);
|
|
1112
|
+
/** Keys whose value is a storefront route the storefront renders as a link target. */
|
|
1113
|
+
const STOREFRONT_NAVIGATE_LITERAL_PREFIX = 'NAVIGATE_';
|
|
1114
|
+
/**
|
|
1115
|
+
* A same-origin path: a leading `/`, a second character that is neither `/` nor `\`
|
|
1116
|
+
* (`//host` and `/\host` are protocol-relative to a browser), and no whitespace or
|
|
1117
|
+
* backslash anywhere — a browser strips tab and newline before parsing, so `/\t/host`
|
|
1118
|
+
* becomes `//host`. A value with a scheme cannot start with `/`.
|
|
1119
|
+
*
|
|
1120
|
+
* The storefront is to apply this identical pattern in `src/app/slices/literals.ts`
|
|
1121
|
+
* `resolveLayer` (its change is pending there); keep the two the same.
|
|
1122
|
+
*/
|
|
1123
|
+
const STOREFRONT_SAME_ORIGIN_PATH_RE = /^\/(?![/\\])[^\s\\]*$/;
|
|
1124
|
+
/**
|
|
1125
|
+
* Whether `value` may be stored, published or served for `key`. A `NAVIGATE_*` key is
|
|
1126
|
+
* rendered as a link, so it must be a same-origin path — otherwise an override could
|
|
1127
|
+
* send a shop's customers to an off-site look-alike login page. Every other key is
|
|
1128
|
+
* unconstrained here (key membership, well-formedness and length are checked apart).
|
|
1129
|
+
*/
|
|
1130
|
+
export const isAllowedStorefrontLiteralValue = (key, value) => !key.startsWith(STOREFRONT_NAVIGATE_LITERAL_PREFIX) || STOREFRONT_SAME_ORIGIN_PATH_RE.test(value);
|