@designcrowd/library.brand-page 5.18.1-undo-27 → 5.18.1-undo-29

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 (34) hide show
  1. package/lib/src/{CreatedOnBrandCrowd-de-de-COk1RbBS.js → CreatedOnBrandCrowd-de-de-BxL6mTJW.js} +1 -1
  2. package/lib/src/{CreatedOnBrandCrowd-en-us-CB3iIEMt.js → CreatedOnBrandCrowd-en-us-BPbjqfkj.js} +1 -1
  3. package/lib/src/{CreatedOnBrandCrowd-es-es-CRU0kUB6.js → CreatedOnBrandCrowd-es-es-DDsoe143.js} +1 -1
  4. package/lib/src/{CreatedOnBrandCrowd-fr-fr-C5DdVGnT.js → CreatedOnBrandCrowd-fr-ca-Dak7ppy_.js} +1 -1
  5. package/lib/src/{CreatedOnBrandCrowd-fr-ca-C5DdVGnT.js → CreatedOnBrandCrowd-fr-fr-Dak7ppy_.js} +1 -1
  6. package/lib/src/{CreatedOnBrandCrowd-pt-pt-2L9tw0-m.js → CreatedOnBrandCrowd-pt-br-BUAneEVD.js} +1 -1
  7. package/lib/src/{CreatedOnBrandCrowd-pt-br-2L9tw0-m.js → CreatedOnBrandCrowd-pt-pt-BUAneEVD.js} +1 -1
  8. package/lib/src/{CreatedOnDcom-de-de-BDHBukLE.js → CreatedOnDcom-de-de-BJ00bTz_.js} +1 -1
  9. package/lib/src/{CreatedOnDcom-en-us-D0vKhTnI.js → CreatedOnDcom-en-us-B0V1M9Hs.js} +1 -1
  10. package/lib/src/{CreatedOnDcom-es-es-CCYUHgfO.js → CreatedOnDcom-es-es-YDMLB7u6.js} +1 -1
  11. package/lib/src/{CreatedOnDcom-fr-ca-DnPc5h-w.js → CreatedOnDcom-fr-ca-DppQ26s1.js} +1 -1
  12. package/lib/src/{CreatedOnDcom-fr-fr-CvWbnzbp.js → CreatedOnDcom-fr-fr-0Xi-3slB.js} +1 -1
  13. package/lib/src/{CreatedOnDcom-pt-br-DdMZYZog.js → CreatedOnDcom-pt-br-De-wHqSu.js} +1 -1
  14. package/lib/src/{CreatedOnDcom-pt-pt-BPvriH9Y.js → CreatedOnDcom-pt-pt-CQGAsn5D.js} +1 -1
  15. package/lib/src/brand-page-maker/composables/rich-text-editor/useRichTextEditor.js +13 -1
  16. package/lib/src/brand-page-maker/stores/brandpage-maker/brandpage-maker-store.js +37 -4
  17. package/lib/src/brand-page-maker/stores/history/history-store.d.ts +4 -1
  18. package/lib/src/brand-page-maker/stores/history/history-store.js +103 -443
  19. package/lib/src/brand-page-maker/stores/user/user-store.js +1 -1
  20. package/lib/src/index.mjs +1 -1
  21. package/lib/src/{lib-CcYKXNUY.js → lib-YRlMax_i.js} +21157 -21284
  22. package/lib/src/shared/content-settings/components/payment-config-field/PaymentConfigField.mixin.d.ts +64 -0
  23. package/lib/src/shared/content-settings/components/payment-config-field/PaymentConfigField.mixin.js +12 -0
  24. package/package.json +1 -1
  25. package/src/brand-page-maker/components/quick-link-bar/undo-redo-buttons.test.ts +116 -0
  26. package/src/brand-page-maker/composables/rich-text-editor/useRichTextEditor.ts +15 -2
  27. package/src/brand-page-maker/stores/brandpage-maker/brandpage-maker-store.ts +46 -4
  28. package/src/brand-page-maker/stores/history/history-store.test.ts +184 -894
  29. package/src/brand-page-maker/stores/history/history-store.ts +108 -521
  30. package/src/brand-page-maker/stores/user/user-store.ts +1 -1
  31. package/src/shared/content-settings/components/page-dropdown-field/PageDropdownField.vue +7 -0
  32. package/src/shared/content-settings/components/payment-config-field/PaymentConfigField.mixin.ts +13 -0
  33. package/src/brand-page-maker/components/quick-link-bar/RedoButton.test.ts +0 -166
  34. package/src/brand-page-maker/components/quick-link-bar/UndoButton.test.ts +0 -166
@@ -1,5 +1,5 @@
1
1
  import { openBlock as e, createElementBlock as l, createStaticVNode as a } from "vue";
2
- import { _ as t } from "./lib-CcYKXNUY.js";
2
+ import { _ as t } from "./lib-YRlMax_i.js";
3
3
  const i = {}, h = {
4
4
  width: "275",
5
5
  height: "36",
@@ -1,5 +1,5 @@
1
1
  import { openBlock as e, createElementBlock as l, createStaticVNode as a } from "vue";
2
- import { _ as t } from "./lib-CcYKXNUY.js";
2
+ import { _ as t } from "./lib-YRlMax_i.js";
3
3
  const i = {}, h = {
4
4
  width: "251",
5
5
  height: "36",
@@ -1,5 +1,5 @@
1
1
  import { openBlock as e, createElementBlock as l, createStaticVNode as a } from "vue";
2
- import { _ as t } from "./lib-CcYKXNUY.js";
2
+ import { _ as t } from "./lib-YRlMax_i.js";
3
3
  const i = {}, h = {
4
4
  width: "250",
5
5
  height: "36",
@@ -1,5 +1,5 @@
1
1
  import { openBlock as e, createElementBlock as l, createStaticVNode as a } from "vue";
2
- import { _ as t } from "./lib-CcYKXNUY.js";
2
+ import { _ as t } from "./lib-YRlMax_i.js";
3
3
  const i = {}, h = {
4
4
  width: "237",
5
5
  height: "36",
@@ -1,5 +1,5 @@
1
1
  import { openBlock as e, createElementBlock as l, createStaticVNode as a } from "vue";
2
- import { _ as t } from "./lib-CcYKXNUY.js";
2
+ import { _ as t } from "./lib-YRlMax_i.js";
3
3
  const i = {}, h = {
4
4
  width: "237",
5
5
  height: "36",
@@ -1,5 +1,5 @@
1
1
  import { openBlock as e, createElementBlock as l, createStaticVNode as a } from "vue";
2
- import { _ as t } from "./lib-CcYKXNUY.js";
2
+ import { _ as t } from "./lib-YRlMax_i.js";
3
3
  const i = {}, h = {
4
4
  width: "263",
5
5
  height: "36",
@@ -1,5 +1,5 @@
1
1
  import { openBlock as e, createElementBlock as l, createStaticVNode as a } from "vue";
2
- import { _ as t } from "./lib-CcYKXNUY.js";
2
+ import { _ as t } from "./lib-YRlMax_i.js";
3
3
  const i = {}, h = {
4
4
  width: "263",
5
5
  height: "36",
@@ -1,5 +1,5 @@
1
1
  import { openBlock as H, createElementBlock as V, createStaticVNode as t } from "vue";
2
- import { _ as e } from "./lib-CcYKXNUY.js";
2
+ import { _ as e } from "./lib-YRlMax_i.js";
3
3
  const M = {}, Z = {
4
4
  width: "242",
5
5
  height: "36",
@@ -1,5 +1,5 @@
1
1
  import { openBlock as H, createElementBlock as V, createStaticVNode as t } from "vue";
2
- import { _ as e } from "./lib-CcYKXNUY.js";
2
+ import { _ as e } from "./lib-YRlMax_i.js";
3
3
  const i = {}, M = {
4
4
  width: "231",
5
5
  height: "36",
@@ -1,5 +1,5 @@
1
1
  import { openBlock as H, createElementBlock as V, createStaticVNode as t } from "vue";
2
- import { _ as e } from "./lib-CcYKXNUY.js";
2
+ import { _ as e } from "./lib-YRlMax_i.js";
3
3
  const M = {}, Z = {
4
4
  width: "230",
5
5
  height: "36",
@@ -1,5 +1,5 @@
1
1
  import { openBlock as H, createElementBlock as V, createStaticVNode as t } from "vue";
2
- import { _ as e } from "./lib-CcYKXNUY.js";
2
+ import { _ as e } from "./lib-YRlMax_i.js";
3
3
  const i = {}, l = {
4
4
  width: "216",
5
5
  height: "36",
@@ -1,5 +1,5 @@
1
1
  import { openBlock as H, createElementBlock as V, createStaticVNode as t } from "vue";
2
- import { _ as e } from "./lib-CcYKXNUY.js";
2
+ import { _ as e } from "./lib-YRlMax_i.js";
3
3
  const i = {}, l = {
4
4
  width: "216",
5
5
  height: "36",
@@ -1,5 +1,5 @@
1
1
  import { openBlock as H, createElementBlock as V, createStaticVNode as t } from "vue";
2
- import { _ as M } from "./lib-CcYKXNUY.js";
2
+ import { _ as M } from "./lib-YRlMax_i.js";
3
3
  const Z = {}, e = {
4
4
  width: "232",
5
5
  height: "36",
@@ -1,5 +1,5 @@
1
1
  import { openBlock as H, createElementBlock as V, createStaticVNode as t } from "vue";
2
- import { _ as M } from "./lib-CcYKXNUY.js";
2
+ import { _ as M } from "./lib-YRlMax_i.js";
3
3
  const Z = {}, e = {
4
4
  width: "232",
5
5
  height: "36",
@@ -73,6 +73,19 @@ export const useExternalRichTextEditor = () => {
73
73
  };
74
74
  };
75
75
  export const useRichTextEditor = (model, props, emit, fontSettings, fontStyleDropdownRef, selectedGlobalTextStyles, onSelectTextStyleType, updateRichTextEditor, textStyleTypeOptions, markedText, isHyperlinkPopupOpen, selectedLinkTypeValue) => {
76
+ const historyStore = useHistoryStore();
77
+ // TipTap rehydrates `model.value` on first mount and writes the
78
+ // canonical HTML back via `editor.on('update', ...)` — even when the
79
+ // user-visible text is unchanged (it normalises whitespace, wraps plain
80
+ // text in `<p>`, expands `%0A` to `<br>`, mirrors the resolved textStyle
81
+ // as inline `<strong>`/`<span style="...">`/`<mark>` tags, etc). Each of
82
+ // those rehydration writes mutates `brandPageData` and would otherwise
83
+ // surface as a phantom undo entry the first time the user opens a
84
+ // sidebar or clicks into a section. Arming the merge flag folds the
85
+ // resulting watcher flush into the current head instead of pushing.
86
+ // Idempotent — every editor on the page mounting at once collapses
87
+ // into the same merge.
88
+ historyStore.mergeNextMutation();
76
89
  const editor = new Editor({
77
90
  content: model.value ?? '',
78
91
  editable: !props.readOnly,
@@ -263,7 +276,6 @@ export const useRichTextEditor = (model, props, emit, fontSettings, fontStyleDro
263
276
  const sanitizedData = sanitiseClientSideRTE(editor.getHTML());
264
277
  emit('update:modelValue', sanitizedData.sanitizedHtml);
265
278
  });
266
- const historyStore = useHistoryStore();
267
279
  editor.on('selectionUpdate', () => {
268
280
  // Skip while a history snapshot is being applied — `setContent` fires
269
281
  // selectionUpdate before the editor has fully rehydrated, which causes
@@ -605,6 +605,7 @@ export const useBrandPageMakerStore = defineStore('brandPageMaker', {
605
605
  const logoSettingsStore = useUiLogoSettingsStore();
606
606
  const editableLogoStore = useUiEditableLogoStore();
607
607
  const logoStore = useLogoStore();
608
+ const containerStore = useBrandPageContainerStore();
608
609
  // Restore `editableLogoStore.logoEdits` first — sidecar to `brandPageData`,
609
610
  // captured per-entry. Wholesale-replace via `$patch` so a previous
610
611
  // entry's textObjects/colors don't leak through (e.g. switching
@@ -638,9 +639,7 @@ export const useBrandPageMakerStore = defineStore('brandPageMaker', {
638
639
  // and BYO upload stamps `templateAsset` onto the registered draft when
639
640
  // it lands — so the registered draft is enough to fully restore the
640
641
  // sidebar's design/upload chooser without storing anything inside
641
- // each history entry. The variations grid is restored from the
642
- // editable-logo store's per-token cache (populated by every
643
- // `updateEditableLogoImageUrlAsync` render).
642
+ // each history entry.
644
643
  const draft = logoStore.getLogoDraftAssetByToken(draftToken);
645
644
  if (draft) {
646
645
  editableLogoStore.setEnableEditMode(!draft.isByo);
@@ -649,7 +648,41 @@ export const useBrandPageMakerStore = defineStore('brandPageMaker', {
649
648
  }
650
649
  }
651
650
  editableLogoStore.setLogoDraftToken(draftToken);
652
- editableLogoStore.restoreVariationsForDraftToken(draftToken);
651
+ const isByo = !!draft?.isByo;
652
+ if (isByo) {
653
+ // BYO uploads register a fresh `logoDraftToken` per upload, so
654
+ // `variationsByDraftToken` keyed off that token always matches the
655
+ // base64 the user saw at capture. No re-render — the uploaded
656
+ // image bytes are the source of truth and there's nothing for
657
+ // fabric-render to derive.
658
+ editableLogoStore.restoreVariationsForDraftToken(draftToken);
659
+ return;
660
+ }
661
+ // Designed (non-BYO) logo. The draft token is reused across every
662
+ // form-field edit, so any per-token cache only ever holds the latest
663
+ // render — undoing past it would leave `editableLogoVariations` (and
664
+ // every consumer that reads from it: the sidebar preview, the
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:
669
+ // `updateEditableLogoImageUrlAsync` POSTs the freshly-restored
670
+ // `logoEdits` to fabric-render and writes the returned base64 across
671
+ // every header/footer + per-page logo content + `editableLogoVariations`.
672
+ // The undo/redo apply itself stays synchronous; the canvas updates
673
+ // a moment later when fabric-render responds.
674
+ //
675
+ // Arm `mergeNextMutation` so the watcher folds the post-render
676
+ // mutation back into the entry we just restored instead of pushing
677
+ // a phantom entry.
678
+ if (containerStore.isPrePurchase &&
679
+ logoEditsStr &&
680
+ logoStore.logoTemplateAsset) {
681
+ useHistoryStore().mergeNextMutation();
682
+ editableLogoStore.updateEditableLogoImageUrlAsync().catch((error) => {
683
+ console.error('brandpage-maker-store: failed to re-render logo on history apply', error);
684
+ });
685
+ }
653
686
  },
654
687
  /**
655
688
  * Restore the active page after a history apply. The id passed in is
@@ -72,6 +72,7 @@ export declare const useHistoryStore: import("pinia").StoreDefinition<"history",
72
72
  }) => 'committed' | 'oversized' | 'noop' | 'skipped';
73
73
  captureTemplateSwitch: (label?: string) => 'committed' | 'oversized' | 'noop' | 'skipped';
74
74
  captureAiChangeset: (label?: string) => 'committed' | 'oversized' | 'noop' | 'skipped';
75
+ mergeNextMutation: () => void;
75
76
  undo: () => Promise<void>;
76
77
  redo: () => Promise<void>;
77
78
  reset: () => void;
@@ -92,6 +93,7 @@ export declare const useHistoryStore: import("pinia").StoreDefinition<"history",
92
93
  }) => 'committed' | 'oversized' | 'noop' | 'skipped';
93
94
  captureTemplateSwitch: (label?: string) => 'committed' | 'oversized' | 'noop' | 'skipped';
94
95
  captureAiChangeset: (label?: string) => 'committed' | 'oversized' | 'noop' | 'skipped';
96
+ mergeNextMutation: () => void;
95
97
  undo: () => Promise<void>;
96
98
  redo: () => Promise<void>;
97
99
  reset: () => void;
@@ -112,9 +114,10 @@ export declare const useHistoryStore: import("pinia").StoreDefinition<"history",
112
114
  }) => 'committed' | 'oversized' | 'noop' | 'skipped';
113
115
  captureTemplateSwitch: (label?: string) => 'committed' | 'oversized' | 'noop' | 'skipped';
114
116
  captureAiChangeset: (label?: string) => 'committed' | 'oversized' | 'noop' | 'skipped';
117
+ mergeNextMutation: () => void;
115
118
  undo: () => Promise<void>;
116
119
  redo: () => Promise<void>;
117
120
  reset: () => void;
118
121
  getCurrentSizeBytes: () => number;
119
122
  getCurrentEntryCount: () => number;
120
- }, "reset" | "undo" | "redo" | "captureBaseline" | "capture" | "captureTemplateSwitch" | "captureAiChangeset" | "getCurrentSizeBytes" | "getCurrentEntryCount">>;
123
+ }, "reset" | "undo" | "redo" | "captureBaseline" | "capture" | "captureTemplateSwitch" | "captureAiChangeset" | "mergeNextMutation" | "getCurrentSizeBytes" | "getCurrentEntryCount">>;