@designcrowd/library.brand-page 5.18.6 → 5.18.7-ast-padding-1
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-DlYq1LAT.js → CreatedOnBrandCrowd-de-de-Cn8zNuGM.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-en-us-BssRIQqn.js → CreatedOnBrandCrowd-en-us-CP8xAFc-.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-es-es-BGF9pptH.js → CreatedOnBrandCrowd-es-es-Ds8NijwP.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-fr-fr-Caupqu2Z.js → CreatedOnBrandCrowd-fr-ca-BiVV_7lj.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-fr-ca-Caupqu2Z.js → CreatedOnBrandCrowd-fr-fr-BiVV_7lj.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-pt-pt-s9q4uJ4u.js → CreatedOnBrandCrowd-pt-br-CjjrYojo.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-pt-br-s9q4uJ4u.js → CreatedOnBrandCrowd-pt-pt-CjjrYojo.js} +1 -1
- package/lib/src/{CreatedOnDcom-de-de-UnYnZbA7.js → CreatedOnDcom-de-de-ChR5jvlP.js} +1 -1
- package/lib/src/{CreatedOnDcom-en-us-rDv6H12L.js → CreatedOnDcom-en-us-C4rO1BMA.js} +1 -1
- package/lib/src/{CreatedOnDcom-es-es-DKPLaT6o.js → CreatedOnDcom-es-es-DxGMS6JK.js} +1 -1
- package/lib/src/{CreatedOnDcom-fr-ca-DAv34bG7.js → CreatedOnDcom-fr-ca-n31u4t7u.js} +1 -1
- package/lib/src/{CreatedOnDcom-fr-fr-DsOHnS8q.js → CreatedOnDcom-fr-fr-gwdsX7YV.js} +1 -1
- package/lib/src/{CreatedOnDcom-pt-br-DpjDBCLj.js → CreatedOnDcom-pt-br-iZjFp--s.js} +1 -1
- package/lib/src/{CreatedOnDcom-pt-pt-rFG0unf1.js → CreatedOnDcom-pt-pt-B3Z3-RLC.js} +1 -1
- package/lib/src/brand-page/components/contact-form/ContactForm.mixin.d.ts +4 -0
- package/lib/src/brand-page/components/contact-form/ContactForm.mixin.js +8 -4
- package/lib/src/brand-page/components/image-gallery/ImageGallery.mixin.d.ts +4 -0
- package/lib/src/brand-page/components/image-gallery/ImageGallery.mixin.js +4 -0
- package/lib/src/brand-page/components/mailing-list/MailingList.mixin.d.ts +4 -0
- package/lib/src/brand-page/components/mailing-list/MailingList.mixin.js +4 -1
- package/lib/src/brand-page/components/payment/request-payment/RequestPayment.mixin.d.ts +4 -0
- package/lib/src/brand-page/components/payment/request-payment/RequestPayment.mixin.js +4 -0
- package/lib/src/brand-page/components/payment/support-me/SupportMe.mixin.d.ts +4 -0
- package/lib/src/brand-page/components/payment/support-me/SupportMe.mixin.js +4 -1
- package/lib/src/brand-page/components/video/Video.mixin.d.ts +4 -0
- package/lib/src/brand-page/components/video/Video.mixin.js +4 -0
- package/lib/src/brand-page/constants/misc.constants.d.ts +26 -0
- package/lib/src/brand-page/constants/misc.constants.js +42 -0
- package/lib/src/brand-page/models/content.model.d.ts +2 -0
- package/lib/src/brand-page/utils/content-padding.util.d.ts +13 -0
- package/lib/src/brand-page/utils/content-padding.util.js +10 -0
- package/lib/src/brand-page/utils/index.d.ts +1 -0
- package/lib/src/brand-page/utils/index.js +1 -0
- package/lib/src/brand-page/utils/migration/migration-17.d.ts +2 -0
- package/lib/src/brand-page/utils/migration/migration-17.js +48 -0
- package/lib/src/brand-page/utils/migration.util.js +10 -0
- package/lib/src/brand-page-maker/components/action-bar/ActionBar.mixin.d.ts +7 -2
- package/lib/src/brand-page-maker/components/admin-logo-settings/AdminLogoSettings.mixin.d.ts +2 -0
- package/lib/src/brand-page-maker/components/brand-page-maker/BrandPageMaker.mixin.d.ts +19 -2
- package/lib/src/brand-page-maker/components/brand-page-maker/BrandPageMaker.mixin.js +8 -0
- package/lib/src/brand-page-maker/components/brand-page-maker/BrandPageMakerTemplateSettings.mixin.d.ts +7 -2
- package/lib/src/brand-page-maker/components/brand-page-maker/__fixtures__/brand-page-examples.js +1 -0
- package/lib/src/brand-page-maker/components/brandpage-maker-page/BrandPageMakerPage.mixin.d.ts +104 -2
- package/lib/src/brand-page-maker/components/brandpage-maker-page/BrandPageMakerPage.mixin.js +5 -0
- package/lib/src/brand-page-maker/components/brandpage-settings/ReplaceImageSettingsForBrandPageSettings.mixin.d.ts +7 -2
- package/lib/src/brand-page-maker/components/quick-link-bar/QuickLinkBar.mixin.d.ts +3 -0
- package/lib/src/brand-page-maker/components/quick-link-bar/QuickLinkBar.mixin.js +11 -0
- package/lib/src/brand-page-maker/components/seo-settings/SeoPageSettings.mixin.d.ts +7 -2
- package/lib/src/brand-page-maker/components/seo-settings/UrlSettings.mixin.d.ts +7 -2
- package/lib/src/brand-page-maker/components/social-share/SocialShare.mixin.d.ts +7 -2
- package/lib/src/brand-page-maker/components/template-preview/TemplatePreview.mixin.d.ts +7 -2
- package/lib/src/brand-page-maker/composables/ai-chat/useAiWebsiteBuilderChat.js +9 -0
- package/lib/src/brand-page-maker/composables/rich-text-editor/useRichTextEditor.js +21 -1
- package/lib/src/brand-page-maker/composables/useEventTracker.d.ts +20 -0
- package/lib/src/brand-page-maker/composables/useEventTracker.js +17 -0
- package/lib/src/brand-page-maker/composables/useUndoRedoFlag.d.ts +17 -0
- package/lib/src/brand-page-maker/composables/useUndoRedoFlag.js +25 -0
- package/lib/src/brand-page-maker/constants/config-settings-constant.js +38 -0
- package/lib/src/brand-page-maker/convertors/about-display-style.convertor.js +9 -1
- package/lib/src/brand-page-maker/convertors/banner-align-display-style.convertor.js +7 -1
- package/lib/src/brand-page-maker/convertors/contact-layout-style.convertor.js +6 -1
- package/lib/src/brand-page-maker/models/content-settings.js +36 -2
- package/lib/src/brand-page-maker/stores/ai-checkpoint/ai-checkpoint-store.d.ts +12 -0
- package/lib/src/brand-page-maker/stores/brandpage-maker/brandpage-maker-store.d.ts +41 -2
- package/lib/src/brand-page-maker/stores/brandpage-maker/brandpage-maker-store.js +307 -5
- package/lib/src/brand-page-maker/stores/history/history-store.d.ts +86 -0
- package/lib/src/brand-page-maker/stores/history/history-store.js +501 -0
- package/lib/src/brand-page-maker/stores/logo-store/logo-store.d.ts +1 -0
- package/lib/src/brand-page-maker/stores/user/user-store.js +1 -0
- package/lib/src/bundled-translations-BUyt4scr.js +175 -0
- package/lib/src/bundled-translations.de-DE-DEw_OVai.js +175 -0
- package/lib/src/bundled-translations.es-ES-CFKWmkgY.js +175 -0
- package/lib/src/bundled-translations.fr-CA-DCl5LJS4.js +175 -0
- package/lib/src/bundled-translations.fr-FR-B5BjgllA.js +175 -0
- package/lib/src/bundled-translations.pt-BR-5PWpMPuM.js +175 -0
- package/lib/src/bundled-translations.pt-PT-B9_wN0HR.js +175 -0
- package/lib/src/bundles/bundled-translations.de-DE.json +5 -1
- package/lib/src/bundles/bundled-translations.es-ES.json +5 -1
- package/lib/src/bundles/bundled-translations.fr-CA.json +5 -1
- package/lib/src/bundles/bundled-translations.fr-FR.json +5 -1
- package/lib/src/bundles/bundled-translations.json +5 -1
- package/lib/src/bundles/bundled-translations.pt-BR.json +5 -1
- package/lib/src/bundles/bundled-translations.pt-PT.json +5 -1
- package/lib/src/constants/ui.d.ts +1 -0
- package/lib/src/css/library.brand-page-brandCrowd.min.css +128 -131
- package/lib/src/css/library.brand-page-brandPage.min.css +128 -132
- package/lib/src/css/library.brand-page-designCom.min.css +128 -131
- package/lib/src/css/library.brand-page-preview.min.css +128 -131
- package/lib/src/index.mjs +1 -1
- package/lib/src/{lib-ngdDRkSL.js → lib-CIj_C38s.js} +36378 -35591
- package/lib/src/shared/content-settings/components/content-settings/ContentSettings.mixin.d.ts +104 -2
- package/lib/src/shared/content-settings/components/content-settings/ContentSettings.mixin.js +5 -0
- package/lib/src/shared/content-settings/components/content-settings/ContentSettings.stories.js +1 -0
- package/lib/src/shared/content-settings/components/content-settings/ReplaceImageSettingsForContent.mixin.d.ts +37 -2
- package/lib/src/shared/content-settings/components/content-settings-item/ContentSettingsItem.mixin.d.ts +28 -0
- package/lib/src/shared/content-settings/components/content-settings-item/ContentSettingsItemField.mixin.d.ts +19 -2
- package/lib/src/shared/content-settings/components/draggable-item-list/DraggableItemList.mixin.d.ts +3 -0
- package/lib/src/shared/content-settings/components/draggable-item-list/DraggableItemList.mixin.js +19 -2
- package/lib/src/shared/content-settings/components/focused-content-item-settings/FocusedContentItemSettings.mixin.d.ts +12 -0
- package/lib/src/shared/content-settings/components/form-fields-field/FormFieldsField.mixin.js +18 -8
- package/lib/src/shared/content-settings/components/payment-config-field/PaymentConfigField.mixin.d.ts +67 -0
- package/lib/src/shared/content-settings/components/payment-config-field/PaymentConfigField.mixin.js +6 -0
- package/lib/src/shared/content-settings/components/slider-field/SliderField.mixin.js +9 -0
- package/lib/src/shared/content-settings/store/content-settings-store.d.ts +12 -0
- package/lib/src/shared/logo-settings/components/EditLogoSettings.mixin.d.ts +19 -0
- package/lib/src/shared/logo-settings/components/EditLogoSettings.mixin.js +11 -0
- package/lib/src/shared/logo-settings/components/LogoSettings.mixin.d.ts +10 -2
- package/lib/src/shared/logo-settings/store/editable-logo-store.d.ts +5 -1
- package/lib/src/shared/logo-settings/store/editable-logo-store.js +31 -0
- package/lib/src/shared/page-settings/components/page-settings/PageSettings.mixin.d.ts +40 -2
- package/lib/src/shared/page-settings/components/page-settings-section-styles/PageSettingsSectionStyles.mixin.d.ts +24 -2
- package/lib/src/shared/publish-brand-page-with-state/PublishBrandPageModalWithState.mixin.d.ts +23 -2
- package/lib/src/shared/side-bar/components/SideBarTabButton.mixin.d.ts +16 -0
- package/lib/src/shared/style-settings/components/StyleSettings.mixin.d.ts +23 -2
- package/lib/src/shared/template-settings/components/TemplatesSettings.mixin.d.ts +16 -0
- package/lib/src/utils/minify-brand-page-metadata.js +11 -1
- package/package.json +1 -1
- package/src/brand-page/components/about-section/AboutSection.vue +10 -4
- package/src/brand-page/components/banner-section/BannerSection.vue +11 -4
- package/src/brand-page/components/booking-section/BookingSection.vue +11 -3
- package/src/brand-page/components/contact-form/ContactForm.mixin.ts +12 -6
- package/src/brand-page/components/contact-form/ContactForm.vue +105 -104
- package/src/brand-page/components/image-gallery/ImageGallery.mixin.ts +5 -0
- package/src/brand-page/components/image-gallery/ImageGallery.vue +1 -1
- package/src/brand-page/components/mailing-list/MailingList.mixin.ts +8 -1
- package/src/brand-page/components/mailing-list/MailingList.vue +1 -1
- package/src/brand-page/components/map/Map.vue +5 -1
- package/src/brand-page/components/payment/request-payment/RequestPayment.mixin.ts +5 -0
- package/src/brand-page/components/payment/request-payment/RequestPayment.vue +1 -0
- package/src/brand-page/components/payment/support-me/SupportMe.mixin.ts +8 -1
- package/src/brand-page/components/payment/support-me/SupportMe.vue +1 -0
- package/src/brand-page/components/shop/Shop.vue +7 -2
- package/src/brand-page/components/social-links/SocialLinks.vue +7 -3
- package/src/brand-page/components/text/Text.vue +12 -5
- package/src/brand-page/components/text-media-section/TextMediaSection.vue +11 -3
- package/src/brand-page/components/video/Video.mixin.ts +5 -0
- package/src/brand-page/components/video/Video.vue +1 -1
- package/src/brand-page/constants/misc.constants.ts +48 -0
- package/src/brand-page/models/content.model.ts +2 -0
- package/src/brand-page/utils/__snapshots__/migration.util.test.ts.snap +9 -3
- package/src/brand-page/utils/content-padding.util.test.ts +29 -0
- package/src/brand-page/utils/content-padding.util.ts +13 -0
- package/src/brand-page/utils/index.ts +1 -0
- package/src/brand-page/utils/migration/migration-17.ts +65 -0
- package/src/brand-page/utils/migration.util.test.ts +195 -0
- package/src/brand-page/utils/migration.util.ts +11 -0
- package/src/brand-page-maker/components/brand-page-maker/BrandPageMaker.mixin.ts +9 -0
- package/src/brand-page-maker/components/brand-page-maker/BrandPageMaker.vue +2 -3
- package/src/brand-page-maker/components/brand-page-maker/__fixtures__/brand-page-examples.ts +1 -0
- package/src/brand-page-maker/components/brandpage-maker-page/BrandPageMakerPage.mixin.ts +5 -0
- package/src/brand-page-maker/components/cookie-collection/CookieSettings.vue +18 -17
- package/src/brand-page-maker/components/quick-link-bar/QuickLinkBar.mixin.ts +13 -0
- package/src/brand-page-maker/components/quick-link-bar/QuickLinkBar.vue +26 -3
- package/src/brand-page-maker/components/quick-link-bar/RedoButton.vue +66 -0
- package/src/brand-page-maker/components/quick-link-bar/UndoButton.vue +66 -0
- package/src/brand-page-maker/components/quick-link-bar/i18n/quick-link-bar.de-DE.json +6 -4
- package/src/brand-page-maker/components/quick-link-bar/i18n/quick-link-bar.es-ES.json +6 -4
- package/src/brand-page-maker/components/quick-link-bar/i18n/quick-link-bar.fr-CA.json +6 -4
- package/src/brand-page-maker/components/quick-link-bar/i18n/quick-link-bar.fr-FR.json +6 -4
- package/src/brand-page-maker/components/quick-link-bar/i18n/quick-link-bar.json +3 -1
- package/src/brand-page-maker/components/quick-link-bar/i18n/quick-link-bar.pt-BR.json +6 -4
- package/src/brand-page-maker/components/quick-link-bar/i18n/quick-link-bar.pt-PT.json +6 -4
- package/src/brand-page-maker/components/quick-link-bar/undo-redo-buttons.test.ts +116 -0
- package/src/brand-page-maker/components/save-contact/SaveContact.vue +12 -19
- package/src/brand-page-maker/composables/ai-chat/useAiWebsiteBuilderChat.ts +10 -0
- package/src/brand-page-maker/composables/rich-text-editor/useRichTextEditor.ts +28 -1
- package/src/brand-page-maker/composables/useEventTracker.ts +29 -0
- package/src/brand-page-maker/composables/useUndoRedoFlag.ts +30 -0
- package/src/brand-page-maker/constants/config-settings-constant.ts +44 -0
- package/src/brand-page-maker/convertors/about-display-style.convertor.ts +10 -0
- package/src/brand-page-maker/convertors/banner-align-display-style.convertor.ts +8 -0
- package/src/brand-page-maker/convertors/contact-layout-style.convertor.test.ts +50 -0
- package/src/brand-page-maker/convertors/contact-layout-style.convertor.ts +8 -0
- package/src/brand-page-maker/models/content-settings.ts +38 -2
- package/src/brand-page-maker/stores/brandpage-maker/brandpage-maker-store.test.ts +334 -0
- package/src/brand-page-maker/stores/brandpage-maker/brandpage-maker-store.ts +371 -4
- package/src/brand-page-maker/stores/history/history-store.test.ts +1120 -0
- package/src/brand-page-maker/stores/history/history-store.ts +666 -0
- package/src/brand-page-maker/stores/logo-store/logo-store.ts +5 -0
- package/src/brand-page-maker/stores/user/user-store.ts +1 -0
- package/src/bundles/bundled-translations.de-DE.json +5 -1
- package/src/bundles/bundled-translations.es-ES.json +5 -1
- package/src/bundles/bundled-translations.fr-CA.json +5 -1
- package/src/bundles/bundled-translations.fr-FR.json +5 -1
- package/src/bundles/bundled-translations.json +5 -1
- package/src/bundles/bundled-translations.pt-BR.json +5 -1
- package/src/bundles/bundled-translations.pt-PT.json +5 -1
- package/src/constants/ui.ts +1 -0
- package/src/shared/content-settings/components/content-settings/ContentSettings.mixin.ts +5 -0
- package/src/shared/content-settings/components/content-settings/ContentSettings.stories.ts +1 -0
- package/src/shared/content-settings/components/content-settings/i18n/content-settings.de-DE.json +2 -0
- package/src/shared/content-settings/components/content-settings/i18n/content-settings.es-ES.json +2 -0
- package/src/shared/content-settings/components/content-settings/i18n/content-settings.fr-CA.json +2 -0
- package/src/shared/content-settings/components/content-settings/i18n/content-settings.fr-FR.json +2 -0
- package/src/shared/content-settings/components/content-settings/i18n/content-settings.json +2 -0
- package/src/shared/content-settings/components/content-settings/i18n/content-settings.pt-BR.json +2 -0
- package/src/shared/content-settings/components/content-settings/i18n/content-settings.pt-PT.json +2 -0
- package/src/shared/content-settings/components/content-settings-item/ContentSettingsItem.vue +1 -1
- package/src/shared/content-settings/components/draggable-item-list/DraggableItemList.mixin.ts +19 -2
- package/src/shared/content-settings/components/draggable-item-list/DraggableItemList.vue +1 -1
- package/src/shared/content-settings/components/focused-content-item-settings/FocusedContentItemSettings.vue +2 -2
- package/src/shared/content-settings/components/form-fields-field/FormFieldsField.mixin.ts +26 -10
- package/src/shared/content-settings/components/logo-selection-field/LogoSelection.vue +63 -48
- package/src/shared/content-settings/components/page-dropdown-field/PageDropdownField.vue +4 -0
- package/src/shared/content-settings/components/payment-config-field/PaymentConfigField.mixin.ts +7 -0
- package/src/shared/content-settings/components/slider-field/SliderField.mixin.ts +9 -0
- package/src/shared/content-settings/components/text-field/TextField.vue +1 -0
- package/src/shared/content-settings/components/text-image-field/TextImageField.vue +33 -4
- package/src/shared/logo-settings/components/EditLogoSettings.mixin.ts +11 -0
- package/src/shared/logo-settings/store/editable-logo-store.ts +42 -1
- package/src/utils/minify-brand-page-metadata.ts +11 -1
- package/lib/src/bundled-translations-B5Fkt3qd.js +0 -175
- package/lib/src/bundled-translations.de-DE-DpdVePM9.js +0 -175
- package/lib/src/bundled-translations.es-ES-BsIcrzZF.js +0 -175
- package/lib/src/bundled-translations.fr-CA-G1XCp2Qh.js +0 -175
- package/lib/src/bundled-translations.fr-FR-BdwLXOnB.js +0 -175
- package/lib/src/bundled-translations.pt-BR-Bvn5ePe7.js +0 -175
- package/lib/src/bundled-translations.pt-PT-CDtkb2k1.js +0 -175
|
@@ -44,6 +44,13 @@ import { useUiBackgroundSettingsStore } from '@shared/background-settings/store'
|
|
|
44
44
|
import { useBrandPageMakerUserStore } from '../user';
|
|
45
45
|
import { useBrandPageContainerStore } from '../brandpage-container';
|
|
46
46
|
import { useUiTemplateSettingsStore } from '@shared/template-settings/store';
|
|
47
|
+
import {
|
|
48
|
+
CONTENT_SETTINGS_MODES,
|
|
49
|
+
useUiContentSettingsStore,
|
|
50
|
+
} from '@shared/content-settings/store';
|
|
51
|
+
import { useUiSideBarStore } from '@shared/side-bar/store';
|
|
52
|
+
import { useUiEditableLogoStore } from '@shared/logo-settings/store/editable-logo-store';
|
|
53
|
+
import { SIDE_BAR_TAB_NAMES } from '@brand-page-maker/constants';
|
|
47
54
|
import { PAGE_SECTIONS } from '@shared/page-settings/models';
|
|
48
55
|
import { FabricRenderClient } from '../../../clients/fabric-render-client';
|
|
49
56
|
import { setLocaleAsync } from '@src/composables/useTranslate';
|
|
@@ -603,4 +610,331 @@ describe('brand page maker store module', () => {
|
|
|
603
610
|
// Assert
|
|
604
611
|
expect(setDesignTemplateTokenSpy).not.toHaveBeenCalled();
|
|
605
612
|
});
|
|
613
|
+
|
|
614
|
+
// BP-5506 regression: applyHistorySnapshot must replace nested navigation
|
|
615
|
+
// style refs as a whole, not deep-merge them. The previous bug was that
|
|
616
|
+
// object-form $patch would leave keys present in the live state but absent
|
|
617
|
+
// from the snapshot in place — e.g. switching nav button styles then
|
|
618
|
+
// undoing would leave the new style's borderColor / borderRadius applied.
|
|
619
|
+
test('applyHistorySnapshot replaces navigation styles wholesale (no key bleed across undo)', async () => {
|
|
620
|
+
// Arrange — initialise the maker so `applyHistorySnapshot` has a
|
|
621
|
+
// populated set of dependent stores to write into.
|
|
622
|
+
const makerStore = useBrandPageMakerStore();
|
|
623
|
+
const navigationStyleSettingsStore = useUiNavigationStyleSettingsStore();
|
|
624
|
+
|
|
625
|
+
await makerStore.initialise(INITIALISE_PAYLOAD);
|
|
626
|
+
|
|
627
|
+
// Build snapshot A — the "older" state we'll undo back to. Keep the
|
|
628
|
+
// navigation simple: only borderRadius is set on selectedButtonStyle.
|
|
629
|
+
const snapshotA = {
|
|
630
|
+
...makerStore.brandPageData,
|
|
631
|
+
pageHeaderDesktop: {
|
|
632
|
+
...makerStore.brandPageData.pageHeaderDesktop,
|
|
633
|
+
navigation: {
|
|
634
|
+
...makerStore.brandPageData.pageHeaderDesktop?.navigation,
|
|
635
|
+
selectedButtonStyle: {
|
|
636
|
+
borderRadius: '0px',
|
|
637
|
+
},
|
|
638
|
+
},
|
|
639
|
+
},
|
|
640
|
+
} as BrandPageModel;
|
|
641
|
+
|
|
642
|
+
// Build snapshot B — the "newer" state with extra keys that the
|
|
643
|
+
// older snapshot does NOT have. If $patch deep-merged, these would
|
|
644
|
+
// survive an undo back to A.
|
|
645
|
+
const snapshotB = {
|
|
646
|
+
...snapshotA,
|
|
647
|
+
pageHeaderDesktop: {
|
|
648
|
+
...snapshotA.pageHeaderDesktop,
|
|
649
|
+
navigation: {
|
|
650
|
+
...snapshotA.pageHeaderDesktop?.navigation,
|
|
651
|
+
selectedButtonStyle: {
|
|
652
|
+
borderRadius: '12px',
|
|
653
|
+
borderColor: 'rgb(255, 0, 0)',
|
|
654
|
+
borderStyle: 'dashed',
|
|
655
|
+
borderWidth: '4px',
|
|
656
|
+
},
|
|
657
|
+
},
|
|
658
|
+
},
|
|
659
|
+
} as BrandPageModel;
|
|
660
|
+
|
|
661
|
+
// Act — apply newer first (simulates the user making the edit), then
|
|
662
|
+
// older (simulates the undo). NavigationDesktop's constructor folds
|
|
663
|
+
// its input over a defaults object, so we read the resulting state
|
|
664
|
+
// and assert against the keys that came from snapshotB but NOT from
|
|
665
|
+
// snapshotA.
|
|
666
|
+
await makerStore.applyHistorySnapshot(snapshotB);
|
|
667
|
+
await makerStore.applyHistorySnapshot(snapshotA);
|
|
668
|
+
|
|
669
|
+
// Assert — after the undo, no keys from B should bleed through onto
|
|
670
|
+
// A's selectedButtonStyle. Specifically the values that are unique to
|
|
671
|
+
// B (red dashed border) must not be present.
|
|
672
|
+
const restored =
|
|
673
|
+
navigationStyleSettingsStore.navigation[PAGE_SECTIONS.header][
|
|
674
|
+
VIEWPORTS.desktop
|
|
675
|
+
];
|
|
676
|
+
const restoredSelected = restored.selectedButtonStyle;
|
|
677
|
+
|
|
678
|
+
expect(restoredSelected.borderRadius).toBe('0px');
|
|
679
|
+
// The B-only values must not survive the undo. NavigationStyles'
|
|
680
|
+
// constructor seeds defaults for selectedButtonStyle, so we assert
|
|
681
|
+
// the *exact* B-only values are gone rather than a strict superset.
|
|
682
|
+
expect(restoredSelected.borderColor).not.toBe('rgb(255, 0, 0)');
|
|
683
|
+
expect(restoredSelected.borderStyle).not.toBe('dashed');
|
|
684
|
+
expect(restoredSelected.borderWidth).not.toBe('4px');
|
|
685
|
+
});
|
|
686
|
+
|
|
687
|
+
// BP-5506 regression: undoing a page-add must clear the URL/active-page
|
|
688
|
+
// back to a page that exists in the restored snapshot. The page-tabs
|
|
689
|
+
// carousel keys "selected" off the route URL; after `setNav` removes the
|
|
690
|
+
// added route, no nav item matches the URL slug and the highlight
|
|
691
|
+
// disappears. `applyHistorySnapshot` accepts an `activePageId` and writes
|
|
692
|
+
// it through `pageNavigationStore.setCurrentActivePage` so the routeStore
|
|
693
|
+
// and `currentPage` getter realign.
|
|
694
|
+
test('applyHistorySnapshot updates pageNavigation.activePageId when given a valid id', async () => {
|
|
695
|
+
const makerStore = useBrandPageMakerStore();
|
|
696
|
+
const pageNavigationStore = usePageNavigationStore();
|
|
697
|
+
|
|
698
|
+
await makerStore.initialise(INITIALISE_PAYLOAD);
|
|
699
|
+
|
|
700
|
+
const restoredPageId = pageNavigationStore.routes[0]?.pageId;
|
|
701
|
+
|
|
702
|
+
expect(restoredPageId).toBeDefined();
|
|
703
|
+
|
|
704
|
+
pageNavigationStore.activePageId = '';
|
|
705
|
+
|
|
706
|
+
await makerStore.applyHistorySnapshot(
|
|
707
|
+
makerStore.brandPageData,
|
|
708
|
+
restoredPageId,
|
|
709
|
+
);
|
|
710
|
+
|
|
711
|
+
expect(pageNavigationStore.activePageId).toBe(restoredPageId);
|
|
712
|
+
});
|
|
713
|
+
|
|
714
|
+
test('applyHistorySnapshot falls back to first/default route when no activePageId is provided', async () => {
|
|
715
|
+
const makerStore = useBrandPageMakerStore();
|
|
716
|
+
const pageNavigationStore = usePageNavigationStore();
|
|
717
|
+
|
|
718
|
+
await makerStore.initialise(INITIALISE_PAYLOAD);
|
|
719
|
+
|
|
720
|
+
const expectedFirstId =
|
|
721
|
+
pageNavigationStore.getFirstOrDefaultRoute()?.pageId;
|
|
722
|
+
|
|
723
|
+
expect(expectedFirstId).toBeDefined();
|
|
724
|
+
|
|
725
|
+
pageNavigationStore.activePageId = 'stale-page-id-not-in-nav';
|
|
726
|
+
|
|
727
|
+
await makerStore.applyHistorySnapshot(makerStore.brandPageData);
|
|
728
|
+
|
|
729
|
+
expect(pageNavigationStore.activePageId).toBe(expectedFirstId);
|
|
730
|
+
});
|
|
731
|
+
|
|
732
|
+
// BP-5506 follow-up: undoing a non-page-structural edit (e.g. a title
|
|
733
|
+
// change) must NOT push a new route. The router push fires
|
|
734
|
+
// `router.afterEach`, and BrandPageMaker.mixin's afterEach hook resets
|
|
735
|
+
// the content-settings modeStack — which would snap the sidebar back
|
|
736
|
+
// to the default Content tab on every undo, even when the user was
|
|
737
|
+
// deep-editing a content item. Same-page navigation MUST be skipped.
|
|
738
|
+
test('applyHistorySnapshot does NOT touch modeStack when active page is unchanged', async () => {
|
|
739
|
+
const makerStore = useBrandPageMakerStore();
|
|
740
|
+
const pageNavigationStore = usePageNavigationStore();
|
|
741
|
+
const contentSettingsStore = useUiContentSettingsStore();
|
|
742
|
+
|
|
743
|
+
await makerStore.initialise(INITIALISE_PAYLOAD);
|
|
744
|
+
|
|
745
|
+
const activePageId = pageNavigationStore.routes[0]?.pageId;
|
|
746
|
+
|
|
747
|
+
expect(activePageId).toBeDefined();
|
|
748
|
+
|
|
749
|
+
pageNavigationStore.activePageId = activePageId!;
|
|
750
|
+
|
|
751
|
+
// User is deep-editing a content item — focused mode pushed onto the stack.
|
|
752
|
+
const realItemId = contentSettingsStore.items[0]?.id;
|
|
753
|
+
|
|
754
|
+
expect(realItemId).toBeDefined();
|
|
755
|
+
|
|
756
|
+
contentSettingsStore.pushMode({
|
|
757
|
+
mode: CONTENT_SETTINGS_MODES.focusedContentItem,
|
|
758
|
+
selectedItemId: realItemId,
|
|
759
|
+
});
|
|
760
|
+
contentSettingsStore.selectedItemId = realItemId;
|
|
761
|
+
|
|
762
|
+
expect(contentSettingsStore.mode).toBe(
|
|
763
|
+
CONTENT_SETTINGS_MODES.focusedContentItem,
|
|
764
|
+
);
|
|
765
|
+
|
|
766
|
+
// Apply a snapshot whose activePageId equals the current page (i.e.
|
|
767
|
+
// a non-structural edit that didn't change pages — title edit, color
|
|
768
|
+
// change, etc.).
|
|
769
|
+
await makerStore.applyHistorySnapshot(
|
|
770
|
+
makerStore.brandPageData,
|
|
771
|
+
activePageId,
|
|
772
|
+
);
|
|
773
|
+
|
|
774
|
+
// Mode stack is preserved — no router.afterEach was triggered.
|
|
775
|
+
expect(contentSettingsStore.mode).toBe(
|
|
776
|
+
CONTENT_SETTINGS_MODES.focusedContentItem,
|
|
777
|
+
);
|
|
778
|
+
expect(contentSettingsStore.selectedItemId).toBe(realItemId);
|
|
779
|
+
});
|
|
780
|
+
|
|
781
|
+
// BP-5506 regression: when undoing a content add, the selected item
|
|
782
|
+
// disappears. The fallback must restore the Content tab's natural
|
|
783
|
+
// landing state (mode = edit, selectedItemId = null), not just switch
|
|
784
|
+
// tabs — otherwise `<FocusedContentItemSettings>` keeps rendering for
|
|
785
|
+
// a missing item and paints a blank panel.
|
|
786
|
+
test('applyHistorySnapshot resets sidebar to default Content tab when selected item is gone', async () => {
|
|
787
|
+
const makerStore = useBrandPageMakerStore();
|
|
788
|
+
const contentSettingsStore = useUiContentSettingsStore();
|
|
789
|
+
const sideBarStore = useUiSideBarStore();
|
|
790
|
+
|
|
791
|
+
await makerStore.initialise(INITIALISE_PAYLOAD);
|
|
792
|
+
|
|
793
|
+
// Simulate the user opening a content item's focused settings.
|
|
794
|
+
const orphanItemId = 'orphan-content-id-not-in-snapshot';
|
|
795
|
+
|
|
796
|
+
contentSettingsStore.pushMode({
|
|
797
|
+
mode: CONTENT_SETTINGS_MODES.focusedContentItem,
|
|
798
|
+
selectedItemId: orphanItemId,
|
|
799
|
+
});
|
|
800
|
+
contentSettingsStore.selectedItemId = orphanItemId;
|
|
801
|
+
sideBarStore.setSelectedTabName({
|
|
802
|
+
tabName: SIDE_BAR_TAB_NAMES.CONTENT_SETTINGS,
|
|
803
|
+
});
|
|
804
|
+
|
|
805
|
+
// Pre-condition: panel is showing the focused content item.
|
|
806
|
+
expect(contentSettingsStore.mode).toBe(
|
|
807
|
+
CONTENT_SETTINGS_MODES.focusedContentItem,
|
|
808
|
+
);
|
|
809
|
+
expect(contentSettingsStore.selectedItemId).toBe(orphanItemId);
|
|
810
|
+
|
|
811
|
+
// Snapshot does NOT contain orphanItemId — simulates undo of an add.
|
|
812
|
+
await makerStore.applyHistorySnapshot(makerStore.brandPageData);
|
|
813
|
+
|
|
814
|
+
// Post-condition: same shape as a fresh Content tab click.
|
|
815
|
+
expect(contentSettingsStore.mode).toBe(CONTENT_SETTINGS_MODES.edit);
|
|
816
|
+
expect(contentSettingsStore.selectedItemId).toBeNull();
|
|
817
|
+
expect(sideBarStore.selectedTabName).toBe(
|
|
818
|
+
SIDE_BAR_TAB_NAMES.CONTENT_SETTINGS,
|
|
819
|
+
);
|
|
820
|
+
});
|
|
821
|
+
|
|
822
|
+
// BP-5506 follow-up: applyHistorySnapshot accepts a `logoEdits` JSON
|
|
823
|
+
// string (sidecar to brandPageData; pre-purchase logo-tab form-field
|
|
824
|
+
// state). On undo it must wholesale-replace `editableLogoStore.logoEdits`
|
|
825
|
+
// so the form fields reflect the pre-edit state. Wholesale replacement
|
|
826
|
+
// matters because a previous entry's textObjects/colors must NOT leak
|
|
827
|
+
// through (e.g. switching template A→B then undoing must NOT keep B's
|
|
828
|
+
// textObject ids in A's restored state).
|
|
829
|
+
test('applyHistorySnapshot restores editableLogoStore.logoEdits from sidecar', async () => {
|
|
830
|
+
const makerStore = useBrandPageMakerStore();
|
|
831
|
+
const editableLogoStore = useUiEditableLogoStore();
|
|
832
|
+
|
|
833
|
+
await makerStore.initialise(INITIALISE_PAYLOAD);
|
|
834
|
+
|
|
835
|
+
// User has typed "AcmeCo" — current logoEdits state.
|
|
836
|
+
editableLogoStore.logoEdits.textObjects = [
|
|
837
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
838
|
+
{
|
|
839
|
+
id: 't1',
|
|
840
|
+
role: 'primary-text',
|
|
841
|
+
text: 'AcmeCo',
|
|
842
|
+
textEnabled: true,
|
|
843
|
+
} as any,
|
|
844
|
+
];
|
|
845
|
+
|
|
846
|
+
// The history entry the user is undoing TO captured "Acme".
|
|
847
|
+
const sidecar = JSON.stringify({
|
|
848
|
+
backgroundObject: { id: 'bg', type: 'rect', role: 'background' },
|
|
849
|
+
logoObject: {
|
|
850
|
+
id: 'lg',
|
|
851
|
+
type: 'group',
|
|
852
|
+
role: 'logo',
|
|
853
|
+
logoColors: [],
|
|
854
|
+
logoStrokeColors: [],
|
|
855
|
+
},
|
|
856
|
+
textObjects: [
|
|
857
|
+
{ id: 't1', role: 'primary-text', text: 'Acme', textEnabled: true },
|
|
858
|
+
],
|
|
859
|
+
});
|
|
860
|
+
|
|
861
|
+
await makerStore.applyHistorySnapshot(
|
|
862
|
+
makerStore.brandPageData,
|
|
863
|
+
undefined,
|
|
864
|
+
sidecar,
|
|
865
|
+
);
|
|
866
|
+
|
|
867
|
+
expect(editableLogoStore.logoEdits.textObjects).toEqual([
|
|
868
|
+
{ id: 't1', role: 'primary-text', text: 'Acme', textEnabled: true },
|
|
869
|
+
]);
|
|
870
|
+
});
|
|
871
|
+
|
|
872
|
+
test('applyHistorySnapshot wholesale-replaces logoEdits (no leak from prior state)', async () => {
|
|
873
|
+
const makerStore = useBrandPageMakerStore();
|
|
874
|
+
const editableLogoStore = useUiEditableLogoStore();
|
|
875
|
+
|
|
876
|
+
await makerStore.initialise(INITIALISE_PAYLOAD);
|
|
877
|
+
|
|
878
|
+
// Current state has TWO textObjects (e.g. user is on template B with a
|
|
879
|
+
// logo + tagline).
|
|
880
|
+
editableLogoStore.logoEdits.textObjects = [
|
|
881
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
882
|
+
{
|
|
883
|
+
id: 'b-1',
|
|
884
|
+
role: 'primary-text',
|
|
885
|
+
text: 'Brand B',
|
|
886
|
+
textEnabled: true,
|
|
887
|
+
} as any,
|
|
888
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
889
|
+
{ id: 'b-2', role: 'tagline', text: 'tagline', textEnabled: true } as any,
|
|
890
|
+
];
|
|
891
|
+
|
|
892
|
+
// Undo target captured template A — only ONE textObject with a
|
|
893
|
+
// different id. After restore, b-1 / b-2 must be gone.
|
|
894
|
+
const sidecar = JSON.stringify({
|
|
895
|
+
backgroundObject: { id: 'bg', type: 'rect', role: 'background' },
|
|
896
|
+
logoObject: {
|
|
897
|
+
id: 'lg',
|
|
898
|
+
type: 'group',
|
|
899
|
+
role: 'logo',
|
|
900
|
+
logoColors: [],
|
|
901
|
+
logoStrokeColors: [],
|
|
902
|
+
},
|
|
903
|
+
textObjects: [
|
|
904
|
+
{ id: 'a-1', role: 'primary-text', text: 'Brand A', textEnabled: true },
|
|
905
|
+
],
|
|
906
|
+
});
|
|
907
|
+
|
|
908
|
+
await makerStore.applyHistorySnapshot(
|
|
909
|
+
makerStore.brandPageData,
|
|
910
|
+
undefined,
|
|
911
|
+
sidecar,
|
|
912
|
+
);
|
|
913
|
+
|
|
914
|
+
expect(editableLogoStore.logoEdits.textObjects).toHaveLength(1);
|
|
915
|
+
expect(editableLogoStore.logoEdits.textObjects[0].id).toBe('a-1');
|
|
916
|
+
});
|
|
917
|
+
|
|
918
|
+
test('applyHistorySnapshot leaves logoEdits untouched when sidecar is undefined', async () => {
|
|
919
|
+
const makerStore = useBrandPageMakerStore();
|
|
920
|
+
const editableLogoStore = useUiEditableLogoStore();
|
|
921
|
+
|
|
922
|
+
await makerStore.initialise(INITIALISE_PAYLOAD);
|
|
923
|
+
|
|
924
|
+
editableLogoStore.logoEdits.textObjects = [
|
|
925
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
926
|
+
{
|
|
927
|
+
id: 't1',
|
|
928
|
+
role: 'primary-text',
|
|
929
|
+
text: 'Acme',
|
|
930
|
+
textEnabled: true,
|
|
931
|
+
} as any,
|
|
932
|
+
];
|
|
933
|
+
|
|
934
|
+
// No third arg — pre-existing entries from before this feature shipped.
|
|
935
|
+
await makerStore.applyHistorySnapshot(makerStore.brandPageData);
|
|
936
|
+
|
|
937
|
+
// Still 'Acme' — no restore attempted.
|
|
938
|
+
expect(editableLogoStore.logoEdits.textObjects[0].text).toBe('Acme');
|
|
939
|
+
});
|
|
606
940
|
});
|