@designcrowd/library.brand-page 5.18.1-undo-29 → 5.18.1-undo-32
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-BxL6mTJW.js → CreatedOnBrandCrowd-de-de-DUgkmx89.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-en-us-BPbjqfkj.js → CreatedOnBrandCrowd-en-us-C5dQGLuA.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-es-es-DDsoe143.js → CreatedOnBrandCrowd-es-es-CjPcnNlq.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-fr-fr-Dak7ppy_.js → CreatedOnBrandCrowd-fr-ca-D2wnZOOE.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-fr-ca-Dak7ppy_.js → CreatedOnBrandCrowd-fr-fr-D2wnZOOE.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-pt-pt-BUAneEVD.js → CreatedOnBrandCrowd-pt-br-OQj-IBh_.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-pt-br-BUAneEVD.js → CreatedOnBrandCrowd-pt-pt-OQj-IBh_.js} +1 -1
- package/lib/src/{CreatedOnDcom-de-de-BJ00bTz_.js → CreatedOnDcom-de-de-DLijuIaL.js} +1 -1
- package/lib/src/{CreatedOnDcom-en-us-B0V1M9Hs.js → CreatedOnDcom-en-us-D9M_heGE.js} +1 -1
- package/lib/src/{CreatedOnDcom-es-es-YDMLB7u6.js → CreatedOnDcom-es-es-PgWwbBLA.js} +1 -1
- package/lib/src/{CreatedOnDcom-fr-ca-DppQ26s1.js → CreatedOnDcom-fr-ca-BXiB-abj.js} +1 -1
- package/lib/src/{CreatedOnDcom-fr-fr-0Xi-3slB.js → CreatedOnDcom-fr-fr-BXhTmu7F.js} +1 -1
- package/lib/src/{CreatedOnDcom-pt-br-De-wHqSu.js → CreatedOnDcom-pt-br-3e6y567w.js} +1 -1
- package/lib/src/{CreatedOnDcom-pt-pt-CQGAsn5D.js → CreatedOnDcom-pt-pt-GojOtHmO.js} +1 -1
- package/lib/src/brand-page-maker/components/action-bar/ActionBar.mixin.d.ts +1 -1
- package/lib/src/brand-page-maker/components/brand-page-maker/BrandPageMaker.mixin.d.ts +1 -1
- package/lib/src/brand-page-maker/components/brand-page-maker/BrandPageMakerTemplateSettings.mixin.d.ts +1 -1
- package/lib/src/brand-page-maker/components/brandpage-maker-page/BrandPageMakerPage.mixin.d.ts +1 -1
- package/lib/src/brand-page-maker/components/brandpage-settings/ReplaceImageSettingsForBrandPageSettings.mixin.d.ts +1 -1
- package/lib/src/brand-page-maker/components/seo-settings/SeoPageSettings.mixin.d.ts +1 -1
- package/lib/src/brand-page-maker/components/seo-settings/UrlSettings.mixin.d.ts +1 -1
- package/lib/src/brand-page-maker/components/social-share/SocialShare.mixin.d.ts +1 -1
- package/lib/src/brand-page-maker/components/template-preview/TemplatePreview.mixin.d.ts +1 -1
- package/lib/src/brand-page-maker/stores/brandpage-maker/brandpage-maker-store.d.ts +1 -1
- package/lib/src/brand-page-maker/stores/brandpage-maker/brandpage-maker-store.js +46 -22
- package/lib/src/brand-page-maker/stores/history/history-store.js +66 -66
- package/lib/src/index.mjs +1 -1
- package/lib/src/{lib-YRlMax_i.js → lib-DVs3jUit.js} +18674 -18654
- package/lib/src/shared/content-settings/components/content-settings/ContentSettings.mixin.d.ts +65 -1
- package/lib/src/shared/content-settings/components/content-settings/ContentSettings.mixin.js +12 -0
- package/lib/src/shared/content-settings/components/content-settings/ReplaceImageSettingsForContent.mixin.d.ts +1 -1
- package/lib/src/shared/content-settings/components/content-settings-item/ContentSettingsItemField.mixin.d.ts +1 -1
- package/lib/src/shared/logo-settings/components/EditLogoSettings.mixin.d.ts +1 -0
- package/lib/src/shared/logo-settings/components/LogoSettings.mixin.d.ts +2 -1
- package/lib/src/shared/logo-settings/store/editable-logo-store.d.ts +14 -0
- package/lib/src/shared/logo-settings/store/editable-logo-store.js +26 -10
- package/lib/src/shared/page-settings/components/page-settings/PageSettings.mixin.d.ts +1 -1
- package/lib/src/shared/page-settings/components/page-settings-section-styles/PageSettingsSectionStyles.mixin.d.ts +2 -1
- package/lib/src/shared/publish-brand-page-with-state/PublishBrandPageModalWithState.mixin.d.ts +1 -1
- package/lib/src/shared/style-settings/components/StyleSettings.mixin.d.ts +1 -1
- package/package.json +1 -1
- package/src/brand-page-maker/stores/brandpage-maker/brandpage-maker-store.ts +53 -23
- package/src/brand-page-maker/stores/history/history-store.test.ts +29 -135
- package/src/brand-page-maker/stores/history/history-store.ts +85 -76
- package/src/shared/content-settings/components/content-settings/ContentSettings.mixin.ts +12 -0
- package/src/shared/logo-settings/store/editable-logo-store.ts +28 -11
|
@@ -119,7 +119,7 @@ declare const _default: import("vue").DefineComponent<{}, {
|
|
|
119
119
|
}>(payload: P): Promise<void>;
|
|
120
120
|
_captureTemplateSwitchIfEnabled(): void;
|
|
121
121
|
applyHistorySnapshot(snapshot: import("@brand-page/models").BrandPageModel, activePageId?: string | undefined, logoEditsStr?: string | undefined): Promise<void>;
|
|
122
|
-
_syncLogoSettingsFromSnapshot(snapshot: import("@brand-page/models").BrandPageModel, logoEditsStr?: string | undefined): void
|
|
122
|
+
_syncLogoSettingsFromSnapshot(snapshot: import("@brand-page/models").BrandPageModel, logoEditsStr?: string | undefined): Promise<void>;
|
|
123
123
|
_navigateToActivePage(activePageId?: string | undefined): void;
|
|
124
124
|
_fallbackSidebarIfSelectedContentMissing(snapshot: import("@brand-page/models").BrandPageModel): void;
|
|
125
125
|
export(): import("@brand-page/models").BrandPageModel;
|
|
@@ -164,7 +164,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
164
164
|
}>(payload: P): Promise<void>;
|
|
165
165
|
_captureTemplateSwitchIfEnabled(): void;
|
|
166
166
|
applyHistorySnapshot(snapshot: import("@brand-page").BrandPageModel, activePageId?: string | undefined, logoEditsStr?: string | undefined): Promise<void>;
|
|
167
|
-
_syncLogoSettingsFromSnapshot(snapshot: import("@brand-page").BrandPageModel, logoEditsStr?: string | undefined): void
|
|
167
|
+
_syncLogoSettingsFromSnapshot(snapshot: import("@brand-page").BrandPageModel, logoEditsStr?: string | undefined): Promise<void>;
|
|
168
168
|
_navigateToActivePage(activePageId?: string | undefined): void;
|
|
169
169
|
_fallbackSidebarIfSelectedContentMissing(snapshot: import("@brand-page").BrandPageModel): void;
|
|
170
170
|
export(): import("@brand-page").BrandPageModel;
|
|
@@ -108,7 +108,7 @@ declare const _default: import("vue").DefineComponent<{}, {
|
|
|
108
108
|
}>(payload: P): Promise<void>;
|
|
109
109
|
_captureTemplateSwitchIfEnabled(): void;
|
|
110
110
|
applyHistorySnapshot(snapshot: import("../../../lib").BrandPageModel, activePageId?: string | undefined, logoEditsStr?: string | undefined): Promise<void>;
|
|
111
|
-
_syncLogoSettingsFromSnapshot(snapshot: import("../../../lib").BrandPageModel, logoEditsStr?: string | undefined): void
|
|
111
|
+
_syncLogoSettingsFromSnapshot(snapshot: import("../../../lib").BrandPageModel, logoEditsStr?: string | undefined): Promise<void>;
|
|
112
112
|
_navigateToActivePage(activePageId?: string | undefined): void;
|
|
113
113
|
_fallbackSidebarIfSelectedContentMissing(snapshot: import("../../../lib").BrandPageModel): void;
|
|
114
114
|
export(): import("../../../lib").BrandPageModel;
|
package/lib/src/brand-page-maker/components/brandpage-maker-page/BrandPageMakerPage.mixin.d.ts
CHANGED
|
@@ -614,7 +614,7 @@ declare const _default: import("vue").DefineComponent<{}, {
|
|
|
614
614
|
}>(payload: P): Promise<void>;
|
|
615
615
|
_captureTemplateSwitchIfEnabled(): void;
|
|
616
616
|
applyHistorySnapshot(snapshot: import("@brand-page").BrandPageModel, activePageId?: string | undefined, logoEditsStr?: string | undefined): Promise<void>;
|
|
617
|
-
_syncLogoSettingsFromSnapshot(snapshot: import("@brand-page").BrandPageModel, logoEditsStr?: string | undefined): void
|
|
617
|
+
_syncLogoSettingsFromSnapshot(snapshot: import("@brand-page").BrandPageModel, logoEditsStr?: string | undefined): Promise<void>;
|
|
618
618
|
_navigateToActivePage(activePageId?: string | undefined): void;
|
|
619
619
|
_fallbackSidebarIfSelectedContentMissing(snapshot: import("@brand-page").BrandPageModel): void;
|
|
620
620
|
export(): import("@brand-page").BrandPageModel;
|
|
@@ -114,7 +114,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
114
114
|
}>(payload: P): Promise<void>;
|
|
115
115
|
_captureTemplateSwitchIfEnabled(): void;
|
|
116
116
|
applyHistorySnapshot(snapshot: import("../../../brand-page").BrandPageModel, activePageId?: string | undefined, logoEditsStr?: string | undefined): Promise<void>;
|
|
117
|
-
_syncLogoSettingsFromSnapshot(snapshot: import("../../../brand-page").BrandPageModel, logoEditsStr?: string | undefined): void
|
|
117
|
+
_syncLogoSettingsFromSnapshot(snapshot: import("../../../brand-page").BrandPageModel, logoEditsStr?: string | undefined): Promise<void>;
|
|
118
118
|
_navigateToActivePage(activePageId?: string | undefined): void;
|
|
119
119
|
_fallbackSidebarIfSelectedContentMissing(snapshot: import("../../../brand-page").BrandPageModel): void;
|
|
120
120
|
export(): import("../../../brand-page").BrandPageModel;
|
|
@@ -392,7 +392,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
392
392
|
}>(payload: P): Promise<void>;
|
|
393
393
|
_captureTemplateSwitchIfEnabled(): void;
|
|
394
394
|
applyHistorySnapshot(snapshot: import("../../../brand-page").BrandPageModel, activePageId?: string | undefined, logoEditsStr?: string | undefined): Promise<void>;
|
|
395
|
-
_syncLogoSettingsFromSnapshot(snapshot: import("../../../brand-page").BrandPageModel, logoEditsStr?: string | undefined): void
|
|
395
|
+
_syncLogoSettingsFromSnapshot(snapshot: import("../../../brand-page").BrandPageModel, logoEditsStr?: string | undefined): Promise<void>;
|
|
396
396
|
_navigateToActivePage(activePageId?: string | undefined): void;
|
|
397
397
|
_fallbackSidebarIfSelectedContentMissing(snapshot: import("../../../brand-page").BrandPageModel): void;
|
|
398
398
|
export(): import("../../../brand-page").BrandPageModel;
|
|
@@ -393,7 +393,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
393
393
|
}>(payload: P): Promise<void>;
|
|
394
394
|
_captureTemplateSwitchIfEnabled(): void;
|
|
395
395
|
applyHistorySnapshot(snapshot: import("../../../brand-page").BrandPageModel, activePageId?: string | undefined, logoEditsStr?: string | undefined): Promise<void>;
|
|
396
|
-
_syncLogoSettingsFromSnapshot(snapshot: import("../../../brand-page").BrandPageModel, logoEditsStr?: string | undefined): void
|
|
396
|
+
_syncLogoSettingsFromSnapshot(snapshot: import("../../../brand-page").BrandPageModel, logoEditsStr?: string | undefined): Promise<void>;
|
|
397
397
|
_navigateToActivePage(activePageId?: string | undefined): void;
|
|
398
398
|
_fallbackSidebarIfSelectedContentMissing(snapshot: import("../../../brand-page").BrandPageModel): void;
|
|
399
399
|
export(): import("../../../brand-page").BrandPageModel;
|
|
@@ -124,7 +124,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
124
124
|
}>(payload: P): Promise<void>;
|
|
125
125
|
_captureTemplateSwitchIfEnabled(): void;
|
|
126
126
|
applyHistorySnapshot(snapshot: import("../../../brand-page").BrandPageModel, activePageId?: string | undefined, logoEditsStr?: string | undefined): Promise<void>;
|
|
127
|
-
_syncLogoSettingsFromSnapshot(snapshot: import("../../../brand-page").BrandPageModel, logoEditsStr?: string | undefined): void
|
|
127
|
+
_syncLogoSettingsFromSnapshot(snapshot: import("../../../brand-page").BrandPageModel, logoEditsStr?: string | undefined): Promise<void>;
|
|
128
128
|
_navigateToActivePage(activePageId?: string | undefined): void;
|
|
129
129
|
_fallbackSidebarIfSelectedContentMissing(snapshot: import("../../../brand-page").BrandPageModel): void;
|
|
130
130
|
export(): import("../../../brand-page").BrandPageModel;
|
|
@@ -444,7 +444,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
444
444
|
}>(payload: P): Promise<void>;
|
|
445
445
|
_captureTemplateSwitchIfEnabled(): void;
|
|
446
446
|
applyHistorySnapshot(snapshot: import("@brand-page").BrandPageModel, activePageId?: string | undefined, logoEditsStr?: string | undefined): Promise<void>;
|
|
447
|
-
_syncLogoSettingsFromSnapshot(snapshot: import("@brand-page").BrandPageModel, logoEditsStr?: string | undefined): void
|
|
447
|
+
_syncLogoSettingsFromSnapshot(snapshot: import("@brand-page").BrandPageModel, logoEditsStr?: string | undefined): Promise<void>;
|
|
448
448
|
_navigateToActivePage(activePageId?: string | undefined): void;
|
|
449
449
|
_fallbackSidebarIfSelectedContentMissing(snapshot: import("@brand-page").BrandPageModel): void;
|
|
450
450
|
export(): import("@brand-page").BrandPageModel;
|
|
@@ -210,7 +210,7 @@ export declare const useBrandPageMakerStore: import("pinia").StoreDefinition<"br
|
|
|
210
210
|
*/
|
|
211
211
|
_captureTemplateSwitchIfEnabled(): void;
|
|
212
212
|
applyHistorySnapshot(snapshot: BrandPageModel, activePageId?: string, logoEditsStr?: string): Promise<void>;
|
|
213
|
-
_syncLogoSettingsFromSnapshot(snapshot: BrandPageModel, logoEditsStr?: string): void
|
|
213
|
+
_syncLogoSettingsFromSnapshot(snapshot: BrandPageModel, logoEditsStr?: string): Promise<void>;
|
|
214
214
|
/**
|
|
215
215
|
* Restore the active page after a history apply. The id passed in is
|
|
216
216
|
* already validated against the restored nav by the history store; if
|
|
@@ -2,6 +2,7 @@ import { EMPTY_LOGO_IMAGE_MODEL, SENSITIVE_CONTENT_TYPES, TEXT_STYLE_TYPES, VIEW
|
|
|
2
2
|
import { BackgroundStyles, BRAND_PAGE_TYPES, BrandPageModel, CONTENT_TYPES, NavigationDesktop, NavigationMobile, NavModel, } from '@brand-page';
|
|
3
3
|
import { useBrandPageMakerUserStore } from '../user';
|
|
4
4
|
import { defineStore } from 'pinia';
|
|
5
|
+
import { toRaw } from 'vue';
|
|
5
6
|
import { useUiStore } from '../ui';
|
|
6
7
|
import { useUiLogoSettingsStore, useUiEditableLogoStore, } from '@shared/logo-settings/store';
|
|
7
8
|
import { useUiStyleSettingsStore } from '@shared/style-settings/store';
|
|
@@ -584,7 +585,7 @@ export const useBrandPageMakerStore = defineStore('brandPageMaker', {
|
|
|
584
585
|
// text, support text, logo colors, fonts), `editableLogoStore.logoEdits`
|
|
585
586
|
// is restored from that string so the sidebar form fields and the
|
|
586
587
|
// save-time fabric-render POST both pick up the pre-edit state.
|
|
587
|
-
this._syncLogoSettingsFromSnapshot(snapshot, logoEditsStr);
|
|
588
|
+
await this._syncLogoSettingsFromSnapshot(snapshot, logoEditsStr);
|
|
588
589
|
// 9. If the sidebar is editing a content item that no longer exists in
|
|
589
590
|
// the restored page, fall back to the Content tab so the user doesn't
|
|
590
591
|
// stare at a blank settings panel.
|
|
@@ -601,11 +602,17 @@ export const useBrandPageMakerStore = defineStore('brandPageMaker', {
|
|
|
601
602
|
// sidebar's `currentPage` getter silently falls back to page 0.
|
|
602
603
|
this._navigateToActivePage(activePageId);
|
|
603
604
|
},
|
|
604
|
-
_syncLogoSettingsFromSnapshot(snapshot, logoEditsStr) {
|
|
605
|
+
async _syncLogoSettingsFromSnapshot(snapshot, logoEditsStr) {
|
|
605
606
|
const logoSettingsStore = useUiLogoSettingsStore();
|
|
606
607
|
const editableLogoStore = useUiEditableLogoStore();
|
|
607
608
|
const logoStore = useLogoStore();
|
|
608
609
|
const containerStore = useBrandPageContainerStore();
|
|
610
|
+
// Snapshot the pre-restore logo identity BEFORE we $patch logoEdits.
|
|
611
|
+
// Used below to short-circuit the fabric-render call when the entry
|
|
612
|
+
// we're restoring has the same logoEdits + draft token as the live
|
|
613
|
+
// state — i.e. only non-logo state changed between the two entries.
|
|
614
|
+
const prevLogoEditsStr = JSON.stringify(toRaw(editableLogoStore.logoEdits));
|
|
615
|
+
const prevDraftToken = editableLogoStore.logoDraftToken;
|
|
609
616
|
// Restore `editableLogoStore.logoEdits` first — sidecar to `brandPageData`,
|
|
610
617
|
// captured per-entry. Wholesale-replace via `$patch` so a previous
|
|
611
618
|
// entry's textObjects/colors don't leak through (e.g. switching
|
|
@@ -648,40 +655,57 @@ export const useBrandPageMakerStore = defineStore('brandPageMaker', {
|
|
|
648
655
|
}
|
|
649
656
|
}
|
|
650
657
|
editableLogoStore.setLogoDraftToken(draftToken);
|
|
658
|
+
// Did the logo identity actually change between the two entries?
|
|
659
|
+
// If both `logoEdits` and the draft token match what was already
|
|
660
|
+
// live, the cached `editableLogoVariations` is still the right
|
|
661
|
+
// render and we just need to stamp it back into `brandPageData`
|
|
662
|
+
// (history-store strips `logoImageBase64Url` from snapshots, so
|
|
663
|
+
// the page-level base64 fields are now empty).
|
|
664
|
+
const logoUnchanged = prevDraftToken === draftToken &&
|
|
665
|
+
(logoEditsStr === undefined || logoEditsStr === prevLogoEditsStr);
|
|
666
|
+
if (logoUnchanged) {
|
|
667
|
+
editableLogoStore.stampLogoBase64IntoBrandPageData();
|
|
668
|
+
return;
|
|
669
|
+
}
|
|
651
670
|
const isByo = !!draft?.isByo;
|
|
652
671
|
if (isByo) {
|
|
653
672
|
// BYO uploads register a fresh `logoDraftToken` per upload, so
|
|
654
673
|
// `variationsByDraftToken` keyed off that token always matches the
|
|
655
674
|
// base64 the user saw at capture. No re-render — the uploaded
|
|
656
675
|
// image bytes are the source of truth and there's nothing for
|
|
657
|
-
// fabric-render to derive.
|
|
658
|
-
|
|
676
|
+
// fabric-render to derive. After restoring the variations cache,
|
|
677
|
+
// stamp the base64 back across header/footer/per-page logo
|
|
678
|
+
// content; the snapshot itself doesn't carry `logoImageBase64Url`.
|
|
679
|
+
if (editableLogoStore.restoreVariationsForDraftToken(draftToken)) {
|
|
680
|
+
editableLogoStore.stampLogoBase64IntoBrandPageData();
|
|
681
|
+
}
|
|
659
682
|
return;
|
|
660
683
|
}
|
|
661
|
-
// Designed (non-BYO) logo
|
|
662
|
-
//
|
|
663
|
-
//
|
|
664
|
-
//
|
|
665
|
-
// canvas, post-undo save metadata, recalculateLogoSizes) showing
|
|
666
|
-
// the post-edit base64 while the form fields show pre-edit state.
|
|
667
|
-
//
|
|
668
|
-
// Fire-and-forget the same render the live edit path runs:
|
|
684
|
+
// Designed (non-BYO) logo whose form state actually differs from
|
|
685
|
+
// the live state. The draft token is reused across every form-field
|
|
686
|
+
// edit, so the per-token cache only holds the latest render —
|
|
687
|
+
// re-issue the same fabric-render call the live edit path runs.
|
|
669
688
|
// `updateEditableLogoImageUrlAsync` POSTs the freshly-restored
|
|
670
|
-
// `logoEdits
|
|
671
|
-
//
|
|
672
|
-
// The undo/redo apply itself stays synchronous; the canvas updates
|
|
673
|
-
// a moment later when fabric-render responds.
|
|
689
|
+
// `logoEdits`, writes the returned base64 across every header/footer
|
|
690
|
+
// + per-page logo content + `editableLogoVariations`.
|
|
674
691
|
//
|
|
675
|
-
//
|
|
676
|
-
//
|
|
677
|
-
//
|
|
692
|
+
// Awaited (not fire-and-forget): two undos in quick succession would
|
|
693
|
+
// otherwise kick off two parallel render bursts whose `Promise.all`
|
|
694
|
+
// tasks interleave, leaving each variation showing whichever request
|
|
695
|
+
// happened to win the race rather than the variation that belongs
|
|
696
|
+
// to the snapshot the user landed on. Awaiting also keeps the call
|
|
697
|
+
// inside the `applyHistorySnapshot`/`isApplyingSnapshot` window, so
|
|
698
|
+
// the post-render writeback is naturally suppressed by the existing
|
|
699
|
+
// watcher guard — no `mergeNextMutation()` needed.
|
|
678
700
|
if (containerStore.isPrePurchase &&
|
|
679
701
|
logoEditsStr &&
|
|
680
702
|
logoStore.logoTemplateAsset) {
|
|
681
|
-
|
|
682
|
-
|
|
703
|
+
try {
|
|
704
|
+
await editableLogoStore.updateEditableLogoImageUrlAsync();
|
|
705
|
+
}
|
|
706
|
+
catch (error) {
|
|
683
707
|
console.error('brandpage-maker-store: failed to re-render logo on history apply', error);
|
|
684
|
-
}
|
|
708
|
+
}
|
|
685
709
|
}
|
|
686
710
|
},
|
|
687
711
|
/**
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { defineStore } from 'pinia';
|
|
2
|
-
import { computed,
|
|
2
|
+
import { computed, ref, shallowRef, toRaw, watch } from 'vue';
|
|
3
3
|
import { useBrandPageMakerStore } from '../brandpage-maker/brandpage-maker-store';
|
|
4
|
+
import { useBrandPageContainerStore } from '../brandpage-container';
|
|
4
5
|
import { useAiWebsiteBuilderThreadStore } from '../ai-thread/ai-website-builder-thread-store';
|
|
5
6
|
import { useEventTracker } from '../../composables/useEventTracker';
|
|
6
7
|
import { usePageNavigationStore } from '@shared/page-navigation/store/page-navigation-store';
|
|
7
8
|
import { useUiEditableLogoStore } from '@shared/logo-settings/store/editable-logo-store';
|
|
8
|
-
import { useShopConfigStore } from '@shared/ecommerce-settings/store/shop-settings-store';
|
|
9
|
-
import { useUiPageSettingsStore } from '@shared/page-settings/store';
|
|
10
9
|
/**
|
|
11
10
|
* Single-stack history model with a pointer instead of two stacks.
|
|
12
11
|
*
|
|
@@ -49,22 +48,6 @@ const MAX_ENTRY_BYTES = 25 * 1024 * 1024;
|
|
|
49
48
|
// reactive cascades (template loadPageNo, router afterEach, layout settle)
|
|
50
49
|
// that would otherwise make undo light up before the user has done anything.
|
|
51
50
|
const BASELINE_SETTLE_MS = 2000;
|
|
52
|
-
// Content-level wrapper keys whose `paymentConfig` child is a denormalised
|
|
53
|
-
// cache of `shopConfigStore.paymentConfig` (the user's Stripe Connect
|
|
54
|
-
// linkage). Stripe Connect linkage state is backend-confirmed (per
|
|
55
|
-
// `project-guardrails.md`) and must NEVER ride along on the undo/redo stack.
|
|
56
|
-
//
|
|
57
|
-
// paymentConfig is kept invariant under undo/redo by re-stamping every live
|
|
58
|
-
// wrapper from `shopConfigStore.paymentConfig` after every restore — see
|
|
59
|
-
// `restorePaymentConfigsOnLivePages`. The shop store itself is never
|
|
60
|
-
// touched by undo/redo (see `applyHistorySnapshot` step 6), so the live
|
|
61
|
-
// wrapper always equals the live shop store regardless of what's in the
|
|
62
|
-
// snapshot bytes.
|
|
63
|
-
const PAYMENT_CONFIG_WRAPPER_KEYS = [
|
|
64
|
-
'supportMeConfig',
|
|
65
|
-
'requestPaymentConfig',
|
|
66
|
-
'shopPaymentConfig',
|
|
67
|
-
];
|
|
68
51
|
export const useHistoryStore = defineStore('history', () => {
|
|
69
52
|
const eventTracker = useEventTracker();
|
|
70
53
|
// --- State ---
|
|
@@ -89,6 +72,53 @@ export const useHistoryStore = defineStore('history', () => {
|
|
|
89
72
|
* the capture hot path is synchronous.
|
|
90
73
|
*/
|
|
91
74
|
let cachedMakerStore = null;
|
|
75
|
+
/**
|
|
76
|
+
* Walk `brandPageData` and null `logoImageBase64Url` on every logo
|
|
77
|
+
* placement (header/footer × desktop/mobile + per-page logo content).
|
|
78
|
+
* Pre-purchase only — the same gate the save path uses
|
|
79
|
+
* (see `brand-page-container-store.ts:805`).
|
|
80
|
+
*
|
|
81
|
+
* Each rendered base64 is ~2-4 MB and the brand-site templates put the
|
|
82
|
+
* same logo in 6-8 places, so unstripped pre-purchase snapshots run
|
|
83
|
+
* 18-24 MB and bump the 25 MB per-entry cap, which silently drops the
|
|
84
|
+
* entry. The base64 is repopulated on undo by `_syncLogoSettingsFromSnapshot`
|
|
85
|
+
* (designed: re-issue fabric-render; BYO: stamp from per-token cache),
|
|
86
|
+
* so the snapshot doesn't need to carry it.
|
|
87
|
+
*/
|
|
88
|
+
function stripLogoBase64IfPrePurchase(data) {
|
|
89
|
+
try {
|
|
90
|
+
if (!useBrandPageContainerStore().isPrePurchase)
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
catch {
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
if (data.pageHeaderDesktop) {
|
|
97
|
+
data.pageHeaderDesktop.logoImageBase64Url = undefined;
|
|
98
|
+
}
|
|
99
|
+
if (data.pageHeaderMobile) {
|
|
100
|
+
data.pageHeaderMobile.logoImageBase64Url = undefined;
|
|
101
|
+
}
|
|
102
|
+
if (data.pageFooterDesktop) {
|
|
103
|
+
data.pageFooterDesktop.logoImageBase64Url = undefined;
|
|
104
|
+
}
|
|
105
|
+
if (data.pageFooterMobile) {
|
|
106
|
+
data.pageFooterMobile.logoImageBase64Url = undefined;
|
|
107
|
+
}
|
|
108
|
+
if (Array.isArray(data.pages)) {
|
|
109
|
+
for (const page of data.pages) {
|
|
110
|
+
if (!Array.isArray(page?.contents))
|
|
111
|
+
continue;
|
|
112
|
+
for (const content of page.contents) {
|
|
113
|
+
if (content &&
|
|
114
|
+
typeof content === 'object' &&
|
|
115
|
+
'logoImageBase64Url' in content) {
|
|
116
|
+
content.logoImageBase64Url = undefined;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
92
122
|
/**
|
|
93
123
|
* Serialize the current `brandPageData` into a detached JSON string.
|
|
94
124
|
* Synchronous — safe to call inside a microtask without racing a follow-up
|
|
@@ -98,7 +128,9 @@ export const useHistoryStore = defineStore('history', () => {
|
|
|
98
128
|
if (!cachedMakerStore)
|
|
99
129
|
return null;
|
|
100
130
|
try {
|
|
101
|
-
|
|
131
|
+
const cloned = JSON.parse(JSON.stringify(toRaw(cachedMakerStore.brandPageData)));
|
|
132
|
+
stripLogoBase64IfPrePurchase(cloned);
|
|
133
|
+
return JSON.stringify(cloned);
|
|
102
134
|
}
|
|
103
135
|
catch (error) {
|
|
104
136
|
console.error('history-store: failed to serialize snapshot', error);
|
|
@@ -180,8 +212,18 @@ export const useHistoryStore = defineStore('history', () => {
|
|
|
180
212
|
*/
|
|
181
213
|
function commitEntry(args) {
|
|
182
214
|
const current = entries.value[currentIndex.value];
|
|
183
|
-
|
|
215
|
+
// Compare both the snapshot bytes AND the logoEdits sidecar.
|
|
216
|
+
// Pre-purchase logo-tab edits (text/color/font) live in the
|
|
217
|
+
// `editableLogoStore.logoEdits` sidecar, NOT in `brandPageData`.
|
|
218
|
+
// The accompanying base64 writeback is also stripped from the
|
|
219
|
+
// snapshot (size cap), so a pure logo edit would produce a
|
|
220
|
+
// byte-identical snapshot to the previous entry — without the
|
|
221
|
+
// sidecar comparison every logo edit would dedup as a no-op.
|
|
222
|
+
if (current &&
|
|
223
|
+
current.snapshot === args.snapshot &&
|
|
224
|
+
current.logoEdits === args.logoEdits) {
|
|
184
225
|
return 'noop';
|
|
226
|
+
}
|
|
185
227
|
if (args.snapshot.length > MAX_ENTRY_BYTES) {
|
|
186
228
|
eventTracker.sendHistoryOversizedEvent({
|
|
187
229
|
attempted_bytes: args.snapshot.length,
|
|
@@ -425,9 +467,9 @@ export const useHistoryStore = defineStore('history', () => {
|
|
|
425
467
|
* dedicated `applyHistorySnapshot` action, which rehydrates every Pinia
|
|
426
468
|
* source store + own-store scalar fields that `brandPageData` reads from.
|
|
427
469
|
*
|
|
428
|
-
* Holds `isApplyingSnapshot`
|
|
429
|
-
*
|
|
430
|
-
*
|
|
470
|
+
* Holds `isApplyingSnapshot` for the duration of the apply so the
|
|
471
|
+
* watcher guard suppresses the cascade of mutations from being
|
|
472
|
+
* re-captured as a spurious duplicate entry.
|
|
431
473
|
*
|
|
432
474
|
* Active-page resolution priority:
|
|
433
475
|
* 1. Diff against `cameFromIndex` — any page present in the target
|
|
@@ -505,53 +547,11 @@ export const useHistoryStore = defineStore('history', () => {
|
|
|
505
547
|
cancelPendingAutoCapture();
|
|
506
548
|
try {
|
|
507
549
|
await brandPageMakerStore.applyHistorySnapshot(snapshot, resolvedActivePageId, targetEntry?.logoEdits);
|
|
508
|
-
await nextTick();
|
|
509
|
-
// Re-stamp `wrapper.paymentConfig` on every payment-config wrapper in
|
|
510
|
-
// the freshly-restored content tree from the live shop store. Stripe
|
|
511
|
-
// Connect linkage is backend-confirmed (per `project-guardrails.md`)
|
|
512
|
-
// and must NEVER come from the snapshot — the captured value can be
|
|
513
|
-
// arbitrarily stale (an entry captured before
|
|
514
|
-
// `PaymentConfigField.mixin.ts:created()` lazily filled in the
|
|
515
|
-
// wrapper carries `paymentConfig: undefined`) and using it would
|
|
516
|
-
// re-surface the "Please enable a payment provider" warning on
|
|
517
|
-
// undo. The shop store's value is itself never undoable (see
|
|
518
|
-
// `applyHistorySnapshot` step 6).
|
|
519
|
-
restorePaymentConfigsOnLivePages();
|
|
520
550
|
}
|
|
521
551
|
finally {
|
|
522
552
|
isApplyingSnapshot.value = false;
|
|
523
553
|
}
|
|
524
554
|
}
|
|
525
|
-
/**
|
|
526
|
-
* Walk the live `pageSettingsStore.pages` and stamp
|
|
527
|
-
* `wrapper.paymentConfig = shopConfigStore.paymentConfig` on every
|
|
528
|
-
* payment-config wrapper. Called from `applySnapshotString` after
|
|
529
|
-
* `applyHistorySnapshot` rebuilds page contents.
|
|
530
|
-
*/
|
|
531
|
-
function restorePaymentConfigsOnLivePages() {
|
|
532
|
-
try {
|
|
533
|
-
const shopStore = useShopConfigStore();
|
|
534
|
-
const pageSettingsStore = useUiPageSettingsStore();
|
|
535
|
-
const livePaymentConfig = shopStore.paymentConfig;
|
|
536
|
-
for (const page of pageSettingsStore.pages) {
|
|
537
|
-
for (const item of page.contents) {
|
|
538
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
539
|
-
const content = item.settings.content;
|
|
540
|
-
for (const key of PAYMENT_CONFIG_WRAPPER_KEYS) {
|
|
541
|
-
const wrapper = content?.[key];
|
|
542
|
-
if (wrapper &&
|
|
543
|
-
typeof wrapper === 'object' &&
|
|
544
|
-
!Array.isArray(wrapper)) {
|
|
545
|
-
wrapper.paymentConfig = livePaymentConfig;
|
|
546
|
-
}
|
|
547
|
-
}
|
|
548
|
-
}
|
|
549
|
-
}
|
|
550
|
-
}
|
|
551
|
-
catch (error) {
|
|
552
|
-
console.error('history-store: failed to restore paymentConfig on live pages', error);
|
|
553
|
-
}
|
|
554
|
-
}
|
|
555
555
|
/** Move the pointer back one step and apply the entry at the new position. */
|
|
556
556
|
async function undo() {
|
|
557
557
|
if (!canUndo.value)
|
package/lib/src/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as E, a as T, b as s, c as I, d as S, e as N, f as e, B as A, g as O, h as C, i as G, j as D, k as P, l as t, m as R, n as L, o as M, p as o, q as r, r as b, s as n, t as F, u as i, v as l, w as g, x as B, y as c, z as Y, C as U, D as d, E as u, F as H, G as p, H as y, I as K, J as k, K as m, L as V, M as X, N as h, O as v, P as W, Q as f, R as x, S as z, T as w, U as Z, V as j, W as Q, X as q, Y as J, Z as $, $ as aa, a0 as _a, a1 as Ea, a2 as Ta, a3 as sa, a4 as Ia, a5 as Sa, a6 as Na, a7 as ea, a8 as Aa, a9 as Oa, aa as Ca, ab as Ga, ac as Da, ad as Pa, ae as ta, af as Ra, ag as La, ah as Ma, ai as oa, aj as ra, ak as ba, al as na, am as Fa, an as ia, ao as la, ap as ga, aq as Ba, ar as ca, as as Ya, at as Ua, au as da, av as ua, aw as Ha, ax as pa, ay as ya, az as Ka, aA as ka, aB as ma, aC as Va, aD as Xa, aE as ha, aF as va, aG as Wa, aH as fa, aI as xa, aJ as za, aK as wa, aL as Za, aM as ja, aN as Qa, aO as qa, aP as Ja, aQ as $a, aR as a_, aS as __, aT as E_, aU as T_, aV as s_, aW as I_, aX as S_, aY as N_, aZ as e_, a_ as A_, a$ as O_, b0 as C_, b1 as G_, b2 as D_, b3 as P_, b4 as t_, b5 as R_, b6 as L_, b7 as M_, b8 as o_, b9 as r_, ba as b_, bb as n_, bc as F_, bd as i_, be as l_, bf as g_, bg as B_, bh as c_, bi as Y_, bj as U_, bk as d_, bl as u_, bm as H_, bn as p_, bo as y_, bp as K_, bq as k_, br as m_, bs as V_, bt as X_, bu as h_, bv as v_, bw as W_, bx as f_, by as x_, bz as z_, bA as w_, bB as Z_, bC as j_, bD as Q_, bE as q_, bF as J_, bG as $_, bH as aE, bI as _E, bJ as EE, bK as TE, bL as sE, bM as IE, bN as SE, bO as NE, bP as eE, bQ as AE, bR as OE, bS as CE, bT as GE, bU as DE, bV as PE, bW as tE, bX as RE, bY as LE, bZ as ME, b_ as oE, b$ as rE, c0 as bE, c1 as nE, c2 as FE, c3 as iE, c4 as lE, c5 as gE, c6 as BE, c7 as cE, c8 as YE, c9 as UE, ca as dE, cb as uE, cc as HE, cd as pE, ce as yE, cf as KE, cg as kE, ch as mE, ci as VE, cj as XE, ck as hE, cl as vE, cm as WE, cn as fE, co as xE } from "./lib-
|
|
1
|
+
import { A as E, a as T, b as s, c as I, d as S, e as N, f as e, B as A, g as O, h as C, i as G, j as D, k as P, l as t, m as R, n as L, o as M, p as o, q as r, r as b, s as n, t as F, u as i, v as l, w as g, x as B, y as c, z as Y, C as U, D as d, E as u, F as H, G as p, H as y, I as K, J as k, K as m, L as V, M as X, N as h, O as v, P as W, Q as f, R as x, S as z, T as w, U as Z, V as j, W as Q, X as q, Y as J, Z as $, $ as aa, a0 as _a, a1 as Ea, a2 as Ta, a3 as sa, a4 as Ia, a5 as Sa, a6 as Na, a7 as ea, a8 as Aa, a9 as Oa, aa as Ca, ab as Ga, ac as Da, ad as Pa, ae as ta, af as Ra, ag as La, ah as Ma, ai as oa, aj as ra, ak as ba, al as na, am as Fa, an as ia, ao as la, ap as ga, aq as Ba, ar as ca, as as Ya, at as Ua, au as da, av as ua, aw as Ha, ax as pa, ay as ya, az as Ka, aA as ka, aB as ma, aC as Va, aD as Xa, aE as ha, aF as va, aG as Wa, aH as fa, aI as xa, aJ as za, aK as wa, aL as Za, aM as ja, aN as Qa, aO as qa, aP as Ja, aQ as $a, aR as a_, aS as __, aT as E_, aU as T_, aV as s_, aW as I_, aX as S_, aY as N_, aZ as e_, a_ as A_, a$ as O_, b0 as C_, b1 as G_, b2 as D_, b3 as P_, b4 as t_, b5 as R_, b6 as L_, b7 as M_, b8 as o_, b9 as r_, ba as b_, bb as n_, bc as F_, bd as i_, be as l_, bf as g_, bg as B_, bh as c_, bi as Y_, bj as U_, bk as d_, bl as u_, bm as H_, bn as p_, bo as y_, bp as K_, bq as k_, br as m_, bs as V_, bt as X_, bu as h_, bv as v_, bw as W_, bx as f_, by as x_, bz as z_, bA as w_, bB as Z_, bC as j_, bD as Q_, bE as q_, bF as J_, bG as $_, bH as aE, bI as _E, bJ as EE, bK as TE, bL as sE, bM as IE, bN as SE, bO as NE, bP as eE, bQ as AE, bR as OE, bS as CE, bT as GE, bU as DE, bV as PE, bW as tE, bX as RE, bY as LE, bZ as ME, b_ as oE, b$ as rE, c0 as bE, c1 as nE, c2 as FE, c3 as iE, c4 as lE, c5 as gE, c6 as BE, c7 as cE, c8 as YE, c9 as UE, ca as dE, cb as uE, cc as HE, cd as pE, ce as yE, cf as KE, cg as kE, ch as mE, ci as VE, cj as XE, ck as hE, cl as vE, cm as WE, cn as fE, co as xE } from "./lib-DVs3jUit.js";
|
|
2
2
|
import { createPinia as wE, setActivePinia as ZE } from "pinia";
|
|
3
3
|
export {
|
|
4
4
|
E as ABOUT_SECTION_SETTINGS_CONFIG,
|