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