@designcrowd/library.brand-page 5.18.4 → 5.18.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/src/{CreatedOnBrandCrowd-de-de-DQLtpdLe.js → CreatedOnBrandCrowd-de-de-ciKpCAd9.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-en-us-CvEhlADd.js → CreatedOnBrandCrowd-en-us-CZbTS1AZ.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-es-es-pYQeTTC0.js → CreatedOnBrandCrowd-es-es-C8MExng5.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-fr-fr-CcE-iCEq.js → CreatedOnBrandCrowd-fr-ca-CO0L9NK2.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-fr-ca-CcE-iCEq.js → CreatedOnBrandCrowd-fr-fr-CO0L9NK2.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-pt-pt-OyhWWWyO.js → CreatedOnBrandCrowd-pt-br-zVDvBF2H.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-pt-br-OyhWWWyO.js → CreatedOnBrandCrowd-pt-pt-zVDvBF2H.js} +1 -1
- package/lib/src/{CreatedOnDcom-de-de-DH98FFLS.js → CreatedOnDcom-de-de-WrUSQdjf.js} +1 -1
- package/lib/src/{CreatedOnDcom-en-us-DK67NN1r.js → CreatedOnDcom-en-us-BqC9YtkL.js} +1 -1
- package/lib/src/{CreatedOnDcom-es-es-9-QU4BU6.js → CreatedOnDcom-es-es-BzH32Oya.js} +1 -1
- package/lib/src/{CreatedOnDcom-fr-ca-U9J9H9VB.js → CreatedOnDcom-fr-ca-D7TYfCW0.js} +1 -1
- package/lib/src/{CreatedOnDcom-fr-fr-DqdzB1DJ.js → CreatedOnDcom-fr-fr-DVlyfBtb.js} +1 -1
- package/lib/src/{CreatedOnDcom-pt-br-c4UiWtkB.js → CreatedOnDcom-pt-br-CSRB91ey.js} +1 -1
- package/lib/src/{CreatedOnDcom-pt-pt-Do2qJsYp.js → CreatedOnDcom-pt-pt-9KMj5gpc.js} +1 -1
- package/lib/src/brand-page/models/navigation-styles.model.d.ts +7 -0
- package/lib/src/brand-page/models/navigation-styles.model.js +25 -2
- package/lib/src/brand-page/utils/migration/migration-16.d.ts +2 -0
- package/lib/src/brand-page/utils/migration/migration-16.js +47 -0
- package/lib/src/brand-page/utils/migration.util.js +7 -0
- package/lib/src/brand-page-maker/components/action-bar/ActionBar.mixin.d.ts +7 -2
- package/lib/src/brand-page-maker/components/brand-page-maker/BrandPageMaker.mixin.d.ts +7 -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 +87 -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 +20 -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/stores/brandpage-maker/brandpage-maker-store.d.ts +41 -2
- package/lib/src/brand-page-maker/stores/brandpage-maker/brandpage-maker-store.js +308 -14
- package/lib/src/brand-page-maker/stores/history/history-store.d.ts +83 -0
- package/lib/src/brand-page-maker/stores/history/history-store.js +495 -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-D1q3rSEz.js +175 -0
- package/lib/src/bundled-translations.de-DE-BxqLLwbh.js +175 -0
- package/lib/src/bundled-translations.es-ES-uh249NlJ.js +175 -0
- package/lib/src/bundled-translations.fr-CA-BEQmv2fX.js +175 -0
- package/lib/src/bundled-translations.fr-FR-BnNuCojH.js +175 -0
- package/lib/src/bundled-translations.pt-BR-CJUOxVlq.js +175 -0
- package/lib/src/bundled-translations.pt-PT-Ds9cMEqK.js +175 -0
- package/lib/src/bundles/bundled-translations.de-DE.json +3 -1
- package/lib/src/bundles/bundled-translations.es-ES.json +3 -1
- package/lib/src/bundles/bundled-translations.fr-CA.json +3 -1
- package/lib/src/bundles/bundled-translations.fr-FR.json +3 -1
- package/lib/src/bundles/bundled-translations.json +3 -1
- package/lib/src/bundles/bundled-translations.pt-BR.json +3 -1
- package/lib/src/bundles/bundled-translations.pt-PT.json +3 -1
- package/lib/src/constants/ui.d.ts +1 -0
- package/lib/src/css/library.brand-page-brandCrowd.min.css +77 -82
- package/lib/src/css/library.brand-page-brandPage.min.css +77 -83
- package/lib/src/css/library.brand-page-designCom.min.css +77 -82
- package/lib/src/css/library.brand-page-preview.min.css +77 -82
- package/lib/src/index.mjs +62 -60
- package/lib/src/{lib-BI3J4Mbk.js → lib-BXbo_N88.js} +35072 -34447
- package/lib/src/metadata-builder/builders/reorder-pages-builder.d.ts +13 -0
- package/lib/src/metadata-builder/builders/reorder-pages-builder.js +49 -0
- package/lib/src/shared/content-settings/components/content-settings/ContentSettings.mixin.d.ts +87 -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 +23 -2
- package/lib/src/shared/content-settings/components/content-settings-item/ContentSettingsItem.mixin.d.ts +16 -0
- package/lib/src/shared/content-settings/components/content-settings-item/ContentSettingsItemField.mixin.d.ts +7 -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/form-fields-field/FormFieldsField.mixin.js +18 -8
- package/lib/src/shared/content-settings/components/payment-config-field/PaymentConfigField.mixin.d.ts +64 -0
- package/lib/src/shared/content-settings/components/payment-config-field/PaymentConfigField.mixin.js +6 -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/navigation-style-settings/components/navigation-style-settings/NavigationStyleSettings.mixin.js +10 -8
- package/lib/src/shared/navigation-style-settings/store/index.js +1 -12
- package/lib/src/shared/page-settings/components/page-settings/PageSettings.mixin.d.ts +24 -2
- package/lib/src/shared/page-settings/components/page-settings-section-styles/PageSettingsSectionStyles.mixin.d.ts +10 -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/package.json +1 -1
- package/src/brand-page/components/button/Button.vue +2 -10
- package/src/brand-page/components/contact-form/ContactForm.vue +2 -2
- package/src/brand-page/components/navigation/navigation-side-menu/NavigationSideMenu.vue +4 -1
- package/src/brand-page/models/navigation-styles.model.ts +39 -1
- package/src/brand-page/utils/__snapshots__/migration.util.test.ts.snap +3 -3
- package/src/brand-page/utils/migration/migration-16.test.ts +319 -0
- package/src/brand-page/utils/migration/migration-16.ts +75 -0
- package/src/brand-page/utils/migration.util.ts +8 -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/color-palette/BpColorPalette.vue +9 -7
- 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 +24 -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/stores/brandpage-maker/brandpage-maker-store.test.ts +377 -0
- package/src/brand-page-maker/stores/brandpage-maker/brandpage-maker-store.ts +371 -18
- package/src/brand-page-maker/stores/history/history-store.test.ts +1120 -0
- package/src/brand-page-maker/stores/history/history-store.ts +660 -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 +3 -1
- package/src/bundles/bundled-translations.es-ES.json +3 -1
- package/src/bundles/bundled-translations.fr-CA.json +3 -1
- package/src/bundles/bundled-translations.fr-FR.json +3 -1
- package/src/bundles/bundled-translations.json +3 -1
- package/src/bundles/bundled-translations.pt-BR.json +3 -1
- package/src/bundles/bundled-translations.pt-PT.json +3 -1
- package/src/constants/ui.ts +1 -0
- package/src/metadata-builder/builders/reorder-pages-builder.ts +80 -0
- package/src/shared/content-settings/components/color-field/ColorField.vue +10 -5
- 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/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/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/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/shared/navigation-style-settings/components/navigation-style-settings/NavigationStyleSettings.mixin.ts +17 -11
- package/src/shared/navigation-style-settings/components/navigation-style-settings/NavigationStyleSettings.vue +4 -1
- package/src/shared/navigation-style-settings/store/index.ts +1 -21
- 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
|
@@ -33,6 +33,7 @@ import type {
|
|
|
33
33
|
import type { UserFeatures } from '../user';
|
|
34
34
|
import { useBrandPageMakerUserStore } from '../user';
|
|
35
35
|
import { defineStore } from 'pinia';
|
|
36
|
+
import { toRaw } from 'vue';
|
|
36
37
|
import { useUiStore } from '../ui';
|
|
37
38
|
import type { LogoSettingsState } from '@shared/logo-settings/store';
|
|
38
39
|
import {
|
|
@@ -60,6 +61,7 @@ import {
|
|
|
60
61
|
BRANDPAGE_DEFAULT_SAVE_MESSAGE_DESCRIPTION,
|
|
61
62
|
MAKER_MOBILE_BREAKPOINT,
|
|
62
63
|
MESSAGE_VISIBLE_DURATION,
|
|
64
|
+
SIDE_BAR_TAB_NAMES,
|
|
63
65
|
} from '@brand-page-maker/constants';
|
|
64
66
|
import { useUiSideBarStore } from '@shared/side-bar/store';
|
|
65
67
|
import { delayInMS } from '../../../utils/ui-util';
|
|
@@ -71,7 +73,6 @@ import { useAdminLogoSettingsStore } from '../admin-logo-settings';
|
|
|
71
73
|
import type { PageSettingsStateSections } from '@shared/page-settings/store';
|
|
72
74
|
import { useUiPageSettingsStore } from '@shared/page-settings/store';
|
|
73
75
|
import {
|
|
74
|
-
isColorMatched,
|
|
75
76
|
mapBrandPageContentToContentSettingsItem,
|
|
76
77
|
removeContentFieldValues,
|
|
77
78
|
removeLogoTemplateModel,
|
|
@@ -104,6 +105,7 @@ import { useConsent } from '@brand-page/composables/consent.composable';
|
|
|
104
105
|
import { commonTr, errorTr } from '@src/composables/useTranslate';
|
|
105
106
|
import { UPGRADE_CTA_LOCATIONS } from '../../composables/useEventTracker';
|
|
106
107
|
import { useVideoStore } from '../video';
|
|
108
|
+
import { useHistoryStore } from '../history/history-store';
|
|
107
109
|
import { findValuesByKey } from '../../../helpers/ts.helper';
|
|
108
110
|
import { useLogoStore } from '../logo-store';
|
|
109
111
|
|
|
@@ -668,6 +670,16 @@ export const useBrandPageMakerStore = defineStore('brandPageMaker', {
|
|
|
668
670
|
description: payload.noDescription ? '' : description,
|
|
669
671
|
},
|
|
670
672
|
});
|
|
673
|
+
|
|
674
|
+
// Any successful save re-baselines the undo stack so a user can't
|
|
675
|
+
// undo back past the persisted state. This covers Save Progress /
|
|
676
|
+
// Publish AND settings-only saves (updateBrandPage,
|
|
677
|
+
// updateSensitiveContent, admin saveTemplate) — settings-tab
|
|
678
|
+
// actions persist the metadata, so allowing undo to roll them
|
|
679
|
+
// back would let the local stack drift from what's saved.
|
|
680
|
+
// reset() no-ops in non-undo-redo sessions (no baseline = nothing
|
|
681
|
+
// to clear).
|
|
682
|
+
useHistoryStore().reset();
|
|
671
683
|
},
|
|
672
684
|
hideChangeTemplateConfirmModal() {
|
|
673
685
|
this.setIsChangeTemplateConfirmModalVisible({
|
|
@@ -681,10 +693,11 @@ export const useBrandPageMakerStore = defineStore('brandPageMaker', {
|
|
|
681
693
|
this.setSelectedTemplateId({ templateId: false });
|
|
682
694
|
this.hideChangeTemplateConfirmModal();
|
|
683
695
|
},
|
|
684
|
-
onChangeTemplateConfirmModalConfirm() {
|
|
685
|
-
this.applySelectedTemplate();
|
|
696
|
+
async onChangeTemplateConfirmModalConfirm() {
|
|
697
|
+
await this.applySelectedTemplate();
|
|
686
698
|
this.hideChangeTemplateConfirmModal();
|
|
687
699
|
this.isModifiedAfterTemplateApplied = false;
|
|
700
|
+
this._captureTemplateSwitchIfEnabled();
|
|
688
701
|
},
|
|
689
702
|
onContentChanged() {
|
|
690
703
|
this.setIsModifiedAfterTemplateApplied();
|
|
@@ -692,7 +705,7 @@ export const useBrandPageMakerStore = defineStore('brandPageMaker', {
|
|
|
692
705
|
onStyleChanged(): void {
|
|
693
706
|
this.setIsModifiedAfterTemplateApplied();
|
|
694
707
|
},
|
|
695
|
-
onTemplateSelected(payload: OnTemplateSelectedPayload) {
|
|
708
|
+
async onTemplateSelected(payload: OnTemplateSelectedPayload) {
|
|
696
709
|
this.setSelectedTemplateId({
|
|
697
710
|
templateId: payload.templateId,
|
|
698
711
|
});
|
|
@@ -702,7 +715,8 @@ export const useBrandPageMakerStore = defineStore('brandPageMaker', {
|
|
|
702
715
|
isVisible: true,
|
|
703
716
|
});
|
|
704
717
|
} else {
|
|
705
|
-
this.applySelectedTemplate();
|
|
718
|
+
await this.applySelectedTemplate();
|
|
719
|
+
this._captureTemplateSwitchIfEnabled();
|
|
706
720
|
}
|
|
707
721
|
},
|
|
708
722
|
setSelectedTabName(payload) {
|
|
@@ -739,6 +753,358 @@ export const useBrandPageMakerStore = defineStore('brandPageMaker', {
|
|
|
739
753
|
const uiContentSettingsStore = useUiContentSettingsStore();
|
|
740
754
|
|
|
741
755
|
uiContentSettingsStore.updateContent<TContent>(payload);
|
|
756
|
+
|
|
757
|
+
// NOTE (Bolt 1, 2026-04-23): this action is not the actual edit path used
|
|
758
|
+
// by the UI — sidebar inputs call uiContentSettingsStore.updateItemValue
|
|
759
|
+
// directly. History capture is driven by a deep `watch(brandPageData, ...)`
|
|
760
|
+
// installed in history-store once the baseline is captured, so we do not
|
|
761
|
+
// need to instrument this action. Kept here as a pass-through because
|
|
762
|
+
// removing it may affect other callers.
|
|
763
|
+
},
|
|
764
|
+
/**
|
|
765
|
+
* Restore every store that the `brandPageData` getter reads from, so undo
|
|
766
|
+
* and redo bring back the EXACT document state captured at snapshot time.
|
|
767
|
+
*
|
|
768
|
+
* `initialiseStoresByBrandPageModelAsync` is too narrow for undo/redo — it
|
|
769
|
+
* only rehydrates pages, sections, and nav structure, which is enough for
|
|
770
|
+
* the AI-apply path but leaves navigation styles, backgrounds, button/text/
|
|
771
|
+
* logo/gallery styles, shop config, and several own-store fields unchanged.
|
|
772
|
+
* This action mirrors the full hydration surface of `applySelectedTemplate`
|
|
773
|
+
* (minus the template-specific logo/personalisation logic) so a restore is
|
|
774
|
+
* a complete round-trip of what `brandPageData` returns.
|
|
775
|
+
*
|
|
776
|
+
* Called ONLY by history-store during undo/redo. The history store sets
|
|
777
|
+
* `isApplyingSnapshot=true` across this call to prevent the deep-watcher
|
|
778
|
+
* on `brandPageData` from re-capturing the restored state.
|
|
779
|
+
*/
|
|
780
|
+
/**
|
|
781
|
+
* Force-commit a `template_switch` entry to the history store, if the
|
|
782
|
+
* history store has a baseline (which only happens when the undo/redo
|
|
783
|
+
* feature flag is on — see `BrandPageMaker.mixin.ts`).
|
|
784
|
+
*/
|
|
785
|
+
_captureTemplateSwitchIfEnabled(): void {
|
|
786
|
+
const historyStore = useHistoryStore();
|
|
787
|
+
|
|
788
|
+
if (!historyStore.baselineCaptured) return;
|
|
789
|
+
|
|
790
|
+
historyStore.captureTemplateSwitch();
|
|
791
|
+
},
|
|
792
|
+
async applyHistorySnapshot(
|
|
793
|
+
snapshot: BrandPageModel,
|
|
794
|
+
activePageId?: string,
|
|
795
|
+
logoEditsStr?: string,
|
|
796
|
+
): Promise<void> {
|
|
797
|
+
const styleSettingsStore = useUiStyleSettingsStore();
|
|
798
|
+
const navigationStyleSettingsStore = useUiNavigationStyleSettingsStore();
|
|
799
|
+
const backgroundSettingsStore = useUiBackgroundSettingsStore();
|
|
800
|
+
const pageNavigationStore = usePageNavigationStore();
|
|
801
|
+
const shopStore = useShopConfigStore();
|
|
802
|
+
|
|
803
|
+
// 1. Pages + header/footer sections (also covers content items).
|
|
804
|
+
this.initialisePagesForCurrentPage({
|
|
805
|
+
pages: snapshot.pages,
|
|
806
|
+
sections: {
|
|
807
|
+
[PAGE_SECTIONS.header]: {
|
|
808
|
+
[VIEWPORTS.desktop]: snapshot.pageHeaderDesktop,
|
|
809
|
+
[VIEWPORTS.mobile]: snapshot.pageHeaderMobile,
|
|
810
|
+
},
|
|
811
|
+
[PAGE_SECTIONS.footer]: {
|
|
812
|
+
[VIEWPORTS.desktop]: snapshot.pageFooterDesktop,
|
|
813
|
+
[VIEWPORTS.mobile]: snapshot.pageFooterMobile,
|
|
814
|
+
},
|
|
815
|
+
},
|
|
816
|
+
});
|
|
817
|
+
|
|
818
|
+
// 2. Page-level nav structure (routes, orders).
|
|
819
|
+
pageNavigationStore.setNav({ nav: snapshot.nav });
|
|
820
|
+
|
|
821
|
+
// 3. Navigation STYLES (header/footer nav colors, alignment, etc.) —
|
|
822
|
+
// this is the bit that was being dropped before.
|
|
823
|
+
// Use function-form $patch so each nested style object is replaced as a
|
|
824
|
+
// whole reference. The object-form $patch (used by setState) deep-merges
|
|
825
|
+
// and would leave keys present in the live state but absent from the
|
|
826
|
+
// snapshot in place — e.g. switching button styles then undoing would
|
|
827
|
+
// leave the new style's borderRadius/borderStyle/borderWidth applied.
|
|
828
|
+
navigationStyleSettingsStore.$patch((state) => {
|
|
829
|
+
state.navigation[PAGE_SECTIONS.header][VIEWPORTS.desktop] =
|
|
830
|
+
new NavigationDesktop(snapshot.pageHeaderDesktop?.navigation);
|
|
831
|
+
state.navigation[PAGE_SECTIONS.header][VIEWPORTS.mobile] =
|
|
832
|
+
new NavigationMobile(snapshot.pageHeaderMobile?.navigation);
|
|
833
|
+
});
|
|
834
|
+
|
|
835
|
+
// 4. Global styles (logo, button, text, gallery). Same whole-reference
|
|
836
|
+
// replacement reasoning as step 3.
|
|
837
|
+
styleSettingsStore.$patch((state) => {
|
|
838
|
+
state.buttonStyles = snapshot.styles.buttonStyles;
|
|
839
|
+
state.logoStyles = snapshot.styles.logoStyles;
|
|
840
|
+
state.textStyles = snapshot.styles.textStyles;
|
|
841
|
+
state.galleryStyles = snapshot.styles.galleryStyles;
|
|
842
|
+
});
|
|
843
|
+
|
|
844
|
+
// 5. Background styles. Same whole-reference replacement reasoning as
|
|
845
|
+
// step 3 — `setBackgroundStyles` calls per-field setters that
|
|
846
|
+
// `Object.assign` partials onto the live `style` and
|
|
847
|
+
// `backgroundShapeStyle` objects, so keys from the previous mode
|
|
848
|
+
// (e.g. background image url, shape style props) would survive an
|
|
849
|
+
// undo back to a state that doesn't have them.
|
|
850
|
+
backgroundSettingsStore.$patch((state) => {
|
|
851
|
+
state.backgroundStyles = snapshot.styles.backgroundStyles;
|
|
852
|
+
});
|
|
853
|
+
backgroundSettingsStore.onBackgroundChanged();
|
|
854
|
+
|
|
855
|
+
// 6. Shop products are derived from shop-content blocks inside `pages`,
|
|
856
|
+
// so they're already implicitly restored at step 1. Re-run the shop
|
|
857
|
+
// store's derivation to keep `products` in sync with the snapshot
|
|
858
|
+
// pages. paymentConfig is intentionally NOT restored — selecting it is
|
|
859
|
+
// backend-confirmed (Stripe Connect / payment-provider linkage) per
|
|
860
|
+
// project-guardrails.md, so it must persist across undo. We pass the
|
|
861
|
+
// live paymentConfig back in to preserve it.
|
|
862
|
+
shopStore.initialiseShopStore({
|
|
863
|
+
paymentConfig: shopStore.paymentConfig,
|
|
864
|
+
pages: snapshot.pages ?? [],
|
|
865
|
+
});
|
|
866
|
+
|
|
867
|
+
// 7. Own-store scalar fields surfaced by the brandPageData getter.
|
|
868
|
+
if (snapshot.isModifiedAfterTemplateApplied !== undefined) {
|
|
869
|
+
this.isModifiedAfterTemplateApplied =
|
|
870
|
+
snapshot.isModifiedAfterTemplateApplied;
|
|
871
|
+
}
|
|
872
|
+
|
|
873
|
+
if (snapshot.brandPageType) {
|
|
874
|
+
this.setBrandPageType({ brandPageType: snapshot.brandPageType });
|
|
875
|
+
}
|
|
876
|
+
|
|
877
|
+
this.faviconUrl = snapshot.faviconUrl;
|
|
878
|
+
this.ogImageUrl = snapshot.ogImageUrl;
|
|
879
|
+
this.measurementID = snapshot.measurementID;
|
|
880
|
+
this.adsenseID = snapshot.adsenseID;
|
|
881
|
+
this.ogTitle = snapshot.ogTitle;
|
|
882
|
+
this.ogDescription = snapshot.ogDescription;
|
|
883
|
+
this.cookieOptions = snapshot.cookieOptions;
|
|
884
|
+
this.saveContactSettings = snapshot.saveContactSettings;
|
|
885
|
+
|
|
886
|
+
// 8. Re-sync the logo-settings sidebar's `selectedLogoImage` from the
|
|
887
|
+
// restored header logo. The preview rehydrates via the page contents,
|
|
888
|
+
// but `uiLogoSettings` holds its own copy that drives the sidebar
|
|
889
|
+
// "current logo" state — same pattern as `initialiseStoresByBrandPageModelAsync`.
|
|
890
|
+
// Also restores the variations grid + template asset for the
|
|
891
|
+
// snapshot's draft token (both are sidecars to `brandPageData` —
|
|
892
|
+
// BYO upload mutates them out of band). When the captured entry
|
|
893
|
+
// carries a `logoEdits` sidecar (pre-purchase logo-tab edits —
|
|
894
|
+
// text, support text, logo colors, fonts), `editableLogoStore.logoEdits`
|
|
895
|
+
// is restored from that string so the sidebar form fields and the
|
|
896
|
+
// save-time fabric-render POST both pick up the pre-edit state.
|
|
897
|
+
await this._syncLogoSettingsFromSnapshot(snapshot, logoEditsStr);
|
|
898
|
+
|
|
899
|
+
// 9. If the sidebar is editing a content item that no longer exists in
|
|
900
|
+
// the restored page, fall back to the Content tab so the user doesn't
|
|
901
|
+
// stare at a blank settings panel.
|
|
902
|
+
this._fallbackSidebarIfSelectedContentMissing(snapshot);
|
|
903
|
+
|
|
904
|
+
// 10. Switch to the page the user was viewing when this entry was
|
|
905
|
+
// captured (or the closest still-existing page if the captured
|
|
906
|
+
// page was the one being undone-away). The history store does the
|
|
907
|
+
// walk-back resolution and passes us a pageId that's guaranteed to
|
|
908
|
+
// exist in the restored nav — or undefined if no entry walking
|
|
909
|
+
// back has a viable id, in which case we fall through to the
|
|
910
|
+
// first/default route. Without this, the page-tabs carousel keeps
|
|
911
|
+
// highlighting whatever page slug is in the URL (which can no
|
|
912
|
+
// longer match any nav item after a page-add undo) and the
|
|
913
|
+
// sidebar's `currentPage` getter silently falls back to page 0.
|
|
914
|
+
this._navigateToActivePage(activePageId);
|
|
915
|
+
},
|
|
916
|
+
|
|
917
|
+
async _syncLogoSettingsFromSnapshot(
|
|
918
|
+
snapshot: BrandPageModel,
|
|
919
|
+
logoEditsStr?: string,
|
|
920
|
+
): Promise<void> {
|
|
921
|
+
const logoSettingsStore = useUiLogoSettingsStore();
|
|
922
|
+
const editableLogoStore = useUiEditableLogoStore();
|
|
923
|
+
const logoStore = useLogoStore();
|
|
924
|
+
const containerStore = useBrandPageContainerStore();
|
|
925
|
+
|
|
926
|
+
// Pre-restore logo identity, used to short-circuit the
|
|
927
|
+
// fabric-render call when only non-logo state changed.
|
|
928
|
+
const prevLogoEditsStr = JSON.stringify(
|
|
929
|
+
toRaw(editableLogoStore.logoEdits),
|
|
930
|
+
);
|
|
931
|
+
const prevDraftToken = editableLogoStore.logoDraftToken;
|
|
932
|
+
|
|
933
|
+
// Wholesale-replace via $patch so prior textObjects/colors don't
|
|
934
|
+
// leak across template switches.
|
|
935
|
+
if (logoEditsStr) {
|
|
936
|
+
try {
|
|
937
|
+
const parsed = JSON.parse(logoEditsStr);
|
|
938
|
+
|
|
939
|
+
editableLogoStore.$patch({ logoEdits: parsed });
|
|
940
|
+
} catch (error) {
|
|
941
|
+
console.error(
|
|
942
|
+
'brandpage-maker-store: failed to restore logoEdits',
|
|
943
|
+
error,
|
|
944
|
+
);
|
|
945
|
+
}
|
|
946
|
+
}
|
|
947
|
+
|
|
948
|
+
const logoImage =
|
|
949
|
+
snapshot.brandPageType === BRAND_PAGE_TYPES.default
|
|
950
|
+
? (
|
|
951
|
+
snapshot.pages?.[0]?.contents?.find(
|
|
952
|
+
(c) => c.type === 'logo',
|
|
953
|
+
) as any
|
|
954
|
+
)?.logoImage
|
|
955
|
+
: snapshot.pageHeaderDesktop?.logoImage;
|
|
956
|
+
|
|
957
|
+
if (!logoImage) return;
|
|
958
|
+
|
|
959
|
+
logoSettingsStore.setState({
|
|
960
|
+
newState: { selectedLogoImage: logoImage },
|
|
961
|
+
});
|
|
962
|
+
|
|
963
|
+
const draftToken: string | undefined = logoImage.logoDraftToken;
|
|
964
|
+
|
|
965
|
+
if (!draftToken) return;
|
|
966
|
+
|
|
967
|
+
// Re-derive enableEditMode + templateAsset from the draft registry
|
|
968
|
+
// (append-only for the session) instead of stashing on every entry.
|
|
969
|
+
const draft = logoStore.getLogoDraftAssetByToken(draftToken);
|
|
970
|
+
|
|
971
|
+
if (draft) {
|
|
972
|
+
editableLogoStore.setEnableEditMode(!draft.isByo);
|
|
973
|
+
|
|
974
|
+
if (draft.templateAsset) {
|
|
975
|
+
logoStore.setLogoTemplateAsset(draft.templateAsset);
|
|
976
|
+
}
|
|
977
|
+
}
|
|
978
|
+
|
|
979
|
+
editableLogoStore.setLogoDraftToken(draftToken);
|
|
980
|
+
|
|
981
|
+
// No logo change → cache is still correct; just stamp base64 back
|
|
982
|
+
// (snapshot doesn't carry logoImageBase64Url).
|
|
983
|
+
const logoUnchanged =
|
|
984
|
+
prevDraftToken === draftToken &&
|
|
985
|
+
(logoEditsStr === undefined || logoEditsStr === prevLogoEditsStr);
|
|
986
|
+
|
|
987
|
+
if (logoUnchanged) {
|
|
988
|
+
editableLogoStore.stampLogoBase64IntoBrandPageData();
|
|
989
|
+
|
|
990
|
+
return;
|
|
991
|
+
}
|
|
992
|
+
|
|
993
|
+
const isByo = !!draft?.isByo;
|
|
994
|
+
|
|
995
|
+
if (isByo) {
|
|
996
|
+
// BYO mints a fresh draftToken per upload so the per-token
|
|
997
|
+
// cache always matches; no re-render needed.
|
|
998
|
+
if (editableLogoStore.restoreVariationsForDraftToken(draftToken)) {
|
|
999
|
+
editableLogoStore.stampLogoBase64IntoBrandPageData();
|
|
1000
|
+
}
|
|
1001
|
+
|
|
1002
|
+
return;
|
|
1003
|
+
}
|
|
1004
|
+
|
|
1005
|
+
// Designed: draft token is reused across edits, so the cache
|
|
1006
|
+
// only holds the latest render. Re-issue fabric-render — same
|
|
1007
|
+
// call as the live edit path. Awaited so concurrent undos
|
|
1008
|
+
// serialize and the call sits inside the isApplyingSnapshot
|
|
1009
|
+
// window (watcher guard suppresses the writeback).
|
|
1010
|
+
if (
|
|
1011
|
+
containerStore.isPrePurchase &&
|
|
1012
|
+
logoEditsStr &&
|
|
1013
|
+
logoStore.logoTemplateAsset
|
|
1014
|
+
) {
|
|
1015
|
+
// Stamp the cached (pre-undo) base64 onto brandPageData first
|
|
1016
|
+
// so the canvas keeps showing the previous logo while the
|
|
1017
|
+
// re-render is in flight. Without this the logoImageBase64Url
|
|
1018
|
+
// fields are undefined (snapshot is stripped pre-purchase) and
|
|
1019
|
+
// the canvas flickers blank for ~500-1500ms.
|
|
1020
|
+
editableLogoStore.stampLogoBase64IntoBrandPageData();
|
|
1021
|
+
|
|
1022
|
+
try {
|
|
1023
|
+
await editableLogoStore.updateEditableLogoImageUrlAsync();
|
|
1024
|
+
} catch (error) {
|
|
1025
|
+
console.error(
|
|
1026
|
+
'brandpage-maker-store: failed to re-render logo on history apply',
|
|
1027
|
+
error,
|
|
1028
|
+
);
|
|
1029
|
+
}
|
|
1030
|
+
}
|
|
1031
|
+
},
|
|
1032
|
+
|
|
1033
|
+
/**
|
|
1034
|
+
* Restore the active page after a history apply. The id passed in is
|
|
1035
|
+
* already validated against the restored nav by the history store; if
|
|
1036
|
+
* it's undefined (no entry walking back had a viable page), fall back
|
|
1037
|
+
* to the first/default route so the URL, `routeStore.currentRoute.params`,
|
|
1038
|
+
* `pageNavigation.activePageId`, and the page-tab highlight all line up.
|
|
1039
|
+
*
|
|
1040
|
+
* `setCurrentActivePage` is called explicitly in addition to
|
|
1041
|
+
* `navigateToPageByPageId` because `navigateToPageByPageId` is a no-op
|
|
1042
|
+
* when the router instance is undefined (e.g. SSR / unit tests), but the
|
|
1043
|
+
* Pinia state must still be updated so the sidebar's `currentPage`
|
|
1044
|
+
* getter returns the right page.
|
|
1045
|
+
*/
|
|
1046
|
+
_navigateToActivePage(activePageId?: string): void {
|
|
1047
|
+
const pageNavigationStore = usePageNavigationStore();
|
|
1048
|
+
|
|
1049
|
+
let targetPageId = activePageId;
|
|
1050
|
+
|
|
1051
|
+
if (!targetPageId) {
|
|
1052
|
+
const fallbackRoute = pageNavigationStore.routes.length
|
|
1053
|
+
? pageNavigationStore.getFirstOrDefaultRoute()
|
|
1054
|
+
: undefined;
|
|
1055
|
+
|
|
1056
|
+
targetPageId = fallbackRoute?.pageId;
|
|
1057
|
+
}
|
|
1058
|
+
|
|
1059
|
+
if (!targetPageId) return;
|
|
1060
|
+
|
|
1061
|
+
// Skip both the Pinia write and the router push when the target page
|
|
1062
|
+
// is already active. The router push fires `router.afterEach` even
|
|
1063
|
+
// for same-page navigation, and BrandPageMaker.mixin's afterEach hook
|
|
1064
|
+
// resets the content-settings modeStack — which would snap the
|
|
1065
|
+
// sidebar back to the default Content tab on every undo/redo,
|
|
1066
|
+
// regardless of whether the user was deep-editing a content item.
|
|
1067
|
+
if (pageNavigationStore.activePageId === targetPageId) return;
|
|
1068
|
+
|
|
1069
|
+
pageNavigationStore.setCurrentActivePage({ pageId: targetPageId });
|
|
1070
|
+
navigateToPageByPageId(targetPageId);
|
|
1071
|
+
},
|
|
1072
|
+
|
|
1073
|
+
_fallbackSidebarIfSelectedContentMissing(snapshot: BrandPageModel): void {
|
|
1074
|
+
const contentSettingsStore = useUiContentSettingsStore();
|
|
1075
|
+
const sideBarStore = useUiSideBarStore();
|
|
1076
|
+
|
|
1077
|
+
const selectedItemId = contentSettingsStore.selectedItemId;
|
|
1078
|
+
|
|
1079
|
+
if (!selectedItemId) return;
|
|
1080
|
+
|
|
1081
|
+
const existingContentIds = new Set<string>();
|
|
1082
|
+
|
|
1083
|
+
snapshot.pages?.forEach((page) => {
|
|
1084
|
+
page.contents?.forEach((content) => {
|
|
1085
|
+
if (content?.id) existingContentIds.add(content.id);
|
|
1086
|
+
});
|
|
1087
|
+
});
|
|
1088
|
+
|
|
1089
|
+
if (existingContentIds.has(selectedItemId)) return;
|
|
1090
|
+
|
|
1091
|
+
// The previously-selected content was undone away. Restore the
|
|
1092
|
+
// Content tab's natural landing state — the same shape produced
|
|
1093
|
+
// when the user clicks the Content tab fresh — instead of leaving
|
|
1094
|
+
// the sidebar stuck rendering `<FocusedContentItemSettings>` for
|
|
1095
|
+
// a missing item, which paints a blank panel.
|
|
1096
|
+
//
|
|
1097
|
+
// `resetMode()` pops the modeStack back to the base `edit` entry
|
|
1098
|
+
// (the default landing mode); clearing `selectedItemId` releases
|
|
1099
|
+
// the pointer to the now-deleted item.
|
|
1100
|
+
sideBarStore.setSelectedTabName({
|
|
1101
|
+
tabName: SIDE_BAR_TAB_NAMES.CONTENT_SETTINGS,
|
|
1102
|
+
});
|
|
1103
|
+
contentSettingsStore.resetMode();
|
|
1104
|
+
contentSettingsStore.selectedItemId = null;
|
|
1105
|
+
contentSettingsStore.selectedItemFieldName = null;
|
|
1106
|
+
contentSettingsStore.selectedItemIndex = null;
|
|
1107
|
+
contentSettingsStore.selectedItemValue = null;
|
|
742
1108
|
},
|
|
743
1109
|
export(): BrandPageModel {
|
|
744
1110
|
const data = this.brandPageData;
|
|
@@ -1098,19 +1464,6 @@ export const useBrandPageMakerStore = defineStore('brandPageMaker', {
|
|
|
1098
1464
|
},
|
|
1099
1465
|
});
|
|
1100
1466
|
|
|
1101
|
-
if (userStore.isAdmin && !this.isUserDraft) {
|
|
1102
|
-
for (const viewport of [VIEWPORTS.desktop, VIEWPORTS.mobile]) {
|
|
1103
|
-
const hamburger =
|
|
1104
|
-
navigationStyleSettingsStore.navigation[PAGE_SECTIONS.header][
|
|
1105
|
-
viewport
|
|
1106
|
-
].hamburgerMenuStyle;
|
|
1107
|
-
|
|
1108
|
-
if (isColorMatched(hamburger.subNavBackgroundColor)) {
|
|
1109
|
-
hamburger.subNavBackgroundColor = undefined;
|
|
1110
|
-
}
|
|
1111
|
-
}
|
|
1112
|
-
}
|
|
1113
|
-
|
|
1114
1467
|
uiStore.setThirdPartySettings({
|
|
1115
1468
|
thirdPartySettings: {
|
|
1116
1469
|
unsplashApplicationName,
|