platform-types 1.10.695 → 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.
@@ -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 theme.
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;
@@ -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`). Empty when publishable.
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 theme.
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 {};
@@ -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 theme.
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
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "platform-types",
3
- "version": "1.10.695",
3
+ "version": "1.10.696",
4
4
  "description": "Shared wire and entity contracts for the platform.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",