platform-types 1.10.694 → 1.10.696
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/cart.d.ts +8 -1
- package/dist/cjs/serviceOrder.js +5 -0
- package/dist/cjs/storefrontTheme.js +18 -2
- package/dist/order.d.ts +2 -1
- package/dist/serviceOrder.d.ts +5 -1
- package/dist/serviceOrder.js +5 -0
- package/dist/storefrontDesign.d.ts +11 -1
- package/dist/storefrontTheme.d.ts +7 -1
- package/dist/storefrontTheme.js +18 -2
- package/package.json +1 -1
package/dist/cart.d.ts
CHANGED
|
@@ -197,7 +197,9 @@ declare global {
|
|
|
197
197
|
* ⚠️ It is the value AFTER the cost floor. A cashier who types below cost
|
|
198
198
|
* gets the cost, and the cost is what is remembered — so the floor is
|
|
199
199
|
* re-applied against the CURRENT product cost on every later rebuild and a
|
|
200
|
-
* pinned price can never drift below margin as costs rise.
|
|
200
|
+
* pinned price can never drift below margin as costs rise. That also means
|
|
201
|
+
* it can exceed 1,000,000,000 (the cap a TYPED price answers to), because
|
|
202
|
+
* the cost is catalogue-derived; echoing it back unchanged is never refused.
|
|
201
203
|
*
|
|
202
204
|
* ⚠️ It SURVIVES every later write to the cart — another line being added, a
|
|
203
205
|
* coupon applied, this line's own quantity changed, the price list moving to
|
|
@@ -849,6 +851,11 @@ declare global {
|
|
|
849
851
|
* on, and the result is floored at the product's own `cost` — a counter
|
|
850
852
|
* price may discount and never sell below margin.
|
|
851
853
|
*
|
|
854
|
+
* ⚠️ An HONOURED number above 1,000,000,000 — the line price order edit
|
|
855
|
+
* accepts — is refused `400 VALIDATION_FAILED` naming `price`. A number the
|
|
856
|
+
* surface or the store switch discards is never refused, however large, so
|
|
857
|
+
* a storefront or `changePrice`-off till may echo any list price.
|
|
858
|
+
*
|
|
852
859
|
* ⚠️ THREE values, three different instructions:
|
|
853
860
|
*
|
|
854
861
|
* - ABSENT — say nothing about price. A line already pinned to a staff
|
package/dist/cjs/serviceOrder.js
CHANGED
|
@@ -197,6 +197,10 @@ exports.MAX_SERVICE_PICTURES = 20;
|
|
|
197
197
|
* the ticket (`data.basketCurrency`, `data.serviceCurrency`). Nothing was
|
|
198
198
|
* written and no order number was minted; bill the cart separately or resend
|
|
199
199
|
* with `includeBasket: false`.
|
|
200
|
+
* - `SERVICE_LINE_PRICE_TOO_LARGE` · 400 — the `ready → delivered` handover
|
|
201
|
+
* would mint an order line (`data.line`: `'labor'` or `'parts'`, at
|
|
202
|
+
* `data.amount`) above `data.max`, the line price order edit accepts. Nothing
|
|
203
|
+
* was written and no order number was minted; split the work across tickets.
|
|
200
204
|
* - `SERVICE_RENOTIFY_*` — `mode: 'renotify'`. `_TOO_SOON` (429) carries
|
|
201
205
|
* `lastNotifiedAt` and `retryAfterMs`; `_IMPERSONATED` (403) means a support
|
|
202
206
|
* session cannot message the customer — the store must resend it itself;
|
|
@@ -337,6 +341,7 @@ exports.SERVICE_ORDER_ERROR_CODES = [
|
|
|
337
341
|
'PRODUCT_SALE_LIMIT_INVALID',
|
|
338
342
|
'FX_CONVERSION_UNAVAILABLE',
|
|
339
343
|
'TRANSACT_ITEMS_LIMIT_EXCEEDED',
|
|
344
|
+
'SERVICE_LINE_PRICE_TOO_LARGE',
|
|
340
345
|
// Parts
|
|
341
346
|
'SERVICE_PARTS_RESTORE_EXCEEDS_CONSUMED',
|
|
342
347
|
'SERVICE_PARTS_RESTORE_EXCEEDS_AMOUNT',
|
|
@@ -2,6 +2,16 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.resolveStorefrontTheme = exports.resolveStorefrontEffectiveSettings = exports.storefrontGlobalSettingsLayer = exports.storefrontContrastRatio = void 0;
|
|
4
4
|
const storefrontDesignRegistry_ts_1 = require("./storefrontDesignRegistry.js");
|
|
5
|
+
const WARNING_SETTING = {
|
|
6
|
+
link: 'primaryColor',
|
|
7
|
+
button: 'primaryColor',
|
|
8
|
+
focus: 'accentColor',
|
|
9
|
+
};
|
|
10
|
+
const SURFACE_SETTING = {
|
|
11
|
+
page: 'backgroundColor',
|
|
12
|
+
header: 'headerColor',
|
|
13
|
+
footer: 'footerColor',
|
|
14
|
+
};
|
|
5
15
|
const channels = (color) => [
|
|
6
16
|
Number.parseInt(color.slice(1, 3), 16),
|
|
7
17
|
Number.parseInt(color.slice(3, 5), 16),
|
|
@@ -94,7 +104,13 @@ exports.resolveStorefrontEffectiveSettings = resolveStorefrontEffectiveSettings;
|
|
|
94
104
|
* resolves defaults plus the design only — correct solely while no GLOBAL design setting
|
|
95
105
|
* is set, so a caller serving or reporting on a storefront passes the row (the edge
|
|
96
106
|
* renderer's `theme-color` is the one exception, design-only by its read grant). Passing
|
|
97
|
-
* already-effective settings as `overrides` rebuilds the same
|
|
107
|
+
* already-effective settings as `overrides` rebuilds the same tokens.
|
|
108
|
+
*
|
|
109
|
+
* `warnings` names only adjustments the design itself caused: the adjusted colour, or the
|
|
110
|
+
* background of the surface it sits on, is set in `overrides`. No single colour reads at 4.5:1 on
|
|
111
|
+
* both a white page and its dark-mode counterpart, so a platform or GLOBAL default is always
|
|
112
|
+
* adjusted somewhere, and a shop that chose nothing has nothing to act on. Pass the design's own
|
|
113
|
+
* settings, not effective ones, or every default reads as chosen.
|
|
98
114
|
*/
|
|
99
115
|
const resolveStorefrontTheme = (overrides = {}, globalsRow) => {
|
|
100
116
|
const settings = (0, exports.resolveStorefrontEffectiveSettings)(overrides, globalsRow);
|
|
@@ -127,7 +143,7 @@ const resolveStorefrontTheme = (overrides = {}, globalsRow) => {
|
|
|
127
143
|
},
|
|
128
144
|
shape: { borderRadius: 4 },
|
|
129
145
|
spacing: 8,
|
|
130
|
-
warnings,
|
|
146
|
+
warnings: warnings.filter(({ role, surface }) => overrides[WARNING_SETTING[role]] !== undefined || overrides[SURFACE_SETTING[surface]] !== undefined),
|
|
131
147
|
};
|
|
132
148
|
};
|
|
133
149
|
exports.resolveStorefrontTheme = resolveStorefrontTheme;
|
package/dist/order.d.ts
CHANGED
|
@@ -1774,7 +1774,8 @@ declare global {
|
|
|
1774
1774
|
* cart path, where the price is the catalogue's. It is not a licence to set
|
|
1775
1775
|
* any price: a store with `changePrice: false` refuses a line whose price
|
|
1776
1776
|
* differs from the catalogue price, and a non-positive price is refused
|
|
1777
|
-
* everywhere.
|
|
1777
|
+
* everywhere. A price above 1,000,000,000 is refused too, the cap order
|
|
1778
|
+
* edit puts on a line price, so the order can always be edited.
|
|
1778
1779
|
*/
|
|
1779
1780
|
price: number;
|
|
1780
1781
|
/** Per-line discount, subject to the same operator capability as a cart discount. */
|
package/dist/serviceOrder.d.ts
CHANGED
|
@@ -1311,6 +1311,10 @@ export declare const MAX_SERVICE_PICTURES = 20;
|
|
|
1311
1311
|
* the ticket (`data.basketCurrency`, `data.serviceCurrency`). Nothing was
|
|
1312
1312
|
* written and no order number was minted; bill the cart separately or resend
|
|
1313
1313
|
* with `includeBasket: false`.
|
|
1314
|
+
* - `SERVICE_LINE_PRICE_TOO_LARGE` · 400 — the `ready → delivered` handover
|
|
1315
|
+
* would mint an order line (`data.line`: `'labor'` or `'parts'`, at
|
|
1316
|
+
* `data.amount`) above `data.max`, the line price order edit accepts. Nothing
|
|
1317
|
+
* was written and no order number was minted; split the work across tickets.
|
|
1314
1318
|
* - `SERVICE_RENOTIFY_*` — `mode: 'renotify'`. `_TOO_SOON` (429) carries
|
|
1315
1319
|
* `lastNotifiedAt` and `retryAfterMs`; `_IMPERSONATED` (403) means a support
|
|
1316
1320
|
* session cannot message the customer — the store must resend it itself;
|
|
@@ -1377,6 +1381,6 @@ export declare const MAX_SERVICE_PICTURES = 20;
|
|
|
1377
1381
|
* check `GATING_ERROR_CODES` in addition. The deposit's opt-in idempotency
|
|
1378
1382
|
* refusals are included here.
|
|
1379
1383
|
*/
|
|
1380
|
-
export declare const SERVICE_ORDER_ERROR_CODES: readonly ["UNIT_QUANTITY_NOT_WHOLE", "UNIT_REVISION_STALE", "ROLE_FORBIDDEN", "PARENT_FILTER_CONFLICT", "VALIDATION_FAILED", "INVALID_CURSOR", "INVALID_FROM_DATE", "INVALID_TO_DATE", "INVALID_DATE_RANGE", "REWORK_INDEX_UNAVAILABLE", "STORE_NOT_FOUND", "SERVICE_ORDER_NOT_FOUND", "CUSTOMER_NOT_FOUND", "PARENT_SERVICE_ORDER_NOT_FOUND", "SERVICE_TEMPLATE_NOT_FOUND", "SERVICE_TYPE_REQUIRED", "INVALID_IMAGE_REFERENCE", "MISSING_STORE_CONTEXT", "WARRANTY_BELOW_LEGAL_MINIMUM", "TECHNICIAN_NOT_FOUND", "TECHNICIAN_NOT_ELIGIBLE", "CUSTODY_ILLEGAL_TRANSITION", "SERVICE_ORDER_BILLABLE_FROZEN", "SERVICE_ORDER_EDIT_CHANGED", "SERVICE_ORDER_DISABLED_STATE_UNCHANGED", "APPOINTMENT_NOT_FOUND", "APPOINTMENT_NOT_LINKABLE", "APPOINTMENT_NOT_OPEN", "APPOINTMENT_CUSTOMER_MISMATCH", "APPOINTMENT_VERSION_CONFLICT", "SERVICE_ORDER_TERMINAL", "SERVICE_ORDER_DISABLED", "SERVICE_ORDER_ILLEGAL_TRANSITION", "SERVICE_ORDER_STATUS_CHANGED", "SERVICE_ORDER_OUTCOME_REQUIRED", "SERVICE_ORDER_OUTCOME_NOT_ALLOWED", "SERVICE_ORDER_CUSTODY_NOT_RECEIVED", "SERVICE_ORDER_BILLABLE_NOT_AT_THIS_TRANSITION", "PAYMENT_METHODS_NOT_CONFIGURED", "PAYMENT_METHOD_NOT_FOUND", "SERVICE_ORDER_DEPOSIT_CHANGED", "INVALID_IDEMPOTENCY_KEY", "IDEMPOTENCY_KEY_REUSE", "IDEMPOTENCY_IN_PROGRESS", "IDEMPOTENCY_KEY_FAILED", "IDEMPOTENCY_LOCK_CONTENTION", "SERVICE_DEPOSIT_CURRENCY_MISMATCH", "SERVICE_DEPOSIT_INVALID", "INVALID_AMOUNT", "DEFAULT_DRAWER_UNAVAILABLE", "CURRENCY_MISMATCH", "SHIFT_NOT_OPEN", "SERVICE_BILLING_PRODUCTS_UNAVAILABLE", "CATEGORY_NOT_FOUND", "CATEGORY_DISABLED", "CATEGORY_DISABLE_IN_PROGRESS", "SERVICE_BILLING_PRODUCT_IN_BASKET", "SERVICE_DELIVERY_BASKET_DECISION_REQUIRED", "SERVICE_DELIVERY_BASKET_CURRENCY_MISMATCH", "PRODUCT_NOT_AVAILABLE", "PRODUCT_SALE_LIMIT_EXCEEDED", "PRODUCT_SALE_LIMIT_INVALID", "FX_CONVERSION_UNAVAILABLE", "TRANSACT_ITEMS_LIMIT_EXCEEDED", "SERVICE_PARTS_RESTORE_EXCEEDS_CONSUMED", "SERVICE_PARTS_RESTORE_EXCEEDS_AMOUNT", "SERVICE_PARTS_STOCK_INSUFFICIENT", "SERVICE_PARTS_PRODUCT_NOT_FOUND", "SERVICE_PARTS_LEDGER_FULL", "SERVICE_PARTS_TOO_MANY", "SERVICE_ORDER_PARTS_CHANGED", "SERVICE_QUOTE_NOT_FOUND", "SERVICE_QUOTE_NOT_OFFERABLE", "SERVICE_QUOTE_HOLDS_TOO_MANY", "SERVICE_QUOTE_SUPERSEDED", "SERVICE_QUOTE_ALREADY_RESOLVED", "SERVICE_QUOTE_LAPSED", "SERVICE_QUOTE_CHANNEL_RESERVED", "SERVICE_QUOTE_CHANNEL_NOT_APPLICABLE", "SERVICE_QUOTE_REASON_NOT_APPLICABLE", "SERVICE_ORDER_QUOTE_CHANGED", "SERVICE_ORDER_NOT_READY", "SERVICE_RENOTIFY_IMPERSONATED", "SERVICE_RENOTIFY_TOO_SOON", "SERVICE_RENOTIFY_CONFLICT", "SERVICE_RENOTIFY_NOT_RECORDED", "SERVICE_RENOTIFY_LEDGER_UNREADABLE", "SERVICE_RENOTIFY_NOT_DISPATCHED", "SERVICE_TIMER_ALREADY_RUNNING", "SERVICE_TIMER_NOT_RUNNING", "SERVICE_TIMER_STOP_CONFLICT", "TECHNICIAN_NOT_CLOCKED_IN", "SERVICE_ORDER_GONE", "SERVICE_WORKLOG_NOT_FOUND", "SERVICE_WORKLOG_NOT_REVERSIBLE", "SERVICE_WORKLOG_ALREADY_REVERSED", "SERVICE_ORDER_WORKLOG_CHANGED", "CART_PROMOTION_UNAVAILABLE", "COUPON_NOT_FOUND", "COUPON_NOT_ACTIVE", "COUPON_EXPIRED", "COUPON_EXHAUSTED", "COUPON_EXHAUSTED_AT_CHECKOUT", "COUPON_MIN_SUBTOTAL", "COUPON_REQUIRES_CUSTOMER", "COUPON_BUDGET_EXHAUSTED", "COUPON_CURRENCY_MISMATCH"];
|
|
1384
|
+
export declare const SERVICE_ORDER_ERROR_CODES: readonly ["UNIT_QUANTITY_NOT_WHOLE", "UNIT_REVISION_STALE", "ROLE_FORBIDDEN", "PARENT_FILTER_CONFLICT", "VALIDATION_FAILED", "INVALID_CURSOR", "INVALID_FROM_DATE", "INVALID_TO_DATE", "INVALID_DATE_RANGE", "REWORK_INDEX_UNAVAILABLE", "STORE_NOT_FOUND", "SERVICE_ORDER_NOT_FOUND", "CUSTOMER_NOT_FOUND", "PARENT_SERVICE_ORDER_NOT_FOUND", "SERVICE_TEMPLATE_NOT_FOUND", "SERVICE_TYPE_REQUIRED", "INVALID_IMAGE_REFERENCE", "MISSING_STORE_CONTEXT", "WARRANTY_BELOW_LEGAL_MINIMUM", "TECHNICIAN_NOT_FOUND", "TECHNICIAN_NOT_ELIGIBLE", "CUSTODY_ILLEGAL_TRANSITION", "SERVICE_ORDER_BILLABLE_FROZEN", "SERVICE_ORDER_EDIT_CHANGED", "SERVICE_ORDER_DISABLED_STATE_UNCHANGED", "APPOINTMENT_NOT_FOUND", "APPOINTMENT_NOT_LINKABLE", "APPOINTMENT_NOT_OPEN", "APPOINTMENT_CUSTOMER_MISMATCH", "APPOINTMENT_VERSION_CONFLICT", "SERVICE_ORDER_TERMINAL", "SERVICE_ORDER_DISABLED", "SERVICE_ORDER_ILLEGAL_TRANSITION", "SERVICE_ORDER_STATUS_CHANGED", "SERVICE_ORDER_OUTCOME_REQUIRED", "SERVICE_ORDER_OUTCOME_NOT_ALLOWED", "SERVICE_ORDER_CUSTODY_NOT_RECEIVED", "SERVICE_ORDER_BILLABLE_NOT_AT_THIS_TRANSITION", "PAYMENT_METHODS_NOT_CONFIGURED", "PAYMENT_METHOD_NOT_FOUND", "SERVICE_ORDER_DEPOSIT_CHANGED", "INVALID_IDEMPOTENCY_KEY", "IDEMPOTENCY_KEY_REUSE", "IDEMPOTENCY_IN_PROGRESS", "IDEMPOTENCY_KEY_FAILED", "IDEMPOTENCY_LOCK_CONTENTION", "SERVICE_DEPOSIT_CURRENCY_MISMATCH", "SERVICE_DEPOSIT_INVALID", "INVALID_AMOUNT", "DEFAULT_DRAWER_UNAVAILABLE", "CURRENCY_MISMATCH", "SHIFT_NOT_OPEN", "SERVICE_BILLING_PRODUCTS_UNAVAILABLE", "CATEGORY_NOT_FOUND", "CATEGORY_DISABLED", "CATEGORY_DISABLE_IN_PROGRESS", "SERVICE_BILLING_PRODUCT_IN_BASKET", "SERVICE_DELIVERY_BASKET_DECISION_REQUIRED", "SERVICE_DELIVERY_BASKET_CURRENCY_MISMATCH", "PRODUCT_NOT_AVAILABLE", "PRODUCT_SALE_LIMIT_EXCEEDED", "PRODUCT_SALE_LIMIT_INVALID", "FX_CONVERSION_UNAVAILABLE", "TRANSACT_ITEMS_LIMIT_EXCEEDED", "SERVICE_LINE_PRICE_TOO_LARGE", "SERVICE_PARTS_RESTORE_EXCEEDS_CONSUMED", "SERVICE_PARTS_RESTORE_EXCEEDS_AMOUNT", "SERVICE_PARTS_STOCK_INSUFFICIENT", "SERVICE_PARTS_PRODUCT_NOT_FOUND", "SERVICE_PARTS_LEDGER_FULL", "SERVICE_PARTS_TOO_MANY", "SERVICE_ORDER_PARTS_CHANGED", "SERVICE_QUOTE_NOT_FOUND", "SERVICE_QUOTE_NOT_OFFERABLE", "SERVICE_QUOTE_HOLDS_TOO_MANY", "SERVICE_QUOTE_SUPERSEDED", "SERVICE_QUOTE_ALREADY_RESOLVED", "SERVICE_QUOTE_LAPSED", "SERVICE_QUOTE_CHANNEL_RESERVED", "SERVICE_QUOTE_CHANNEL_NOT_APPLICABLE", "SERVICE_QUOTE_REASON_NOT_APPLICABLE", "SERVICE_ORDER_QUOTE_CHANGED", "SERVICE_ORDER_NOT_READY", "SERVICE_RENOTIFY_IMPERSONATED", "SERVICE_RENOTIFY_TOO_SOON", "SERVICE_RENOTIFY_CONFLICT", "SERVICE_RENOTIFY_NOT_RECORDED", "SERVICE_RENOTIFY_LEDGER_UNREADABLE", "SERVICE_RENOTIFY_NOT_DISPATCHED", "SERVICE_TIMER_ALREADY_RUNNING", "SERVICE_TIMER_NOT_RUNNING", "SERVICE_TIMER_STOP_CONFLICT", "TECHNICIAN_NOT_CLOCKED_IN", "SERVICE_ORDER_GONE", "SERVICE_WORKLOG_NOT_FOUND", "SERVICE_WORKLOG_NOT_REVERSIBLE", "SERVICE_WORKLOG_ALREADY_REVERSED", "SERVICE_ORDER_WORKLOG_CHANGED", "CART_PROMOTION_UNAVAILABLE", "COUPON_NOT_FOUND", "COUPON_NOT_ACTIVE", "COUPON_EXPIRED", "COUPON_EXHAUSTED", "COUPON_EXHAUSTED_AT_CHECKOUT", "COUPON_MIN_SUBTOTAL", "COUPON_REQUIRES_CUSTOMER", "COUPON_BUDGET_EXHAUSTED", "COUPON_CURRENCY_MISMATCH"];
|
|
1381
1385
|
export type ServiceOrderErrorCode = (typeof SERVICE_ORDER_ERROR_CODES)[number];
|
|
1382
1386
|
export {};
|
package/dist/serviceOrder.js
CHANGED
|
@@ -194,6 +194,10 @@ export const MAX_SERVICE_PICTURES = 20;
|
|
|
194
194
|
* the ticket (`data.basketCurrency`, `data.serviceCurrency`). Nothing was
|
|
195
195
|
* written and no order number was minted; bill the cart separately or resend
|
|
196
196
|
* with `includeBasket: false`.
|
|
197
|
+
* - `SERVICE_LINE_PRICE_TOO_LARGE` · 400 — the `ready → delivered` handover
|
|
198
|
+
* would mint an order line (`data.line`: `'labor'` or `'parts'`, at
|
|
199
|
+
* `data.amount`) above `data.max`, the line price order edit accepts. Nothing
|
|
200
|
+
* was written and no order number was minted; split the work across tickets.
|
|
197
201
|
* - `SERVICE_RENOTIFY_*` — `mode: 'renotify'`. `_TOO_SOON` (429) carries
|
|
198
202
|
* `lastNotifiedAt` and `retryAfterMs`; `_IMPERSONATED` (403) means a support
|
|
199
203
|
* session cannot message the customer — the store must resend it itself;
|
|
@@ -334,6 +338,7 @@ export const SERVICE_ORDER_ERROR_CODES = [
|
|
|
334
338
|
'PRODUCT_SALE_LIMIT_INVALID',
|
|
335
339
|
'FX_CONVERSION_UNAVAILABLE',
|
|
336
340
|
'TRANSACT_ITEMS_LIMIT_EXCEEDED',
|
|
341
|
+
'SERVICE_LINE_PRICE_TOO_LARGE',
|
|
337
342
|
// Parts
|
|
338
343
|
'SERVICE_PARTS_RESTORE_EXCEEDS_CONSUMED',
|
|
339
344
|
'SERVICE_PARTS_RESTORE_EXCEEDS_AMOUNT',
|
|
@@ -336,6 +336,11 @@ declare global {
|
|
|
336
336
|
type StorefrontDesignErrorCode = 'STOREFRONT_DESIGN_INVALID' | 'STOREFRONT_SCHEMA_UNSUPPORTED' | 'STOREFRONT_REVISION_CONFLICT' | 'STOREFRONT_DRAFT_NOT_INITIALIZED' | 'STOREFRONT_REQUEST_EXPIRED' | 'STOREFRONT_PUBLICATION_NOT_FOUND'
|
|
337
337
|
/** Web `GET /store` and `GET /literals` `503`: the stored publication cannot be served; retry later. */
|
|
338
338
|
| 'STOREFRONT_PUBLICATION_UNAVAILABLE' | 'STOREFRONT_OPERATION_NOT_FOUND' | 'STOREFRONT_DRAFT_UNAVAILABLE' | 'IDEMPOTENCY_CONFLICT' | 'STOREFRONT_EDITOR_REQUIRED' | 'STOREFRONT_ASSET_NOT_READY' | 'STOREFRONT_PREVIEW_EXPIRED' | 'STOREFRONT_PREVIEW_REVOKED' | 'STOREFRONT_PREVIEW_FORBIDDEN' | 'STOREFRONT_PREVIEW_UNAVAILABLE';
|
|
339
|
+
/**
|
|
340
|
+
* A legacy value the editor baseline could not carry. The baseline no longer reports one: every
|
|
341
|
+
* such value falls back to its default, so a fresh `mappingConflicts` is `[]`. The type stays for a
|
|
342
|
+
* draft stored before that change, which keeps its conflicts until it is discarded.
|
|
343
|
+
*/
|
|
339
344
|
interface StorefrontDesignMappingConflict {
|
|
340
345
|
path: string;
|
|
341
346
|
code: 'LEGACY_MULTIPLE_PRODUCT_FEEDS' | 'LEGACY_UNMAPPED_CONTENT';
|
|
@@ -344,8 +349,10 @@ declare global {
|
|
|
344
349
|
interface StorefrontEditorBaseline {
|
|
345
350
|
legacyRevision?: number;
|
|
346
351
|
document: StorefrontDesignV1;
|
|
352
|
+
/** Always `[]`: an invalid colour, an unmapped Home switch, the banner and every refused or oversized literal fall back to defaults. */
|
|
347
353
|
mappingConflicts: StorefrontDesignMappingConflict[];
|
|
348
354
|
legacySourceRevision: string;
|
|
355
|
+
/** The store's own logo, offered as a suggestion; init copies it into `branding.logo`, and a copy that cannot complete leaves no logo and no conflict. */
|
|
349
356
|
legacyLogo?: {
|
|
350
357
|
source: 'store.photoURL';
|
|
351
358
|
key: string;
|
|
@@ -386,6 +393,7 @@ declare global {
|
|
|
386
393
|
publishedRevision: null;
|
|
387
394
|
document: StorefrontDesignV1;
|
|
388
395
|
dirty: false;
|
|
396
|
+
/** Always `[]` (see `StorefrontEditorBaseline`). */
|
|
389
397
|
mappingConflicts: StorefrontDesignMappingConflict[];
|
|
390
398
|
legacySourceRevision: string;
|
|
391
399
|
}
|
|
@@ -425,6 +433,7 @@ declare global {
|
|
|
425
433
|
publishedRevision: string | null;
|
|
426
434
|
document: StorefrontDesignV1;
|
|
427
435
|
dirty: boolean;
|
|
436
|
+
/** Empty for a draft seeded now; only a draft stored before the baseline stopped reporting conflicts carries any. */
|
|
428
437
|
mappingConflicts: StorefrontDesignMappingConflict[];
|
|
429
438
|
legacySourceRevision: string;
|
|
430
439
|
/**
|
|
@@ -440,7 +449,7 @@ declare global {
|
|
|
440
449
|
* content, a link to a disabled or missing page (`DANGLING_REFERENCE`), a slug a published
|
|
441
450
|
* page still owns (`ALIAS_CONFLICT`), a page out of aliases (`ALIAS_LIMIT`), and one
|
|
442
451
|
* `MAPPING_CONFLICT` per unresolved `mappingConflicts` entry, at that entry's path (the
|
|
443
|
-
* publish refusal itself names the single path `mappingConflicts
|
|
452
|
+
* publish refusal itself names the single path `mappingConflicts`; a draft seeded now has none). Empty when publishable.
|
|
444
453
|
* Never blocks a save, and never covers asset readiness, which publish probes on its own
|
|
445
454
|
* (`STOREFRONT_ASSET_NOT_READY`).
|
|
446
455
|
*/
|
|
@@ -461,6 +470,7 @@ declare global {
|
|
|
461
470
|
type StorefrontDesignPublishOperationResult = StorefrontDesignPublishResult;
|
|
462
471
|
type StorefrontDesignPublishOperationResponse = StorefrontDesignPublishResponse;
|
|
463
472
|
interface StorefrontDesignPublishResult {
|
|
473
|
+
/** Only adjustments to a colour the design itself sets; a default colour is never listed. */
|
|
464
474
|
changeSummary: {
|
|
465
475
|
contrastAdjustments: StorefrontThemeWarning[];
|
|
466
476
|
};
|
|
@@ -71,7 +71,13 @@ export declare const resolveStorefrontEffectiveSettings: (overrides?: Partial<St
|
|
|
71
71
|
* resolves defaults plus the design only — correct solely while no GLOBAL design setting
|
|
72
72
|
* is set, so a caller serving or reporting on a storefront passes the row (the edge
|
|
73
73
|
* renderer's `theme-color` is the one exception, design-only by its read grant). Passing
|
|
74
|
-
* already-effective settings as `overrides` rebuilds the same
|
|
74
|
+
* already-effective settings as `overrides` rebuilds the same tokens.
|
|
75
|
+
*
|
|
76
|
+
* `warnings` names only adjustments the design itself caused: the adjusted colour, or the
|
|
77
|
+
* background of the surface it sits on, is set in `overrides`. No single colour reads at 4.5:1 on
|
|
78
|
+
* both a white page and its dark-mode counterpart, so a platform or GLOBAL default is always
|
|
79
|
+
* adjusted somewhere, and a shop that chose nothing has nothing to act on. Pass the design's own
|
|
80
|
+
* settings, not effective ones, or every default reads as chosen.
|
|
75
81
|
*/
|
|
76
82
|
export declare const resolveStorefrontTheme: (overrides?: Partial<StorefrontDesignSettings>, globalsRow?: Record<string, unknown>) => StorefrontResolvedTheme;
|
|
77
83
|
export {};
|
package/dist/storefrontTheme.js
CHANGED
|
@@ -1,4 +1,14 @@
|
|
|
1
1
|
import { resolveStorefrontDesignSettings, validateStorefrontDesignSetting, } from "./storefrontDesignRegistry.js";
|
|
2
|
+
const WARNING_SETTING = {
|
|
3
|
+
link: 'primaryColor',
|
|
4
|
+
button: 'primaryColor',
|
|
5
|
+
focus: 'accentColor',
|
|
6
|
+
};
|
|
7
|
+
const SURFACE_SETTING = {
|
|
8
|
+
page: 'backgroundColor',
|
|
9
|
+
header: 'headerColor',
|
|
10
|
+
footer: 'footerColor',
|
|
11
|
+
};
|
|
2
12
|
const channels = (color) => [
|
|
3
13
|
Number.parseInt(color.slice(1, 3), 16),
|
|
4
14
|
Number.parseInt(color.slice(3, 5), 16),
|
|
@@ -88,7 +98,13 @@ export const resolveStorefrontEffectiveSettings = (overrides = {}, globalsRow) =
|
|
|
88
98
|
* resolves defaults plus the design only — correct solely while no GLOBAL design setting
|
|
89
99
|
* is set, so a caller serving or reporting on a storefront passes the row (the edge
|
|
90
100
|
* renderer's `theme-color` is the one exception, design-only by its read grant). Passing
|
|
91
|
-
* already-effective settings as `overrides` rebuilds the same
|
|
101
|
+
* already-effective settings as `overrides` rebuilds the same tokens.
|
|
102
|
+
*
|
|
103
|
+
* `warnings` names only adjustments the design itself caused: the adjusted colour, or the
|
|
104
|
+
* background of the surface it sits on, is set in `overrides`. No single colour reads at 4.5:1 on
|
|
105
|
+
* both a white page and its dark-mode counterpart, so a platform or GLOBAL default is always
|
|
106
|
+
* adjusted somewhere, and a shop that chose nothing has nothing to act on. Pass the design's own
|
|
107
|
+
* settings, not effective ones, or every default reads as chosen.
|
|
92
108
|
*/
|
|
93
109
|
export const resolveStorefrontTheme = (overrides = {}, globalsRow) => {
|
|
94
110
|
const settings = resolveStorefrontEffectiveSettings(overrides, globalsRow);
|
|
@@ -121,6 +137,6 @@ export const resolveStorefrontTheme = (overrides = {}, globalsRow) => {
|
|
|
121
137
|
},
|
|
122
138
|
shape: { borderRadius: 4 },
|
|
123
139
|
spacing: 8,
|
|
124
|
-
warnings,
|
|
140
|
+
warnings: warnings.filter(({ role, surface }) => overrides[WARNING_SETTING[role]] !== undefined || overrides[SURFACE_SETTING[surface]] !== undefined),
|
|
125
141
|
};
|
|
126
142
|
};
|