@designcrowd/library.brand-page 5.6.3 → 5.6.4-fluid-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.
Files changed (50) hide show
  1. package/lib/src/brand-page/components/banner-section/BannerSection.mixin.js +5 -0
  2. package/lib/src/brand-page/components/payment/__fixtures__/request-payment.d.ts +3 -0
  3. package/lib/src/brand-page/components/payment/__fixtures__/support-me.d.ts +3 -0
  4. package/lib/src/brand-page/models/brand-page-context.model.d.ts +3 -0
  5. package/lib/src/brand-page/utils/migration/migration-03.d.ts +5 -0
  6. package/lib/src/brand-page/utils/migration/migration-03.js +28 -0
  7. package/lib/src/brand-page/utils/migration.util.js +5 -0
  8. package/lib/src/brand-page-maker/components/brand-page-maker/BrandPageMaker.mixin.js +1 -1
  9. package/lib/src/brand-page-maker/components/brand-page-maker/BrandPageMaker.stories.js +37 -2
  10. package/lib/src/brand-page-maker/components/brandpage-maker-page/BrandPageMakerPage.mixin.d.ts +1 -0
  11. package/lib/src/brand-page-maker/components/brandpage-maker-page/BrandPageMakerPage.mixin.js +11 -0
  12. package/lib/src/brand-page-maker/components/template-preview/TemplatePreview.mixin.js +3 -0
  13. package/lib/src/brand-page-maker/convertors/text-size-value.convertor.js +3 -3
  14. package/lib/src/brand-page-maker/utils/text.util.d.ts +2 -2
  15. package/lib/src/brand-page-maker/utils/text.util.js +3 -3
  16. package/lib/src/clients/user-media-client.d.ts +1 -2
  17. package/lib/src/clients/user-media-client.js +5 -19
  18. package/lib/src/css/library.brand-page-brandCrowd.min.css +19 -47
  19. package/lib/src/css/library.brand-page-brandPage.min.css +19 -47
  20. package/lib/src/css/library.brand-page-designCom.min.css +19 -47
  21. package/lib/src/css/library.brand-page-preview.min.css +19 -47
  22. package/lib/src/index.mjs +11068 -11101
  23. package/lib/src/shared/my-uploads/MyMedia.mixin.d.ts +0 -4
  24. package/lib/src/shared/my-uploads/MyMedia.mixin.js +5 -24
  25. package/lib/src/shared/my-uploads/MyUploads.mixin.js +1 -1
  26. package/lib/src/shared/my-uploads/models.d.ts +0 -1
  27. package/package.json +1 -1
  28. package/src/brand-page/components/banner-section/BannerSection.mixin.ts +5 -0
  29. package/src/brand-page/components/page/Page.vue +5 -1
  30. package/src/brand-page/components/text-wrapper/TextWrapper.vue +156 -12
  31. package/src/brand-page/models/brand-page-context.model.ts +3 -0
  32. package/src/brand-page/utils/__snapshots__/migration.util.test.ts.snap +26 -26
  33. package/src/brand-page/utils/migration/migration-03.ts +40 -0
  34. package/src/brand-page/utils/migration.util.ts +5 -0
  35. package/src/brand-page-maker/components/brand-page-maker/BrandPageMaker.mixin.ts +1 -1
  36. package/src/brand-page-maker/components/brand-page-maker/BrandPageMaker.stories.ts +43 -3
  37. package/src/brand-page-maker/components/brandpage-maker-page/BrandPageMakerPage.mixin.ts +13 -0
  38. package/src/brand-page-maker/components/template-preview/TemplatePreview.mixin.ts +3 -0
  39. package/src/brand-page-maker/convertors/text-size-value.convertor.ts +3 -3
  40. package/src/brand-page-maker/stores/brandpage-maker/brandpage-maker-store.test.ts +12 -3
  41. package/src/brand-page-maker/utils/text.util.ts +3 -3
  42. package/src/clients/user-media-client.ts +15 -32
  43. package/src/shared/my-uploads/MyMedia.mixin.ts +8 -36
  44. package/src/shared/my-uploads/MyMedia.vue +10 -9
  45. package/src/shared/my-uploads/MyUploads.mixin.ts +0 -1
  46. package/src/shared/my-uploads/models.ts +0 -1
  47. package/lib/src/brand-page/components/text-wrapper/TextWrapper.mixin.d.ts +0 -44
  48. package/lib/src/brand-page/components/text-wrapper/TextWrapper.mixin.js +0 -38
  49. package/src/brand-page/components/text-wrapper/TextWrapper.mixin.ts +0 -41
  50. package/src/shared/my-uploads/MyMediaSelectionItem.vue +0 -137
@@ -1,6 +1,5 @@
1
1
  import type { PropType } from 'vue';
2
2
  import type { UserMediaItemWithDimensions } from './models';
3
- import { UserMediaClient } from '../../clients/user-media-client';
4
3
  declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
5
4
  isDeleteEnabled: {
6
5
  type: BooleanConstructor;
@@ -62,7 +61,6 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
62
61
  isDeleting: boolean;
63
62
  selectedDeleteMediaItem: UserMediaItemWithDimensions | null;
64
63
  userMedia: UserMediaItemWithDimensions[];
65
- userMediaClient: UserMediaClient | null;
66
64
  loading: boolean;
67
65
  }, {
68
66
  filteredUserMedia(): UserMediaItemWithDimensions[];
@@ -76,8 +74,6 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
76
74
  onMediaDeleteConfirmClick(image: UserMediaItemWithDimensions): Promise<void>;
77
75
  deleteSelectedDeleteMediaItem(): Promise<void>;
78
76
  isSvg(imageUrl: string | undefined): boolean;
79
- onMediaStatusUpdatedToDone(data: any): Promise<void>;
80
- isImageUploaded(image: any): boolean;
81
77
  }, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
82
78
  isDeleteEnabled: {
83
79
  type: BooleanConstructor;
@@ -1,6 +1,6 @@
1
1
  import { UI_EVENTS } from '../../brand-page-maker/constants';
2
2
  import { computed, defineComponent } from 'vue';
3
- import { getInstance as getUserMediaClientInstance, UserMediaClient, } from '../../clients/user-media-client';
3
+ import { getInstance as getUserMediaClientInstance } from '../../clients/user-media-client';
4
4
  import { preloadImage } from '../../brand-page/utils';
5
5
  import { useUiStore } from '../../brand-page-maker/stores';
6
6
  import { MEDIA_TYPES } from '../../brand-page/models/brand-page-context.model';
@@ -33,7 +33,6 @@ export default defineComponent({
33
33
  isDeleting: false,
34
34
  selectedDeleteMediaItem: null,
35
35
  userMedia: [],
36
- userMediaClient: null,
37
36
  loading: false,
38
37
  };
39
38
  },
@@ -52,7 +51,6 @@ export default defineComponent({
52
51
  },
53
52
  },
54
53
  async mounted() {
55
- this.userMediaClient = getUserMediaClientInstance(this.endpoints);
56
54
  await this.loadUserMedia();
57
55
  if (window) {
58
56
  window.addEventListener(UI_EVENTS.refreshUserMediaEvent, this.onRefreshMedia);
@@ -66,7 +64,8 @@ export default defineComponent({
66
64
  methods: {
67
65
  async loadUserMedia() {
68
66
  this.loading = true;
69
- const images = await this.userMediaClient.getUserMediaAsync(this.supportedFileExtensions, true, this.mediaType);
67
+ const userMediaClient = getUserMediaClientInstance(this.endpoints);
68
+ const images = await userMediaClient.getUserMediaAsync(this.supportedFileExtensions, true, this.mediaType);
70
69
  if (Array.isArray(images)) {
71
70
  await Promise.all(images.map(async (x) => {
72
71
  const image = await preloadImage(x.thumbnailUrl || x.url);
@@ -115,7 +114,8 @@ export default defineComponent({
115
114
  }
116
115
  this.isDeleting = true;
117
116
  try {
118
- const deleted = await this.userMediaClient.deleteUserMediaByUserMediaToken(this.selectedDeleteMediaItem.media.token);
117
+ const userMediaClient = getUserMediaClientInstance(this.endpoints);
118
+ const deleted = await userMediaClient.deleteUserMediaByUserMediaToken(this.selectedDeleteMediaItem.media.token);
119
119
  if (deleted) {
120
120
  this.selectedDeleteMediaItem = null;
121
121
  await this.onRefreshMedia();
@@ -128,24 +128,5 @@ export default defineComponent({
128
128
  isSvg(imageUrl) {
129
129
  return imageUrl?.endsWith('.svg') || false;
130
130
  },
131
- async onMediaStatusUpdatedToDone(data) {
132
- const newMedia = this.userMedia.map((m) => {
133
- if (m.media.token === data.media.token) {
134
- return {
135
- imagePreviewSrc: data.thumbnailUrl,
136
- imageSrc: data.url,
137
- ...data,
138
- };
139
- }
140
- return m;
141
- });
142
- this.userMedia = newMedia;
143
- },
144
- isImageUploaded(image) {
145
- if (image.media && image.media.status) {
146
- return image.media.status === 'done';
147
- }
148
- return true;
149
- },
150
131
  },
151
132
  });
@@ -137,7 +137,7 @@ export default defineComponent({
137
137
  async onDropzoneImageUploaderSuccess(file) {
138
138
  const { mediaToken, name, type } = file;
139
139
  if (this.userMediaClient) {
140
- await this.userMediaClient.insertUserMediaAsync(mediaToken, name, type, true, undefined, this.mediaType, true);
140
+ await this.userMediaClient.insertUserMediaAsync(mediaToken, name, type, true, undefined, this.mediaType);
141
141
  }
142
142
  this.dropzoneImageUploaderRef?.removeAllFiles();
143
143
  // Dispatch the refresh event in the dropzone success event handler
@@ -4,7 +4,6 @@ interface UserMediaItemMedia {
4
4
  name: string;
5
5
  mimeType: string;
6
6
  createdOn: string;
7
- status: string;
8
7
  }
9
8
  export interface UserMediaItem {
10
9
  url: string;
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.6.3",
4
+ "version": "5.6.4-fluid-2",
5
5
  "author": "Design.com Eng",
6
6
  "license": "UNLICENSED",
7
7
  "type": "module",
@@ -52,6 +52,11 @@ export default defineComponent({
52
52
  window.addEventListener('resize', this.onResize);
53
53
  });
54
54
  },
55
+ unmounted() {
56
+ if (typeof window !== undefined) {
57
+ window.removeEventListener(`resize`, this.onResize);
58
+ }
59
+ },
55
60
  computed: {
56
61
  displayAlignClass() {
57
62
  switch (this.viewModel.displayStyle) {
@@ -58,6 +58,7 @@
58
58
 
59
59
  <div
60
60
  :class="{
61
+ 'brand-page-container': true,
61
62
  'brand-page__content--default': !context.isBrandSite,
62
63
  'brand-page__content--desktop': context.isBrandSite,
63
64
  }"
@@ -226,7 +227,10 @@
226
227
  />
227
228
  </div>
228
229
 
229
- <MediaQuery :viewport="viewport">
230
+ <MediaQuery
231
+ v-if="!context.options?.disableNavigationSideMenu"
232
+ :viewport="viewport"
233
+ >
230
234
  <template #desktop>
231
235
  <NavigationSideMenu
232
236
  :context="context"
@@ -1,18 +1,162 @@
1
1
  <template>
2
- <div v-if="text" class="tw-w-full" :style="style">
3
- <component
4
- :is="element"
5
- :class="padding"
6
- class="tw-box-decoration-clone tw-inline"
7
- :style="textStyles"
8
- v-html="text"
9
- />
2
+ <div v-if="text" class="tw-w-full" :style="data.wrapperStyle">
3
+ <div class="tw-w-full" :style="style">
4
+ <component
5
+ :is="element"
6
+ :class="padding"
7
+ class="tw-box-decoration-clone tw-inline"
8
+ :style="textStyles"
9
+ v-html="text"
10
+ />
11
+ </div>
10
12
  </div>
11
13
  </template>
12
- <script>
13
- import TextWrapper from './TextWrapper.mixin.ts';
14
+ <script setup lang="ts">
15
+ import {
16
+ computed,
17
+ reactive,
18
+ onMounted,
19
+ onUnmounted,
20
+ getCurrentInstance,
21
+ } from 'vue';
14
22
 
15
- export default {
16
- mixins: [TextWrapper],
23
+ interface Props {
24
+ textStyle: BrandPageCssStyle;
25
+ text: string;
26
+ element?: string;
27
+ }
28
+
29
+ const props = withDefaults(defineProps<Props>(), {
30
+ element: 'p',
31
+ });
32
+
33
+ const data = reactive({
34
+ wrapperStyle: {
35
+ fontSize: '100%',
36
+ },
37
+ thisElement: null as any,
38
+ targetContainer: null as any,
39
+ });
40
+
41
+ const textStyles = computed(() => {
42
+ return {
43
+ backgroundColor: props.textStyle.backgroundColor,
44
+ };
45
+ });
46
+
47
+ const style = computed<any>(() => {
48
+ const { backgroundColor, ...textStyle } = props.textStyle;
49
+
50
+ return textStyle;
51
+ });
52
+
53
+ const context = getCurrentInstance();
54
+
55
+ const padding = computed(() =>
56
+ props.textStyle.backgroundColor ? 'tw-py-2 tw-px-4' : '',
57
+ );
58
+
59
+ onMounted(() => {
60
+ setTargetContainer();
61
+
62
+ window.addEventListener('resize', applyScale);
63
+ window.addEventListener('editor:viewport', applyScaleWithDelay);
64
+ });
65
+
66
+ onUnmounted(() => {
67
+ window.removeEventListener('resize', applyScale);
68
+ window.removeEventListener('editor:viewport', applyScaleWithDelay);
69
+ });
70
+
71
+ const applyScaleWithDelay = (e) => {
72
+ setTimeout(() => {
73
+ applyScale(e);
74
+ }, 350);
75
+ };
76
+
77
+ const defaultTargetContainer = 'brand-page-container';
78
+
79
+ // Traversing back up the node tree to find the correct container element
80
+ // There can be more than one due to template setting side bar if we use document selector
81
+ const setTargetContainer = () => {
82
+ data.thisElement = (context as any).vnode.el;
83
+
84
+ let p = data.thisElement.parentNode;
85
+ while (p) {
86
+ if (p.className?.split(' ').includes(defaultTargetContainer)) {
87
+ data.targetContainer = p;
88
+ return;
89
+ }
90
+
91
+ p = p.parentNode;
92
+ }
93
+
94
+ data.targetContainer = null;
95
+ };
96
+
97
+ // 1 16
98
+ // 2 32
99
+ // 3 48
100
+ // 4 64
101
+ // 4.5 72
102
+ // 5 80
103
+ // 6 96
104
+ // 7 112
105
+ // 8 128
106
+
107
+ // 13 length - higest
108
+ // 8 length
109
+ // 6 length - average
110
+
111
+ // 100% - 41.5% - roughly maximum scale reduction is -60%
112
+ // 768px - 320px
113
+
114
+ // Original -> newFont -> reduced
115
+ // 128px -> 51 = -77 .. require drastic change
116
+ // 100px -> 40 = -60 ..
117
+ // 50px -> 20 = -30 .. require shallow change
118
+
119
+ const applyScale = (e) => {
120
+ // console.log('ee2e', e.type, e);
121
+
122
+ const currentFontSize = props.textStyle.fontSize || '1em';
123
+ const fontSizeValue = parseFloat(currentFontSize);
124
+ const fontSizeValueInPx = fontSizeValue * 16;
125
+ if (fontSizeValue < 2) {
126
+ return;
127
+ }
128
+
129
+ const minFontSizeInPx = 18;
130
+ const maxWidth = 768;
131
+ const targetContainerWidth = data.targetContainer.clientWidth;
132
+
133
+ console.log('Text >', props.text, window.innerWidth, targetContainerWidth);
134
+
135
+ if (targetContainerWidth < maxWidth) {
136
+ const windowSizeChangeRate = targetContainerWidth / maxWidth;
137
+
138
+ // VariableRate that determines the how much windowSizeChangeRate to actually apply
139
+ const variableFontRate = minFontSizeInPx / fontSizeValueInPx;
140
+ const variableRate = 1 - variableFontRate;
141
+
142
+ // using math power to give variable factor
143
+ const changeRate = Math.pow(windowSizeChangeRate, variableRate);
144
+
145
+ const scaledPercentage = Math.min(changeRate * 100, 100);
146
+ console.log(' fontSize', currentFontSize, `${fontSizeValue * 16}px`);
147
+ console.log(
148
+ ' fontSizeScaled',
149
+ fontSizeValue * changeRate,
150
+ `${fontSizeValue * 16 * changeRate}px`,
151
+ );
152
+ console.log(' variableFontRate', variableFontRate);
153
+ console.log(' windowSizeChangeRate', windowSizeChangeRate);
154
+ console.log(' variableRate', variableRate);
155
+ console.log(' changeRate', changeRate);
156
+
157
+ data.wrapperStyle.fontSize = `${scaledPercentage}%`;
158
+ } else {
159
+ data.wrapperStyle.fontSize = '100%';
160
+ }
17
161
  };
18
162
  </script>
@@ -45,4 +45,7 @@ export interface BrandPageContext {
45
45
  isBrandPageOrIsBrandContact: boolean;
46
46
  isBrandSite: boolean;
47
47
  isBrandContact: boolean;
48
+ options?: {
49
+ disableNavigationSideMenu: boolean;
50
+ };
48
51
  }
@@ -147,7 +147,7 @@ BrandPageModel {
147
147
  "borderTopWidth": "0px",
148
148
  "color": undefined,
149
149
  "fontFamily": "Lato",
150
- "fontSize": "1rem",
150
+ "fontSize": "1em",
151
151
  "fontStyle": undefined,
152
152
  "fontWeight": "normal",
153
153
  "lineHeight": "1.1",
@@ -219,7 +219,7 @@ BrandPageModel {
219
219
  "borderTopWidth": "0px",
220
220
  "color": undefined,
221
221
  "fontFamily": "Lato",
222
- "fontSize": "1rem",
222
+ "fontSize": "1em",
223
223
  "fontStyle": undefined,
224
224
  "fontWeight": "normal",
225
225
  "lineHeight": "1.1",
@@ -275,7 +275,7 @@ BrandPageModel {
275
275
  "buttonText": "Get Started",
276
276
  "buttonTextStyle": {
277
277
  "fontFamily": "Lato",
278
- "fontSize": "1rem",
278
+ "fontSize": "1em",
279
279
  "lineHeight": "1.5",
280
280
  "overflowWrap": "anywhere",
281
281
  "textAlign": "center",
@@ -285,7 +285,7 @@ BrandPageModel {
285
285
  "description": "",
286
286
  "descriptionStyle": {
287
287
  "fontFamily": "Lato",
288
- "fontSize": "1rem",
288
+ "fontSize": "1em",
289
289
  "lineHeight": "1.5",
290
290
  "overflowWrap": "anywhere",
291
291
  "textAlign": "center",
@@ -300,7 +300,7 @@ BrandPageModel {
300
300
  "title": "This is a banner",
301
301
  "titleStyle": {
302
302
  "fontFamily": "Lato",
303
- "fontSize": "2.25rem",
303
+ "fontSize": "2.25em",
304
304
  "lineHeight": "1.1",
305
305
  "overflowWrap": "anywhere",
306
306
  "textAlign": "center",
@@ -361,7 +361,7 @@ BrandPageModel {
361
361
  "style": {
362
362
  "color": undefined,
363
363
  "fontFamily": "Lato",
364
- "fontSize": "1rem",
364
+ "fontSize": "1em",
365
365
  "fontStyle": undefined,
366
366
  "fontWeight": undefined,
367
367
  "letterSpacing": "0",
@@ -377,7 +377,7 @@ BrandPageModel {
377
377
  "style": {
378
378
  "color": undefined,
379
379
  "fontFamily": "Lato",
380
- "fontSize": "1.5rem",
380
+ "fontSize": "1.5em",
381
381
  "fontStyle": undefined,
382
382
  "fontWeight": undefined,
383
383
  "letterSpacing": "0",
@@ -393,7 +393,7 @@ BrandPageModel {
393
393
  "style": {
394
394
  "color": undefined,
395
395
  "fontFamily": "Lato",
396
- "fontSize": "1rem",
396
+ "fontSize": "1em",
397
397
  "fontStyle": undefined,
398
398
  "fontWeight": undefined,
399
399
  "letterSpacing": "0",
@@ -409,7 +409,7 @@ BrandPageModel {
409
409
  "style": {
410
410
  "color": undefined,
411
411
  "fontFamily": "Lato",
412
- "fontSize": "2.25rem",
412
+ "fontSize": "2.25em",
413
413
  "fontStyle": undefined,
414
414
  "fontWeight": undefined,
415
415
  "letterSpacing": "0",
@@ -423,7 +423,7 @@ BrandPageModel {
423
423
  },
424
424
  },
425
425
  },
426
- "v": 2,
426
+ "v": 3,
427
427
  }
428
428
  `;
429
429
 
@@ -574,7 +574,7 @@ BrandPageModel {
574
574
  "borderTopWidth": "0px",
575
575
  "color": undefined,
576
576
  "fontFamily": "Lato",
577
- "fontSize": "1rem",
577
+ "fontSize": "1em",
578
578
  "fontStyle": undefined,
579
579
  "fontWeight": "normal",
580
580
  "lineHeight": "1.1",
@@ -646,7 +646,7 @@ BrandPageModel {
646
646
  "borderTopWidth": "0px",
647
647
  "color": undefined,
648
648
  "fontFamily": "Lato",
649
- "fontSize": "1rem",
649
+ "fontSize": "1em",
650
650
  "fontStyle": undefined,
651
651
  "fontWeight": "normal",
652
652
  "lineHeight": "1.1",
@@ -711,7 +711,7 @@ BrandPageModel {
711
711
  },
712
712
  ],
713
713
  "textSize": {
714
- "fontSize": "1rem",
714
+ "fontSize": "1em",
715
715
  "lineHeight": "1.2",
716
716
  },
717
717
  "textStyle": {
@@ -772,7 +772,7 @@ BrandPageModel {
772
772
  "style": {
773
773
  "color": undefined,
774
774
  "fontFamily": "Lato",
775
- "fontSize": "1rem",
775
+ "fontSize": "1em",
776
776
  "fontStyle": undefined,
777
777
  "fontWeight": undefined,
778
778
  "letterSpacing": "0",
@@ -788,7 +788,7 @@ BrandPageModel {
788
788
  "style": {
789
789
  "color": undefined,
790
790
  "fontFamily": "Lato",
791
- "fontSize": "1.5rem",
791
+ "fontSize": "1.5em",
792
792
  "fontStyle": undefined,
793
793
  "fontWeight": undefined,
794
794
  "letterSpacing": "0",
@@ -804,7 +804,7 @@ BrandPageModel {
804
804
  "style": {
805
805
  "color": undefined,
806
806
  "fontFamily": "Lato",
807
- "fontSize": "1rem",
807
+ "fontSize": "1em",
808
808
  "fontStyle": undefined,
809
809
  "fontWeight": undefined,
810
810
  "letterSpacing": "0",
@@ -820,7 +820,7 @@ BrandPageModel {
820
820
  "style": {
821
821
  "color": undefined,
822
822
  "fontFamily": "Lato",
823
- "fontSize": "2.25rem",
823
+ "fontSize": "2.25em",
824
824
  "fontStyle": undefined,
825
825
  "fontWeight": undefined,
826
826
  "letterSpacing": "0",
@@ -834,7 +834,7 @@ BrandPageModel {
834
834
  },
835
835
  },
836
836
  },
837
- "v": 2,
837
+ "v": 3,
838
838
  }
839
839
  `;
840
840
 
@@ -985,7 +985,7 @@ BrandPageModel {
985
985
  "borderTopWidth": "0px",
986
986
  "color": undefined,
987
987
  "fontFamily": "Lato",
988
- "fontSize": "1rem",
988
+ "fontSize": "1em",
989
989
  "fontStyle": undefined,
990
990
  "fontWeight": "normal",
991
991
  "lineHeight": "1.1",
@@ -1057,7 +1057,7 @@ BrandPageModel {
1057
1057
  "borderTopWidth": "0px",
1058
1058
  "color": undefined,
1059
1059
  "fontFamily": "Lato",
1060
- "fontSize": "1rem",
1060
+ "fontSize": "1em",
1061
1061
  "fontStyle": undefined,
1062
1062
  "fontWeight": "normal",
1063
1063
  "lineHeight": "1.1",
@@ -1129,7 +1129,7 @@ BrandPageModel {
1129
1129
  },
1130
1130
  ],
1131
1131
  "textSize": {
1132
- "fontSize": "1rem",
1132
+ "fontSize": "1em",
1133
1133
  "lineHeight": "1.2",
1134
1134
  },
1135
1135
  "textStyle": {
@@ -1190,7 +1190,7 @@ BrandPageModel {
1190
1190
  "style": {
1191
1191
  "color": undefined,
1192
1192
  "fontFamily": "Lato",
1193
- "fontSize": "1rem",
1193
+ "fontSize": "1em",
1194
1194
  "fontStyle": undefined,
1195
1195
  "fontWeight": undefined,
1196
1196
  "letterSpacing": "0",
@@ -1206,7 +1206,7 @@ BrandPageModel {
1206
1206
  "style": {
1207
1207
  "color": undefined,
1208
1208
  "fontFamily": "Lato",
1209
- "fontSize": "1.5rem",
1209
+ "fontSize": "1.5em",
1210
1210
  "fontStyle": undefined,
1211
1211
  "fontWeight": undefined,
1212
1212
  "letterSpacing": "0",
@@ -1222,7 +1222,7 @@ BrandPageModel {
1222
1222
  "style": {
1223
1223
  "color": undefined,
1224
1224
  "fontFamily": "Lato",
1225
- "fontSize": "1rem",
1225
+ "fontSize": "1em",
1226
1226
  "fontStyle": undefined,
1227
1227
  "fontWeight": undefined,
1228
1228
  "letterSpacing": "0",
@@ -1238,7 +1238,7 @@ BrandPageModel {
1238
1238
  "style": {
1239
1239
  "color": undefined,
1240
1240
  "fontFamily": "Lato",
1241
- "fontSize": "2.25rem",
1241
+ "fontSize": "2.25em",
1242
1242
  "fontStyle": undefined,
1243
1243
  "fontWeight": undefined,
1244
1244
  "letterSpacing": "0",
@@ -1252,6 +1252,6 @@ BrandPageModel {
1252
1252
  },
1253
1253
  },
1254
1254
  },
1255
- "v": 2,
1255
+ "v": 3,
1256
1256
  }
1257
1257
  `;
@@ -0,0 +1,40 @@
1
+ import { type BrandPageModel, type LogoImageModel } from '../..';
2
+
3
+ const handleRecursiveFontSizeMigration = (object: object) => {
4
+ if (!object) {
5
+ return;
6
+ }
7
+
8
+ if (object['fontSize']) {
9
+ // Handle conversion here
10
+ object['fontSize'] = object['fontSize'].replace('rem', 'em');
11
+ }
12
+
13
+ Object.keys(object).forEach((k) => {
14
+ if (typeof object[k] === 'object' && !Array.isArray(object[k])) {
15
+ handleRecursiveFontSizeMigration(object[k]);
16
+ }
17
+ });
18
+ };
19
+
20
+ export const migration03 = (
21
+ brandPageModel: BrandPageModel,
22
+ options: {
23
+ logoImage?: LogoImageModel;
24
+ isUserDraft: boolean;
25
+ },
26
+ ): BrandPageModel => {
27
+ handleRecursiveFontSizeMigration(brandPageModel.pageHeaderDesktop);
28
+ handleRecursiveFontSizeMigration(brandPageModel.pageHeaderMobile);
29
+ handleRecursiveFontSizeMigration(brandPageModel.pageFooterDesktop);
30
+ handleRecursiveFontSizeMigration(brandPageModel.pageFooterMobile);
31
+ handleRecursiveFontSizeMigration(brandPageModel.styles);
32
+
33
+ brandPageModel.pages.forEach((page) => {
34
+ page.contents.forEach((content) => {
35
+ handleRecursiveFontSizeMigration(content);
36
+ });
37
+ });
38
+
39
+ return brandPageModel;
40
+ };
@@ -1,6 +1,7 @@
1
1
  import { type BrandPageModel, type LogoImageModel } from '../models';
2
2
  import { migration01 } from './migration/migration-01';
3
3
  import { migration02 } from './migration/migration-02';
4
+ import { migration03 } from './migration/migration-03';
4
5
 
5
6
  interface MigrationTableItem {
6
7
  version: number;
@@ -22,6 +23,10 @@ const MIGRATION_TABLE = [
22
23
  version: 2,
23
24
  migrateFn: migration02,
24
25
  },
26
+ {
27
+ version: 3,
28
+ migrateFn: migration03,
29
+ },
25
30
  ] as MigrationTableItem[];
26
31
 
27
32
  export const GetLatestModelVersion = () =>
@@ -164,7 +164,7 @@ export default defineComponent({
164
164
  : null;
165
165
 
166
166
  if (!this.containerStore.baseFabricRenderUrl) {
167
- throw new Error('base fabric render url is undefined');
167
+ // throw new Error('base fabric render url is undefined');
168
168
  }
169
169
 
170
170
  FabricRenderClient.setInstance({