platform-types 1.10.752 → 1.10.754
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,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.STOREFRONT_PREVIEW_PROTOCOL_ERRORS = exports.STOREFRONT_PREVIEW_READ_OPERATIONS = 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.isStorefrontPageSlug = exports.STOREFRONT_PAGE_SLUG_RE = exports.STOREFRONT_DESIGN_LIMITS = exports.STOREFRONT_SOCIAL_HOSTS = void 0;
|
|
3
|
+
exports.STOREFRONT_PREVIEW_PROTOCOL_ERRORS = exports.STOREFRONT_PREVIEW_READ_OPERATIONS = exports.STOREFRONT_DESIGN_AUDIENCES = exports.STOREFRONT_BENEFIT_ICONS = exports.STOREFRONT_RESERVED_SLUGS = exports.STOREFRONT_CONTACT_FIELDS = exports.STOREFRONT_PROTECTED_BUILTIN_DESTINATIONS = exports.STOREFRONT_BUILTIN_DESTINATIONS = exports.STOREFRONT_REPEATABLE_SECTION_TYPES = exports.STOREFRONT_SECTION_TYPES = exports.isStorefrontPageSlug = exports.STOREFRONT_PAGE_SLUG_RE = exports.STOREFRONT_DESIGN_LIMITS = exports.STOREFRONT_SOCIAL_HOSTS = void 0;
|
|
4
4
|
exports.createStorefrontDesignV1 = createStorefrontDesignV1;
|
|
5
5
|
exports.parseStorefrontPreviewDocument = parseStorefrontPreviewDocument;
|
|
6
6
|
exports.parseStorefrontPreviewMessage = parseStorefrontPreviewMessage;
|
|
@@ -19,6 +19,12 @@ exports.STOREFRONT_DESIGN_LIMITS = {
|
|
|
19
19
|
pageAliases: 20,
|
|
20
20
|
pageAliasMetadataBytes: 64 * 1024,
|
|
21
21
|
sectionsPerPage: 10,
|
|
22
|
+
/**
|
|
23
|
+
* How many sections of one `STOREFRONT_REPEATABLE_SECTION_TYPES` type a page may hold, disabled
|
|
24
|
+
* sections included; a fifth is `SECTION_TYPE_LIMIT` at its `type` path. Every other type is
|
|
25
|
+
* once per page (a second is `DUPLICATE`), and `sectionsPerPage` still caps the whole page.
|
|
26
|
+
*/
|
|
27
|
+
repeatableSectionsPerType: 4,
|
|
22
28
|
productCountMin: 4,
|
|
23
29
|
productCountMax: 24,
|
|
24
30
|
productCountDefault: 8,
|
|
@@ -31,6 +37,8 @@ exports.STOREFRONT_DESIGN_LIMITS = {
|
|
|
31
37
|
benefits: 8,
|
|
32
38
|
historyEntries: 20,
|
|
33
39
|
selectedSourceIds: 50,
|
|
40
|
+
/** A `visibility` rule's `priceLists`: the store's own cap on price lists. */
|
|
41
|
+
visibilityPriceLists: 64,
|
|
34
42
|
documentBytes: 256 * 1024,
|
|
35
43
|
heading: 120,
|
|
36
44
|
label: 80,
|
|
@@ -76,6 +84,17 @@ exports.STOREFRONT_SECTION_TYPES = [
|
|
|
76
84
|
'contact',
|
|
77
85
|
'paymentDelivery',
|
|
78
86
|
];
|
|
87
|
+
/**
|
|
88
|
+
* The section types a page may repeat, each up to `STOREFRONT_DESIGN_LIMITS.repeatableSectionsPerType`
|
|
89
|
+
* times (disabled sections count), so a Home can show offers and new arrivals together. Every other
|
|
90
|
+
* type is once per page. Draft save and publish both enforce it; the editor reads the same list.
|
|
91
|
+
*/
|
|
92
|
+
exports.STOREFRONT_REPEATABLE_SECTION_TYPES = [
|
|
93
|
+
'products',
|
|
94
|
+
'banner',
|
|
95
|
+
'imageText',
|
|
96
|
+
'text',
|
|
97
|
+
];
|
|
79
98
|
/**
|
|
80
99
|
* The storefront routes a design link may target by name. `incomes` is the
|
|
81
100
|
* always-available recency listing (`/products/incomes`); `new` is the separate
|
|
@@ -151,6 +170,12 @@ exports.STOREFRONT_RESERVED_SLUGS = [
|
|
|
151
170
|
'mantenimiento',
|
|
152
171
|
];
|
|
153
172
|
exports.STOREFRONT_BENEFIT_ICONS = ['truck', 'shield', 'credit-card', 'store', 'heart', 'check'];
|
|
173
|
+
/**
|
|
174
|
+
* Who a `visibility` rule may name. `guest`: no approved customer resolved. `customer`: any
|
|
175
|
+
* approved customer. `retail` / `wholesale`: an approved customer whose list's `audienceClass`
|
|
176
|
+
* is that class, an absent class meaning `retail`.
|
|
177
|
+
*/
|
|
178
|
+
exports.STOREFRONT_DESIGN_AUDIENCES = ['guest', 'customer', 'retail', 'wholesale'];
|
|
154
179
|
function createStorefrontDesignV1() {
|
|
155
180
|
return {
|
|
156
181
|
schemaVersion: 1,
|
|
@@ -215,6 +240,29 @@ function previewWithinBytes(value, maximum) {
|
|
|
215
240
|
return false;
|
|
216
241
|
}
|
|
217
242
|
}
|
|
243
|
+
/**
|
|
244
|
+
* A `visibility` rule kept on the transport only when well-formed: known audiences, and integer
|
|
245
|
+
* price lists within the store cap. Anything else is left off rather than failing the frame — the
|
|
246
|
+
* preview never filters by it, it only shows the rule the editor authored.
|
|
247
|
+
*/
|
|
248
|
+
function previewVisibility(input) {
|
|
249
|
+
if (!previewRecord(input) || !Array.isArray(input.audiences))
|
|
250
|
+
return {};
|
|
251
|
+
const { audiences, priceLists } = input;
|
|
252
|
+
if (!audiences.every((entry) => exports.STOREFRONT_DESIGN_AUDIENCES.includes(entry)))
|
|
253
|
+
return {};
|
|
254
|
+
if (priceLists !== undefined &&
|
|
255
|
+
(!Array.isArray(priceLists) ||
|
|
256
|
+
priceLists.length > exports.STOREFRONT_DESIGN_LIMITS.visibilityPriceLists ||
|
|
257
|
+
!priceLists.every((entry) => Number.isInteger(entry))))
|
|
258
|
+
return {};
|
|
259
|
+
return {
|
|
260
|
+
visibility: {
|
|
261
|
+
audiences: [...audiences],
|
|
262
|
+
...(priceLists === undefined ? {} : { priceLists: [...priceLists] }),
|
|
263
|
+
},
|
|
264
|
+
};
|
|
265
|
+
}
|
|
218
266
|
function previewSections(input) {
|
|
219
267
|
if (!Array.isArray(input) || input.length > exports.STOREFRONT_DESIGN_LIMITS.sectionsPerPage)
|
|
220
268
|
return undefined;
|
|
@@ -231,6 +279,7 @@ function previewSections(input) {
|
|
|
231
279
|
type: entry.type,
|
|
232
280
|
enabled: entry.enabled,
|
|
233
281
|
content: entry.content,
|
|
282
|
+
...previewVisibility(entry.visibility),
|
|
234
283
|
});
|
|
235
284
|
}
|
|
236
285
|
return sections;
|
|
@@ -253,6 +302,7 @@ function previewPage(input) {
|
|
|
253
302
|
enabled: input.enabled,
|
|
254
303
|
sections,
|
|
255
304
|
...(input.seo === undefined ? {} : { seo: input.seo }),
|
|
305
|
+
...previewVisibility(input.visibility),
|
|
256
306
|
};
|
|
257
307
|
}
|
|
258
308
|
/** Checks transport structure and UTF-8 size; unfamiliar section types are skipped, never rendered. */
|
|
@@ -13,6 +13,12 @@ export declare const STOREFRONT_DESIGN_LIMITS: {
|
|
|
13
13
|
readonly pageAliases: 20;
|
|
14
14
|
readonly pageAliasMetadataBytes: number;
|
|
15
15
|
readonly sectionsPerPage: 10;
|
|
16
|
+
/**
|
|
17
|
+
* How many sections of one `STOREFRONT_REPEATABLE_SECTION_TYPES` type a page may hold, disabled
|
|
18
|
+
* sections included; a fifth is `SECTION_TYPE_LIMIT` at its `type` path. Every other type is
|
|
19
|
+
* once per page (a second is `DUPLICATE`), and `sectionsPerPage` still caps the whole page.
|
|
20
|
+
*/
|
|
21
|
+
readonly repeatableSectionsPerType: 4;
|
|
16
22
|
readonly productCountMin: 4;
|
|
17
23
|
readonly productCountMax: 24;
|
|
18
24
|
readonly productCountDefault: 8;
|
|
@@ -25,6 +31,8 @@ export declare const STOREFRONT_DESIGN_LIMITS: {
|
|
|
25
31
|
readonly benefits: 8;
|
|
26
32
|
readonly historyEntries: 20;
|
|
27
33
|
readonly selectedSourceIds: 50;
|
|
34
|
+
/** A `visibility` rule's `priceLists`: the store's own cap on price lists. */
|
|
35
|
+
readonly visibilityPriceLists: 64;
|
|
28
36
|
readonly documentBytes: number;
|
|
29
37
|
readonly heading: 120;
|
|
30
38
|
readonly label: 80;
|
|
@@ -58,6 +66,13 @@ export declare const STOREFRONT_DESIGN_LIMITS: {
|
|
|
58
66
|
export declare const STOREFRONT_PAGE_SLUG_RE: RegExp;
|
|
59
67
|
export declare const isStorefrontPageSlug: (value: unknown) => value is string;
|
|
60
68
|
export declare const STOREFRONT_SECTION_TYPES: readonly ["banner", "imageText", "products", "categories", "brands", "text", "faq", "benefits", "contact", "paymentDelivery"];
|
|
69
|
+
/**
|
|
70
|
+
* The section types a page may repeat, each up to `STOREFRONT_DESIGN_LIMITS.repeatableSectionsPerType`
|
|
71
|
+
* times (disabled sections count), so a Home can show offers and new arrivals together. Every other
|
|
72
|
+
* type is once per page. Draft save and publish both enforce it; the editor reads the same list.
|
|
73
|
+
*/
|
|
74
|
+
export declare const STOREFRONT_REPEATABLE_SECTION_TYPES: readonly ["products", "banner", "imageText", "text"];
|
|
75
|
+
export type StorefrontRepeatableSectionType = (typeof STOREFRONT_REPEATABLE_SECTION_TYPES)[number];
|
|
61
76
|
/**
|
|
62
77
|
* The storefront routes a design link may target by name. `incomes` is the
|
|
63
78
|
* always-available recency listing (`/products/incomes`); `new` is the separate
|
|
@@ -78,6 +93,12 @@ export declare const STOREFRONT_PROTECTED_BUILTIN_DESTINATIONS: readonly ["searc
|
|
|
78
93
|
export declare const STOREFRONT_CONTACT_FIELDS: readonly ["email", "phone", "whatsapp", "address", "hours", "socials"];
|
|
79
94
|
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"];
|
|
80
95
|
export declare const STOREFRONT_BENEFIT_ICONS: readonly ["truck", "shield", "credit-card", "store", "heart", "check"];
|
|
96
|
+
/**
|
|
97
|
+
* Who a `visibility` rule may name. `guest`: no approved customer resolved. `customer`: any
|
|
98
|
+
* approved customer. `retail` / `wholesale`: an approved customer whose list's `audienceClass`
|
|
99
|
+
* is that class, an absent class meaning `retail`.
|
|
100
|
+
*/
|
|
101
|
+
export declare const STOREFRONT_DESIGN_AUDIENCES: readonly ["guest", "customer", "retail", "wholesale"];
|
|
81
102
|
export declare function createStorefrontDesignV1(): StorefrontDesignV1;
|
|
82
103
|
declare global {
|
|
83
104
|
type StorefrontDesignSectionType = (typeof STOREFRONT_SECTION_TYPES)[number];
|
|
@@ -189,12 +210,27 @@ declare global {
|
|
|
189
210
|
showDelivery?: boolean;
|
|
190
211
|
};
|
|
191
212
|
}
|
|
213
|
+
type StorefrontDesignAudience = (typeof STOREFRONT_DESIGN_AUDIENCES)[number];
|
|
214
|
+
/**
|
|
215
|
+
* Who sees a section, page, navigation entry (top level or child) or footer link. Absent means
|
|
216
|
+
* everyone. A caller sees the item when any listed audience matches it, or when its price list
|
|
217
|
+
* is in `priceLists`. A list deleted after publish matches no one. Carries no `kind` or `id` key,
|
|
218
|
+
* so the reference and identity walkers pass over it.
|
|
219
|
+
*
|
|
220
|
+
* Web `GET /store` filters by it and strips it, marking each item visible through a rule
|
|
221
|
+
* `audienceScoped: true`. The private preview is not filtered and carries it as authored.
|
|
222
|
+
*/
|
|
223
|
+
interface StorefrontDesignVisibility {
|
|
224
|
+
audiences: StorefrontDesignAudience[];
|
|
225
|
+
priceLists?: number[];
|
|
226
|
+
}
|
|
192
227
|
type StorefrontDesignSection = {
|
|
193
228
|
[K in StorefrontDesignSectionType]: {
|
|
194
229
|
id: string;
|
|
195
230
|
type: K;
|
|
196
231
|
enabled: boolean;
|
|
197
232
|
content: StorefrontDesignSectionContent[K];
|
|
233
|
+
visibility?: StorefrontDesignVisibility;
|
|
198
234
|
};
|
|
199
235
|
}[StorefrontDesignSectionType];
|
|
200
236
|
interface StorefrontDesignPublicationMetadata {
|
|
@@ -214,6 +250,7 @@ declare global {
|
|
|
214
250
|
enabled: boolean;
|
|
215
251
|
seo?: StorefrontDesignSeo;
|
|
216
252
|
sections: StorefrontDesignSection[];
|
|
253
|
+
visibility?: StorefrontDesignVisibility;
|
|
217
254
|
}
|
|
218
255
|
interface StorefrontDesignHome {
|
|
219
256
|
id: 'home';
|
|
@@ -225,6 +262,7 @@ declare global {
|
|
|
225
262
|
id: string;
|
|
226
263
|
label?: string;
|
|
227
264
|
target?: StorefrontDesignLinkTarget;
|
|
265
|
+
visibility?: StorefrontDesignVisibility;
|
|
228
266
|
}
|
|
229
267
|
interface StorefrontDesignNavigationEntry extends StorefrontDesignMenuLink {
|
|
230
268
|
children?: StorefrontDesignMenuLink[];
|
|
@@ -292,6 +330,10 @@ declare global {
|
|
|
292
330
|
* alone is not servable. Never route it through `/fit-in/`: the media path is refused there.
|
|
293
331
|
* Private preview envelopes instead supply `/preview/read?operation=asset&assetId=...`; the
|
|
294
332
|
* preview transport adds a variant query and its in-memory grant, then renders returned bytes.
|
|
333
|
+
*
|
|
334
|
+
* An item that can carry `visibility` (section, page, navigation entry, footer link) may also
|
|
335
|
+
* carry `audienceScoped: true`: web `GET /store` sets it on an item it returned because the
|
|
336
|
+
* caller matched that item's rule, and strips every `visibility`. The preview never sets it.
|
|
295
337
|
*/
|
|
296
338
|
type PublicStorefrontDesignValue<T> = T extends StorefrontDesignImagePlacement ? T & {
|
|
297
339
|
url: string;
|
|
@@ -301,7 +343,11 @@ declare global {
|
|
|
301
343
|
id: string;
|
|
302
344
|
} ? T & {
|
|
303
345
|
slug: string;
|
|
304
|
-
} : T extends readonly (infer V)[] ? PublicStorefrontDesignValue<V>[] : T extends object ? {
|
|
346
|
+
} : T extends readonly (infer V)[] ? PublicStorefrontDesignValue<V>[] : T extends object ? 'visibility' extends keyof T ? {
|
|
347
|
+
[K in keyof T]: PublicStorefrontDesignValue<T[K]>;
|
|
348
|
+
} & {
|
|
349
|
+
audienceScoped?: true;
|
|
350
|
+
} : {
|
|
305
351
|
[K in keyof T]: PublicStorefrontDesignValue<T[K]>;
|
|
306
352
|
} : T;
|
|
307
353
|
type PublicStorefrontDesign = PublicStorefrontDesignValue<Omit<StorefrontDesignPublic, 'literalOverrides'>>;
|
|
@@ -333,8 +379,14 @@ declare global {
|
|
|
333
379
|
seo: StorefrontDesignSeo;
|
|
334
380
|
literalOverrides: Record<string, string>;
|
|
335
381
|
}
|
|
336
|
-
/**
|
|
337
|
-
|
|
382
|
+
/**
|
|
383
|
+
* `TOO_LARGE` at path `''` means the whole stored draft would exceed its row budget, not one field.
|
|
384
|
+
* At `<page>.sections.<index>.type`, `DUPLICATE` is a second section of a once-per-page type and
|
|
385
|
+
* `SECTION_TYPE_LIMIT` is a section past `repeatableSectionsPerType` of a repeatable type.
|
|
386
|
+
*/
|
|
387
|
+
type StorefrontDesignFieldErrorCode = 'INVALID' | 'REQUIRED' | 'UNKNOWN_KEY' | 'DUPLICATE' | 'SECTION_TYPE_LIMIT' | 'RESERVED_SLUG' | 'ALIAS_CONFLICT' | 'ALIAS_LIMIT' | 'DANGLING_REFERENCE' | 'MAPPING_CONFLICT' | 'TOO_LARGE'
|
|
388
|
+
/** A `visibility.priceLists` entry naming no list of the store's `priceLists`; refused on draft save. */
|
|
389
|
+
| 'UNKNOWN_PRICE_LIST';
|
|
338
390
|
interface StorefrontDesignFieldError {
|
|
339
391
|
path: string;
|
|
340
392
|
code: StorefrontDesignFieldErrorCode;
|
|
@@ -650,6 +702,8 @@ declare global {
|
|
|
650
702
|
type: StorefrontDesignSectionType;
|
|
651
703
|
enabled: boolean;
|
|
652
704
|
content: Record<string, unknown>;
|
|
705
|
+
/** Carried as authored when well-formed, as navigation and footer entries carry theirs; never applied. */
|
|
706
|
+
visibility?: StorefrontDesignVisibility;
|
|
653
707
|
}
|
|
654
708
|
interface StorefrontPreviewDocument {
|
|
655
709
|
schemaVersion: 1;
|
|
@@ -669,6 +723,7 @@ declare global {
|
|
|
669
723
|
enabled: boolean;
|
|
670
724
|
sections: StorefrontPreviewSection[];
|
|
671
725
|
seo?: object;
|
|
726
|
+
visibility?: StorefrontDesignVisibility;
|
|
672
727
|
}[];
|
|
673
728
|
navigation: object[];
|
|
674
729
|
footer: object[];
|
package/dist/storefrontDesign.js
CHANGED
|
@@ -12,6 +12,12 @@ export const STOREFRONT_DESIGN_LIMITS = {
|
|
|
12
12
|
pageAliases: 20,
|
|
13
13
|
pageAliasMetadataBytes: 64 * 1024,
|
|
14
14
|
sectionsPerPage: 10,
|
|
15
|
+
/**
|
|
16
|
+
* How many sections of one `STOREFRONT_REPEATABLE_SECTION_TYPES` type a page may hold, disabled
|
|
17
|
+
* sections included; a fifth is `SECTION_TYPE_LIMIT` at its `type` path. Every other type is
|
|
18
|
+
* once per page (a second is `DUPLICATE`), and `sectionsPerPage` still caps the whole page.
|
|
19
|
+
*/
|
|
20
|
+
repeatableSectionsPerType: 4,
|
|
15
21
|
productCountMin: 4,
|
|
16
22
|
productCountMax: 24,
|
|
17
23
|
productCountDefault: 8,
|
|
@@ -24,6 +30,8 @@ export const STOREFRONT_DESIGN_LIMITS = {
|
|
|
24
30
|
benefits: 8,
|
|
25
31
|
historyEntries: 20,
|
|
26
32
|
selectedSourceIds: 50,
|
|
33
|
+
/** A `visibility` rule's `priceLists`: the store's own cap on price lists. */
|
|
34
|
+
visibilityPriceLists: 64,
|
|
27
35
|
documentBytes: 256 * 1024,
|
|
28
36
|
heading: 120,
|
|
29
37
|
label: 80,
|
|
@@ -68,6 +76,17 @@ export const STOREFRONT_SECTION_TYPES = [
|
|
|
68
76
|
'contact',
|
|
69
77
|
'paymentDelivery',
|
|
70
78
|
];
|
|
79
|
+
/**
|
|
80
|
+
* The section types a page may repeat, each up to `STOREFRONT_DESIGN_LIMITS.repeatableSectionsPerType`
|
|
81
|
+
* times (disabled sections count), so a Home can show offers and new arrivals together. Every other
|
|
82
|
+
* type is once per page. Draft save and publish both enforce it; the editor reads the same list.
|
|
83
|
+
*/
|
|
84
|
+
export const STOREFRONT_REPEATABLE_SECTION_TYPES = [
|
|
85
|
+
'products',
|
|
86
|
+
'banner',
|
|
87
|
+
'imageText',
|
|
88
|
+
'text',
|
|
89
|
+
];
|
|
71
90
|
/**
|
|
72
91
|
* The storefront routes a design link may target by name. `incomes` is the
|
|
73
92
|
* always-available recency listing (`/products/incomes`); `new` is the separate
|
|
@@ -143,6 +162,12 @@ export const STOREFRONT_RESERVED_SLUGS = [
|
|
|
143
162
|
'mantenimiento',
|
|
144
163
|
];
|
|
145
164
|
export const STOREFRONT_BENEFIT_ICONS = ['truck', 'shield', 'credit-card', 'store', 'heart', 'check'];
|
|
165
|
+
/**
|
|
166
|
+
* Who a `visibility` rule may name. `guest`: no approved customer resolved. `customer`: any
|
|
167
|
+
* approved customer. `retail` / `wholesale`: an approved customer whose list's `audienceClass`
|
|
168
|
+
* is that class, an absent class meaning `retail`.
|
|
169
|
+
*/
|
|
170
|
+
export const STOREFRONT_DESIGN_AUDIENCES = ['guest', 'customer', 'retail', 'wholesale'];
|
|
146
171
|
export function createStorefrontDesignV1() {
|
|
147
172
|
return {
|
|
148
173
|
schemaVersion: 1,
|
|
@@ -207,6 +232,29 @@ function previewWithinBytes(value, maximum) {
|
|
|
207
232
|
return false;
|
|
208
233
|
}
|
|
209
234
|
}
|
|
235
|
+
/**
|
|
236
|
+
* A `visibility` rule kept on the transport only when well-formed: known audiences, and integer
|
|
237
|
+
* price lists within the store cap. Anything else is left off rather than failing the frame — the
|
|
238
|
+
* preview never filters by it, it only shows the rule the editor authored.
|
|
239
|
+
*/
|
|
240
|
+
function previewVisibility(input) {
|
|
241
|
+
if (!previewRecord(input) || !Array.isArray(input.audiences))
|
|
242
|
+
return {};
|
|
243
|
+
const { audiences, priceLists } = input;
|
|
244
|
+
if (!audiences.every((entry) => STOREFRONT_DESIGN_AUDIENCES.includes(entry)))
|
|
245
|
+
return {};
|
|
246
|
+
if (priceLists !== undefined &&
|
|
247
|
+
(!Array.isArray(priceLists) ||
|
|
248
|
+
priceLists.length > STOREFRONT_DESIGN_LIMITS.visibilityPriceLists ||
|
|
249
|
+
!priceLists.every((entry) => Number.isInteger(entry))))
|
|
250
|
+
return {};
|
|
251
|
+
return {
|
|
252
|
+
visibility: {
|
|
253
|
+
audiences: [...audiences],
|
|
254
|
+
...(priceLists === undefined ? {} : { priceLists: [...priceLists] }),
|
|
255
|
+
},
|
|
256
|
+
};
|
|
257
|
+
}
|
|
210
258
|
function previewSections(input) {
|
|
211
259
|
if (!Array.isArray(input) || input.length > STOREFRONT_DESIGN_LIMITS.sectionsPerPage)
|
|
212
260
|
return undefined;
|
|
@@ -223,6 +271,7 @@ function previewSections(input) {
|
|
|
223
271
|
type: entry.type,
|
|
224
272
|
enabled: entry.enabled,
|
|
225
273
|
content: entry.content,
|
|
274
|
+
...previewVisibility(entry.visibility),
|
|
226
275
|
});
|
|
227
276
|
}
|
|
228
277
|
return sections;
|
|
@@ -245,6 +294,7 @@ function previewPage(input) {
|
|
|
245
294
|
enabled: input.enabled,
|
|
246
295
|
sections,
|
|
247
296
|
...(input.seo === undefined ? {} : { seo: input.seo }),
|
|
297
|
+
...previewVisibility(input.visibility),
|
|
248
298
|
};
|
|
249
299
|
}
|
|
250
300
|
/** Checks transport structure and UTF-8 size; unfamiliar section types are skipped, never rendered. */
|