platform-types 1.10.678 → 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 = {
@@ -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 = [];
@@ -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 = {
@@ -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.678",
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",