@designcrowd/library.brand-page 5.18.3-undo-40 → 5.18.3

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.
Files changed (112) hide show
  1. package/lib/src/{CreatedOnBrandCrowd-de-de-D_w411MF.js → CreatedOnBrandCrowd-de-de-CkuAAwKQ.js} +1 -1
  2. package/lib/src/{CreatedOnBrandCrowd-en-us-DvJhv23Q.js → CreatedOnBrandCrowd-en-us-Coln5kSU.js} +1 -1
  3. package/lib/src/{CreatedOnBrandCrowd-es-es-BvW6EBKl.js → CreatedOnBrandCrowd-es-es-raGyXChm.js} +1 -1
  4. package/lib/src/{CreatedOnBrandCrowd-fr-fr-Bc4iL236.js → CreatedOnBrandCrowd-fr-ca-BT_WYYxW.js} +1 -1
  5. package/lib/src/{CreatedOnBrandCrowd-fr-ca-Bc4iL236.js → CreatedOnBrandCrowd-fr-fr-BT_WYYxW.js} +1 -1
  6. package/lib/src/{CreatedOnBrandCrowd-pt-pt-C74D9eIB.js → CreatedOnBrandCrowd-pt-br-BRbD_kiI.js} +1 -1
  7. package/lib/src/{CreatedOnBrandCrowd-pt-br-C74D9eIB.js → CreatedOnBrandCrowd-pt-pt-BRbD_kiI.js} +1 -1
  8. package/lib/src/{CreatedOnDcom-de-de-BVL3vDSq.js → CreatedOnDcom-de-de-DetCIFxa.js} +1 -1
  9. package/lib/src/{CreatedOnDcom-en-us-B9Dow5pk.js → CreatedOnDcom-en-us-D0LeF_V2.js} +1 -1
  10. package/lib/src/{CreatedOnDcom-es-es-H2Dv6N8F.js → CreatedOnDcom-es-es-CHa4stWS.js} +1 -1
  11. package/lib/src/{CreatedOnDcom-fr-ca-sw4LRlLw.js → CreatedOnDcom-fr-ca-ntW7A335.js} +1 -1
  12. package/lib/src/{CreatedOnDcom-fr-fr-DnOriI4M.js → CreatedOnDcom-fr-fr-C6rQcclc.js} +1 -1
  13. package/lib/src/{CreatedOnDcom-pt-br-BXs8zbRg.js → CreatedOnDcom-pt-br-Cn07ZK_m.js} +1 -1
  14. package/lib/src/{CreatedOnDcom-pt-pt-DmfOvW_0.js → CreatedOnDcom-pt-pt-CewmqYVY.js} +1 -1
  15. package/lib/src/brand-page-maker/components/action-bar/ActionBar.mixin.d.ts +2 -7
  16. package/lib/src/brand-page-maker/components/brand-page-maker/BrandPageMaker.mixin.d.ts +2 -7
  17. package/lib/src/brand-page-maker/components/brand-page-maker/BrandPageMaker.mixin.js +0 -8
  18. package/lib/src/brand-page-maker/components/brand-page-maker/BrandPageMakerTemplateSettings.mixin.d.ts +2 -7
  19. package/lib/src/brand-page-maker/components/brand-page-maker/__fixtures__/brand-page-examples.js +0 -1
  20. package/lib/src/brand-page-maker/components/brandpage-maker-page/BrandPageMakerPage.mixin.d.ts +2 -87
  21. package/lib/src/brand-page-maker/components/brandpage-maker-page/BrandPageMakerPage.mixin.js +0 -5
  22. package/lib/src/brand-page-maker/components/brandpage-settings/ReplaceImageSettingsForBrandPageSettings.mixin.d.ts +2 -7
  23. package/lib/src/brand-page-maker/components/quick-link-bar/QuickLinkBar.mixin.d.ts +0 -3
  24. package/lib/src/brand-page-maker/components/quick-link-bar/QuickLinkBar.mixin.js +0 -11
  25. package/lib/src/brand-page-maker/components/seo-settings/SeoPageSettings.mixin.d.ts +2 -7
  26. package/lib/src/brand-page-maker/components/seo-settings/UrlSettings.mixin.d.ts +2 -7
  27. package/lib/src/brand-page-maker/components/social-share/SocialShare.mixin.d.ts +2 -7
  28. package/lib/src/brand-page-maker/components/template-preview/TemplatePreview.mixin.d.ts +2 -7
  29. package/lib/src/brand-page-maker/composables/ai-chat/useAiWebsiteBuilderChat.js +0 -9
  30. package/lib/src/brand-page-maker/composables/rich-text-editor/useRichTextEditor.js +1 -20
  31. package/lib/src/brand-page-maker/composables/useEventTracker.d.ts +0 -20
  32. package/lib/src/brand-page-maker/composables/useEventTracker.js +0 -17
  33. package/lib/src/brand-page-maker/stores/brandpage-maker/brandpage-maker-store.d.ts +2 -41
  34. package/lib/src/brand-page-maker/stores/brandpage-maker/brandpage-maker-store.js +5 -307
  35. package/lib/src/brand-page-maker/stores/logo-store/logo-store.d.ts +0 -1
  36. package/lib/src/brand-page-maker/stores/user/user-store.js +0 -1
  37. package/lib/src/bundled-translations-B5Fkt3qd.js +175 -0
  38. package/lib/src/bundles/bundled-translations.json +1 -3
  39. package/lib/src/constants/ui.d.ts +0 -1
  40. package/lib/src/css/library.brand-page-brandCrowd.min.css +15 -20
  41. package/lib/src/css/library.brand-page-brandPage.min.css +16 -20
  42. package/lib/src/css/library.brand-page-designCom.min.css +15 -20
  43. package/lib/src/css/library.brand-page-preview.min.css +15 -20
  44. package/lib/src/index.mjs +1 -1
  45. package/lib/src/{lib-Dg2Zs9nH.js → lib-CGfmcIBb.js} +29373 -29970
  46. package/lib/src/shared/content-settings/components/content-settings/ContentSettings.mixin.d.ts +2 -87
  47. package/lib/src/shared/content-settings/components/content-settings/ContentSettings.mixin.js +0 -5
  48. package/lib/src/shared/content-settings/components/content-settings/ContentSettings.stories.js +0 -1
  49. package/lib/src/shared/content-settings/components/content-settings/ReplaceImageSettingsForContent.mixin.d.ts +2 -23
  50. package/lib/src/shared/content-settings/components/content-settings-item/ContentSettingsItem.mixin.d.ts +0 -16
  51. package/lib/src/shared/content-settings/components/content-settings-item/ContentSettingsItemField.mixin.d.ts +2 -7
  52. package/lib/src/shared/content-settings/components/draggable-item-list/DraggableItemList.mixin.d.ts +0 -3
  53. package/lib/src/shared/content-settings/components/draggable-item-list/DraggableItemList.mixin.js +2 -19
  54. package/lib/src/shared/content-settings/components/form-fields-field/FormFieldsField.mixin.js +8 -18
  55. package/lib/src/shared/content-settings/components/payment-config-field/PaymentConfigField.mixin.d.ts +0 -64
  56. package/lib/src/shared/content-settings/components/payment-config-field/PaymentConfigField.mixin.js +0 -6
  57. package/lib/src/shared/logo-settings/components/EditLogoSettings.mixin.d.ts +0 -19
  58. package/lib/src/shared/logo-settings/components/EditLogoSettings.mixin.js +0 -11
  59. package/lib/src/shared/logo-settings/components/LogoSettings.mixin.d.ts +2 -10
  60. package/lib/src/shared/logo-settings/store/editable-logo-store.d.ts +1 -5
  61. package/lib/src/shared/logo-settings/store/editable-logo-store.js +0 -31
  62. package/lib/src/shared/page-settings/components/page-settings/PageSettings.mixin.d.ts +2 -24
  63. package/lib/src/shared/page-settings/components/page-settings-section-styles/PageSettingsSectionStyles.mixin.d.ts +2 -10
  64. package/lib/src/shared/publish-brand-page-with-state/PublishBrandPageModalWithState.mixin.d.ts +2 -23
  65. package/lib/src/shared/side-bar/components/SideBarTabButton.mixin.d.ts +0 -16
  66. package/lib/src/shared/style-settings/components/StyleSettings.mixin.d.ts +2 -23
  67. package/lib/src/shared/template-settings/components/TemplatesSettings.mixin.d.ts +0 -16
  68. package/package.json +1 -1
  69. package/src/brand-page-maker/components/brand-page-maker/BrandPageMaker.mixin.ts +0 -9
  70. package/src/brand-page-maker/components/brand-page-maker/BrandPageMaker.vue +3 -2
  71. package/src/brand-page-maker/components/brand-page-maker/__fixtures__/brand-page-examples.ts +0 -1
  72. package/src/brand-page-maker/components/brandpage-maker-page/BrandPageMakerPage.mixin.ts +0 -5
  73. package/src/brand-page-maker/components/cookie-collection/CookieSettings.vue +17 -18
  74. package/src/brand-page-maker/components/quick-link-bar/QuickLinkBar.mixin.ts +0 -13
  75. package/src/brand-page-maker/components/quick-link-bar/QuickLinkBar.vue +3 -26
  76. package/src/brand-page-maker/components/quick-link-bar/i18n/quick-link-bar.json +1 -3
  77. package/src/brand-page-maker/components/save-contact/SaveContact.vue +19 -12
  78. package/src/brand-page-maker/composables/ai-chat/useAiWebsiteBuilderChat.ts +0 -10
  79. package/src/brand-page-maker/composables/rich-text-editor/useRichTextEditor.ts +1 -24
  80. package/src/brand-page-maker/composables/useEventTracker.ts +0 -29
  81. package/src/brand-page-maker/stores/brandpage-maker/brandpage-maker-store.test.ts +0 -335
  82. package/src/brand-page-maker/stores/brandpage-maker/brandpage-maker-store.ts +4 -371
  83. package/src/brand-page-maker/stores/logo-store/logo-store.ts +0 -5
  84. package/src/brand-page-maker/stores/user/user-store.ts +0 -1
  85. package/src/bundles/bundled-translations.json +1 -3
  86. package/src/constants/ui.ts +0 -1
  87. package/src/shared/content-settings/components/content-settings/ContentSettings.mixin.ts +0 -5
  88. package/src/shared/content-settings/components/content-settings/ContentSettings.stories.ts +0 -1
  89. package/src/shared/content-settings/components/draggable-item-list/DraggableItemList.mixin.ts +2 -19
  90. package/src/shared/content-settings/components/draggable-item-list/DraggableItemList.vue +1 -1
  91. package/src/shared/content-settings/components/form-fields-field/FormFieldsField.mixin.ts +10 -26
  92. package/src/shared/content-settings/components/logo-selection-field/LogoSelection.vue +48 -63
  93. package/src/shared/content-settings/components/page-dropdown-field/PageDropdownField.vue +0 -4
  94. package/src/shared/content-settings/components/payment-config-field/PaymentConfigField.mixin.ts +0 -7
  95. package/src/shared/content-settings/components/text-field/TextField.vue +0 -1
  96. package/src/shared/content-settings/components/text-image-field/TextImageField.vue +4 -33
  97. package/src/shared/logo-settings/components/EditLogoSettings.mixin.ts +0 -11
  98. package/src/shared/logo-settings/store/editable-logo-store.ts +1 -42
  99. package/lib/src/brand-page-maker/composables/useUndoRedoFlag.d.ts +0 -17
  100. package/lib/src/brand-page-maker/composables/useUndoRedoFlag.js +0 -25
  101. package/lib/src/brand-page-maker/stores/history/history-store.d.ts +0 -83
  102. package/lib/src/brand-page-maker/stores/history/history-store.js +0 -495
  103. package/lib/src/bundled-translations-D1q3rSEz.js +0 -175
  104. package/lib/src/metadata-builder/builders/reorder-pages-builder.d.ts +0 -13
  105. package/lib/src/metadata-builder/builders/reorder-pages-builder.js +0 -49
  106. package/src/brand-page-maker/components/quick-link-bar/RedoButton.vue +0 -66
  107. package/src/brand-page-maker/components/quick-link-bar/UndoButton.vue +0 -66
  108. package/src/brand-page-maker/components/quick-link-bar/undo-redo-buttons.test.ts +0 -116
  109. package/src/brand-page-maker/composables/useUndoRedoFlag.ts +0 -30
  110. package/src/brand-page-maker/stores/history/history-store.test.ts +0 -1120
  111. package/src/brand-page-maker/stores/history/history-store.ts +0 -660
  112. package/src/metadata-builder/builders/reorder-pages-builder.ts +0 -80
@@ -33,7 +33,6 @@ 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';
37
36
  import { useUiStore } from '../ui';
38
37
  import type { LogoSettingsState } from '@shared/logo-settings/store';
39
38
  import {
@@ -61,7 +60,6 @@ import {
61
60
  BRANDPAGE_DEFAULT_SAVE_MESSAGE_DESCRIPTION,
62
61
  MAKER_MOBILE_BREAKPOINT,
63
62
  MESSAGE_VISIBLE_DURATION,
64
- SIDE_BAR_TAB_NAMES,
65
63
  } from '@brand-page-maker/constants';
66
64
  import { useUiSideBarStore } from '@shared/side-bar/store';
67
65
  import { delayInMS } from '../../../utils/ui-util';
@@ -106,7 +104,6 @@ import { useConsent } from '@brand-page/composables/consent.composable';
106
104
  import { commonTr, errorTr } from '@src/composables/useTranslate';
107
105
  import { UPGRADE_CTA_LOCATIONS } from '../../composables/useEventTracker';
108
106
  import { useVideoStore } from '../video';
109
- import { useHistoryStore } from '../history/history-store';
110
107
  import { findValuesByKey } from '../../../helpers/ts.helper';
111
108
  import { useLogoStore } from '../logo-store';
112
109
 
@@ -671,16 +668,6 @@ export const useBrandPageMakerStore = defineStore('brandPageMaker', {
671
668
  description: payload.noDescription ? '' : description,
672
669
  },
673
670
  });
674
-
675
- // Any successful save re-baselines the undo stack so a user can't
676
- // undo back past the persisted state. This covers Save Progress /
677
- // Publish AND settings-only saves (updateBrandPage,
678
- // updateSensitiveContent, admin saveTemplate) — settings-tab
679
- // actions persist the metadata, so allowing undo to roll them
680
- // back would let the local stack drift from what's saved.
681
- // reset() no-ops in non-undo-redo sessions (no baseline = nothing
682
- // to clear).
683
- useHistoryStore().reset();
684
671
  },
685
672
  hideChangeTemplateConfirmModal() {
686
673
  this.setIsChangeTemplateConfirmModalVisible({
@@ -694,11 +681,10 @@ export const useBrandPageMakerStore = defineStore('brandPageMaker', {
694
681
  this.setSelectedTemplateId({ templateId: false });
695
682
  this.hideChangeTemplateConfirmModal();
696
683
  },
697
- async onChangeTemplateConfirmModalConfirm() {
698
- await this.applySelectedTemplate();
684
+ onChangeTemplateConfirmModalConfirm() {
685
+ this.applySelectedTemplate();
699
686
  this.hideChangeTemplateConfirmModal();
700
687
  this.isModifiedAfterTemplateApplied = false;
701
- this._captureTemplateSwitchIfEnabled();
702
688
  },
703
689
  onContentChanged() {
704
690
  this.setIsModifiedAfterTemplateApplied();
@@ -706,7 +692,7 @@ export const useBrandPageMakerStore = defineStore('brandPageMaker', {
706
692
  onStyleChanged(): void {
707
693
  this.setIsModifiedAfterTemplateApplied();
708
694
  },
709
- async onTemplateSelected(payload: OnTemplateSelectedPayload) {
695
+ onTemplateSelected(payload: OnTemplateSelectedPayload) {
710
696
  this.setSelectedTemplateId({
711
697
  templateId: payload.templateId,
712
698
  });
@@ -716,8 +702,7 @@ export const useBrandPageMakerStore = defineStore('brandPageMaker', {
716
702
  isVisible: true,
717
703
  });
718
704
  } else {
719
- await this.applySelectedTemplate();
720
- this._captureTemplateSwitchIfEnabled();
705
+ this.applySelectedTemplate();
721
706
  }
722
707
  },
723
708
  setSelectedTabName(payload) {
@@ -754,358 +739,6 @@ export const useBrandPageMakerStore = defineStore('brandPageMaker', {
754
739
  const uiContentSettingsStore = useUiContentSettingsStore();
755
740
 
756
741
  uiContentSettingsStore.updateContent<TContent>(payload);
757
-
758
- // NOTE (Bolt 1, 2026-04-23): this action is not the actual edit path used
759
- // by the UI — sidebar inputs call uiContentSettingsStore.updateItemValue
760
- // directly. History capture is driven by a deep `watch(brandPageData, ...)`
761
- // installed in history-store once the baseline is captured, so we do not
762
- // need to instrument this action. Kept here as a pass-through because
763
- // removing it may affect other callers.
764
- },
765
- /**
766
- * Restore every store that the `brandPageData` getter reads from, so undo
767
- * and redo bring back the EXACT document state captured at snapshot time.
768
- *
769
- * `initialiseStoresByBrandPageModelAsync` is too narrow for undo/redo — it
770
- * only rehydrates pages, sections, and nav structure, which is enough for
771
- * the AI-apply path but leaves navigation styles, backgrounds, button/text/
772
- * logo/gallery styles, shop config, and several own-store fields unchanged.
773
- * This action mirrors the full hydration surface of `applySelectedTemplate`
774
- * (minus the template-specific logo/personalisation logic) so a restore is
775
- * a complete round-trip of what `brandPageData` returns.
776
- *
777
- * Called ONLY by history-store during undo/redo. The history store sets
778
- * `isApplyingSnapshot=true` across this call to prevent the deep-watcher
779
- * on `brandPageData` from re-capturing the restored state.
780
- */
781
- /**
782
- * Force-commit a `template_switch` entry to the history store, if the
783
- * history store has a baseline (which only happens when the undo/redo
784
- * feature flag is on — see `BrandPageMaker.mixin.ts`).
785
- */
786
- _captureTemplateSwitchIfEnabled(): void {
787
- const historyStore = useHistoryStore();
788
-
789
- if (!historyStore.baselineCaptured) return;
790
-
791
- historyStore.captureTemplateSwitch();
792
- },
793
- async applyHistorySnapshot(
794
- snapshot: BrandPageModel,
795
- activePageId?: string,
796
- logoEditsStr?: string,
797
- ): Promise<void> {
798
- const styleSettingsStore = useUiStyleSettingsStore();
799
- const navigationStyleSettingsStore = useUiNavigationStyleSettingsStore();
800
- const backgroundSettingsStore = useUiBackgroundSettingsStore();
801
- const pageNavigationStore = usePageNavigationStore();
802
- const shopStore = useShopConfigStore();
803
-
804
- // 1. Pages + header/footer sections (also covers content items).
805
- this.initialisePagesForCurrentPage({
806
- pages: snapshot.pages,
807
- sections: {
808
- [PAGE_SECTIONS.header]: {
809
- [VIEWPORTS.desktop]: snapshot.pageHeaderDesktop,
810
- [VIEWPORTS.mobile]: snapshot.pageHeaderMobile,
811
- },
812
- [PAGE_SECTIONS.footer]: {
813
- [VIEWPORTS.desktop]: snapshot.pageFooterDesktop,
814
- [VIEWPORTS.mobile]: snapshot.pageFooterMobile,
815
- },
816
- },
817
- });
818
-
819
- // 2. Page-level nav structure (routes, orders).
820
- pageNavigationStore.setNav({ nav: snapshot.nav });
821
-
822
- // 3. Navigation STYLES (header/footer nav colors, alignment, etc.) —
823
- // this is the bit that was being dropped before.
824
- // Use function-form $patch so each nested style object is replaced as a
825
- // whole reference. The object-form $patch (used by setState) deep-merges
826
- // and would leave keys present in the live state but absent from the
827
- // snapshot in place — e.g. switching button styles then undoing would
828
- // leave the new style's borderRadius/borderStyle/borderWidth applied.
829
- navigationStyleSettingsStore.$patch((state) => {
830
- state.navigation[PAGE_SECTIONS.header][VIEWPORTS.desktop] =
831
- new NavigationDesktop(snapshot.pageHeaderDesktop?.navigation);
832
- state.navigation[PAGE_SECTIONS.header][VIEWPORTS.mobile] =
833
- new NavigationMobile(snapshot.pageHeaderMobile?.navigation);
834
- });
835
-
836
- // 4. Global styles (logo, button, text, gallery). Same whole-reference
837
- // replacement reasoning as step 3.
838
- styleSettingsStore.$patch((state) => {
839
- state.buttonStyles = snapshot.styles.buttonStyles;
840
- state.logoStyles = snapshot.styles.logoStyles;
841
- state.textStyles = snapshot.styles.textStyles;
842
- state.galleryStyles = snapshot.styles.galleryStyles;
843
- });
844
-
845
- // 5. Background styles. Same whole-reference replacement reasoning as
846
- // step 3 — `setBackgroundStyles` calls per-field setters that
847
- // `Object.assign` partials onto the live `style` and
848
- // `backgroundShapeStyle` objects, so keys from the previous mode
849
- // (e.g. background image url, shape style props) would survive an
850
- // undo back to a state that doesn't have them.
851
- backgroundSettingsStore.$patch((state) => {
852
- state.backgroundStyles = snapshot.styles.backgroundStyles;
853
- });
854
- backgroundSettingsStore.onBackgroundChanged();
855
-
856
- // 6. Shop products are derived from shop-content blocks inside `pages`,
857
- // so they're already implicitly restored at step 1. Re-run the shop
858
- // store's derivation to keep `products` in sync with the snapshot
859
- // pages. paymentConfig is intentionally NOT restored — selecting it is
860
- // backend-confirmed (Stripe Connect / payment-provider linkage) per
861
- // project-guardrails.md, so it must persist across undo. We pass the
862
- // live paymentConfig back in to preserve it.
863
- shopStore.initialiseShopStore({
864
- paymentConfig: shopStore.paymentConfig,
865
- pages: snapshot.pages ?? [],
866
- });
867
-
868
- // 7. Own-store scalar fields surfaced by the brandPageData getter.
869
- if (snapshot.isModifiedAfterTemplateApplied !== undefined) {
870
- this.isModifiedAfterTemplateApplied =
871
- snapshot.isModifiedAfterTemplateApplied;
872
- }
873
-
874
- if (snapshot.brandPageType) {
875
- this.setBrandPageType({ brandPageType: snapshot.brandPageType });
876
- }
877
-
878
- this.faviconUrl = snapshot.faviconUrl;
879
- this.ogImageUrl = snapshot.ogImageUrl;
880
- this.measurementID = snapshot.measurementID;
881
- this.adsenseID = snapshot.adsenseID;
882
- this.ogTitle = snapshot.ogTitle;
883
- this.ogDescription = snapshot.ogDescription;
884
- this.cookieOptions = snapshot.cookieOptions;
885
- this.saveContactSettings = snapshot.saveContactSettings;
886
-
887
- // 8. Re-sync the logo-settings sidebar's `selectedLogoImage` from the
888
- // restored header logo. The preview rehydrates via the page contents,
889
- // but `uiLogoSettings` holds its own copy that drives the sidebar
890
- // "current logo" state — same pattern as `initialiseStoresByBrandPageModelAsync`.
891
- // Also restores the variations grid + template asset for the
892
- // snapshot's draft token (both are sidecars to `brandPageData` —
893
- // BYO upload mutates them out of band). When the captured entry
894
- // carries a `logoEdits` sidecar (pre-purchase logo-tab edits —
895
- // text, support text, logo colors, fonts), `editableLogoStore.logoEdits`
896
- // is restored from that string so the sidebar form fields and the
897
- // save-time fabric-render POST both pick up the pre-edit state.
898
- await this._syncLogoSettingsFromSnapshot(snapshot, logoEditsStr);
899
-
900
- // 9. If the sidebar is editing a content item that no longer exists in
901
- // the restored page, fall back to the Content tab so the user doesn't
902
- // stare at a blank settings panel.
903
- this._fallbackSidebarIfSelectedContentMissing(snapshot);
904
-
905
- // 10. Switch to the page the user was viewing when this entry was
906
- // captured (or the closest still-existing page if the captured
907
- // page was the one being undone-away). The history store does the
908
- // walk-back resolution and passes us a pageId that's guaranteed to
909
- // exist in the restored nav — or undefined if no entry walking
910
- // back has a viable id, in which case we fall through to the
911
- // first/default route. Without this, the page-tabs carousel keeps
912
- // highlighting whatever page slug is in the URL (which can no
913
- // longer match any nav item after a page-add undo) and the
914
- // sidebar's `currentPage` getter silently falls back to page 0.
915
- this._navigateToActivePage(activePageId);
916
- },
917
-
918
- async _syncLogoSettingsFromSnapshot(
919
- snapshot: BrandPageModel,
920
- logoEditsStr?: string,
921
- ): Promise<void> {
922
- const logoSettingsStore = useUiLogoSettingsStore();
923
- const editableLogoStore = useUiEditableLogoStore();
924
- const logoStore = useLogoStore();
925
- const containerStore = useBrandPageContainerStore();
926
-
927
- // Pre-restore logo identity, used to short-circuit the
928
- // fabric-render call when only non-logo state changed.
929
- const prevLogoEditsStr = JSON.stringify(
930
- toRaw(editableLogoStore.logoEdits),
931
- );
932
- const prevDraftToken = editableLogoStore.logoDraftToken;
933
-
934
- // Wholesale-replace via $patch so prior textObjects/colors don't
935
- // leak across template switches.
936
- if (logoEditsStr) {
937
- try {
938
- const parsed = JSON.parse(logoEditsStr);
939
-
940
- editableLogoStore.$patch({ logoEdits: parsed });
941
- } catch (error) {
942
- console.error(
943
- 'brandpage-maker-store: failed to restore logoEdits',
944
- error,
945
- );
946
- }
947
- }
948
-
949
- const logoImage =
950
- snapshot.brandPageType === BRAND_PAGE_TYPES.default
951
- ? (
952
- snapshot.pages?.[0]?.contents?.find(
953
- (c) => c.type === 'logo',
954
- ) as any
955
- )?.logoImage
956
- : snapshot.pageHeaderDesktop?.logoImage;
957
-
958
- if (!logoImage) return;
959
-
960
- logoSettingsStore.setState({
961
- newState: { selectedLogoImage: logoImage },
962
- });
963
-
964
- const draftToken: string | undefined = logoImage.logoDraftToken;
965
-
966
- if (!draftToken) return;
967
-
968
- // Re-derive enableEditMode + templateAsset from the draft registry
969
- // (append-only for the session) instead of stashing on every entry.
970
- const draft = logoStore.getLogoDraftAssetByToken(draftToken);
971
-
972
- if (draft) {
973
- editableLogoStore.setEnableEditMode(!draft.isByo);
974
-
975
- if (draft.templateAsset) {
976
- logoStore.setLogoTemplateAsset(draft.templateAsset);
977
- }
978
- }
979
-
980
- editableLogoStore.setLogoDraftToken(draftToken);
981
-
982
- // No logo change → cache is still correct; just stamp base64 back
983
- // (snapshot doesn't carry logoImageBase64Url).
984
- const logoUnchanged =
985
- prevDraftToken === draftToken &&
986
- (logoEditsStr === undefined || logoEditsStr === prevLogoEditsStr);
987
-
988
- if (logoUnchanged) {
989
- editableLogoStore.stampLogoBase64IntoBrandPageData();
990
-
991
- return;
992
- }
993
-
994
- const isByo = !!draft?.isByo;
995
-
996
- if (isByo) {
997
- // BYO mints a fresh draftToken per upload so the per-token
998
- // cache always matches; no re-render needed.
999
- if (editableLogoStore.restoreVariationsForDraftToken(draftToken)) {
1000
- editableLogoStore.stampLogoBase64IntoBrandPageData();
1001
- }
1002
-
1003
- return;
1004
- }
1005
-
1006
- // Designed: draft token is reused across edits, so the cache
1007
- // only holds the latest render. Re-issue fabric-render — same
1008
- // call as the live edit path. Awaited so concurrent undos
1009
- // serialize and the call sits inside the isApplyingSnapshot
1010
- // window (watcher guard suppresses the writeback).
1011
- if (
1012
- containerStore.isPrePurchase &&
1013
- logoEditsStr &&
1014
- logoStore.logoTemplateAsset
1015
- ) {
1016
- // Stamp the cached (pre-undo) base64 onto brandPageData first
1017
- // so the canvas keeps showing the previous logo while the
1018
- // re-render is in flight. Without this the logoImageBase64Url
1019
- // fields are undefined (snapshot is stripped pre-purchase) and
1020
- // the canvas flickers blank for ~500-1500ms.
1021
- editableLogoStore.stampLogoBase64IntoBrandPageData();
1022
-
1023
- try {
1024
- await editableLogoStore.updateEditableLogoImageUrlAsync();
1025
- } catch (error) {
1026
- console.error(
1027
- 'brandpage-maker-store: failed to re-render logo on history apply',
1028
- error,
1029
- );
1030
- }
1031
- }
1032
- },
1033
-
1034
- /**
1035
- * Restore the active page after a history apply. The id passed in is
1036
- * already validated against the restored nav by the history store; if
1037
- * it's undefined (no entry walking back had a viable page), fall back
1038
- * to the first/default route so the URL, `routeStore.currentRoute.params`,
1039
- * `pageNavigation.activePageId`, and the page-tab highlight all line up.
1040
- *
1041
- * `setCurrentActivePage` is called explicitly in addition to
1042
- * `navigateToPageByPageId` because `navigateToPageByPageId` is a no-op
1043
- * when the router instance is undefined (e.g. SSR / unit tests), but the
1044
- * Pinia state must still be updated so the sidebar's `currentPage`
1045
- * getter returns the right page.
1046
- */
1047
- _navigateToActivePage(activePageId?: string): void {
1048
- const pageNavigationStore = usePageNavigationStore();
1049
-
1050
- let targetPageId = activePageId;
1051
-
1052
- if (!targetPageId) {
1053
- const fallbackRoute = pageNavigationStore.routes.length
1054
- ? pageNavigationStore.getFirstOrDefaultRoute()
1055
- : undefined;
1056
-
1057
- targetPageId = fallbackRoute?.pageId;
1058
- }
1059
-
1060
- if (!targetPageId) return;
1061
-
1062
- // Skip both the Pinia write and the router push when the target page
1063
- // is already active. The router push fires `router.afterEach` even
1064
- // for same-page navigation, and BrandPageMaker.mixin's afterEach hook
1065
- // resets the content-settings modeStack — which would snap the
1066
- // sidebar back to the default Content tab on every undo/redo,
1067
- // regardless of whether the user was deep-editing a content item.
1068
- if (pageNavigationStore.activePageId === targetPageId) return;
1069
-
1070
- pageNavigationStore.setCurrentActivePage({ pageId: targetPageId });
1071
- navigateToPageByPageId(targetPageId);
1072
- },
1073
-
1074
- _fallbackSidebarIfSelectedContentMissing(snapshot: BrandPageModel): void {
1075
- const contentSettingsStore = useUiContentSettingsStore();
1076
- const sideBarStore = useUiSideBarStore();
1077
-
1078
- const selectedItemId = contentSettingsStore.selectedItemId;
1079
-
1080
- if (!selectedItemId) return;
1081
-
1082
- const existingContentIds = new Set<string>();
1083
-
1084
- snapshot.pages?.forEach((page) => {
1085
- page.contents?.forEach((content) => {
1086
- if (content?.id) existingContentIds.add(content.id);
1087
- });
1088
- });
1089
-
1090
- if (existingContentIds.has(selectedItemId)) return;
1091
-
1092
- // The previously-selected content was undone away. Restore the
1093
- // Content tab's natural landing state — the same shape produced
1094
- // when the user clicks the Content tab fresh — instead of leaving
1095
- // the sidebar stuck rendering `<FocusedContentItemSettings>` for
1096
- // a missing item, which paints a blank panel.
1097
- //
1098
- // `resetMode()` pops the modeStack back to the base `edit` entry
1099
- // (the default landing mode); clearing `selectedItemId` releases
1100
- // the pointer to the now-deleted item.
1101
- sideBarStore.setSelectedTabName({
1102
- tabName: SIDE_BAR_TAB_NAMES.CONTENT_SETTINGS,
1103
- });
1104
- contentSettingsStore.resetMode();
1105
- contentSettingsStore.selectedItemId = null;
1106
- contentSettingsStore.selectedItemFieldName = null;
1107
- contentSettingsStore.selectedItemIndex = null;
1108
- contentSettingsStore.selectedItemValue = null;
1109
742
  },
1110
743
  export(): BrandPageModel {
1111
744
  const data = this.brandPageData;
@@ -14,11 +14,6 @@ export interface LogoDraftAsset {
14
14
  tick: number;
15
15
  isByo: boolean;
16
16
  logoEditUrl?: string;
17
- // The `logoTemplateAsset` active when this draft was created. Stamped at
18
- // upload/setState time so undo/redo can restore the right template token
19
- // + isByo flag from a snapshot's `logoDraftToken` alone — without us
20
- // bloating each history entry with a copy of the asset.
21
- templateAsset?: LogoTemplateAsset;
22
17
  }
23
18
 
24
19
  export interface LogoStoreState {
@@ -33,7 +33,6 @@ export const useBrandPageMakerUserStore = defineStore('brandPageMakerUser', {
33
33
  canUseGettyVideos: false,
34
34
  canUseGoogleAdsense: false,
35
35
  googleAdsenseEnabled: false,
36
- canUseUndoRedo: false,
37
36
  },
38
37
  emailAddress: '',
39
38
  hasPremiumSubscription: false,
@@ -1126,9 +1126,7 @@
1126
1126
  "quickLinkBar": {
1127
1127
  "myWebPageLabel": "My web page:",
1128
1128
  "copyButton": "Copy",
1129
- "copiedButton": "Copied!",
1130
- "undoLabel": "Undo",
1131
- "redoLabel": "Redo"
1129
+ "copiedButton": "Copied!"
1132
1130
  },
1133
1131
  "saveContactSettings": {
1134
1132
  "saveContentInfo": "Let visitors save your contact information when they view your Digital Business Card",
@@ -14,7 +14,6 @@ export interface UIUserFeatures {
14
14
  canUseGettyVideos: boolean;
15
15
  canUseGoogleAdsense: boolean;
16
16
  googleAdsenseEnabled: boolean;
17
- canUseUndoRedo: boolean;
18
17
  }
19
18
 
20
19
  export const TEMPLATE_FIRST_PAGE_NO = 1;
@@ -29,7 +29,6 @@ import {
29
29
  } from '@brand-page-maker/utils';
30
30
  import { useUiStyleSettingsStore } from '../../../style-settings/store';
31
31
  import { usePageNavigationStore } from '../../../../shared/page-navigation/store/page-navigation-store';
32
- import { useHistoryStore } from '@brand-page-maker/stores/history/history-store';
33
32
 
34
33
  interface CategoryTab {
35
34
  category: string;
@@ -45,7 +44,6 @@ export default defineComponent({
45
44
  const styleSettingsStore = useUiStyleSettingsStore();
46
45
  const userStore = useBrandPageMakerUserStore();
47
46
  const eventTracker = useEventTracker();
48
- const historyStore = useHistoryStore();
49
47
  const { externalEditor } = useExternalRichTextEditor();
50
48
 
51
49
  return {
@@ -67,7 +65,6 @@ export default defineComponent({
67
65
  pageSettingsStore,
68
66
  styleSettingsStore,
69
67
  eventTracker,
70
- historyStore,
71
68
  externalEditor,
72
69
  };
73
70
  },
@@ -84,8 +81,6 @@ export default defineComponent({
84
81
  },
85
82
  mounted() {
86
83
  if (this.canUseRichTextEditor) {
87
- // RTE rewrap on tab mount — fold into current head.
88
- this.historyStore.mergeNextMutation();
89
84
  switchAllContentToRTE(
90
85
  this.pageSettingsStore,
91
86
  this.externalEditor,
@@ -32,7 +32,6 @@ export const Sample = (): any => {
32
32
  canUseGettyVideos: true,
33
33
  canUseGoogleAdsense: false,
34
34
  googleAdsenseEnabled: false,
35
- canUseUndoRedo: false,
36
35
  };
37
36
 
38
37
  const pinia = setupStoryPinia();
@@ -76,12 +76,6 @@ export default defineComponent({
76
76
  schema: 'https',
77
77
  textIcon: 'globe',
78
78
  textIcons: [] as string[],
79
- // Display-only override for the focused URL input. While a row is
80
- // focused we strip the schema visually but MUST NOT mutate modelValue —
81
- // doing so would land in the store and trigger a spurious undo/redo
82
- // history entry between focus and blur (BP-5506).
83
- focusedIndex: null as number | null,
84
- focusedDisplay: '',
85
79
  }),
86
80
  computed: {
87
81
  items: {
@@ -168,26 +162,15 @@ export default defineComponent({
168
162
  },
169
163
 
170
164
  onFocusOverride(index: number, itemValue: string): void {
165
+ const value = [...this.modelValue];
171
166
  const match = URL_RE.exec(itemValue);
172
167
 
173
168
  if (match) {
174
169
  this.schema = match[1];
175
- this.focusedIndex = index;
176
- this.focusedDisplay = match[2];
177
- } else {
178
- this.focusedIndex = index;
179
- this.focusedDisplay = itemValue;
170
+ value[index][this.valuePropName] = match[2];
180
171
  }
181
172
  },
182
- inputDisplayValue(index: number): string {
183
- return this.focusedIndex === index
184
- ? this.focusedDisplay
185
- : this.itemValue(index);
186
- },
187
173
  onBlurOverride(index: number, itemValue: string): void {
188
- this.focusedIndex = null;
189
- this.focusedDisplay = '';
190
-
191
174
  const value = [...this.modelValue];
192
175
 
193
176
  let isValid = true;
@@ -70,7 +70,7 @@
70
70
  hasError[index],
71
71
  }"
72
72
  :placeholder="placeholderPrefix"
73
- :value="inputDisplayValue(index)"
73
+ :value="itemValue(index)"
74
74
  :data-test-tag="'image-url-text-input'"
75
75
  @focus="onFocusOverride(index, $event.target.value)"
76
76
  @blur="onBlurOverride(index, $event.target.value)"
@@ -1,4 +1,4 @@
1
- import { defineComponent, ref, watch } from 'vue';
1
+ import { defineComponent, ref } from 'vue';
2
2
  import type { PropType } from 'vue';
3
3
  import type { FormField } from '@brand-page';
4
4
  import { formFieldsTr } from '@src/composables/useTranslate';
@@ -49,34 +49,18 @@ export default defineComponent({
49
49
  },
50
50
  ];
51
51
 
52
- const valueWithState = ref(
53
- props.value.map((field) => ({
54
- field,
55
- isCollapsed: true,
56
- isTypeDropdownOpen: false,
57
- })),
58
- );
59
-
60
- // Re-sync when the store-bound value changes externally (e.g. undo/redo
61
- // via history-store). Preserve per-row UI flags (isCollapsed,
62
- // isTypeDropdownOpen) by index so an undo doesn't snap rows back to
63
- // collapsed state.
64
- watch(
65
- () => props.value,
66
- (newVal) => {
67
- valueWithState.value = newVal.map((field, index) => ({
68
- field,
69
- isCollapsed: valueWithState.value[index]?.isCollapsed ?? true,
70
- isTypeDropdownOpen:
71
- valueWithState.value[index]?.isTypeDropdownOpen ?? false,
72
- }));
73
- },
74
- );
75
-
76
52
  return {
77
53
  formFieldsTr,
78
54
  typeList,
79
- valueWithState,
55
+ valueWithState: ref(
56
+ props.value.map((field) => {
57
+ return {
58
+ field: field,
59
+ isCollapsed: true,
60
+ isTypeDropdownOpen: false,
61
+ };
62
+ }),
63
+ ),
80
64
  };
81
65
  },
82
66
  methods: {