@designcrowd/library.brand-page 5.18.1-undo-32 → 5.18.1-undo-33

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 (40) hide show
  1. package/lib/src/{CreatedOnBrandCrowd-de-de-DUgkmx89.js → CreatedOnBrandCrowd-de-de-986OpXvU.js} +1 -1
  2. package/lib/src/{CreatedOnBrandCrowd-en-us-C5dQGLuA.js → CreatedOnBrandCrowd-en-us-CTZuZ366.js} +1 -1
  3. package/lib/src/{CreatedOnBrandCrowd-es-es-CjPcnNlq.js → CreatedOnBrandCrowd-es-es-CHrTgX9-.js} +1 -1
  4. package/lib/src/{CreatedOnBrandCrowd-fr-fr-D2wnZOOE.js → CreatedOnBrandCrowd-fr-ca-xJAvxQ-x.js} +1 -1
  5. package/lib/src/{CreatedOnBrandCrowd-fr-ca-D2wnZOOE.js → CreatedOnBrandCrowd-fr-fr-xJAvxQ-x.js} +1 -1
  6. package/lib/src/{CreatedOnBrandCrowd-pt-pt-OQj-IBh_.js → CreatedOnBrandCrowd-pt-br-lpRIGIcs.js} +1 -1
  7. package/lib/src/{CreatedOnBrandCrowd-pt-br-OQj-IBh_.js → CreatedOnBrandCrowd-pt-pt-lpRIGIcs.js} +1 -1
  8. package/lib/src/{CreatedOnDcom-de-de-DLijuIaL.js → CreatedOnDcom-de-de-CZuim3ee.js} +1 -1
  9. package/lib/src/{CreatedOnDcom-en-us-D9M_heGE.js → CreatedOnDcom-en-us-DG4I5f4s.js} +1 -1
  10. package/lib/src/{CreatedOnDcom-es-es-PgWwbBLA.js → CreatedOnDcom-es-es-Hpieh1wX.js} +1 -1
  11. package/lib/src/{CreatedOnDcom-fr-ca-BXiB-abj.js → CreatedOnDcom-fr-ca-DWr5P-df.js} +1 -1
  12. package/lib/src/{CreatedOnDcom-fr-fr-BXhTmu7F.js → CreatedOnDcom-fr-fr-CHfOyS6V.js} +1 -1
  13. package/lib/src/{CreatedOnDcom-pt-br-3e6y567w.js → CreatedOnDcom-pt-br-bQwCCDDI.js} +1 -1
  14. package/lib/src/{CreatedOnDcom-pt-pt-GojOtHmO.js → CreatedOnDcom-pt-pt-bo-i_h0N.js} +1 -1
  15. package/lib/src/brand-page-maker/composables/rich-text-editor/useRichTextEditor.js +2 -11
  16. package/lib/src/brand-page-maker/stores/brandpage-maker/brandpage-maker-store.js +15 -47
  17. package/lib/src/brand-page-maker/stores/history/history-store.d.ts +7 -47
  18. package/lib/src/brand-page-maker/stores/history/history-store.js +63 -277
  19. package/lib/src/index.mjs +1 -1
  20. package/lib/src/{lib-DVs3jUit.js → lib-DNHBgZyy.js} +3887 -3903
  21. package/lib/src/shared/content-settings/components/GenericTextInput.mixin.d.ts +1 -1
  22. package/lib/src/shared/content-settings/components/content-settings/ContentSettings.mixin.js +1 -8
  23. package/lib/src/shared/content-settings/components/email-field/EmailField.mixin.d.ts +1 -1
  24. package/lib/src/shared/content-settings/components/payment-config-field/PaymentConfigField.mixin.js +2 -8
  25. package/lib/src/shared/content-settings/components/radio-field/RadioField.mixin.d.ts +1 -1
  26. package/lib/src/shared/content-settings/components/tel-field/TelField.mixin.d.ts +1 -1
  27. package/lib/src/shared/content-settings/components/text-field/TextField.mixin.d.ts +1 -1
  28. package/lib/src/shared/content-settings/components/textarea-field/TextareaField.mixin.d.ts +1 -1
  29. package/lib/src/shared/content-settings/components/url-field/UrlField.mixin.d.ts +1 -1
  30. package/lib/src/shared/content-settings/components/youtube-video-field/YoutubeVideoField.mixin.d.ts +1 -1
  31. package/lib/src/shared/logo-settings/store/editable-logo-store.d.ts +0 -18
  32. package/lib/src/shared/logo-settings/store/editable-logo-store.js +6 -24
  33. package/package.json +1 -1
  34. package/src/brand-page-maker/composables/rich-text-editor/useRichTextEditor.ts +2 -11
  35. package/src/brand-page-maker/stores/brandpage-maker/brandpage-maker-store.ts +15 -47
  36. package/src/brand-page-maker/stores/history/history-store.ts +70 -333
  37. package/src/shared/content-settings/components/content-settings/ContentSettings.mixin.ts +1 -8
  38. package/src/shared/content-settings/components/page-dropdown-field/PageDropdownField.vue +1 -4
  39. package/src/shared/content-settings/components/payment-config-field/PaymentConfigField.mixin.ts +2 -8
  40. package/src/shared/logo-settings/store/editable-logo-store.ts +9 -29
@@ -187,8 +187,8 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
187
187
  minLength: number;
188
188
  maxLength: number;
189
189
  value: string | false | undefined;
190
- isRequired: boolean;
191
190
  attrs: Record<string, any>;
191
+ isRequired: boolean;
192
192
  isToggled: boolean;
193
193
  readOnly: boolean;
194
194
  contentType: string;
@@ -55,14 +55,7 @@ export default defineComponent({
55
55
  },
56
56
  mounted() {
57
57
  if (this.canUseRichTextEditor) {
58
- // `switchAllContentToRTE` walks every content item on every page
59
- // and rewraps plain-text titles/paragraphs in TipTap HTML so they
60
- // render through the inline RTE. That's a hydration write — it
61
- // happens whenever the Content sidebar tab mounts (incl. when the
62
- // user clicks the header in the canvas) and produces no
63
- // user-visible change. Arm the merge flag so the watcher folds
64
- // the resulting flush into the current head entry instead of
65
- // pushing a phantom undo step.
58
+ // RTE rewrap on tab mount — fold into current head.
66
59
  this.historyStore.mergeNextMutation();
67
60
  switchAllContentToRTE(this.pageSettingsStore, this.externalEditor, this.styleSettingsStore);
68
61
  }
@@ -184,8 +184,8 @@ declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import
184
184
  minLength: number;
185
185
  maxLength: number;
186
186
  value: string | false | undefined;
187
- isRequired: boolean;
188
187
  attrs: Record<string, any>;
188
+ isRequired: boolean;
189
189
  isToggled: boolean;
190
190
  readOnly: boolean;
191
191
  contentType: string;
@@ -102,14 +102,8 @@ export default defineComponent({
102
102
  name: this.name,
103
103
  value,
104
104
  };
105
- // Stripe Connect linkage hydration runs the first time the user
106
- // opens a Tipping/Request Payment/Shop section sidebar. The emit
107
- // below mutates `brandPageData[*].paymentConfig` from undefined to
108
- // the live `shopConfigStore.paymentConfig` — no user authoring
109
- // intent. Arm the merge flag so the watcher's flush folds this
110
- // into the current head instead of pushing a phantom undo entry
111
- // that would, when undone, surface the "Please enable a payment
112
- // provider" warning.
105
+ // Lazy paymentConfig hydration — fold into current head instead
106
+ // of pushing a phantom entry.
113
107
  this.historyStore.mergeNextMutation();
114
108
  this.$emit('update:modelValue', payload);
115
109
  }
@@ -110,9 +110,9 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
110
110
  placeholder: string;
111
111
  variant: string;
112
112
  value: string | boolean | Record<string, any>;
113
- isRequired: boolean;
114
113
  multiple: boolean;
115
114
  optionsConvertor: OptionsConvertor<unknown>;
115
+ isRequired: boolean;
116
116
  }, {}, {
117
117
  FieldSubHeader: import("vue").DefineComponent<{}, {}, any>;
118
118
  Button: any;
@@ -184,8 +184,8 @@ declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import
184
184
  minLength: number;
185
185
  maxLength: number;
186
186
  value: string | false | undefined;
187
- isRequired: boolean;
188
187
  attrs: Record<string, any>;
188
+ isRequired: boolean;
189
189
  isToggled: boolean;
190
190
  readOnly: boolean;
191
191
  contentType: string;
@@ -184,8 +184,8 @@ declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import
184
184
  minLength: number;
185
185
  maxLength: number;
186
186
  value: string | false | undefined;
187
- isRequired: boolean;
188
187
  attrs: Record<string, any>;
188
+ isRequired: boolean;
189
189
  isToggled: boolean;
190
190
  readOnly: boolean;
191
191
  contentType: string;
@@ -198,8 +198,8 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
198
198
  minLength: number;
199
199
  maxLength: number;
200
200
  value: string | false | undefined;
201
- isRequired: boolean;
202
201
  attrs: Record<string, any>;
202
+ isRequired: boolean;
203
203
  isToggled: boolean;
204
204
  readOnly: boolean;
205
205
  contentType: string;
@@ -191,8 +191,8 @@ declare const _default: import("vue").DefineComponent<{}, {}, Record<string, any
191
191
  minLength: number;
192
192
  maxLength: number;
193
193
  value: string | false | undefined;
194
- isRequired: boolean;
195
194
  attrs: Record<string, any>;
195
+ isRequired: boolean;
196
196
  isToggled: boolean;
197
197
  readOnly: boolean;
198
198
  contentType: string;
@@ -187,8 +187,8 @@ declare const _default: import("vue").DefineComponent<{}, {}, Record<string, any
187
187
  minLength: number;
188
188
  maxLength: number;
189
189
  value: string | false | undefined;
190
- isRequired: boolean;
191
190
  attrs: Record<string, any>;
191
+ isRequired: boolean;
192
192
  isToggled: boolean;
193
193
  readOnly: boolean;
194
194
  contentType: string;
@@ -186,25 +186,7 @@ export declare const useUiEditableLogoStore: import("pinia").StoreDefinition<"ui
186
186
  getEditableLogoVariationByVariationId(id: number): any;
187
187
  getEditableLogoVariationByBase64(base64: string): any;
188
188
  updateEditableLogoImageUrlAsync(defaultPrimaryText?: string, overrideLogoVariation?: number | undefined, layout?: string): Promise<void>;
189
- /**
190
- * Stamp `editableLogoVariations[*].base64` across every consumer in
191
- * `brandPageData`: header/footer logo sections (desktop + mobile)
192
- * and every `LogoContent` block on every page. Used by the live edit
193
- * path after a fabric-render POST AND by the undo/redo BYO branch
194
- * after `restoreVariationsForDraftToken` has rehydrated the cache.
195
- *
196
- * The history store strips `logoImageBase64Url` from snapshots to
197
- * keep them under the 25 MB per-entry cap, so something has to
198
- * write the base64 back into `brandPageData` after restore — for
199
- * designed logos it's the awaited fabric-render call; for BYO it's
200
- * this method.
201
- */
202
189
  stampLogoBase64IntoBrandPageData(overrideLogoVariation?: number): void;
203
- /**
204
- * Restore the variations grid for `logoDraftToken` from the per-token
205
- * cache. Called by `_syncLogoSettingsFromSnapshot` during undo/redo.
206
- * Returns true on cache hit.
207
- */
208
190
  restoreVariationsForDraftToken(logoDraftToken: string): boolean;
209
191
  updateMetadataAsync(defaultPrimaryText?: string, resetLogoTemplateMetadata?: boolean, layout?: string): Promise<void>;
210
192
  updateEditableLogoImageByVariationAsync(editableLogoVariation: EditableLogoVariation, defaultPrimaryText?: string, layout?: string): Promise<ModifyLogoDataResponse | null>;
@@ -219,30 +219,15 @@ export const useUiEditableLogoStore = defineStore('uiEditableLogo', {
219
219
  const tasks = this.editableLogoVariations.map((x) => this.updateEditableLogoImageByVariationAsync(x, defaultPrimaryText, layout));
220
220
  await Promise.all(tasks);
221
221
  this.stampLogoBase64IntoBrandPageData(overrideLogoVariation);
222
- // Stash the freshly rendered variation set under the active draft
223
- // token so undo can restore it later without re-rendering. This is
224
- // the only place in production that meaningfully populates
225
- // `editableLogoVariations` (BYO upload + designed-logo setStateAsync
226
- // both funnel here), so caching here keeps every distinct draft's
227
- // grid available for the lifetime of the session.
222
+ // Cache per draft token so BYO undo can restore without re-rendering.
228
223
  if (this.logoDraftToken) {
229
224
  this.variationsByDraftToken[this.logoDraftToken] =
230
225
  this.editableLogoVariations.map((v) => ({ ...v }));
231
226
  }
232
227
  },
233
- /**
234
- * Stamp `editableLogoVariations[*].base64` across every consumer in
235
- * `brandPageData`: header/footer logo sections (desktop + mobile)
236
- * and every `LogoContent` block on every page. Used by the live edit
237
- * path after a fabric-render POST AND by the undo/redo BYO branch
238
- * after `restoreVariationsForDraftToken` has rehydrated the cache.
239
- *
240
- * The history store strips `logoImageBase64Url` from snapshots to
241
- * keep them under the 25 MB per-entry cap, so something has to
242
- * write the base64 back into `brandPageData` after restore — for
243
- * designed logos it's the awaited fabric-render call; for BYO it's
244
- * this method.
245
- */
228
+ // Stamp editableLogoVariations[*].base64 across header/footer + every
229
+ // LogoContent. Called by the live edit path post-render, and by
230
+ // undo/redo to repopulate the stripped logoImageBase64Url fields.
246
231
  stampLogoBase64IntoBrandPageData(overrideLogoVariation) {
247
232
  const pageSettingStore = useUiPageSettingsStore();
248
233
  [PAGE_SECTIONS.header, PAGE_SECTIONS.footer].forEach((section) => {
@@ -270,11 +255,8 @@ export const useUiEditableLogoStore = defineStore('uiEditableLogo', {
270
255
  });
271
256
  });
272
257
  },
273
- /**
274
- * Restore the variations grid for `logoDraftToken` from the per-token
275
- * cache. Called by `_syncLogoSettingsFromSnapshot` during undo/redo.
276
- * Returns true on cache hit.
277
- */
258
+ // Restore variations grid for a draft token from the per-token cache.
259
+ // Returns true on cache hit.
278
260
  restoreVariationsForDraftToken(logoDraftToken) {
279
261
  const cached = this.variationsByDraftToken[logoDraftToken];
280
262
  if (!cached)
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@designcrowd/library.brand-page",
3
3
  "description": "A collection of Maker/Designer applications",
4
- "version": "5.18.1-undo-32",
4
+ "version": "5.18.1-undo-33",
5
5
  "author": "Design.com Eng",
6
6
  "license": "UNLICENSED",
7
7
  "type": "module",
@@ -211,17 +211,8 @@ export const useRichTextEditor = (
211
211
  ): UseRichTextEditorReturn => {
212
212
  const historyStore = useHistoryStore();
213
213
 
214
- // TipTap rehydrates `model.value` on first mount and writes the
215
- // canonical HTML back via `editor.on('update', ...)` — even when the
216
- // user-visible text is unchanged (it normalises whitespace, wraps plain
217
- // text in `<p>`, expands `%0A` to `<br>`, mirrors the resolved textStyle
218
- // as inline `<strong>`/`<span style="...">`/`<mark>` tags, etc). Each of
219
- // those rehydration writes mutates `brandPageData` and would otherwise
220
- // surface as a phantom undo entry the first time the user opens a
221
- // sidebar or clicks into a section. Arming the merge flag folds the
222
- // resulting watcher flush into the current head instead of pushing.
223
- // Idempotent — every editor on the page mounting at once collapses
224
- // into the same merge.
214
+ // TipTap rehydrates and writes back canonical HTML on mount — fold
215
+ // that into the current head instead of pushing a phantom entry.
225
216
  historyStore.mergeNextMutation();
226
217
 
227
218
  const editor = new Editor({
@@ -924,23 +924,15 @@ export const useBrandPageMakerStore = defineStore('brandPageMaker', {
924
924
  const logoStore = useLogoStore();
925
925
  const containerStore = useBrandPageContainerStore();
926
926
 
927
- // Snapshot the pre-restore logo identity BEFORE we $patch logoEdits.
928
- // Used below to short-circuit the fabric-render call when the entry
929
- // we're restoring has the same logoEdits + draft token as the live
930
- // state — i.e. only non-logo state changed between the two entries.
927
+ // Pre-restore logo identity, used to short-circuit the
928
+ // fabric-render call when only non-logo state changed.
931
929
  const prevLogoEditsStr = JSON.stringify(
932
930
  toRaw(editableLogoStore.logoEdits),
933
931
  );
934
932
  const prevDraftToken = editableLogoStore.logoDraftToken;
935
933
 
936
- // Restore `editableLogoStore.logoEdits` first — sidecar to `brandPageData`,
937
- // captured per-entry. Wholesale-replace via `$patch` so a previous
938
- // entry's textObjects/colors don't leak through (e.g. switching
939
- // template A→B then undoing A's restored object set must NOT contain
940
- // B's textObject ids). Failing parse is non-fatal; the logo tab will
941
- // just keep showing whatever logoEdits state was already loaded —
942
- // canvas + saved metadata still come from `brandPageData` + the
943
- // save-time `updateMetadataAsync` round-trip.
934
+ // Wholesale-replace via $patch so prior textObjects/colors don't
935
+ // leak across template switches.
944
936
  if (logoEditsStr) {
945
937
  try {
946
938
  const parsed = JSON.parse(logoEditsStr);
@@ -973,12 +965,8 @@ export const useBrandPageMakerStore = defineStore('brandPageMaker', {
973
965
 
974
966
  if (!draftToken) return;
975
967
 
976
- // Re-derive `enableEditMode` and the active template asset from the
977
- // logo-store's draft registry. Drafts are append-only for the session,
978
- // and BYO upload stamps `templateAsset` onto the registered draft when
979
- // it lands — so the registered draft is enough to fully restore the
980
- // sidebar's design/upload chooser without storing anything inside
981
- // each history entry.
968
+ // Re-derive enableEditMode + templateAsset from the draft registry
969
+ // (append-only for the session) instead of stashing on every entry.
982
970
  const draft = logoStore.getLogoDraftAssetByToken(draftToken);
983
971
 
984
972
  if (draft) {
@@ -991,12 +979,8 @@ export const useBrandPageMakerStore = defineStore('brandPageMaker', {
991
979
 
992
980
  editableLogoStore.setLogoDraftToken(draftToken);
993
981
 
994
- // Did the logo identity actually change between the two entries?
995
- // If both `logoEdits` and the draft token match what was already
996
- // live, the cached `editableLogoVariations` is still the right
997
- // render and we just need to stamp it back into `brandPageData`
998
- // (history-store strips `logoImageBase64Url` from snapshots, so
999
- // the page-level base64 fields are now empty).
982
+ // No logo change → cache is still correct; just stamp base64 back
983
+ // (snapshot doesn't carry logoImageBase64Url).
1000
984
  const logoUnchanged =
1001
985
  prevDraftToken === draftToken &&
1002
986
  (logoEditsStr === undefined || logoEditsStr === prevLogoEditsStr);
@@ -1010,13 +994,8 @@ export const useBrandPageMakerStore = defineStore('brandPageMaker', {
1010
994
  const isByo = !!draft?.isByo;
1011
995
 
1012
996
  if (isByo) {
1013
- // BYO uploads register a fresh `logoDraftToken` per upload, so
1014
- // `variationsByDraftToken` keyed off that token always matches the
1015
- // base64 the user saw at capture. No re-render — the uploaded
1016
- // image bytes are the source of truth and there's nothing for
1017
- // fabric-render to derive. After restoring the variations cache,
1018
- // stamp the base64 back across header/footer/per-page logo
1019
- // content; the snapshot itself doesn't carry `logoImageBase64Url`.
997
+ // BYO mints a fresh draftToken per upload so the per-token
998
+ // cache always matches; no re-render needed.
1020
999
  if (editableLogoStore.restoreVariationsForDraftToken(draftToken)) {
1021
1000
  editableLogoStore.stampLogoBase64IntoBrandPageData();
1022
1001
  }
@@ -1024,22 +1003,11 @@ export const useBrandPageMakerStore = defineStore('brandPageMaker', {
1024
1003
  return;
1025
1004
  }
1026
1005
 
1027
- // Designed (non-BYO) logo whose form state actually differs from
1028
- // the live state. The draft token is reused across every form-field
1029
- // edit, so the per-token cache only holds the latest render —
1030
- // re-issue the same fabric-render call the live edit path runs.
1031
- // `updateEditableLogoImageUrlAsync` POSTs the freshly-restored
1032
- // `logoEdits`, writes the returned base64 across every header/footer
1033
- // + per-page logo content + `editableLogoVariations`.
1034
- //
1035
- // Awaited (not fire-and-forget): two undos in quick succession would
1036
- // otherwise kick off two parallel render bursts whose `Promise.all`
1037
- // tasks interleave, leaving each variation showing whichever request
1038
- // happened to win the race rather than the variation that belongs
1039
- // to the snapshot the user landed on. Awaiting also keeps the call
1040
- // inside the `applyHistorySnapshot`/`isApplyingSnapshot` window, so
1041
- // the post-render writeback is naturally suppressed by the existing
1042
- // watcher guard — no `mergeNextMutation()` needed.
1006
+ // Designed: draft token is reused across edits, so the cache
1007
+ // only holds the latest render. Re-issue fabric-render — same
1008
+ // call as the live edit path. Awaited so concurrent undos
1009
+ // serialize and the call sits inside the isApplyingSnapshot
1010
+ // window (watcher guard suppresses the writeback).
1043
1011
  if (
1044
1012
  containerStore.isPrePurchase &&
1045
1013
  logoEditsStr &&