platform-types 1.10.675 → 1.10.676

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.
package/dist/cjs/index.js CHANGED
@@ -96,6 +96,9 @@ __exportStar(require("./serviceTemplate.js"), exports);
96
96
  __exportStar(require("./socket.js"), exports);
97
97
  __exportStar(require("./stock.js"), exports);
98
98
  __exportStar(require("./store.js"), exports);
99
+ __exportStar(require("./storefrontDesign.js"), exports);
100
+ __exportStar(require("./storefrontDesignRegistry.js"), exports);
101
+ __exportStar(require("./storefrontTheme.js"), exports);
99
102
  __exportStar(require("./storeNetwork.js"), exports);
100
103
  __exportStar(require("./storefrontEvent.js"), exports);
101
104
  __exportStar(require("./subscription.js"), exports);
@@ -1,8 +1,4 @@
1
1
  "use strict";
2
- // Platform-wide config/feature-flag contracts. Single fixed
3
- // GLOBALS/PLATFORM scope, unlike Literals' multi-scope override chain — no
4
- // per-tenant override use case identified for globals/flags (deliberate
5
- // divergence from the Literals model).
6
2
  Object.defineProperty(exports, "__esModule", { value: true });
7
3
  exports.ML_ORDER_RECONCILE_SUMMARY_KEYS = exports.INTEGRATION_EVENT_OUTCOMES = exports.INTEGRATION_EVENT_TYPES = void 0;
8
4
  // ── Integration events log — the rows both read endpoints return ─────────
@@ -0,0 +1,118 @@
1
+ "use strict";
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;
4
+ exports.createStorefrontDesignV1 = createStorefrontDesignV1;
5
+ exports.STOREFRONT_DESIGN_LIMITS = {
6
+ customPages: 20,
7
+ sectionsPerPage: 10,
8
+ productCountMin: 4,
9
+ productCountMax: 24,
10
+ productCountDefault: 8,
11
+ navigationTopLevel: 12,
12
+ navigationChildren: 8,
13
+ navigationTotal: 40,
14
+ footerGroups: 4,
15
+ footerLinks: 8,
16
+ faqs: 20,
17
+ benefits: 8,
18
+ historyEntries: 20,
19
+ documentBytes: 256 * 1024,
20
+ heading: 120,
21
+ label: 80,
22
+ body: 4000,
23
+ slug: 80,
24
+ seoTitle: 120,
25
+ seoDescription: 320,
26
+ imageAlt: 250,
27
+ activeImages: 200,
28
+ imageDecodedBytes: 4 * 1024 * 1024,
29
+ imagePixels: 32_000_000,
30
+ imageDimension: 8000,
31
+ previewSeconds: 15 * 60,
32
+ fieldErrors: 100,
33
+ fieldErrorPath: 240,
34
+ contactAddress: 500,
35
+ contactNote: 200,
36
+ contactHours: 14,
37
+ contactSocials: 8,
38
+ contactEmail: 254,
39
+ };
40
+ exports.STOREFRONT_SECTION_TYPES = [
41
+ 'banner',
42
+ 'imageText',
43
+ 'products',
44
+ 'categories',
45
+ 'brands',
46
+ 'text',
47
+ 'faq',
48
+ 'benefits',
49
+ 'contact',
50
+ 'paymentDelivery',
51
+ ];
52
+ exports.STOREFRONT_BUILTIN_DESTINATIONS = [
53
+ 'home',
54
+ 'catalogue',
55
+ 'offers',
56
+ 'new',
57
+ 'search',
58
+ 'cart',
59
+ 'account',
60
+ 'privacy',
61
+ 'terms',
62
+ ];
63
+ exports.STOREFRONT_CONTACT_FIELDS = ['email', 'phone', 'whatsapp', 'address', 'hours', 'socials'];
64
+ exports.STOREFRONT_RESERVED_SLUGS = [
65
+ 'home',
66
+ 'index',
67
+ 'api',
68
+ 'auth',
69
+ 'login',
70
+ 'logout',
71
+ 'account',
72
+ 'cart',
73
+ 'checkout',
74
+ 'orders',
75
+ 'search',
76
+ 'products',
77
+ 'product',
78
+ 'producto',
79
+ 'coleccion',
80
+ 'categories',
81
+ 'brands',
82
+ 'sale',
83
+ 'new',
84
+ 'privacy',
85
+ 'terms',
86
+ 'sitemap',
87
+ 'robots',
88
+ 'manifest',
89
+ 'assets',
90
+ 'preview',
91
+ 'admin',
92
+ 'storefront',
93
+ 'pagina',
94
+ ];
95
+ exports.STOREFRONT_BENEFIT_ICONS = ['truck', 'shield', 'credit-card', 'store', 'heart', 'check'];
96
+ exports.STOREFRONT_SOCIAL_HOSTS = {
97
+ instagram: ['instagram.com', 'www.instagram.com'],
98
+ facebook: ['facebook.com', 'www.facebook.com'],
99
+ youtube: ['youtube.com', 'www.youtube.com', 'youtu.be', 'www.youtu.be'],
100
+ tiktok: ['tiktok.com', 'www.tiktok.com'],
101
+ linkedin: ['linkedin.com', 'www.linkedin.com'],
102
+ x: ['x.com', 'www.x.com'],
103
+ };
104
+ function createStorefrontDesignV1() {
105
+ return {
106
+ schemaVersion: 1,
107
+ templateId: 'standard',
108
+ settings: {},
109
+ branding: {},
110
+ home: { id: 'home', title: 'Home', enabled: true, sections: [] },
111
+ pages: [],
112
+ navigation: [],
113
+ footer: [],
114
+ contact: {},
115
+ seo: {},
116
+ literalOverrides: {},
117
+ };
118
+ }
@@ -0,0 +1,130 @@
1
+ "use strict";
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;
4
+ const DESIGN_METADATA = {
5
+ scope: 'storefront',
6
+ allowedLayers: ['GLOBAL', 'WEB', 'WEB#store'],
7
+ audience: 'public',
8
+ lifecycle: 'release-owned',
9
+ storage: { policy: 'GLOBALS', override: 'design.settings' },
10
+ ownership: 'storefront-design',
11
+ };
12
+ const color = (key, defaultValue, label, help) => ({
13
+ ...DESIGN_METADATA,
14
+ key,
15
+ defaultValue,
16
+ valueType: 'string',
17
+ valueSchema: { type: 'string', format: 'hex-color', maxLength: 7 },
18
+ maxLength: 7,
19
+ description: help,
20
+ literal: { kind: 'text', label, help },
21
+ });
22
+ const choice = (key, allowedValues, defaultValue, label, help) => ({
23
+ ...DESIGN_METADATA,
24
+ key,
25
+ defaultValue,
26
+ valueType: 'string',
27
+ allowedValues,
28
+ valueSchema: { type: 'string', enum: allowedValues },
29
+ description: help,
30
+ literal: { kind: 'text', label, help },
31
+ });
32
+ const toggle = (key, defaultValue, label, help) => ({
33
+ ...DESIGN_METADATA,
34
+ key,
35
+ defaultValue,
36
+ valueType: 'boolean',
37
+ valueSchema: { type: 'boolean' },
38
+ description: help,
39
+ literal: { kind: 'text', label, help },
40
+ });
41
+ exports.STOREFRONT_DESIGN_SETTINGS = {
42
+ primaryColor: color('primaryColor', '#0066CC', 'Color principal', 'Color solicitado para los elementos principales de la tienda.'),
43
+ accentColor: color('accentColor', '#0066CC', 'Color de acento', 'Color solicitado para los elementos destacados de la tienda.'),
44
+ backgroundColor: color('backgroundColor', '#FFFFFF', 'Color de fondo', 'Color solicitado para el fondo de la tienda.'),
45
+ headerColor: color('headerColor', '#0066CC', 'Color del encabezado', 'Color solicitado para el encabezado de la tienda.'),
46
+ footerColor: color('footerColor', '#212529', 'Color del pie', 'Color solicitado para el pie de la tienda.'),
47
+ headingFont: choice('headingFont', ['ubuntu', 'noto-sans', 'noto-serif'], 'ubuntu', 'Tipografía de títulos', 'Familia tipográfica de los títulos.'),
48
+ bodyFont: choice('bodyFont', ['ubuntu', 'noto-sans', 'noto-serif'], 'ubuntu', 'Tipografía de texto', 'Familia tipográfica del cuerpo de texto.'),
49
+ textSize: choice('textSize', ['compact', 'standard', 'large'], 'standard', 'Tamaño de texto', 'Escala de texto de la tienda.'),
50
+ cardImageRatio: choice('cardImageRatio', ['square', 'portrait'], 'square', 'Proporción de imágenes', 'Proporción de las imágenes en las tarjetas de productos.'),
51
+ cardDensity: choice('cardDensity', ['compact', 'spacious'], 'spacious', 'Espaciado de tarjetas', 'Espaciado entre los elementos de las tarjetas.'),
52
+ showBrand: toggle('showBrand', false, 'Mostrar marca', 'Mostrar la marca en las tarjetas de productos.'),
53
+ showSku: toggle('showSku', false, 'Mostrar SKU', 'Mostrar el código SKU en las tarjetas de productos.'),
54
+ };
55
+ const isStorefrontDesignSettingKey = (key) => Object.hasOwn(exports.STOREFRONT_DESIGN_SETTINGS, key);
56
+ exports.isStorefrontDesignSettingKey = isStorefrontDesignSettingKey;
57
+ const validateStorefrontSettingValue = (schema, value) => {
58
+ if (schema.type === 'boolean')
59
+ return typeof value === 'boolean';
60
+ if (typeof value !== 'string' || !value.isWellFormed())
61
+ return false;
62
+ if (schema.maxLength !== undefined && Array.from(value).length > schema.maxLength)
63
+ return false;
64
+ if (schema.format === 'hex-color' && !/^#[0-9a-fA-F]{6}$/.test(value))
65
+ return false;
66
+ return schema.enum === undefined || schema.enum.includes(value);
67
+ };
68
+ exports.validateStorefrontSettingValue = validateStorefrontSettingValue;
69
+ const validateStorefrontDesignSetting = (key, value) => (0, exports.isStorefrontDesignSettingKey)(key) &&
70
+ (0, exports.validateStorefrontSettingValue)(exports.STOREFRONT_DESIGN_SETTINGS[key].valueSchema, value);
71
+ exports.validateStorefrontDesignSetting = validateStorefrontDesignSetting;
72
+ exports.STOREFRONT_DESIGN_LITERAL_MAX_CODE_POINTS = 4096;
73
+ const resolveStorefrontDesignSettingsLayers = (layers, overrides = {}) => {
74
+ const values = {};
75
+ const provenance = {};
76
+ const ordered = ['GLOBAL', 'WEB', 'WEB#store'].flatMap((name) => layers.filter(({ layer }) => layer === name));
77
+ for (const key of Object.keys(exports.STOREFRONT_DESIGN_SETTINGS)) {
78
+ Object.assign(values, { [key]: exports.STOREFRONT_DESIGN_SETTINGS[key].defaultValue });
79
+ provenance[key] = 'default';
80
+ for (const { layer, values: inherited } of ordered) {
81
+ if (!Object.hasOwn(inherited, key) || !(0, exports.validateStorefrontDesignSetting)(key, inherited[key]))
82
+ continue;
83
+ Object.assign(values, { [key]: inherited[key] });
84
+ provenance[key] = layer;
85
+ }
86
+ if (Object.hasOwn(overrides, key) && (0, exports.validateStorefrontDesignSetting)(key, overrides[key])) {
87
+ Object.assign(values, { [key]: overrides[key] });
88
+ provenance[key] = 'design';
89
+ }
90
+ }
91
+ return { values, provenance };
92
+ };
93
+ exports.resolveStorefrontDesignSettingsLayers = resolveStorefrontDesignSettingsLayers;
94
+ const resolveStorefrontDesignSettings = (overrides = {}, layers = []) => (0, exports.resolveStorefrontDesignSettingsLayers)(layers, overrides).values;
95
+ exports.resolveStorefrontDesignSettings = resolveStorefrontDesignSettings;
96
+ const LIVE_METADATA = {
97
+ allowedLayers: ['GLOBAL', 'WEB', 'WEB#store'],
98
+ audience: 'public',
99
+ lifecycle: 'live',
100
+ ownership: 'storefront-operation',
101
+ excludedFromSnapshot: true,
102
+ };
103
+ exports.STOREFRONT_DESIGN_REGISTRY = {
104
+ settings: exports.STOREFRONT_DESIGN_SETTINGS,
105
+ content: {
106
+ schema: 'StorefrontDesignV1',
107
+ lifecycle: 'release-owned',
108
+ ownership: 'storefront-design',
109
+ audience: 'public',
110
+ storage: { document: 'storefront-design' },
111
+ },
112
+ literalOverrides: {
113
+ catalog: 'WEB_LITERAL_DEFAULTS',
114
+ allowedLayers: DESIGN_METADATA.allowedLayers,
115
+ lifecycle: 'release-owned',
116
+ ownership: 'storefront-design',
117
+ audience: 'public',
118
+ storage: { source: 'LITERALS', override: 'design.literalOverrides' },
119
+ },
120
+ live: {
121
+ showIvaAlert: { ...LIVE_METADATA, storage: { source: 'featureFlags' } },
122
+ showCurrencySelector: { ...LIVE_METADATA, storage: { source: 'featureFlags' } },
123
+ enableSaveForLater: { ...LIVE_METADATA, storage: { source: 'featureFlags' } },
124
+ prices: { ...LIVE_METADATA, storage: { source: 'catalogue' } },
125
+ stock: { ...LIVE_METADATA, storage: { source: 'catalogue' } },
126
+ checkout: { ...LIVE_METADATA, storage: { source: 'store' } },
127
+ catalogue: { ...LIVE_METADATA, storage: { source: 'catalogue' } },
128
+ availability: { ...LIVE_METADATA, storage: { source: 'store' } },
129
+ },
130
+ };
@@ -0,0 +1,102 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.resolveStorefrontTheme = exports.storefrontContrastRatio = void 0;
4
+ const storefrontDesignRegistry_ts_1 = require("./storefrontDesignRegistry.js");
5
+ const channels = (color) => [
6
+ Number.parseInt(color.slice(1, 3), 16),
7
+ Number.parseInt(color.slice(3, 5), 16),
8
+ Number.parseInt(color.slice(5, 7), 16),
9
+ ];
10
+ const hex = (rgb) => `#${rgb
11
+ .map((value) => Math.round(value).toString(16).padStart(2, '0'))
12
+ .join('')
13
+ .toUpperCase()}`;
14
+ // MUI's RGB lighten/darken arithmetic; fixed hex output keeps tokens CSS-independent.
15
+ const mix = (color, target, amount) => {
16
+ const destination = channels(target);
17
+ return hex(channels(color).map((value, index) => value + (destination[index] - value) * amount));
18
+ };
19
+ const luminance = (color) => {
20
+ const linear = channels(color).map((channel) => {
21
+ const value = channel / 255;
22
+ return value <= 0.03928 ? value / 12.92 : ((value + 0.055) / 1.055) ** 2.4;
23
+ });
24
+ return linear[0] * 0.2126 + linear[1] * 0.7152 + linear[2] * 0.0722;
25
+ };
26
+ const storefrontContrastRatio = (foreground, background) => {
27
+ const a = luminance(foreground);
28
+ const b = luminance(background);
29
+ return (Math.max(a, b) + 0.05) / (Math.min(a, b) + 0.05);
30
+ };
31
+ exports.storefrontContrastRatio = storefrontContrastRatio;
32
+ const readableText = (background) => (0, exports.storefrontContrastRatio)('#000000', background) >= (0, exports.storefrontContrastRatio)('#FFFFFF', background)
33
+ ? '#000000'
34
+ : '#FFFFFF';
35
+ const ensureContrast = (color, background, minimum) => {
36
+ if ((0, exports.storefrontContrastRatio)(color, background) >= minimum)
37
+ return color.toUpperCase();
38
+ const target = readableText(background);
39
+ for (let step = 1; step <= 100; step++) {
40
+ const candidate = mix(color, target, step / 100);
41
+ if ((0, exports.storefrontContrastRatio)(candidate, background) >= minimum)
42
+ return candidate;
43
+ }
44
+ return target;
45
+ };
46
+ const surfaceTokens = (background, settings, mode, surface, warnings) => {
47
+ const adjusted = (role, requested, minimum) => {
48
+ const effective = ensureContrast(requested, background, minimum);
49
+ if (effective !== requested.toUpperCase())
50
+ warnings.push({ mode, surface, role, requested, effective });
51
+ return effective;
52
+ };
53
+ const text = readableText(background);
54
+ const button = adjusted('button', settings.primaryColor, 3);
55
+ const hover = ensureContrast(mix(button, readableText(background), 0.2), background, 3);
56
+ const disabledBackground = mix(background, text, 0.12);
57
+ return {
58
+ background,
59
+ text,
60
+ secondaryText: ensureContrast(mix(background, text, 0.6), background, 4.5),
61
+ link: adjusted('link', settings.primaryColor, 4.5),
62
+ focus: adjusted('focus', settings.accentColor, 3),
63
+ border: ensureContrast(mix(background, text, 0.3), background, 3),
64
+ button: { background: button, text: readableText(button), hover, hoverText: readableText(hover) },
65
+ disabled: { background: disabledBackground, text: readableText(disabledBackground) },
66
+ };
67
+ };
68
+ const resolveStorefrontTheme = (overrides = {}) => {
69
+ const settings = (0, storefrontDesignRegistry_ts_1.resolveStorefrontDesignSettings)(overrides);
70
+ const warnings = [];
71
+ const makeMode = (mode) => {
72
+ const background = (requested) => mode === 'light' ? requested.toUpperCase() : mix(requested, '#000000', 0.9);
73
+ return {
74
+ page: surfaceTokens(background(settings.backgroundColor), settings, mode, 'page', warnings),
75
+ header: surfaceTokens(background(settings.headerColor), settings, mode, 'header', warnings),
76
+ footer: surfaceTokens(background(settings.footerColor), settings, mode, 'footer', warnings),
77
+ };
78
+ };
79
+ const scale = { compact: 0.875, standard: 1, large: 1.125 }[settings.textSize];
80
+ return {
81
+ requested: settings,
82
+ light: makeMode('light'),
83
+ dark: makeMode('dark'),
84
+ typography: {
85
+ headingFont: settings.headingFont,
86
+ bodyFont: settings.bodyFont,
87
+ fontSize: 14 * scale,
88
+ body1: 16 * scale,
89
+ body2: 14 * scale,
90
+ h1: 96 * scale,
91
+ h2: 60 * scale,
92
+ h3: 48 * scale,
93
+ h4: 34 * scale,
94
+ h5: 24 * scale,
95
+ h6: 20 * scale,
96
+ },
97
+ shape: { borderRadius: 4 },
98
+ spacing: 8,
99
+ warnings,
100
+ };
101
+ };
102
+ exports.resolveStorefrontTheme = resolveStorefrontTheme;
package/dist/index.d.ts CHANGED
@@ -72,6 +72,9 @@ export * from './serviceTemplate.ts';
72
72
  export * from './socket.ts';
73
73
  export * from './stock.ts';
74
74
  export * from './store.ts';
75
+ export * from './storefrontDesign.ts';
76
+ export * from './storefrontDesignRegistry.ts';
77
+ export * from './storefrontTheme.ts';
75
78
  export * from './storeNetwork.ts';
76
79
  export * from './storefrontEvent.ts';
77
80
  export * from './subscription.ts';
package/dist/index.js CHANGED
@@ -80,6 +80,9 @@ export * from "./serviceTemplate.js";
80
80
  export * from "./socket.js";
81
81
  export * from "./stock.js";
82
82
  export * from "./store.js";
83
+ export * from "./storefrontDesign.js";
84
+ export * from "./storefrontDesignRegistry.js";
85
+ export * from "./storefrontTheme.js";
83
86
  export * from "./storeNetwork.js";
84
87
  export * from "./storefrontEvent.js";
85
88
  export * from "./subscription.js";
@@ -1,8 +1,9 @@
1
+ import type { StorefrontRegistryMetadata } from './storefrontDesignRegistry.ts';
1
2
  type PlatformConfigScope = 'app' | 'landing' | 'storefront';
2
3
  type PlatformConfigValueType = 'boolean' | 'string' | 'number';
3
4
  type PlatformConfigKind = 'setting' | 'flag';
4
5
  type PlatformConfigValue = string | number | boolean;
5
- export interface PlatformConfigEntry {
6
+ export interface PlatformConfigEntry extends Partial<StorefrontRegistryMetadata> {
6
7
  key: string;
7
8
  valueType: PlatformConfigValueType;
8
9
  kind: PlatformConfigKind;
package/dist/platform.js CHANGED
@@ -1,7 +1,3 @@
1
- // Platform-wide config/feature-flag contracts. Single fixed
2
- // GLOBALS/PLATFORM scope, unlike Literals' multi-scope override chain — no
3
- // per-tenant override use case identified for globals/flags (deliberate
4
- // divergence from the Literals model).
5
1
  // ── Integration events log — the rows both read endpoints return ─────────
6
2
  //
7
3
  // `GET /platform/integrations/{provider}/events` (MANAGER, every tenant) and
package/dist/store.d.ts CHANGED
@@ -880,6 +880,8 @@ declare global {
880
880
  * value refetches `GET /store` to see those.
881
881
  */
882
882
  publicStorefront?: PublicStorefront | null;
883
+ /** Read-only legacy editor seed, available only to the entitled tenant ADMIN. */
884
+ storefrontEditorBaseline?: StorefrontEditorBaseline;
883
885
  photoURL: string;
884
886
  /** @deprecated Request-only upload control, never persisted or returned — use `StoreUpdateInput.photoData`. */
885
887
  photoData?: string;