@selfhelp/shared 1.21.3 → 1.21.5
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/CHANGELOG.md +83 -0
- package/README.md +2 -1
- package/dist/index.d.mts +427 -20
- package/dist/index.d.ts +427 -20
- package/dist/index.js +560 -13
- package/dist/index.mjs +518 -13
- package/dist/plugin-sdk/index.d.mts +1 -1
- package/dist/plugin-sdk/index.d.ts +1 -1
- package/dist/plugin-sdk/index.js +2 -1
- package/dist/plugin-sdk/index.mjs +2 -1
- package/dist/registry/index.d.mts +2 -2
- package/dist/registry/index.d.ts +2 -2
- package/dist/registry/index.js +2 -1
- package/dist/registry/index.mjs +2 -1
- package/dist/{styles.registry-DEDEZ8l3.d.ts → styles.registry-DX79oirw.d.ts} +93 -16
- package/dist/{styles.registry-DHM4M77N.d.mts → styles.registry-ffw0MH3r.d.mts} +93 -16
- package/package.json +1 -1
- package/src/content/__tests__/fieldsMapLabels.test.ts +55 -0
- package/src/content/__tests__/optionLabels.test.ts +100 -0
- package/src/content/fieldsMapLabels.ts +103 -0
- package/src/content/index.ts +2 -0
- package/src/content/optionLabels.ts +200 -0
- package/src/navigation/__tests__/navigation.test.ts +296 -6
- package/src/navigation/activeTrail.ts +99 -0
- package/src/navigation/branchNav.ts +155 -6
- package/src/navigation/footerPreset.ts +109 -0
- package/src/navigation/headerLayers.ts +56 -0
- package/src/navigation/headerPreset.ts +9 -2
- package/src/navigation/index.ts +4 -0
- package/src/navigation/menuDepth.ts +73 -37
- package/src/navigation/mobileRoute.ts +25 -0
- package/src/navigation/navLinks.ts +0 -4
- package/src/navigation/navigationBundle.ts +81 -0
- package/src/navigation/navigationPayload.ts +96 -17
- package/src/registry/__tests__/platform.test.ts +11 -10
- package/src/registry/styles.registry.ts +2 -1
- package/src/types/__tests__/preview-bridge.test.ts +7 -0
- package/src/types/auth.ts +4 -0
- package/src/types/cms-app.ts +74 -0
- package/src/types/index.ts +1 -0
- package/src/types/mobile-adapters.ts +1 -0
- package/src/types/pages.ts +6 -0
- package/src/types/preview-bridge.ts +12 -1
- package/src/types/styles/composite.ts +21 -0
- package/src/types/styles/forms.ts +57 -10
- package/src/types/styles/interactive.ts +1 -1
- package/src/types/styles/unknown.ts +2 -2
package/dist/index.js
CHANGED
|
@@ -37,13 +37,17 @@ __export(index_exports, {
|
|
|
37
37
|
CLIENT_TYPE_MOBILE: () => CLIENT_TYPE_MOBILE,
|
|
38
38
|
CLIENT_TYPE_MOBILE_AND_WEB: () => CLIENT_TYPE_MOBILE_AND_WEB,
|
|
39
39
|
CLIENT_TYPE_WEB: () => CLIENT_TYPE_WEB,
|
|
40
|
+
CMS_APP_PRIMARY_ROLES: () => CMS_APP_PRIMARY_ROLES,
|
|
41
|
+
CMS_APP_ROLES: () => CMS_APP_ROLES,
|
|
40
42
|
COLOR_NAMES: () => COLOR_NAMES,
|
|
41
43
|
COLOR_PALETTE: () => COLOR_PALETTE,
|
|
42
44
|
COLOR_SCALES: () => COLOR_SCALES,
|
|
43
45
|
CONTAINER_SIZE_PX: () => CONTAINER_SIZE_PX,
|
|
44
46
|
DEFAULT_MOBILE_ICON: () => DEFAULT_MOBILE_ICON,
|
|
47
|
+
DEFAULT_WEB_FOOTER_PRESET: () => DEFAULT_WEB_FOOTER_PRESET,
|
|
45
48
|
DEFAULT_WEB_HEADER_PRESET: () => DEFAULT_WEB_HEADER_PRESET,
|
|
46
49
|
ENDPOINTS: () => ENDPOINTS,
|
|
50
|
+
FIELDS_MAP_STYLE_CONFIG: () => FIELDS_MAP_STYLE_CONFIG,
|
|
47
51
|
FONT_SIZE_PX: () => FONT_SIZE_PX,
|
|
48
52
|
FULL_RADIUS_PX: () => FULL_RADIUS_PX,
|
|
49
53
|
HEADER_CLIENT_TYPE: () => HEADER_CLIENT_TYPE,
|
|
@@ -52,6 +56,11 @@ __export(index_exports, {
|
|
|
52
56
|
MOBILE_ICON_NAMES: () => MOBILE_ICON_NAMES,
|
|
53
57
|
MOBILE_ICON_SET: () => MOBILE_ICON_SET,
|
|
54
58
|
MOBILE_PREVIEW_ENDPOINTS: () => MOBILE_PREVIEW_ENDPOINTS,
|
|
59
|
+
NAVIGATION_BRANDING_LOGO_HEIGHTS: () => NAVIGATION_BRANDING_LOGO_HEIGHTS,
|
|
60
|
+
NAVIGATION_BUNDLE_FORMAT: () => NAVIGATION_BUNDLE_FORMAT,
|
|
61
|
+
NAVIGATION_BUNDLE_VERSION: () => NAVIGATION_BUNDLE_VERSION,
|
|
62
|
+
NAVIGATION_HEADER_LAYER_TOP: () => NAVIGATION_HEADER_LAYER_TOP,
|
|
63
|
+
OPTION_STYLE_CONFIGS: () => OPTION_STYLE_CONFIGS,
|
|
55
64
|
PERMISSIONS: () => PERMISSIONS,
|
|
56
65
|
PREVIEW_BRIDGE_MESSAGE: () => PREVIEW_BRIDGE_MESSAGE,
|
|
57
66
|
PREVIEW_PARENT_ORIGIN_PARAM: () => PREVIEW_PARENT_ORIGIN_PARAM,
|
|
@@ -64,29 +73,38 @@ __export(index_exports, {
|
|
|
64
73
|
SPACING_VALUES: () => SPACING_VALUES,
|
|
65
74
|
STYLE_REGISTRY: () => STYLE_REGISTRY,
|
|
66
75
|
SYSTEM_ENDPOINTS: () => SYSTEM_ENDPOINTS,
|
|
76
|
+
WEB_FOOTER_PRESET_OPTIONS: () => WEB_FOOTER_PRESET_OPTIONS,
|
|
77
|
+
WEB_FOOTER_PRESET_VALUES: () => WEB_FOOTER_PRESET_VALUES,
|
|
67
78
|
WEB_HEADER_PRESET_OPTIONS: () => WEB_HEADER_PRESET_OPTIONS,
|
|
68
79
|
WEB_HEADER_PRESET_VALUES: () => WEB_HEADER_PRESET_VALUES,
|
|
69
80
|
_resetPluginStyleRegistry: () => _resetPluginStyleRegistry,
|
|
70
81
|
arePreviewPreferencesEqual: () => arePreviewPreferencesEqual,
|
|
71
82
|
buildConditionContext: () => buildConditionContext,
|
|
83
|
+
buildPublicPathFromRoute: () => buildPublicPathFromRoute,
|
|
72
84
|
clampMenuItemsAtDepth: () => clampMenuItemsAtDepth,
|
|
73
85
|
classifyClass: () => classifyClass,
|
|
74
86
|
classifyClassString: () => classifyClassString,
|
|
75
87
|
collectPageIdsFromMenuItems: () => collectPageIdsFromMenuItems,
|
|
76
88
|
colorToHex: () => colorToHex,
|
|
77
89
|
evaluateCondition: () => evaluateCondition,
|
|
90
|
+
expandedIdsForActiveTrail: () => expandedIdsForActiveTrail,
|
|
78
91
|
extendStyleRegistry: () => extendStyleRegistry,
|
|
79
92
|
findMenuItemByPageId: () => findMenuItemByPageId,
|
|
80
93
|
findNearestBottomTabMenuItemForPage: () => findNearestBottomTabMenuItemForPage,
|
|
81
94
|
findPageRefInNavigationPayload: () => findPageRefInNavigationPayload,
|
|
82
95
|
findRemap: () => findRemap,
|
|
96
|
+
flattenFooterItems: () => flattenFooterItems,
|
|
83
97
|
flattenMenuItems: () => flattenMenuItems,
|
|
84
98
|
flattenNavigationMenuItems: () => flattenNavigationMenuItems,
|
|
99
|
+
footerColumnItems: () => footerColumnItems,
|
|
100
|
+
footerGroupLinks: () => footerGroupLinks,
|
|
101
|
+
footerStandaloneItems: () => footerStandaloneItems,
|
|
85
102
|
getMergedStyleRegistry: () => getMergedStyleRegistry,
|
|
86
103
|
getNavigationItemAriaLabel: () => getNavigationItemAriaLabel,
|
|
87
104
|
getNavigationItemHref: () => getNavigationItemHref,
|
|
88
105
|
getNavigationItemKeyword: () => getNavigationItemKeyword,
|
|
89
106
|
getNavigationItemLabel: () => getNavigationItemLabel,
|
|
107
|
+
getNavigationItemMobileHref: () => getNavigationItemMobileHref,
|
|
90
108
|
getPluginStyleRegistry: () => getPluginStyleRegistry,
|
|
91
109
|
getRegistryEntry: () => getRegistryEntry,
|
|
92
110
|
getRegistryEntryAny: () => getRegistryEntryAny,
|
|
@@ -96,8 +114,12 @@ __export(index_exports, {
|
|
|
96
114
|
gridSpanToReactNativeColumn: () => gridSpanToReactNativeColumn,
|
|
97
115
|
hasInlineFormatting: () => hasInlineFormatting,
|
|
98
116
|
isBottomTabMenuItemActive: () => isBottomTabMenuItemActive,
|
|
117
|
+
isDoubleWebHeaderPreset: () => isDoubleWebHeaderPreset,
|
|
99
118
|
isKnownStyleName: () => isKnownStyleName,
|
|
119
|
+
isMenuItemActiveOnMobile: () => isMenuItemActiveOnMobile,
|
|
120
|
+
isMenuItemActiveOnWeb: () => isMenuItemActiveOnWeb,
|
|
100
121
|
isMobileIconName: () => isMobileIconName,
|
|
122
|
+
isNavigationBundleVersionSupported: () => isNavigationBundleVersionSupported,
|
|
101
123
|
isOnAnyMobileMenu: () => isOnAnyMobileMenu,
|
|
102
124
|
isOnAnyMobileMenuFromPayload: () => isOnAnyMobileMenuFromPayload,
|
|
103
125
|
isPageInMenuTree: () => isPageInMenuTree,
|
|
@@ -110,6 +132,7 @@ __export(index_exports, {
|
|
|
110
132
|
isStyleAllowedOnPage: () => isStyleAllowedOnPage,
|
|
111
133
|
isStylePlacementAllowed: () => isStylePlacementAllowed,
|
|
112
134
|
isStyleSupportedOnPlatform: () => isStyleSupportedOnPlatform,
|
|
135
|
+
isWebFooterPreset: () => isWebFooterPreset,
|
|
113
136
|
isWebHeaderPreset: () => isWebHeaderPreset,
|
|
114
137
|
mapAccordionVariantToHeroUiVariant: () => mapAccordionVariantToHeroUiVariant,
|
|
115
138
|
mapChipVariantToHeroUiVariant: () => mapChipVariantToHeroUiVariant,
|
|
@@ -122,10 +145,18 @@ __export(index_exports, {
|
|
|
122
145
|
mapSizeToHeroUi: () => mapSizeToHeroUi,
|
|
123
146
|
mapSizeToMantine: () => mapSizeToMantine,
|
|
124
147
|
mapSpacingToPx: () => mapSpacingToPx,
|
|
148
|
+
matchesMobilePath: () => matchesMobilePath,
|
|
149
|
+
matchesWebPath: () => matchesWebPath,
|
|
150
|
+
mergeHeaderLayers: () => mergeHeaderLayers,
|
|
125
151
|
pageUrlToMobileRoute: () => pageUrlToMobileRoute,
|
|
126
152
|
parseDimensionToReactNative: () => parseDimensionToReactNative,
|
|
127
153
|
parseDimensionToWeb: () => parseDimensionToWeb,
|
|
154
|
+
parseFieldsMapCatalog: () => parseFieldsMapCatalog,
|
|
155
|
+
parseFieldsMapLabels: () => parseFieldsMapLabels,
|
|
128
156
|
parseInlineRich: () => parseInlineRich,
|
|
157
|
+
parseOptionCatalog: () => parseOptionCatalog,
|
|
158
|
+
parseOptionCodes: () => parseOptionCodes,
|
|
159
|
+
parseOptionLabels: () => parseOptionLabels,
|
|
129
160
|
parseSpacing: () => parseSpacing,
|
|
130
161
|
previewKeywordFromPath: () => previewKeywordFromPath,
|
|
131
162
|
radiusToPx: () => radiusToPx,
|
|
@@ -133,6 +164,8 @@ __export(index_exports, {
|
|
|
133
164
|
resolveAssetSources: () => resolveAssetSources,
|
|
134
165
|
resolveAssetUrl: () => resolveAssetUrl,
|
|
135
166
|
resolveBranchNavGroup: () => resolveBranchNavGroup,
|
|
167
|
+
resolveBrandingPresentation: () => resolveBrandingPresentation,
|
|
168
|
+
resolveFieldsMapLabel: () => resolveFieldsMapLabel,
|
|
136
169
|
resolveHolderRedirectPath: () => resolveHolderRedirectPath,
|
|
137
170
|
resolveMantineVariant: () => resolveMantineVariant,
|
|
138
171
|
resolveMenuMaxDepth: () => resolveMenuMaxDepth,
|
|
@@ -141,20 +174,29 @@ __export(index_exports, {
|
|
|
141
174
|
resolveMobileSegmentGroup: () => resolveMobileSegmentGroup,
|
|
142
175
|
resolveMobileStartupKeyword: () => resolveMobileStartupKeyword,
|
|
143
176
|
resolveMobileStartupRoute: () => resolveMobileStartupRoute,
|
|
177
|
+
resolveOptionCodesLabels: () => resolveOptionCodesLabels,
|
|
178
|
+
resolveOptionLabel: () => resolveOptionLabel,
|
|
179
|
+
resolveOptionValueLabels: () => resolveOptionValueLabels,
|
|
180
|
+
resolveOptions: () => resolveOptions,
|
|
144
181
|
resolveSharedStyle: () => resolveSharedStyle,
|
|
145
182
|
resolveSharedStyleForMobile: () => resolveSharedStyleForMobile,
|
|
146
183
|
resolveSharedStyleForWeb: () => resolveSharedStyleForWeb,
|
|
147
184
|
resolveSharedStyleProps: () => resolveSharedStyleProps,
|
|
185
|
+
resolveWebBranchNavContext: () => resolveWebBranchNavContext,
|
|
148
186
|
resolveWebBranchNavGroup: () => resolveWebBranchNavGroup,
|
|
187
|
+
resolveWebFooterPreset: () => resolveWebFooterPreset,
|
|
149
188
|
resolveWebHeaderPreset: () => resolveWebHeaderPreset,
|
|
150
189
|
resolveWebStartupPath: () => resolveWebStartupPath,
|
|
151
190
|
searchMenuPagesInPayload: () => searchMenuPagesInPayload,
|
|
191
|
+
serializeFieldsMapCatalog: () => serializeFieldsMapCatalog,
|
|
192
|
+
serializeFieldsMapLabels: () => serializeFieldsMapLabels,
|
|
152
193
|
setToStylePlatform: () => setToStylePlatform,
|
|
153
194
|
sharedTailwindExtend: () => sharedTailwindExtend,
|
|
154
195
|
sharedTailwindPreset: () => sharedTailwindPreset,
|
|
155
196
|
sizeToFontPx: () => sizeToFontPx,
|
|
156
197
|
spacingToClasses: () => spacingToClasses,
|
|
157
198
|
spacingToPx: () => spacingToPx,
|
|
199
|
+
splitHeaderLayers: () => splitHeaderLayers,
|
|
158
200
|
stripHtmlToText: () => stripHtmlToText,
|
|
159
201
|
stylePlatformToSet: () => stylePlatformToSet,
|
|
160
202
|
toHeroUiSemanticProps: () => toHeroUiSemanticProps,
|
|
@@ -176,6 +218,10 @@ var PERMISSIONS = {
|
|
|
176
218
|
ADMIN_PAGE_VERSION_PUBLISH: "admin.page.version.publish",
|
|
177
219
|
ADMIN_PAGE_VERSION_READ: "admin.page.version.read",
|
|
178
220
|
ADMIN_PAGE_VERSION_COMPARE: "admin.page.version.compare",
|
|
221
|
+
ADMIN_CMS_APP_READ: "admin.cms_app.read",
|
|
222
|
+
ADMIN_CMS_APP_CREATE: "admin.cms_app.create",
|
|
223
|
+
ADMIN_CMS_APP_UPDATE: "admin.cms_app.update",
|
|
224
|
+
ADMIN_CMS_APP_DELETE: "admin.cms_app.delete",
|
|
179
225
|
ADMIN_USER_READ: "admin.user.read",
|
|
180
226
|
ADMIN_USER_CREATE: "admin.user.create",
|
|
181
227
|
ADMIN_USER_UPDATE: "admin.user.update",
|
|
@@ -217,6 +263,23 @@ var PERMISSIONS = {
|
|
|
217
263
|
ADMIN_AUDIT_VIEW: "admin.audit.view"
|
|
218
264
|
};
|
|
219
265
|
|
|
266
|
+
// src/types/cms-app.ts
|
|
267
|
+
var CMS_APP_ROLES = [
|
|
268
|
+
"form",
|
|
269
|
+
"cms_list",
|
|
270
|
+
"cms_detail",
|
|
271
|
+
"public_list",
|
|
272
|
+
"public_detail",
|
|
273
|
+
"other"
|
|
274
|
+
];
|
|
275
|
+
var CMS_APP_PRIMARY_ROLES = [
|
|
276
|
+
"form",
|
|
277
|
+
"cms_list",
|
|
278
|
+
"cms_detail",
|
|
279
|
+
"public_list",
|
|
280
|
+
"public_detail"
|
|
281
|
+
];
|
|
282
|
+
|
|
220
283
|
// src/types/api/system.ts
|
|
221
284
|
var SYSTEM_PREFIX = "/cms-api/v1/admin/system";
|
|
222
285
|
var SYSTEM_ENDPOINTS = {
|
|
@@ -289,7 +352,7 @@ function isPreviewBridgeMessage(value) {
|
|
|
289
352
|
case PREVIEW_BRIDGE_MESSAGE.NAVIGATED:
|
|
290
353
|
return (record.source === "web" || record.source === "mobile") && (typeof record.keyword === "string" || record.keyword === null) && typeof record.href === "string";
|
|
291
354
|
case PREVIEW_BRIDGE_MESSAGE.NAVIGATE:
|
|
292
|
-
return typeof record.keyword === "string" || record.keyword === null;
|
|
355
|
+
return (typeof record.keyword === "string" || record.keyword === null) && (record.path === void 0 || record.path === null || typeof record.path === "string");
|
|
293
356
|
case PREVIEW_BRIDGE_MESSAGE.SET_PREFERENCES:
|
|
294
357
|
return isPreviewPreferences(record.preferences);
|
|
295
358
|
case PREVIEW_BRIDGE_MESSAGE.PREFERENCES_CHANGED:
|
|
@@ -375,6 +438,7 @@ var BASE_STYLE_REGISTRY = {
|
|
|
375
438
|
// ===== forms =====
|
|
376
439
|
"form-log": { description: "Append-only form (one row per submit)", category: "forms", canHaveChildren: true },
|
|
377
440
|
"form-record": { description: "Per-user record form", category: "forms", canHaveChildren: true },
|
|
441
|
+
"entry-record-form": { description: "Route-aware create/edit form", category: "forms", canHaveChildren: true },
|
|
378
442
|
input: { description: "Plain HTML input", category: "forms", canHaveChildren: false },
|
|
379
443
|
"text-input": { description: "Mantine TextInput", category: "forms", canHaveChildren: false },
|
|
380
444
|
textarea: { description: "Mantine Textarea", category: "forms", canHaveChildren: false },
|
|
@@ -416,7 +480,7 @@ var BASE_STYLE_REGISTRY = {
|
|
|
416
480
|
version: { description: "Build/version diagnostic surface", category: "auth", canHaveChildren: false },
|
|
417
481
|
"ref-container": { description: "Renders content referenced from another section", category: "layout", canHaveChildren: true },
|
|
418
482
|
"data-container": { description: "Data-scoped container (renders subtree against a data scope)", category: "layout", canHaveChildren: true },
|
|
419
|
-
"
|
|
483
|
+
"entry-table": { description: "Built-in admin CRUD grid over a form's records (search/sort/paginate/CSV, add / edit / delete actions)", category: "forms", canHaveChildren: false }
|
|
420
484
|
};
|
|
421
485
|
var STYLE_REGISTRY = BASE_STYLE_REGISTRY;
|
|
422
486
|
var PLUGIN_STYLE_REGISTRY = {};
|
|
@@ -1572,6 +1636,183 @@ function stripHtmlToText(value) {
|
|
|
1572
1636
|
return out.replace(/\s+/g, " ").trim();
|
|
1573
1637
|
}
|
|
1574
1638
|
|
|
1639
|
+
// src/content/optionLabels.ts
|
|
1640
|
+
var OPTION_STYLE_CONFIGS = {
|
|
1641
|
+
select: {
|
|
1642
|
+
catalogField: "options",
|
|
1643
|
+
multipleField: "is_multiple"
|
|
1644
|
+
},
|
|
1645
|
+
radio: {
|
|
1646
|
+
catalogField: "radio_options"
|
|
1647
|
+
},
|
|
1648
|
+
combobox: {
|
|
1649
|
+
catalogField: "combobox_options",
|
|
1650
|
+
multipleField: "web_combobox_multi_select"
|
|
1651
|
+
},
|
|
1652
|
+
"segmented-control": {
|
|
1653
|
+
catalogField: "segmented_control_data"
|
|
1654
|
+
}
|
|
1655
|
+
};
|
|
1656
|
+
function parseJson(raw) {
|
|
1657
|
+
if (typeof raw !== "string" || raw.trim() === "") {
|
|
1658
|
+
return raw;
|
|
1659
|
+
}
|
|
1660
|
+
try {
|
|
1661
|
+
return JSON.parse(raw);
|
|
1662
|
+
} catch {
|
|
1663
|
+
return raw;
|
|
1664
|
+
}
|
|
1665
|
+
}
|
|
1666
|
+
function toString(value) {
|
|
1667
|
+
if (typeof value !== "string") return null;
|
|
1668
|
+
const trimmed = value.trim();
|
|
1669
|
+
return trimmed === "" ? null : trimmed;
|
|
1670
|
+
}
|
|
1671
|
+
function parseOptionCatalog(raw) {
|
|
1672
|
+
const parsed = parseJson(raw);
|
|
1673
|
+
if (!Array.isArray(parsed)) return [];
|
|
1674
|
+
const entries = [];
|
|
1675
|
+
for (const item of parsed) {
|
|
1676
|
+
if (item == null || typeof item !== "object") continue;
|
|
1677
|
+
const record = item;
|
|
1678
|
+
const value = toString(record.value);
|
|
1679
|
+
if (!value) continue;
|
|
1680
|
+
const explicitMeta = record.meta && typeof record.meta === "object" && !Array.isArray(record.meta) ? record.meta : {};
|
|
1681
|
+
const legacyDescription = toString(record.description);
|
|
1682
|
+
const meta = legacyDescription && explicitMeta.description === void 0 ? { ...explicitMeta, description: legacyDescription } : explicitMeta;
|
|
1683
|
+
entries.push({
|
|
1684
|
+
value,
|
|
1685
|
+
...typeof record.sort === "number" ? { sort: record.sort } : {},
|
|
1686
|
+
...typeof record.disabled === "boolean" ? { disabled: record.disabled } : {},
|
|
1687
|
+
...Object.keys(meta).length > 0 ? { meta } : {},
|
|
1688
|
+
...toString(record.label) ?? toString(record.text) ? { legacyLabel: toString(record.label) ?? toString(record.text) ?? void 0 } : {}
|
|
1689
|
+
});
|
|
1690
|
+
}
|
|
1691
|
+
return entries;
|
|
1692
|
+
}
|
|
1693
|
+
function parseOptionLabels(raw) {
|
|
1694
|
+
const parsed = parseJson(raw);
|
|
1695
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
1696
|
+
return {};
|
|
1697
|
+
}
|
|
1698
|
+
const labels = {};
|
|
1699
|
+
for (const [key, value] of Object.entries(parsed)) {
|
|
1700
|
+
if (!key || typeof value !== "string") continue;
|
|
1701
|
+
const trimmed = value.trim();
|
|
1702
|
+
if (trimmed !== "") {
|
|
1703
|
+
labels[key] = trimmed;
|
|
1704
|
+
}
|
|
1705
|
+
}
|
|
1706
|
+
return labels;
|
|
1707
|
+
}
|
|
1708
|
+
function resolveOptionLabel(code, labels, fallbackLabels = {}, legacyLabel) {
|
|
1709
|
+
if (!code) return "";
|
|
1710
|
+
return labels[code] ?? fallbackLabels[code] ?? legacyLabel ?? code;
|
|
1711
|
+
}
|
|
1712
|
+
function resolveOptions(catalogRaw, labelsRaw, fallbackLabelsRaw) {
|
|
1713
|
+
const catalog = parseOptionCatalog(catalogRaw);
|
|
1714
|
+
const labels = parseOptionLabels(labelsRaw);
|
|
1715
|
+
const fallbackLabels = parseOptionLabels(fallbackLabelsRaw);
|
|
1716
|
+
return catalog.map((entry) => ({
|
|
1717
|
+
value: entry.value,
|
|
1718
|
+
label: resolveOptionLabel(entry.value, labels, fallbackLabels, entry.legacyLabel),
|
|
1719
|
+
...entry.sort !== void 0 ? { sort: entry.sort } : {},
|
|
1720
|
+
...entry.disabled !== void 0 ? { disabled: entry.disabled } : {},
|
|
1721
|
+
...entry.meta ? { meta: entry.meta } : {}
|
|
1722
|
+
}));
|
|
1723
|
+
}
|
|
1724
|
+
function resolveOptionCodesLabels(codes, labels, fallbackLabels = {}) {
|
|
1725
|
+
return codes.map((code) => resolveOptionLabel(code, labels, fallbackLabels)).filter((label) => label !== "");
|
|
1726
|
+
}
|
|
1727
|
+
function parseOptionCodes(value) {
|
|
1728
|
+
const rawCodes = Array.isArray(value) ? value : typeof value === "string" ? value.split(",") : [];
|
|
1729
|
+
return rawCodes.filter((code) => typeof code === "string").map((code) => code.trim()).filter((code) => code !== "");
|
|
1730
|
+
}
|
|
1731
|
+
function resolveOptionValueLabels(value, labelsRaw, fallbackLabelsRaw) {
|
|
1732
|
+
return resolveOptionCodesLabels(
|
|
1733
|
+
parseOptionCodes(value),
|
|
1734
|
+
parseOptionLabels(labelsRaw),
|
|
1735
|
+
parseOptionLabels(fallbackLabelsRaw)
|
|
1736
|
+
);
|
|
1737
|
+
}
|
|
1738
|
+
|
|
1739
|
+
// src/content/fieldsMapLabels.ts
|
|
1740
|
+
var FIELDS_MAP_STYLE_CONFIG = {
|
|
1741
|
+
catalogField: "fields_map",
|
|
1742
|
+
labelsField: "fields_map_labels"
|
|
1743
|
+
};
|
|
1744
|
+
function parseJson2(raw) {
|
|
1745
|
+
if (typeof raw !== "string" || raw.trim() === "") {
|
|
1746
|
+
return raw;
|
|
1747
|
+
}
|
|
1748
|
+
try {
|
|
1749
|
+
return JSON.parse(raw);
|
|
1750
|
+
} catch {
|
|
1751
|
+
return raw;
|
|
1752
|
+
}
|
|
1753
|
+
}
|
|
1754
|
+
function parseFieldsMapCatalog(raw) {
|
|
1755
|
+
const parsed = parseJson2(raw);
|
|
1756
|
+
if (!Array.isArray(parsed)) {
|
|
1757
|
+
return [];
|
|
1758
|
+
}
|
|
1759
|
+
const keys = [];
|
|
1760
|
+
for (const item of parsed) {
|
|
1761
|
+
if (typeof item === "string" && item.trim() !== "") {
|
|
1762
|
+
keys.push(item.trim());
|
|
1763
|
+
continue;
|
|
1764
|
+
}
|
|
1765
|
+
if (item && typeof item === "object" && !Array.isArray(item)) {
|
|
1766
|
+
const record = item;
|
|
1767
|
+
const legacy = typeof record.field_name === "string" ? record.field_name.trim() : "";
|
|
1768
|
+
if (legacy !== "") {
|
|
1769
|
+
keys.push(legacy);
|
|
1770
|
+
}
|
|
1771
|
+
}
|
|
1772
|
+
}
|
|
1773
|
+
return keys;
|
|
1774
|
+
}
|
|
1775
|
+
function parseFieldsMapLabels(raw) {
|
|
1776
|
+
const parsed = parseJson2(raw);
|
|
1777
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
1778
|
+
return {};
|
|
1779
|
+
}
|
|
1780
|
+
const labels = {};
|
|
1781
|
+
for (const [key, value] of Object.entries(parsed)) {
|
|
1782
|
+
if (!key || typeof value !== "string") {
|
|
1783
|
+
continue;
|
|
1784
|
+
}
|
|
1785
|
+
const trimmed = value.trim();
|
|
1786
|
+
if (trimmed !== "") {
|
|
1787
|
+
labels[key] = trimmed;
|
|
1788
|
+
}
|
|
1789
|
+
}
|
|
1790
|
+
return labels;
|
|
1791
|
+
}
|
|
1792
|
+
function resolveFieldsMapLabel(fieldKey, labels, fallbackLabels = {}) {
|
|
1793
|
+
return labels[fieldKey] ?? fallbackLabels[fieldKey] ?? fieldKey;
|
|
1794
|
+
}
|
|
1795
|
+
function serializeFieldsMapCatalog(fieldKeys) {
|
|
1796
|
+
const keys = fieldKeys.map((key) => key.trim()).filter((key) => key !== "");
|
|
1797
|
+
if (keys.length === 0) {
|
|
1798
|
+
return "";
|
|
1799
|
+
}
|
|
1800
|
+
return JSON.stringify(keys);
|
|
1801
|
+
}
|
|
1802
|
+
function serializeFieldsMapLabels(labels) {
|
|
1803
|
+
const clean = {};
|
|
1804
|
+
for (const [key, value] of Object.entries(labels)) {
|
|
1805
|
+
const trimmed = value.trim();
|
|
1806
|
+
if (key && trimmed !== "") {
|
|
1807
|
+
clean[key] = trimmed;
|
|
1808
|
+
}
|
|
1809
|
+
}
|
|
1810
|
+
if (Object.keys(clean).length === 0) {
|
|
1811
|
+
return "";
|
|
1812
|
+
}
|
|
1813
|
+
return JSON.stringify(clean);
|
|
1814
|
+
}
|
|
1815
|
+
|
|
1575
1816
|
// src/navigation/headerPreset.ts
|
|
1576
1817
|
var WEB_HEADER_PRESET_VALUES = [
|
|
1577
1818
|
"simple",
|
|
@@ -1587,16 +1828,134 @@ var WEB_HEADER_PRESET_OPTIONS = [
|
|
|
1587
1828
|
{ value: "dropdown", label: "Dropdown", description: "Default \u2014 nested dropdown menus." },
|
|
1588
1829
|
{ value: "mega-menu", label: "Mega menu", description: "Rich sections with descriptions and icons." },
|
|
1589
1830
|
{ value: "tabs", label: "Tabs", description: "Top-level sections as tabs." },
|
|
1590
|
-
{ value: "double-dropdown", label: "Double header (dropdown)", description: "
|
|
1591
|
-
{ value: "double-mega-menu", label: "Double header (mega menu)", description: "
|
|
1831
|
+
{ value: "double-dropdown", label: "Double header (dropdown)", description: "Top row with flat links and utilities above the main dropdown nav." },
|
|
1832
|
+
{ value: "double-mega-menu", label: "Double header (mega menu)", description: "Top row with flat links and utilities above the mega menu." }
|
|
1592
1833
|
];
|
|
1834
|
+
var DOUBLE_WEB_HEADER_PRESETS = ["double-dropdown", "double-mega-menu"];
|
|
1593
1835
|
function isWebHeaderPreset(value) {
|
|
1594
1836
|
return typeof value === "string" && WEB_HEADER_PRESET_VALUES.includes(value);
|
|
1595
1837
|
}
|
|
1838
|
+
function isDoubleWebHeaderPreset(value) {
|
|
1839
|
+
return isWebHeaderPreset(value) && DOUBLE_WEB_HEADER_PRESETS.includes(value);
|
|
1840
|
+
}
|
|
1596
1841
|
function resolveWebHeaderPreset(value, fallback = DEFAULT_WEB_HEADER_PRESET) {
|
|
1597
1842
|
return isWebHeaderPreset(value) ? value : fallback;
|
|
1598
1843
|
}
|
|
1599
1844
|
|
|
1845
|
+
// src/navigation/footerPreset.ts
|
|
1846
|
+
var WEB_FOOTER_PRESET_VALUES = [
|
|
1847
|
+
"columns",
|
|
1848
|
+
"inline"
|
|
1849
|
+
];
|
|
1850
|
+
var DEFAULT_WEB_FOOTER_PRESET = "columns";
|
|
1851
|
+
var WEB_FOOTER_PRESET_OPTIONS = [
|
|
1852
|
+
{
|
|
1853
|
+
value: "columns",
|
|
1854
|
+
label: "Columns (grouped)",
|
|
1855
|
+
description: "Group headings become footer columns with their links below."
|
|
1856
|
+
},
|
|
1857
|
+
{
|
|
1858
|
+
value: "inline",
|
|
1859
|
+
label: "Inline links",
|
|
1860
|
+
description: "One flat centered link row; group links are shown inline, headings hidden. Groups are kept and restored when switching back."
|
|
1861
|
+
}
|
|
1862
|
+
];
|
|
1863
|
+
function isWebFooterPreset(value) {
|
|
1864
|
+
return typeof value === "string" && WEB_FOOTER_PRESET_VALUES.includes(value);
|
|
1865
|
+
}
|
|
1866
|
+
function resolveWebFooterPreset(value, fallback = DEFAULT_WEB_FOOTER_PRESET) {
|
|
1867
|
+
return isWebFooterPreset(value) ? value : fallback;
|
|
1868
|
+
}
|
|
1869
|
+
function isRenderableFooterLeaf(item) {
|
|
1870
|
+
if (!item.is_active) {
|
|
1871
|
+
return false;
|
|
1872
|
+
}
|
|
1873
|
+
if (item.item_type === "external_url") {
|
|
1874
|
+
return item.external_url != null && item.external_url !== "";
|
|
1875
|
+
}
|
|
1876
|
+
return item.item_type === "page" && item.page != null;
|
|
1877
|
+
}
|
|
1878
|
+
function flattenFooterItems(items) {
|
|
1879
|
+
const out = [];
|
|
1880
|
+
for (const item of items) {
|
|
1881
|
+
if (!item.is_active) {
|
|
1882
|
+
continue;
|
|
1883
|
+
}
|
|
1884
|
+
if (item.item_type === "group") {
|
|
1885
|
+
out.push(...flattenFooterItems(item.children));
|
|
1886
|
+
continue;
|
|
1887
|
+
}
|
|
1888
|
+
if (isRenderableFooterLeaf(item)) {
|
|
1889
|
+
out.push(item);
|
|
1890
|
+
out.push(...flattenFooterItems(item.children));
|
|
1891
|
+
}
|
|
1892
|
+
}
|
|
1893
|
+
return out;
|
|
1894
|
+
}
|
|
1895
|
+
function footerColumnItems(items) {
|
|
1896
|
+
return items.filter(
|
|
1897
|
+
(item) => item.is_active && item.item_type === "group" && item.children.some(isRenderableFooterLeaf)
|
|
1898
|
+
);
|
|
1899
|
+
}
|
|
1900
|
+
function footerStandaloneItems(items) {
|
|
1901
|
+
return items.filter((item) => item.item_type !== "group" && isRenderableFooterLeaf(item));
|
|
1902
|
+
}
|
|
1903
|
+
function footerGroupLinks(group) {
|
|
1904
|
+
return group.children.filter(isRenderableFooterLeaf);
|
|
1905
|
+
}
|
|
1906
|
+
|
|
1907
|
+
// src/navigation/headerLayers.ts
|
|
1908
|
+
var NAVIGATION_HEADER_LAYER_TOP = "top";
|
|
1909
|
+
function byPosition(a, b) {
|
|
1910
|
+
return a.position - b.position || a.id - b.id;
|
|
1911
|
+
}
|
|
1912
|
+
function splitHeaderLayers(items) {
|
|
1913
|
+
const top = [];
|
|
1914
|
+
const main = [];
|
|
1915
|
+
for (const item of items) {
|
|
1916
|
+
if (item.layer === NAVIGATION_HEADER_LAYER_TOP) {
|
|
1917
|
+
top.push(item);
|
|
1918
|
+
} else {
|
|
1919
|
+
main.push(item);
|
|
1920
|
+
}
|
|
1921
|
+
}
|
|
1922
|
+
top.sort(byPosition);
|
|
1923
|
+
main.sort(byPosition);
|
|
1924
|
+
return { top, main };
|
|
1925
|
+
}
|
|
1926
|
+
function mergeHeaderLayers(items) {
|
|
1927
|
+
const { top, main } = splitHeaderLayers(items);
|
|
1928
|
+
return [...main, ...top];
|
|
1929
|
+
}
|
|
1930
|
+
|
|
1931
|
+
// src/navigation/navigationPayload.ts
|
|
1932
|
+
var NAVIGATION_BRANDING_LOGO_HEIGHTS = {
|
|
1933
|
+
sm: 24,
|
|
1934
|
+
md: 32,
|
|
1935
|
+
lg: 44,
|
|
1936
|
+
xl: 56
|
|
1937
|
+
};
|
|
1938
|
+
function resolveBrandingPresentation(branding) {
|
|
1939
|
+
const size = branding?.logo_size ?? "md";
|
|
1940
|
+
const requestedVariant = branding?.logo_variant ?? "logo-and-name";
|
|
1941
|
+
const hasLogo = Boolean(branding?.logo_url);
|
|
1942
|
+
const variant = hasLogo ? requestedVariant : "name-only";
|
|
1943
|
+
return {
|
|
1944
|
+
size,
|
|
1945
|
+
variant,
|
|
1946
|
+
logoHeight: NAVIGATION_BRANDING_LOGO_HEIGHTS[size],
|
|
1947
|
+
showLogo: variant !== "name-only",
|
|
1948
|
+
showName: variant !== "logo-only"
|
|
1949
|
+
};
|
|
1950
|
+
}
|
|
1951
|
+
|
|
1952
|
+
// src/navigation/navigationBundle.ts
|
|
1953
|
+
var NAVIGATION_BUNDLE_FORMAT = "selfhelp/navigation-bundle";
|
|
1954
|
+
var NAVIGATION_BUNDLE_VERSION = "2.0";
|
|
1955
|
+
function isNavigationBundleVersionSupported(version) {
|
|
1956
|
+
return version === NAVIGATION_BUNDLE_VERSION;
|
|
1957
|
+
}
|
|
1958
|
+
|
|
1600
1959
|
// src/navigation/menuMembership.ts
|
|
1601
1960
|
function flattenItems(items) {
|
|
1602
1961
|
const out = [];
|
|
@@ -1661,6 +2020,22 @@ function findPageRefInNavigationPayload(payload, pageId) {
|
|
|
1661
2020
|
}
|
|
1662
2021
|
|
|
1663
2022
|
// src/navigation/mobileRoute.ts
|
|
2023
|
+
function buildPublicPathFromRoute(urlTemplate, routeParams) {
|
|
2024
|
+
if (!urlTemplate || !urlTemplate.includes("{")) {
|
|
2025
|
+
return null;
|
|
2026
|
+
}
|
|
2027
|
+
let path = urlTemplate;
|
|
2028
|
+
for (const [key, value] of Object.entries(routeParams)) {
|
|
2029
|
+
if (value === void 0 || value === "") {
|
|
2030
|
+
continue;
|
|
2031
|
+
}
|
|
2032
|
+
path = path.replaceAll(`{${key}}`, value);
|
|
2033
|
+
}
|
|
2034
|
+
if (path.includes("{")) {
|
|
2035
|
+
return null;
|
|
2036
|
+
}
|
|
2037
|
+
return path.replace(/\/+$/, "") || "/";
|
|
2038
|
+
}
|
|
1664
2039
|
function pageUrlToMobileRoute(url, keyword) {
|
|
1665
2040
|
const normalizedKeyword = keyword.trim().toLowerCase();
|
|
1666
2041
|
if (normalizedKeyword === "profile") {
|
|
@@ -1685,8 +2060,8 @@ function toSegment(item) {
|
|
|
1685
2060
|
keyword: item.page.keyword,
|
|
1686
2061
|
url: item.page.url,
|
|
1687
2062
|
label: itemLabel(item),
|
|
1688
|
-
icon: item.icon ??
|
|
1689
|
-
mobile_icon: item.
|
|
2063
|
+
icon: item.icon ?? null,
|
|
2064
|
+
mobile_icon: item.mobile_icon ?? null
|
|
1690
2065
|
};
|
|
1691
2066
|
}
|
|
1692
2067
|
function findParentItem(items, pageId, parent = null) {
|
|
@@ -1739,9 +2114,7 @@ function resolveBranchNavGroup(payload, currentPageId, menuKeys) {
|
|
|
1739
2114
|
}
|
|
1740
2115
|
const located = findParentItem([root], currentPageId);
|
|
1741
2116
|
if (located) {
|
|
1742
|
-
const directChildren = menuVisibleChildItems(
|
|
1743
|
-
located.parent ?? { id: 0, item_type: "group", label: "", position: 0, children: located.siblings }
|
|
1744
|
-
);
|
|
2117
|
+
const directChildren = located.parent ? menuVisibleChildItems(located.parent) : located.siblings.filter((sibling) => sibling.page != null && sibling.is_active !== false);
|
|
1745
2118
|
if (located.parent && located.parent.page?.id === currentPageId && directChildren.length > 0) {
|
|
1746
2119
|
const segments = directChildren.map(toSegment).filter((s) => s != null);
|
|
1747
2120
|
return segments.length > 0 ? segments : null;
|
|
@@ -1782,6 +2155,80 @@ function resolveMobileSegmentGroup(payload, currentPageId) {
|
|
|
1782
2155
|
function resolveWebBranchNavGroup(payload, currentPageId) {
|
|
1783
2156
|
return resolveBranchNavGroup(payload, currentPageId, ["web_header", "web_footer"]);
|
|
1784
2157
|
}
|
|
2158
|
+
function findMenuItemPath(items, pageId, trail = []) {
|
|
2159
|
+
for (const item of items) {
|
|
2160
|
+
const nextTrail = [...trail, item];
|
|
2161
|
+
if (item.page?.id === pageId) {
|
|
2162
|
+
return nextTrail;
|
|
2163
|
+
}
|
|
2164
|
+
if (item.children?.length) {
|
|
2165
|
+
const found = findMenuItemPath(item.children, pageId, nextTrail);
|
|
2166
|
+
if (found) {
|
|
2167
|
+
return found;
|
|
2168
|
+
}
|
|
2169
|
+
}
|
|
2170
|
+
}
|
|
2171
|
+
return null;
|
|
2172
|
+
}
|
|
2173
|
+
function toBreadcrumb(item) {
|
|
2174
|
+
return {
|
|
2175
|
+
label: itemLabel(item),
|
|
2176
|
+
pageId: item.page?.id ?? null,
|
|
2177
|
+
keyword: item.page?.keyword ?? null,
|
|
2178
|
+
url: item.page?.url ?? null
|
|
2179
|
+
};
|
|
2180
|
+
}
|
|
2181
|
+
function resolveModeForBranch(branchParent, menu) {
|
|
2182
|
+
return branchParent?.children_nav ?? menu.children_nav ?? "sidebar";
|
|
2183
|
+
}
|
|
2184
|
+
function resolvePagerForBranch(branchParent, menu) {
|
|
2185
|
+
return branchParent?.show_pager ?? menu.show_pager ?? true;
|
|
2186
|
+
}
|
|
2187
|
+
function resolveWebBranchNavContext(payload, currentPageId) {
|
|
2188
|
+
for (const key of ["web_header", "web_footer"]) {
|
|
2189
|
+
const menu = payload.menus[key];
|
|
2190
|
+
if (!menu?.items?.length) {
|
|
2191
|
+
continue;
|
|
2192
|
+
}
|
|
2193
|
+
const path = findMenuItemPath(menu.items, currentPageId);
|
|
2194
|
+
if (!path) {
|
|
2195
|
+
continue;
|
|
2196
|
+
}
|
|
2197
|
+
const currentItem = path[path.length - 1];
|
|
2198
|
+
const ownChildren = menuVisibleChildItems(currentItem);
|
|
2199
|
+
let branchParent = null;
|
|
2200
|
+
let group;
|
|
2201
|
+
if (ownChildren.length > 0) {
|
|
2202
|
+
branchParent = currentItem;
|
|
2203
|
+
group = ownChildren;
|
|
2204
|
+
} else if (path.length >= 2) {
|
|
2205
|
+
branchParent = path[path.length - 2];
|
|
2206
|
+
group = menuVisibleChildItems(branchParent);
|
|
2207
|
+
} else {
|
|
2208
|
+
return null;
|
|
2209
|
+
}
|
|
2210
|
+
const segments = group.map(toSegment).filter((segment) => segment != null);
|
|
2211
|
+
if (segments.length === 0) {
|
|
2212
|
+
return null;
|
|
2213
|
+
}
|
|
2214
|
+
const currentIndex = segments.findIndex((segment) => segment.pageId === currentPageId);
|
|
2215
|
+
const pager = {
|
|
2216
|
+
prev: currentIndex > 0 ? segments[currentIndex - 1] : null,
|
|
2217
|
+
next: currentIndex >= 0 && currentIndex < segments.length - 1 ? segments[currentIndex + 1] : null
|
|
2218
|
+
};
|
|
2219
|
+
return {
|
|
2220
|
+
mode: resolveModeForBranch(branchParent, menu),
|
|
2221
|
+
showBreadcrumbs: menu.show_breadcrumbs ?? false,
|
|
2222
|
+
showPager: resolvePagerForBranch(branchParent, menu),
|
|
2223
|
+
heading: branchParent ? itemLabel(branchParent) : null,
|
|
2224
|
+
parent: branchParent ? toSegment(branchParent) : null,
|
|
2225
|
+
segments,
|
|
2226
|
+
breadcrumbs: path.map(toBreadcrumb),
|
|
2227
|
+
pager
|
|
2228
|
+
};
|
|
2229
|
+
}
|
|
2230
|
+
return null;
|
|
2231
|
+
}
|
|
1785
2232
|
function resolveMobilePagePresentation(payload, pageId) {
|
|
1786
2233
|
return isOnAnyMobileMenuFromPayload(payload, pageId) ? "route" : "modal";
|
|
1787
2234
|
}
|
|
@@ -1845,10 +2292,6 @@ function getNavigationItemLabel(item) {
|
|
|
1845
2292
|
return item.label || item.page?.title || item.page?.keyword || "";
|
|
1846
2293
|
}
|
|
1847
2294
|
function getNavigationItemAriaLabel(item) {
|
|
1848
|
-
const aria = item.aria_label?.trim();
|
|
1849
|
-
if (aria) {
|
|
1850
|
-
return aria;
|
|
1851
|
-
}
|
|
1852
2295
|
const label = getNavigationItemLabel(item);
|
|
1853
2296
|
return label || void 0;
|
|
1854
2297
|
}
|
|
@@ -2072,6 +2515,68 @@ function clampMenuItemsAtDepth(items, maxDepth, depth = 0) {
|
|
|
2072
2515
|
});
|
|
2073
2516
|
}
|
|
2074
2517
|
|
|
2518
|
+
// src/navigation/activeTrail.ts
|
|
2519
|
+
function getNavigationItemMobileHref(item) {
|
|
2520
|
+
if (item.item_type === "external_url" && item.external_url) {
|
|
2521
|
+
return item.external_url;
|
|
2522
|
+
}
|
|
2523
|
+
if (!item.page) {
|
|
2524
|
+
return "/index";
|
|
2525
|
+
}
|
|
2526
|
+
return pageUrlToMobileRoute(item.page.url, item.page.keyword);
|
|
2527
|
+
}
|
|
2528
|
+
function matchesWebPath(href, pathname) {
|
|
2529
|
+
if (href === "" || href === "#") {
|
|
2530
|
+
return false;
|
|
2531
|
+
}
|
|
2532
|
+
if (pathname === href) {
|
|
2533
|
+
return true;
|
|
2534
|
+
}
|
|
2535
|
+
return href !== "/" && pathname.startsWith(`${href}/`);
|
|
2536
|
+
}
|
|
2537
|
+
function matchesMobilePath(href, pathname) {
|
|
2538
|
+
if (pathname === href) {
|
|
2539
|
+
return true;
|
|
2540
|
+
}
|
|
2541
|
+
if (href === "/index" && (pathname === "" || pathname === "/" || pathname === "/index")) {
|
|
2542
|
+
return true;
|
|
2543
|
+
}
|
|
2544
|
+
return href !== "/" && pathname.startsWith(`${href}/`);
|
|
2545
|
+
}
|
|
2546
|
+
function isActive(item, pathname, getHref, matches) {
|
|
2547
|
+
if (matches(getHref(item), pathname)) {
|
|
2548
|
+
return true;
|
|
2549
|
+
}
|
|
2550
|
+
return item.children.some((child) => isActive(child, pathname, getHref, matches));
|
|
2551
|
+
}
|
|
2552
|
+
function isMenuItemActiveOnWeb(item, pathname) {
|
|
2553
|
+
return isActive(item, pathname, getNavigationItemHref, matchesWebPath);
|
|
2554
|
+
}
|
|
2555
|
+
function isMenuItemActiveOnMobile(item, pathname) {
|
|
2556
|
+
return isActive(item, pathname, getNavigationItemMobileHref, matchesMobilePath);
|
|
2557
|
+
}
|
|
2558
|
+
function expandedIdsForActiveTrail(items, pathname, platform) {
|
|
2559
|
+
const getHref = platform === "mobile" ? getNavigationItemMobileHref : getNavigationItemHref;
|
|
2560
|
+
const matches = platform === "mobile" ? matchesMobilePath : matchesWebPath;
|
|
2561
|
+
const expanded = /* @__PURE__ */ new Set();
|
|
2562
|
+
const visit = (item) => {
|
|
2563
|
+
let childActive = false;
|
|
2564
|
+
for (const child of item.children) {
|
|
2565
|
+
if (visit(child)) {
|
|
2566
|
+
childActive = true;
|
|
2567
|
+
}
|
|
2568
|
+
}
|
|
2569
|
+
if (childActive) {
|
|
2570
|
+
expanded.add(item.id);
|
|
2571
|
+
}
|
|
2572
|
+
return childActive || matches(getHref(item), pathname);
|
|
2573
|
+
};
|
|
2574
|
+
for (const item of items) {
|
|
2575
|
+
visit(item);
|
|
2576
|
+
}
|
|
2577
|
+
return expanded;
|
|
2578
|
+
}
|
|
2579
|
+
|
|
2075
2580
|
// src/utils/spacing.ts
|
|
2076
2581
|
var ALLOWED_KEYS = ["mt", "mb", "ms", "me", "pt", "pb", "ps", "pe"];
|
|
2077
2582
|
function parseSpacing(raw) {
|
|
@@ -2148,13 +2653,17 @@ function transformPagesData(pages) {
|
|
|
2148
2653
|
CLIENT_TYPE_MOBILE,
|
|
2149
2654
|
CLIENT_TYPE_MOBILE_AND_WEB,
|
|
2150
2655
|
CLIENT_TYPE_WEB,
|
|
2656
|
+
CMS_APP_PRIMARY_ROLES,
|
|
2657
|
+
CMS_APP_ROLES,
|
|
2151
2658
|
COLOR_NAMES,
|
|
2152
2659
|
COLOR_PALETTE,
|
|
2153
2660
|
COLOR_SCALES,
|
|
2154
2661
|
CONTAINER_SIZE_PX,
|
|
2155
2662
|
DEFAULT_MOBILE_ICON,
|
|
2663
|
+
DEFAULT_WEB_FOOTER_PRESET,
|
|
2156
2664
|
DEFAULT_WEB_HEADER_PRESET,
|
|
2157
2665
|
ENDPOINTS,
|
|
2666
|
+
FIELDS_MAP_STYLE_CONFIG,
|
|
2158
2667
|
FONT_SIZE_PX,
|
|
2159
2668
|
FULL_RADIUS_PX,
|
|
2160
2669
|
HEADER_CLIENT_TYPE,
|
|
@@ -2163,6 +2672,11 @@ function transformPagesData(pages) {
|
|
|
2163
2672
|
MOBILE_ICON_NAMES,
|
|
2164
2673
|
MOBILE_ICON_SET,
|
|
2165
2674
|
MOBILE_PREVIEW_ENDPOINTS,
|
|
2675
|
+
NAVIGATION_BRANDING_LOGO_HEIGHTS,
|
|
2676
|
+
NAVIGATION_BUNDLE_FORMAT,
|
|
2677
|
+
NAVIGATION_BUNDLE_VERSION,
|
|
2678
|
+
NAVIGATION_HEADER_LAYER_TOP,
|
|
2679
|
+
OPTION_STYLE_CONFIGS,
|
|
2166
2680
|
PERMISSIONS,
|
|
2167
2681
|
PREVIEW_BRIDGE_MESSAGE,
|
|
2168
2682
|
PREVIEW_PARENT_ORIGIN_PARAM,
|
|
@@ -2175,29 +2689,38 @@ function transformPagesData(pages) {
|
|
|
2175
2689
|
SPACING_VALUES,
|
|
2176
2690
|
STYLE_REGISTRY,
|
|
2177
2691
|
SYSTEM_ENDPOINTS,
|
|
2692
|
+
WEB_FOOTER_PRESET_OPTIONS,
|
|
2693
|
+
WEB_FOOTER_PRESET_VALUES,
|
|
2178
2694
|
WEB_HEADER_PRESET_OPTIONS,
|
|
2179
2695
|
WEB_HEADER_PRESET_VALUES,
|
|
2180
2696
|
_resetPluginStyleRegistry,
|
|
2181
2697
|
arePreviewPreferencesEqual,
|
|
2182
2698
|
buildConditionContext,
|
|
2699
|
+
buildPublicPathFromRoute,
|
|
2183
2700
|
clampMenuItemsAtDepth,
|
|
2184
2701
|
classifyClass,
|
|
2185
2702
|
classifyClassString,
|
|
2186
2703
|
collectPageIdsFromMenuItems,
|
|
2187
2704
|
colorToHex,
|
|
2188
2705
|
evaluateCondition,
|
|
2706
|
+
expandedIdsForActiveTrail,
|
|
2189
2707
|
extendStyleRegistry,
|
|
2190
2708
|
findMenuItemByPageId,
|
|
2191
2709
|
findNearestBottomTabMenuItemForPage,
|
|
2192
2710
|
findPageRefInNavigationPayload,
|
|
2193
2711
|
findRemap,
|
|
2712
|
+
flattenFooterItems,
|
|
2194
2713
|
flattenMenuItems,
|
|
2195
2714
|
flattenNavigationMenuItems,
|
|
2715
|
+
footerColumnItems,
|
|
2716
|
+
footerGroupLinks,
|
|
2717
|
+
footerStandaloneItems,
|
|
2196
2718
|
getMergedStyleRegistry,
|
|
2197
2719
|
getNavigationItemAriaLabel,
|
|
2198
2720
|
getNavigationItemHref,
|
|
2199
2721
|
getNavigationItemKeyword,
|
|
2200
2722
|
getNavigationItemLabel,
|
|
2723
|
+
getNavigationItemMobileHref,
|
|
2201
2724
|
getPluginStyleRegistry,
|
|
2202
2725
|
getRegistryEntry,
|
|
2203
2726
|
getRegistryEntryAny,
|
|
@@ -2207,8 +2730,12 @@ function transformPagesData(pages) {
|
|
|
2207
2730
|
gridSpanToReactNativeColumn,
|
|
2208
2731
|
hasInlineFormatting,
|
|
2209
2732
|
isBottomTabMenuItemActive,
|
|
2733
|
+
isDoubleWebHeaderPreset,
|
|
2210
2734
|
isKnownStyleName,
|
|
2735
|
+
isMenuItemActiveOnMobile,
|
|
2736
|
+
isMenuItemActiveOnWeb,
|
|
2211
2737
|
isMobileIconName,
|
|
2738
|
+
isNavigationBundleVersionSupported,
|
|
2212
2739
|
isOnAnyMobileMenu,
|
|
2213
2740
|
isOnAnyMobileMenuFromPayload,
|
|
2214
2741
|
isPageInMenuTree,
|
|
@@ -2221,6 +2748,7 @@ function transformPagesData(pages) {
|
|
|
2221
2748
|
isStyleAllowedOnPage,
|
|
2222
2749
|
isStylePlacementAllowed,
|
|
2223
2750
|
isStyleSupportedOnPlatform,
|
|
2751
|
+
isWebFooterPreset,
|
|
2224
2752
|
isWebHeaderPreset,
|
|
2225
2753
|
mapAccordionVariantToHeroUiVariant,
|
|
2226
2754
|
mapChipVariantToHeroUiVariant,
|
|
@@ -2233,10 +2761,18 @@ function transformPagesData(pages) {
|
|
|
2233
2761
|
mapSizeToHeroUi,
|
|
2234
2762
|
mapSizeToMantine,
|
|
2235
2763
|
mapSpacingToPx,
|
|
2764
|
+
matchesMobilePath,
|
|
2765
|
+
matchesWebPath,
|
|
2766
|
+
mergeHeaderLayers,
|
|
2236
2767
|
pageUrlToMobileRoute,
|
|
2237
2768
|
parseDimensionToReactNative,
|
|
2238
2769
|
parseDimensionToWeb,
|
|
2770
|
+
parseFieldsMapCatalog,
|
|
2771
|
+
parseFieldsMapLabels,
|
|
2239
2772
|
parseInlineRich,
|
|
2773
|
+
parseOptionCatalog,
|
|
2774
|
+
parseOptionCodes,
|
|
2775
|
+
parseOptionLabels,
|
|
2240
2776
|
parseSpacing,
|
|
2241
2777
|
previewKeywordFromPath,
|
|
2242
2778
|
radiusToPx,
|
|
@@ -2244,6 +2780,8 @@ function transformPagesData(pages) {
|
|
|
2244
2780
|
resolveAssetSources,
|
|
2245
2781
|
resolveAssetUrl,
|
|
2246
2782
|
resolveBranchNavGroup,
|
|
2783
|
+
resolveBrandingPresentation,
|
|
2784
|
+
resolveFieldsMapLabel,
|
|
2247
2785
|
resolveHolderRedirectPath,
|
|
2248
2786
|
resolveMantineVariant,
|
|
2249
2787
|
resolveMenuMaxDepth,
|
|
@@ -2252,20 +2790,29 @@ function transformPagesData(pages) {
|
|
|
2252
2790
|
resolveMobileSegmentGroup,
|
|
2253
2791
|
resolveMobileStartupKeyword,
|
|
2254
2792
|
resolveMobileStartupRoute,
|
|
2793
|
+
resolveOptionCodesLabels,
|
|
2794
|
+
resolveOptionLabel,
|
|
2795
|
+
resolveOptionValueLabels,
|
|
2796
|
+
resolveOptions,
|
|
2255
2797
|
resolveSharedStyle,
|
|
2256
2798
|
resolveSharedStyleForMobile,
|
|
2257
2799
|
resolveSharedStyleForWeb,
|
|
2258
2800
|
resolveSharedStyleProps,
|
|
2801
|
+
resolveWebBranchNavContext,
|
|
2259
2802
|
resolveWebBranchNavGroup,
|
|
2803
|
+
resolveWebFooterPreset,
|
|
2260
2804
|
resolveWebHeaderPreset,
|
|
2261
2805
|
resolveWebStartupPath,
|
|
2262
2806
|
searchMenuPagesInPayload,
|
|
2807
|
+
serializeFieldsMapCatalog,
|
|
2808
|
+
serializeFieldsMapLabels,
|
|
2263
2809
|
setToStylePlatform,
|
|
2264
2810
|
sharedTailwindExtend,
|
|
2265
2811
|
sharedTailwindPreset,
|
|
2266
2812
|
sizeToFontPx,
|
|
2267
2813
|
spacingToClasses,
|
|
2268
2814
|
spacingToPx,
|
|
2815
|
+
splitHeaderLayers,
|
|
2269
2816
|
stripHtmlToText,
|
|
2270
2817
|
stylePlatformToSet,
|
|
2271
2818
|
toHeroUiSemanticProps,
|