@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.
- package/lib/src/{CreatedOnBrandCrowd-de-de-BmtwV05T.js → CreatedOnBrandCrowd-de-de-J__RLFLg.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-en-us-LuqBJgA0.js → CreatedOnBrandCrowd-en-us-C_StRJjo.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-es-es-jz11frzX.js → CreatedOnBrandCrowd-es-es-ykBdLbIt.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-fr-fr-7sG2kcrh.js → CreatedOnBrandCrowd-fr-ca-Ben4lUb4.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-fr-ca-7sG2kcrh.js → CreatedOnBrandCrowd-fr-fr-Ben4lUb4.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-pt-pt-B-cCVxd5.js → CreatedOnBrandCrowd-pt-br-DE7Ub3nU.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-pt-br-B-cCVxd5.js → CreatedOnBrandCrowd-pt-pt-DE7Ub3nU.js} +1 -1
- package/lib/src/{CreatedOnDcom-de-de-D2qanamp.js → CreatedOnDcom-de-de-Di4nyRvm.js} +1 -1
- package/lib/src/{CreatedOnDcom-en-us-7-SxOY7M.js → CreatedOnDcom-en-us-DhKIp5pO.js} +1 -1
- package/lib/src/{CreatedOnDcom-es-es-DgoRlaC6.js → CreatedOnDcom-es-es-CN2W2-do.js} +1 -1
- package/lib/src/{CreatedOnDcom-fr-ca-B0Sh69Uf.js → CreatedOnDcom-fr-ca-C9BMeD0q.js} +1 -1
- package/lib/src/{CreatedOnDcom-fr-fr-BUtkbWuU.js → CreatedOnDcom-fr-fr-BEDq3Dtj.js} +1 -1
- package/lib/src/{CreatedOnDcom-pt-br-CGm1W-GK.js → CreatedOnDcom-pt-br-DayjxD6x.js} +1 -1
- package/lib/src/{CreatedOnDcom-pt-pt-Bu6bf7iy.js → CreatedOnDcom-pt-pt-E7OAm5qD.js} +1 -1
- package/lib/src/brand-page/constants/logo.constants.d.ts +1 -0
- package/lib/src/brand-page/constants/logo.constants.js +2 -0
- package/lib/src/brand-page/utils/logo.util.d.ts +1 -4
- package/lib/src/brand-page/utils/logo.util.js +17 -34
- package/lib/src/brand-page/utils/migration/migration-07.d.ts +4 -2
- package/lib/src/brand-page/utils/migration/migration-07.js +1 -1
- package/lib/src/brand-page/utils/migration/migration-08.d.ts +5 -2
- package/lib/src/brand-page/utils/migration/migration-08.js +5 -2
- package/lib/src/brand-page/utils/migration.util.d.ts +3 -5
- package/lib/src/brand-page/utils/migration.util.js +1 -0
- package/lib/src/brand-page-maker/stores/brandpage-maker/brandpage-maker-store.js +5 -6
- package/lib/src/css/library.brand-page-brandCrowd.min.css +82 -84
- package/lib/src/css/library.brand-page-brandPage.min.css +82 -84
- package/lib/src/css/library.brand-page-designCom.min.css +82 -84
- package/lib/src/css/library.brand-page-preview.min.css +82 -84
- package/lib/src/index.mjs +1 -1
- package/lib/src/{lib-VRdwhwmL.js → lib-BOtmY7CJ.js} +6242 -6242
- package/package.json +1 -1
- package/src/brand-page/components/page-header/HeaderLayout.vue +3 -5
- package/src/brand-page/constants/logo.constants.ts +3 -0
- package/src/brand-page/utils/logo.util.test.ts +37 -0
- package/src/brand-page/utils/logo.util.ts +20 -43
- package/src/brand-page/utils/migration/migration-07.test.ts +8 -32
- package/src/brand-page/utils/migration/migration-07.ts +3 -3
- package/src/brand-page/utils/migration/migration-08.test.ts +10 -38
- package/src/brand-page/utils/migration/migration-08.ts +14 -4
- package/src/brand-page/utils/migration.util.ts +11 -10
- package/src/brand-page-maker/stores/brandpage-maker/brandpage-maker-store.ts +5 -7
|
@@ -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: (
|
|
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 = (
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
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
|
-
|
|
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
|
|
272
|
-
content.logoImageHeight
|
|
273
|
-
|
|
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
|
|
2
|
-
export declare const migration07: (migrationResult: MigrationData, options:
|
|
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.
|
|
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
|
|
2
|
-
export declare const migration08: (migrationResult: MigrationData, options:
|
|
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.
|
|
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
|
|
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
|
-
|
|
11
|
-
}
|
|
12
|
-
export declare const GetLatestModelVersion: () => number;
|
|
13
|
-
export declare const migrateBrandPageModel: (brandPageModel: BrandPageModel, options: MigrationOptions) => Promise<MigrationData>;
|
|
11
|
+
}) => Promise<MigrationData>;
|
|
@@ -552,14 +552,13 @@ export const useBrandPageMakerStore = defineStore('brandPageMaker', {
|
|
|
552
552
|
? logoPrePurchase
|
|
553
553
|
: logoPostPurchase;
|
|
554
554
|
if (logo && logoImageHeight) {
|
|
555
|
-
const
|
|
556
|
-
pageSettingsStore.sections[PAGE_SECTIONS.header][VIEWPORTS.desktop].logoImageWidth =
|
|
557
|
-
pageSettingsStore.sections[PAGE_SECTIONS.header][VIEWPORTS.desktop].logoImageHeight =
|
|
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 (
|
|
561
|
-
|
|
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);
|