platform-types 1.10.677 → 1.10.679

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.
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.MAX_STOREFRONT_ASSETS = exports.STOREFRONT_ASSET_VARIANTS = void 0;
4
+ const storefrontDesign_ts_1 = require("./storefrontDesign.js");
4
5
  exports.STOREFRONT_ASSET_VARIANTS = [
5
6
  'original',
6
7
  '200x200',
@@ -9,4 +10,5 @@ exports.STOREFRONT_ASSET_VARIANTS = [
9
10
  '1200x1200',
10
11
  '1600x1600',
11
12
  ];
12
- exports.MAX_STOREFRONT_ASSETS = 200;
13
+ /** The active-asset cap, the same value as `STOREFRONT_DESIGN_LIMITS.activeImages` by construction. */
14
+ exports.MAX_STOREFRONT_ASSETS = storefrontDesign_ts_1.STOREFRONT_DESIGN_LIMITS.activeImages;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.STOREFRONT_SOCIAL_HOSTS = exports.STOREFRONT_BENEFIT_ICONS = exports.STOREFRONT_RESERVED_SLUGS = exports.STOREFRONT_CONTACT_FIELDS = exports.STOREFRONT_BUILTIN_DESTINATIONS = exports.STOREFRONT_SECTION_TYPES = exports.STOREFRONT_DESIGN_LIMITS = void 0;
3
+ exports.STOREFRONT_SOCIAL_HOSTS = exports.STOREFRONT_BENEFIT_ICONS = exports.STOREFRONT_RESERVED_SLUGS = exports.STOREFRONT_CONTACT_FIELDS = exports.STOREFRONT_PROTECTED_BUILTIN_DESTINATIONS = exports.STOREFRONT_BUILTIN_DESTINATIONS = exports.STOREFRONT_SECTION_TYPES = exports.STOREFRONT_DESIGN_LIMITS = void 0;
4
4
  exports.createStorefrontDesignV1 = createStorefrontDesignV1;
5
5
  exports.STOREFRONT_DESIGN_LIMITS = {
6
6
  customPages: 20,
@@ -24,6 +24,8 @@ exports.STOREFRONT_DESIGN_LIMITS = {
24
24
  seoTitle: 120,
25
25
  seoDescription: 320,
26
26
  imageAlt: 250,
27
+ assetFilename: 255,
28
+ assetSearch: 80,
27
29
  activeImages: 200,
28
30
  imageDecodedBytes: 4 * 1024 * 1024,
29
31
  imagePixels: 32_000_000,
@@ -58,7 +60,21 @@ exports.STOREFRONT_BUILTIN_DESTINATIONS = [
58
60
  'cart',
59
61
  'account',
60
62
  'privacy',
61
- 'terms',
63
+ ];
64
+ /**
65
+ * The built-in destinations that must stay reachable whatever a design does with
66
+ * its menus: search, cart, account and the required legal page. Reachability is
67
+ * owned by the storefront's platform chrome, not by the design: the storefront
68
+ * always renders these outside merchant menus and footer groups, so no design can
69
+ * remove or repoint them. A design may still link to them. Editors show them as
70
+ * fixed, non-editable entries. `parseStorefrontDesign` therefore does not refuse
71
+ * a document whose menus omit them.
72
+ */
73
+ exports.STOREFRONT_PROTECTED_BUILTIN_DESTINATIONS = [
74
+ 'search',
75
+ 'cart',
76
+ 'account',
77
+ 'privacy',
62
78
  ];
63
79
  exports.STOREFRONT_CONTACT_FIELDS = ['email', 'phone', 'whatsapp', 'address', 'hours', 'socials'];
64
80
  exports.STOREFRONT_RESERVED_SLUGS = [
@@ -91,6 +107,14 @@ exports.STOREFRONT_RESERVED_SLUGS = [
91
107
  'admin',
92
108
  'storefront',
93
109
  'pagina',
110
+ 'basket',
111
+ 'profile',
112
+ 'favorites',
113
+ 'invoices',
114
+ 'payments',
115
+ 'payment-methods',
116
+ 'user',
117
+ 'mantenimiento',
94
118
  ];
95
119
  exports.STOREFRONT_BENEFIT_ICONS = ['truck', 'shield', 'credit-card', 'store', 'heart', 'check'];
96
120
  exports.STOREFRONT_SOCIAL_HOSTS = {
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.STOREFRONT_DESIGN_REGISTRY = exports.resolveStorefrontDesignSettings = exports.resolveStorefrontDesignSettingsLayers = exports.STOREFRONT_DESIGN_LITERAL_MAX_CODE_POINTS = exports.validateStorefrontDesignSetting = exports.validateStorefrontSettingValue = exports.isStorefrontDesignSettingKey = exports.STOREFRONT_DESIGN_SETTINGS = void 0;
3
+ exports.isStorefrontEditorLiteralKey = exports.STOREFRONT_EDITOR_LITERAL_DEFAULTS = exports.resolveStorefrontLiveSettings = exports.isStorefrontLiveSettingKey = exports.STOREFRONT_LIVE_SETTING_KEYS = exports.STOREFRONT_DESIGN_REGISTRY = exports.resolveStorefrontDesignSettings = exports.resolveStorefrontDesignSettingsLayers = exports.STOREFRONT_DESIGN_LITERAL_MAX_CODE_POINTS = exports.validateStorefrontDesignSetting = exports.validateStorefrontSettingValue = exports.isStorefrontDesignSettingKey = exports.STOREFRONT_DESIGN_SETTINGS = void 0;
4
4
  const DESIGN_METADATA = {
5
5
  scope: 'storefront',
6
6
  allowedLayers: ['GLOBAL', 'WEB', 'WEB#store'],
@@ -100,6 +100,16 @@ const LIVE_METADATA = {
100
100
  ownership: 'storefront-operation',
101
101
  excludedFromSnapshot: true,
102
102
  };
103
+ const liveToggle = (key, labelKey, helpKey, label, help) => ({
104
+ ...LIVE_METADATA,
105
+ key,
106
+ allowedLayers: ['WEB#store'],
107
+ storage: { source: 'store', override: 'ecommerce.config' },
108
+ defaultValue: true,
109
+ valueType: 'boolean',
110
+ valueSchema: { type: 'boolean' },
111
+ literal: { kind: 'key', label: labelKey, help: helpKey, defaults: { label, help } },
112
+ });
103
113
  exports.STOREFRONT_DESIGN_REGISTRY = {
104
114
  settings: exports.STOREFRONT_DESIGN_SETTINGS,
105
115
  content: {
@@ -118,9 +128,9 @@ exports.STOREFRONT_DESIGN_REGISTRY = {
118
128
  storage: { source: 'LITERALS', override: 'design.literalOverrides' },
119
129
  },
120
130
  live: {
121
- showIvaAlert: { ...LIVE_METADATA, storage: { source: 'featureFlags' } },
122
- showCurrencySelector: { ...LIVE_METADATA, storage: { source: 'featureFlags' } },
123
- enableSaveForLater: { ...LIVE_METADATA, storage: { source: 'featureFlags' } },
131
+ showIvaAlert: liveToggle('showIvaAlert', 'STOREFRONT_SHOW_IVA_ALERT_LABEL', 'STOREFRONT_SHOW_IVA_ALERT_HELP', 'Mostrar aviso de IVA', 'Mostrar el aviso de IVA incluido en los precios.'),
132
+ showCurrencySelector: liveToggle('showCurrencySelector', 'STOREFRONT_SHOW_CURRENCY_SELECTOR_LABEL', 'STOREFRONT_SHOW_CURRENCY_SELECTOR_HELP', 'Mostrar selector de moneda', 'Permitir elegir la moneda de visualización en la tienda.'),
133
+ enableSaveForLater: liveToggle('enableSaveForLater', 'STOREFRONT_ENABLE_SAVE_FOR_LATER_LABEL', 'STOREFRONT_ENABLE_SAVE_FOR_LATER_HELP', 'Permitir guardar para después', 'Mostrar los controles para guardar productos de la cesta para después.'),
124
134
  prices: { ...LIVE_METADATA, storage: { source: 'catalogue' } },
125
135
  stock: { ...LIVE_METADATA, storage: { source: 'catalogue' } },
126
136
  checkout: { ...LIVE_METADATA, storage: { source: 'store' } },
@@ -128,3 +138,26 @@ exports.STOREFRONT_DESIGN_REGISTRY = {
128
138
  availability: { ...LIVE_METADATA, storage: { source: 'store' } },
129
139
  },
130
140
  };
141
+ exports.STOREFRONT_LIVE_SETTING_KEYS = Object.keys(exports.STOREFRONT_DESIGN_REGISTRY.live).filter((key) => 'valueSchema' in exports.STOREFRONT_DESIGN_REGISTRY.live[key]);
142
+ const isStorefrontLiveSettingKey = (key) => exports.STOREFRONT_LIVE_SETTING_KEYS.some((candidate) => candidate === key);
143
+ exports.isStorefrontLiveSettingKey = isStorefrontLiveSettingKey;
144
+ const liveBoolean = (source, key) => {
145
+ if (!source || typeof source !== 'object' || Array.isArray(source) || !Object.hasOwn(source, key))
146
+ return undefined;
147
+ const value = source[key];
148
+ return typeof value === 'boolean' ? value : undefined;
149
+ };
150
+ const resolveStorefrontLiveSettings = (canonical, legacy) => Object.fromEntries(exports.STOREFRONT_LIVE_SETTING_KEYS.map((key) => [
151
+ key,
152
+ liveBoolean(canonical, key) ?? liveBoolean(legacy, key) ?? exports.STOREFRONT_DESIGN_REGISTRY.live[key].defaultValue,
153
+ ]));
154
+ exports.resolveStorefrontLiveSettings = resolveStorefrontLiveSettings;
155
+ exports.STOREFRONT_EDITOR_LITERAL_DEFAULTS = Object.fromEntries(exports.STOREFRONT_LIVE_SETTING_KEYS.flatMap((key) => {
156
+ const { literal } = exports.STOREFRONT_DESIGN_REGISTRY.live[key];
157
+ return [
158
+ [literal.label, literal.defaults.label],
159
+ [literal.help, literal.defaults.help],
160
+ ];
161
+ }));
162
+ const isStorefrontEditorLiteralKey = (key) => Object.hasOwn(exports.STOREFRONT_EDITOR_LITERAL_DEFAULTS, key);
163
+ exports.isStorefrontEditorLiteralKey = isStorefrontEditorLiteralKey;
@@ -65,6 +65,13 @@ const surfaceTokens = (background, settings, mode, surface, warnings) => {
65
65
  disabled: { background: disabledBackground, text: readableText(disabledBackground) },
66
66
  };
67
67
  };
68
+ /**
69
+ * The storefront theme for a design's settings overrides.
70
+ *
71
+ * Settings resolve from the registry defaults plus the store's own design
72
+ * overrides ONLY — no GLOBAL or WEB layer takes part — so a consumer uses this
73
+ * as shipped rather than merging layers of its own first.
74
+ */
68
75
  const resolveStorefrontTheme = (overrides = {}) => {
69
76
  const settings = (0, storefrontDesignRegistry_ts_1.resolveStorefrontDesignSettings)(overrides);
70
77
  const warnings = [];
@@ -22,6 +22,8 @@ declare global {
22
22
  /** Absent when no store was requested — the chain is then global-only. */
23
23
  storeId?: string;
24
24
  layers: LiteralLayer[];
25
+ /** APP only: live storefront editor copy resolved from registry defaults and this scope chain. */
26
+ editorLiterals?: ResolvedStorefrontEditorLiterals;
25
27
  }
26
28
  /**
27
29
  * Legacy mode — the response when NO `surface` is sent. A single already-merged
package/dist/store.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import type { ArgentineProvince } from './provinces.ts';
2
+ import type { StorefrontLiveSettingKey } from './storefrontDesignRegistry.ts';
2
3
  declare global {
3
4
  /**
4
5
  * One tenant-authored Cmd-K palette entry (`store.palette.custom[]`).
@@ -112,7 +113,7 @@ declare global {
112
113
  * there); never sent to shoppers.
113
114
  */
114
115
  deactivatesAt?: number | null;
115
- config?: {
116
+ config?: Partial<StorefrontLiveSettings> & {
116
117
  showDefaultPriceList?: number;
117
118
  showStocks?: boolean;
118
119
  };
@@ -151,6 +152,17 @@ declare global {
151
152
  appVersion?: number;
152
153
  stats?: Record<string, string>;
153
154
  }
155
+ /** Sparse tenant PATCH shape; live null values reset to registry defaults and are never stored. */
156
+ interface EcommercePatchInput {
157
+ config?: Pick<NonNullable<Ecommerce['config']>, 'showDefaultPriceList'> & StorefrontLiveSettingsPatch;
158
+ sidebar?: Ecommerce['sidebar'];
159
+ home?: Omit<NonNullable<Ecommerce['home']>, 'displayOrders' | 'displayProfile'>;
160
+ themeColors?: Ecommerce['themeColors'];
161
+ }
162
+ /** Platform override retains its wider surface and the same live-setting reset semantics. */
163
+ type EcommerceAdminOverrideInput = Omit<Ecommerce, 'config' | 'deactivatesAt' | 'stats'> & {
164
+ config?: Omit<NonNullable<Ecommerce['config']>, StorefrontLiveSettingKey> & StorefrontLiveSettingsPatch;
165
+ };
154
166
  /**
155
167
  * Platform globals forwarded to a tenant session on `GET /store`.
156
168
  *
@@ -1444,13 +1456,14 @@ declare global {
1444
1456
  * BE; `afip`/`mercadopago` bodies are re-routed to per-leaf integration
1445
1457
  * writes rather than SET wholesale.
1446
1458
  */
1447
- interface StoreUpdateInput extends Partial<Omit<Store, 'photoData' | 'removePhotoURL' | 'config'>> {
1459
+ interface StoreUpdateInput extends Partial<Omit<Store, 'photoData' | 'removePhotoURL' | 'config' | 'ecommerce'>> {
1448
1460
  /**
1449
1461
  * Partial, and `maxLineDiscountPercent` is nullable to clear it — neither
1450
1462
  * of which `Partial<Store>['config']` can express, which is why `config`
1451
1463
  * is omitted from the extends clause above rather than inherited.
1452
1464
  */
1453
1465
  config?: StoreConfigPatchInput;
1466
+ ecommerce?: EcommercePatchInput;
1454
1467
  /** Transient base64 image upload; the BE stores the derived `photoURL`, never this. */
1455
1468
  photoData?: string;
1456
1469
  /** Request-only: asks the BE to delete the current photo. */
@@ -1510,7 +1523,7 @@ declare global {
1510
1523
  /** @deprecated Same retirement as `Store['config']['defaultAccountCurrency']` — still accepted by `platform/_storeConfigPut.ts`, no new writers. */
1511
1524
  defaultAccountCurrency?: string;
1512
1525
  };
1513
- ecommerce?: Ecommerce;
1526
+ ecommerce?: EcommerceAdminOverrideInput;
1514
1527
  reason: string;
1515
1528
  }
1516
1529
  /**
@@ -1,7 +1,8 @@
1
1
  export declare const STOREFRONT_ASSET_VARIANTS: readonly ["original", "200x200", "400x400", "800x800", "1200x1200", "1600x1600"];
2
- export declare const MAX_STOREFRONT_ASSETS = 200;
2
+ /** The active-asset cap, the same value as `STOREFRONT_DESIGN_LIMITS.activeImages` by construction. */
3
+ export declare const MAX_STOREFRONT_ASSETS: 200;
3
4
  declare global {
4
- type StorefrontAssetErrorCode = 'ROLE_FORBIDDEN' | 'PLAN_UPGRADE_REQUIRED' | 'SUBSCRIPTION_READONLY' | 'STOREFRONT_ASSET_ENTITLEMENT_UNAVAILABLE' | 'STOREFRONT_ASSET_REQUEST_TOO_LARGE' | 'STOREFRONT_ASSET_TIMEOUT' | 'VALIDATION_FAILED' | 'ASSET_ARCHIVE_UNCERTAIN' | 'ASSET_CAPACITY_EXCEEDED' | 'ASSET_NOT_FOUND' | 'ASSET_REQUEST_CONFLICT' | 'ASSET_STORAGE_CONFLICT' | 'ASSET_TOO_LARGE' | 'ASSET_UPLOAD_FAILED' | 'ASSET_UPLOAD_PENDING' | 'ASSET_UPLOAD_UNCERTAIN' | 'INVALID_ACTOR' | 'INVALID_ASSET_CURSOR' | 'INVALID_ASSET_ID' | 'INVALID_ASSET_IMAGE' | 'INVALID_ASSET_LIMIT' | 'INVALID_ASSET_PLACEMENT' | 'INVALID_ASSET_STAGE' | 'INVALID_ASSET_VARIANT' | 'INVALID_REQUEST_ID' | 'INVALID_STORE_CONTEXT' | 'LEGACY_LOGO_MAPPING_CONFLICT';
5
+ type StorefrontAssetErrorCode = 'ROLE_FORBIDDEN' | 'PLAN_UPGRADE_REQUIRED' | 'SUBSCRIPTION_READONLY' | 'STOREFRONT_ASSET_ENTITLEMENT_UNAVAILABLE' | 'STOREFRONT_ASSET_REQUEST_TOO_LARGE' | 'STOREFRONT_ASSET_TIMEOUT' | 'VALIDATION_FAILED' | 'ASSET_ARCHIVE_UNCERTAIN' | 'ASSET_ARCHIVED' | 'ASSET_CAPACITY_EXCEEDED' | 'ASSET_NOT_FOUND' | 'ASSET_REQUEST_CONFLICT' | 'ASSET_STORAGE_CONFLICT' | 'ASSET_TOO_LARGE' | 'ASSET_UPDATE_UNCERTAIN' | 'ASSET_UPLOAD_FAILED' | 'ASSET_UPLOAD_PENDING' | 'ASSET_UPLOAD_UNCERTAIN' | 'INVALID_ACTOR' | 'INVALID_ASSET_CURSOR' | 'INVALID_ASSET_ID' | 'INVALID_ASSET_IMAGE' | 'INVALID_ASSET_LIMIT' | 'INVALID_ASSET_PLACEMENT' | 'INVALID_ASSET_SEARCH' | 'INVALID_ASSET_STAGE' | 'INVALID_ASSET_VARIANT' | 'INVALID_REQUEST_ID' | 'INVALID_STORE_CONTEXT' | 'LEGACY_LOGO_MAPPING_CONFLICT';
5
6
  interface StorefrontAssetResponse {
6
7
  message: string;
7
8
  data: StorefrontAsset;
@@ -21,18 +22,51 @@ declare global {
21
22
  source?: EntitlementSource;
22
23
  requiredPlan?: PlanTier | null;
23
24
  currentPlan?: PlanTier | null;
25
+ currentStatus?: SubscriptionStatus;
24
26
  }
25
27
  type StorefrontAssetVariant = (typeof STOREFRONT_ASSET_VARIANTS)[number];
28
+ /**
29
+ * `filename` is the picked file's name, kept as a basename (any directory
30
+ * part dropped) for the library's search; `label` and `defaultAlt` seed the
31
+ * editor's picker and a NEW placement's alt — a placement carries its own
32
+ * `alt`, so neither is ever read at render time. Each is bounded in code
33
+ * points, and a blank, ill-formed or control-character value is refused
34
+ * 400 `VALIDATION_FAILED`, never cleaned up.
35
+ */
26
36
  interface StorefrontAssetUploadRequest {
27
37
  requestId: string;
28
38
  base64: string;
39
+ filename?: string;
40
+ label?: string;
41
+ defaultAlt?: string;
29
42
  }
30
43
  interface StorefrontAssetArchiveRequest {
31
44
  requestId: string;
32
45
  }
46
+ /**
47
+ * `PATCH /store/design/assets/{assetId}`. An omitted key is left as stored,
48
+ * `null` clears it. Idempotent by `requestId` like archive: the same body
49
+ * replays the first answer, a different body under the same `requestId`
50
+ * answers 409 `ASSET_REQUEST_CONFLICT`. An archived asset answers 409
51
+ * `ASSET_ARCHIVED`. Editing metadata never touches a draft, published or
52
+ * historical placement.
53
+ */
54
+ interface StorefrontAssetMetadataUpdateRequest {
55
+ requestId: string;
56
+ label?: string | null;
57
+ defaultAlt?: string | null;
58
+ }
59
+ /**
60
+ * `search` matches `filename` and `label` case- and accent-insensitively, as
61
+ * a substring. ⚠️ The filter applies AFTER `limit` rows of the active list are
62
+ * read, so a filtered page can hold fewer than `limit` items — even none —
63
+ * and still carry a `cursor`; follow the cursor until it is absent. A cursor
64
+ * is bound to the `search` it was minted under.
65
+ */
33
66
  interface StorefrontAssetListQuery {
34
67
  limit?: number;
35
68
  cursor?: string;
69
+ search?: string;
36
70
  }
37
71
  interface StorefrontAssetFieldError {
38
72
  path: string;
@@ -48,15 +82,10 @@ declare global {
48
82
  height: number;
49
83
  contentType: 'image/jpeg' | 'image/png' | 'image/webp';
50
84
  createdAt: number;
85
+ filename?: string;
86
+ label?: string;
87
+ defaultAlt?: string;
51
88
  }
52
- interface StorefrontAssetPlacement {
53
- assetId: string;
54
- mobileAssetId?: string;
55
- alt?: string;
56
- decorative: boolean;
57
- focalPoint?: {
58
- x: number;
59
- y: number;
60
- };
61
- }
89
+ /** @deprecated Use `StorefrontDesignImagePlacement`; this is the same shape. */
90
+ type StorefrontAssetPlacement = StorefrontDesignImagePlacement;
62
91
  }
@@ -1,3 +1,4 @@
1
+ import { STOREFRONT_DESIGN_LIMITS } from "./storefrontDesign.js";
1
2
  export const STOREFRONT_ASSET_VARIANTS = [
2
3
  'original',
3
4
  '200x200',
@@ -6,4 +7,5 @@ export const STOREFRONT_ASSET_VARIANTS = [
6
7
  '1200x1200',
7
8
  '1600x1600',
8
9
  ];
9
- export const MAX_STOREFRONT_ASSETS = 200;
10
+ /** The active-asset cap, the same value as `STOREFRONT_DESIGN_LIMITS.activeImages` by construction. */
11
+ export const MAX_STOREFRONT_ASSETS = STOREFRONT_DESIGN_LIMITS.activeImages;
@@ -20,6 +20,8 @@ export declare const STOREFRONT_DESIGN_LIMITS: {
20
20
  readonly seoTitle: 120;
21
21
  readonly seoDescription: 320;
22
22
  readonly imageAlt: 250;
23
+ readonly assetFilename: 255;
24
+ readonly assetSearch: 80;
23
25
  readonly activeImages: 200;
24
26
  readonly imageDecodedBytes: number;
25
27
  readonly imagePixels: 32000000;
@@ -34,9 +36,19 @@ export declare const STOREFRONT_DESIGN_LIMITS: {
34
36
  readonly contactEmail: 254;
35
37
  };
36
38
  export declare const STOREFRONT_SECTION_TYPES: readonly ["banner", "imageText", "products", "categories", "brands", "text", "faq", "benefits", "contact", "paymentDelivery"];
37
- export declare const STOREFRONT_BUILTIN_DESTINATIONS: readonly ["home", "catalogue", "offers", "new", "search", "cart", "account", "privacy", "terms"];
39
+ export declare const STOREFRONT_BUILTIN_DESTINATIONS: readonly ["home", "catalogue", "offers", "new", "search", "cart", "account", "privacy"];
40
+ /**
41
+ * The built-in destinations that must stay reachable whatever a design does with
42
+ * its menus: search, cart, account and the required legal page. Reachability is
43
+ * owned by the storefront's platform chrome, not by the design: the storefront
44
+ * always renders these outside merchant menus and footer groups, so no design can
45
+ * remove or repoint them. A design may still link to them. Editors show them as
46
+ * fixed, non-editable entries. `parseStorefrontDesign` therefore does not refuse
47
+ * a document whose menus omit them.
48
+ */
49
+ export declare const STOREFRONT_PROTECTED_BUILTIN_DESTINATIONS: readonly ["search", "cart", "account", "privacy"];
38
50
  export declare const STOREFRONT_CONTACT_FIELDS: readonly ["email", "phone", "whatsapp", "address", "hours", "socials"];
39
- export declare const STOREFRONT_RESERVED_SLUGS: readonly ["home", "index", "api", "auth", "login", "logout", "account", "cart", "checkout", "orders", "search", "products", "product", "producto", "coleccion", "categories", "brands", "sale", "new", "privacy", "terms", "sitemap", "robots", "manifest", "assets", "preview", "admin", "storefront", "pagina"];
51
+ export declare const STOREFRONT_RESERVED_SLUGS: readonly ["home", "index", "api", "auth", "login", "logout", "account", "cart", "checkout", "orders", "search", "products", "product", "producto", "coleccion", "categories", "brands", "sale", "new", "privacy", "terms", "sitemap", "robots", "manifest", "assets", "preview", "admin", "storefront", "pagina", "basket", "profile", "favorites", "invoices", "payments", "payment-methods", "user", "mantenimiento"];
40
52
  export declare const STOREFRONT_BENEFIT_ICONS: readonly ["truck", "shield", "credit-card", "store", "heart", "check"];
41
53
  export declare const STOREFRONT_SOCIAL_HOSTS: {
42
54
  readonly instagram: readonly ["instagram.com", "www.instagram.com"];
@@ -305,6 +317,17 @@ declare global {
305
317
  expiresAt: string;
306
318
  protocolVersion: 1;
307
319
  }
320
+ /**
321
+ * The editor access refusals, answered by the shared editor gate
322
+ * (`stacks/helpers/storefrontEditorGate.ts`) before any editor route reads or
323
+ * writes: 403 `ROLE_FORBIDDEN` (anything but an exact single-role tenant
324
+ * ADMIN), 403 `PLAN_UPGRADE_REQUIRED` (storefront entitlement off), 402
325
+ * `SUBSCRIPTION_READONLY` (a mutating call on a status other than active,
326
+ * trialing or past_due) and 503 `STOREFRONT_ASSET_ENTITLEMENT_UNAVAILABLE`
327
+ * (the entitlement could not be read). The 503 keeps the asset library's name
328
+ * so one gate answers one code on every editor route.
329
+ */
330
+ type StorefrontDesignAccessErrorCode = 'ROLE_FORBIDDEN' | 'PLAN_UPGRADE_REQUIRED' | 'SUBSCRIPTION_READONLY' | 'STOREFRONT_ASSET_ENTITLEMENT_UNAVAILABLE';
308
331
  type StorefrontDesignFailure = {
309
332
  message: string;
310
333
  error: 'STOREFRONT_REVISION_CONFLICT';
@@ -314,6 +337,20 @@ declare global {
314
337
  message: string;
315
338
  error: Exclude<StorefrontDesignErrorCode, 'STOREFRONT_REVISION_CONFLICT'>;
316
339
  fieldErrors?: StorefrontDesignFieldError[];
340
+ } | {
341
+ message: string;
342
+ error: 'PLAN_UPGRADE_REQUIRED';
343
+ feature: 'storefront';
344
+ currentPlan: PlanTier | null;
345
+ source?: EntitlementSource;
346
+ requiredPlan?: PlanTier | null;
347
+ } | {
348
+ message: string;
349
+ error: 'SUBSCRIPTION_READONLY';
350
+ currentStatus: SubscriptionStatus;
351
+ } | {
352
+ message: string;
353
+ error: 'ROLE_FORBIDDEN' | 'STOREFRONT_ASSET_ENTITLEMENT_UNAVAILABLE';
317
354
  };
318
355
  type StorefrontDesignDraftResponse = {
319
356
  message: string;
@@ -20,6 +20,8 @@ export const STOREFRONT_DESIGN_LIMITS = {
20
20
  seoTitle: 120,
21
21
  seoDescription: 320,
22
22
  imageAlt: 250,
23
+ assetFilename: 255,
24
+ assetSearch: 80,
23
25
  activeImages: 200,
24
26
  imageDecodedBytes: 4 * 1024 * 1024,
25
27
  imagePixels: 32_000_000,
@@ -54,7 +56,21 @@ export const STOREFRONT_BUILTIN_DESTINATIONS = [
54
56
  'cart',
55
57
  'account',
56
58
  'privacy',
57
- 'terms',
59
+ ];
60
+ /**
61
+ * The built-in destinations that must stay reachable whatever a design does with
62
+ * its menus: search, cart, account and the required legal page. Reachability is
63
+ * owned by the storefront's platform chrome, not by the design: the storefront
64
+ * always renders these outside merchant menus and footer groups, so no design can
65
+ * remove or repoint them. A design may still link to them. Editors show them as
66
+ * fixed, non-editable entries. `parseStorefrontDesign` therefore does not refuse
67
+ * a document whose menus omit them.
68
+ */
69
+ export const STOREFRONT_PROTECTED_BUILTIN_DESTINATIONS = [
70
+ 'search',
71
+ 'cart',
72
+ 'account',
73
+ 'privacy',
58
74
  ];
59
75
  export const STOREFRONT_CONTACT_FIELDS = ['email', 'phone', 'whatsapp', 'address', 'hours', 'socials'];
60
76
  export const STOREFRONT_RESERVED_SLUGS = [
@@ -87,6 +103,14 @@ export const STOREFRONT_RESERVED_SLUGS = [
87
103
  'admin',
88
104
  'storefront',
89
105
  'pagina',
106
+ 'basket',
107
+ 'profile',
108
+ 'favorites',
109
+ 'invoices',
110
+ 'payments',
111
+ 'payment-methods',
112
+ 'user',
113
+ 'mantenimiento',
90
114
  ];
91
115
  export const STOREFRONT_BENEFIT_ICONS = ['truck', 'shield', 'credit-card', 'store', 'heart', 'check'];
92
116
  export const STOREFRONT_SOCIAL_HOSTS = {
@@ -3,7 +3,7 @@ export type StorefrontRegistryAudience = 'internal' | 'app' | 'public';
3
3
  export type StorefrontRegistryLifecycle = 'live' | 'release-owned';
4
4
  export type StorefrontRegistryStorage = {
5
5
  policy?: 'GLOBALS';
6
- override?: 'design.settings' | 'design.literalOverrides';
6
+ override?: 'design.settings' | 'design.literalOverrides' | 'ecommerce.config';
7
7
  document?: 'storefront-design';
8
8
  source?: 'LITERALS' | 'store' | 'catalogue' | 'featureFlags';
9
9
  };
@@ -25,6 +25,14 @@ export interface StorefrontRegistryMetadata {
25
25
  readonly kind: 'text';
26
26
  readonly label: string;
27
27
  readonly help: string;
28
+ } | {
29
+ readonly kind: 'key';
30
+ readonly label: string;
31
+ readonly help: string;
32
+ readonly defaults: {
33
+ readonly label: string;
34
+ readonly help: string;
35
+ };
28
36
  };
29
37
  valueSchema?: StorefrontSettingValueSchema;
30
38
  }
@@ -686,30 +694,78 @@ export declare const STOREFRONT_DESIGN_REGISTRY: {
686
694
  };
687
695
  readonly live: {
688
696
  readonly showIvaAlert: {
697
+ readonly key: "showIvaAlert";
698
+ readonly allowedLayers: readonly ["WEB#store"];
689
699
  readonly storage: {
690
- readonly source: "featureFlags";
700
+ readonly source: "store";
701
+ readonly override: "ecommerce.config";
702
+ };
703
+ readonly defaultValue: true;
704
+ readonly valueType: "boolean";
705
+ readonly valueSchema: {
706
+ readonly type: "boolean";
707
+ };
708
+ readonly literal: {
709
+ readonly kind: "key";
710
+ readonly label: "STOREFRONT_SHOW_IVA_ALERT_LABEL";
711
+ readonly help: "STOREFRONT_SHOW_IVA_ALERT_HELP";
712
+ readonly defaults: {
713
+ readonly label: string;
714
+ readonly help: string;
715
+ };
691
716
  };
692
- readonly allowedLayers: readonly ["GLOBAL", "WEB", "WEB#store"];
693
717
  readonly audience: "public";
694
718
  readonly lifecycle: "live";
695
719
  readonly ownership: "storefront-operation";
696
720
  readonly excludedFromSnapshot: true;
697
721
  };
698
722
  readonly showCurrencySelector: {
723
+ readonly key: "showCurrencySelector";
724
+ readonly allowedLayers: readonly ["WEB#store"];
699
725
  readonly storage: {
700
- readonly source: "featureFlags";
726
+ readonly source: "store";
727
+ readonly override: "ecommerce.config";
728
+ };
729
+ readonly defaultValue: true;
730
+ readonly valueType: "boolean";
731
+ readonly valueSchema: {
732
+ readonly type: "boolean";
733
+ };
734
+ readonly literal: {
735
+ readonly kind: "key";
736
+ readonly label: "STOREFRONT_SHOW_CURRENCY_SELECTOR_LABEL";
737
+ readonly help: "STOREFRONT_SHOW_CURRENCY_SELECTOR_HELP";
738
+ readonly defaults: {
739
+ readonly label: string;
740
+ readonly help: string;
741
+ };
701
742
  };
702
- readonly allowedLayers: readonly ["GLOBAL", "WEB", "WEB#store"];
703
743
  readonly audience: "public";
704
744
  readonly lifecycle: "live";
705
745
  readonly ownership: "storefront-operation";
706
746
  readonly excludedFromSnapshot: true;
707
747
  };
708
748
  readonly enableSaveForLater: {
749
+ readonly key: "enableSaveForLater";
750
+ readonly allowedLayers: readonly ["WEB#store"];
709
751
  readonly storage: {
710
- readonly source: "featureFlags";
752
+ readonly source: "store";
753
+ readonly override: "ecommerce.config";
754
+ };
755
+ readonly defaultValue: true;
756
+ readonly valueType: "boolean";
757
+ readonly valueSchema: {
758
+ readonly type: "boolean";
759
+ };
760
+ readonly literal: {
761
+ readonly kind: "key";
762
+ readonly label: "STOREFRONT_ENABLE_SAVE_FOR_LATER_LABEL";
763
+ readonly help: "STOREFRONT_ENABLE_SAVE_FOR_LATER_HELP";
764
+ readonly defaults: {
765
+ readonly label: string;
766
+ readonly help: string;
767
+ };
711
768
  };
712
- readonly allowedLayers: readonly ["GLOBAL", "WEB", "WEB#store"];
713
769
  readonly audience: "public";
714
770
  readonly lifecycle: "live";
715
771
  readonly ownership: "storefront-operation";
@@ -767,3 +823,31 @@ export declare const STOREFRONT_DESIGN_REGISTRY: {
767
823
  };
768
824
  };
769
825
  };
826
+ type LiveRegistry = typeof STOREFRONT_DESIGN_REGISTRY.live;
827
+ export type StorefrontLiveSettingKey = {
828
+ [K in keyof LiveRegistry]: LiveRegistry[K] extends {
829
+ valueSchema: StorefrontSettingValueSchema;
830
+ } ? K : never;
831
+ }[keyof LiveRegistry];
832
+ declare global {
833
+ type StorefrontLiveSettings = Record<StorefrontLiveSettingKey, boolean>;
834
+ /** Omitted keeps the value; null removes the stored override and restores the default. */
835
+ type StorefrontLiveSettingsPatch = {
836
+ [K in StorefrontLiveSettingKey]?: boolean | null;
837
+ };
838
+ }
839
+ export type { StorefrontLiveSettings, StorefrontLiveSettingsPatch };
840
+ export declare const STOREFRONT_LIVE_SETTING_KEYS: readonly StorefrontLiveSettingKey[];
841
+ export declare const isStorefrontLiveSettingKey: (key: string) => key is StorefrontLiveSettingKey;
842
+ export declare const resolveStorefrontLiveSettings: (canonical?: unknown, legacy?: unknown) => StorefrontLiveSettings;
843
+ type LiveLiteralMetadata = LiveRegistry[StorefrontLiveSettingKey]['literal'];
844
+ export type StorefrontEditorLiteralKey = LiveLiteralMetadata['label' | 'help'];
845
+ export declare const STOREFRONT_EDITOR_LITERAL_DEFAULTS: Readonly<Record<StorefrontEditorLiteralKey, string>>;
846
+ export declare const isStorefrontEditorLiteralKey: (key: string) => key is StorefrontEditorLiteralKey;
847
+ declare global {
848
+ interface ResolvedStorefrontEditorLiterals {
849
+ values: Record<StorefrontEditorLiteralKey, string>;
850
+ provenance: Record<StorefrontEditorLiteralKey, 'default' | 'GLOBAL' | 'APP' | `APP#${string}`>;
851
+ }
852
+ }
853
+ export type { ResolvedStorefrontEditorLiterals };
@@ -92,6 +92,16 @@ const LIVE_METADATA = {
92
92
  ownership: 'storefront-operation',
93
93
  excludedFromSnapshot: true,
94
94
  };
95
+ const liveToggle = (key, labelKey, helpKey, label, help) => ({
96
+ ...LIVE_METADATA,
97
+ key,
98
+ allowedLayers: ['WEB#store'],
99
+ storage: { source: 'store', override: 'ecommerce.config' },
100
+ defaultValue: true,
101
+ valueType: 'boolean',
102
+ valueSchema: { type: 'boolean' },
103
+ literal: { kind: 'key', label: labelKey, help: helpKey, defaults: { label, help } },
104
+ });
95
105
  export const STOREFRONT_DESIGN_REGISTRY = {
96
106
  settings: STOREFRONT_DESIGN_SETTINGS,
97
107
  content: {
@@ -110,9 +120,9 @@ export const STOREFRONT_DESIGN_REGISTRY = {
110
120
  storage: { source: 'LITERALS', override: 'design.literalOverrides' },
111
121
  },
112
122
  live: {
113
- showIvaAlert: { ...LIVE_METADATA, storage: { source: 'featureFlags' } },
114
- showCurrencySelector: { ...LIVE_METADATA, storage: { source: 'featureFlags' } },
115
- enableSaveForLater: { ...LIVE_METADATA, storage: { source: 'featureFlags' } },
123
+ showIvaAlert: liveToggle('showIvaAlert', 'STOREFRONT_SHOW_IVA_ALERT_LABEL', 'STOREFRONT_SHOW_IVA_ALERT_HELP', 'Mostrar aviso de IVA', 'Mostrar el aviso de IVA incluido en los precios.'),
124
+ showCurrencySelector: liveToggle('showCurrencySelector', 'STOREFRONT_SHOW_CURRENCY_SELECTOR_LABEL', 'STOREFRONT_SHOW_CURRENCY_SELECTOR_HELP', 'Mostrar selector de moneda', 'Permitir elegir la moneda de visualización en la tienda.'),
125
+ enableSaveForLater: liveToggle('enableSaveForLater', 'STOREFRONT_ENABLE_SAVE_FOR_LATER_LABEL', 'STOREFRONT_ENABLE_SAVE_FOR_LATER_HELP', 'Permitir guardar para después', 'Mostrar los controles para guardar productos de la cesta para después.'),
116
126
  prices: { ...LIVE_METADATA, storage: { source: 'catalogue' } },
117
127
  stock: { ...LIVE_METADATA, storage: { source: 'catalogue' } },
118
128
  checkout: { ...LIVE_METADATA, storage: { source: 'store' } },
@@ -120,3 +130,23 @@ export const STOREFRONT_DESIGN_REGISTRY = {
120
130
  availability: { ...LIVE_METADATA, storage: { source: 'store' } },
121
131
  },
122
132
  };
133
+ export const STOREFRONT_LIVE_SETTING_KEYS = Object.keys(STOREFRONT_DESIGN_REGISTRY.live).filter((key) => 'valueSchema' in STOREFRONT_DESIGN_REGISTRY.live[key]);
134
+ export const isStorefrontLiveSettingKey = (key) => STOREFRONT_LIVE_SETTING_KEYS.some((candidate) => candidate === key);
135
+ const liveBoolean = (source, key) => {
136
+ if (!source || typeof source !== 'object' || Array.isArray(source) || !Object.hasOwn(source, key))
137
+ return undefined;
138
+ const value = source[key];
139
+ return typeof value === 'boolean' ? value : undefined;
140
+ };
141
+ export const resolveStorefrontLiveSettings = (canonical, legacy) => Object.fromEntries(STOREFRONT_LIVE_SETTING_KEYS.map((key) => [
142
+ key,
143
+ liveBoolean(canonical, key) ?? liveBoolean(legacy, key) ?? STOREFRONT_DESIGN_REGISTRY.live[key].defaultValue,
144
+ ]));
145
+ export const STOREFRONT_EDITOR_LITERAL_DEFAULTS = Object.fromEntries(STOREFRONT_LIVE_SETTING_KEYS.flatMap((key) => {
146
+ const { literal } = STOREFRONT_DESIGN_REGISTRY.live[key];
147
+ return [
148
+ [literal.label, literal.defaults.label],
149
+ [literal.help, literal.defaults.help],
150
+ ];
151
+ }));
152
+ export const isStorefrontEditorLiteralKey = (key) => Object.hasOwn(STOREFRONT_EDITOR_LITERAL_DEFAULTS, key);
@@ -50,5 +50,12 @@ export interface StorefrontResolvedTheme {
50
50
  warnings: StorefrontThemeWarning[];
51
51
  }
52
52
  export declare const storefrontContrastRatio: (foreground: string, background: string) => number;
53
+ /**
54
+ * The storefront theme for a design's settings overrides.
55
+ *
56
+ * Settings resolve from the registry defaults plus the store's own design
57
+ * overrides ONLY — no GLOBAL or WEB layer takes part — so a consumer uses this
58
+ * as shipped rather than merging layers of its own first.
59
+ */
53
60
  export declare const resolveStorefrontTheme: (overrides?: Partial<StorefrontDesignSettings>) => StorefrontResolvedTheme;
54
61
  export {};
@@ -61,6 +61,13 @@ const surfaceTokens = (background, settings, mode, surface, warnings) => {
61
61
  disabled: { background: disabledBackground, text: readableText(disabledBackground) },
62
62
  };
63
63
  };
64
+ /**
65
+ * The storefront theme for a design's settings overrides.
66
+ *
67
+ * Settings resolve from the registry defaults plus the store's own design
68
+ * overrides ONLY — no GLOBAL or WEB layer takes part — so a consumer uses this
69
+ * as shipped rather than merging layers of its own first.
70
+ */
64
71
  export const resolveStorefrontTheme = (overrides = {}) => {
65
72
  const settings = resolveStorefrontDesignSettings(overrides);
66
73
  const warnings = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "platform-types",
3
- "version": "1.10.677",
3
+ "version": "1.10.679",
4
4
  "description": "Shared wire and entity contracts for the platform.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",