platform-types 1.10.676 → 1.10.678

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
@@ -100,6 +100,7 @@ __exportStar(require("./storefrontDesign.js"), exports);
100
100
  __exportStar(require("./storefrontDesignRegistry.js"), exports);
101
101
  __exportStar(require("./storefrontTheme.js"), exports);
102
102
  __exportStar(require("./storeNetwork.js"), exports);
103
+ __exportStar(require("./storefrontAssets.js"), exports);
103
104
  __exportStar(require("./storefrontEvent.js"), exports);
104
105
  __exportStar(require("./subscription.js"), exports);
105
106
  __exportStar(require("./support.js"), exports);
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MAX_STOREFRONT_ASSETS = exports.STOREFRONT_ASSET_VARIANTS = void 0;
4
+ exports.STOREFRONT_ASSET_VARIANTS = [
5
+ 'original',
6
+ '200x200',
7
+ '400x400',
8
+ '800x800',
9
+ '1200x1200',
10
+ '1600x1600',
11
+ ];
12
+ exports.MAX_STOREFRONT_ASSETS = 200;
@@ -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;
package/dist/index.d.ts CHANGED
@@ -76,6 +76,7 @@ export * from './storefrontDesign.ts';
76
76
  export * from './storefrontDesignRegistry.ts';
77
77
  export * from './storefrontTheme.ts';
78
78
  export * from './storeNetwork.ts';
79
+ export * from './storefrontAssets.ts';
79
80
  export * from './storefrontEvent.ts';
80
81
  export * from './subscription.ts';
81
82
  export * from './support.ts';
package/dist/index.js CHANGED
@@ -84,6 +84,7 @@ export * from "./storefrontDesign.js";
84
84
  export * from "./storefrontDesignRegistry.js";
85
85
  export * from "./storefrontTheme.js";
86
86
  export * from "./storeNetwork.js";
87
+ export * from "./storefrontAssets.js";
87
88
  export * from "./storefrontEvent.js";
88
89
  export * from "./subscription.js";
89
90
  export * from "./support.js";
@@ -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
  /**
@@ -0,0 +1,62 @@
1
+ export declare const STOREFRONT_ASSET_VARIANTS: readonly ["original", "200x200", "400x400", "800x800", "1200x1200", "1600x1600"];
2
+ export declare const MAX_STOREFRONT_ASSETS = 200;
3
+ 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
+ interface StorefrontAssetResponse {
6
+ message: string;
7
+ data: StorefrontAsset;
8
+ }
9
+ interface StorefrontAssetListResponse {
10
+ message: string;
11
+ data: {
12
+ items: StorefrontAsset[];
13
+ cursor?: string;
14
+ };
15
+ }
16
+ interface StorefrontAssetErrorResponse {
17
+ message: string;
18
+ error: StorefrontAssetErrorCode;
19
+ fieldErrors?: StorefrontAssetFieldError[];
20
+ feature?: 'storefront';
21
+ source?: EntitlementSource;
22
+ requiredPlan?: PlanTier | null;
23
+ currentPlan?: PlanTier | null;
24
+ }
25
+ type StorefrontAssetVariant = (typeof STOREFRONT_ASSET_VARIANTS)[number];
26
+ interface StorefrontAssetUploadRequest {
27
+ requestId: string;
28
+ base64: string;
29
+ }
30
+ interface StorefrontAssetArchiveRequest {
31
+ requestId: string;
32
+ }
33
+ interface StorefrontAssetListQuery {
34
+ limit?: number;
35
+ cursor?: string;
36
+ }
37
+ interface StorefrontAssetFieldError {
38
+ path: string;
39
+ code: string;
40
+ }
41
+ interface StorefrontAssetImageQuery {
42
+ variant?: StorefrontAssetVariant;
43
+ }
44
+ interface StorefrontAsset {
45
+ assetId: string;
46
+ status: 'ready' | 'archived';
47
+ width: number;
48
+ height: number;
49
+ contentType: 'image/jpeg' | 'image/png' | 'image/webp';
50
+ createdAt: number;
51
+ }
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
+ }
62
+ }
@@ -0,0 +1,9 @@
1
+ export const STOREFRONT_ASSET_VARIANTS = [
2
+ 'original',
3
+ '200x200',
4
+ '400x400',
5
+ '800x800',
6
+ '1200x1200',
7
+ '1600x1600',
8
+ ];
9
+ export const MAX_STOREFRONT_ASSETS = 200;
@@ -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);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "platform-types",
3
- "version": "1.10.676",
3
+ "version": "1.10.678",
4
4
  "description": "Shared wire and entity contracts for the platform.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",