@designcrowd/library.brand-page 5.16.20-jj-5 → 5.16.20

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 (42) hide show
  1. package/lib/src/{CreatedOnBrandCrowd-de-de-BmtwV05T.js → CreatedOnBrandCrowd-de-de-J__RLFLg.js} +1 -1
  2. package/lib/src/{CreatedOnBrandCrowd-en-us-LuqBJgA0.js → CreatedOnBrandCrowd-en-us-C_StRJjo.js} +1 -1
  3. package/lib/src/{CreatedOnBrandCrowd-es-es-jz11frzX.js → CreatedOnBrandCrowd-es-es-ykBdLbIt.js} +1 -1
  4. package/lib/src/{CreatedOnBrandCrowd-fr-fr-7sG2kcrh.js → CreatedOnBrandCrowd-fr-ca-Ben4lUb4.js} +1 -1
  5. package/lib/src/{CreatedOnBrandCrowd-fr-ca-7sG2kcrh.js → CreatedOnBrandCrowd-fr-fr-Ben4lUb4.js} +1 -1
  6. package/lib/src/{CreatedOnBrandCrowd-pt-pt-B-cCVxd5.js → CreatedOnBrandCrowd-pt-br-DE7Ub3nU.js} +1 -1
  7. package/lib/src/{CreatedOnBrandCrowd-pt-br-B-cCVxd5.js → CreatedOnBrandCrowd-pt-pt-DE7Ub3nU.js} +1 -1
  8. package/lib/src/{CreatedOnDcom-de-de-D2qanamp.js → CreatedOnDcom-de-de-Di4nyRvm.js} +1 -1
  9. package/lib/src/{CreatedOnDcom-en-us-7-SxOY7M.js → CreatedOnDcom-en-us-DhKIp5pO.js} +1 -1
  10. package/lib/src/{CreatedOnDcom-es-es-DgoRlaC6.js → CreatedOnDcom-es-es-CN2W2-do.js} +1 -1
  11. package/lib/src/{CreatedOnDcom-fr-ca-B0Sh69Uf.js → CreatedOnDcom-fr-ca-C9BMeD0q.js} +1 -1
  12. package/lib/src/{CreatedOnDcom-fr-fr-BUtkbWuU.js → CreatedOnDcom-fr-fr-BEDq3Dtj.js} +1 -1
  13. package/lib/src/{CreatedOnDcom-pt-br-CGm1W-GK.js → CreatedOnDcom-pt-br-DayjxD6x.js} +1 -1
  14. package/lib/src/{CreatedOnDcom-pt-pt-Bu6bf7iy.js → CreatedOnDcom-pt-pt-E7OAm5qD.js} +1 -1
  15. package/lib/src/brand-page/constants/logo.constants.d.ts +1 -0
  16. package/lib/src/brand-page/constants/logo.constants.js +2 -0
  17. package/lib/src/brand-page/utils/logo.util.d.ts +1 -4
  18. package/lib/src/brand-page/utils/logo.util.js +17 -34
  19. package/lib/src/brand-page/utils/migration/migration-07.d.ts +4 -2
  20. package/lib/src/brand-page/utils/migration/migration-07.js +1 -1
  21. package/lib/src/brand-page/utils/migration/migration-08.d.ts +5 -2
  22. package/lib/src/brand-page/utils/migration/migration-08.js +5 -2
  23. package/lib/src/brand-page/utils/migration.util.d.ts +3 -5
  24. package/lib/src/brand-page/utils/migration.util.js +1 -0
  25. package/lib/src/brand-page-maker/stores/brandpage-maker/brandpage-maker-store.js +5 -6
  26. package/lib/src/css/library.brand-page-brandCrowd.min.css +82 -84
  27. package/lib/src/css/library.brand-page-brandPage.min.css +82 -84
  28. package/lib/src/css/library.brand-page-designCom.min.css +82 -84
  29. package/lib/src/css/library.brand-page-preview.min.css +82 -84
  30. package/lib/src/index.mjs +1 -1
  31. package/lib/src/{lib-VRdwhwmL.js → lib-BOtmY7CJ.js} +6242 -6242
  32. package/package.json +1 -1
  33. package/src/brand-page/components/page-header/HeaderLayout.vue +3 -5
  34. package/src/brand-page/constants/logo.constants.ts +3 -0
  35. package/src/brand-page/utils/logo.util.test.ts +37 -0
  36. package/src/brand-page/utils/logo.util.ts +20 -43
  37. package/src/brand-page/utils/migration/migration-07.test.ts +8 -32
  38. package/src/brand-page/utils/migration/migration-07.ts +3 -3
  39. package/src/brand-page/utils/migration/migration-08.test.ts +10 -38
  40. package/src/brand-page/utils/migration/migration-08.ts +14 -4
  41. package/src/brand-page/utils/migration.util.ts +11 -10
  42. package/src/brand-page-maker/stores/brandpage-maker/brandpage-maker-store.ts +5 -7
@@ -1,5 +1,5 @@
1
1
  import { createElementBlock as e, openBlock as l, createStaticVNode as a } from "vue";
2
- import { _ as t } from "./lib-VRdwhwmL.js";
2
+ import { _ as t } from "./lib-BOtmY7CJ.js";
3
3
  const i = {}, h = {
4
4
  width: "275",
5
5
  height: "36",
@@ -1,5 +1,5 @@
1
1
  import { createElementBlock as e, openBlock as l, createStaticVNode as a } from "vue";
2
- import { _ as t } from "./lib-VRdwhwmL.js";
2
+ import { _ as t } from "./lib-BOtmY7CJ.js";
3
3
  const i = {}, h = {
4
4
  width: "251",
5
5
  height: "36",
@@ -1,5 +1,5 @@
1
1
  import { createElementBlock as e, openBlock as l, createStaticVNode as a } from "vue";
2
- import { _ as t } from "./lib-VRdwhwmL.js";
2
+ import { _ as t } from "./lib-BOtmY7CJ.js";
3
3
  const i = {}, h = {
4
4
  width: "250",
5
5
  height: "36",
@@ -1,5 +1,5 @@
1
1
  import { createElementBlock as e, openBlock as l, createStaticVNode as a } from "vue";
2
- import { _ as t } from "./lib-VRdwhwmL.js";
2
+ import { _ as t } from "./lib-BOtmY7CJ.js";
3
3
  const i = {}, h = {
4
4
  width: "237",
5
5
  height: "36",
@@ -1,5 +1,5 @@
1
1
  import { createElementBlock as e, openBlock as l, createStaticVNode as a } from "vue";
2
- import { _ as t } from "./lib-VRdwhwmL.js";
2
+ import { _ as t } from "./lib-BOtmY7CJ.js";
3
3
  const i = {}, h = {
4
4
  width: "237",
5
5
  height: "36",
@@ -1,5 +1,5 @@
1
1
  import { createElementBlock as e, openBlock as l, createStaticVNode as a } from "vue";
2
- import { _ as t } from "./lib-VRdwhwmL.js";
2
+ import { _ as t } from "./lib-BOtmY7CJ.js";
3
3
  const i = {}, h = {
4
4
  width: "263",
5
5
  height: "36",
@@ -1,5 +1,5 @@
1
1
  import { createElementBlock as e, openBlock as l, createStaticVNode as a } from "vue";
2
- import { _ as t } from "./lib-VRdwhwmL.js";
2
+ import { _ as t } from "./lib-BOtmY7CJ.js";
3
3
  const i = {}, h = {
4
4
  width: "263",
5
5
  height: "36",
@@ -1,5 +1,5 @@
1
1
  import { createElementBlock as H, openBlock as V, createStaticVNode as t } from "vue";
2
- import { _ as e } from "./lib-VRdwhwmL.js";
2
+ import { _ as e } from "./lib-BOtmY7CJ.js";
3
3
  const M = {}, Z = {
4
4
  width: "242",
5
5
  height: "36",
@@ -1,5 +1,5 @@
1
1
  import { createElementBlock as H, openBlock as V, createStaticVNode as t } from "vue";
2
- import { _ as e } from "./lib-VRdwhwmL.js";
2
+ import { _ as e } from "./lib-BOtmY7CJ.js";
3
3
  const i = {}, M = {
4
4
  width: "231",
5
5
  height: "36",
@@ -1,5 +1,5 @@
1
1
  import { createElementBlock as H, openBlock as V, createStaticVNode as t } from "vue";
2
- import { _ as e } from "./lib-VRdwhwmL.js";
2
+ import { _ as e } from "./lib-BOtmY7CJ.js";
3
3
  const M = {}, Z = {
4
4
  width: "230",
5
5
  height: "36",
@@ -1,5 +1,5 @@
1
1
  import { createElementBlock as H, openBlock as V, createStaticVNode as t } from "vue";
2
- import { _ as e } from "./lib-VRdwhwmL.js";
2
+ import { _ as e } from "./lib-BOtmY7CJ.js";
3
3
  const i = {}, l = {
4
4
  width: "216",
5
5
  height: "36",
@@ -1,5 +1,5 @@
1
1
  import { createElementBlock as H, openBlock as V, createStaticVNode as t } from "vue";
2
- import { _ as e } from "./lib-VRdwhwmL.js";
2
+ import { _ as e } from "./lib-BOtmY7CJ.js";
3
3
  const i = {}, l = {
4
4
  width: "216",
5
5
  height: "36",
@@ -1,5 +1,5 @@
1
1
  import { createElementBlock as H, openBlock as V, createStaticVNode as t } from "vue";
2
- import { _ as M } from "./lib-VRdwhwmL.js";
2
+ import { _ as M } from "./lib-BOtmY7CJ.js";
3
3
  const Z = {}, e = {
4
4
  width: "232",
5
5
  height: "36",
@@ -1,5 +1,5 @@
1
1
  import { createElementBlock as H, openBlock as V, createStaticVNode as t } from "vue";
2
- import { _ as M } from "./lib-VRdwhwmL.js";
2
+ import { _ as M } from "./lib-BOtmY7CJ.js";
3
3
  const Z = {}, e = {
4
4
  width: "232",
5
5
  height: "36",
@@ -5,3 +5,4 @@ export declare const LOGO_VARIATION: {
5
5
  TEXT_ONLY_WITH_TRANSPARENT_BACKGROUND: number;
6
6
  };
7
7
  export declare const DEFAULT_LOGO_VARIATION: number;
8
+ export declare const LOGO_MIGRATION_VERSION = 6;
@@ -5,3 +5,5 @@ export const LOGO_VARIATION = {
5
5
  TEXT_ONLY_WITH_TRANSPARENT_BACKGROUND: 3,
6
6
  };
7
7
  export const DEFAULT_LOGO_VARIATION = LOGO_VARIATION.LOGO_WITH_TRANSPARENT_BACKGROUND;
8
+ // migrating logo images to a fixed height
9
+ export const LOGO_MIGRATION_VERSION = 6;
@@ -1,4 +1,3 @@
1
- import type { BrandPageType } from '../models';
2
1
  import { type BrandPageModel, type LogoImageModel, type LogoTemplateImageModel, type LogoVariation } from '../models';
3
2
  import { type LogoOutputFormat } from '../../clients/fabric-render-client';
4
3
  export declare const getLogoDraftTokenFromLogoImageUrl: (variationUrl?: string) => string;
@@ -13,9 +12,7 @@ export declare const applyLogoImageBase64UrlToBrandPageTemplateModel: (model: Br
13
12
  export declare const applyLogoTemplateImageToBrandPageTemplateModel: (model: BrandPageModel, logoTemplateImage: LogoTemplateImageModel) => BrandPageModel;
14
13
  export declare const getLogoVariationUrlByLogoImage: (logoImage: LogoImageModel) => string | undefined;
15
14
  export declare const getLogoTemplateUrlByLogoTemplateImage: (logoTemplateImage: LogoTemplateImageModel) => string;
16
- export declare const getOptimalLogoSize: (brandPageType: BrandPageType, width: number, height: number, currentSize: string) => {
17
- newLogoSize: string;
18
- };
15
+ export declare const getOptimalLogoSize: (width: number, height: number, currentSize: string) => string;
19
16
  export declare const calculateLogoDimensions: (logoData: {
20
17
  width: number;
21
18
  height: number;
@@ -167,40 +167,21 @@ export const getLogoVariationUrlByLogoImage = (logoImage) => {
167
167
  export const getLogoTemplateUrlByLogoTemplateImage = (logoTemplateImage) => {
168
168
  return FabricRenderClient.getInstance().getLogoTemplateUrlByLogoTemplateImage(logoTemplateImage);
169
169
  };
170
- export const getOptimalLogoSize = (brandPageType, width, height, currentSize) => {
171
- // //OLD logic
172
- // if (parseFloat(currentSize) >= 16) {
173
- // return { newLogoSize: currentSize };
174
- // }
175
- // const aspectRatio = width / height;
176
- // if (!parseFloat(`${aspectRatio}`) || aspectRatio <= 1) {
177
- // return { newLogoSize: currentSize };
178
- // }
179
- // const newSize = parseFloat(currentSize) + (aspectRatio - 1) * 4.5;
180
- // if (newSize > 11) {
181
- // return { newLogoSize: '11rem' };
182
- // } else {
183
- // return { newLogoSize: `${Math.round(newSize)}rem` };
184
- // }
185
- const ratio = width / height;
186
- let newLogoSize = '11rem'; // default size
187
- if (brandPageType === BRAND_PAGE_TYPES.brandSite) {
188
- if (ratio < 0.95) {
189
- // tall logos
190
- newLogoSize = '10rem';
191
- }
192
- else if (ratio >= 1.65) {
193
- // wide logos
194
- newLogoSize = '10rem';
195
- }
170
+ export const getOptimalLogoSize = (width, height, currentSize) => {
171
+ if (parseFloat(currentSize) >= 16) {
172
+ return currentSize;
173
+ }
174
+ const aspectRatio = width / height;
175
+ if (!parseFloat(`${aspectRatio}`) || aspectRatio <= 1) {
176
+ return currentSize;
177
+ }
178
+ const newSize = parseFloat(currentSize) + (aspectRatio - 1) * 4.5;
179
+ if (newSize > 11) {
180
+ return '11rem';
196
181
  }
197
182
  else {
198
- // BP and BC default
199
- newLogoSize = '8rem';
183
+ return `${Math.round(newSize)}rem`;
200
184
  }
201
- return {
202
- newLogoSize,
203
- };
204
185
  };
205
186
  export const calculateLogoDimensions = (logoData, maxWidth, maxHeight) => {
206
187
  const maxWidthRem = parseFloat(maxWidth);
@@ -268,9 +249,11 @@ export const recalculateLogoContentDimensions = async (pageData, editableLogoVar
268
249
  }
269
250
  // Apply dimensions or fallback logic
270
251
  if (logoData && logoData.width && logoData.height) {
271
- const dimensions = getOptimalLogoSize(BRAND_PAGE_TYPES.default, logoData.width, logoData.height, content.logoImageHeight);
272
- content.logoImageHeight = dimensions.newLogoSize;
273
- content.logoImageWidth = dimensions.newLogoSize;
252
+ const currentMaxWidth = content.logoImageWidth || DEFAULT_LOGO_WIDTH;
253
+ const currentMaxHeight = content.logoImageHeight || DEFAULT_LOGO_HEIGHT;
254
+ const dimensions = calculateOptimizedLogoDimensions(logoData, currentMaxWidth, currentMaxHeight);
255
+ content.logoImageHeight = dimensions.height;
256
+ content.logoImageWidth = dimensions.width;
274
257
  }
275
258
  });
276
259
  }
@@ -1,2 +1,4 @@
1
- import type { MigrationData, MigrationOptions } from '../migration.util';
2
- export declare const migration07: (migrationResult: MigrationData, options: MigrationOptions) => Promise<MigrationData>;
1
+ import type { MigrationData } from '../migration.util';
2
+ export declare const migration07: (migrationResult: MigrationData, options: {
3
+ isServerRender: boolean;
4
+ }) => Promise<MigrationData>;
@@ -6,7 +6,7 @@ export const migration07 = async (migrationResult, options) => {
6
6
  if (brandPageModel.brandPageType !== BRAND_PAGE_TYPES.brandSite) {
7
7
  return migrationResult;
8
8
  }
9
- if (options.disableLogoSizeMigration) {
9
+ if (options.isServerRender !== undefined && options.isServerRender) {
10
10
  migrationResult.useOldLogoRenderSize = true;
11
11
  return migrationResult;
12
12
  }
@@ -1,2 +1,5 @@
1
- import type { MigrationData, MigrationOptions } from '../migration.util';
2
- export declare const migration08: (migrationResult: MigrationData, options: MigrationOptions) => Promise<MigrationData>;
1
+ import type { MigrationData } from '../migration.util';
2
+ export declare const migration08: (migrationResult: MigrationData, options: {
3
+ isServerRender: boolean;
4
+ isUserDraft?: boolean;
5
+ }) => Promise<MigrationData>;
@@ -1,14 +1,17 @@
1
1
  import { DEFAULT_LOGO_HEIGHT, DEFAULT_LOGO_WIDTH, BRAND_PAGE_TYPES, } from '../..';
2
2
  import { FabricRenderClient } from '../../../clients/fabric-render-client';
3
3
  import { isLogoContent } from '../model.util';
4
- import { calculateLogoDimensions } from '../logo.util';
4
+ import { calculateLogoDimensions, safeGetLogoImageFromLogoImageUrl, } from '../logo.util';
5
5
  export const migration08 = async (migrationResult, options) => {
6
6
  const { brandPageModel } = migrationResult;
7
7
  if (brandPageModel.brandPageType !== BRAND_PAGE_TYPES.default &&
8
8
  brandPageModel.brandPageType !== BRAND_PAGE_TYPES.brandContact) {
9
9
  return migrationResult;
10
10
  }
11
- if (options.disableLogoSizeMigration) {
11
+ if (options.isUserDraft !== undefined && !options.isUserDraft) {
12
+ return migrationResult;
13
+ }
14
+ if (options.isServerRender !== undefined && options.isServerRender) {
12
15
  migrationResult.useOldLogoRenderSize = true;
13
16
  return migrationResult;
14
17
  }
@@ -3,11 +3,9 @@ export interface MigrationData {
3
3
  brandPageModel: BrandPageModel;
4
4
  useOldLogoRenderSize: boolean;
5
5
  }
6
- export interface MigrationOptions {
6
+ export declare const GetLatestModelVersion: () => number;
7
+ export declare const migrateBrandPageModel: (brandPageModel: BrandPageModel, options: {
7
8
  logoImage?: LogoImageModel;
8
9
  isUserDraft: boolean;
9
10
  isServerRender: boolean;
10
- disableLogoSizeMigration?: boolean;
11
- }
12
- export declare const GetLatestModelVersion: () => number;
13
- export declare const migrateBrandPageModel: (brandPageModel: BrandPageModel, options: MigrationOptions) => Promise<MigrationData>;
11
+ }) => Promise<MigrationData>;
@@ -1,3 +1,4 @@
1
+ import { LOGO_MIGRATION_VERSION } from '../constants';
1
2
  import {} from '../models';
2
3
  import { migration01 } from './migration/migration-01';
3
4
  import { migration01_1 } from './migration/migration-01_1';
@@ -552,14 +552,13 @@ export const useBrandPageMakerStore = defineStore('brandPageMaker', {
552
552
  ? logoPrePurchase
553
553
  : logoPostPurchase;
554
554
  if (logo && logoImageHeight) {
555
- const optimalSize = getOptimalLogoSize(this.brandPageType, logo.width, logo.height, logoImageHeight);
556
- pageSettingsStore.sections[PAGE_SECTIONS.header][VIEWPORTS.desktop].logoImageWidth = optimalSize.newLogoSize;
557
- pageSettingsStore.sections[PAGE_SECTIONS.header][VIEWPORTS.desktop].logoImageHeight = optimalSize.newLogoSize;
555
+ const newLogoSize = getOptimalLogoSize(logo.width, logo.height, logoImageHeight);
556
+ pageSettingsStore.sections[PAGE_SECTIONS.header][VIEWPORTS.desktop].logoImageWidth = newLogoSize;
557
+ pageSettingsStore.sections[PAGE_SECTIONS.header][VIEWPORTS.desktop].logoImageHeight = newLogoSize;
558
558
  }
559
559
  }
560
- else if (!brandPageContainerStore.designDraftToken &&
561
- !userStore.isAdmin &&
562
- this.isBrandPageOrIsBrandContact) {
560
+ else if (this.isBrandPageOrIsBrandContact &&
561
+ brandPageContainerStore.isPrePurchase) {
563
562
  recalculateLogoContentDimensions(pageSettingsStore, editableLogoStore.editableLogoVariations);
564
563
  }
565
564
  const backgroundStyles = new BackgroundStyles(brandPageModel.styles.backgroundStyles);