@designcrowd/library.brand-page 5.16.21-jj-2 → 5.16.21
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-8Kv1QK-_.js → CreatedOnBrandCrowd-de-de-DgwCYxpo.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-en-us-DcJ6F4lH.js → CreatedOnBrandCrowd-en-us-Ce4dtJzF.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-es-es-CtkMQtU3.js → CreatedOnBrandCrowd-es-es-DDdbZpFk.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-fr-fr-BNplU4jF.js → CreatedOnBrandCrowd-fr-ca-PqYlFJIq.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-fr-ca-BNplU4jF.js → CreatedOnBrandCrowd-fr-fr-PqYlFJIq.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-pt-pt-Cy4OHP5I.js → CreatedOnBrandCrowd-pt-br-J-uo_wBq.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-pt-br-Cy4OHP5I.js → CreatedOnBrandCrowd-pt-pt-J-uo_wBq.js} +1 -1
- package/lib/src/{CreatedOnDcom-de-de-BBKnC2qq.js → CreatedOnDcom-de-de-DqXE51XT.js} +1 -1
- package/lib/src/{CreatedOnDcom-en-us-DiMrhwGV.js → CreatedOnDcom-en-us-BxrSQ6H4.js} +1 -1
- package/lib/src/{CreatedOnDcom-es-es-DaJGZD-a.js → CreatedOnDcom-es-es-tJ59EfOu.js} +1 -1
- package/lib/src/{CreatedOnDcom-fr-ca-Crtbot4j.js → CreatedOnDcom-fr-ca-CDtK8MUu.js} +1 -1
- package/lib/src/{CreatedOnDcom-fr-fr-bCLzH0zv.js → CreatedOnDcom-fr-fr-DbotQbN2.js} +1 -1
- package/lib/src/{CreatedOnDcom-pt-br-DMEWbRkY.js → CreatedOnDcom-pt-br-ClzylsH_.js} +1 -1
- package/lib/src/{CreatedOnDcom-pt-pt-Ccnn-BjY.js → CreatedOnDcom-pt-pt-BF3m2X2_.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/components/brand-page-maker/BrandPageMakerTemplateSettings.mixin.d.ts +0 -1
- package/lib/src/brand-page-maker/components/brand-page-maker/BrandPageMakerTemplateSettings.mixin.js +3 -8
- package/lib/src/brand-page-maker/constants/template-constants.d.ts +0 -1
- package/lib/src/brand-page-maker/constants/template-constants.js +0 -1
- 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 +105 -106
- package/lib/src/{lib-D90J8yWA.js → lib-CAvMr_zk.js} +9320 -9322
- 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/components/brand-page-maker/BrandPageMakerTemplateSettings.mixin.ts +2 -12
- package/src/brand-page-maker/constants/template-constants.ts +0 -1
- package/src/brand-page-maker/stores/brandpage-maker/brandpage-maker-store.ts +5 -7
package/package.json
CHANGED
|
@@ -31,7 +31,6 @@ withDefaults(
|
|
|
31
31
|
<style scoped>
|
|
32
32
|
.root {
|
|
33
33
|
--logo-width: v-bind('logoWidth');
|
|
34
|
-
--logo-max-width: 20rem;
|
|
35
34
|
--tab-nav-height: 56px;
|
|
36
35
|
--hamburger-nav-height: 32px;
|
|
37
36
|
--hamburger-nav-width: 32px;
|
|
@@ -77,8 +76,8 @@ withDefaults(
|
|
|
77
76
|
.desktop-tab-horizontal-stack-left-logo-centered-menu {
|
|
78
77
|
@apply tw-grid;
|
|
79
78
|
grid-template-columns:
|
|
80
|
-
[logo-start] var(--logo-
|
|
81
|
-
--logo-
|
|
79
|
+
[logo-start] var(--logo-width) [logo-end nav-start] 1fr [nav-end] var(
|
|
80
|
+
--logo-width
|
|
82
81
|
)
|
|
83
82
|
[cols-end];
|
|
84
83
|
@apply tw-gap-x-4;
|
|
@@ -87,7 +86,6 @@ withDefaults(
|
|
|
87
86
|
}
|
|
88
87
|
.desktop-tab-horizontal-stack-left-logo-centered-menu .logo-container {
|
|
89
88
|
grid-column: logo-start / logo-end;
|
|
90
|
-
justify-self: start;
|
|
91
89
|
}
|
|
92
90
|
.desktop-tab-horizontal-stack-left-logo-centered-menu .nav-container {
|
|
93
91
|
grid-column: nav-start / nav-end;
|
|
@@ -105,7 +103,7 @@ withDefaults(
|
|
|
105
103
|
.desktop-tab-horizontal-stack-centered-logo-right-menu {
|
|
106
104
|
@apply tw-grid;
|
|
107
105
|
@apply tw-gap-x-4;
|
|
108
|
-
grid-template-columns: [col-start] 1fr [logo-start] var(--logo-
|
|
106
|
+
grid-template-columns: [col-start] 1fr [logo-start] var(--logo-width) [logo-end nav-start] 1fr [nav-end];
|
|
109
107
|
}
|
|
110
108
|
.desktop-tab-horizontal-stack-centered-logo-right-menu .logo-container {
|
|
111
109
|
grid-column: logo-start / logo-end;
|
|
@@ -208,4 +208,41 @@ describe('logo-util', () => {
|
|
|
208
208
|
logoImage.logoDraftToken,
|
|
209
209
|
);
|
|
210
210
|
});
|
|
211
|
+
|
|
212
|
+
test('getOptimalLogoSize should scale up the logo', async () => {
|
|
213
|
+
// Should return same as the current size
|
|
214
|
+
const result = logoUtil.getOptimalLogoSize(100, 100, '12rem');
|
|
215
|
+
|
|
216
|
+
expect(result).toBe('12rem');
|
|
217
|
+
|
|
218
|
+
// should return max size
|
|
219
|
+
const result2 = logoUtil.getOptimalLogoSize(100, 50, '12rem');
|
|
220
|
+
|
|
221
|
+
expect(result2).toBe('11rem');
|
|
222
|
+
|
|
223
|
+
// should return new size
|
|
224
|
+
const result3 = logoUtil.getOptimalLogoSize(100, 80, '12rem');
|
|
225
|
+
|
|
226
|
+
expect(result3).toBe('11rem');
|
|
227
|
+
|
|
228
|
+
// should return current size because height is bigger than width
|
|
229
|
+
const result4 = logoUtil.getOptimalLogoSize(100, 120, '12rem');
|
|
230
|
+
|
|
231
|
+
expect(result4).toBe('12rem');
|
|
232
|
+
|
|
233
|
+
// should return new size
|
|
234
|
+
const result5 = logoUtil.getOptimalLogoSize(100, 60, '12rem');
|
|
235
|
+
|
|
236
|
+
expect(result5).toBe('11rem');
|
|
237
|
+
|
|
238
|
+
// should return current size because our max logic is 16rem
|
|
239
|
+
const result6 = logoUtil.getOptimalLogoSize(100, 60, '18rem');
|
|
240
|
+
|
|
241
|
+
expect(result6).toBe('18rem');
|
|
242
|
+
|
|
243
|
+
// should return current size because our max logic is 16rem
|
|
244
|
+
const result7 = logoUtil.getOptimalLogoSize(100, 60, '16rem');
|
|
245
|
+
|
|
246
|
+
expect(result7).toBe('16rem');
|
|
247
|
+
});
|
|
211
248
|
});
|
|
@@ -7,7 +7,6 @@ import {
|
|
|
7
7
|
import type {
|
|
8
8
|
AbstractPageFooterStyles,
|
|
9
9
|
AbstractPageHeaderStyles,
|
|
10
|
-
BrandPageType,
|
|
11
10
|
} from '../models';
|
|
12
11
|
import {
|
|
13
12
|
BRAND_PAGE_TYPES,
|
|
@@ -318,50 +317,27 @@ export const getLogoTemplateUrlByLogoTemplateImage = (
|
|
|
318
317
|
};
|
|
319
318
|
|
|
320
319
|
export const getOptimalLogoSize = (
|
|
321
|
-
brandPageType: BrandPageType,
|
|
322
320
|
width: number,
|
|
323
321
|
height: number,
|
|
324
322
|
currentSize: string,
|
|
325
|
-
):
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
// }
|
|
330
|
-
|
|
331
|
-
// const aspectRatio = width / height;
|
|
332
|
-
|
|
333
|
-
// if (!parseFloat(`${aspectRatio}`) || aspectRatio <= 1) {
|
|
334
|
-
// return { newLogoSize: currentSize };
|
|
335
|
-
// }
|
|
336
|
-
|
|
337
|
-
// const newSize = parseFloat(currentSize) + (aspectRatio - 1) * 4.5;
|
|
323
|
+
): string => {
|
|
324
|
+
if (parseFloat(currentSize) >= 16) {
|
|
325
|
+
return currentSize;
|
|
326
|
+
}
|
|
338
327
|
|
|
339
|
-
|
|
340
|
-
// return { newLogoSize: '11rem' };
|
|
341
|
-
// } else {
|
|
342
|
-
// return { newLogoSize: `${Math.round(newSize)}rem` };
|
|
343
|
-
// }
|
|
328
|
+
const aspectRatio = width / height;
|
|
344
329
|
|
|
345
|
-
|
|
330
|
+
if (!parseFloat(`${aspectRatio}`) || aspectRatio <= 1) {
|
|
331
|
+
return currentSize;
|
|
332
|
+
}
|
|
346
333
|
|
|
347
|
-
|
|
334
|
+
const newSize = parseFloat(currentSize) + (aspectRatio - 1) * 4.5;
|
|
348
335
|
|
|
349
|
-
if (
|
|
350
|
-
|
|
351
|
-
// tall logos
|
|
352
|
-
newLogoSize = '10rem';
|
|
353
|
-
} else if (ratio >= 1.65) {
|
|
354
|
-
// wide logos
|
|
355
|
-
newLogoSize = '10rem';
|
|
356
|
-
}
|
|
336
|
+
if (newSize > 11) {
|
|
337
|
+
return '11rem';
|
|
357
338
|
} else {
|
|
358
|
-
|
|
359
|
-
newLogoSize = '8rem';
|
|
339
|
+
return `${Math.round(newSize)}rem`;
|
|
360
340
|
}
|
|
361
|
-
|
|
362
|
-
return {
|
|
363
|
-
newLogoSize,
|
|
364
|
-
};
|
|
365
341
|
};
|
|
366
342
|
|
|
367
343
|
export const calculateLogoDimensions = (
|
|
@@ -471,15 +447,16 @@ export const recalculateLogoContentDimensions = async (
|
|
|
471
447
|
|
|
472
448
|
// Apply dimensions or fallback logic
|
|
473
449
|
if (logoData && logoData.width && logoData.height) {
|
|
474
|
-
const
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
logoData
|
|
478
|
-
|
|
450
|
+
const currentMaxWidth = content.logoImageWidth || DEFAULT_LOGO_WIDTH;
|
|
451
|
+
const currentMaxHeight = content.logoImageHeight || DEFAULT_LOGO_HEIGHT;
|
|
452
|
+
const dimensions = calculateOptimizedLogoDimensions(
|
|
453
|
+
logoData,
|
|
454
|
+
currentMaxWidth,
|
|
455
|
+
currentMaxHeight,
|
|
479
456
|
);
|
|
480
457
|
|
|
481
|
-
content.logoImageHeight = dimensions.
|
|
482
|
-
content.logoImageWidth = dimensions.
|
|
458
|
+
content.logoImageHeight = dimensions.height;
|
|
459
|
+
content.logoImageWidth = dimensions.width;
|
|
483
460
|
}
|
|
484
461
|
});
|
|
485
462
|
} catch (error) {
|
|
@@ -85,10 +85,7 @@ describe('migration07', () => {
|
|
|
85
85
|
const migrationData = createMigrationData(brandPageData);
|
|
86
86
|
const originalDimensions = captureOriginalDimensions(migrationData);
|
|
87
87
|
|
|
88
|
-
const result = await migration07(migrationData, {
|
|
89
|
-
isServerRender: true,
|
|
90
|
-
isUserDraft: false,
|
|
91
|
-
});
|
|
88
|
+
const result = await migration07(migrationData, { isServerRender: true });
|
|
92
89
|
|
|
93
90
|
// Should set useOldLogoRenderSize flag and return early
|
|
94
91
|
expect(result.useOldLogoRenderSize).toBe(true);
|
|
@@ -122,10 +119,7 @@ describe('migration07', () => {
|
|
|
122
119
|
const migrationData = createMigrationData(brandPageData);
|
|
123
120
|
const originalDimensions = captureOriginalDimensions(migrationData);
|
|
124
121
|
|
|
125
|
-
const result = await migration07(migrationData, {
|
|
126
|
-
isServerRender: false,
|
|
127
|
-
isUserDraft: false,
|
|
128
|
-
});
|
|
122
|
+
const result = await migration07(migrationData, { isServerRender: false });
|
|
129
123
|
|
|
130
124
|
// Dimensions should remain unchanged when no logo token
|
|
131
125
|
expect(result.brandPageModel.pageHeaderDesktop?.logoImageWidth).toBe(
|
|
@@ -154,10 +148,7 @@ describe('migration07', () => {
|
|
|
154
148
|
});
|
|
155
149
|
|
|
156
150
|
const migrationData = createMigrationData(brandPageData);
|
|
157
|
-
const result = await migration07(migrationData, {
|
|
158
|
-
isServerRender: false,
|
|
159
|
-
isUserDraft: false,
|
|
160
|
-
});
|
|
151
|
+
const result = await migration07(migrationData, { isServerRender: false });
|
|
161
152
|
|
|
162
153
|
// Should not crash and return the migrationData unchanged since no logo token
|
|
163
154
|
expect(result).toBeDefined();
|
|
@@ -176,10 +167,7 @@ describe('migration07', () => {
|
|
|
176
167
|
|
|
177
168
|
// Should not crash when pageHeaderDesktop is missing
|
|
178
169
|
await expect(
|
|
179
|
-
migration07(migrationData, {
|
|
180
|
-
isServerRender: false,
|
|
181
|
-
isUserDraft: false,
|
|
182
|
-
}),
|
|
170
|
+
migration07(migrationData, { isServerRender: false }),
|
|
183
171
|
).resolves.toBeDefined();
|
|
184
172
|
});
|
|
185
173
|
|
|
@@ -208,10 +196,7 @@ describe('migration07', () => {
|
|
|
208
196
|
});
|
|
209
197
|
|
|
210
198
|
const migrationData = createMigrationData(brandPageData);
|
|
211
|
-
const result = await migration07(migrationData, {
|
|
212
|
-
isServerRender: true,
|
|
213
|
-
isUserDraft: false,
|
|
214
|
-
});
|
|
199
|
+
const result = await migration07(migrationData, { isServerRender: true });
|
|
215
200
|
|
|
216
201
|
// Should return the exact same migrationData instance
|
|
217
202
|
expect(result).toBe(migrationData);
|
|
@@ -250,10 +235,7 @@ describe('migration07', () => {
|
|
|
250
235
|
|
|
251
236
|
// The migration should attempt to process the template image
|
|
252
237
|
// Since we can't mock the API call, we expect it to either succeed or fail gracefully
|
|
253
|
-
const result = await migration07(migrationData, {
|
|
254
|
-
isServerRender: false,
|
|
255
|
-
isUserDraft: false,
|
|
256
|
-
});
|
|
238
|
+
const result = await migration07(migrationData, { isServerRender: false });
|
|
257
239
|
|
|
258
240
|
expect(result).toBeDefined();
|
|
259
241
|
expect(result.brandPageModel.pageHeaderDesktop).toBeDefined();
|
|
@@ -294,10 +276,7 @@ describe('migration07', () => {
|
|
|
294
276
|
});
|
|
295
277
|
|
|
296
278
|
const migrationData = createMigrationData(brandPageData);
|
|
297
|
-
const result = await migration07(migrationData, {
|
|
298
|
-
isServerRender: false,
|
|
299
|
-
isUserDraft: false,
|
|
300
|
-
});
|
|
279
|
+
const result = await migration07(migrationData, { isServerRender: false });
|
|
301
280
|
|
|
302
281
|
const { brandPageModel } = result;
|
|
303
282
|
|
|
@@ -351,10 +330,7 @@ describe('migration07', () => {
|
|
|
351
330
|
});
|
|
352
331
|
|
|
353
332
|
const migrationData = createMigrationData(brandPageData);
|
|
354
|
-
const result = await migration07(migrationData, {
|
|
355
|
-
isServerRender: false,
|
|
356
|
-
isUserDraft: false,
|
|
357
|
-
});
|
|
333
|
+
const result = await migration07(migrationData, { isServerRender: false });
|
|
358
334
|
|
|
359
335
|
const { brandPageModel } = result;
|
|
360
336
|
|
|
@@ -11,11 +11,11 @@ import {
|
|
|
11
11
|
} from '../..';
|
|
12
12
|
import { FabricRenderClient } from '../../../clients/fabric-render-client';
|
|
13
13
|
import { calculateLogoDimensions } from '../logo.util';
|
|
14
|
-
import type { MigrationData
|
|
14
|
+
import type { MigrationData } from '../migration.util';
|
|
15
15
|
|
|
16
16
|
export const migration07 = async (
|
|
17
17
|
migrationResult: MigrationData,
|
|
18
|
-
options:
|
|
18
|
+
options: { isServerRender: boolean },
|
|
19
19
|
): Promise<MigrationData> => {
|
|
20
20
|
const { brandPageModel } = migrationResult;
|
|
21
21
|
|
|
@@ -23,7 +23,7 @@ export const migration07 = async (
|
|
|
23
23
|
return migrationResult;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
if (options.
|
|
26
|
+
if (options.isServerRender !== undefined && options.isServerRender) {
|
|
27
27
|
migrationResult.useOldLogoRenderSize = true;
|
|
28
28
|
|
|
29
29
|
return migrationResult;
|
|
@@ -60,15 +60,11 @@ describe('migration08', () => {
|
|
|
60
60
|
vi.clearAllMocks();
|
|
61
61
|
});
|
|
62
62
|
|
|
63
|
-
test('should skip migration when
|
|
63
|
+
test('should skip migration when isServerRender is true', async () => {
|
|
64
64
|
const brandPageData = createTestBrandPageData();
|
|
65
65
|
const migrationData = createMigrationData(brandPageData);
|
|
66
66
|
|
|
67
|
-
const result = await migration08(migrationData, {
|
|
68
|
-
isServerRender: true,
|
|
69
|
-
isUserDraft: false,
|
|
70
|
-
disableLogoSizeMigration: true,
|
|
71
|
-
});
|
|
67
|
+
const result = await migration08(migrationData, { isServerRender: true });
|
|
72
68
|
|
|
73
69
|
expect(result.useOldLogoRenderSize).toBe(true);
|
|
74
70
|
expect(
|
|
@@ -107,10 +103,7 @@ describe('migration08', () => {
|
|
|
107
103
|
data: 'test-svg-data',
|
|
108
104
|
});
|
|
109
105
|
|
|
110
|
-
const result = await migration08(migrationData, {
|
|
111
|
-
isServerRender: false,
|
|
112
|
-
isUserDraft: false,
|
|
113
|
-
});
|
|
106
|
+
const result = await migration08(migrationData, { isServerRender: false });
|
|
114
107
|
|
|
115
108
|
expect(result.useOldLogoRenderSize).toBe(false);
|
|
116
109
|
expect(
|
|
@@ -150,10 +143,7 @@ describe('migration08', () => {
|
|
|
150
143
|
migrationData.brandPageModel.pages[0].contents[0] as LogoContent
|
|
151
144
|
).logoImageWidth;
|
|
152
145
|
|
|
153
|
-
const result = await migration08(migrationData, {
|
|
154
|
-
isServerRender: false,
|
|
155
|
-
isUserDraft: false,
|
|
156
|
-
});
|
|
146
|
+
const result = await migration08(migrationData, { isServerRender: false });
|
|
157
147
|
|
|
158
148
|
// Migration should complete successfully but skip processing brandSite
|
|
159
149
|
expect(result.useOldLogoRenderSize).toBe(false);
|
|
@@ -200,10 +190,7 @@ describe('migration08', () => {
|
|
|
200
190
|
});
|
|
201
191
|
const migrationData = createMigrationData(brandPageData);
|
|
202
192
|
|
|
203
|
-
const result = await migration08(migrationData, {
|
|
204
|
-
isServerRender: false,
|
|
205
|
-
isUserDraft: false,
|
|
206
|
-
});
|
|
193
|
+
const result = await migration08(migrationData, { isServerRender: false });
|
|
207
194
|
|
|
208
195
|
expect(result.useOldLogoRenderSize).toBe(false);
|
|
209
196
|
});
|
|
@@ -257,10 +244,7 @@ describe('migration08', () => {
|
|
|
257
244
|
},
|
|
258
245
|
);
|
|
259
246
|
|
|
260
|
-
const result = await migration08(migrationData, {
|
|
261
|
-
isServerRender: false,
|
|
262
|
-
isUserDraft: false,
|
|
263
|
-
});
|
|
247
|
+
const result = await migration08(migrationData, { isServerRender: false });
|
|
264
248
|
|
|
265
249
|
expect(result.useOldLogoRenderSize).toBe(false);
|
|
266
250
|
expect(
|
|
@@ -291,10 +275,7 @@ describe('migration08', () => {
|
|
|
291
275
|
});
|
|
292
276
|
const migrationData = createMigrationData(brandPageData);
|
|
293
277
|
|
|
294
|
-
const result = await migration08(migrationData, {
|
|
295
|
-
isServerRender: false,
|
|
296
|
-
isUserDraft: false,
|
|
297
|
-
});
|
|
278
|
+
const result = await migration08(migrationData, { isServerRender: false });
|
|
298
279
|
|
|
299
280
|
// Should apply fallback logic
|
|
300
281
|
expect(
|
|
@@ -341,10 +322,7 @@ describe('migration08', () => {
|
|
|
341
322
|
data: 'test-template-svg-data',
|
|
342
323
|
});
|
|
343
324
|
|
|
344
|
-
const result = await migration08(migrationData, {
|
|
345
|
-
isServerRender: false,
|
|
346
|
-
isUserDraft: false,
|
|
347
|
-
});
|
|
325
|
+
const result = await migration08(migrationData, { isServerRender: false });
|
|
348
326
|
|
|
349
327
|
expect(
|
|
350
328
|
mockFabricClient.getLogoSvgUrlByLogoTemplateImageAsync,
|
|
@@ -383,10 +361,7 @@ describe('migration08', () => {
|
|
|
383
361
|
new Error('API Error'),
|
|
384
362
|
);
|
|
385
363
|
|
|
386
|
-
const result = await migration08(migrationData, {
|
|
387
|
-
isServerRender: false,
|
|
388
|
-
isUserDraft: false,
|
|
389
|
-
});
|
|
364
|
+
const result = await migration08(migrationData, { isServerRender: false });
|
|
390
365
|
|
|
391
366
|
expect(result.useOldLogoRenderSize).toBe(true);
|
|
392
367
|
});
|
|
@@ -415,10 +390,7 @@ describe('migration08', () => {
|
|
|
415
390
|
});
|
|
416
391
|
const migrationData = createMigrationData(brandPageData);
|
|
417
392
|
|
|
418
|
-
const result = await migration08(migrationData, {
|
|
419
|
-
isServerRender: false,
|
|
420
|
-
isUserDraft: false,
|
|
421
|
-
});
|
|
393
|
+
const result = await migration08(migrationData, { isServerRender: false });
|
|
422
394
|
|
|
423
395
|
expect(result.useOldLogoRenderSize).toBe(false);
|
|
424
396
|
expect(result.brandPageModel.pages[0].contents.length).toBe(2);
|
|
@@ -4,14 +4,20 @@ import {
|
|
|
4
4
|
BRAND_PAGE_TYPES,
|
|
5
5
|
} from '../..';
|
|
6
6
|
import { FabricRenderClient } from '../../../clients/fabric-render-client';
|
|
7
|
-
import type { MigrationData
|
|
7
|
+
import type { MigrationData } from '../migration.util';
|
|
8
8
|
import { isLogoContent } from '../model.util';
|
|
9
9
|
import type { LogoContent } from '../../models/logo.model';
|
|
10
|
-
import {
|
|
10
|
+
import {
|
|
11
|
+
calculateLogoDimensions,
|
|
12
|
+
safeGetLogoImageFromLogoImageUrl,
|
|
13
|
+
} from '../logo.util';
|
|
11
14
|
|
|
12
15
|
export const migration08 = async (
|
|
13
16
|
migrationResult: MigrationData,
|
|
14
|
-
options:
|
|
17
|
+
options: {
|
|
18
|
+
isServerRender: boolean;
|
|
19
|
+
isUserDraft?: boolean;
|
|
20
|
+
},
|
|
15
21
|
): Promise<MigrationData> => {
|
|
16
22
|
const { brandPageModel } = migrationResult;
|
|
17
23
|
|
|
@@ -22,7 +28,11 @@ export const migration08 = async (
|
|
|
22
28
|
return migrationResult;
|
|
23
29
|
}
|
|
24
30
|
|
|
25
|
-
if (options.
|
|
31
|
+
if (options.isUserDraft !== undefined && !options.isUserDraft) {
|
|
32
|
+
return migrationResult;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
if (options.isServerRender !== undefined && options.isServerRender) {
|
|
26
36
|
migrationResult.useOldLogoRenderSize = true;
|
|
27
37
|
|
|
28
38
|
return migrationResult;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { LOGO_MIGRATION_VERSION } from '../constants';
|
|
1
2
|
import { type BrandPageModel, type LogoImageModel } from '../models';
|
|
2
3
|
import { migration01 } from './migration/migration-01';
|
|
3
4
|
import { migration01_1 } from './migration/migration-01_1';
|
|
@@ -12,24 +13,20 @@ import { migration07 } from './migration/migration-07';
|
|
|
12
13
|
import { migration08 } from './migration/migration-08';
|
|
13
14
|
import { migration09 } from './migration/migration-09';
|
|
14
15
|
import { migration10 } from './migration/migration-10';
|
|
15
|
-
|
|
16
16
|
export interface MigrationData {
|
|
17
17
|
brandPageModel: BrandPageModel;
|
|
18
18
|
useOldLogoRenderSize: boolean;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
export interface MigrationOptions {
|
|
22
|
-
logoImage?: LogoImageModel;
|
|
23
|
-
isUserDraft: boolean;
|
|
24
|
-
isServerRender: boolean;
|
|
25
|
-
disableLogoSizeMigration?: boolean;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
21
|
interface MigrationTableItem {
|
|
29
22
|
version: number;
|
|
30
23
|
migrateFn: (
|
|
31
24
|
migrationResult: MigrationData,
|
|
32
|
-
options:
|
|
25
|
+
options: {
|
|
26
|
+
logoImage?: LogoImageModel;
|
|
27
|
+
isUserDraft: boolean;
|
|
28
|
+
isServerRender: boolean;
|
|
29
|
+
},
|
|
33
30
|
) => Promise<MigrationData>;
|
|
34
31
|
description: string;
|
|
35
32
|
runAlways?: boolean;
|
|
@@ -111,7 +108,11 @@ export const GetLatestModelVersion = () =>
|
|
|
111
108
|
|
|
112
109
|
export const migrateBrandPageModel = async (
|
|
113
110
|
brandPageModel: BrandPageModel,
|
|
114
|
-
options:
|
|
111
|
+
options: {
|
|
112
|
+
logoImage?: LogoImageModel;
|
|
113
|
+
isUserDraft: boolean;
|
|
114
|
+
isServerRender: boolean;
|
|
115
|
+
},
|
|
115
116
|
): Promise<MigrationData> => {
|
|
116
117
|
let modelVersion = brandPageModel.v;
|
|
117
118
|
|
package/src/brand-page-maker/components/brand-page-maker/BrandPageMakerTemplateSettings.mixin.ts
CHANGED
|
@@ -4,22 +4,16 @@ import {
|
|
|
4
4
|
DESKTOP_WIDTH,
|
|
5
5
|
MOBILE_HEIGHT,
|
|
6
6
|
MOBILE_WIDTH,
|
|
7
|
-
MOBILE_HEIGHT_POST_PURCHASE,
|
|
8
7
|
} from '../../constants';
|
|
9
|
-
import {
|
|
10
|
-
useBrandPageMakerStore,
|
|
11
|
-
useBrandPageContainerStore,
|
|
12
|
-
} from '../../../lib';
|
|
8
|
+
import { useBrandPageMakerStore } from '../../../lib';
|
|
13
9
|
|
|
14
10
|
export default defineComponent({
|
|
15
11
|
setup() {
|
|
16
12
|
const brandPageMakerStore = useBrandPageMakerStore();
|
|
17
|
-
const brandPageContainerStore = useBrandPageContainerStore();
|
|
18
13
|
|
|
19
14
|
return {
|
|
20
15
|
brandPageType: computed(() => brandPageMakerStore.brandPageType),
|
|
21
16
|
isBrandSite: computed(() => brandPageMakerStore.isBrandSite),
|
|
22
|
-
isPrePurchase: computed(() => brandPageContainerStore.isPrePurchase),
|
|
23
17
|
isBrandPageOrIsBrandContact: computed(
|
|
24
18
|
() => brandPageMakerStore.isBrandPageOrIsBrandContact,
|
|
25
19
|
),
|
|
@@ -36,11 +30,7 @@ export default defineComponent({
|
|
|
36
30
|
},
|
|
37
31
|
|
|
38
32
|
height(): number {
|
|
39
|
-
|
|
40
|
-
return DESKTOP_HEIGHT;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
return this.isPrePurchase ? MOBILE_HEIGHT : MOBILE_HEIGHT_POST_PURCHASE;
|
|
33
|
+
return this.isBrandSite ? DESKTOP_HEIGHT : MOBILE_HEIGHT;
|
|
44
34
|
},
|
|
45
35
|
},
|
|
46
36
|
});
|
|
@@ -901,8 +901,7 @@ export const useBrandPageMakerStore = defineStore('brandPageMaker', {
|
|
|
901
901
|
: logoPostPurchase;
|
|
902
902
|
|
|
903
903
|
if (logo && logoImageHeight) {
|
|
904
|
-
const
|
|
905
|
-
this.brandPageType,
|
|
904
|
+
const newLogoSize = getOptimalLogoSize(
|
|
906
905
|
logo.width,
|
|
907
906
|
logo.height,
|
|
908
907
|
logoImageHeight,
|
|
@@ -910,15 +909,14 @@ export const useBrandPageMakerStore = defineStore('brandPageMaker', {
|
|
|
910
909
|
|
|
911
910
|
pageSettingsStore.sections[PAGE_SECTIONS.header][
|
|
912
911
|
VIEWPORTS.desktop
|
|
913
|
-
].logoImageWidth =
|
|
912
|
+
].logoImageWidth = newLogoSize;
|
|
914
913
|
pageSettingsStore.sections[PAGE_SECTIONS.header][
|
|
915
914
|
VIEWPORTS.desktop
|
|
916
|
-
].logoImageHeight =
|
|
915
|
+
].logoImageHeight = newLogoSize;
|
|
917
916
|
}
|
|
918
917
|
} else if (
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
this.isBrandPageOrIsBrandContact
|
|
918
|
+
this.isBrandPageOrIsBrandContact &&
|
|
919
|
+
brandPageContainerStore.isPrePurchase
|
|
922
920
|
) {
|
|
923
921
|
recalculateLogoContentDimensions(
|
|
924
922
|
pageSettingsStore,
|