@designcrowd/library.brand-page 5.18.1-undo-22 → 5.18.1-undo-23
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-Q1oYxhFA.js → CreatedOnBrandCrowd-de-de-AFaRM8AB.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-en-us-QDl7ywkQ.js → CreatedOnBrandCrowd-en-us-Hzq-a60h.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-es-es-DcbldLR8.js → CreatedOnBrandCrowd-es-es-JcJzcPt4.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-fr-fr-CtKg-kmK.js → CreatedOnBrandCrowd-fr-ca-BvfD6_cT.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-fr-ca-CtKg-kmK.js → CreatedOnBrandCrowd-fr-fr-BvfD6_cT.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-pt-pt-B8LdULlM.js → CreatedOnBrandCrowd-pt-br-CvCBHtHz.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-pt-br-B8LdULlM.js → CreatedOnBrandCrowd-pt-pt-CvCBHtHz.js} +1 -1
- package/lib/src/{CreatedOnDcom-de-de-B8a5JB3V.js → CreatedOnDcom-de-de-DY72j1HT.js} +1 -1
- package/lib/src/{CreatedOnDcom-en-us-BxJb4VxH.js → CreatedOnDcom-en-us-CQlkVR3f.js} +1 -1
- package/lib/src/{CreatedOnDcom-es-es-_YCAGVL0.js → CreatedOnDcom-es-es-B308Qq0k.js} +1 -1
- package/lib/src/{CreatedOnDcom-fr-ca-DV5JKmY0.js → CreatedOnDcom-fr-ca-CmZfNZDD.js} +1 -1
- package/lib/src/{CreatedOnDcom-fr-fr-CjGeFt2Y.js → CreatedOnDcom-fr-fr-YEMbYuns.js} +1 -1
- package/lib/src/{CreatedOnDcom-pt-br-fPa9wQ6j.js → CreatedOnDcom-pt-br-DC06ZQTq.js} +1 -1
- package/lib/src/{CreatedOnDcom-pt-pt-BEC57JU6.js → CreatedOnDcom-pt-pt-gbUCpWPU.js} +1 -1
- package/lib/src/brand-page-maker/components/action-bar/ActionBar.mixin.d.ts +2 -2
- package/lib/src/brand-page-maker/components/brand-page-maker/BrandPageMaker.mixin.d.ts +2 -2
- package/lib/src/brand-page-maker/components/brand-page-maker/BrandPageMakerTemplateSettings.mixin.d.ts +2 -2
- package/lib/src/brand-page-maker/components/brandpage-maker-page/BrandPageMakerPage.mixin.d.ts +2 -2
- package/lib/src/brand-page-maker/components/brandpage-settings/ReplaceImageSettingsForBrandPageSettings.mixin.d.ts +2 -2
- package/lib/src/brand-page-maker/components/seo-settings/SeoPageSettings.mixin.d.ts +2 -2
- package/lib/src/brand-page-maker/components/seo-settings/UrlSettings.mixin.d.ts +2 -2
- package/lib/src/brand-page-maker/components/social-share/SocialShare.mixin.d.ts +2 -2
- package/lib/src/brand-page-maker/components/template-preview/TemplatePreview.mixin.d.ts +2 -2
- package/lib/src/brand-page-maker/stores/brandpage-maker/brandpage-maker-store.d.ts +2 -2
- package/lib/src/brand-page-maker/stores/brandpage-maker/brandpage-maker-store.js +33 -4
- package/lib/src/brand-page-maker/stores/history/history-store.d.ts +17 -1
- package/lib/src/brand-page-maker/stores/history/history-store.js +71 -27
- package/lib/src/index.mjs +1 -1
- package/lib/src/{lib-BxlBHrQd.js → lib-gUHeBTLS.js} +8581 -8547
- package/lib/src/shared/content-settings/components/content-settings/ContentSettings.mixin.d.ts +2 -2
- package/lib/src/shared/content-settings/components/content-settings/ReplaceImageSettingsForContent.mixin.d.ts +2 -2
- package/lib/src/shared/content-settings/components/content-settings-item/ContentSettingsItemField.mixin.d.ts +2 -2
- package/lib/src/shared/logo-settings/components/LogoSettings.mixin.d.ts +2 -2
- package/lib/src/shared/page-settings/components/page-settings/PageSettings.mixin.d.ts +2 -2
- package/lib/src/shared/page-settings/components/page-settings-section-styles/PageSettingsSectionStyles.mixin.d.ts +2 -2
- package/lib/src/shared/publish-brand-page-with-state/PublishBrandPageModalWithState.mixin.d.ts +2 -2
- package/lib/src/shared/style-settings/components/StyleSettings.mixin.d.ts +2 -2
- package/package.json +1 -1
- package/src/brand-page-maker/stores/brandpage-maker/brandpage-maker-store.test.ts +169 -0
- package/src/brand-page-maker/stores/brandpage-maker/brandpage-maker-store.ts +40 -3
- package/src/brand-page-maker/stores/history/history-store.test.ts +240 -11
- package/src/brand-page-maker/stores/history/history-store.ts +97 -27
package/lib/src/shared/content-settings/components/content-settings/ContentSettings.mixin.d.ts
CHANGED
|
@@ -145,8 +145,8 @@ declare const _default: import("vue").DefineComponent<{}, {
|
|
|
145
145
|
content: TContent;
|
|
146
146
|
}>(payload: P): Promise<void>;
|
|
147
147
|
_captureTemplateSwitchIfEnabled(): void;
|
|
148
|
-
applyHistorySnapshot(snapshot: import("@brand-page").BrandPageModel, activePageId?: string | undefined): Promise<void>;
|
|
149
|
-
_syncLogoSettingsFromSnapshot(snapshot: import("@brand-page").BrandPageModel): void;
|
|
148
|
+
applyHistorySnapshot(snapshot: import("@brand-page").BrandPageModel, activePageId?: string | undefined, logoEditsStr?: string | undefined): Promise<void>;
|
|
149
|
+
_syncLogoSettingsFromSnapshot(snapshot: import("@brand-page").BrandPageModel, logoEditsStr?: string | undefined): void;
|
|
150
150
|
_navigateToActivePage(activePageId?: string | undefined): void;
|
|
151
151
|
_fallbackSidebarIfSelectedContentMissing(snapshot: import("@brand-page").BrandPageModel): void;
|
|
152
152
|
export(): import("@brand-page").BrandPageModel;
|
|
@@ -661,8 +661,8 @@ declare const _default: import("vue").DefineComponent<{}, {
|
|
|
661
661
|
content: TContent;
|
|
662
662
|
}>(payload: P): Promise<void>;
|
|
663
663
|
_captureTemplateSwitchIfEnabled(): void;
|
|
664
|
-
applyHistorySnapshot(snapshot: import("@brand-page").BrandPageModel, activePageId?: string | undefined): Promise<void>;
|
|
665
|
-
_syncLogoSettingsFromSnapshot(snapshot: import("@brand-page").BrandPageModel): void;
|
|
664
|
+
applyHistorySnapshot(snapshot: import("@brand-page").BrandPageModel, activePageId?: string | undefined, logoEditsStr?: string | undefined): Promise<void>;
|
|
665
|
+
_syncLogoSettingsFromSnapshot(snapshot: import("@brand-page").BrandPageModel, logoEditsStr?: string | undefined): void;
|
|
666
666
|
_navigateToActivePage(activePageId?: string | undefined): void;
|
|
667
667
|
_fallbackSidebarIfSelectedContentMissing(snapshot: import("@brand-page").BrandPageModel): void;
|
|
668
668
|
export(): import("@brand-page").BrandPageModel;
|
|
@@ -608,8 +608,8 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
608
608
|
content: TContent;
|
|
609
609
|
}>(payload: P): Promise<void>;
|
|
610
610
|
_captureTemplateSwitchIfEnabled(): void;
|
|
611
|
-
applyHistorySnapshot(snapshot: import("@brand-page").BrandPageModel, activePageId?: string | undefined): Promise<void>;
|
|
612
|
-
_syncLogoSettingsFromSnapshot(snapshot: import("@brand-page").BrandPageModel): void;
|
|
611
|
+
applyHistorySnapshot(snapshot: import("@brand-page").BrandPageModel, activePageId?: string | undefined, logoEditsStr?: string | undefined): Promise<void>;
|
|
612
|
+
_syncLogoSettingsFromSnapshot(snapshot: import("@brand-page").BrandPageModel, logoEditsStr?: string | undefined): void;
|
|
613
613
|
_navigateToActivePage(activePageId?: string | undefined): void;
|
|
614
614
|
_fallbackSidebarIfSelectedContentMissing(snapshot: import("@brand-page").BrandPageModel): void;
|
|
615
615
|
export(): import("@brand-page").BrandPageModel;
|
|
@@ -135,8 +135,8 @@ declare const _default: import("vue").DefineComponent<{}, {
|
|
|
135
135
|
content: TContent;
|
|
136
136
|
}>(payload: P): Promise<void>;
|
|
137
137
|
_captureTemplateSwitchIfEnabled(): void;
|
|
138
|
-
applyHistorySnapshot(snapshot: import("../../../brand-page").BrandPageModel, activePageId?: string | undefined): Promise<void>;
|
|
139
|
-
_syncLogoSettingsFromSnapshot(snapshot: import("../../../brand-page").BrandPageModel): void;
|
|
138
|
+
applyHistorySnapshot(snapshot: import("../../../brand-page").BrandPageModel, activePageId?: string | undefined, logoEditsStr?: string | undefined): Promise<void>;
|
|
139
|
+
_syncLogoSettingsFromSnapshot(snapshot: import("../../../brand-page").BrandPageModel, logoEditsStr?: string | undefined): void;
|
|
140
140
|
_navigateToActivePage(activePageId?: string | undefined): void;
|
|
141
141
|
_fallbackSidebarIfSelectedContentMissing(snapshot: import("../../../brand-page").BrandPageModel): void;
|
|
142
142
|
export(): import("../../../brand-page").BrandPageModel;
|
|
@@ -3847,8 +3847,8 @@ declare const _default: import("vue").DefineComponent<{}, {
|
|
|
3847
3847
|
content: TContent;
|
|
3848
3848
|
}>(payload: P): Promise<void>;
|
|
3849
3849
|
_captureTemplateSwitchIfEnabled(): void;
|
|
3850
|
-
applyHistorySnapshot(snapshot: import("@brand-page").BrandPageModel, activePageId?: string | undefined): Promise<void>;
|
|
3851
|
-
_syncLogoSettingsFromSnapshot(snapshot: import("@brand-page").BrandPageModel): void;
|
|
3850
|
+
applyHistorySnapshot(snapshot: import("@brand-page").BrandPageModel, activePageId?: string | undefined, logoEditsStr?: string | undefined): Promise<void>;
|
|
3851
|
+
_syncLogoSettingsFromSnapshot(snapshot: import("@brand-page").BrandPageModel, logoEditsStr?: string | undefined): void;
|
|
3852
3852
|
_navigateToActivePage(activePageId?: string | undefined): void;
|
|
3853
3853
|
_fallbackSidebarIfSelectedContentMissing(snapshot: import("@brand-page").BrandPageModel): void;
|
|
3854
3854
|
export(): import("@brand-page").BrandPageModel;
|
|
@@ -4406,8 +4406,8 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
4406
4406
|
content: TContent;
|
|
4407
4407
|
}>(payload: P): Promise<void>;
|
|
4408
4408
|
_captureTemplateSwitchIfEnabled(): void;
|
|
4409
|
-
applyHistorySnapshot(snapshot: import("@brand-page").BrandPageModel, activePageId?: string | undefined): Promise<void>;
|
|
4410
|
-
_syncLogoSettingsFromSnapshot(snapshot: import("@brand-page").BrandPageModel): void;
|
|
4409
|
+
applyHistorySnapshot(snapshot: import("@brand-page").BrandPageModel, activePageId?: string | undefined, logoEditsStr?: string | undefined): Promise<void>;
|
|
4410
|
+
_syncLogoSettingsFromSnapshot(snapshot: import("@brand-page").BrandPageModel, logoEditsStr?: string | undefined): void;
|
|
4411
4411
|
_navigateToActivePage(activePageId?: string | undefined): void;
|
|
4412
4412
|
_fallbackSidebarIfSelectedContentMissing(snapshot: import("@brand-page").BrandPageModel): void;
|
|
4413
4413
|
export(): import("@brand-page").BrandPageModel;
|
package/lib/src/shared/publish-brand-page-with-state/PublishBrandPageModalWithState.mixin.d.ts
CHANGED
|
@@ -184,8 +184,8 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
184
184
|
content: TContent;
|
|
185
185
|
}>(payload: P): Promise<void>;
|
|
186
186
|
_captureTemplateSwitchIfEnabled(): void;
|
|
187
|
-
applyHistorySnapshot(snapshot: import("@brand-page/models").BrandPageModel, activePageId?: string | undefined): Promise<void>;
|
|
188
|
-
_syncLogoSettingsFromSnapshot(snapshot: import("@brand-page/models").BrandPageModel): void;
|
|
187
|
+
applyHistorySnapshot(snapshot: import("@brand-page/models").BrandPageModel, activePageId?: string | undefined, logoEditsStr?: string | undefined): Promise<void>;
|
|
188
|
+
_syncLogoSettingsFromSnapshot(snapshot: import("@brand-page/models").BrandPageModel, logoEditsStr?: string | undefined): void;
|
|
189
189
|
_navigateToActivePage(activePageId?: string | undefined): void;
|
|
190
190
|
_fallbackSidebarIfSelectedContentMissing(snapshot: import("@brand-page/models").BrandPageModel): void;
|
|
191
191
|
export(): import("@brand-page/models").BrandPageModel;
|
|
@@ -576,8 +576,8 @@ declare const _default: import("vue").DefineComponent<{}, {
|
|
|
576
576
|
content: TContent;
|
|
577
577
|
}>(payload: P): Promise<void>;
|
|
578
578
|
_captureTemplateSwitchIfEnabled(): void;
|
|
579
|
-
applyHistorySnapshot(snapshot: import("@brand-page").BrandPageModel, activePageId?: string | undefined): Promise<void>;
|
|
580
|
-
_syncLogoSettingsFromSnapshot(snapshot: import("@brand-page").BrandPageModel): void;
|
|
579
|
+
applyHistorySnapshot(snapshot: import("@brand-page").BrandPageModel, activePageId?: string | undefined, logoEditsStr?: string | undefined): Promise<void>;
|
|
580
|
+
_syncLogoSettingsFromSnapshot(snapshot: import("@brand-page").BrandPageModel, logoEditsStr?: string | undefined): void;
|
|
581
581
|
_navigateToActivePage(activePageId?: string | undefined): void;
|
|
582
582
|
_fallbackSidebarIfSelectedContentMissing(snapshot: import("@brand-page").BrandPageModel): void;
|
|
583
583
|
export(): import("@brand-page").BrandPageModel;
|
package/package.json
CHANGED
|
@@ -46,6 +46,7 @@ import {
|
|
|
46
46
|
useUiContentSettingsStore,
|
|
47
47
|
} from '@shared/content-settings/store';
|
|
48
48
|
import { useUiSideBarStore } from '@shared/side-bar/store';
|
|
49
|
+
import { useUiEditableLogoStore } from '@shared/logo-settings/store/editable-logo-store';
|
|
49
50
|
import { SIDE_BAR_TAB_NAMES } from '@brand-page-maker/constants';
|
|
50
51
|
import { PAGE_SECTIONS } from '@shared/page-settings/models';
|
|
51
52
|
import { FabricRenderClient } from '../../../clients/fabric-render-client';
|
|
@@ -686,6 +687,55 @@ describe('brand page maker store module', () => {
|
|
|
686
687
|
expect(pageNavigationStore.activePageId).toBe(expectedFirstId);
|
|
687
688
|
});
|
|
688
689
|
|
|
690
|
+
// BP-5506 follow-up: undoing a non-page-structural edit (e.g. a title
|
|
691
|
+
// change) must NOT push a new route. The router push fires
|
|
692
|
+
// `router.afterEach`, and BrandPageMaker.mixin's afterEach hook resets
|
|
693
|
+
// the content-settings modeStack — which would snap the sidebar back
|
|
694
|
+
// to the default Content tab on every undo, even when the user was
|
|
695
|
+
// deep-editing a content item. Same-page navigation MUST be skipped.
|
|
696
|
+
test('applyHistorySnapshot does NOT touch modeStack when active page is unchanged', async () => {
|
|
697
|
+
const makerStore = useBrandPageMakerStore();
|
|
698
|
+
const pageNavigationStore = usePageNavigationStore();
|
|
699
|
+
const contentSettingsStore = useUiContentSettingsStore();
|
|
700
|
+
|
|
701
|
+
await makerStore.initialise(INITIALISE_PAYLOAD);
|
|
702
|
+
|
|
703
|
+
const activePageId = pageNavigationStore.routes[0]?.pageId;
|
|
704
|
+
|
|
705
|
+
expect(activePageId).toBeDefined();
|
|
706
|
+
|
|
707
|
+
pageNavigationStore.activePageId = activePageId!;
|
|
708
|
+
|
|
709
|
+
// User is deep-editing a content item — focused mode pushed onto the stack.
|
|
710
|
+
const realItemId = contentSettingsStore.items[0]?.id;
|
|
711
|
+
|
|
712
|
+
expect(realItemId).toBeDefined();
|
|
713
|
+
|
|
714
|
+
contentSettingsStore.pushMode({
|
|
715
|
+
mode: CONTENT_SETTINGS_MODES.focusedContentItem,
|
|
716
|
+
selectedItemId: realItemId,
|
|
717
|
+
});
|
|
718
|
+
contentSettingsStore.selectedItemId = realItemId;
|
|
719
|
+
|
|
720
|
+
expect(contentSettingsStore.mode).toBe(
|
|
721
|
+
CONTENT_SETTINGS_MODES.focusedContentItem,
|
|
722
|
+
);
|
|
723
|
+
|
|
724
|
+
// Apply a snapshot whose activePageId equals the current page (i.e.
|
|
725
|
+
// a non-structural edit that didn't change pages — title edit, color
|
|
726
|
+
// change, etc.).
|
|
727
|
+
await makerStore.applyHistorySnapshot(
|
|
728
|
+
makerStore.brandPageData,
|
|
729
|
+
activePageId,
|
|
730
|
+
);
|
|
731
|
+
|
|
732
|
+
// Mode stack is preserved — no router.afterEach was triggered.
|
|
733
|
+
expect(contentSettingsStore.mode).toBe(
|
|
734
|
+
CONTENT_SETTINGS_MODES.focusedContentItem,
|
|
735
|
+
);
|
|
736
|
+
expect(contentSettingsStore.selectedItemId).toBe(realItemId);
|
|
737
|
+
});
|
|
738
|
+
|
|
689
739
|
// BP-5506 regression: when undoing a content add, the selected item
|
|
690
740
|
// disappears. The fallback must restore the Content tab's natural
|
|
691
741
|
// landing state (mode = edit, selectedItemId = null), not just switch
|
|
@@ -726,4 +776,123 @@ describe('brand page maker store module', () => {
|
|
|
726
776
|
SIDE_BAR_TAB_NAMES.CONTENT_SETTINGS,
|
|
727
777
|
);
|
|
728
778
|
});
|
|
779
|
+
|
|
780
|
+
// BP-5506 follow-up: applyHistorySnapshot accepts a `logoEdits` JSON
|
|
781
|
+
// string (sidecar to brandPageData; pre-purchase logo-tab form-field
|
|
782
|
+
// state). On undo it must wholesale-replace `editableLogoStore.logoEdits`
|
|
783
|
+
// so the form fields reflect the pre-edit state. Wholesale replacement
|
|
784
|
+
// matters because a previous entry's textObjects/colors must NOT leak
|
|
785
|
+
// through (e.g. switching template A→B then undoing must NOT keep B's
|
|
786
|
+
// textObject ids in A's restored state).
|
|
787
|
+
test('applyHistorySnapshot restores editableLogoStore.logoEdits from sidecar', async () => {
|
|
788
|
+
const makerStore = useBrandPageMakerStore();
|
|
789
|
+
const editableLogoStore = useUiEditableLogoStore();
|
|
790
|
+
|
|
791
|
+
await makerStore.initialise(INITIALISE_PAYLOAD);
|
|
792
|
+
|
|
793
|
+
// User has typed "AcmeCo" — current logoEdits state.
|
|
794
|
+
editableLogoStore.logoEdits.textObjects = [
|
|
795
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
796
|
+
{
|
|
797
|
+
id: 't1',
|
|
798
|
+
role: 'primary-text',
|
|
799
|
+
text: 'AcmeCo',
|
|
800
|
+
textEnabled: true,
|
|
801
|
+
} as any,
|
|
802
|
+
];
|
|
803
|
+
|
|
804
|
+
// The history entry the user is undoing TO captured "Acme".
|
|
805
|
+
const sidecar = JSON.stringify({
|
|
806
|
+
backgroundObject: { id: 'bg', type: 'rect', role: 'background' },
|
|
807
|
+
logoObject: {
|
|
808
|
+
id: 'lg',
|
|
809
|
+
type: 'group',
|
|
810
|
+
role: 'logo',
|
|
811
|
+
logoColors: [],
|
|
812
|
+
logoStrokeColors: [],
|
|
813
|
+
},
|
|
814
|
+
textObjects: [
|
|
815
|
+
{ id: 't1', role: 'primary-text', text: 'Acme', textEnabled: true },
|
|
816
|
+
],
|
|
817
|
+
});
|
|
818
|
+
|
|
819
|
+
await makerStore.applyHistorySnapshot(
|
|
820
|
+
makerStore.brandPageData,
|
|
821
|
+
undefined,
|
|
822
|
+
sidecar,
|
|
823
|
+
);
|
|
824
|
+
|
|
825
|
+
expect(editableLogoStore.logoEdits.textObjects).toEqual([
|
|
826
|
+
{ id: 't1', role: 'primary-text', text: 'Acme', textEnabled: true },
|
|
827
|
+
]);
|
|
828
|
+
});
|
|
829
|
+
|
|
830
|
+
test('applyHistorySnapshot wholesale-replaces logoEdits (no leak from prior state)', async () => {
|
|
831
|
+
const makerStore = useBrandPageMakerStore();
|
|
832
|
+
const editableLogoStore = useUiEditableLogoStore();
|
|
833
|
+
|
|
834
|
+
await makerStore.initialise(INITIALISE_PAYLOAD);
|
|
835
|
+
|
|
836
|
+
// Current state has TWO textObjects (e.g. user is on template B with a
|
|
837
|
+
// logo + tagline).
|
|
838
|
+
editableLogoStore.logoEdits.textObjects = [
|
|
839
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
840
|
+
{
|
|
841
|
+
id: 'b-1',
|
|
842
|
+
role: 'primary-text',
|
|
843
|
+
text: 'Brand B',
|
|
844
|
+
textEnabled: true,
|
|
845
|
+
} as any,
|
|
846
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
847
|
+
{ id: 'b-2', role: 'tagline', text: 'tagline', textEnabled: true } as any,
|
|
848
|
+
];
|
|
849
|
+
|
|
850
|
+
// Undo target captured template A — only ONE textObject with a
|
|
851
|
+
// different id. After restore, b-1 / b-2 must be gone.
|
|
852
|
+
const sidecar = JSON.stringify({
|
|
853
|
+
backgroundObject: { id: 'bg', type: 'rect', role: 'background' },
|
|
854
|
+
logoObject: {
|
|
855
|
+
id: 'lg',
|
|
856
|
+
type: 'group',
|
|
857
|
+
role: 'logo',
|
|
858
|
+
logoColors: [],
|
|
859
|
+
logoStrokeColors: [],
|
|
860
|
+
},
|
|
861
|
+
textObjects: [
|
|
862
|
+
{ id: 'a-1', role: 'primary-text', text: 'Brand A', textEnabled: true },
|
|
863
|
+
],
|
|
864
|
+
});
|
|
865
|
+
|
|
866
|
+
await makerStore.applyHistorySnapshot(
|
|
867
|
+
makerStore.brandPageData,
|
|
868
|
+
undefined,
|
|
869
|
+
sidecar,
|
|
870
|
+
);
|
|
871
|
+
|
|
872
|
+
expect(editableLogoStore.logoEdits.textObjects).toHaveLength(1);
|
|
873
|
+
expect(editableLogoStore.logoEdits.textObjects[0].id).toBe('a-1');
|
|
874
|
+
});
|
|
875
|
+
|
|
876
|
+
test('applyHistorySnapshot leaves logoEdits untouched when sidecar is undefined', async () => {
|
|
877
|
+
const makerStore = useBrandPageMakerStore();
|
|
878
|
+
const editableLogoStore = useUiEditableLogoStore();
|
|
879
|
+
|
|
880
|
+
await makerStore.initialise(INITIALISE_PAYLOAD);
|
|
881
|
+
|
|
882
|
+
editableLogoStore.logoEdits.textObjects = [
|
|
883
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
884
|
+
{
|
|
885
|
+
id: 't1',
|
|
886
|
+
role: 'primary-text',
|
|
887
|
+
text: 'Acme',
|
|
888
|
+
textEnabled: true,
|
|
889
|
+
} as any,
|
|
890
|
+
];
|
|
891
|
+
|
|
892
|
+
// No third arg — pre-existing entries from before this feature shipped.
|
|
893
|
+
await makerStore.applyHistorySnapshot(makerStore.brandPageData);
|
|
894
|
+
|
|
895
|
+
// Still 'Acme' — no restore attempted.
|
|
896
|
+
expect(editableLogoStore.logoEdits.textObjects[0].text).toBe('Acme');
|
|
897
|
+
});
|
|
729
898
|
});
|
|
@@ -792,6 +792,7 @@ export const useBrandPageMakerStore = defineStore('brandPageMaker', {
|
|
|
792
792
|
async applyHistorySnapshot(
|
|
793
793
|
snapshot: BrandPageModel,
|
|
794
794
|
activePageId?: string,
|
|
795
|
+
logoEditsStr?: string,
|
|
795
796
|
): Promise<void> {
|
|
796
797
|
const styleSettingsStore = useUiStyleSettingsStore();
|
|
797
798
|
const navigationStyleSettingsStore = useUiNavigationStyleSettingsStore();
|
|
@@ -888,8 +889,12 @@ export const useBrandPageMakerStore = defineStore('brandPageMaker', {
|
|
|
888
889
|
// "current logo" state — same pattern as `initialiseStoresByBrandPageModelAsync`.
|
|
889
890
|
// Also restores the variations grid + template asset for the
|
|
890
891
|
// snapshot's draft token (both are sidecars to `brandPageData` —
|
|
891
|
-
// BYO upload mutates them out of band).
|
|
892
|
-
|
|
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
|
+
this._syncLogoSettingsFromSnapshot(snapshot, logoEditsStr);
|
|
893
898
|
|
|
894
899
|
// 9. If the sidebar is editing a content item that no longer exists in
|
|
895
900
|
// the restored page, fall back to the Content tab so the user doesn't
|
|
@@ -909,11 +914,35 @@ export const useBrandPageMakerStore = defineStore('brandPageMaker', {
|
|
|
909
914
|
this._navigateToActivePage(activePageId);
|
|
910
915
|
},
|
|
911
916
|
|
|
912
|
-
_syncLogoSettingsFromSnapshot(
|
|
917
|
+
_syncLogoSettingsFromSnapshot(
|
|
918
|
+
snapshot: BrandPageModel,
|
|
919
|
+
logoEditsStr?: string,
|
|
920
|
+
): void {
|
|
913
921
|
const logoSettingsStore = useUiLogoSettingsStore();
|
|
914
922
|
const editableLogoStore = useUiEditableLogoStore();
|
|
915
923
|
const logoStore = useLogoStore();
|
|
916
924
|
|
|
925
|
+
// Restore `editableLogoStore.logoEdits` first — sidecar to `brandPageData`,
|
|
926
|
+
// captured per-entry. Wholesale-replace via `$patch` so a previous
|
|
927
|
+
// entry's textObjects/colors don't leak through (e.g. switching
|
|
928
|
+
// template A→B then undoing A's restored object set must NOT contain
|
|
929
|
+
// B's textObject ids). Failing parse is non-fatal; the logo tab will
|
|
930
|
+
// just keep showing whatever logoEdits state was already loaded —
|
|
931
|
+
// canvas + saved metadata still come from `brandPageData` + the
|
|
932
|
+
// save-time `updateMetadataAsync` round-trip.
|
|
933
|
+
if (logoEditsStr) {
|
|
934
|
+
try {
|
|
935
|
+
const parsed = JSON.parse(logoEditsStr);
|
|
936
|
+
|
|
937
|
+
editableLogoStore.$patch({ logoEdits: parsed });
|
|
938
|
+
} catch (error) {
|
|
939
|
+
console.error(
|
|
940
|
+
'brandpage-maker-store: failed to restore logoEdits',
|
|
941
|
+
error,
|
|
942
|
+
);
|
|
943
|
+
}
|
|
944
|
+
}
|
|
945
|
+
|
|
917
946
|
const logoImage =
|
|
918
947
|
snapshot.brandPageType === BRAND_PAGE_TYPES.default
|
|
919
948
|
? (
|
|
@@ -983,6 +1012,14 @@ export const useBrandPageMakerStore = defineStore('brandPageMaker', {
|
|
|
983
1012
|
|
|
984
1013
|
if (!targetPageId) return;
|
|
985
1014
|
|
|
1015
|
+
// Skip both the Pinia write and the router push when the target page
|
|
1016
|
+
// is already active. The router push fires `router.afterEach` even
|
|
1017
|
+
// for same-page navigation, and BrandPageMaker.mixin's afterEach hook
|
|
1018
|
+
// resets the content-settings modeStack — which would snap the
|
|
1019
|
+
// sidebar back to the default Content tab on every undo/redo,
|
|
1020
|
+
// regardless of whether the user was deep-editing a content item.
|
|
1021
|
+
if (pageNavigationStore.activePageId === targetPageId) return;
|
|
1022
|
+
|
|
986
1023
|
pageNavigationStore.setCurrentActivePage({ pageId: targetPageId });
|
|
987
1024
|
navigateToPageByPageId(targetPageId);
|
|
988
1025
|
},
|