@designcrowd/library.brand-page 5.18.1-undo-28 → 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 (19) hide show
  1. package/lib/src/{CreatedOnBrandCrowd-de-de-CmaFdOwA.js → CreatedOnBrandCrowd-de-de-BxL6mTJW.js} +1 -1
  2. package/lib/src/{CreatedOnBrandCrowd-en-us-DYcx1zJ5.js → CreatedOnBrandCrowd-en-us-BPbjqfkj.js} +1 -1
  3. package/lib/src/{CreatedOnBrandCrowd-es-es-BW-OyQM7.js → CreatedOnBrandCrowd-es-es-DDsoe143.js} +1 -1
  4. package/lib/src/{CreatedOnBrandCrowd-fr-fr-DDBKibOe.js → CreatedOnBrandCrowd-fr-ca-Dak7ppy_.js} +1 -1
  5. package/lib/src/{CreatedOnBrandCrowd-fr-ca-DDBKibOe.js → CreatedOnBrandCrowd-fr-fr-Dak7ppy_.js} +1 -1
  6. package/lib/src/{CreatedOnBrandCrowd-pt-pt-6OSkxFgf.js → CreatedOnBrandCrowd-pt-br-BUAneEVD.js} +1 -1
  7. package/lib/src/{CreatedOnBrandCrowd-pt-br-6OSkxFgf.js → CreatedOnBrandCrowd-pt-pt-BUAneEVD.js} +1 -1
  8. package/lib/src/{CreatedOnDcom-de-de-Ds3pSY3b.js → CreatedOnDcom-de-de-BJ00bTz_.js} +1 -1
  9. package/lib/src/{CreatedOnDcom-en-us-nu_xhm3W.js → CreatedOnDcom-en-us-B0V1M9Hs.js} +1 -1
  10. package/lib/src/{CreatedOnDcom-es-es-DeWd8xLJ.js → CreatedOnDcom-es-es-YDMLB7u6.js} +1 -1
  11. package/lib/src/{CreatedOnDcom-fr-ca-C30UWAc7.js → CreatedOnDcom-fr-ca-DppQ26s1.js} +1 -1
  12. package/lib/src/{CreatedOnDcom-fr-fr-ZFAi67Ii.js → CreatedOnDcom-fr-fr-0Xi-3slB.js} +1 -1
  13. package/lib/src/{CreatedOnDcom-pt-br-Bvtz3TFZ.js → CreatedOnDcom-pt-br-De-wHqSu.js} +1 -1
  14. package/lib/src/{CreatedOnDcom-pt-pt-Dr__mA4b.js → CreatedOnDcom-pt-pt-CQGAsn5D.js} +1 -1
  15. package/lib/src/brand-page-maker/stores/brandpage-maker/brandpage-maker-store.js +37 -4
  16. package/lib/src/index.mjs +1 -1
  17. package/lib/src/{lib-BBItimSg.js → lib-YRlMax_i.js} +683 -674
  18. package/package.json +1 -1
  19. package/src/brand-page-maker/stores/brandpage-maker/brandpage-maker-store.ts +46 -4
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-28",
4
+ "version": "5.18.1-undo-29",
5
5
  "author": "Design.com Eng",
6
6
  "license": "UNLICENSED",
7
7
  "type": "module",
@@ -921,6 +921,7 @@ export const useBrandPageMakerStore = defineStore('brandPageMaker', {
921
921
  const logoSettingsStore = useUiLogoSettingsStore();
922
922
  const editableLogoStore = useUiEditableLogoStore();
923
923
  const logoStore = useLogoStore();
924
+ const containerStore = useBrandPageContainerStore();
924
925
 
925
926
  // Restore `editableLogoStore.logoEdits` first — sidecar to `brandPageData`,
926
927
  // captured per-entry. Wholesale-replace via `$patch` so a previous
@@ -967,9 +968,7 @@ export const useBrandPageMakerStore = defineStore('brandPageMaker', {
967
968
  // and BYO upload stamps `templateAsset` onto the registered draft when
968
969
  // it lands — so the registered draft is enough to fully restore the
969
970
  // sidebar's design/upload chooser without storing anything inside
970
- // each history entry. The variations grid is restored from the
971
- // editable-logo store's per-token cache (populated by every
972
- // `updateEditableLogoImageUrlAsync` render).
971
+ // each history entry.
973
972
  const draft = logoStore.getLogoDraftAssetByToken(draftToken);
974
973
 
975
974
  if (draft) {
@@ -981,7 +980,50 @@ export const useBrandPageMakerStore = defineStore('brandPageMaker', {
981
980
  }
982
981
 
983
982
  editableLogoStore.setLogoDraftToken(draftToken);
984
- editableLogoStore.restoreVariationsForDraftToken(draftToken);
983
+
984
+ const isByo = !!draft?.isByo;
985
+
986
+ if (isByo) {
987
+ // BYO uploads register a fresh `logoDraftToken` per upload, so
988
+ // `variationsByDraftToken` keyed off that token always matches the
989
+ // base64 the user saw at capture. No re-render — the uploaded
990
+ // image bytes are the source of truth and there's nothing for
991
+ // fabric-render to derive.
992
+ editableLogoStore.restoreVariationsForDraftToken(draftToken);
993
+
994
+ return;
995
+ }
996
+
997
+ // Designed (non-BYO) logo. The draft token is reused across every
998
+ // form-field edit, so any per-token cache only ever holds the latest
999
+ // render — undoing past it would leave `editableLogoVariations` (and
1000
+ // every consumer that reads from it: the sidebar preview, the
1001
+ // canvas, post-undo save metadata, recalculateLogoSizes) showing
1002
+ // the post-edit base64 while the form fields show pre-edit state.
1003
+ //
1004
+ // Fire-and-forget the same render the live edit path runs:
1005
+ // `updateEditableLogoImageUrlAsync` POSTs the freshly-restored
1006
+ // `logoEdits` to fabric-render and writes the returned base64 across
1007
+ // every header/footer + per-page logo content + `editableLogoVariations`.
1008
+ // The undo/redo apply itself stays synchronous; the canvas updates
1009
+ // a moment later when fabric-render responds.
1010
+ //
1011
+ // Arm `mergeNextMutation` so the watcher folds the post-render
1012
+ // mutation back into the entry we just restored instead of pushing
1013
+ // a phantom entry.
1014
+ if (
1015
+ containerStore.isPrePurchase &&
1016
+ logoEditsStr &&
1017
+ logoStore.logoTemplateAsset
1018
+ ) {
1019
+ useHistoryStore().mergeNextMutation();
1020
+ editableLogoStore.updateEditableLogoImageUrlAsync().catch((error) => {
1021
+ console.error(
1022
+ 'brandpage-maker-store: failed to re-render logo on history apply',
1023
+ error,
1024
+ );
1025
+ });
1026
+ }
985
1027
  },
986
1028
 
987
1029
  /**