@designcrowd/library.brand-page 5.17.25-undo-1 → 5.17.25-undo-4
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-D4ev-dOV.js → CreatedOnBrandCrowd-de-de-Bfno64hd.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-en-us-l6fBsu39.js → CreatedOnBrandCrowd-en-us-D_vCn5Pl.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-es-es-DLQIQ5M2.js → CreatedOnBrandCrowd-es-es-Dbsv2mXS.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-fr-fr-DupdjGz_.js → CreatedOnBrandCrowd-fr-ca-C7cjAdAT.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-fr-ca-DupdjGz_.js → CreatedOnBrandCrowd-fr-fr-C7cjAdAT.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-pt-pt-DfQn7LrQ.js → CreatedOnBrandCrowd-pt-br-qkmkw32p.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-pt-br-DfQn7LrQ.js → CreatedOnBrandCrowd-pt-pt-qkmkw32p.js} +1 -1
- package/lib/src/{CreatedOnDcom-de-de-ya4QeOad.js → CreatedOnDcom-de-de-CQUNS-WQ.js} +1 -1
- package/lib/src/{CreatedOnDcom-en-us-Di2D0lWP.js → CreatedOnDcom-en-us-DSTor88S.js} +1 -1
- package/lib/src/{CreatedOnDcom-es-es-lXVX_P5c.js → CreatedOnDcom-es-es-B_gzXzCR.js} +1 -1
- package/lib/src/{CreatedOnDcom-fr-ca-DczLEsh-.js → CreatedOnDcom-fr-ca-DskYXGaJ.js} +1 -1
- package/lib/src/{CreatedOnDcom-fr-fr-DJpzYwiw.js → CreatedOnDcom-fr-fr-B3A-09VT.js} +1 -1
- package/lib/src/{CreatedOnDcom-pt-br-DbI1Kiaj.js → CreatedOnDcom-pt-br-EhBegIrb.js} +1 -1
- package/lib/src/{CreatedOnDcom-pt-pt-DbYfgRQW.js → CreatedOnDcom-pt-pt-BkWfCkfb.js} +1 -1
- package/lib/src/brand-page-maker/stores/brandpage-maker/brandpage-maker-store.js +11 -0
- package/lib/src/brand-page-maker/stores/history/history-store.d.ts +9 -9
- package/lib/src/brand-page-maker/stores/history/history-store.js +102 -13
- package/lib/src/brand-page-maker/stores/user/user-store.js +1 -1
- package/lib/src/index.mjs +1 -1
- package/lib/src/{lib-DbbZWyn5.js → lib-qbF5b3zi.js} +4338 -4292
- package/lib/src/shared/logo-settings/components/EditLogoSettings.mixin.js +11 -0
- package/package.json +1 -1
- package/src/brand-page-maker/stores/brandpage-maker/brandpage-maker-store.ts +14 -0
- package/src/brand-page-maker/stores/history/history-store.test.ts +200 -14
- package/src/brand-page-maker/stores/history/history-store.ts +122 -18
- package/src/brand-page-maker/stores/user/user-store.ts +1 -1
- package/src/shared/logo-settings/components/EditLogoSettings.mixin.ts +11 -0
|
@@ -575,6 +575,8 @@ export const useBrandPageMakerStore = defineStore('brandPageMaker', {
|
|
|
575
575
|
},
|
|
576
576
|
_syncLogoSettingsFromSnapshot(snapshot) {
|
|
577
577
|
const logoSettingsStore = useUiLogoSettingsStore();
|
|
578
|
+
const editableLogoStore = useUiEditableLogoStore();
|
|
579
|
+
const logoStore = useLogoStore();
|
|
578
580
|
const logoImage = snapshot.brandPageType === BRAND_PAGE_TYPES.default
|
|
579
581
|
? snapshot.pages?.[0]?.contents?.find((c) => c.type === 'logo')?.logoImage
|
|
580
582
|
: snapshot.pageHeaderDesktop?.logoImage;
|
|
@@ -583,6 +585,15 @@ export const useBrandPageMakerStore = defineStore('brandPageMaker', {
|
|
|
583
585
|
logoSettingsStore.setState({
|
|
584
586
|
newState: { selectedLogoImage: logoImage },
|
|
585
587
|
});
|
|
588
|
+
// Re-derive `enableEditMode` so the sidebar's design/upload tabs
|
|
589
|
+
// reflect the restored logo. BYO logos can't be edited in the design
|
|
590
|
+
// surface, so `enableEditMode` must flip false on undo back to a BYO
|
|
591
|
+
// upload and true on redo back to a designed logo. Logo drafts are
|
|
592
|
+
// append-only during a session, so a token in the snapshot always
|
|
593
|
+
// resolves here.
|
|
594
|
+
const draft = logoStore.getLogoDraftAssetByToken(logoImage.logoDraftToken);
|
|
595
|
+
if (draft)
|
|
596
|
+
editableLogoStore.setEnableEditMode(!draft.isByo);
|
|
586
597
|
},
|
|
587
598
|
_fallbackSidebarIfSelectedContentMissing(snapshot) {
|
|
588
599
|
const contentSettingsStore = useUiContentSettingsStore();
|
|
@@ -35,9 +35,9 @@ export declare const useHistoryStore: import("pinia").StoreDefinition<"history",
|
|
|
35
35
|
source: HistoryEntry['source'];
|
|
36
36
|
actor: HistoryEntry['actor'];
|
|
37
37
|
label?: string;
|
|
38
|
-
}) => 'committed' | 'oversized' | 'skipped';
|
|
39
|
-
captureTemplateSwitch: (label?: string) => 'committed' | 'oversized' | 'skipped';
|
|
40
|
-
captureAiChangeset: (label?: string) => 'committed' | 'oversized' | 'skipped';
|
|
38
|
+
}) => 'committed' | 'oversized' | 'noop' | 'skipped';
|
|
39
|
+
captureTemplateSwitch: (label?: string) => 'committed' | 'oversized' | 'noop' | 'skipped';
|
|
40
|
+
captureAiChangeset: (label?: string) => 'committed' | 'oversized' | 'noop' | 'skipped';
|
|
41
41
|
undo: () => Promise<void>;
|
|
42
42
|
redo: () => Promise<void>;
|
|
43
43
|
getCurrentSizeBytes: () => number;
|
|
@@ -54,9 +54,9 @@ export declare const useHistoryStore: import("pinia").StoreDefinition<"history",
|
|
|
54
54
|
source: HistoryEntry['source'];
|
|
55
55
|
actor: HistoryEntry['actor'];
|
|
56
56
|
label?: string;
|
|
57
|
-
}) => 'committed' | 'oversized' | 'skipped';
|
|
58
|
-
captureTemplateSwitch: (label?: string) => 'committed' | 'oversized' | 'skipped';
|
|
59
|
-
captureAiChangeset: (label?: string) => 'committed' | 'oversized' | 'skipped';
|
|
57
|
+
}) => 'committed' | 'oversized' | 'noop' | 'skipped';
|
|
58
|
+
captureTemplateSwitch: (label?: string) => 'committed' | 'oversized' | 'noop' | 'skipped';
|
|
59
|
+
captureAiChangeset: (label?: string) => 'committed' | 'oversized' | 'noop' | 'skipped';
|
|
60
60
|
undo: () => Promise<void>;
|
|
61
61
|
redo: () => Promise<void>;
|
|
62
62
|
getCurrentSizeBytes: () => number;
|
|
@@ -73,9 +73,9 @@ export declare const useHistoryStore: import("pinia").StoreDefinition<"history",
|
|
|
73
73
|
source: HistoryEntry['source'];
|
|
74
74
|
actor: HistoryEntry['actor'];
|
|
75
75
|
label?: string;
|
|
76
|
-
}) => 'committed' | 'oversized' | 'skipped';
|
|
77
|
-
captureTemplateSwitch: (label?: string) => 'committed' | 'oversized' | 'skipped';
|
|
78
|
-
captureAiChangeset: (label?: string) => 'committed' | 'oversized' | 'skipped';
|
|
76
|
+
}) => 'committed' | 'oversized' | 'noop' | 'skipped';
|
|
77
|
+
captureTemplateSwitch: (label?: string) => 'committed' | 'oversized' | 'noop' | 'skipped';
|
|
78
|
+
captureAiChangeset: (label?: string) => 'committed' | 'oversized' | 'noop' | 'skipped';
|
|
79
79
|
undo: () => Promise<void>;
|
|
80
80
|
redo: () => Promise<void>;
|
|
81
81
|
getCurrentSizeBytes: () => number;
|
|
@@ -80,24 +80,119 @@ export const useHistoryStore = defineStore('history', () => {
|
|
|
80
80
|
return null;
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
|
+
/**
|
|
84
|
+
* Normalize a snapshot for the dedup byte-compare. Strips/canonicalizes
|
|
85
|
+
* fields that get mutated by sidebar-open reactive cascades but aren't
|
|
86
|
+
* user-visible edits — without this, opening a content panel produces an
|
|
87
|
+
* undo step that "does nothing" when replayed.
|
|
88
|
+
*
|
|
89
|
+
* Known phantom sources (BP-5506):
|
|
90
|
+
* - TipTap RTE writing back its empty-paragraph default on first mount
|
|
91
|
+
* (e.g. `""` → `<p style="text-align: center;"></p>`).
|
|
92
|
+
* - Lazy hydration of `textStyle` fields (`fontSize`, `letterSpacing`)
|
|
93
|
+
* when a content settings panel computes resolved values from
|
|
94
|
+
* `textStyleType` and writes them onto the model.
|
|
95
|
+
* - `isModifiedAfterTemplateApplied` flipping on first edit gesture.
|
|
96
|
+
*
|
|
97
|
+
* Used ONLY for dedup comparison. Stored snapshots remain unchanged so
|
|
98
|
+
* `applyHistorySnapshot` always sees the real state.
|
|
99
|
+
*/
|
|
100
|
+
// Empty paragraph forms TipTap emits when an editor mounts on an empty
|
|
101
|
+
// string. Treated as equivalent to `""` for dedup.
|
|
102
|
+
const EMPTY_RTE_HTML = /^<p(\s[^>]*)?>(<br\s*\/?>)?<\/p>$/;
|
|
103
|
+
function isEmptyRteHtml(value) {
|
|
104
|
+
return typeof value === 'string' && EMPTY_RTE_HTML.test(value);
|
|
105
|
+
}
|
|
106
|
+
function normalizeNode(node) {
|
|
107
|
+
if (Array.isArray(node))
|
|
108
|
+
return node.map(normalizeNode);
|
|
109
|
+
if (node === null || typeof node !== 'object')
|
|
110
|
+
return node;
|
|
111
|
+
const out = {};
|
|
112
|
+
for (const key of Object.keys(node)) {
|
|
113
|
+
const v = node[key];
|
|
114
|
+
// Strip the template-modified flag — it's meta-state that flips on
|
|
115
|
+
// first edit gesture (e.g. clicking into a panel) and does not
|
|
116
|
+
// represent a user-visible change.
|
|
117
|
+
if (key === 'isModifiedAfterTemplateApplied')
|
|
118
|
+
continue;
|
|
119
|
+
// Empty TipTap paragraphs collapse to "" — and an empty string is
|
|
120
|
+
// equivalent to the key being absent (JSON.stringify drops `undefined`),
|
|
121
|
+
// so skip the key entirely. Otherwise the normalizer would emit
|
|
122
|
+
// `"description": ""` here while the baseline snapshot — captured when
|
|
123
|
+
// `description` was `undefined` — has no `description` key at all,
|
|
124
|
+
// and the two normalized strings would differ.
|
|
125
|
+
if (isEmptyRteHtml(v) || v === '')
|
|
126
|
+
continue;
|
|
127
|
+
// textStyle / descriptionStyle / titleStyle / *Style objects:
|
|
128
|
+
// strip lazily-hydrated fields that get filled in when the settings
|
|
129
|
+
// panel computes resolved values from `textStyleType`.
|
|
130
|
+
if (v !== null &&
|
|
131
|
+
typeof v === 'object' &&
|
|
132
|
+
!Array.isArray(v) &&
|
|
133
|
+
/Style$/.test(key)) {
|
|
134
|
+
const styleObj = v;
|
|
135
|
+
const cleanedStyle = {};
|
|
136
|
+
for (const sk of Object.keys(styleObj)) {
|
|
137
|
+
if (sk === 'fontSize' || sk === 'letterSpacing')
|
|
138
|
+
continue;
|
|
139
|
+
cleanedStyle[sk] = normalizeNode(styleObj[sk]);
|
|
140
|
+
}
|
|
141
|
+
out[key] = cleanedStyle;
|
|
142
|
+
continue;
|
|
143
|
+
}
|
|
144
|
+
out[key] = normalizeNode(v);
|
|
145
|
+
}
|
|
146
|
+
return out;
|
|
147
|
+
}
|
|
148
|
+
function normalizeSnapshotForDedup(snapshotStr) {
|
|
149
|
+
try {
|
|
150
|
+
const parsed = JSON.parse(snapshotStr);
|
|
151
|
+
return JSON.stringify(normalizeNode(parsed));
|
|
152
|
+
}
|
|
153
|
+
catch {
|
|
154
|
+
return snapshotStr;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
83
157
|
/**
|
|
84
158
|
* Commit a new entry into the stack at the current pointer position.
|
|
85
159
|
*
|
|
86
160
|
* Returns 'committed' when the entry lands in the stack, 'oversized' when
|
|
87
|
-
* the entry exceeds `MAX_ENTRY_BYTES` and is skipped (FR-13c)
|
|
88
|
-
*
|
|
161
|
+
* the entry exceeds `MAX_ENTRY_BYTES` and is skipped (FR-13c), or 'noop'
|
|
162
|
+
* when the snapshot is byte-identical to the entry at the current pointer.
|
|
163
|
+
* Callers can use the return to emit telemetry — analytics wiring lives
|
|
164
|
+
* in U5.
|
|
89
165
|
*
|
|
90
|
-
* Enforces
|
|
91
|
-
* 1.
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
*
|
|
166
|
+
* Enforces these invariants in order:
|
|
167
|
+
* 1. Drop no-op duplicates — if the new snapshot is identical to the
|
|
168
|
+
* entry at the current pointer, skip it. Color/text settle paths,
|
|
169
|
+
* template-switch confirms with no real diff, and AI applies that
|
|
170
|
+
* land identical state would otherwise create undo/redo steps that
|
|
171
|
+
* do nothing visible.
|
|
172
|
+
* 2. FR-13c — if the new entry exceeds 5 MB, skip it entirely.
|
|
173
|
+
* 3. FR-11 — truncate any redo tail.
|
|
174
|
+
* 4. FR-12 — cap at 40 entries; drop oldest non-baseline on overflow.
|
|
175
|
+
* 5. FR-13 — keep total memory under 100 MB; drop oldest non-baseline
|
|
95
176
|
* repeatedly until we're under budget.
|
|
96
177
|
*
|
|
97
178
|
* Baseline (entry 0) is never evicted so "undo everything" always returns
|
|
98
179
|
* to session start.
|
|
99
180
|
*/
|
|
100
181
|
function commitEntry(args) {
|
|
182
|
+
const current = entries.value[currentIndex.value];
|
|
183
|
+
if (current) {
|
|
184
|
+
if (current.snapshot === args.snapshot)
|
|
185
|
+
return 'noop';
|
|
186
|
+
// Phantom-edit dedup: normalize both snapshots to ignore
|
|
187
|
+
// sidebar-open reactive cascades (RTE empty-paragraph init, lazy
|
|
188
|
+
// textStyle hydration, isModifiedAfterTemplateApplied flips). If
|
|
189
|
+
// they're equal after normalization, this capture has no
|
|
190
|
+
// user-visible diff vs. the entry at the pointer.
|
|
191
|
+
if (normalizeSnapshotForDedup(current.snapshot) ===
|
|
192
|
+
normalizeSnapshotForDedup(args.snapshot)) {
|
|
193
|
+
return 'noop';
|
|
194
|
+
}
|
|
195
|
+
}
|
|
101
196
|
if (args.snapshot.length > MAX_ENTRY_BYTES) {
|
|
102
197
|
eventTracker.sendHistoryOversizedEvent({
|
|
103
198
|
attempted_bytes: args.snapshot.length,
|
|
@@ -188,12 +283,6 @@ export const useHistoryStore = defineStore('history', () => {
|
|
|
188
283
|
const snapshot = serializeCurrentBrandPageData();
|
|
189
284
|
if (!snapshot)
|
|
190
285
|
return;
|
|
191
|
-
// Skip no-op captures so post-init reactivity (template load, layout
|
|
192
|
-
// settling) doesn't create a duplicate baseline that makes undo
|
|
193
|
-
// appear available with nothing to undo.
|
|
194
|
-
const current = entries.value[currentIndex.value];
|
|
195
|
-
if (current && current.snapshot === snapshot)
|
|
196
|
-
return;
|
|
197
286
|
// During the post-init settle window, fold any captured mutation back
|
|
198
287
|
// into the baseline (entry 0). Async cascades like template
|
|
199
288
|
// `loadPageNo`, the router's `afterEach`, and layout settling all
|
|
@@ -20,7 +20,7 @@ export const useBrandPageMakerUserStore = defineStore('brandPageMakerUser', {
|
|
|
20
20
|
canUseAITextGenerator: false,
|
|
21
21
|
canUseGoogleAdsense: false,
|
|
22
22
|
googleAdsenseEnabled: false,
|
|
23
|
-
canUseUndoRedo:
|
|
23
|
+
canUseUndoRedo: false,
|
|
24
24
|
},
|
|
25
25
|
emailAddress: '',
|
|
26
26
|
hasPremiumSubscription: false,
|
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-qbF5b3zi.js";
|
|
2
2
|
import { createPinia as wE, setActivePinia as ZE } from "pinia";
|
|
3
3
|
export {
|
|
4
4
|
E as ABOUT_SECTION_SETTINGS_CONFIG,
|