platform-types 1.10.695 → 1.10.697
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.
|
@@ -76,6 +76,12 @@ exports.STOREFRONT_SECTION_TYPES = [
|
|
|
76
76
|
'contact',
|
|
77
77
|
'paymentDelivery',
|
|
78
78
|
];
|
|
79
|
+
/**
|
|
80
|
+
* The storefront routes a design link may target by name. `incomes` is the
|
|
81
|
+
* always-available recency listing (`/products/incomes`); `new` is the separate
|
|
82
|
+
* listing that depends on a feature flag. `brands` and `favorites` map to
|
|
83
|
+
* `/brands` and `/favorites`.
|
|
84
|
+
*/
|
|
79
85
|
exports.STOREFRONT_BUILTIN_DESTINATIONS = [
|
|
80
86
|
'home',
|
|
81
87
|
'catalogue',
|
|
@@ -85,6 +91,9 @@ exports.STOREFRONT_BUILTIN_DESTINATIONS = [
|
|
|
85
91
|
'cart',
|
|
86
92
|
'account',
|
|
87
93
|
'privacy',
|
|
94
|
+
'brands',
|
|
95
|
+
'favorites',
|
|
96
|
+
'incomes',
|
|
88
97
|
];
|
|
89
98
|
/**
|
|
90
99
|
* The built-in destinations that must stay reachable whatever a design does with
|
|
@@ -164,6 +173,7 @@ exports.STOREFRONT_PREVIEW_READ_OPERATIONS = [
|
|
|
164
173
|
'productBySlug',
|
|
165
174
|
'productsByIds',
|
|
166
175
|
'products',
|
|
176
|
+
'incomes',
|
|
167
177
|
'group',
|
|
168
178
|
'related',
|
|
169
179
|
'categories',
|
|
@@ -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;
|
|
@@ -58,7 +58,13 @@ export declare const STOREFRONT_DESIGN_LIMITS: {
|
|
|
58
58
|
export declare const STOREFRONT_PAGE_SLUG_RE: RegExp;
|
|
59
59
|
export declare const isStorefrontPageSlug: (value: unknown) => value is string;
|
|
60
60
|
export declare const STOREFRONT_SECTION_TYPES: readonly ["banner", "imageText", "products", "categories", "brands", "text", "faq", "benefits", "contact", "paymentDelivery"];
|
|
61
|
-
|
|
61
|
+
/**
|
|
62
|
+
* The storefront routes a design link may target by name. `incomes` is the
|
|
63
|
+
* always-available recency listing (`/products/incomes`); `new` is the separate
|
|
64
|
+
* listing that depends on a feature flag. `brands` and `favorites` map to
|
|
65
|
+
* `/brands` and `/favorites`.
|
|
66
|
+
*/
|
|
67
|
+
export declare const STOREFRONT_BUILTIN_DESTINATIONS: readonly ["home", "catalogue", "offers", "new", "search", "cart", "account", "privacy", "brands", "favorites", "incomes"];
|
|
62
68
|
/**
|
|
63
69
|
* The built-in destinations that must stay reachable whatever a design does with
|
|
64
70
|
* its menus: search, cart, account and the required legal page. Reachability is
|
|
@@ -336,6 +342,11 @@ declare global {
|
|
|
336
342
|
type StorefrontDesignErrorCode = 'STOREFRONT_DESIGN_INVALID' | 'STOREFRONT_SCHEMA_UNSUPPORTED' | 'STOREFRONT_REVISION_CONFLICT' | 'STOREFRONT_DRAFT_NOT_INITIALIZED' | 'STOREFRONT_REQUEST_EXPIRED' | 'STOREFRONT_PUBLICATION_NOT_FOUND'
|
|
337
343
|
/** Web `GET /store` and `GET /literals` `503`: the stored publication cannot be served; retry later. */
|
|
338
344
|
| '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';
|
|
345
|
+
/**
|
|
346
|
+
* A legacy value the editor baseline could not carry. The baseline no longer reports one: every
|
|
347
|
+
* such value falls back to its default, so a fresh `mappingConflicts` is `[]`. The type stays for a
|
|
348
|
+
* draft stored before that change, which keeps its conflicts until it is discarded.
|
|
349
|
+
*/
|
|
339
350
|
interface StorefrontDesignMappingConflict {
|
|
340
351
|
path: string;
|
|
341
352
|
code: 'LEGACY_MULTIPLE_PRODUCT_FEEDS' | 'LEGACY_UNMAPPED_CONTENT';
|
|
@@ -344,8 +355,10 @@ declare global {
|
|
|
344
355
|
interface StorefrontEditorBaseline {
|
|
345
356
|
legacyRevision?: number;
|
|
346
357
|
document: StorefrontDesignV1;
|
|
358
|
+
/** Always `[]`: an invalid colour, an unmapped Home switch, the banner and every refused or oversized literal fall back to defaults. */
|
|
347
359
|
mappingConflicts: StorefrontDesignMappingConflict[];
|
|
348
360
|
legacySourceRevision: string;
|
|
361
|
+
/** 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
362
|
legacyLogo?: {
|
|
350
363
|
source: 'store.photoURL';
|
|
351
364
|
key: string;
|
|
@@ -386,6 +399,7 @@ declare global {
|
|
|
386
399
|
publishedRevision: null;
|
|
387
400
|
document: StorefrontDesignV1;
|
|
388
401
|
dirty: false;
|
|
402
|
+
/** Always `[]` (see `StorefrontEditorBaseline`). */
|
|
389
403
|
mappingConflicts: StorefrontDesignMappingConflict[];
|
|
390
404
|
legacySourceRevision: string;
|
|
391
405
|
}
|
|
@@ -425,6 +439,7 @@ declare global {
|
|
|
425
439
|
publishedRevision: string | null;
|
|
426
440
|
document: StorefrontDesignV1;
|
|
427
441
|
dirty: boolean;
|
|
442
|
+
/** Empty for a draft seeded now; only a draft stored before the baseline stopped reporting conflicts carries any. */
|
|
428
443
|
mappingConflicts: StorefrontDesignMappingConflict[];
|
|
429
444
|
legacySourceRevision: string;
|
|
430
445
|
/**
|
|
@@ -440,7 +455,7 @@ declare global {
|
|
|
440
455
|
* content, a link to a disabled or missing page (`DANGLING_REFERENCE`), a slug a published
|
|
441
456
|
* page still owns (`ALIAS_CONFLICT`), a page out of aliases (`ALIAS_LIMIT`), and one
|
|
442
457
|
* `MAPPING_CONFLICT` per unresolved `mappingConflicts` entry, at that entry's path (the
|
|
443
|
-
* publish refusal itself names the single path `mappingConflicts
|
|
458
|
+
* publish refusal itself names the single path `mappingConflicts`; a draft seeded now has none). Empty when publishable.
|
|
444
459
|
* Never blocks a save, and never covers asset readiness, which publish probes on its own
|
|
445
460
|
* (`STOREFRONT_ASSET_NOT_READY`).
|
|
446
461
|
*/
|
|
@@ -461,6 +476,7 @@ declare global {
|
|
|
461
476
|
type StorefrontDesignPublishOperationResult = StorefrontDesignPublishResult;
|
|
462
477
|
type StorefrontDesignPublishOperationResponse = StorefrontDesignPublishResponse;
|
|
463
478
|
interface StorefrontDesignPublishResult {
|
|
479
|
+
/** Only adjustments to a colour the design itself sets; a default colour is never listed. */
|
|
464
480
|
changeSummary: {
|
|
465
481
|
contrastAdjustments: StorefrontThemeWarning[];
|
|
466
482
|
};
|
|
@@ -526,6 +542,19 @@ declare global {
|
|
|
526
542
|
inStock?: 'true';
|
|
527
543
|
isNew?: 'true';
|
|
528
544
|
startKey?: string;
|
|
545
|
+
}
|
|
546
|
+
/**
|
|
547
|
+
* Web `GET /products?updatedAt=`'s recency listing (the shop's «Ingresos» page), with the
|
|
548
|
+
* same rows and cursor shape, in the grant's store: enabled products updated after
|
|
549
|
+
* `updatedAt` (epoch ms, digits), newest first; `LastEvaluatedKey` resumes as `startKey`.
|
|
550
|
+
* Non-digits or a `startKey` over 2048 characters answer 400 `STOREFRONT_PREVIEW_INVALID`;
|
|
551
|
+
* an `updatedAt` past `Number.MAX_SAFE_INTEGER` answers 400 `INVALID_UPDATED_AT`; a
|
|
552
|
+
* malformed or foreign `startKey` answers 400 `INVALID_CURSOR`.
|
|
553
|
+
*/
|
|
554
|
+
| {
|
|
555
|
+
operation: 'incomes';
|
|
556
|
+
updatedAt?: string;
|
|
557
|
+
startKey?: string;
|
|
529
558
|
} | {
|
|
530
559
|
operation: 'group';
|
|
531
560
|
groupId: string;
|
|
@@ -736,7 +765,7 @@ declare global {
|
|
|
736
765
|
data: StorefrontDesignPreviewResult;
|
|
737
766
|
} | StorefrontDesignFailure;
|
|
738
767
|
}
|
|
739
|
-
export declare const STOREFRONT_PREVIEW_READ_OPERATIONS: readonly ["design", "store", "product", "productBySlug", "productsByIds", "products", "group", "related", "categories", "brands", "tags", "collection", "paymentMethods", "deliveryMethods", "asset"];
|
|
768
|
+
export declare const STOREFRONT_PREVIEW_READ_OPERATIONS: readonly ["design", "store", "product", "productBySlug", "productsByIds", "products", "incomes", "group", "related", "categories", "brands", "tags", "collection", "paymentMethods", "deliveryMethods", "asset"];
|
|
740
769
|
/** Checks transport structure and UTF-8 size; unfamiliar section types are skipped, never rendered. */
|
|
741
770
|
export declare function parseStorefrontPreviewDocument(input: unknown): StorefrontPreviewDocument | undefined;
|
|
742
771
|
/** The codes a preview frame may report in an `error` message; the parser accepts exactly these. */
|
package/dist/storefrontDesign.js
CHANGED
|
@@ -68,6 +68,12 @@ export const STOREFRONT_SECTION_TYPES = [
|
|
|
68
68
|
'contact',
|
|
69
69
|
'paymentDelivery',
|
|
70
70
|
];
|
|
71
|
+
/**
|
|
72
|
+
* The storefront routes a design link may target by name. `incomes` is the
|
|
73
|
+
* always-available recency listing (`/products/incomes`); `new` is the separate
|
|
74
|
+
* listing that depends on a feature flag. `brands` and `favorites` map to
|
|
75
|
+
* `/brands` and `/favorites`.
|
|
76
|
+
*/
|
|
71
77
|
export const STOREFRONT_BUILTIN_DESTINATIONS = [
|
|
72
78
|
'home',
|
|
73
79
|
'catalogue',
|
|
@@ -77,6 +83,9 @@ export const STOREFRONT_BUILTIN_DESTINATIONS = [
|
|
|
77
83
|
'cart',
|
|
78
84
|
'account',
|
|
79
85
|
'privacy',
|
|
86
|
+
'brands',
|
|
87
|
+
'favorites',
|
|
88
|
+
'incomes',
|
|
80
89
|
];
|
|
81
90
|
/**
|
|
82
91
|
* The built-in destinations that must stay reachable whatever a design does with
|
|
@@ -156,6 +165,7 @@ export const STOREFRONT_PREVIEW_READ_OPERATIONS = [
|
|
|
156
165
|
'productBySlug',
|
|
157
166
|
'productsByIds',
|
|
158
167
|
'products',
|
|
168
|
+
'incomes',
|
|
159
169
|
'group',
|
|
160
170
|
'related',
|
|
161
171
|
'categories',
|
|
@@ -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
|
};
|