@selfhelp/shared 1.21.3 → 1.21.6
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 +106 -0
- package/README.md +2 -1
- package/dist/index.d.mts +519 -24
- package/dist/index.d.ts +519 -24
- package/dist/index.js +723 -18
- package/dist/index.mjs +674 -18
- 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/api/__tests__/endpoints.test.ts +37 -12
- package/src/api/endpoints.ts +5 -5
- package/src/api/index.ts +1 -0
- package/src/api/pagesResolve.ts +78 -0
- package/src/content/__tests__/fieldsMapLabels.test.ts +55 -0
- package/src/content/__tests__/formRecordPrefill.test.ts +104 -0
- package/src/content/__tests__/optionLabels.test.ts +100 -0
- package/src/content/fieldsMapLabels.ts +103 -0
- package/src/content/formRecordPrefill.ts +191 -0
- package/src/content/index.ts +3 -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 +22 -2
- 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,14 +37,19 @@ __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,
|
|
52
|
+
FORM_RECORD_PREFILL_SKIP_FIELDS: () => FORM_RECORD_PREFILL_SKIP_FIELDS,
|
|
48
53
|
FULL_RADIUS_PX: () => FULL_RADIUS_PX,
|
|
49
54
|
HEADER_CLIENT_TYPE: () => HEADER_CLIENT_TYPE,
|
|
50
55
|
LINE_HEIGHT: () => LINE_HEIGHT,
|
|
@@ -52,6 +57,11 @@ __export(index_exports, {
|
|
|
52
57
|
MOBILE_ICON_NAMES: () => MOBILE_ICON_NAMES,
|
|
53
58
|
MOBILE_ICON_SET: () => MOBILE_ICON_SET,
|
|
54
59
|
MOBILE_PREVIEW_ENDPOINTS: () => MOBILE_PREVIEW_ENDPOINTS,
|
|
60
|
+
NAVIGATION_BRANDING_LOGO_HEIGHTS: () => NAVIGATION_BRANDING_LOGO_HEIGHTS,
|
|
61
|
+
NAVIGATION_BUNDLE_FORMAT: () => NAVIGATION_BUNDLE_FORMAT,
|
|
62
|
+
NAVIGATION_BUNDLE_VERSION: () => NAVIGATION_BUNDLE_VERSION,
|
|
63
|
+
NAVIGATION_HEADER_LAYER_TOP: () => NAVIGATION_HEADER_LAYER_TOP,
|
|
64
|
+
OPTION_STYLE_CONFIGS: () => OPTION_STYLE_CONFIGS,
|
|
55
65
|
PERMISSIONS: () => PERMISSIONS,
|
|
56
66
|
PREVIEW_BRIDGE_MESSAGE: () => PREVIEW_BRIDGE_MESSAGE,
|
|
57
67
|
PREVIEW_PARENT_ORIGIN_PARAM: () => PREVIEW_PARENT_ORIGIN_PARAM,
|
|
@@ -64,29 +74,42 @@ __export(index_exports, {
|
|
|
64
74
|
SPACING_VALUES: () => SPACING_VALUES,
|
|
65
75
|
STYLE_REGISTRY: () => STYLE_REGISTRY,
|
|
66
76
|
SYSTEM_ENDPOINTS: () => SYSTEM_ENDPOINTS,
|
|
77
|
+
WEB_FOOTER_PRESET_OPTIONS: () => WEB_FOOTER_PRESET_OPTIONS,
|
|
78
|
+
WEB_FOOTER_PRESET_VALUES: () => WEB_FOOTER_PRESET_VALUES,
|
|
67
79
|
WEB_HEADER_PRESET_OPTIONS: () => WEB_HEADER_PRESET_OPTIONS,
|
|
68
80
|
WEB_HEADER_PRESET_VALUES: () => WEB_HEADER_PRESET_VALUES,
|
|
69
81
|
_resetPluginStyleRegistry: () => _resetPluginStyleRegistry,
|
|
70
82
|
arePreviewPreferencesEqual: () => arePreviewPreferencesEqual,
|
|
71
83
|
buildConditionContext: () => buildConditionContext,
|
|
84
|
+
buildPagesResolvePath: () => buildPagesResolvePath,
|
|
85
|
+
buildPagesResolveQuery: () => buildPagesResolveQuery,
|
|
86
|
+
buildPagesResolveUrl: () => buildPagesResolveUrl,
|
|
87
|
+
buildPublicPathFromRoute: () => buildPublicPathFromRoute,
|
|
72
88
|
clampMenuItemsAtDepth: () => clampMenuItemsAtDepth,
|
|
73
89
|
classifyClass: () => classifyClass,
|
|
74
90
|
classifyClassString: () => classifyClassString,
|
|
75
91
|
collectPageIdsFromMenuItems: () => collectPageIdsFromMenuItems,
|
|
76
92
|
colorToHex: () => colorToHex,
|
|
77
93
|
evaluateCondition: () => evaluateCondition,
|
|
94
|
+
expandedIdsForActiveTrail: () => expandedIdsForActiveTrail,
|
|
78
95
|
extendStyleRegistry: () => extendStyleRegistry,
|
|
79
96
|
findMenuItemByPageId: () => findMenuItemByPageId,
|
|
80
97
|
findNearestBottomTabMenuItemForPage: () => findNearestBottomTabMenuItemForPage,
|
|
81
98
|
findPageRefInNavigationPayload: () => findPageRefInNavigationPayload,
|
|
82
99
|
findRemap: () => findRemap,
|
|
100
|
+
flattenFooterItems: () => flattenFooterItems,
|
|
101
|
+
flattenFormRecordPrefillValues: () => flattenFormRecordPrefillValues,
|
|
83
102
|
flattenMenuItems: () => flattenMenuItems,
|
|
84
103
|
flattenNavigationMenuItems: () => flattenNavigationMenuItems,
|
|
104
|
+
footerColumnItems: () => footerColumnItems,
|
|
105
|
+
footerGroupLinks: () => footerGroupLinks,
|
|
106
|
+
footerStandaloneItems: () => footerStandaloneItems,
|
|
85
107
|
getMergedStyleRegistry: () => getMergedStyleRegistry,
|
|
86
108
|
getNavigationItemAriaLabel: () => getNavigationItemAriaLabel,
|
|
87
109
|
getNavigationItemHref: () => getNavigationItemHref,
|
|
88
110
|
getNavigationItemKeyword: () => getNavigationItemKeyword,
|
|
89
111
|
getNavigationItemLabel: () => getNavigationItemLabel,
|
|
112
|
+
getNavigationItemMobileHref: () => getNavigationItemMobileHref,
|
|
90
113
|
getPluginStyleRegistry: () => getPluginStyleRegistry,
|
|
91
114
|
getRegistryEntry: () => getRegistryEntry,
|
|
92
115
|
getRegistryEntryAny: () => getRegistryEntryAny,
|
|
@@ -96,8 +119,12 @@ __export(index_exports, {
|
|
|
96
119
|
gridSpanToReactNativeColumn: () => gridSpanToReactNativeColumn,
|
|
97
120
|
hasInlineFormatting: () => hasInlineFormatting,
|
|
98
121
|
isBottomTabMenuItemActive: () => isBottomTabMenuItemActive,
|
|
122
|
+
isDoubleWebHeaderPreset: () => isDoubleWebHeaderPreset,
|
|
99
123
|
isKnownStyleName: () => isKnownStyleName,
|
|
124
|
+
isMenuItemActiveOnMobile: () => isMenuItemActiveOnMobile,
|
|
125
|
+
isMenuItemActiveOnWeb: () => isMenuItemActiveOnWeb,
|
|
100
126
|
isMobileIconName: () => isMobileIconName,
|
|
127
|
+
isNavigationBundleVersionSupported: () => isNavigationBundleVersionSupported,
|
|
101
128
|
isOnAnyMobileMenu: () => isOnAnyMobileMenu,
|
|
102
129
|
isOnAnyMobileMenuFromPayload: () => isOnAnyMobileMenuFromPayload,
|
|
103
130
|
isPageInMenuTree: () => isPageInMenuTree,
|
|
@@ -110,6 +137,7 @@ __export(index_exports, {
|
|
|
110
137
|
isStyleAllowedOnPage: () => isStyleAllowedOnPage,
|
|
111
138
|
isStylePlacementAllowed: () => isStylePlacementAllowed,
|
|
112
139
|
isStyleSupportedOnPlatform: () => isStyleSupportedOnPlatform,
|
|
140
|
+
isWebFooterPreset: () => isWebFooterPreset,
|
|
113
141
|
isWebHeaderPreset: () => isWebHeaderPreset,
|
|
114
142
|
mapAccordionVariantToHeroUiVariant: () => mapAccordionVariantToHeroUiVariant,
|
|
115
143
|
mapChipVariantToHeroUiVariant: () => mapChipVariantToHeroUiVariant,
|
|
@@ -122,10 +150,20 @@ __export(index_exports, {
|
|
|
122
150
|
mapSizeToHeroUi: () => mapSizeToHeroUi,
|
|
123
151
|
mapSizeToMantine: () => mapSizeToMantine,
|
|
124
152
|
mapSpacingToPx: () => mapSpacingToPx,
|
|
153
|
+
matchesMobilePath: () => matchesMobilePath,
|
|
154
|
+
matchesWebPath: () => matchesWebPath,
|
|
155
|
+
mergeHeaderLayers: () => mergeHeaderLayers,
|
|
156
|
+
normalizePagesResolvePath: () => normalizePagesResolvePath,
|
|
125
157
|
pageUrlToMobileRoute: () => pageUrlToMobileRoute,
|
|
126
158
|
parseDimensionToReactNative: () => parseDimensionToReactNative,
|
|
127
159
|
parseDimensionToWeb: () => parseDimensionToWeb,
|
|
160
|
+
parseFieldsMapCatalog: () => parseFieldsMapCatalog,
|
|
161
|
+
parseFieldsMapLabels: () => parseFieldsMapLabels,
|
|
162
|
+
parseFormRecordPrefill: () => parseFormRecordPrefill,
|
|
128
163
|
parseInlineRich: () => parseInlineRich,
|
|
164
|
+
parseOptionCatalog: () => parseOptionCatalog,
|
|
165
|
+
parseOptionCodes: () => parseOptionCodes,
|
|
166
|
+
parseOptionLabels: () => parseOptionLabels,
|
|
129
167
|
parseSpacing: () => parseSpacing,
|
|
130
168
|
previewKeywordFromPath: () => previewKeywordFromPath,
|
|
131
169
|
radiusToPx: () => radiusToPx,
|
|
@@ -133,6 +171,8 @@ __export(index_exports, {
|
|
|
133
171
|
resolveAssetSources: () => resolveAssetSources,
|
|
134
172
|
resolveAssetUrl: () => resolveAssetUrl,
|
|
135
173
|
resolveBranchNavGroup: () => resolveBranchNavGroup,
|
|
174
|
+
resolveBrandingPresentation: () => resolveBrandingPresentation,
|
|
175
|
+
resolveFieldsMapLabel: () => resolveFieldsMapLabel,
|
|
136
176
|
resolveHolderRedirectPath: () => resolveHolderRedirectPath,
|
|
137
177
|
resolveMantineVariant: () => resolveMantineVariant,
|
|
138
178
|
resolveMenuMaxDepth: () => resolveMenuMaxDepth,
|
|
@@ -141,20 +181,29 @@ __export(index_exports, {
|
|
|
141
181
|
resolveMobileSegmentGroup: () => resolveMobileSegmentGroup,
|
|
142
182
|
resolveMobileStartupKeyword: () => resolveMobileStartupKeyword,
|
|
143
183
|
resolveMobileStartupRoute: () => resolveMobileStartupRoute,
|
|
184
|
+
resolveOptionCodesLabels: () => resolveOptionCodesLabels,
|
|
185
|
+
resolveOptionLabel: () => resolveOptionLabel,
|
|
186
|
+
resolveOptionValueLabels: () => resolveOptionValueLabels,
|
|
187
|
+
resolveOptions: () => resolveOptions,
|
|
144
188
|
resolveSharedStyle: () => resolveSharedStyle,
|
|
145
189
|
resolveSharedStyleForMobile: () => resolveSharedStyleForMobile,
|
|
146
190
|
resolveSharedStyleForWeb: () => resolveSharedStyleForWeb,
|
|
147
191
|
resolveSharedStyleProps: () => resolveSharedStyleProps,
|
|
192
|
+
resolveWebBranchNavContext: () => resolveWebBranchNavContext,
|
|
148
193
|
resolveWebBranchNavGroup: () => resolveWebBranchNavGroup,
|
|
194
|
+
resolveWebFooterPreset: () => resolveWebFooterPreset,
|
|
149
195
|
resolveWebHeaderPreset: () => resolveWebHeaderPreset,
|
|
150
196
|
resolveWebStartupPath: () => resolveWebStartupPath,
|
|
151
197
|
searchMenuPagesInPayload: () => searchMenuPagesInPayload,
|
|
198
|
+
serializeFieldsMapCatalog: () => serializeFieldsMapCatalog,
|
|
199
|
+
serializeFieldsMapLabels: () => serializeFieldsMapLabels,
|
|
152
200
|
setToStylePlatform: () => setToStylePlatform,
|
|
153
201
|
sharedTailwindExtend: () => sharedTailwindExtend,
|
|
154
202
|
sharedTailwindPreset: () => sharedTailwindPreset,
|
|
155
203
|
sizeToFontPx: () => sizeToFontPx,
|
|
156
204
|
spacingToClasses: () => spacingToClasses,
|
|
157
205
|
spacingToPx: () => spacingToPx,
|
|
206
|
+
splitHeaderLayers: () => splitHeaderLayers,
|
|
158
207
|
stripHtmlToText: () => stripHtmlToText,
|
|
159
208
|
stylePlatformToSet: () => stylePlatformToSet,
|
|
160
209
|
toHeroUiSemanticProps: () => toHeroUiSemanticProps,
|
|
@@ -176,6 +225,10 @@ var PERMISSIONS = {
|
|
|
176
225
|
ADMIN_PAGE_VERSION_PUBLISH: "admin.page.version.publish",
|
|
177
226
|
ADMIN_PAGE_VERSION_READ: "admin.page.version.read",
|
|
178
227
|
ADMIN_PAGE_VERSION_COMPARE: "admin.page.version.compare",
|
|
228
|
+
ADMIN_CMS_APP_READ: "admin.cms_app.read",
|
|
229
|
+
ADMIN_CMS_APP_CREATE: "admin.cms_app.create",
|
|
230
|
+
ADMIN_CMS_APP_UPDATE: "admin.cms_app.update",
|
|
231
|
+
ADMIN_CMS_APP_DELETE: "admin.cms_app.delete",
|
|
179
232
|
ADMIN_USER_READ: "admin.user.read",
|
|
180
233
|
ADMIN_USER_CREATE: "admin.user.create",
|
|
181
234
|
ADMIN_USER_UPDATE: "admin.user.update",
|
|
@@ -217,6 +270,23 @@ var PERMISSIONS = {
|
|
|
217
270
|
ADMIN_AUDIT_VIEW: "admin.audit.view"
|
|
218
271
|
};
|
|
219
272
|
|
|
273
|
+
// src/types/cms-app.ts
|
|
274
|
+
var CMS_APP_ROLES = [
|
|
275
|
+
"form",
|
|
276
|
+
"cms_list",
|
|
277
|
+
"cms_detail",
|
|
278
|
+
"public_list",
|
|
279
|
+
"public_detail",
|
|
280
|
+
"other"
|
|
281
|
+
];
|
|
282
|
+
var CMS_APP_PRIMARY_ROLES = [
|
|
283
|
+
"form",
|
|
284
|
+
"cms_list",
|
|
285
|
+
"cms_detail",
|
|
286
|
+
"public_list",
|
|
287
|
+
"public_detail"
|
|
288
|
+
];
|
|
289
|
+
|
|
220
290
|
// src/types/api/system.ts
|
|
221
291
|
var SYSTEM_PREFIX = "/cms-api/v1/admin/system";
|
|
222
292
|
var SYSTEM_ENDPOINTS = {
|
|
@@ -287,9 +357,9 @@ function isPreviewBridgeMessage(value) {
|
|
|
287
357
|
case PREVIEW_BRIDGE_MESSAGE.READY:
|
|
288
358
|
return record.source === "web" || record.source === "mobile";
|
|
289
359
|
case PREVIEW_BRIDGE_MESSAGE.NAVIGATED:
|
|
290
|
-
return (record.source === "web" || record.source === "mobile") && (typeof record.keyword === "string" || record.keyword === null) && typeof record.href === "string";
|
|
360
|
+
return (record.source === "web" || record.source === "mobile") && (typeof record.keyword === "string" || record.keyword === null) && typeof record.href === "string" && (record.path === void 0 || record.path === null || typeof record.path === "string");
|
|
291
361
|
case PREVIEW_BRIDGE_MESSAGE.NAVIGATE:
|
|
292
|
-
return typeof record.keyword === "string" || record.keyword === null;
|
|
362
|
+
return (typeof record.keyword === "string" || record.keyword === null) && (record.path === void 0 || record.path === null || typeof record.path === "string");
|
|
293
363
|
case PREVIEW_BRIDGE_MESSAGE.SET_PREFERENCES:
|
|
294
364
|
return isPreviewPreferences(record.preferences);
|
|
295
365
|
case PREVIEW_BRIDGE_MESSAGE.PREFERENCES_CHANGED:
|
|
@@ -375,6 +445,7 @@ var BASE_STYLE_REGISTRY = {
|
|
|
375
445
|
// ===== forms =====
|
|
376
446
|
"form-log": { description: "Append-only form (one row per submit)", category: "forms", canHaveChildren: true },
|
|
377
447
|
"form-record": { description: "Per-user record form", category: "forms", canHaveChildren: true },
|
|
448
|
+
"entry-record-form": { description: "Route-aware create/edit form", category: "forms", canHaveChildren: true },
|
|
378
449
|
input: { description: "Plain HTML input", category: "forms", canHaveChildren: false },
|
|
379
450
|
"text-input": { description: "Mantine TextInput", category: "forms", canHaveChildren: false },
|
|
380
451
|
textarea: { description: "Mantine Textarea", category: "forms", canHaveChildren: false },
|
|
@@ -416,7 +487,7 @@ var BASE_STYLE_REGISTRY = {
|
|
|
416
487
|
version: { description: "Build/version diagnostic surface", category: "auth", canHaveChildren: false },
|
|
417
488
|
"ref-container": { description: "Renders content referenced from another section", category: "layout", canHaveChildren: true },
|
|
418
489
|
"data-container": { description: "Data-scoped container (renders subtree against a data scope)", category: "layout", canHaveChildren: true },
|
|
419
|
-
"
|
|
490
|
+
"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
491
|
};
|
|
421
492
|
var STYLE_REGISTRY = BASE_STYLE_REGISTRY;
|
|
422
493
|
var PLUGIN_STYLE_REGISTRY = {};
|
|
@@ -560,11 +631,12 @@ var ENDPOINTS = {
|
|
|
560
631
|
BY_KEYWORD: (keyword) => `${API_VERSION_PREFIX}/pages/by-keyword/${encodeURIComponent(keyword)}`,
|
|
561
632
|
BY_ID: (pageId) => `${API_VERSION_PREFIX}/pages/${pageId}`,
|
|
562
633
|
/**
|
|
563
|
-
*
|
|
564
|
-
*
|
|
565
|
-
*
|
|
634
|
+
* Static resolve route (no query). Always pair with
|
|
635
|
+
* {@link buildPagesResolveUrl} / {@link buildPagesResolvePath} so
|
|
636
|
+
* `path`, `language_id`, and `preview` are encoded identically across
|
|
637
|
+
* SSR, browser, and mobile.
|
|
566
638
|
*/
|
|
567
|
-
|
|
639
|
+
RESOLVE_ROUTE: `${API_VERSION_PREFIX}/pages/resolve`
|
|
568
640
|
},
|
|
569
641
|
NAVIGATION: {
|
|
570
642
|
GET: `${API_VERSION_PREFIX}/navigation`,
|
|
@@ -586,6 +658,37 @@ var CLIENT_TYPE_WEB = "web";
|
|
|
586
658
|
var CLIENT_TYPE_MOBILE = "mobile";
|
|
587
659
|
var CLIENT_TYPE_MOBILE_AND_WEB = "mobile_and_web";
|
|
588
660
|
|
|
661
|
+
// src/api/pagesResolve.ts
|
|
662
|
+
function normalizePagesResolvePath(rawPath) {
|
|
663
|
+
const withoutOrigin = rawPath.includes("://") ? (() => {
|
|
664
|
+
try {
|
|
665
|
+
return new URL(rawPath).pathname;
|
|
666
|
+
} catch {
|
|
667
|
+
return rawPath;
|
|
668
|
+
}
|
|
669
|
+
})() : rawPath;
|
|
670
|
+
const pathOnly = withoutOrigin.split("#")[0].split("?")[0];
|
|
671
|
+
const withSlash = pathOnly.startsWith("/") ? pathOnly : `/${pathOnly}`;
|
|
672
|
+
return withSlash.replace(/\/+$/, "") || "/";
|
|
673
|
+
}
|
|
674
|
+
function buildPagesResolveQuery(params) {
|
|
675
|
+
const search = new URLSearchParams();
|
|
676
|
+
search.set("path", normalizePagesResolvePath(params.path));
|
|
677
|
+
if (params.languageId != null && Number.isFinite(params.languageId) && params.languageId > 0) {
|
|
678
|
+
search.set("language_id", String(params.languageId));
|
|
679
|
+
}
|
|
680
|
+
if (params.preview) {
|
|
681
|
+
search.set("preview", "true");
|
|
682
|
+
}
|
|
683
|
+
return search.toString();
|
|
684
|
+
}
|
|
685
|
+
function buildPagesResolvePath(params) {
|
|
686
|
+
return `/pages/resolve?${buildPagesResolveQuery(params)}`;
|
|
687
|
+
}
|
|
688
|
+
function buildPagesResolveUrl(params) {
|
|
689
|
+
return `${API_VERSION_PREFIX}${buildPagesResolvePath(params)}`;
|
|
690
|
+
}
|
|
691
|
+
|
|
589
692
|
// src/theme/tokens.ts
|
|
590
693
|
var FONT_SIZE_PX = {
|
|
591
694
|
xs: 12,
|
|
@@ -1572,6 +1675,295 @@ function stripHtmlToText(value) {
|
|
|
1572
1675
|
return out.replace(/\s+/g, " ").trim();
|
|
1573
1676
|
}
|
|
1574
1677
|
|
|
1678
|
+
// src/content/optionLabels.ts
|
|
1679
|
+
var OPTION_STYLE_CONFIGS = {
|
|
1680
|
+
select: {
|
|
1681
|
+
catalogField: "options",
|
|
1682
|
+
multipleField: "is_multiple"
|
|
1683
|
+
},
|
|
1684
|
+
radio: {
|
|
1685
|
+
catalogField: "radio_options"
|
|
1686
|
+
},
|
|
1687
|
+
combobox: {
|
|
1688
|
+
catalogField: "combobox_options",
|
|
1689
|
+
multipleField: "web_combobox_multi_select"
|
|
1690
|
+
},
|
|
1691
|
+
"segmented-control": {
|
|
1692
|
+
catalogField: "segmented_control_data"
|
|
1693
|
+
}
|
|
1694
|
+
};
|
|
1695
|
+
function parseJson(raw) {
|
|
1696
|
+
if (typeof raw !== "string" || raw.trim() === "") {
|
|
1697
|
+
return raw;
|
|
1698
|
+
}
|
|
1699
|
+
try {
|
|
1700
|
+
return JSON.parse(raw);
|
|
1701
|
+
} catch {
|
|
1702
|
+
return raw;
|
|
1703
|
+
}
|
|
1704
|
+
}
|
|
1705
|
+
function toString(value) {
|
|
1706
|
+
if (typeof value !== "string") return null;
|
|
1707
|
+
const trimmed = value.trim();
|
|
1708
|
+
return trimmed === "" ? null : trimmed;
|
|
1709
|
+
}
|
|
1710
|
+
function parseOptionCatalog(raw) {
|
|
1711
|
+
const parsed = parseJson(raw);
|
|
1712
|
+
if (!Array.isArray(parsed)) return [];
|
|
1713
|
+
const entries = [];
|
|
1714
|
+
for (const item of parsed) {
|
|
1715
|
+
if (item == null || typeof item !== "object") continue;
|
|
1716
|
+
const record = item;
|
|
1717
|
+
const value = toString(record.value);
|
|
1718
|
+
if (!value) continue;
|
|
1719
|
+
const explicitMeta = record.meta && typeof record.meta === "object" && !Array.isArray(record.meta) ? record.meta : {};
|
|
1720
|
+
const legacyDescription = toString(record.description);
|
|
1721
|
+
const meta = legacyDescription && explicitMeta.description === void 0 ? { ...explicitMeta, description: legacyDescription } : explicitMeta;
|
|
1722
|
+
entries.push({
|
|
1723
|
+
value,
|
|
1724
|
+
...typeof record.sort === "number" ? { sort: record.sort } : {},
|
|
1725
|
+
...typeof record.disabled === "boolean" ? { disabled: record.disabled } : {},
|
|
1726
|
+
...Object.keys(meta).length > 0 ? { meta } : {},
|
|
1727
|
+
...toString(record.label) ?? toString(record.text) ? { legacyLabel: toString(record.label) ?? toString(record.text) ?? void 0 } : {}
|
|
1728
|
+
});
|
|
1729
|
+
}
|
|
1730
|
+
return entries;
|
|
1731
|
+
}
|
|
1732
|
+
function parseOptionLabels(raw) {
|
|
1733
|
+
const parsed = parseJson(raw);
|
|
1734
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
1735
|
+
return {};
|
|
1736
|
+
}
|
|
1737
|
+
const labels = {};
|
|
1738
|
+
for (const [key, value] of Object.entries(parsed)) {
|
|
1739
|
+
if (!key || typeof value !== "string") continue;
|
|
1740
|
+
const trimmed = value.trim();
|
|
1741
|
+
if (trimmed !== "") {
|
|
1742
|
+
labels[key] = trimmed;
|
|
1743
|
+
}
|
|
1744
|
+
}
|
|
1745
|
+
return labels;
|
|
1746
|
+
}
|
|
1747
|
+
function resolveOptionLabel(code, labels, fallbackLabels = {}, legacyLabel) {
|
|
1748
|
+
if (!code) return "";
|
|
1749
|
+
return labels[code] ?? fallbackLabels[code] ?? legacyLabel ?? code;
|
|
1750
|
+
}
|
|
1751
|
+
function resolveOptions(catalogRaw, labelsRaw, fallbackLabelsRaw) {
|
|
1752
|
+
const catalog = parseOptionCatalog(catalogRaw);
|
|
1753
|
+
const labels = parseOptionLabels(labelsRaw);
|
|
1754
|
+
const fallbackLabels = parseOptionLabels(fallbackLabelsRaw);
|
|
1755
|
+
return catalog.map((entry) => ({
|
|
1756
|
+
value: entry.value,
|
|
1757
|
+
label: resolveOptionLabel(entry.value, labels, fallbackLabels, entry.legacyLabel),
|
|
1758
|
+
...entry.sort !== void 0 ? { sort: entry.sort } : {},
|
|
1759
|
+
...entry.disabled !== void 0 ? { disabled: entry.disabled } : {},
|
|
1760
|
+
...entry.meta ? { meta: entry.meta } : {}
|
|
1761
|
+
}));
|
|
1762
|
+
}
|
|
1763
|
+
function resolveOptionCodesLabels(codes, labels, fallbackLabels = {}) {
|
|
1764
|
+
return codes.map((code) => resolveOptionLabel(code, labels, fallbackLabels)).filter((label) => label !== "");
|
|
1765
|
+
}
|
|
1766
|
+
function parseOptionCodes(value) {
|
|
1767
|
+
const rawCodes = Array.isArray(value) ? value : typeof value === "string" ? value.split(",") : [];
|
|
1768
|
+
return rawCodes.filter((code) => typeof code === "string").map((code) => code.trim()).filter((code) => code !== "");
|
|
1769
|
+
}
|
|
1770
|
+
function resolveOptionValueLabels(value, labelsRaw, fallbackLabelsRaw) {
|
|
1771
|
+
return resolveOptionCodesLabels(
|
|
1772
|
+
parseOptionCodes(value),
|
|
1773
|
+
parseOptionLabels(labelsRaw),
|
|
1774
|
+
parseOptionLabels(fallbackLabelsRaw)
|
|
1775
|
+
);
|
|
1776
|
+
}
|
|
1777
|
+
|
|
1778
|
+
// src/content/fieldsMapLabels.ts
|
|
1779
|
+
var FIELDS_MAP_STYLE_CONFIG = {
|
|
1780
|
+
catalogField: "fields_map",
|
|
1781
|
+
labelsField: "fields_map_labels"
|
|
1782
|
+
};
|
|
1783
|
+
function parseJson2(raw) {
|
|
1784
|
+
if (typeof raw !== "string" || raw.trim() === "") {
|
|
1785
|
+
return raw;
|
|
1786
|
+
}
|
|
1787
|
+
try {
|
|
1788
|
+
return JSON.parse(raw);
|
|
1789
|
+
} catch {
|
|
1790
|
+
return raw;
|
|
1791
|
+
}
|
|
1792
|
+
}
|
|
1793
|
+
function parseFieldsMapCatalog(raw) {
|
|
1794
|
+
const parsed = parseJson2(raw);
|
|
1795
|
+
if (!Array.isArray(parsed)) {
|
|
1796
|
+
return [];
|
|
1797
|
+
}
|
|
1798
|
+
const keys = [];
|
|
1799
|
+
for (const item of parsed) {
|
|
1800
|
+
if (typeof item === "string" && item.trim() !== "") {
|
|
1801
|
+
keys.push(item.trim());
|
|
1802
|
+
continue;
|
|
1803
|
+
}
|
|
1804
|
+
if (item && typeof item === "object" && !Array.isArray(item)) {
|
|
1805
|
+
const record = item;
|
|
1806
|
+
const legacy = typeof record.field_name === "string" ? record.field_name.trim() : "";
|
|
1807
|
+
if (legacy !== "") {
|
|
1808
|
+
keys.push(legacy);
|
|
1809
|
+
}
|
|
1810
|
+
}
|
|
1811
|
+
}
|
|
1812
|
+
return keys;
|
|
1813
|
+
}
|
|
1814
|
+
function parseFieldsMapLabels(raw) {
|
|
1815
|
+
const parsed = parseJson2(raw);
|
|
1816
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
1817
|
+
return {};
|
|
1818
|
+
}
|
|
1819
|
+
const labels = {};
|
|
1820
|
+
for (const [key, value] of Object.entries(parsed)) {
|
|
1821
|
+
if (!key || typeof value !== "string") {
|
|
1822
|
+
continue;
|
|
1823
|
+
}
|
|
1824
|
+
const trimmed = value.trim();
|
|
1825
|
+
if (trimmed !== "") {
|
|
1826
|
+
labels[key] = trimmed;
|
|
1827
|
+
}
|
|
1828
|
+
}
|
|
1829
|
+
return labels;
|
|
1830
|
+
}
|
|
1831
|
+
function resolveFieldsMapLabel(fieldKey, labels, fallbackLabels = {}) {
|
|
1832
|
+
return labels[fieldKey] ?? fallbackLabels[fieldKey] ?? fieldKey;
|
|
1833
|
+
}
|
|
1834
|
+
function serializeFieldsMapCatalog(fieldKeys) {
|
|
1835
|
+
const keys = fieldKeys.map((key) => key.trim()).filter((key) => key !== "");
|
|
1836
|
+
if (keys.length === 0) {
|
|
1837
|
+
return "";
|
|
1838
|
+
}
|
|
1839
|
+
return JSON.stringify(keys);
|
|
1840
|
+
}
|
|
1841
|
+
function serializeFieldsMapLabels(labels) {
|
|
1842
|
+
const clean = {};
|
|
1843
|
+
for (const [key, value] of Object.entries(labels)) {
|
|
1844
|
+
const trimmed = value.trim();
|
|
1845
|
+
if (key && trimmed !== "") {
|
|
1846
|
+
clean[key] = trimmed;
|
|
1847
|
+
}
|
|
1848
|
+
}
|
|
1849
|
+
if (Object.keys(clean).length === 0) {
|
|
1850
|
+
return "";
|
|
1851
|
+
}
|
|
1852
|
+
return JSON.stringify(clean);
|
|
1853
|
+
}
|
|
1854
|
+
|
|
1855
|
+
// src/content/formRecordPrefill.ts
|
|
1856
|
+
var FORM_RECORD_PREFILL_SKIP_FIELDS = /* @__PURE__ */ new Set([
|
|
1857
|
+
"record_id",
|
|
1858
|
+
"entry_date",
|
|
1859
|
+
"id_users",
|
|
1860
|
+
"user_name",
|
|
1861
|
+
"user_code",
|
|
1862
|
+
"id_actionTriggerTypes",
|
|
1863
|
+
"triggerType",
|
|
1864
|
+
"id_languages",
|
|
1865
|
+
"language_locale",
|
|
1866
|
+
"language_name"
|
|
1867
|
+
]);
|
|
1868
|
+
function isTranslatableChild(children, fieldName) {
|
|
1869
|
+
if (!Array.isArray(children)) {
|
|
1870
|
+
return false;
|
|
1871
|
+
}
|
|
1872
|
+
const child = children.find((item) => item?.name?.content === fieldName);
|
|
1873
|
+
return child?.translatable?.content === "1";
|
|
1874
|
+
}
|
|
1875
|
+
function asScalarString(value) {
|
|
1876
|
+
if (value === null || value === void 0) {
|
|
1877
|
+
return null;
|
|
1878
|
+
}
|
|
1879
|
+
if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
|
|
1880
|
+
return String(value);
|
|
1881
|
+
}
|
|
1882
|
+
return null;
|
|
1883
|
+
}
|
|
1884
|
+
function parseFormRecordPrefill(section) {
|
|
1885
|
+
const sectionDataArray = section?.section_data;
|
|
1886
|
+
if (!Array.isArray(sectionDataArray) || sectionDataArray.length === 0) {
|
|
1887
|
+
return { recordId: null, values: {} };
|
|
1888
|
+
}
|
|
1889
|
+
const recordGroups = {};
|
|
1890
|
+
for (const row of sectionDataArray) {
|
|
1891
|
+
if (!row || typeof row !== "object" || Array.isArray(row)) {
|
|
1892
|
+
continue;
|
|
1893
|
+
}
|
|
1894
|
+
const record = row;
|
|
1895
|
+
const rawRecordId = record.record_id;
|
|
1896
|
+
const recordId = typeof rawRecordId === "number" ? rawRecordId : typeof rawRecordId === "string" && rawRecordId.trim() !== "" && Number.isFinite(Number(rawRecordId)) ? Number(rawRecordId) : null;
|
|
1897
|
+
if (recordId === null) {
|
|
1898
|
+
continue;
|
|
1899
|
+
}
|
|
1900
|
+
if (!recordGroups[recordId]) {
|
|
1901
|
+
recordGroups[recordId] = {};
|
|
1902
|
+
}
|
|
1903
|
+
const languageId = typeof record.id_languages === "number" ? record.id_languages : typeof record.id_languages === "string" && Number.isFinite(Number(record.id_languages)) ? Number(record.id_languages) : void 0;
|
|
1904
|
+
for (const [fieldName, fieldValue] of Object.entries(record)) {
|
|
1905
|
+
if (FORM_RECORD_PREFILL_SKIP_FIELDS.has(fieldName)) {
|
|
1906
|
+
continue;
|
|
1907
|
+
}
|
|
1908
|
+
const value = asScalarString(fieldValue);
|
|
1909
|
+
if (value === null) {
|
|
1910
|
+
continue;
|
|
1911
|
+
}
|
|
1912
|
+
const translatable = isTranslatableChild(section.children, fieldName);
|
|
1913
|
+
if (translatable) {
|
|
1914
|
+
if (languageId === 1) {
|
|
1915
|
+
if (!recordGroups[recordId][fieldName]) {
|
|
1916
|
+
recordGroups[recordId][fieldName] = value;
|
|
1917
|
+
}
|
|
1918
|
+
} else if (typeof languageId === "number") {
|
|
1919
|
+
const current = recordGroups[recordId][fieldName];
|
|
1920
|
+
if (typeof current === "string" || !current) {
|
|
1921
|
+
recordGroups[recordId][fieldName] = [{ language_id: languageId, value }];
|
|
1922
|
+
} else {
|
|
1923
|
+
const langValues = current;
|
|
1924
|
+
const existingIndex = langValues.findIndex((v) => v.language_id === languageId);
|
|
1925
|
+
if (existingIndex >= 0) {
|
|
1926
|
+
langValues[existingIndex] = { language_id: languageId, value };
|
|
1927
|
+
} else {
|
|
1928
|
+
langValues.push({ language_id: languageId, value });
|
|
1929
|
+
}
|
|
1930
|
+
}
|
|
1931
|
+
}
|
|
1932
|
+
} else if (languageId === 1 || !recordGroups[recordId][fieldName]) {
|
|
1933
|
+
recordGroups[recordId][fieldName] = value;
|
|
1934
|
+
}
|
|
1935
|
+
}
|
|
1936
|
+
}
|
|
1937
|
+
const firstRecordId = Object.keys(recordGroups)[0];
|
|
1938
|
+
if (!firstRecordId) {
|
|
1939
|
+
return { recordId: null, values: {} };
|
|
1940
|
+
}
|
|
1941
|
+
const id = Number(firstRecordId);
|
|
1942
|
+
return { recordId: id, values: recordGroups[id] ?? {} };
|
|
1943
|
+
}
|
|
1944
|
+
function flattenFormRecordPrefillValues(values, languageId) {
|
|
1945
|
+
const out = {};
|
|
1946
|
+
for (const [key, value] of Object.entries(values)) {
|
|
1947
|
+
if (typeof value === "string") {
|
|
1948
|
+
out[key] = value;
|
|
1949
|
+
continue;
|
|
1950
|
+
}
|
|
1951
|
+
if (!Array.isArray(value) || value.length === 0) {
|
|
1952
|
+
continue;
|
|
1953
|
+
}
|
|
1954
|
+
if (languageId != null) {
|
|
1955
|
+
const match = value.find((entry) => entry.language_id === languageId);
|
|
1956
|
+
if (match) {
|
|
1957
|
+
out[key] = match.value;
|
|
1958
|
+
continue;
|
|
1959
|
+
}
|
|
1960
|
+
}
|
|
1961
|
+
const nonIndependent = value.find((entry) => entry.language_id !== 1);
|
|
1962
|
+
out[key] = (nonIndependent ?? value[0]).value;
|
|
1963
|
+
}
|
|
1964
|
+
return out;
|
|
1965
|
+
}
|
|
1966
|
+
|
|
1575
1967
|
// src/navigation/headerPreset.ts
|
|
1576
1968
|
var WEB_HEADER_PRESET_VALUES = [
|
|
1577
1969
|
"simple",
|
|
@@ -1587,16 +1979,134 @@ var WEB_HEADER_PRESET_OPTIONS = [
|
|
|
1587
1979
|
{ value: "dropdown", label: "Dropdown", description: "Default \u2014 nested dropdown menus." },
|
|
1588
1980
|
{ value: "mega-menu", label: "Mega menu", description: "Rich sections with descriptions and icons." },
|
|
1589
1981
|
{ 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: "
|
|
1982
|
+
{ value: "double-dropdown", label: "Double header (dropdown)", description: "Top row with flat links and utilities above the main dropdown nav." },
|
|
1983
|
+
{ value: "double-mega-menu", label: "Double header (mega menu)", description: "Top row with flat links and utilities above the mega menu." }
|
|
1592
1984
|
];
|
|
1985
|
+
var DOUBLE_WEB_HEADER_PRESETS = ["double-dropdown", "double-mega-menu"];
|
|
1593
1986
|
function isWebHeaderPreset(value) {
|
|
1594
1987
|
return typeof value === "string" && WEB_HEADER_PRESET_VALUES.includes(value);
|
|
1595
1988
|
}
|
|
1989
|
+
function isDoubleWebHeaderPreset(value) {
|
|
1990
|
+
return isWebHeaderPreset(value) && DOUBLE_WEB_HEADER_PRESETS.includes(value);
|
|
1991
|
+
}
|
|
1596
1992
|
function resolveWebHeaderPreset(value, fallback = DEFAULT_WEB_HEADER_PRESET) {
|
|
1597
1993
|
return isWebHeaderPreset(value) ? value : fallback;
|
|
1598
1994
|
}
|
|
1599
1995
|
|
|
1996
|
+
// src/navigation/footerPreset.ts
|
|
1997
|
+
var WEB_FOOTER_PRESET_VALUES = [
|
|
1998
|
+
"columns",
|
|
1999
|
+
"inline"
|
|
2000
|
+
];
|
|
2001
|
+
var DEFAULT_WEB_FOOTER_PRESET = "columns";
|
|
2002
|
+
var WEB_FOOTER_PRESET_OPTIONS = [
|
|
2003
|
+
{
|
|
2004
|
+
value: "columns",
|
|
2005
|
+
label: "Columns (grouped)",
|
|
2006
|
+
description: "Group headings become footer columns with their links below."
|
|
2007
|
+
},
|
|
2008
|
+
{
|
|
2009
|
+
value: "inline",
|
|
2010
|
+
label: "Inline links",
|
|
2011
|
+
description: "One flat centered link row; group links are shown inline, headings hidden. Groups are kept and restored when switching back."
|
|
2012
|
+
}
|
|
2013
|
+
];
|
|
2014
|
+
function isWebFooterPreset(value) {
|
|
2015
|
+
return typeof value === "string" && WEB_FOOTER_PRESET_VALUES.includes(value);
|
|
2016
|
+
}
|
|
2017
|
+
function resolveWebFooterPreset(value, fallback = DEFAULT_WEB_FOOTER_PRESET) {
|
|
2018
|
+
return isWebFooterPreset(value) ? value : fallback;
|
|
2019
|
+
}
|
|
2020
|
+
function isRenderableFooterLeaf(item) {
|
|
2021
|
+
if (!item.is_active) {
|
|
2022
|
+
return false;
|
|
2023
|
+
}
|
|
2024
|
+
if (item.item_type === "external_url") {
|
|
2025
|
+
return item.external_url != null && item.external_url !== "";
|
|
2026
|
+
}
|
|
2027
|
+
return item.item_type === "page" && item.page != null;
|
|
2028
|
+
}
|
|
2029
|
+
function flattenFooterItems(items) {
|
|
2030
|
+
const out = [];
|
|
2031
|
+
for (const item of items) {
|
|
2032
|
+
if (!item.is_active) {
|
|
2033
|
+
continue;
|
|
2034
|
+
}
|
|
2035
|
+
if (item.item_type === "group") {
|
|
2036
|
+
out.push(...flattenFooterItems(item.children));
|
|
2037
|
+
continue;
|
|
2038
|
+
}
|
|
2039
|
+
if (isRenderableFooterLeaf(item)) {
|
|
2040
|
+
out.push(item);
|
|
2041
|
+
out.push(...flattenFooterItems(item.children));
|
|
2042
|
+
}
|
|
2043
|
+
}
|
|
2044
|
+
return out;
|
|
2045
|
+
}
|
|
2046
|
+
function footerColumnItems(items) {
|
|
2047
|
+
return items.filter(
|
|
2048
|
+
(item) => item.is_active && item.item_type === "group" && item.children.some(isRenderableFooterLeaf)
|
|
2049
|
+
);
|
|
2050
|
+
}
|
|
2051
|
+
function footerStandaloneItems(items) {
|
|
2052
|
+
return items.filter((item) => item.item_type !== "group" && isRenderableFooterLeaf(item));
|
|
2053
|
+
}
|
|
2054
|
+
function footerGroupLinks(group) {
|
|
2055
|
+
return group.children.filter(isRenderableFooterLeaf);
|
|
2056
|
+
}
|
|
2057
|
+
|
|
2058
|
+
// src/navigation/headerLayers.ts
|
|
2059
|
+
var NAVIGATION_HEADER_LAYER_TOP = "top";
|
|
2060
|
+
function byPosition(a, b) {
|
|
2061
|
+
return a.position - b.position || a.id - b.id;
|
|
2062
|
+
}
|
|
2063
|
+
function splitHeaderLayers(items) {
|
|
2064
|
+
const top = [];
|
|
2065
|
+
const main = [];
|
|
2066
|
+
for (const item of items) {
|
|
2067
|
+
if (item.layer === NAVIGATION_HEADER_LAYER_TOP) {
|
|
2068
|
+
top.push(item);
|
|
2069
|
+
} else {
|
|
2070
|
+
main.push(item);
|
|
2071
|
+
}
|
|
2072
|
+
}
|
|
2073
|
+
top.sort(byPosition);
|
|
2074
|
+
main.sort(byPosition);
|
|
2075
|
+
return { top, main };
|
|
2076
|
+
}
|
|
2077
|
+
function mergeHeaderLayers(items) {
|
|
2078
|
+
const { top, main } = splitHeaderLayers(items);
|
|
2079
|
+
return [...main, ...top];
|
|
2080
|
+
}
|
|
2081
|
+
|
|
2082
|
+
// src/navigation/navigationPayload.ts
|
|
2083
|
+
var NAVIGATION_BRANDING_LOGO_HEIGHTS = {
|
|
2084
|
+
sm: 24,
|
|
2085
|
+
md: 32,
|
|
2086
|
+
lg: 44,
|
|
2087
|
+
xl: 56
|
|
2088
|
+
};
|
|
2089
|
+
function resolveBrandingPresentation(branding) {
|
|
2090
|
+
const size = branding?.logo_size ?? "md";
|
|
2091
|
+
const requestedVariant = branding?.logo_variant ?? "logo-and-name";
|
|
2092
|
+
const hasLogo = Boolean(branding?.logo_url);
|
|
2093
|
+
const variant = hasLogo ? requestedVariant : "name-only";
|
|
2094
|
+
return {
|
|
2095
|
+
size,
|
|
2096
|
+
variant,
|
|
2097
|
+
logoHeight: NAVIGATION_BRANDING_LOGO_HEIGHTS[size],
|
|
2098
|
+
showLogo: variant !== "name-only",
|
|
2099
|
+
showName: variant !== "logo-only"
|
|
2100
|
+
};
|
|
2101
|
+
}
|
|
2102
|
+
|
|
2103
|
+
// src/navigation/navigationBundle.ts
|
|
2104
|
+
var NAVIGATION_BUNDLE_FORMAT = "selfhelp/navigation-bundle";
|
|
2105
|
+
var NAVIGATION_BUNDLE_VERSION = "2.0";
|
|
2106
|
+
function isNavigationBundleVersionSupported(version) {
|
|
2107
|
+
return version === NAVIGATION_BUNDLE_VERSION;
|
|
2108
|
+
}
|
|
2109
|
+
|
|
1600
2110
|
// src/navigation/menuMembership.ts
|
|
1601
2111
|
function flattenItems(items) {
|
|
1602
2112
|
const out = [];
|
|
@@ -1661,6 +2171,22 @@ function findPageRefInNavigationPayload(payload, pageId) {
|
|
|
1661
2171
|
}
|
|
1662
2172
|
|
|
1663
2173
|
// src/navigation/mobileRoute.ts
|
|
2174
|
+
function buildPublicPathFromRoute(urlTemplate, routeParams) {
|
|
2175
|
+
if (!urlTemplate || !urlTemplate.includes("{")) {
|
|
2176
|
+
return null;
|
|
2177
|
+
}
|
|
2178
|
+
let path = urlTemplate;
|
|
2179
|
+
for (const [key, value] of Object.entries(routeParams)) {
|
|
2180
|
+
if (value === void 0 || value === "") {
|
|
2181
|
+
continue;
|
|
2182
|
+
}
|
|
2183
|
+
path = path.replaceAll(`{${key}}`, value);
|
|
2184
|
+
}
|
|
2185
|
+
if (path.includes("{")) {
|
|
2186
|
+
return null;
|
|
2187
|
+
}
|
|
2188
|
+
return path.replace(/\/+$/, "") || "/";
|
|
2189
|
+
}
|
|
1664
2190
|
function pageUrlToMobileRoute(url, keyword) {
|
|
1665
2191
|
const normalizedKeyword = keyword.trim().toLowerCase();
|
|
1666
2192
|
if (normalizedKeyword === "profile") {
|
|
@@ -1685,8 +2211,8 @@ function toSegment(item) {
|
|
|
1685
2211
|
keyword: item.page.keyword,
|
|
1686
2212
|
url: item.page.url,
|
|
1687
2213
|
label: itemLabel(item),
|
|
1688
|
-
icon: item.icon ??
|
|
1689
|
-
mobile_icon: item.
|
|
2214
|
+
icon: item.icon ?? null,
|
|
2215
|
+
mobile_icon: item.mobile_icon ?? null
|
|
1690
2216
|
};
|
|
1691
2217
|
}
|
|
1692
2218
|
function findParentItem(items, pageId, parent = null) {
|
|
@@ -1739,9 +2265,7 @@ function resolveBranchNavGroup(payload, currentPageId, menuKeys) {
|
|
|
1739
2265
|
}
|
|
1740
2266
|
const located = findParentItem([root], currentPageId);
|
|
1741
2267
|
if (located) {
|
|
1742
|
-
const directChildren = menuVisibleChildItems(
|
|
1743
|
-
located.parent ?? { id: 0, item_type: "group", label: "", position: 0, children: located.siblings }
|
|
1744
|
-
);
|
|
2268
|
+
const directChildren = located.parent ? menuVisibleChildItems(located.parent) : located.siblings.filter((sibling) => sibling.page != null && sibling.is_active !== false);
|
|
1745
2269
|
if (located.parent && located.parent.page?.id === currentPageId && directChildren.length > 0) {
|
|
1746
2270
|
const segments = directChildren.map(toSegment).filter((s) => s != null);
|
|
1747
2271
|
return segments.length > 0 ? segments : null;
|
|
@@ -1782,6 +2306,80 @@ function resolveMobileSegmentGroup(payload, currentPageId) {
|
|
|
1782
2306
|
function resolveWebBranchNavGroup(payload, currentPageId) {
|
|
1783
2307
|
return resolveBranchNavGroup(payload, currentPageId, ["web_header", "web_footer"]);
|
|
1784
2308
|
}
|
|
2309
|
+
function findMenuItemPath(items, pageId, trail = []) {
|
|
2310
|
+
for (const item of items) {
|
|
2311
|
+
const nextTrail = [...trail, item];
|
|
2312
|
+
if (item.page?.id === pageId) {
|
|
2313
|
+
return nextTrail;
|
|
2314
|
+
}
|
|
2315
|
+
if (item.children?.length) {
|
|
2316
|
+
const found = findMenuItemPath(item.children, pageId, nextTrail);
|
|
2317
|
+
if (found) {
|
|
2318
|
+
return found;
|
|
2319
|
+
}
|
|
2320
|
+
}
|
|
2321
|
+
}
|
|
2322
|
+
return null;
|
|
2323
|
+
}
|
|
2324
|
+
function toBreadcrumb(item) {
|
|
2325
|
+
return {
|
|
2326
|
+
label: itemLabel(item),
|
|
2327
|
+
pageId: item.page?.id ?? null,
|
|
2328
|
+
keyword: item.page?.keyword ?? null,
|
|
2329
|
+
url: item.page?.url ?? null
|
|
2330
|
+
};
|
|
2331
|
+
}
|
|
2332
|
+
function resolveModeForBranch(branchParent, menu) {
|
|
2333
|
+
return branchParent?.children_nav ?? menu.children_nav ?? "sidebar";
|
|
2334
|
+
}
|
|
2335
|
+
function resolvePagerForBranch(branchParent, menu) {
|
|
2336
|
+
return branchParent?.show_pager ?? menu.show_pager ?? true;
|
|
2337
|
+
}
|
|
2338
|
+
function resolveWebBranchNavContext(payload, currentPageId) {
|
|
2339
|
+
for (const key of ["web_header", "web_footer"]) {
|
|
2340
|
+
const menu = payload.menus[key];
|
|
2341
|
+
if (!menu?.items?.length) {
|
|
2342
|
+
continue;
|
|
2343
|
+
}
|
|
2344
|
+
const path = findMenuItemPath(menu.items, currentPageId);
|
|
2345
|
+
if (!path) {
|
|
2346
|
+
continue;
|
|
2347
|
+
}
|
|
2348
|
+
const currentItem = path[path.length - 1];
|
|
2349
|
+
const ownChildren = menuVisibleChildItems(currentItem);
|
|
2350
|
+
let branchParent = null;
|
|
2351
|
+
let group;
|
|
2352
|
+
if (ownChildren.length > 0) {
|
|
2353
|
+
branchParent = currentItem;
|
|
2354
|
+
group = ownChildren;
|
|
2355
|
+
} else if (path.length >= 2) {
|
|
2356
|
+
branchParent = path[path.length - 2];
|
|
2357
|
+
group = menuVisibleChildItems(branchParent);
|
|
2358
|
+
} else {
|
|
2359
|
+
return null;
|
|
2360
|
+
}
|
|
2361
|
+
const segments = group.map(toSegment).filter((segment) => segment != null);
|
|
2362
|
+
if (segments.length === 0) {
|
|
2363
|
+
return null;
|
|
2364
|
+
}
|
|
2365
|
+
const currentIndex = segments.findIndex((segment) => segment.pageId === currentPageId);
|
|
2366
|
+
const pager = {
|
|
2367
|
+
prev: currentIndex > 0 ? segments[currentIndex - 1] : null,
|
|
2368
|
+
next: currentIndex >= 0 && currentIndex < segments.length - 1 ? segments[currentIndex + 1] : null
|
|
2369
|
+
};
|
|
2370
|
+
return {
|
|
2371
|
+
mode: resolveModeForBranch(branchParent, menu),
|
|
2372
|
+
showBreadcrumbs: menu.show_breadcrumbs ?? false,
|
|
2373
|
+
showPager: resolvePagerForBranch(branchParent, menu),
|
|
2374
|
+
heading: branchParent ? itemLabel(branchParent) : null,
|
|
2375
|
+
parent: branchParent ? toSegment(branchParent) : null,
|
|
2376
|
+
segments,
|
|
2377
|
+
breadcrumbs: path.map(toBreadcrumb),
|
|
2378
|
+
pager
|
|
2379
|
+
};
|
|
2380
|
+
}
|
|
2381
|
+
return null;
|
|
2382
|
+
}
|
|
1785
2383
|
function resolveMobilePagePresentation(payload, pageId) {
|
|
1786
2384
|
return isOnAnyMobileMenuFromPayload(payload, pageId) ? "route" : "modal";
|
|
1787
2385
|
}
|
|
@@ -1845,10 +2443,6 @@ function getNavigationItemLabel(item) {
|
|
|
1845
2443
|
return item.label || item.page?.title || item.page?.keyword || "";
|
|
1846
2444
|
}
|
|
1847
2445
|
function getNavigationItemAriaLabel(item) {
|
|
1848
|
-
const aria = item.aria_label?.trim();
|
|
1849
|
-
if (aria) {
|
|
1850
|
-
return aria;
|
|
1851
|
-
}
|
|
1852
2446
|
const label = getNavigationItemLabel(item);
|
|
1853
2447
|
return label || void 0;
|
|
1854
2448
|
}
|
|
@@ -2072,6 +2666,68 @@ function clampMenuItemsAtDepth(items, maxDepth, depth = 0) {
|
|
|
2072
2666
|
});
|
|
2073
2667
|
}
|
|
2074
2668
|
|
|
2669
|
+
// src/navigation/activeTrail.ts
|
|
2670
|
+
function getNavigationItemMobileHref(item) {
|
|
2671
|
+
if (item.item_type === "external_url" && item.external_url) {
|
|
2672
|
+
return item.external_url;
|
|
2673
|
+
}
|
|
2674
|
+
if (!item.page) {
|
|
2675
|
+
return "/index";
|
|
2676
|
+
}
|
|
2677
|
+
return pageUrlToMobileRoute(item.page.url, item.page.keyword);
|
|
2678
|
+
}
|
|
2679
|
+
function matchesWebPath(href, pathname) {
|
|
2680
|
+
if (href === "" || href === "#") {
|
|
2681
|
+
return false;
|
|
2682
|
+
}
|
|
2683
|
+
if (pathname === href) {
|
|
2684
|
+
return true;
|
|
2685
|
+
}
|
|
2686
|
+
return href !== "/" && pathname.startsWith(`${href}/`);
|
|
2687
|
+
}
|
|
2688
|
+
function matchesMobilePath(href, pathname) {
|
|
2689
|
+
if (pathname === href) {
|
|
2690
|
+
return true;
|
|
2691
|
+
}
|
|
2692
|
+
if (href === "/index" && (pathname === "" || pathname === "/" || pathname === "/index")) {
|
|
2693
|
+
return true;
|
|
2694
|
+
}
|
|
2695
|
+
return href !== "/" && pathname.startsWith(`${href}/`);
|
|
2696
|
+
}
|
|
2697
|
+
function isActive(item, pathname, getHref, matches) {
|
|
2698
|
+
if (matches(getHref(item), pathname)) {
|
|
2699
|
+
return true;
|
|
2700
|
+
}
|
|
2701
|
+
return item.children.some((child) => isActive(child, pathname, getHref, matches));
|
|
2702
|
+
}
|
|
2703
|
+
function isMenuItemActiveOnWeb(item, pathname) {
|
|
2704
|
+
return isActive(item, pathname, getNavigationItemHref, matchesWebPath);
|
|
2705
|
+
}
|
|
2706
|
+
function isMenuItemActiveOnMobile(item, pathname) {
|
|
2707
|
+
return isActive(item, pathname, getNavigationItemMobileHref, matchesMobilePath);
|
|
2708
|
+
}
|
|
2709
|
+
function expandedIdsForActiveTrail(items, pathname, platform) {
|
|
2710
|
+
const getHref = platform === "mobile" ? getNavigationItemMobileHref : getNavigationItemHref;
|
|
2711
|
+
const matches = platform === "mobile" ? matchesMobilePath : matchesWebPath;
|
|
2712
|
+
const expanded = /* @__PURE__ */ new Set();
|
|
2713
|
+
const visit = (item) => {
|
|
2714
|
+
let childActive = false;
|
|
2715
|
+
for (const child of item.children) {
|
|
2716
|
+
if (visit(child)) {
|
|
2717
|
+
childActive = true;
|
|
2718
|
+
}
|
|
2719
|
+
}
|
|
2720
|
+
if (childActive) {
|
|
2721
|
+
expanded.add(item.id);
|
|
2722
|
+
}
|
|
2723
|
+
return childActive || matches(getHref(item), pathname);
|
|
2724
|
+
};
|
|
2725
|
+
for (const item of items) {
|
|
2726
|
+
visit(item);
|
|
2727
|
+
}
|
|
2728
|
+
return expanded;
|
|
2729
|
+
}
|
|
2730
|
+
|
|
2075
2731
|
// src/utils/spacing.ts
|
|
2076
2732
|
var ALLOWED_KEYS = ["mt", "mb", "ms", "me", "pt", "pb", "ps", "pe"];
|
|
2077
2733
|
function parseSpacing(raw) {
|
|
@@ -2148,14 +2804,19 @@ function transformPagesData(pages) {
|
|
|
2148
2804
|
CLIENT_TYPE_MOBILE,
|
|
2149
2805
|
CLIENT_TYPE_MOBILE_AND_WEB,
|
|
2150
2806
|
CLIENT_TYPE_WEB,
|
|
2807
|
+
CMS_APP_PRIMARY_ROLES,
|
|
2808
|
+
CMS_APP_ROLES,
|
|
2151
2809
|
COLOR_NAMES,
|
|
2152
2810
|
COLOR_PALETTE,
|
|
2153
2811
|
COLOR_SCALES,
|
|
2154
2812
|
CONTAINER_SIZE_PX,
|
|
2155
2813
|
DEFAULT_MOBILE_ICON,
|
|
2814
|
+
DEFAULT_WEB_FOOTER_PRESET,
|
|
2156
2815
|
DEFAULT_WEB_HEADER_PRESET,
|
|
2157
2816
|
ENDPOINTS,
|
|
2817
|
+
FIELDS_MAP_STYLE_CONFIG,
|
|
2158
2818
|
FONT_SIZE_PX,
|
|
2819
|
+
FORM_RECORD_PREFILL_SKIP_FIELDS,
|
|
2159
2820
|
FULL_RADIUS_PX,
|
|
2160
2821
|
HEADER_CLIENT_TYPE,
|
|
2161
2822
|
LINE_HEIGHT,
|
|
@@ -2163,6 +2824,11 @@ function transformPagesData(pages) {
|
|
|
2163
2824
|
MOBILE_ICON_NAMES,
|
|
2164
2825
|
MOBILE_ICON_SET,
|
|
2165
2826
|
MOBILE_PREVIEW_ENDPOINTS,
|
|
2827
|
+
NAVIGATION_BRANDING_LOGO_HEIGHTS,
|
|
2828
|
+
NAVIGATION_BUNDLE_FORMAT,
|
|
2829
|
+
NAVIGATION_BUNDLE_VERSION,
|
|
2830
|
+
NAVIGATION_HEADER_LAYER_TOP,
|
|
2831
|
+
OPTION_STYLE_CONFIGS,
|
|
2166
2832
|
PERMISSIONS,
|
|
2167
2833
|
PREVIEW_BRIDGE_MESSAGE,
|
|
2168
2834
|
PREVIEW_PARENT_ORIGIN_PARAM,
|
|
@@ -2175,29 +2841,42 @@ function transformPagesData(pages) {
|
|
|
2175
2841
|
SPACING_VALUES,
|
|
2176
2842
|
STYLE_REGISTRY,
|
|
2177
2843
|
SYSTEM_ENDPOINTS,
|
|
2844
|
+
WEB_FOOTER_PRESET_OPTIONS,
|
|
2845
|
+
WEB_FOOTER_PRESET_VALUES,
|
|
2178
2846
|
WEB_HEADER_PRESET_OPTIONS,
|
|
2179
2847
|
WEB_HEADER_PRESET_VALUES,
|
|
2180
2848
|
_resetPluginStyleRegistry,
|
|
2181
2849
|
arePreviewPreferencesEqual,
|
|
2182
2850
|
buildConditionContext,
|
|
2851
|
+
buildPagesResolvePath,
|
|
2852
|
+
buildPagesResolveQuery,
|
|
2853
|
+
buildPagesResolveUrl,
|
|
2854
|
+
buildPublicPathFromRoute,
|
|
2183
2855
|
clampMenuItemsAtDepth,
|
|
2184
2856
|
classifyClass,
|
|
2185
2857
|
classifyClassString,
|
|
2186
2858
|
collectPageIdsFromMenuItems,
|
|
2187
2859
|
colorToHex,
|
|
2188
2860
|
evaluateCondition,
|
|
2861
|
+
expandedIdsForActiveTrail,
|
|
2189
2862
|
extendStyleRegistry,
|
|
2190
2863
|
findMenuItemByPageId,
|
|
2191
2864
|
findNearestBottomTabMenuItemForPage,
|
|
2192
2865
|
findPageRefInNavigationPayload,
|
|
2193
2866
|
findRemap,
|
|
2867
|
+
flattenFooterItems,
|
|
2868
|
+
flattenFormRecordPrefillValues,
|
|
2194
2869
|
flattenMenuItems,
|
|
2195
2870
|
flattenNavigationMenuItems,
|
|
2871
|
+
footerColumnItems,
|
|
2872
|
+
footerGroupLinks,
|
|
2873
|
+
footerStandaloneItems,
|
|
2196
2874
|
getMergedStyleRegistry,
|
|
2197
2875
|
getNavigationItemAriaLabel,
|
|
2198
2876
|
getNavigationItemHref,
|
|
2199
2877
|
getNavigationItemKeyword,
|
|
2200
2878
|
getNavigationItemLabel,
|
|
2879
|
+
getNavigationItemMobileHref,
|
|
2201
2880
|
getPluginStyleRegistry,
|
|
2202
2881
|
getRegistryEntry,
|
|
2203
2882
|
getRegistryEntryAny,
|
|
@@ -2207,8 +2886,12 @@ function transformPagesData(pages) {
|
|
|
2207
2886
|
gridSpanToReactNativeColumn,
|
|
2208
2887
|
hasInlineFormatting,
|
|
2209
2888
|
isBottomTabMenuItemActive,
|
|
2889
|
+
isDoubleWebHeaderPreset,
|
|
2210
2890
|
isKnownStyleName,
|
|
2891
|
+
isMenuItemActiveOnMobile,
|
|
2892
|
+
isMenuItemActiveOnWeb,
|
|
2211
2893
|
isMobileIconName,
|
|
2894
|
+
isNavigationBundleVersionSupported,
|
|
2212
2895
|
isOnAnyMobileMenu,
|
|
2213
2896
|
isOnAnyMobileMenuFromPayload,
|
|
2214
2897
|
isPageInMenuTree,
|
|
@@ -2221,6 +2904,7 @@ function transformPagesData(pages) {
|
|
|
2221
2904
|
isStyleAllowedOnPage,
|
|
2222
2905
|
isStylePlacementAllowed,
|
|
2223
2906
|
isStyleSupportedOnPlatform,
|
|
2907
|
+
isWebFooterPreset,
|
|
2224
2908
|
isWebHeaderPreset,
|
|
2225
2909
|
mapAccordionVariantToHeroUiVariant,
|
|
2226
2910
|
mapChipVariantToHeroUiVariant,
|
|
@@ -2233,10 +2917,20 @@ function transformPagesData(pages) {
|
|
|
2233
2917
|
mapSizeToHeroUi,
|
|
2234
2918
|
mapSizeToMantine,
|
|
2235
2919
|
mapSpacingToPx,
|
|
2920
|
+
matchesMobilePath,
|
|
2921
|
+
matchesWebPath,
|
|
2922
|
+
mergeHeaderLayers,
|
|
2923
|
+
normalizePagesResolvePath,
|
|
2236
2924
|
pageUrlToMobileRoute,
|
|
2237
2925
|
parseDimensionToReactNative,
|
|
2238
2926
|
parseDimensionToWeb,
|
|
2927
|
+
parseFieldsMapCatalog,
|
|
2928
|
+
parseFieldsMapLabels,
|
|
2929
|
+
parseFormRecordPrefill,
|
|
2239
2930
|
parseInlineRich,
|
|
2931
|
+
parseOptionCatalog,
|
|
2932
|
+
parseOptionCodes,
|
|
2933
|
+
parseOptionLabels,
|
|
2240
2934
|
parseSpacing,
|
|
2241
2935
|
previewKeywordFromPath,
|
|
2242
2936
|
radiusToPx,
|
|
@@ -2244,6 +2938,8 @@ function transformPagesData(pages) {
|
|
|
2244
2938
|
resolveAssetSources,
|
|
2245
2939
|
resolveAssetUrl,
|
|
2246
2940
|
resolveBranchNavGroup,
|
|
2941
|
+
resolveBrandingPresentation,
|
|
2942
|
+
resolveFieldsMapLabel,
|
|
2247
2943
|
resolveHolderRedirectPath,
|
|
2248
2944
|
resolveMantineVariant,
|
|
2249
2945
|
resolveMenuMaxDepth,
|
|
@@ -2252,20 +2948,29 @@ function transformPagesData(pages) {
|
|
|
2252
2948
|
resolveMobileSegmentGroup,
|
|
2253
2949
|
resolveMobileStartupKeyword,
|
|
2254
2950
|
resolveMobileStartupRoute,
|
|
2951
|
+
resolveOptionCodesLabels,
|
|
2952
|
+
resolveOptionLabel,
|
|
2953
|
+
resolveOptionValueLabels,
|
|
2954
|
+
resolveOptions,
|
|
2255
2955
|
resolveSharedStyle,
|
|
2256
2956
|
resolveSharedStyleForMobile,
|
|
2257
2957
|
resolveSharedStyleForWeb,
|
|
2258
2958
|
resolveSharedStyleProps,
|
|
2959
|
+
resolveWebBranchNavContext,
|
|
2259
2960
|
resolveWebBranchNavGroup,
|
|
2961
|
+
resolveWebFooterPreset,
|
|
2260
2962
|
resolveWebHeaderPreset,
|
|
2261
2963
|
resolveWebStartupPath,
|
|
2262
2964
|
searchMenuPagesInPayload,
|
|
2965
|
+
serializeFieldsMapCatalog,
|
|
2966
|
+
serializeFieldsMapLabels,
|
|
2263
2967
|
setToStylePlatform,
|
|
2264
2968
|
sharedTailwindExtend,
|
|
2265
2969
|
sharedTailwindPreset,
|
|
2266
2970
|
sizeToFontPx,
|
|
2267
2971
|
spacingToClasses,
|
|
2268
2972
|
spacingToPx,
|
|
2973
|
+
splitHeaderLayers,
|
|
2269
2974
|
stripHtmlToText,
|
|
2270
2975
|
stylePlatformToSet,
|
|
2271
2976
|
toHeroUiSemanticProps,
|