@designcrowd/library.brand-page 5.17.25-undo-21 → 5.17.25

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 (115) hide show
  1. package/lib/src/{CreatedOnBrandCrowd-de-de-Bze5WUip.js → CreatedOnBrandCrowd-de-de-9YvB5ocm.js} +1 -1
  2. package/lib/src/{CreatedOnBrandCrowd-en-us-Dw5uSnX8.js → CreatedOnBrandCrowd-en-us-B8OpZpMP.js} +1 -1
  3. package/lib/src/{CreatedOnBrandCrowd-es-es-Cz-oPdjt.js → CreatedOnBrandCrowd-es-es-D_d6SwvE.js} +1 -1
  4. package/lib/src/{CreatedOnBrandCrowd-fr-fr-zldLXw3G.js → CreatedOnBrandCrowd-fr-ca-CPqNeevd.js} +1 -1
  5. package/lib/src/{CreatedOnBrandCrowd-fr-ca-zldLXw3G.js → CreatedOnBrandCrowd-fr-fr-CPqNeevd.js} +1 -1
  6. package/lib/src/{CreatedOnBrandCrowd-pt-pt-64QJpEaD.js → CreatedOnBrandCrowd-pt-br-D0DpxtjY.js} +1 -1
  7. package/lib/src/{CreatedOnBrandCrowd-pt-br-64QJpEaD.js → CreatedOnBrandCrowd-pt-pt-D0DpxtjY.js} +1 -1
  8. package/lib/src/{CreatedOnDcom-de-de-8SXOvjEH.js → CreatedOnDcom-de-de-BLKiD1pl.js} +1 -1
  9. package/lib/src/{CreatedOnDcom-en-us-ClZBYY_t.js → CreatedOnDcom-en-us-DGNjFV5B.js} +1 -1
  10. package/lib/src/{CreatedOnDcom-es-es-xg4ZwvEb.js → CreatedOnDcom-es-es-C2IDMZZe.js} +1 -1
  11. package/lib/src/{CreatedOnDcom-fr-ca-4zo2gxc1.js → CreatedOnDcom-fr-ca-ZRxz3QKj.js} +1 -1
  12. package/lib/src/{CreatedOnDcom-fr-fr-Dw9Fuy7U.js → CreatedOnDcom-fr-fr-5bE7oSdF.js} +1 -1
  13. package/lib/src/{CreatedOnDcom-pt-br-Dbl0EWcU.js → CreatedOnDcom-pt-br-WCumEx63.js} +1 -1
  14. package/lib/src/{CreatedOnDcom-pt-pt-Bps73oQE.js → CreatedOnDcom-pt-pt-C8Hinnmg.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 -10
  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 -23
  21. package/lib/src/brand-page-maker/components/brandpage-settings/ReplaceImageSettingsForBrandPageSettings.mixin.d.ts +2 -7
  22. package/lib/src/brand-page-maker/components/quick-link-bar/QuickLinkBar.mixin.d.ts +0 -3
  23. package/lib/src/brand-page-maker/components/quick-link-bar/QuickLinkBar.mixin.js +0 -11
  24. package/lib/src/brand-page-maker/components/seo-settings/SeoPageSettings.mixin.d.ts +2 -7
  25. package/lib/src/brand-page-maker/components/seo-settings/UrlSettings.mixin.d.ts +2 -7
  26. package/lib/src/brand-page-maker/components/social-share/SocialShare.mixin.d.ts +2 -7
  27. package/lib/src/brand-page-maker/components/template-preview/TemplatePreview.mixin.d.ts +2 -7
  28. package/lib/src/brand-page-maker/composables/ai-chat/useAiWebsiteBuilderChat.js +0 -9
  29. package/lib/src/brand-page-maker/composables/rich-text-editor/useRichTextEditor.js +1 -17
  30. package/lib/src/brand-page-maker/composables/useEventTracker.d.ts +0 -20
  31. package/lib/src/brand-page-maker/composables/useEventTracker.js +0 -17
  32. package/lib/src/brand-page-maker/stores/ai-thread/ai-website-builder-thread-store.d.ts +1 -1
  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 -247
  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-Bu_5FO26.js +173 -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 +17 -22
  41. package/lib/src/css/library.brand-page-brandPage.min.css +18 -22
  42. package/lib/src/css/library.brand-page-designCom.min.css +17 -22
  43. package/lib/src/css/library.brand-page-preview.min.css +17 -22
  44. package/lib/src/index.mjs +1 -1
  45. package/lib/src/{lib-BgvZxeSl.js → lib-BF9ONIgx.js} +23292 -23913
  46. package/lib/src/shared/content-settings/components/GenericTextInput.mixin.d.ts +1 -1
  47. package/lib/src/shared/content-settings/components/content-settings/ContentSettings.mixin.d.ts +2 -23
  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/email-field/EmailField.mixin.d.ts +1 -1
  55. package/lib/src/shared/content-settings/components/form-fields-field/FormFieldsField.mixin.js +8 -18
  56. package/lib/src/shared/content-settings/components/radio-field/RadioField.mixin.d.ts +1 -1
  57. package/lib/src/shared/content-settings/components/tel-field/TelField.mixin.d.ts +1 -1
  58. package/lib/src/shared/content-settings/components/text-field/TextField.mixin.d.ts +1 -1
  59. package/lib/src/shared/content-settings/components/textarea-field/TextareaField.mixin.d.ts +1 -1
  60. package/lib/src/shared/content-settings/components/url-field/UrlField.mixin.d.ts +1 -1
  61. package/lib/src/shared/content-settings/components/youtube-video-field/YoutubeVideoField.mixin.d.ts +1 -1
  62. package/lib/src/shared/logo-settings/components/EditLogoSettings.mixin.d.ts +0 -18
  63. package/lib/src/shared/logo-settings/components/EditLogoSettings.mixin.js +0 -11
  64. package/lib/src/shared/logo-settings/components/LogoSettings.mixin.d.ts +2 -9
  65. package/lib/src/shared/logo-settings/store/editable-logo-store.d.ts +1 -9
  66. package/lib/src/shared/logo-settings/store/editable-logo-store.js +0 -33
  67. package/lib/src/shared/page-settings/components/page-settings/PageSettings.mixin.d.ts +2 -24
  68. package/lib/src/shared/page-settings/components/page-settings-section-styles/PageSettingsSectionStyles.mixin.d.ts +2 -9
  69. package/lib/src/shared/publish-brand-page-with-state/PublishBrandPageModalWithState.mixin.d.ts +2 -23
  70. package/lib/src/shared/side-bar/components/SideBarTabButton.mixin.d.ts +0 -16
  71. package/lib/src/shared/style-settings/components/StyleSettings.mixin.d.ts +2 -23
  72. package/lib/src/shared/template-settings/components/TemplatesSettings.mixin.d.ts +0 -16
  73. package/package.json +1 -1
  74. package/src/brand-page/components/video/Video.vue +0 -2
  75. package/src/brand-page-maker/components/brand-page-maker/BrandPageMaker.mixin.ts +0 -11
  76. package/src/brand-page-maker/components/brand-page-maker/BrandPageMaker.vue +3 -2
  77. package/src/brand-page-maker/components/brand-page-maker/__fixtures__/brand-page-examples.ts +0 -1
  78. package/src/brand-page-maker/components/cookie-collection/CookieSettings.vue +17 -18
  79. package/src/brand-page-maker/components/quick-link-bar/QuickLinkBar.mixin.ts +0 -13
  80. package/src/brand-page-maker/components/quick-link-bar/QuickLinkBar.vue +4 -14
  81. package/src/brand-page-maker/components/quick-link-bar/i18n/quick-link-bar.json +1 -3
  82. package/src/brand-page-maker/components/save-contact/SaveContact.vue +19 -12
  83. package/src/brand-page-maker/composables/ai-chat/useAiWebsiteBuilderChat.ts +0 -10
  84. package/src/brand-page-maker/composables/rich-text-editor/useRichTextEditor.ts +1 -20
  85. package/src/brand-page-maker/composables/useEventTracker.ts +0 -29
  86. package/src/brand-page-maker/stores/brandpage-maker/brandpage-maker-store.test.ts +0 -166
  87. package/src/brand-page-maker/stores/brandpage-maker/brandpage-maker-store.ts +4 -287
  88. package/src/brand-page-maker/stores/logo-store/logo-store.ts +0 -5
  89. package/src/brand-page-maker/stores/user/user-store.ts +0 -1
  90. package/src/bundles/bundled-translations.json +1 -3
  91. package/src/constants/ui.ts +0 -1
  92. package/src/shared/content-settings/components/content-settings/ContentSettings.stories.ts +0 -1
  93. package/src/shared/content-settings/components/draggable-item-list/DraggableItemList.mixin.ts +2 -19
  94. package/src/shared/content-settings/components/draggable-item-list/DraggableItemList.vue +1 -1
  95. package/src/shared/content-settings/components/form-fields-field/FormFieldsField.mixin.ts +10 -26
  96. package/src/shared/content-settings/components/logo-selection-field/LogoSelection.vue +48 -63
  97. package/src/shared/content-settings/components/text-field/TextField.vue +0 -1
  98. package/src/shared/content-settings/components/text-image-field/TextImageField.vue +4 -33
  99. package/src/shared/logo-settings/components/EditLogoSettings.mixin.ts +0 -11
  100. package/src/shared/logo-settings/store/editable-logo-store.ts +1 -45
  101. package/lib/src/brand-page-maker/composables/useUndoRedoFlag.d.ts +0 -16
  102. package/lib/src/brand-page-maker/composables/useUndoRedoFlag.js +0 -22
  103. package/lib/src/brand-page-maker/stores/history/history-store.d.ts +0 -104
  104. package/lib/src/brand-page-maker/stores/history/history-store.js +0 -836
  105. package/lib/src/bundled-translations-CWHKs3in.js +0 -173
  106. package/lib/src/metadata-builder/builders/reorder-pages-builder.d.ts +0 -13
  107. package/lib/src/metadata-builder/builders/reorder-pages-builder.js +0 -49
  108. package/src/brand-page-maker/components/quick-link-bar/RedoButton.test.ts +0 -166
  109. package/src/brand-page-maker/components/quick-link-bar/RedoButton.vue +0 -66
  110. package/src/brand-page-maker/components/quick-link-bar/UndoButton.test.ts +0 -166
  111. package/src/brand-page-maker/components/quick-link-bar/UndoButton.vue +0 -66
  112. package/src/brand-page-maker/composables/useUndoRedoFlag.ts +0 -26
  113. package/src/brand-page-maker/stores/history/history-store.test.ts +0 -1246
  114. package/src/brand-page-maker/stores/history/history-store.ts +0 -1041
  115. package/src/metadata-builder/builders/reorder-pages-builder.ts +0 -80
@@ -177,55 +177,16 @@ export declare const useBrandPageMakerStore: import("pinia").StoreDefinition<"br
177
177
  hideChangeTemplateConfirmModal(): void;
178
178
  onBackgroundChanged(): void;
179
179
  onChangeTemplateConfirmModalCancel(): void;
180
- onChangeTemplateConfirmModalConfirm(): Promise<void>;
180
+ onChangeTemplateConfirmModalConfirm(): void;
181
181
  onContentChanged(): void;
182
182
  onStyleChanged(): void;
183
- onTemplateSelected(payload: OnTemplateSelectedPayload): Promise<void>;
183
+ onTemplateSelected(payload: OnTemplateSelectedPayload): void;
184
184
  setSelectedTabName(payload: any): void;
185
185
  showNextNotificationMessage(): Promise<void>;
186
186
  updateContent<TContent extends Content, P extends {
187
187
  id: string;
188
188
  content: TContent;
189
189
  }>(payload: P): Promise<void>;
190
- /**
191
- * Restore every store that the `brandPageData` getter reads from, so undo
192
- * and redo bring back the EXACT document state captured at snapshot time.
193
- *
194
- * `initialiseStoresByBrandPageModelAsync` is too narrow for undo/redo — it
195
- * only rehydrates pages, sections, and nav structure, which is enough for
196
- * the AI-apply path but leaves navigation styles, backgrounds, button/text/
197
- * logo/gallery styles, shop config, and several own-store fields unchanged.
198
- * This action mirrors the full hydration surface of `applySelectedTemplate`
199
- * (minus the template-specific logo/personalisation logic) so a restore is
200
- * a complete round-trip of what `brandPageData` returns.
201
- *
202
- * Called ONLY by history-store during undo/redo. The history store sets
203
- * `isApplyingSnapshot=true` across this call to prevent the deep-watcher
204
- * on `brandPageData` from re-capturing the restored state.
205
- */
206
- /**
207
- * Force-commit a `template_switch` entry to the history store, if the
208
- * history store has a baseline (which only happens when the undo/redo
209
- * feature flag is on — see `BrandPageMaker.mixin.ts`).
210
- */
211
- _captureTemplateSwitchIfEnabled(): void;
212
- applyHistorySnapshot(snapshot: BrandPageModel, activePageId?: string): Promise<void>;
213
- _syncLogoSettingsFromSnapshot(snapshot: BrandPageModel): void;
214
- /**
215
- * Restore the active page after a history apply. The id passed in is
216
- * already validated against the restored nav by the history store; if
217
- * it's undefined (no entry walking back had a viable page), fall back
218
- * to the first/default route so the URL, `routeStore.currentRoute.params`,
219
- * `pageNavigation.activePageId`, and the page-tab highlight all line up.
220
- *
221
- * `setCurrentActivePage` is called explicitly in addition to
222
- * `navigateToPageByPageId` because `navigateToPageByPageId` is a no-op
223
- * when the router instance is undefined (e.g. SSR / unit tests), but the
224
- * Pinia state must still be updated so the sidebar's `currentPage`
225
- * getter returns the right page.
226
- */
227
- _navigateToActivePage(activePageId?: string): void;
228
- _fallbackSidebarIfSelectedContentMissing(snapshot: BrandPageModel): void;
229
190
  export(): BrandPageModel;
230
191
  setBrandPageType({ brandPageType }: {
231
192
  brandPageType: BrandPageType;
@@ -11,7 +11,7 @@ import { useShopConfigStore } from '@shared/ecommerce-settings/store/shop-settin
11
11
  import { usePageNavigationStore } from '@shared/page-navigation/store/page-navigation-store';
12
12
  import { applyLogoThemeToBrandPageModel, migrateBrandPageModel, applyUserPersonalisationToBrandPageModelAsync, getBrandPageViewModelFromBrandPageModel, isLogoContent, parseLogoThemeToCssStyles, logoUtil, GetLatestModelVersion, } from '@brand-page/utils';
13
13
  import { navigateToPageByPageId } from '../../routing';
14
- import { BRANDPAGE_DEFAULT_ERROR_MESSAGE_DESCRIPTION, BRANDPAGE_DEFAULT_SAVE_MESSAGE_DESCRIPTION, MAKER_MOBILE_BREAKPOINT, MESSAGE_VISIBLE_DURATION, SIDE_BAR_TAB_NAMES, } from '@brand-page-maker/constants';
14
+ import { BRANDPAGE_DEFAULT_ERROR_MESSAGE_DESCRIPTION, BRANDPAGE_DEFAULT_SAVE_MESSAGE_DESCRIPTION, MAKER_MOBILE_BREAKPOINT, MESSAGE_VISIBLE_DURATION, } from '@brand-page-maker/constants';
15
15
  import { useUiSideBarStore } from '@shared/side-bar/store';
16
16
  import { delayInMS } from '../../../utils/ui-util';
17
17
  import { useUiContentSettingsStore } from '@shared/content-settings/store';
@@ -32,7 +32,6 @@ import { useConsent } from '@brand-page/composables/consent.composable';
32
32
  import { commonTr, errorTr } from '@src/composables/useTranslate';
33
33
  import { UPGRADE_CTA_LOCATIONS } from '../../composables/useEventTracker';
34
34
  import { useVideoStore } from '../video';
35
- import { useHistoryStore } from '../history/history-store';
36
35
  import { findValuesByKey } from '../../../helpers/ts.helper';
37
36
  import { useLogoStore } from '../logo-store';
38
37
  const brandPageTypeTemplateTypeMap = {
@@ -387,15 +386,6 @@ export const useBrandPageMakerStore = defineStore('brandPageMaker', {
387
386
  description: payload.noDescription ? '' : description,
388
387
  },
389
388
  });
390
- // Any successful save re-baselines the undo stack so a user can't
391
- // undo back past the persisted state. This covers Save Progress /
392
- // Publish AND settings-only saves (updateBrandPage,
393
- // updateSensitiveContent, admin saveTemplate) — settings-tab
394
- // actions persist the metadata, so allowing undo to roll them
395
- // back would let the local stack drift from what's saved.
396
- // reset() no-ops in non-undo-redo sessions (no baseline = nothing
397
- // to clear).
398
- useHistoryStore().reset();
399
389
  },
400
390
  hideChangeTemplateConfirmModal() {
401
391
  this.setIsChangeTemplateConfirmModalVisible({
@@ -409,11 +399,10 @@ export const useBrandPageMakerStore = defineStore('brandPageMaker', {
409
399
  this.setSelectedTemplateId({ templateId: false });
410
400
  this.hideChangeTemplateConfirmModal();
411
401
  },
412
- async onChangeTemplateConfirmModalConfirm() {
413
- await this.applySelectedTemplate();
402
+ onChangeTemplateConfirmModalConfirm() {
403
+ this.applySelectedTemplate();
414
404
  this.hideChangeTemplateConfirmModal();
415
405
  this.isModifiedAfterTemplateApplied = false;
416
- this._captureTemplateSwitchIfEnabled();
417
406
  },
418
407
  onContentChanged() {
419
408
  this.setIsModifiedAfterTemplateApplied();
@@ -421,7 +410,7 @@ export const useBrandPageMakerStore = defineStore('brandPageMaker', {
421
410
  onStyleChanged() {
422
411
  this.setIsModifiedAfterTemplateApplied();
423
412
  },
424
- async onTemplateSelected(payload) {
413
+ onTemplateSelected(payload) {
425
414
  this.setSelectedTemplateId({
426
415
  templateId: payload.templateId,
427
416
  });
@@ -431,8 +420,7 @@ export const useBrandPageMakerStore = defineStore('brandPageMaker', {
431
420
  });
432
421
  }
433
422
  else {
434
- await this.applySelectedTemplate();
435
- this._captureTemplateSwitchIfEnabled();
423
+ this.applySelectedTemplate();
436
424
  }
437
425
  },
438
426
  setSelectedTabName(payload) {
@@ -458,236 +446,6 @@ export const useBrandPageMakerStore = defineStore('brandPageMaker', {
458
446
  async updateContent(payload) {
459
447
  const uiContentSettingsStore = useUiContentSettingsStore();
460
448
  uiContentSettingsStore.updateContent(payload);
461
- // NOTE (Bolt 1, 2026-04-23): this action is not the actual edit path used
462
- // by the UI — sidebar inputs call uiContentSettingsStore.updateItemValue
463
- // directly. History capture is driven by a deep `watch(brandPageData, ...)`
464
- // installed in history-store once the baseline is captured, so we do not
465
- // need to instrument this action. Kept here as a pass-through because
466
- // removing it may affect other callers.
467
- },
468
- /**
469
- * Restore every store that the `brandPageData` getter reads from, so undo
470
- * and redo bring back the EXACT document state captured at snapshot time.
471
- *
472
- * `initialiseStoresByBrandPageModelAsync` is too narrow for undo/redo — it
473
- * only rehydrates pages, sections, and nav structure, which is enough for
474
- * the AI-apply path but leaves navigation styles, backgrounds, button/text/
475
- * logo/gallery styles, shop config, and several own-store fields unchanged.
476
- * This action mirrors the full hydration surface of `applySelectedTemplate`
477
- * (minus the template-specific logo/personalisation logic) so a restore is
478
- * a complete round-trip of what `brandPageData` returns.
479
- *
480
- * Called ONLY by history-store during undo/redo. The history store sets
481
- * `isApplyingSnapshot=true` across this call to prevent the deep-watcher
482
- * on `brandPageData` from re-capturing the restored state.
483
- */
484
- /**
485
- * Force-commit a `template_switch` entry to the history store, if the
486
- * history store has a baseline (which only happens when the undo/redo
487
- * feature flag is on — see `BrandPageMaker.mixin.ts`).
488
- */
489
- _captureTemplateSwitchIfEnabled() {
490
- const historyStore = useHistoryStore();
491
- if (!historyStore.baselineCaptured)
492
- return;
493
- historyStore.captureTemplateSwitch();
494
- },
495
- async applyHistorySnapshot(snapshot, activePageId) {
496
- const styleSettingsStore = useUiStyleSettingsStore();
497
- const navigationStyleSettingsStore = useUiNavigationStyleSettingsStore();
498
- const backgroundSettingsStore = useUiBackgroundSettingsStore();
499
- const pageNavigationStore = usePageNavigationStore();
500
- const shopStore = useShopConfigStore();
501
- // 1. Pages + header/footer sections (also covers content items).
502
- this.initialisePagesForCurrentPage({
503
- pages: snapshot.pages,
504
- sections: {
505
- [PAGE_SECTIONS.header]: {
506
- [VIEWPORTS.desktop]: snapshot.pageHeaderDesktop,
507
- [VIEWPORTS.mobile]: snapshot.pageHeaderMobile,
508
- },
509
- [PAGE_SECTIONS.footer]: {
510
- [VIEWPORTS.desktop]: snapshot.pageFooterDesktop,
511
- [VIEWPORTS.mobile]: snapshot.pageFooterMobile,
512
- },
513
- },
514
- });
515
- // 2. Page-level nav structure (routes, orders).
516
- pageNavigationStore.setNav({ nav: snapshot.nav });
517
- // 3. Navigation STYLES (header/footer nav colors, alignment, etc.) —
518
- // this is the bit that was being dropped before.
519
- // Use function-form $patch so each nested style object is replaced as a
520
- // whole reference. The object-form $patch (used by setState) deep-merges
521
- // and would leave keys present in the live state but absent from the
522
- // snapshot in place — e.g. switching button styles then undoing would
523
- // leave the new style's borderRadius/borderStyle/borderWidth applied.
524
- navigationStyleSettingsStore.$patch((state) => {
525
- state.navigation[PAGE_SECTIONS.header][VIEWPORTS.desktop] =
526
- new NavigationDesktop(snapshot.pageHeaderDesktop?.navigation);
527
- state.navigation[PAGE_SECTIONS.header][VIEWPORTS.mobile] =
528
- new NavigationMobile(snapshot.pageHeaderMobile?.navigation);
529
- });
530
- // 4. Global styles (logo, button, text, gallery). Same whole-reference
531
- // replacement reasoning as step 3.
532
- styleSettingsStore.$patch((state) => {
533
- state.buttonStyles = snapshot.styles.buttonStyles;
534
- state.logoStyles = snapshot.styles.logoStyles;
535
- state.textStyles = snapshot.styles.textStyles;
536
- state.galleryStyles = snapshot.styles.galleryStyles;
537
- });
538
- // 5. Background styles. Same whole-reference replacement reasoning as
539
- // step 3 — `setBackgroundStyles` calls per-field setters that
540
- // `Object.assign` partials onto the live `style` and
541
- // `backgroundShapeStyle` objects, so keys from the previous mode
542
- // (e.g. background image url, shape style props) would survive an
543
- // undo back to a state that doesn't have them.
544
- backgroundSettingsStore.$patch((state) => {
545
- state.backgroundStyles = snapshot.styles.backgroundStyles;
546
- });
547
- backgroundSettingsStore.onBackgroundChanged();
548
- // 6. Shop products are derived from shop-content blocks inside `pages`,
549
- // so they're already implicitly restored at step 1. Re-run the shop
550
- // store's derivation to keep `products` in sync with the snapshot
551
- // pages. paymentConfig is intentionally NOT restored — selecting it is
552
- // backend-confirmed (Stripe Connect / payment-provider linkage) per
553
- // project-guardrails.md, so it must persist across undo. We pass the
554
- // live paymentConfig back in to preserve it.
555
- shopStore.initialiseShopStore({
556
- paymentConfig: shopStore.paymentConfig,
557
- pages: snapshot.pages ?? [],
558
- });
559
- // 7. Own-store scalar fields surfaced by the brandPageData getter.
560
- if (snapshot.isModifiedAfterTemplateApplied !== undefined) {
561
- this.isModifiedAfterTemplateApplied =
562
- snapshot.isModifiedAfterTemplateApplied;
563
- }
564
- if (snapshot.brandPageType) {
565
- this.setBrandPageType({ brandPageType: snapshot.brandPageType });
566
- }
567
- this.faviconUrl = snapshot.faviconUrl;
568
- this.ogImageUrl = snapshot.ogImageUrl;
569
- this.measurementID = snapshot.measurementID;
570
- this.adsenseID = snapshot.adsenseID;
571
- this.ogTitle = snapshot.ogTitle;
572
- this.ogDescription = snapshot.ogDescription;
573
- this.cookieOptions = snapshot.cookieOptions;
574
- this.saveContactSettings = snapshot.saveContactSettings;
575
- // 8. Re-sync the logo-settings sidebar's `selectedLogoImage` from the
576
- // restored header logo. The preview rehydrates via the page contents,
577
- // but `uiLogoSettings` holds its own copy that drives the sidebar
578
- // "current logo" state — same pattern as `initialiseStoresByBrandPageModelAsync`.
579
- // Also restores the variations grid + template asset for the
580
- // snapshot's draft token (both are sidecars to `brandPageData` —
581
- // BYO upload mutates them out of band).
582
- this._syncLogoSettingsFromSnapshot(snapshot);
583
- // 9. If the sidebar is editing a content item that no longer exists in
584
- // the restored page, fall back to the Content tab so the user doesn't
585
- // stare at a blank settings panel.
586
- this._fallbackSidebarIfSelectedContentMissing(snapshot);
587
- // 10. Switch to the page the user was viewing when this entry was
588
- // captured (or the closest still-existing page if the captured
589
- // page was the one being undone-away). The history store does the
590
- // walk-back resolution and passes us a pageId that's guaranteed to
591
- // exist in the restored nav — or undefined if no entry walking
592
- // back has a viable id, in which case we fall through to the
593
- // first/default route. Without this, the page-tabs carousel keeps
594
- // highlighting whatever page slug is in the URL (which can no
595
- // longer match any nav item after a page-add undo) and the
596
- // sidebar's `currentPage` getter silently falls back to page 0.
597
- this._navigateToActivePage(activePageId);
598
- },
599
- _syncLogoSettingsFromSnapshot(snapshot) {
600
- const logoSettingsStore = useUiLogoSettingsStore();
601
- const editableLogoStore = useUiEditableLogoStore();
602
- const logoStore = useLogoStore();
603
- const logoImage = snapshot.brandPageType === BRAND_PAGE_TYPES.default
604
- ? snapshot.pages?.[0]?.contents?.find((c) => c.type === 'logo')?.logoImage
605
- : snapshot.pageHeaderDesktop?.logoImage;
606
- if (!logoImage)
607
- return;
608
- logoSettingsStore.setState({
609
- newState: { selectedLogoImage: logoImage },
610
- });
611
- const draftToken = logoImage.logoDraftToken;
612
- if (!draftToken)
613
- return;
614
- // Re-derive `enableEditMode` and the active template asset from the
615
- // logo-store's draft registry. Drafts are append-only for the session,
616
- // and BYO upload stamps `templateAsset` onto the registered draft when
617
- // it lands — so the registered draft is enough to fully restore the
618
- // sidebar's design/upload chooser without storing anything inside
619
- // each history entry. The variations grid is restored from the
620
- // editable-logo store's per-token cache (populated by every
621
- // `updateEditableLogoImageUrlAsync` render).
622
- const draft = logoStore.getLogoDraftAssetByToken(draftToken);
623
- if (draft) {
624
- editableLogoStore.setEnableEditMode(!draft.isByo);
625
- if (draft.templateAsset) {
626
- logoStore.setLogoTemplateAsset(draft.templateAsset);
627
- }
628
- }
629
- editableLogoStore.setLogoDraftToken(draftToken);
630
- editableLogoStore.restoreVariationsForDraftToken(draftToken);
631
- },
632
- /**
633
- * Restore the active page after a history apply. The id passed in is
634
- * already validated against the restored nav by the history store; if
635
- * it's undefined (no entry walking back had a viable page), fall back
636
- * to the first/default route so the URL, `routeStore.currentRoute.params`,
637
- * `pageNavigation.activePageId`, and the page-tab highlight all line up.
638
- *
639
- * `setCurrentActivePage` is called explicitly in addition to
640
- * `navigateToPageByPageId` because `navigateToPageByPageId` is a no-op
641
- * when the router instance is undefined (e.g. SSR / unit tests), but the
642
- * Pinia state must still be updated so the sidebar's `currentPage`
643
- * getter returns the right page.
644
- */
645
- _navigateToActivePage(activePageId) {
646
- const pageNavigationStore = usePageNavigationStore();
647
- let targetPageId = activePageId;
648
- if (!targetPageId) {
649
- const fallbackRoute = pageNavigationStore.routes.length
650
- ? pageNavigationStore.getFirstOrDefaultRoute()
651
- : undefined;
652
- targetPageId = fallbackRoute?.pageId;
653
- }
654
- if (!targetPageId)
655
- return;
656
- pageNavigationStore.setCurrentActivePage({ pageId: targetPageId });
657
- navigateToPageByPageId(targetPageId);
658
- },
659
- _fallbackSidebarIfSelectedContentMissing(snapshot) {
660
- const contentSettingsStore = useUiContentSettingsStore();
661
- const sideBarStore = useUiSideBarStore();
662
- const selectedItemId = contentSettingsStore.selectedItemId;
663
- if (!selectedItemId)
664
- return;
665
- const existingContentIds = new Set();
666
- snapshot.pages?.forEach((page) => {
667
- page.contents?.forEach((content) => {
668
- if (content?.id)
669
- existingContentIds.add(content.id);
670
- });
671
- });
672
- if (existingContentIds.has(selectedItemId))
673
- return;
674
- // The previously-selected content was undone away. Restore the
675
- // Content tab's natural landing state — the same shape produced
676
- // when the user clicks the Content tab fresh — instead of leaving
677
- // the sidebar stuck rendering `<FocusedContentItemSettings>` for
678
- // a missing item, which paints a blank panel.
679
- //
680
- // `resetMode()` pops the modeStack back to the base `edit` entry
681
- // (the default landing mode); clearing `selectedItemId` releases
682
- // the pointer to the now-deleted item.
683
- sideBarStore.setSelectedTabName({
684
- tabName: SIDE_BAR_TAB_NAMES.CONTENT_SETTINGS,
685
- });
686
- contentSettingsStore.resetMode();
687
- contentSettingsStore.selectedItemId = null;
688
- contentSettingsStore.selectedItemFieldName = null;
689
- contentSettingsStore.selectedItemIndex = null;
690
- contentSettingsStore.selectedItemValue = null;
691
449
  },
692
450
  export() {
693
451
  const data = this.brandPageData;
@@ -10,7 +10,6 @@ export interface LogoDraftAsset {
10
10
  tick: number;
11
11
  isByo: boolean;
12
12
  logoEditUrl?: string;
13
- templateAsset?: LogoTemplateAsset;
14
13
  }
15
14
  export interface LogoStoreState {
16
15
  logoTemplateAsset?: LogoTemplateAsset;
@@ -20,7 +20,6 @@ export const useBrandPageMakerUserStore = defineStore('brandPageMakerUser', {
20
20
  canUseAITextGenerator: false,
21
21
  canUseGoogleAdsense: false,
22
22
  googleAdsenseEnabled: false,
23
- canUseUndoRedo: true,
24
23
  },
25
24
  emailAddress: '',
26
25
  hasPremiumSubscription: false,