@designcrowd/library.brand-page 5.16.47-kp-dropdown-2 → 5.16.47
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/lib/src/{CreatedOnBrandCrowd-de-de-BTCT28oZ.js → CreatedOnBrandCrowd-de-de-DebKPLDX.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-en-us-CCXQIdn4.js → CreatedOnBrandCrowd-en-us-BpPgKLto.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-es-es-Dv1ZXxtD.js → CreatedOnBrandCrowd-es-es-cPAZBjUO.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-fr-fr-H4ze6Vhb.js → CreatedOnBrandCrowd-fr-ca-BYaPug2f.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-fr-ca-H4ze6Vhb.js → CreatedOnBrandCrowd-fr-fr-BYaPug2f.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-pt-pt-Dnl8_sRO.js → CreatedOnBrandCrowd-pt-br-BMJ1UJ-b.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-pt-br-Dnl8_sRO.js → CreatedOnBrandCrowd-pt-pt-BMJ1UJ-b.js} +1 -1
- package/lib/src/{CreatedOnDcom-de-de-Cjfk8fTg.js → CreatedOnDcom-de-de-B280zfGM.js} +1 -1
- package/lib/src/{CreatedOnDcom-en-us-D_Ks8X6k.js → CreatedOnDcom-en-us-CcH8WRUU.js} +1 -1
- package/lib/src/{CreatedOnDcom-es-es-CVgGS_TQ.js → CreatedOnDcom-es-es-BjVBQo_F.js} +1 -1
- package/lib/src/{CreatedOnDcom-fr-ca-DXU17SGm.js → CreatedOnDcom-fr-ca-T6WZ2I2E.js} +1 -1
- package/lib/src/{CreatedOnDcom-fr-fr-CZprWhYG.js → CreatedOnDcom-fr-fr-Bdwxqa13.js} +1 -1
- package/lib/src/{CreatedOnDcom-pt-br-DgzkkWa6.js → CreatedOnDcom-pt-br-DwM59Qaw.js} +1 -1
- package/lib/src/{CreatedOnDcom-pt-pt-CTXWh20G.js → CreatedOnDcom-pt-pt-Cg34AcLr.js} +1 -1
- package/lib/src/brand-page/__fixtures__/brand-page-sample-data.js +0 -6
- package/lib/src/brand-page/components/button/Button.mixin.js +9 -3
- package/lib/src/brand-page/components/image-gallery/ImageGallery.stories.js +0 -3
- package/lib/src/brand-page/components/images-section/ImagesSection.stories.js +0 -3
- package/lib/src/brand-page/components/navigation/button-carousel/ButtonCarouselNavigation.mixin.d.ts +12 -14
- package/lib/src/brand-page/components/navigation/button-carousel/ButtonCarouselNavigation.mixin.js +23 -19
- package/lib/src/brand-page/components/navigation/navigation-side-menu/NavigationSideMenu.mixin.d.ts +9 -13
- package/lib/src/brand-page/components/navigation/navigation-side-menu/NavigationSideMenu.mixin.js +9 -15
- package/lib/src/brand-page/components/page-header/PageHeader.mixin.d.ts +1 -9
- package/lib/src/brand-page/components/page-header/PageHeader.mixin.js +0 -4
- package/lib/src/brand-page/components/payment/__fixtures__/request-payment.d.ts +0 -1
- package/lib/src/brand-page/components/payment/__fixtures__/support-me.d.ts +0 -1
- package/lib/src/brand-page/components/profile/Profile.stories.js +0 -1
- package/lib/src/brand-page/models/brand-page-context.model.d.ts +1 -2
- package/lib/src/brand-page/models/index.d.ts +3 -3
- package/lib/src/brand-page/utils/migration/migration-06.js +2 -2
- package/lib/src/brand-page/utils/migration.util.js +0 -6
- package/lib/src/brand-page/utils/model.util.d.ts +1 -2
- package/lib/src/brand-page/utils/model.util.js +0 -3
- package/lib/src/brand-page/utils/view-model.util.js +12 -73
- package/lib/src/brand-page/view-models.d.ts +0 -3
- package/lib/src/brand-page-maker/components/brand-page-maker/BrandPageMaker.mixin.d.ts +1 -2
- package/lib/src/brand-page-maker/components/brand-page-maker/__fixtures__/brand-page-examples.js +1 -1
- package/lib/src/brand-page-maker/components/brandpage-maker-page/BrandPageMakerPage.mixin.d.ts +1 -2
- package/lib/src/brand-page-maker/components/preview/Preview.mixin.js +0 -1
- package/lib/src/brand-page-maker/components/template-preview/TemplatePreview.mixin.js +0 -1
- package/lib/src/brand-page-maker/composables/rich-text-editor/hyperlink.d.ts +0 -3
- package/lib/src/brand-page-maker/composables/rich-text-editor/hyperlink.js +0 -15
- package/lib/src/brand-page-maker/composables/rich-text-editor/useRichTextEditor.js +1 -3
- package/lib/src/brand-page-maker/constants/config-settings-constant.js +2 -2
- package/lib/src/brand-page-maker/models/content-settings.js +2 -2
- package/lib/src/brand-page-maker/stores/brandpage-maker/brandpage-maker-store.js +7 -5
- package/lib/src/brand-page-maker/utils/content.util.d.ts +4 -0
- package/lib/src/brand-page-maker/utils/content.util.js +34 -0
- package/lib/src/brand-page-maker/utils/rich-text-editor.util.js +1 -4
- package/lib/src/brand-page-maker/validators/section-button.validator.js +1 -2
- package/lib/src/{bundled-translations-C4k-Kbm4.js → bundled-translations-BGBFf8J6.js} +30 -32
- package/lib/src/{bundled-translations.de-DE-MavJbdYH.js → bundled-translations.de-DE-CMMRRwga.js} +30 -32
- package/lib/src/{bundled-translations.es-ES-Dqi9nQzQ.js → bundled-translations.es-ES-XRLPG1g-.js} +30 -32
- package/lib/src/{bundled-translations.fr-CA-BBJdMWhW.js → bundled-translations.fr-CA-JVxHjJw5.js} +30 -32
- package/lib/src/{bundled-translations.fr-FR-yYENZ0WX.js → bundled-translations.fr-FR-B9v33v0w.js} +32 -34
- package/lib/src/{bundled-translations.pt-BR-B5ztDVhs.js → bundled-translations.pt-BR-B_hexxsq.js} +24 -26
- package/lib/src/{bundled-translations.pt-PT-BZcbziI9.js → bundled-translations.pt-PT-B9aY7rS8.js} +24 -26
- package/lib/src/bundles/bundled-translations.de-DE.json +1 -5
- package/lib/src/bundles/bundled-translations.es-ES.json +1 -5
- package/lib/src/bundles/bundled-translations.fr-CA.json +1 -5
- package/lib/src/bundles/bundled-translations.fr-FR.json +1 -5
- package/lib/src/bundles/bundled-translations.json +2 -6
- package/lib/src/bundles/bundled-translations.pt-BR.json +1 -5
- package/lib/src/bundles/bundled-translations.pt-PT.json +1 -5
- package/lib/src/composables/useTranslate.d.ts +1 -2
- package/lib/src/composables/useTranslate.js +1 -2
- package/lib/src/css/library.brand-page-brandCrowd.min.css +74 -95
- package/lib/src/css/library.brand-page-brandPage.min.css +74 -96
- package/lib/src/css/library.brand-page-designCom.min.css +74 -95
- package/lib/src/css/library.brand-page-preview.min.css +74 -95
- package/lib/src/index.mjs +1 -1
- package/lib/src/{lib-Bs0yL0Cl.js → lib-BJ3mN_oo.js} +22053 -22653
- package/lib/src/shared/content-settings/components/content-settings/ContentSettings.mixin.d.ts +2 -9
- package/lib/src/shared/content-settings/components/content-settings/ContentSettings.mixin.js +1 -5
- package/lib/src/shared/content-settings/components/content-settings/ReplaceImageSettingsForContent.mixin.d.ts +1 -2
- package/lib/src/shared/content-settings/components/content-settings-item/ContentSettingsItem.mixin.js +0 -2
- package/lib/src/shared/content-settings/components/content-settings-item/ContentSettingsItemField.mixin.d.ts +1 -2
- package/lib/src/shared/content-settings/components/focused-content-item-settings/FocusedContentItemSettings.mixin.js +0 -2
- package/lib/src/shared/content-settings/components/page-dropdown-field/PageDropdownField.mixin.d.ts +149 -0
- package/lib/src/shared/content-settings/components/page-dropdown-field/PageDropdownField.mixin.js +103 -0
- package/lib/src/shared/content-settings/components/payment-config-field/PaymentConfigField.mixin.d.ts +1 -2
- package/lib/src/shared/content-settings/components/radio-field/RadioField.mixin.js +0 -2
- package/lib/src/shared/logo-settings/components/LogoSettings.mixin.d.ts +1 -2
- package/lib/src/shared/page-navigation/store/page-navigation-store.d.ts +0 -4
- package/lib/src/shared/page-navigation/store/page-navigation-store.js +0 -4
- package/lib/src/shared/page-settings/components/new-page-modal/NewPageModal.mixin.d.ts +1 -7
- package/lib/src/shared/page-settings/components/new-page-modal/NewPageModal.mixin.js +1 -8
- package/lib/src/shared/page-settings/components/page-settings/PageSettings.mixin.d.ts +2 -8
- package/lib/src/shared/page-settings/components/page-settings/PageSettings.mixin.js +7 -104
- package/lib/src/shared/page-settings/components/page-settings-section-styles/PageSettingsSectionStyles.mixin.d.ts +1 -2
- package/lib/src/shared/page-settings/store/page-settings-store.d.ts +1 -3
- package/lib/src/shared/page-settings/store/page-settings-store.js +6 -10
- package/package.json +5 -5
- package/src/brand-page/__fixtures__/brand-page-sample-data.ts +0 -6
- package/src/brand-page/components/about-section/AboutSection.vue.test.ts +0 -3
- package/src/brand-page/components/button/Button.mixin.ts +17 -4
- package/src/brand-page/components/image/Image.test.ts +0 -3
- package/src/brand-page/components/image-gallery/ImageGallery.stories.ts +0 -3
- package/src/brand-page/components/image-gallery/ImageGallery.test.ts +0 -3
- package/src/brand-page/components/images-section/ImagesSection.stories.ts +0 -3
- package/src/brand-page/components/navigation/Navigation.vue +4 -4
- package/src/brand-page/components/navigation/button-carousel/ButtonCarouselNavigation.mixin.ts +37 -24
- package/src/brand-page/components/navigation/button-carousel/ButtonCarouselNavigation.vue +5 -4
- package/src/brand-page/components/navigation/navigation-side-menu/NavigationSideMenu.mixin.ts +22 -17
- package/src/brand-page/components/navigation/navigation-side-menu/NavigationSideMenu.vue +4 -4
- package/src/brand-page/components/page/Page.vue +3 -9
- package/src/brand-page/components/page-header/PageHeader.mixin.ts +1 -5
- package/src/brand-page/components/page-header/PageHeader.vue +0 -1
- package/src/brand-page/components/profile/Profile.stories.ts +0 -1
- package/src/brand-page/components/social-links/SocialLinks.vue.test.ts +0 -3
- package/src/brand-page/components/text-wrapper/TextWrapper.vue +17 -1
- package/src/brand-page/models/brand-page-context.model.ts +2 -3
- package/src/brand-page/models/index.ts +3 -3
- package/src/brand-page/utils/__snapshots__/migration.util.test.ts.snap +4 -4
- package/src/brand-page/utils/migration/migration-06.ts +7 -3
- package/src/brand-page/utils/migration.util.ts +0 -6
- package/src/brand-page/utils/model.util.ts +0 -7
- package/src/brand-page/utils/view-model.util.ts +35 -119
- package/src/brand-page/view-models.ts +0 -3
- package/src/brand-page-maker/components/brand-page-maker/__fixtures__/brand-page-examples.ts +1 -1
- package/src/brand-page-maker/components/brandpage-maker-page/BrandPageMakerPage.vue +0 -2
- package/src/brand-page-maker/components/preview/Preview.mixin.ts +0 -1
- package/src/brand-page-maker/components/rich-text-editor/RichTextEditor.vue +32 -53
- package/src/brand-page-maker/components/template-preview/TemplatePreview.mixin.ts +0 -1
- package/src/brand-page-maker/composables/rich-text-editor/hyperlink.ts +0 -18
- package/src/brand-page-maker/composables/rich-text-editor/useRichTextEditor.ts +1 -5
- package/src/brand-page-maker/constants/config-settings-constant.ts +2 -2
- package/src/brand-page-maker/models/content-settings.ts +2 -2
- package/src/brand-page-maker/stores/brandpage-maker/brandpage-maker-store.ts +7 -4
- package/src/brand-page-maker/utils/content.util.ts +68 -1
- package/src/brand-page-maker/utils/rich-text-editor.util.ts +1 -5
- package/src/brand-page-maker/validators/section-button.validator.ts +1 -4
- package/src/bundles/bundled-translations.de-DE.json +1 -5
- package/src/bundles/bundled-translations.es-ES.json +1 -5
- package/src/bundles/bundled-translations.fr-CA.json +1 -5
- package/src/bundles/bundled-translations.fr-FR.json +1 -5
- package/src/bundles/bundled-translations.json +2 -6
- package/src/bundles/bundled-translations.pt-BR.json +1 -5
- package/src/bundles/bundled-translations.pt-PT.json +1 -5
- package/src/composables/useTranslate.ts +0 -3
- package/src/shared/content-settings/components/content-settings/ContentSettings.mixin.ts +1 -13
- package/src/shared/content-settings/components/content-settings/ContentSettings.vue +27 -27
- package/src/shared/content-settings/components/content-settings-item/ContentSettingsItem.mixin.ts +0 -2
- package/src/shared/content-settings/components/focused-content-item-settings/FocusedContentItemSettings.mixin.ts +0 -2
- package/src/shared/content-settings/components/page-dropdown-field/PageDropdownField.mixin.ts +115 -0
- package/src/shared/content-settings/components/page-dropdown-field/PageDropdownField.vue +40 -103
- package/src/shared/content-settings/components/radio-field/RadioField.mixin.ts +0 -2
- package/src/shared/page-navigation/store/page-navigation-store.ts +0 -5
- package/src/shared/page-settings/components/new-page-modal/NewPageModal.mixin.ts +1 -12
- package/src/shared/page-settings/components/new-page-modal/NewPageModal.vue +3 -12
- package/src/shared/page-settings/components/new-page-modal/i18n/new-page-modal.json +1 -1
- package/src/shared/page-settings/components/page-settings/PageElement.vue +4 -17
- package/src/shared/page-settings/components/page-settings/PageSettingMenu.vue +3 -31
- package/src/shared/page-settings/components/page-settings/PageSettings.mixin.ts +14 -161
- package/src/shared/page-settings/components/page-settings/PageSettings.vue +41 -22
- package/src/shared/page-settings/components/page-settings/i18n/page-settings.de-DE.json +15 -17
- package/src/shared/page-settings/components/page-settings/i18n/page-settings.es-ES.json +15 -17
- package/src/shared/page-settings/components/page-settings/i18n/page-settings.fr-CA.json +15 -17
- package/src/shared/page-settings/components/page-settings/i18n/page-settings.fr-FR.json +15 -17
- package/src/shared/page-settings/components/page-settings/i18n/page-settings.json +1 -2
- package/src/shared/page-settings/components/page-settings/i18n/page-settings.pt-BR.json +15 -17
- package/src/shared/page-settings/components/page-settings/i18n/page-settings.pt-PT.json +15 -17
- package/src/shared/page-settings/store/page-settings-store.ts +6 -11
- package/lib/src/brand-page/utils/migration/migration-13.d.ts +0 -2
- package/lib/src/brand-page/utils/migration/migration-13.js +0 -74
- package/src/brand-page/utils/migration/migration-13.test.ts +0 -735
- package/src/brand-page/utils/migration/migration-13.ts +0 -125
- package/src/shared/page-navigation/PageSelectorDropdown.vue +0 -174
- package/src/shared/page-navigation/i18n/page-selector-dropdown.de-DE.json +0 -5
- package/src/shared/page-navigation/i18n/page-selector-dropdown.es-ES.json +0 -5
- package/src/shared/page-navigation/i18n/page-selector-dropdown.fr-CA.json +0 -5
- package/src/shared/page-navigation/i18n/page-selector-dropdown.fr-FR.json +0 -5
- package/src/shared/page-navigation/i18n/page-selector-dropdown.json +0 -5
- package/src/shared/page-navigation/i18n/page-selector-dropdown.pt-BR.json +0 -5
- package/src/shared/page-navigation/i18n/page-selector-dropdown.pt-PT.json +0 -5
- package/src/shared/page-settings/components/page-settings/NestedDraggable.vue +0 -276
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
import { reactive } from 'vue';
|
|
2
2
|
import { assertUnreachable } from '../../helpers/ts.helper';
|
|
3
|
-
import { ButtonStyles, VIEWPORTS } from '../models';
|
|
3
|
+
import { ButtonStyles, SENSITIVE_CONTENT_TYPES, VIEWPORTS } from '../models';
|
|
4
4
|
import { NavigationMobile, NavigationDesktop, BRAND_PAGE_TYPES, BUTTON_LINK_TYPE, NavigationMenuStyles, } from '../models';
|
|
5
|
-
import { isHexTransparent } from './color.util';
|
|
6
|
-
import {
|
|
5
|
+
import { isHexTransparent, setRgbAlpha } from './color.util';
|
|
6
|
+
import { isHexColor } from '../../utils/helpers';
|
|
7
|
+
import { CONTENT_TEXT_STYLE_PROPERTY_KEYS, FALLBACK_DEFAULT_LINK_COLOR, FONT_SIZE_BODY, LINE_HEIGHT_BODY, DEFAULT_LOGO_HEIGHT, DEFAULT_LOGO_WIDTH, ButtonSoftBoxShadowSize, ButtonBoxShadowSize, BoxShadowSpread, ALIGN_LEFT_ALIGNED, ALIGN_RIGHT_ALIGNED, MAX_IMAGES_SECTION_ALIGNMENT_ITEMS_LENGTH, FONT_FAMILY_CONFIGS, isGoogleType, LINE_HEIGHT_HEADINGS, FONT_SIZE_HEADINGS, DEFAULT_TEXT_ALIGN, IMAGE_RESOLUTION_PRESETS, BIG_IMAGE, ALIGN_LEFT_BIG_IMAGE, ALIGN_CARD_CENTER_IMAGE, ALIGN_CARD_LEFT_IMAGE, } from '../constants';
|
|
7
8
|
import uniq from 'lodash/uniq';
|
|
8
9
|
import { generateGoogleFontUrl } from './font-loader.util';
|
|
9
10
|
import { isValidSvgUrl } from './image.util';
|
|
10
11
|
import { isLogoContent } from './model.util';
|
|
11
12
|
import { getBoxShadowValue } from './button.util';
|
|
12
13
|
import { getRouteNameByPageIndex, getRouteParamsByPage } from './route.util';
|
|
13
|
-
import { hasRTEContent } from '../../brand-page-maker/utils';
|
|
14
|
-
import { getPageIdFromHref, isHrefPageId, } from '../../brand-page-maker/composables/rich-text-editor/hyperlink';
|
|
15
14
|
const BUTTON_BORDER_RADIUS = '9999px';
|
|
16
15
|
const CONTENT_BORDER_RADIUS = '48px';
|
|
17
16
|
const PROFILE_PADDING_TOP = '1rem';
|
|
@@ -442,7 +441,7 @@ export const mapToBannerSectionViewModel = (content, styles, options) => {
|
|
|
442
441
|
modalImageUrl: '',
|
|
443
442
|
url: content.url,
|
|
444
443
|
title: content.buttonText || '',
|
|
445
|
-
page:
|
|
444
|
+
page: '',
|
|
446
445
|
}, styles, {
|
|
447
446
|
titleStyle: content.buttonTextStyle,
|
|
448
447
|
}),
|
|
@@ -598,7 +597,7 @@ export const mapToBookingSectionViewModel = (content, styles) => {
|
|
|
598
597
|
modalImageUrl: '',
|
|
599
598
|
url: content.url,
|
|
600
599
|
title: content.buttonText || '',
|
|
601
|
-
page: content.
|
|
600
|
+
page: content.pageSlug || '',
|
|
602
601
|
colorReplacements: [],
|
|
603
602
|
titleStyle: content.buttonTextStyle,
|
|
604
603
|
}, styles, {
|
|
@@ -610,34 +609,22 @@ export const mapToBookingSectionViewModel = (content, styles) => {
|
|
|
610
609
|
// Recursively build the nav item view model for each page/sub page in the nav
|
|
611
610
|
const buildNavItemViewModel = (order, routes, parentPath, isFirstPage, brandPageSlug, isCustomDomain, depth = 0) => {
|
|
612
611
|
const route = routes.find((r) => r.id === order.routeId);
|
|
613
|
-
|
|
614
|
-
// This shouldn't happen, but we want to handle it gracefully just in case
|
|
615
|
-
return null;
|
|
616
|
-
}
|
|
617
|
-
const pageSlug = route.pageSlug;
|
|
612
|
+
const pageSlug = route?.pageSlug ?? '';
|
|
618
613
|
const relativePath = parentPath ? `${parentPath}/${pageSlug}` : pageSlug;
|
|
619
614
|
return {
|
|
620
|
-
|
|
621
|
-
pageId: route.pageId,
|
|
622
|
-
slug: route.pageSlug,
|
|
623
|
-
displayName: route.displayName,
|
|
615
|
+
displayName: route?.displayName ?? '',
|
|
624
616
|
routeName: getRouteNameByPageIndex(Boolean(isCustomDomain), isFirstPage ? 0 : 9999),
|
|
625
|
-
routeParams: getRouteParamsByPage(Boolean(isCustomDomain), brandPageSlug ?? '
|
|
626
|
-
pageSlug),
|
|
617
|
+
routeParams: getRouteParamsByPage(Boolean(isCustomDomain), brandPageSlug ?? '', pageSlug),
|
|
627
618
|
relativePath,
|
|
628
|
-
isHidden: route
|
|
619
|
+
isHidden: route?.isHidden ?? false,
|
|
629
620
|
nestedNavItems: depth >= MAX_SUB_NAV_DEPTH
|
|
630
621
|
? []
|
|
631
|
-
: order.subRoutes
|
|
632
|
-
.map((subRoute) => buildNavItemViewModel(subRoute, routes, relativePath, false, brandPageSlug, isCustomDomain, depth + 1))
|
|
633
|
-
.filter((item) => item !== null),
|
|
622
|
+
: order.subRoutes.map((subRoute) => buildNavItemViewModel(subRoute, routes, relativePath, false, brandPageSlug, isCustomDomain, depth + 1)),
|
|
634
623
|
};
|
|
635
624
|
};
|
|
636
625
|
export const mapToNavViewModel = (nav, brandPageSlug, isCustomDomain) => {
|
|
637
626
|
return {
|
|
638
|
-
navItems: nav.orders
|
|
639
|
-
.map((order, idx) => buildNavItemViewModel(order, nav.routes, '', idx === 0, brandPageSlug, isCustomDomain))
|
|
640
|
-
.filter((item) => item !== null).filter((item) => !item.isHidden),
|
|
627
|
+
navItems: nav.orders.map((order, idx) => buildNavItemViewModel(order, nav.routes, '', idx === 0, brandPageSlug, isCustomDomain)),
|
|
641
628
|
};
|
|
642
629
|
};
|
|
643
630
|
export const mapToPageStyleViewModel = (pageStyles, options) => {
|
|
@@ -823,7 +810,6 @@ export const getBrandPageViewModelFromBrandPageModel = (model, brandPageToken, s
|
|
|
823
810
|
};
|
|
824
811
|
});
|
|
825
812
|
const nav = mapToNavViewModel(model.nav, options.brandPageSlug, options.isCustomDomain);
|
|
826
|
-
mapPageIdReferencesToRelativePaths(pages, nav, options);
|
|
827
813
|
return {
|
|
828
814
|
brandPageToken,
|
|
829
815
|
pages,
|
|
@@ -853,53 +839,6 @@ export const getBrandPageViewModelFromBrandPageModel = (model, brandPageToken, s
|
|
|
853
839
|
: { isSavingEnabled: true, hideBranding: false },
|
|
854
840
|
};
|
|
855
841
|
};
|
|
856
|
-
const mapPageIdReferencesToRelativePaths = (pages, nav, options) => {
|
|
857
|
-
pages.forEach((page) => {
|
|
858
|
-
page.contents.forEach((content) => {
|
|
859
|
-
dynamicallyMapPageIdInHyperlinksToRelativePaths(content, nav, options);
|
|
860
|
-
});
|
|
861
|
-
});
|
|
862
|
-
};
|
|
863
|
-
const dynamicallyMapPageIdInHyperlinksToRelativePaths = (content, nav, options) => {
|
|
864
|
-
Object.keys(content).forEach((key) => {
|
|
865
|
-
const value = content[key];
|
|
866
|
-
if (value === undefined || value === null) {
|
|
867
|
-
return;
|
|
868
|
-
}
|
|
869
|
-
if (typeof value === 'object' && (key === 'items' || key === 'textItems')) {
|
|
870
|
-
if (Array.isArray(value)) {
|
|
871
|
-
value.forEach((item) => {
|
|
872
|
-
dynamicallyMapPageIdInHyperlinksToRelativePaths(item, nav, options);
|
|
873
|
-
});
|
|
874
|
-
}
|
|
875
|
-
else {
|
|
876
|
-
dynamicallyMapPageIdInHyperlinksToRelativePaths(value, nav, options);
|
|
877
|
-
}
|
|
878
|
-
}
|
|
879
|
-
else if (typeof value === 'string' && hasRTEContent(value)) {
|
|
880
|
-
content[key] = value.replace(/<a\s+([^>]*?)href="([^"]*?)"([^>]*?)>/gi, (match, existingAttrsStart, href, existingAttrsEnd) => {
|
|
881
|
-
// Only process internal links (no protocol, doesn't start with /)
|
|
882
|
-
if (href && !href.match(/^(https?:\/\/|\/)/) && isHrefPageId(href)) {
|
|
883
|
-
const pageId = getPageIdFromHref(href);
|
|
884
|
-
const route = nav.navItems.find((x) => x.pageId === pageId);
|
|
885
|
-
const brandPageSlugRoute = options.brandPageSlug
|
|
886
|
-
? `/${options.brandPageSlug}`
|
|
887
|
-
: '';
|
|
888
|
-
if (route) {
|
|
889
|
-
let href = `${brandPageSlugRoute}`;
|
|
890
|
-
if (!route.isRoot) {
|
|
891
|
-
href = `${brandPageSlugRoute}/${route.relativePath}`;
|
|
892
|
-
}
|
|
893
|
-
return `<a ${existingAttrsStart}href="${href}"${existingAttrsEnd}>`;
|
|
894
|
-
}
|
|
895
|
-
// fallback to root if pageid cannot be resolved.
|
|
896
|
-
return `<a ${existingAttrsStart}href="${brandPageSlugRoute}"${existingAttrsEnd}>`;
|
|
897
|
-
}
|
|
898
|
-
return match;
|
|
899
|
-
});
|
|
900
|
-
}
|
|
901
|
-
});
|
|
902
|
-
};
|
|
903
842
|
export const isLogoViewModel = (viewModel) => {
|
|
904
843
|
return viewModel.role === 'logo';
|
|
905
844
|
};
|
|
@@ -166,12 +166,9 @@ export interface NavItemRouteParams {
|
|
|
166
166
|
pageSlug?: string;
|
|
167
167
|
}
|
|
168
168
|
export interface NavItemViewModel {
|
|
169
|
-
pageId: string;
|
|
170
|
-
slug: string;
|
|
171
169
|
displayName: string;
|
|
172
170
|
routeName: string;
|
|
173
171
|
routeParams: NavItemRouteParams;
|
|
174
|
-
isRoot: boolean;
|
|
175
172
|
isHidden: boolean;
|
|
176
173
|
relativePath: string;
|
|
177
174
|
nestedNavItems: NavItemViewModel[];
|
|
@@ -931,9 +931,8 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
931
931
|
setPages({ pages }: {
|
|
932
932
|
pages: import("../../../shared/page-settings/models").ContentPage[];
|
|
933
933
|
}): void;
|
|
934
|
-
setNewPageModalVisibilityAsync({ isNewPageModalVisible,
|
|
934
|
+
setNewPageModalVisibilityAsync({ isNewPageModalVisible, }: {
|
|
935
935
|
isNewPageModalVisible: boolean;
|
|
936
|
-
parentPageId?: string | undefined;
|
|
937
936
|
}): Promise<void>;
|
|
938
937
|
addPage({ page }: {
|
|
939
938
|
page: import("../../../shared/page-settings/models").ContentPage;
|
package/lib/src/brand-page-maker/components/brand-page-maker/__fixtures__/brand-page-examples.js
CHANGED
|
@@ -2242,7 +2242,7 @@ export const BRAND_PAGE_PERSONALISED = {
|
|
|
2242
2242
|
type: 'banner-section',
|
|
2243
2243
|
title: 'Building the Future, One Project at a Time.',
|
|
2244
2244
|
imageUrl: 'https://bcassetcdn.com/shapes/prod/b2efecd4-f406-4b20-b9a6-f362fb0db749.svg',
|
|
2245
|
-
|
|
2245
|
+
pageSlug: '',
|
|
2246
2246
|
cardStyle: {
|
|
2247
2247
|
backgroundColor: 'rgb(255,255,255)',
|
|
2248
2248
|
},
|
package/lib/src/brand-page-maker/components/brandpage-maker-page/BrandPageMakerPage.mixin.d.ts
CHANGED
|
@@ -943,9 +943,8 @@ declare const _default: import("vue").DefineComponent<{}, {
|
|
|
943
943
|
setPages({ pages }: {
|
|
944
944
|
pages: import("../../../shared/page-settings/models").ContentPage[];
|
|
945
945
|
}): void;
|
|
946
|
-
setNewPageModalVisibilityAsync({ isNewPageModalVisible,
|
|
946
|
+
setNewPageModalVisibilityAsync({ isNewPageModalVisible, }: {
|
|
947
947
|
isNewPageModalVisible: boolean;
|
|
948
|
-
parentPageId?: string | undefined;
|
|
949
948
|
}): Promise<void>;
|
|
950
949
|
addPage({ page }: {
|
|
951
950
|
page: import("../../../shared/page-settings/models").ContentPage;
|
|
@@ -90,7 +90,6 @@ export default defineComponent({
|
|
|
90
90
|
customDomain: undefined,
|
|
91
91
|
brandPageType: this.viewModel.brandPageType,
|
|
92
92
|
pages: this.viewModel.pages,
|
|
93
|
-
nav: this.viewModel.nav,
|
|
94
93
|
isBrandPage: this.viewModel.brandPageType === BRAND_PAGE_TYPES.default,
|
|
95
94
|
isBrandPageOrIsBrandContact: this.viewModel.brandPageType === BRAND_PAGE_TYPES.default ||
|
|
96
95
|
this.viewModel.brandPageType === BRAND_PAGE_TYPES.brandContact,
|
|
@@ -106,7 +106,6 @@ export default defineComponent({
|
|
|
106
106
|
stripePublishableKey: undefined,
|
|
107
107
|
pageTitle: this.brandPageTitle,
|
|
108
108
|
pages: this.viewModel?.pages || [],
|
|
109
|
-
nav: this.viewModel?.nav || { navItems: [] },
|
|
110
109
|
currentPageSlug: this.viewModel?.pages[0]?.slug || '',
|
|
111
110
|
customDomain: undefined,
|
|
112
111
|
brandPageType: this.viewModel?.brandPageType || BRAND_PAGE_TYPES.default,
|
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
import type { Editor } from '@tiptap/vue-3';
|
|
2
|
-
export declare const isHrefPageId: (href: string) => boolean;
|
|
3
|
-
export declare const getPageIdFromHref: (href: string) => string;
|
|
4
|
-
export declare const getHrefForPage: (pageId: string) => string;
|
|
5
2
|
export declare const useHyperlink: (editor: Editor) => {
|
|
6
3
|
hyperlinkValue: import("vue").WritableComputedRef<{
|
|
7
4
|
id: string;
|
|
@@ -1,21 +1,6 @@
|
|
|
1
1
|
import { ref, computed } from 'vue';
|
|
2
2
|
// Store original colors before applying hyperlinks
|
|
3
3
|
const originalColors = new WeakMap();
|
|
4
|
-
export const isHrefPageId = (href) => {
|
|
5
|
-
if (!href)
|
|
6
|
-
return false;
|
|
7
|
-
return href.startsWith('pageid:');
|
|
8
|
-
};
|
|
9
|
-
export const getPageIdFromHref = (href) => {
|
|
10
|
-
if (!href)
|
|
11
|
-
return href;
|
|
12
|
-
return href.replace('pageid:', '');
|
|
13
|
-
};
|
|
14
|
-
export const getHrefForPage = (pageId) => {
|
|
15
|
-
if (!pageId)
|
|
16
|
-
return pageId;
|
|
17
|
-
return `pageid:${pageId}`;
|
|
18
|
-
};
|
|
19
4
|
export const useHyperlink = (editor) => {
|
|
20
5
|
const hyperlinkUrl = ref('');
|
|
21
6
|
const storeOriginalColor = () => {
|
|
@@ -24,7 +24,7 @@ import { useUiContentSettingsStore } from '../../../shared/content-settings/stor
|
|
|
24
24
|
import { AllSelection } from 'prosemirror-state';
|
|
25
25
|
import { MaxLength } from './extensions/MaxLength';
|
|
26
26
|
import { AutoLink } from './extensions/AutoLink';
|
|
27
|
-
import {
|
|
27
|
+
import { useHyperlink } from './hyperlink';
|
|
28
28
|
import { useBubbleMenu } from './bubbleMenu';
|
|
29
29
|
import { hasLogoColorVar, isLogoColor, getRTEColor, } from '../../utils/rich-text-editor.util';
|
|
30
30
|
import { useEventTracker, EVENTS } from '../useEventTracker';
|
|
@@ -62,7 +62,6 @@ export const useExternalRichTextEditor = () => {
|
|
|
62
62
|
target: isExternal ? '_blank' : null,
|
|
63
63
|
};
|
|
64
64
|
},
|
|
65
|
-
isAllowedUri: (url, ctx) => ctx.defaultValidate(url) || isHrefPageId(url),
|
|
66
65
|
}),
|
|
67
66
|
AutoLink,
|
|
68
67
|
],
|
|
@@ -116,7 +115,6 @@ export const useRichTextEditor = (model, props, emit, fontSettings, fontStyleDro
|
|
|
116
115
|
target: isExternal ? '_blank' : null,
|
|
117
116
|
};
|
|
118
117
|
},
|
|
119
|
-
isAllowedUri: (url, ctx) => ctx.defaultValidate(url) || isHrefPageId(url),
|
|
120
118
|
}),
|
|
121
119
|
AutoLink,
|
|
122
120
|
],
|
|
@@ -1960,7 +1960,7 @@ export const BANNER_SECTION_SETTINGS_CONFIG = () => ({
|
|
|
1960
1960
|
optionsConvertor: buttonLinkStyleConvertor,
|
|
1961
1961
|
visibilityAssessor: bannerLinkTypeVisibilityAssessor,
|
|
1962
1962
|
},
|
|
1963
|
-
|
|
1963
|
+
pageSlug: {
|
|
1964
1964
|
type: 'page-dropdown',
|
|
1965
1965
|
placeholder: contentSettingsTr(`selectAPagePlaceholder`),
|
|
1966
1966
|
groupId: SETTINGS_STYLE_FIELD_GROUP_IDS.settings,
|
|
@@ -2708,7 +2708,7 @@ export const BOOKING_SECTION_SETTINGS_CONFIG = () => ({
|
|
|
2708
2708
|
optionsConvertor: buttonLinkStyleConvertor,
|
|
2709
2709
|
visibilityAssessor: bannerLinkTypeVisibilityAssessor,
|
|
2710
2710
|
},
|
|
2711
|
-
|
|
2711
|
+
pageSlug: {
|
|
2712
2712
|
type: 'page-dropdown',
|
|
2713
2713
|
placeholder: contentSettingsTr(`selectAPagePlaceholder`),
|
|
2714
2714
|
groupId: SETTINGS_STYLE_FIELD_GROUP_IDS.settings,
|
|
@@ -468,7 +468,7 @@ export const createInitialBannerSectionContent = (options) => {
|
|
|
468
468
|
backgroundColor: DEFAULT_LOGO_BACKGROUND_COLOR_RGB,
|
|
469
469
|
},
|
|
470
470
|
backgroundStyle: {},
|
|
471
|
-
|
|
471
|
+
pageSlug: '',
|
|
472
472
|
buttonLinkType: BUTTON_LINK_TYPE.url,
|
|
473
473
|
buttonTextStyle: {
|
|
474
474
|
applyAutoScale: options?.brandPageType === BRAND_PAGE_TYPES.brandSite,
|
|
@@ -500,7 +500,7 @@ export const createInitialBookingSectionContent = (options) => {
|
|
|
500
500
|
textAlign: 'center',
|
|
501
501
|
},
|
|
502
502
|
backgroundStyle: {},
|
|
503
|
-
|
|
503
|
+
pageSlug: '',
|
|
504
504
|
buttonLinkType: BUTTON_LINK_TYPE.url,
|
|
505
505
|
buttonTextStyle: {
|
|
506
506
|
applyAutoScale: options?.brandPageType === BRAND_PAGE_TYPES.brandSite,
|
|
@@ -18,7 +18,7 @@ import { useUiContentSettingsStore } from '../../../shared/content-settings/stor
|
|
|
18
18
|
import { setContentSettingsAddContentOptions } from './brandpage-maker-store-utils';
|
|
19
19
|
import { useAdminLogoSettingsStore } from '../admin-logo-settings';
|
|
20
20
|
import { useUiPageSettingsStore } from '../../../shared/page-settings/store';
|
|
21
|
-
import { mapBrandPageContentToContentSettingsItem, removeContentFieldValues, removeLogoTemplateModel, } from '../../utils';
|
|
21
|
+
import { mapBrandPageContentToContentSettingsItem, removeContentFieldValues, removeLogoTemplateModel, validateContents, } from '../../utils';
|
|
22
22
|
import { UI_DEVICE_MODES, UI_SCREENSIZE_MODES, } from '../../../shared/models';
|
|
23
23
|
import { PAGE_SECTIONS } from '../../../shared/page-settings/models';
|
|
24
24
|
import { useUiTemplateSettingsStore } from '../../../shared/template-settings/store';
|
|
@@ -822,7 +822,9 @@ export const useBrandPageMakerStore = defineStore('brandPageMaker', {
|
|
|
822
822
|
const pageNavigationStore = usePageNavigationStore();
|
|
823
823
|
const pages = pageSettingsStore.pages.map((p) => ({
|
|
824
824
|
...p,
|
|
825
|
-
contents: p.contents
|
|
825
|
+
contents: p.contents
|
|
826
|
+
.map((c) => c.settings.content)
|
|
827
|
+
.map((content) => validateContents(content, pageSettingsStore.pages)),
|
|
826
828
|
}));
|
|
827
829
|
const backgroundStyles = backgroundSettingsStore.backgroundStyles;
|
|
828
830
|
const logoStyles = styleSettingsStore.logoStyles;
|
|
@@ -940,7 +942,7 @@ export const useBrandPageMakerStore = defineStore('brandPageMaker', {
|
|
|
940
942
|
getVideoUrls: videoStore.getVideoUrlsForToken,
|
|
941
943
|
getS3VideoUrls: videoStore.getOptimisedS3VideoUrlsForToken,
|
|
942
944
|
setVideoUrlsWithToken: videoStore.setVideoUrlsWithToken,
|
|
943
|
-
isCustomDomain:
|
|
945
|
+
isCustomDomain: brandPageContainerStore.isCustomDomainEnabled,
|
|
944
946
|
brandPageSlug: brandPageContainerStore.brandPageSlug,
|
|
945
947
|
});
|
|
946
948
|
}
|
|
@@ -955,7 +957,7 @@ export const useBrandPageMakerStore = defineStore('brandPageMaker', {
|
|
|
955
957
|
getVideoUrls: videoStore.getVideoUrlsForToken,
|
|
956
958
|
getS3VideoUrls: videoStore.getOptimisedS3VideoUrlsForToken,
|
|
957
959
|
setVideoUrlsWithToken: videoStore.setVideoUrlsWithToken,
|
|
958
|
-
isCustomDomain:
|
|
960
|
+
isCustomDomain: brandPageContainerStore.isCustomDomainEnabled,
|
|
959
961
|
brandPageSlug: brandPageContainerStore.brandPageSlug,
|
|
960
962
|
});
|
|
961
963
|
}
|
|
@@ -964,7 +966,7 @@ export const useBrandPageMakerStore = defineStore('brandPageMaker', {
|
|
|
964
966
|
getVideoUrls: videoStore.getVideoUrlsForToken,
|
|
965
967
|
getS3VideoUrls: videoStore.getOptimisedS3VideoUrlsForToken,
|
|
966
968
|
setVideoUrlsWithToken: videoStore.setVideoUrlsWithToken,
|
|
967
|
-
isCustomDomain:
|
|
969
|
+
isCustomDomain: brandPageContainerStore.isCustomDomainEnabled,
|
|
968
970
|
brandPageSlug: brandPageContainerStore.brandPageSlug,
|
|
969
971
|
});
|
|
970
972
|
},
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import type { ContentPage } from '../../shared/page-settings/models';
|
|
1
2
|
import type { Content } from '../../brand-page';
|
|
2
3
|
export declare const removeContentFieldValues: (content: Content) => Content;
|
|
3
4
|
export declare const removeLogoTemplateModel: (content: Content) => Content;
|
|
5
|
+
export declare const validateContents: (content: Content, pages: ContentPage[]) => Content;
|
|
6
|
+
export declare const validateBannerInternalPage: (content: Content, pages: ContentPage[]) => Content;
|
|
7
|
+
export declare const validateGeneralLinkInternalPage: (content: Content, pages: ContentPage[]) => Content;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { BUTTON_LINK_TYPE } from '../../brand-page';
|
|
1
2
|
import { ADMIN_DISALLOWED_FIELD_NAMES } from '../../shared/content-settings/constants';
|
|
2
3
|
import { isLogoContent } from '../../brand-page/utils';
|
|
3
4
|
export const removeContentFieldValues = (content) => {
|
|
@@ -22,3 +23,36 @@ export const removeLogoTemplateModel = (content) => {
|
|
|
22
23
|
delete newContent.logoTemplateImage;
|
|
23
24
|
return newContent;
|
|
24
25
|
};
|
|
26
|
+
export const validateContents = (content, pages) => {
|
|
27
|
+
validateBannerInternalPage(content, pages);
|
|
28
|
+
validateGeneralLinkInternalPage(content, pages);
|
|
29
|
+
return content;
|
|
30
|
+
};
|
|
31
|
+
export const validateBannerInternalPage = (content, pages) => {
|
|
32
|
+
if (content.type === 'banner-section') {
|
|
33
|
+
const bannerContent = content;
|
|
34
|
+
if (bannerContent.buttonLinkType === BUTTON_LINK_TYPE.page &&
|
|
35
|
+
bannerContent.pageSlug) {
|
|
36
|
+
const doesPageExist = pages.some((p) => p.slug === bannerContent.pageSlug);
|
|
37
|
+
if (!doesPageExist) {
|
|
38
|
+
bannerContent.pageSlug = '';
|
|
39
|
+
}
|
|
40
|
+
return bannerContent;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return content;
|
|
44
|
+
};
|
|
45
|
+
export const validateGeneralLinkInternalPage = (content, pages) => {
|
|
46
|
+
if (content.type === 'general-link') {
|
|
47
|
+
const generalLinkContent = content;
|
|
48
|
+
if (generalLinkContent.clickActionField === 'page' &&
|
|
49
|
+
generalLinkContent.page) {
|
|
50
|
+
const pageExist = pages.some((p) => p.slug === generalLinkContent.page);
|
|
51
|
+
if (!pageExist) {
|
|
52
|
+
generalLinkContent.page = '';
|
|
53
|
+
}
|
|
54
|
+
return generalLinkContent;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return content;
|
|
58
|
+
};
|
|
@@ -2,7 +2,6 @@ import { STYLE_THEME_KEYS, } from '../../brand-page';
|
|
|
2
2
|
import { ESCAPED_NEWLINE_CHARACTER } from '../../constants/ui';
|
|
3
3
|
import { getRenderText } from '../../brand-page/utils';
|
|
4
4
|
import createDomPurify, {} from 'dompurify';
|
|
5
|
-
import { isHrefPageId } from '../composables/rich-text-editor/hyperlink';
|
|
6
5
|
export const RTE_ALLOWED_SECTION_TYPES = [
|
|
7
6
|
'banner-section',
|
|
8
7
|
'text',
|
|
@@ -820,8 +819,7 @@ const validateAndSanitizeHref = (href) => {
|
|
|
820
819
|
// Allow relative paths, absolute paths, and safe protocols
|
|
821
820
|
if (trimmedHref.startsWith('/') ||
|
|
822
821
|
trimmedHref.startsWith('./') ||
|
|
823
|
-
trimmedHref.startsWith('../')
|
|
824
|
-
isHrefPageId(trimmedHref)) {
|
|
822
|
+
trimmedHref.startsWith('../')) {
|
|
825
823
|
return trimmedHref;
|
|
826
824
|
}
|
|
827
825
|
// Allow http and https URLs
|
|
@@ -896,7 +894,6 @@ export const sanitizeRTEHtml = (html, domPurify) => {
|
|
|
896
894
|
const sanitized = domPurify.sanitize(html, {
|
|
897
895
|
ALLOWED_TAGS: allowedTags,
|
|
898
896
|
ALLOWED_ATTR: allowedAttributes,
|
|
899
|
-
ALLOWED_URI_REGEXP: /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|pageid):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i,
|
|
900
897
|
FORBID_TAGS: forbiddenTags,
|
|
901
898
|
FORBID_ATTR: forbiddenAttributes,
|
|
902
899
|
KEEP_CONTENT: true,
|
|
@@ -55,8 +55,7 @@ export const urlValidator = (section) => {
|
|
|
55
55
|
};
|
|
56
56
|
};
|
|
57
57
|
export const pageValidator = (section) => {
|
|
58
|
-
if (section.buttonLinkType === BUTTON_LINK_TYPE.page &&
|
|
59
|
-
!section.buttonPageId) {
|
|
58
|
+
if (section.buttonLinkType === BUTTON_LINK_TYPE.page && !section.pageSlug) {
|
|
60
59
|
return {
|
|
61
60
|
message: MISSING_PAGE_SLUG_MESSAGE(),
|
|
62
61
|
isValid: false,
|