platform-types 1.10.696 → 1.10.698
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,11 @@
|
|
|
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
|
+
/*
|
|
6
|
+
* The one binding of a warning role and of a surface to the setting it reads: `surfaceTokens`
|
|
7
|
+
* and `makeMode` read the colours THROUGH these maps, and the `warnings` filter judges by them,
|
|
8
|
+
* so the tokens and the "design caused it" filter cannot name different settings.
|
|
9
|
+
*/
|
|
5
10
|
const WARNING_SETTING = {
|
|
6
11
|
link: 'primaryColor',
|
|
7
12
|
button: 'primaryColor',
|
|
@@ -54,22 +59,23 @@ const ensureContrast = (color, background, minimum) => {
|
|
|
54
59
|
return target;
|
|
55
60
|
};
|
|
56
61
|
const surfaceTokens = (background, settings, mode, surface, warnings) => {
|
|
57
|
-
const adjusted = (role,
|
|
62
|
+
const adjusted = (role, minimum) => {
|
|
63
|
+
const requested = settings[WARNING_SETTING[role]];
|
|
58
64
|
const effective = ensureContrast(requested, background, minimum);
|
|
59
65
|
if (effective !== requested.toUpperCase())
|
|
60
66
|
warnings.push({ mode, surface, role, requested, effective });
|
|
61
67
|
return effective;
|
|
62
68
|
};
|
|
63
69
|
const text = readableText(background);
|
|
64
|
-
const button = adjusted('button',
|
|
70
|
+
const button = adjusted('button', 3);
|
|
65
71
|
const hover = ensureContrast(mix(button, readableText(background), 0.2), background, 3);
|
|
66
72
|
const disabledBackground = mix(background, text, 0.12);
|
|
67
73
|
return {
|
|
68
74
|
background,
|
|
69
75
|
text,
|
|
70
76
|
secondaryText: ensureContrast(mix(background, text, 0.6), background, 4.5),
|
|
71
|
-
link: adjusted('link',
|
|
72
|
-
focus: adjusted('focus',
|
|
77
|
+
link: adjusted('link', 4.5),
|
|
78
|
+
focus: adjusted('focus', 3),
|
|
73
79
|
border: ensureContrast(mix(background, text, 0.3), background, 3),
|
|
74
80
|
button: { background: button, text: readableText(button), hover, hoverText: readableText(hover) },
|
|
75
81
|
disabled: { background: disabledBackground, text: readableText(disabledBackground) },
|
|
@@ -117,11 +123,8 @@ const resolveStorefrontTheme = (overrides = {}, globalsRow) => {
|
|
|
117
123
|
const warnings = [];
|
|
118
124
|
const makeMode = (mode) => {
|
|
119
125
|
const background = (requested) => mode === 'light' ? requested.toUpperCase() : mix(requested, '#000000', 0.9);
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
header: surfaceTokens(background(settings.headerColor), settings, mode, 'header', warnings),
|
|
123
|
-
footer: surfaceTokens(background(settings.footerColor), settings, mode, 'footer', warnings),
|
|
124
|
-
};
|
|
126
|
+
const surface = (id) => surfaceTokens(background(settings[SURFACE_SETTING[id]]), settings, mode, id, warnings);
|
|
127
|
+
return { page: surface('page'), header: surface('header'), footer: surface('footer') };
|
|
125
128
|
};
|
|
126
129
|
const scale = { compact: 0.875, standard: 1, large: 1.125 }[settings.textSize];
|
|
127
130
|
return {
|
|
@@ -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
|
|
@@ -352,7 +358,11 @@ declare global {
|
|
|
352
358
|
/** Always `[]`: an invalid colour, an unmapped Home switch, the banner and every refused or oversized literal fall back to defaults. */
|
|
353
359
|
mappingConflicts: StorefrontDesignMappingConflict[];
|
|
354
360
|
legacySourceRevision: string;
|
|
355
|
-
/**
|
|
361
|
+
/**
|
|
362
|
+
* The store's own logo, offered as a suggestion; init copies it into `branding.logo`. A logo
|
|
363
|
+
* that is not adoptable or would exceed the asset capacity leaves no logo and no conflict;
|
|
364
|
+
* any other copy failure answers 503 `STOREFRONT_DRAFT_UNAVAILABLE`.
|
|
365
|
+
*/
|
|
356
366
|
legacyLogo?: {
|
|
357
367
|
source: 'store.photoURL';
|
|
358
368
|
key: string;
|
|
@@ -470,7 +480,11 @@ declare global {
|
|
|
470
480
|
type StorefrontDesignPublishOperationResult = StorefrontDesignPublishResult;
|
|
471
481
|
type StorefrontDesignPublishOperationResponse = StorefrontDesignPublishResponse;
|
|
472
482
|
interface StorefrontDesignPublishResult {
|
|
473
|
-
/**
|
|
483
|
+
/**
|
|
484
|
+
* Only adjustments the design itself caused: the adjusted colour, or the background of the
|
|
485
|
+
* surface it sits on, is set by the design. So a default primary or accent colour IS listed
|
|
486
|
+
* when the design sets that surface's background.
|
|
487
|
+
*/
|
|
474
488
|
changeSummary: {
|
|
475
489
|
contrastAdjustments: StorefrontThemeWarning[];
|
|
476
490
|
};
|
|
@@ -536,6 +550,21 @@ declare global {
|
|
|
536
550
|
inStock?: 'true';
|
|
537
551
|
isNew?: 'true';
|
|
538
552
|
startKey?: string;
|
|
553
|
+
}
|
|
554
|
+
/**
|
|
555
|
+
* Web `GET /products?updatedAt=`'s recency listing (the shop's «Ingresos» page), with the
|
|
556
|
+
* same rows and cursor shape, in the grant's store: enabled products updated after
|
|
557
|
+
* `updatedAt` (epoch ms), newest first; `LastEvaluatedKey` resumes as `startKey`. The web
|
|
558
|
+
* route's one rule: an absent or empty `updatedAt` reads from 0; anything but digits within
|
|
559
|
+
* `Number.MAX_SAFE_INTEGER` (`1e5`, `-5`, `0x10`, a blank) answers 400 `INVALID_UPDATED_AT`,
|
|
560
|
+
* on both routes alike. An `updatedAt` over 32 characters or a `startKey` over 2048 answers
|
|
561
|
+
* 400 `STOREFRONT_PREVIEW_INVALID`; a malformed or foreign `startKey` answers 400
|
|
562
|
+
* `INVALID_CURSOR`.
|
|
563
|
+
*/
|
|
564
|
+
| {
|
|
565
|
+
operation: 'incomes';
|
|
566
|
+
updatedAt?: string;
|
|
567
|
+
startKey?: string;
|
|
539
568
|
} | {
|
|
540
569
|
operation: 'group';
|
|
541
570
|
groupId: string;
|
|
@@ -581,10 +610,12 @@ declare global {
|
|
|
581
610
|
/**
|
|
582
611
|
* The codes a catalogue operation answers through its public web route's own core, as that
|
|
583
612
|
* route does: 404 `PRODUCT_NOT_FOUND` / `PRODUCT_GROUP_NOT_FOUND` / `COLLECTION_NOT_FOUND`,
|
|
584
|
-
* 400 `INVALID_CURSOR` / `INVALID_DISCOVERY_QUERY
|
|
585
|
-
*
|
|
613
|
+
* 400 `INVALID_CURSOR` / `INVALID_DISCOVERY_QUERY` / `INVALID_UPDATED_AT` (an `incomes`
|
|
614
|
+
* `updatedAt` that is not digits within the safe-integer range), 409 `CURSOR_STALE` (a
|
|
615
|
+
* collection that changed between the reads bracketing a page) and 503
|
|
616
|
+
* `PRODUCT_LOOKUP_INCOMPLETE`.
|
|
586
617
|
*/
|
|
587
|
-
type StorefrontPreviewCatalogueErrorCode = 'PRODUCT_NOT_FOUND' | 'PRODUCT_GROUP_NOT_FOUND' | 'COLLECTION_NOT_FOUND' | 'INVALID_CURSOR' | 'INVALID_DISCOVERY_QUERY' | 'CURSOR_STALE' | 'PRODUCT_LOOKUP_INCOMPLETE';
|
|
618
|
+
type StorefrontPreviewCatalogueErrorCode = 'PRODUCT_NOT_FOUND' | 'PRODUCT_GROUP_NOT_FOUND' | 'COLLECTION_NOT_FOUND' | 'INVALID_CURSOR' | 'INVALID_DISCOVERY_QUERY' | 'INVALID_UPDATED_AT' | 'CURSOR_STALE' | 'PRODUCT_LOOKUP_INCOMPLETE';
|
|
588
619
|
interface StorefrontPreviewReadFailure {
|
|
589
620
|
message: string;
|
|
590
621
|
error: StorefrontPreviewReadErrorCode | StorefrontPreviewCatalogueErrorCode;
|
|
@@ -746,7 +777,7 @@ declare global {
|
|
|
746
777
|
data: StorefrontDesignPreviewResult;
|
|
747
778
|
} | StorefrontDesignFailure;
|
|
748
779
|
}
|
|
749
|
-
export declare const STOREFRONT_PREVIEW_READ_OPERATIONS: readonly ["design", "store", "product", "productBySlug", "productsByIds", "products", "group", "related", "categories", "brands", "tags", "collection", "paymentMethods", "deliveryMethods", "asset"];
|
|
780
|
+
export declare const STOREFRONT_PREVIEW_READ_OPERATIONS: readonly ["design", "store", "product", "productBySlug", "productsByIds", "products", "incomes", "group", "related", "categories", "brands", "tags", "collection", "paymentMethods", "deliveryMethods", "asset"];
|
|
750
781
|
/** Checks transport structure and UTF-8 size; unfamiliar section types are skipped, never rendered. */
|
|
751
782
|
export declare function parseStorefrontPreviewDocument(input: unknown): StorefrontPreviewDocument | undefined;
|
|
752
783
|
/** 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',
|
package/dist/storefrontTheme.js
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import { resolveStorefrontDesignSettings, validateStorefrontDesignSetting, } from "./storefrontDesignRegistry.js";
|
|
2
|
+
/*
|
|
3
|
+
* The one binding of a warning role and of a surface to the setting it reads: `surfaceTokens`
|
|
4
|
+
* and `makeMode` read the colours THROUGH these maps, and the `warnings` filter judges by them,
|
|
5
|
+
* so the tokens and the "design caused it" filter cannot name different settings.
|
|
6
|
+
*/
|
|
2
7
|
const WARNING_SETTING = {
|
|
3
8
|
link: 'primaryColor',
|
|
4
9
|
button: 'primaryColor',
|
|
@@ -50,22 +55,23 @@ const ensureContrast = (color, background, minimum) => {
|
|
|
50
55
|
return target;
|
|
51
56
|
};
|
|
52
57
|
const surfaceTokens = (background, settings, mode, surface, warnings) => {
|
|
53
|
-
const adjusted = (role,
|
|
58
|
+
const adjusted = (role, minimum) => {
|
|
59
|
+
const requested = settings[WARNING_SETTING[role]];
|
|
54
60
|
const effective = ensureContrast(requested, background, minimum);
|
|
55
61
|
if (effective !== requested.toUpperCase())
|
|
56
62
|
warnings.push({ mode, surface, role, requested, effective });
|
|
57
63
|
return effective;
|
|
58
64
|
};
|
|
59
65
|
const text = readableText(background);
|
|
60
|
-
const button = adjusted('button',
|
|
66
|
+
const button = adjusted('button', 3);
|
|
61
67
|
const hover = ensureContrast(mix(button, readableText(background), 0.2), background, 3);
|
|
62
68
|
const disabledBackground = mix(background, text, 0.12);
|
|
63
69
|
return {
|
|
64
70
|
background,
|
|
65
71
|
text,
|
|
66
72
|
secondaryText: ensureContrast(mix(background, text, 0.6), background, 4.5),
|
|
67
|
-
link: adjusted('link',
|
|
68
|
-
focus: adjusted('focus',
|
|
73
|
+
link: adjusted('link', 4.5),
|
|
74
|
+
focus: adjusted('focus', 3),
|
|
69
75
|
border: ensureContrast(mix(background, text, 0.3), background, 3),
|
|
70
76
|
button: { background: button, text: readableText(button), hover, hoverText: readableText(hover) },
|
|
71
77
|
disabled: { background: disabledBackground, text: readableText(disabledBackground) },
|
|
@@ -111,11 +117,8 @@ export const resolveStorefrontTheme = (overrides = {}, globalsRow) => {
|
|
|
111
117
|
const warnings = [];
|
|
112
118
|
const makeMode = (mode) => {
|
|
113
119
|
const background = (requested) => mode === 'light' ? requested.toUpperCase() : mix(requested, '#000000', 0.9);
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
header: surfaceTokens(background(settings.headerColor), settings, mode, 'header', warnings),
|
|
117
|
-
footer: surfaceTokens(background(settings.footerColor), settings, mode, 'footer', warnings),
|
|
118
|
-
};
|
|
120
|
+
const surface = (id) => surfaceTokens(background(settings[SURFACE_SETTING[id]]), settings, mode, id, warnings);
|
|
121
|
+
return { page: surface('page'), header: surface('header'), footer: surface('footer') };
|
|
119
122
|
};
|
|
120
123
|
const scale = { compact: 0.875, standard: 1, large: 1.125 }[settings.textSize];
|
|
121
124
|
return {
|