@designcrowd/library.brand-page 5.14.11 → 5.14.12
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-BJ3Foxao.js → CreatedOnBrandCrowd-de-de-C5tl1NwD.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-en-us-BjI_fxWY.js → CreatedOnBrandCrowd-en-us-C7J2vGwU.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-es-es-Dt8190BK.js → CreatedOnBrandCrowd-es-es-IREekVx2.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-fr-fr-Ck6zCiIn.js → CreatedOnBrandCrowd-fr-fr-EJkAJ0iH.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-pt-pt-CaNvmzQJ.js → CreatedOnBrandCrowd-pt-pt-mKBH6Ary.js} +1 -1
- package/lib/src/{CreatedOnDcom-de-de-DMEecXw8.js → CreatedOnDcom-de-de-CWWw2LBb.js} +1 -1
- package/lib/src/{CreatedOnDcom-en-us-BZIPLMxJ.js → CreatedOnDcom-en-us-Db6zzKtc.js} +1 -1
- package/lib/src/{CreatedOnDcom-es-es-D6ey1TnI.js → CreatedOnDcom-es-es-CsMu_iBW.js} +1 -1
- package/lib/src/{CreatedOnDcom-fr-fr-NaeiDsv-.js → CreatedOnDcom-fr-fr-oJRc8eop.js} +1 -1
- package/lib/src/{CreatedOnDcom-pt-pt-BwEUUii2.js → CreatedOnDcom-pt-pt-CQ_otC6l.js} +1 -1
- package/lib/src/brand-page/components/button/Button.mixin.js +4 -2
- package/lib/src/brand-page/models/index.d.ts +9 -2
- package/lib/src/brand-page/utils/migration/migration-06.d.ts +2 -0
- package/lib/src/brand-page/utils/migration/migration-06.js +48 -0
- package/lib/src/brand-page/utils/migration.util.js +6 -0
- package/lib/src/brand-page/utils/view-model.util.js +49 -11
- package/lib/src/brand-page/view-models.d.ts +10 -3
- package/lib/src/brand-page-maker/constants/config-settings-constant.js +8 -1
- package/lib/src/brand-page-maker/models/content-settings.js +7 -1
- package/lib/src/{bundled-translations-B54196Rf.js → bundled-translations-fWikWTfa.js} +15 -15
- package/lib/src/{bundled-translations.de-DE-CNESUsYJ.js → bundled-translations.de-DE-CwtsRCCr.js} +33 -33
- package/lib/src/{bundled-translations.es-ES-FWge029M.js → bundled-translations.es-ES-DELCLCbF.js} +9 -9
- package/lib/src/{bundled-translations.fr-CA-DlWfm29N.js → bundled-translations.fr-CA-PDBhYlx8.js} +17 -17
- package/lib/src/{bundled-translations.fr-FR-DRCMzVfh.js → bundled-translations.fr-FR-OuZj3i-r.js} +24 -24
- package/lib/src/{bundled-translations.pt-BR-llUnBWoL.js → bundled-translations.pt-BR-RPfprZOm.js} +36 -36
- package/lib/src/{bundled-translations.pt-PT-K74Dt682.js → bundled-translations.pt-PT-DF_GCXSl.js} +5 -5
- package/lib/src/bundles/bundled-translations.de-DE.json +18 -2
- package/lib/src/bundles/bundled-translations.es-ES.json +18 -2
- package/lib/src/bundles/bundled-translations.fr-CA.json +18 -2
- package/lib/src/bundles/bundled-translations.fr-FR.json +18 -2
- package/lib/src/bundles/bundled-translations.json +18 -2
- package/lib/src/bundles/bundled-translations.pt-BR.json +18 -2
- package/lib/src/bundles/bundled-translations.pt-PT.json +18 -2
- package/lib/src/css/library.brand-page-brandCrowd.min.css +31 -28
- package/lib/src/css/library.brand-page-brandPage.min.css +31 -28
- package/lib/src/css/library.brand-page-designCom.min.css +31 -28
- package/lib/src/css/library.brand-page-preview.min.css +31 -28
- package/lib/src/index.mjs +1 -1
- package/lib/src/{lib-C0mkZ8UD.js → lib-CwoD7AhY.js} +26687 -26581
- package/lib/src/shared/content-settings/components/items-field/ItemsField.mixin.d.ts +3 -3
- package/lib/src/shared/content-settings/components/items-field/ItemsField.mixin.js +3 -3
- package/lib/src/shared/page-settings/components/page-settings/PageSettings.mixin.d.ts +2 -2
- package/lib/src/shared/page-settings/components/page-settings-section-styles/PageSettingsSectionStyles.mixin.d.ts +2 -2
- package/package.json +1 -1
- package/src/brand-page/components/button/Button.mixin.ts +4 -2
- package/src/brand-page/components/fallback-image/FallbackImage.vue +1 -1
- package/src/brand-page/components/image/Image.vue +1 -1
- package/src/brand-page/components/images-section/ImagesSection.test.ts +230 -0
- package/src/brand-page/components/images-section/ImagesSection.vue +185 -18
- package/src/brand-page/components/shapes-section/ShapesSection.vue +19 -9
- package/src/brand-page/components/text-media-section/TextMediaSection.vue +166 -7
- package/src/brand-page/models/index.ts +10 -2
- package/src/brand-page/utils/__snapshots__/migration.util.test.ts.snap +3 -3
- package/src/brand-page/utils/migration/migration-06.ts +64 -0
- package/src/brand-page/utils/migration.util.ts +6 -0
- package/src/brand-page/utils/view-model.util.ts +62 -13
- package/src/brand-page/view-models.ts +8 -2
- package/src/brand-page-maker/constants/config-settings-constant.ts +7 -1
- package/src/brand-page-maker/models/content-settings.ts +7 -1
- package/src/bundles/bundled-translations.de-DE.json +18 -2
- package/src/bundles/bundled-translations.es-ES.json +18 -2
- package/src/bundles/bundled-translations.fr-CA.json +18 -2
- package/src/bundles/bundled-translations.fr-FR.json +18 -2
- package/src/bundles/bundled-translations.json +18 -2
- package/src/bundles/bundled-translations.pt-BR.json +18 -2
- package/src/bundles/bundled-translations.pt-PT.json +18 -2
- package/src/shared/content-settings/components/button-configuration-field/ButtonConfigurationField.vue +283 -0
- package/src/shared/content-settings/components/content-settings/i18n/content-settings.de-DE.json +1 -0
- package/src/shared/content-settings/components/content-settings/i18n/content-settings.es-ES.json +1 -0
- package/src/shared/content-settings/components/content-settings/i18n/content-settings.fr-CA.json +1 -0
- package/src/shared/content-settings/components/content-settings/i18n/content-settings.fr-FR.json +1 -0
- package/src/shared/content-settings/components/content-settings/i18n/content-settings.json +1 -0
- package/src/shared/content-settings/components/content-settings/i18n/content-settings.pt-BR.json +1 -0
- package/src/shared/content-settings/components/content-settings/i18n/content-settings.pt-PT.json +1 -0
- package/src/shared/content-settings/components/items-field/ItemsField.mixin.ts +3 -3
- package/src/shared/content-settings/components/text-image-field/TextImageField.vue +428 -92
- package/src/shared/content-settings/components/text-image-field/i18n/text-image-field.de-DE.json +18 -3
- package/src/shared/content-settings/components/text-image-field/i18n/text-image-field.es-ES.json +18 -3
- package/src/shared/content-settings/components/text-image-field/i18n/text-image-field.fr-CA.json +18 -3
- package/src/shared/content-settings/components/text-image-field/i18n/text-image-field.fr-FR.json +18 -3
- package/src/shared/content-settings/components/text-image-field/i18n/text-image-field.json +18 -2
- package/src/shared/content-settings/components/text-image-field/i18n/text-image-field.pt-BR.json +18 -3
- package/src/shared/content-settings/components/text-image-field/i18n/text-image-field.pt-PT.json +18 -3
- package/lib/src/brand-page/components/images-section/ImagesSection.mixin.d.ts +0 -86
- package/lib/src/brand-page/components/images-section/ImagesSection.mixin.js +0 -149
- package/lib/src/brand-page/components/shapes-section/ShapesSection.mixin.d.ts +0 -62
- package/lib/src/brand-page/components/shapes-section/ShapesSection.mixin.js +0 -25
- package/lib/src/brand-page/components/text-media-section/TextMediaSection.mixin.d.ts +0 -66
- package/lib/src/brand-page/components/text-media-section/TextMediaSection.mixin.js +0 -90
- package/lib/src/shared/content-settings/components/text-image-field/TextImageField.mixin.d.ts +0 -126
- package/lib/src/shared/content-settings/components/text-image-field/TextImageField.mixin.js +0 -192
- package/src/brand-page/components/images-section/ImagesSection.mixin.ts +0 -183
- package/src/brand-page/components/shapes-section/ShapesSection.mixin.ts +0 -29
- package/src/brand-page/components/text-media-section/TextMediaSection.mixin.ts +0 -124
- package/src/shared/content-settings/components/text-image-field/TextImageField.mixin.ts +0 -252
package/lib/src/shared/content-settings/components/text-image-field/TextImageField.mixin.d.ts
DELETED
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
/// <reference types="types/lodash-shims" />
|
|
2
|
-
import type { PropType } from 'vue';
|
|
3
|
-
import type { ColorReplacement, LogoTheme, TextMediaItem, TextShapeItem, Content } from '../../../../brand-page';
|
|
4
|
-
import type { DebounceHandle } from 'lodash.debounce';
|
|
5
|
-
import type { UpdateItemValuePayload } from '../../models';
|
|
6
|
-
declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
7
|
-
id: {
|
|
8
|
-
type: StringConstructor;
|
|
9
|
-
required: true;
|
|
10
|
-
};
|
|
11
|
-
name: {
|
|
12
|
-
type: StringConstructor;
|
|
13
|
-
required: true;
|
|
14
|
-
};
|
|
15
|
-
content: {
|
|
16
|
-
type: PropType<Content>;
|
|
17
|
-
required: true;
|
|
18
|
-
};
|
|
19
|
-
value: {
|
|
20
|
-
type: PropType<TextMediaItem[]>;
|
|
21
|
-
required: true;
|
|
22
|
-
};
|
|
23
|
-
maxLength: {
|
|
24
|
-
type: NumberConstructor;
|
|
25
|
-
required: false;
|
|
26
|
-
default: undefined;
|
|
27
|
-
};
|
|
28
|
-
logoTheme: {
|
|
29
|
-
type: PropType<LogoTheme>;
|
|
30
|
-
required: true;
|
|
31
|
-
};
|
|
32
|
-
settings: {
|
|
33
|
-
type: ObjectConstructor;
|
|
34
|
-
required: true;
|
|
35
|
-
};
|
|
36
|
-
isAdmin: {
|
|
37
|
-
type: BooleanConstructor;
|
|
38
|
-
required: true;
|
|
39
|
-
};
|
|
40
|
-
brandPageType: {
|
|
41
|
-
type: StringConstructor;
|
|
42
|
-
required: true;
|
|
43
|
-
default: "brandSite";
|
|
44
|
-
};
|
|
45
|
-
}>, {}, {
|
|
46
|
-
changeDebounce: DebounceHandle | undefined;
|
|
47
|
-
options: (TextMediaItem | TextShapeItem)[];
|
|
48
|
-
maxLengthError: any;
|
|
49
|
-
invalidUrlError: any;
|
|
50
|
-
titleLength: number;
|
|
51
|
-
urlError: {};
|
|
52
|
-
mediaType: undefined;
|
|
53
|
-
descriptionLength: number;
|
|
54
|
-
schema: string;
|
|
55
|
-
maxItemsLength: number;
|
|
56
|
-
}, {
|
|
57
|
-
items(): any;
|
|
58
|
-
}, {
|
|
59
|
-
setMaxLayoutLength(value: number): void;
|
|
60
|
-
onItemsDelete(index: number): void;
|
|
61
|
-
onAddNewItem(): void;
|
|
62
|
-
addOption(): void;
|
|
63
|
-
emitChange(): void;
|
|
64
|
-
onItemsChange(items: TextMediaItem[]): void;
|
|
65
|
-
onReplaceImage(index: number, imageUrl: string): void;
|
|
66
|
-
onRemoveImage(index: number): void;
|
|
67
|
-
onColorReplacementsChange(payload: UpdateItemValuePayload<ColorReplacement[]>, index: number): void;
|
|
68
|
-
onValueChange(value: string, index: number): void;
|
|
69
|
-
checkUrl(index: number): any;
|
|
70
|
-
onTextAreaTextChange(payload: {
|
|
71
|
-
id: string;
|
|
72
|
-
name: string;
|
|
73
|
-
value: string;
|
|
74
|
-
}, index: number): void;
|
|
75
|
-
onPersonalisationOverrideChange(payload: {
|
|
76
|
-
id: string;
|
|
77
|
-
name: string;
|
|
78
|
-
value: string;
|
|
79
|
-
}, index: number): void;
|
|
80
|
-
}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:modelValue" | "on-intent-image-replace")[], "update:modelValue" | "on-intent-image-replace", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
81
|
-
id: {
|
|
82
|
-
type: StringConstructor;
|
|
83
|
-
required: true;
|
|
84
|
-
};
|
|
85
|
-
name: {
|
|
86
|
-
type: StringConstructor;
|
|
87
|
-
required: true;
|
|
88
|
-
};
|
|
89
|
-
content: {
|
|
90
|
-
type: PropType<Content>;
|
|
91
|
-
required: true;
|
|
92
|
-
};
|
|
93
|
-
value: {
|
|
94
|
-
type: PropType<TextMediaItem[]>;
|
|
95
|
-
required: true;
|
|
96
|
-
};
|
|
97
|
-
maxLength: {
|
|
98
|
-
type: NumberConstructor;
|
|
99
|
-
required: false;
|
|
100
|
-
default: undefined;
|
|
101
|
-
};
|
|
102
|
-
logoTheme: {
|
|
103
|
-
type: PropType<LogoTheme>;
|
|
104
|
-
required: true;
|
|
105
|
-
};
|
|
106
|
-
settings: {
|
|
107
|
-
type: ObjectConstructor;
|
|
108
|
-
required: true;
|
|
109
|
-
};
|
|
110
|
-
isAdmin: {
|
|
111
|
-
type: BooleanConstructor;
|
|
112
|
-
required: true;
|
|
113
|
-
};
|
|
114
|
-
brandPageType: {
|
|
115
|
-
type: StringConstructor;
|
|
116
|
-
required: true;
|
|
117
|
-
default: "brandSite";
|
|
118
|
-
};
|
|
119
|
-
}>> & Readonly<{
|
|
120
|
-
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
121
|
-
"onOn-intent-image-replace"?: ((...args: any[]) => any) | undefined;
|
|
122
|
-
}>, {
|
|
123
|
-
maxLength: number;
|
|
124
|
-
brandPageType: string;
|
|
125
|
-
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
126
|
-
export default _default;
|
|
@@ -1,192 +0,0 @@
|
|
|
1
|
-
import { defineComponent } from 'vue';
|
|
2
|
-
import { MAX_DESCRIPTION_LENGTH, MAX_LENGTH_ERROR_MESSAGE, MAX_TITLE_LENGTH, INVALID_URL_MESSAGE, BRAND_PAGE_TYPES, ALIGN_LEFT_ALIGNED, ALIGN_RIGHT_ALIGNED, CONTENT_TYPES, MAX_IMAGES_SECTION_ALIGNMENT_ITEMS_LENGTH, } from '../../../../brand-page';
|
|
3
|
-
import debounce from 'lodash.debounce';
|
|
4
|
-
import cloneDeep from 'lodash.clonedeep';
|
|
5
|
-
import { isURL } from '../../../../utils/validator.util';
|
|
6
|
-
const DEBOUNCE_IN_MS = 250;
|
|
7
|
-
export default defineComponent({
|
|
8
|
-
props: {
|
|
9
|
-
id: {
|
|
10
|
-
type: String,
|
|
11
|
-
required: true,
|
|
12
|
-
},
|
|
13
|
-
name: {
|
|
14
|
-
type: String,
|
|
15
|
-
required: true,
|
|
16
|
-
},
|
|
17
|
-
content: {
|
|
18
|
-
type: Object,
|
|
19
|
-
required: true,
|
|
20
|
-
},
|
|
21
|
-
value: {
|
|
22
|
-
type: Array,
|
|
23
|
-
required: true,
|
|
24
|
-
},
|
|
25
|
-
maxLength: {
|
|
26
|
-
type: Number,
|
|
27
|
-
required: false,
|
|
28
|
-
default: undefined,
|
|
29
|
-
},
|
|
30
|
-
logoTheme: {
|
|
31
|
-
type: Object,
|
|
32
|
-
required: true,
|
|
33
|
-
},
|
|
34
|
-
settings: {
|
|
35
|
-
type: Object,
|
|
36
|
-
required: true,
|
|
37
|
-
},
|
|
38
|
-
isAdmin: {
|
|
39
|
-
type: Boolean,
|
|
40
|
-
required: true,
|
|
41
|
-
},
|
|
42
|
-
brandPageType: {
|
|
43
|
-
type: String,
|
|
44
|
-
required: true,
|
|
45
|
-
default: BRAND_PAGE_TYPES.brandSite,
|
|
46
|
-
},
|
|
47
|
-
},
|
|
48
|
-
emits: ['update:modelValue', 'on-intent-image-replace'],
|
|
49
|
-
data: () => ({
|
|
50
|
-
changeDebounce: undefined,
|
|
51
|
-
options: [],
|
|
52
|
-
maxLengthError: MAX_LENGTH_ERROR_MESSAGE(),
|
|
53
|
-
invalidUrlError: INVALID_URL_MESSAGE(),
|
|
54
|
-
titleLength: MAX_TITLE_LENGTH,
|
|
55
|
-
urlError: {},
|
|
56
|
-
mediaType: undefined,
|
|
57
|
-
descriptionLength: MAX_DESCRIPTION_LENGTH,
|
|
58
|
-
schema: 'https',
|
|
59
|
-
maxItemsLength: 0,
|
|
60
|
-
}),
|
|
61
|
-
watch: {
|
|
62
|
-
options: {
|
|
63
|
-
handler() {
|
|
64
|
-
if (this.changeDebounce) {
|
|
65
|
-
this.changeDebounce();
|
|
66
|
-
}
|
|
67
|
-
},
|
|
68
|
-
deep: true,
|
|
69
|
-
},
|
|
70
|
-
},
|
|
71
|
-
created() {
|
|
72
|
-
this.options = cloneDeep(this.value);
|
|
73
|
-
this.mediaType = this.settings.replaceImageSettings.mediaType;
|
|
74
|
-
this.options = this.options.map((o) => ({
|
|
75
|
-
...o,
|
|
76
|
-
mediaType: this.mediaType,
|
|
77
|
-
imageLink: o.imageLink || '',
|
|
78
|
-
}));
|
|
79
|
-
if (!this.changeDebounce) {
|
|
80
|
-
this.changeDebounce = debounce(this.emitChange, DEBOUNCE_IN_MS);
|
|
81
|
-
}
|
|
82
|
-
},
|
|
83
|
-
computed: {
|
|
84
|
-
items() {
|
|
85
|
-
if (this.maxLength &&
|
|
86
|
-
this.maxLength > 2 &&
|
|
87
|
-
this.content.type === CONTENT_TYPES['images-section']) {
|
|
88
|
-
const imagesSectionContent = this.content;
|
|
89
|
-
if ([ALIGN_LEFT_ALIGNED, ALIGN_RIGHT_ALIGNED].some((s) => imagesSectionContent.displayStyle === s)) {
|
|
90
|
-
this.setMaxLayoutLength(MAX_IMAGES_SECTION_ALIGNMENT_ITEMS_LENGTH);
|
|
91
|
-
return this.value.length > 3
|
|
92
|
-
? this.value.slice(0, MAX_IMAGES_SECTION_ALIGNMENT_ITEMS_LENGTH)
|
|
93
|
-
: this.value;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
if (this.maxLength) {
|
|
97
|
-
this.setMaxLayoutLength(this.maxLength);
|
|
98
|
-
}
|
|
99
|
-
return this.value;
|
|
100
|
-
},
|
|
101
|
-
},
|
|
102
|
-
methods: {
|
|
103
|
-
setMaxLayoutLength(value) {
|
|
104
|
-
this.maxItemsLength = value;
|
|
105
|
-
},
|
|
106
|
-
onItemsDelete(index) {
|
|
107
|
-
this.options = this.options.filter((_o, i) => i !== index);
|
|
108
|
-
if (this.changeDebounce) {
|
|
109
|
-
this.changeDebounce();
|
|
110
|
-
}
|
|
111
|
-
const payload = {
|
|
112
|
-
id: this.id,
|
|
113
|
-
name: this.name,
|
|
114
|
-
value: cloneDeep(this.options),
|
|
115
|
-
};
|
|
116
|
-
this.$emit('update:modelValue', payload);
|
|
117
|
-
},
|
|
118
|
-
onAddNewItem() {
|
|
119
|
-
this.addOption();
|
|
120
|
-
},
|
|
121
|
-
addOption() {
|
|
122
|
-
this.options.push({
|
|
123
|
-
paragraph: '',
|
|
124
|
-
title: '',
|
|
125
|
-
imageUrl: '',
|
|
126
|
-
imageTitle: '',
|
|
127
|
-
height: -1,
|
|
128
|
-
width: -1,
|
|
129
|
-
mediaType: this.mediaType,
|
|
130
|
-
imageLink: '',
|
|
131
|
-
itemsId: -1,
|
|
132
|
-
});
|
|
133
|
-
if (this.changeDebounce) {
|
|
134
|
-
this.changeDebounce();
|
|
135
|
-
}
|
|
136
|
-
},
|
|
137
|
-
emitChange() {
|
|
138
|
-
const payload = {
|
|
139
|
-
id: this.id,
|
|
140
|
-
name: this.name,
|
|
141
|
-
value: this.options,
|
|
142
|
-
};
|
|
143
|
-
this.$emit('update:modelValue', payload);
|
|
144
|
-
},
|
|
145
|
-
onItemsChange(items) {
|
|
146
|
-
this.options = items;
|
|
147
|
-
if (this.changeDebounce) {
|
|
148
|
-
this.changeDebounce();
|
|
149
|
-
}
|
|
150
|
-
const payload = {
|
|
151
|
-
id: this.id,
|
|
152
|
-
name: this.name,
|
|
153
|
-
value: cloneDeep(items),
|
|
154
|
-
};
|
|
155
|
-
this.$emit('update:modelValue', payload);
|
|
156
|
-
},
|
|
157
|
-
onReplaceImage(index, imageUrl) {
|
|
158
|
-
this.$emit('on-intent-image-replace', {
|
|
159
|
-
id: this.id,
|
|
160
|
-
name: this.name,
|
|
161
|
-
index,
|
|
162
|
-
value: imageUrl,
|
|
163
|
-
});
|
|
164
|
-
},
|
|
165
|
-
onRemoveImage(index) {
|
|
166
|
-
this.options[index].imageUrl = '';
|
|
167
|
-
this.options[index].colorReplacements =
|
|
168
|
-
[];
|
|
169
|
-
this.emitChange();
|
|
170
|
-
},
|
|
171
|
-
onColorReplacementsChange(payload, index) {
|
|
172
|
-
this.options[index].colorReplacements = payload.value;
|
|
173
|
-
this.emitChange();
|
|
174
|
-
},
|
|
175
|
-
onValueChange(value, index) {
|
|
176
|
-
if (!value.includes(this.schema)) {
|
|
177
|
-
this.options[index].imageLink = `${this.schema}://${value}`;
|
|
178
|
-
}
|
|
179
|
-
this.urlError[index] = isURL(value);
|
|
180
|
-
},
|
|
181
|
-
checkUrl(index) {
|
|
182
|
-
return this.urlError[index] !== undefined ? this.urlError[index] : true;
|
|
183
|
-
},
|
|
184
|
-
onTextAreaTextChange(payload, index) {
|
|
185
|
-
this.options[index].paragraph = payload.value;
|
|
186
|
-
},
|
|
187
|
-
onPersonalisationOverrideChange(payload, index) {
|
|
188
|
-
this.options[index][payload.name] = payload.value;
|
|
189
|
-
this.emitChange();
|
|
190
|
-
},
|
|
191
|
-
},
|
|
192
|
-
});
|
|
@@ -1,183 +0,0 @@
|
|
|
1
|
-
import { defineComponent } from 'vue';
|
|
2
|
-
import type { PropType } from 'vue';
|
|
3
|
-
import ComponentCommonMixin from '../mixins/component-common.mixin';
|
|
4
|
-
import type {
|
|
5
|
-
ImageViewModel,
|
|
6
|
-
TextImageSectionViewModel,
|
|
7
|
-
} from '../../view-models';
|
|
8
|
-
import type { BrandPageContext, ImageItem, TextMediaItem } from '../../models';
|
|
9
|
-
import { ASPECT_RATIOS } from '../../models';
|
|
10
|
-
import { ALIGN_CENTERED, MEDIA_ONLY } from '../../constants';
|
|
11
|
-
import {
|
|
12
|
-
getImageAltText,
|
|
13
|
-
getImagesSectionAspectRatioByDisplayStyle,
|
|
14
|
-
} from '../../utils';
|
|
15
|
-
import isURL from 'validator/lib/isURL';
|
|
16
|
-
|
|
17
|
-
const DEFAULT_CENTERED_ASPECT_RATIO = '2/1';
|
|
18
|
-
|
|
19
|
-
export default defineComponent({
|
|
20
|
-
mixins: [ComponentCommonMixin],
|
|
21
|
-
props: {
|
|
22
|
-
viewModel: {
|
|
23
|
-
type: Object as PropType<TextImageSectionViewModel>,
|
|
24
|
-
required: true,
|
|
25
|
-
},
|
|
26
|
-
context: {
|
|
27
|
-
type: Object as PropType<BrandPageContext>,
|
|
28
|
-
required: true,
|
|
29
|
-
},
|
|
30
|
-
contentIndex: {
|
|
31
|
-
type: Number,
|
|
32
|
-
required: false,
|
|
33
|
-
default: undefined,
|
|
34
|
-
},
|
|
35
|
-
},
|
|
36
|
-
data() {
|
|
37
|
-
return {
|
|
38
|
-
imageModalSelectedImageIndex: undefined as number | undefined,
|
|
39
|
-
imagesBroken: {},
|
|
40
|
-
height: 0,
|
|
41
|
-
width: 0,
|
|
42
|
-
};
|
|
43
|
-
},
|
|
44
|
-
watch: {
|
|
45
|
-
viewModel: {
|
|
46
|
-
handler(newVal, oldVal) {
|
|
47
|
-
if (newVal.items !== oldVal.items) {
|
|
48
|
-
this.resetImageBrokenList();
|
|
49
|
-
}
|
|
50
|
-
},
|
|
51
|
-
deep: true,
|
|
52
|
-
},
|
|
53
|
-
},
|
|
54
|
-
computed: {
|
|
55
|
-
textAlignClass() {
|
|
56
|
-
return this.viewModel.displayStyle === ALIGN_CENTERED
|
|
57
|
-
? 'tw-items-center'
|
|
58
|
-
: 'tw-items-start';
|
|
59
|
-
},
|
|
60
|
-
|
|
61
|
-
imgStyles(): BrandPageCssStyle {
|
|
62
|
-
return getImagesSectionAspectRatioByDisplayStyle(
|
|
63
|
-
this.viewModel.items.length,
|
|
64
|
-
this.viewModel.displayStyle,
|
|
65
|
-
this.viewModel.aspectRatio,
|
|
66
|
-
);
|
|
67
|
-
},
|
|
68
|
-
|
|
69
|
-
placeHolderStyles(): BrandPageCssStyle {
|
|
70
|
-
const aspectRatio = ASPECT_RATIOS[this.viewModel.aspectRatio];
|
|
71
|
-
|
|
72
|
-
if (aspectRatio) {
|
|
73
|
-
if (this.viewModel.aspectRatio === 'circle') {
|
|
74
|
-
return {
|
|
75
|
-
aspectRatio: '1/1',
|
|
76
|
-
borderRadius: aspectRatio,
|
|
77
|
-
overflow: 'hidden',
|
|
78
|
-
};
|
|
79
|
-
} else {
|
|
80
|
-
return {
|
|
81
|
-
aspectRatio: aspectRatio,
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
} else {
|
|
85
|
-
return {
|
|
86
|
-
aspectRatio: DEFAULT_CENTERED_ASPECT_RATIO,
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
|
-
},
|
|
90
|
-
|
|
91
|
-
images(): ImageItem[] {
|
|
92
|
-
return this.viewModel.items || [];
|
|
93
|
-
},
|
|
94
|
-
isPreview(): boolean {
|
|
95
|
-
return this.context.isPreview;
|
|
96
|
-
},
|
|
97
|
-
shouldLimitHeight(): boolean {
|
|
98
|
-
return (
|
|
99
|
-
this.viewModel.displayStyle === MEDIA_ONLY &&
|
|
100
|
-
this.viewModel.items.length === 1
|
|
101
|
-
);
|
|
102
|
-
},
|
|
103
|
-
|
|
104
|
-
shouldLimitHeightForPlaceHolder(): boolean {
|
|
105
|
-
return this.viewModel.items.length === 1;
|
|
106
|
-
},
|
|
107
|
-
|
|
108
|
-
hasAspectRatio(): boolean {
|
|
109
|
-
return ASPECT_RATIOS[this.viewModel.aspectRatio as string] !== '';
|
|
110
|
-
},
|
|
111
|
-
|
|
112
|
-
itemImageAltText(): (item: TextMediaItem) => string {
|
|
113
|
-
return (item) => getImageAltText(item, this.context);
|
|
114
|
-
},
|
|
115
|
-
|
|
116
|
-
imageViewModel(): ImageViewModel | undefined {
|
|
117
|
-
const image = this.images[0];
|
|
118
|
-
|
|
119
|
-
if (!image) {
|
|
120
|
-
return;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
return {
|
|
124
|
-
id: this.viewModel.id,
|
|
125
|
-
type: 'image',
|
|
126
|
-
role: 'image',
|
|
127
|
-
imageUrl: image.imageUrl,
|
|
128
|
-
imageTitle: image.imageTitle,
|
|
129
|
-
isFullWidth: this.viewModel.areImagesFullWidth,
|
|
130
|
-
aspectRatio: this.viewModel.aspectRatio,
|
|
131
|
-
height: image.height,
|
|
132
|
-
width: image.width,
|
|
133
|
-
};
|
|
134
|
-
},
|
|
135
|
-
|
|
136
|
-
shouldRenderImage(): boolean {
|
|
137
|
-
return (
|
|
138
|
-
this.context.isBrandPageOrIsBrandContact &&
|
|
139
|
-
this.images.length === 1 &&
|
|
140
|
-
this.viewModel.displayStyle === MEDIA_ONLY
|
|
141
|
-
);
|
|
142
|
-
},
|
|
143
|
-
|
|
144
|
-
hasBottomMargin(): boolean {
|
|
145
|
-
return this.context.isBrandPageOrIsBrandContact;
|
|
146
|
-
},
|
|
147
|
-
|
|
148
|
-
showDisplayImageInFullWidth(): boolean {
|
|
149
|
-
return this.images.length == 1 || !this.shouldLimitHeight;
|
|
150
|
-
},
|
|
151
|
-
},
|
|
152
|
-
methods: {
|
|
153
|
-
onSelectImage(item: ImageItem) {
|
|
154
|
-
if (item.imageLink && isURL(item.imageLink)) {
|
|
155
|
-
window.open(item.imageLink, '_blank');
|
|
156
|
-
} else {
|
|
157
|
-
const index = this.images.findIndex(
|
|
158
|
-
(i) => i.imageUrl === item.imageUrl,
|
|
159
|
-
);
|
|
160
|
-
|
|
161
|
-
this.imageModalSelectedImageIndex = index;
|
|
162
|
-
}
|
|
163
|
-
},
|
|
164
|
-
onImageModalClose() {
|
|
165
|
-
this.imageModalSelectedImageIndex = undefined;
|
|
166
|
-
},
|
|
167
|
-
onImageError(index: number) {
|
|
168
|
-
this.imagesBroken[index] = true;
|
|
169
|
-
},
|
|
170
|
-
hasImageError(index: number) {
|
|
171
|
-
return this.imagesBroken[index] || false;
|
|
172
|
-
},
|
|
173
|
-
resetImageBrokenList() {
|
|
174
|
-
this.imagesBroken = {};
|
|
175
|
-
},
|
|
176
|
-
showPlaceholder(item: TextMediaItem) {
|
|
177
|
-
return (
|
|
178
|
-
this.context.isPreview &&
|
|
179
|
-
(!item.imageUrl || this.hasImageError(item.itemsId))
|
|
180
|
-
);
|
|
181
|
-
},
|
|
182
|
-
},
|
|
183
|
-
});
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { defineComponent } from 'vue';
|
|
2
|
-
import type { PropType } from 'vue';
|
|
3
|
-
import ComponentCommonMixin from '../mixins/component-common.mixin';
|
|
4
|
-
import type { TextImageSectionViewModel } from '../../view-models';
|
|
5
|
-
import type { BrandPageContext } from '../../models';
|
|
6
|
-
|
|
7
|
-
export default defineComponent({
|
|
8
|
-
mixins: [ComponentCommonMixin],
|
|
9
|
-
props: {
|
|
10
|
-
viewModel: {
|
|
11
|
-
type: Object as PropType<TextImageSectionViewModel>,
|
|
12
|
-
required: true,
|
|
13
|
-
},
|
|
14
|
-
context: {
|
|
15
|
-
type: Object as PropType<BrandPageContext>,
|
|
16
|
-
required: true,
|
|
17
|
-
},
|
|
18
|
-
contentIndex: {
|
|
19
|
-
type: Number,
|
|
20
|
-
required: false,
|
|
21
|
-
default: undefined,
|
|
22
|
-
},
|
|
23
|
-
},
|
|
24
|
-
data() {
|
|
25
|
-
return {
|
|
26
|
-
imageModalSelectedImageIndex: undefined as number | undefined,
|
|
27
|
-
};
|
|
28
|
-
},
|
|
29
|
-
});
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
import { defineComponent } from 'vue';
|
|
2
|
-
import type { PropType } from 'vue';
|
|
3
|
-
import ComponentCommonMixin from '../mixins/component-common.mixin';
|
|
4
|
-
import type { TextImageSectionViewModel } from '../../view-models';
|
|
5
|
-
import type { BrandPageContext } from '../../models';
|
|
6
|
-
import {
|
|
7
|
-
ALIGN_CARD_CENTER_IMAGE,
|
|
8
|
-
ALIGN_CENTERED,
|
|
9
|
-
ALIGN_LEFT_ALIGNED,
|
|
10
|
-
ALIGN_RIGHT_ALIGNED,
|
|
11
|
-
ALTERNATE_IMAGE,
|
|
12
|
-
MEDIA_ONLY,
|
|
13
|
-
} from '../../constants';
|
|
14
|
-
import { isHexTransparent } from '../../utils/color.util';
|
|
15
|
-
import { escapeContentText, getRenderText } from '../../utils';
|
|
16
|
-
|
|
17
|
-
export default defineComponent({
|
|
18
|
-
mixins: [ComponentCommonMixin],
|
|
19
|
-
props: {
|
|
20
|
-
viewModel: {
|
|
21
|
-
type: Object as PropType<TextImageSectionViewModel /* | TextShapeSectionViewModel, | TextIllustrationViewModel */>,
|
|
22
|
-
required: true,
|
|
23
|
-
},
|
|
24
|
-
context: {
|
|
25
|
-
type: Object as PropType<BrandPageContext>,
|
|
26
|
-
required: true,
|
|
27
|
-
},
|
|
28
|
-
},
|
|
29
|
-
computed: {
|
|
30
|
-
items() {
|
|
31
|
-
return this.viewModel.items;
|
|
32
|
-
},
|
|
33
|
-
shouldDisplayText() {
|
|
34
|
-
return this.viewModel.displayStyle !== MEDIA_ONLY;
|
|
35
|
-
},
|
|
36
|
-
|
|
37
|
-
isFullWidth() {
|
|
38
|
-
return this.context.isBrandSite && this.viewModel.areImagesFullWidth;
|
|
39
|
-
},
|
|
40
|
-
|
|
41
|
-
hasTitle() {
|
|
42
|
-
const sanitizedTitle = escapeContentText(this.viewModel.title) || '';
|
|
43
|
-
|
|
44
|
-
return sanitizedTitle.length > 0;
|
|
45
|
-
},
|
|
46
|
-
|
|
47
|
-
hasDescription() {
|
|
48
|
-
const sanitizedDescription =
|
|
49
|
-
escapeContentText(this.viewModel.description) || '';
|
|
50
|
-
|
|
51
|
-
return sanitizedDescription.length > 0;
|
|
52
|
-
},
|
|
53
|
-
|
|
54
|
-
shouldHorizontalAlign() {
|
|
55
|
-
return (
|
|
56
|
-
this.viewModel.displayStyle === ALIGN_LEFT_ALIGNED ||
|
|
57
|
-
this.viewModel.displayStyle === ALIGN_RIGHT_ALIGNED
|
|
58
|
-
);
|
|
59
|
-
},
|
|
60
|
-
|
|
61
|
-
shouldCenterAlign() {
|
|
62
|
-
return (
|
|
63
|
-
this.viewModel.displayStyle === ALIGN_CENTERED ||
|
|
64
|
-
this.viewModel.displayStyle === MEDIA_ONLY ||
|
|
65
|
-
this.viewModel.displayStyle === ALIGN_CARD_CENTER_IMAGE
|
|
66
|
-
);
|
|
67
|
-
},
|
|
68
|
-
isCardCenteredAlign() {
|
|
69
|
-
return this.viewModel.displayStyle === ALIGN_CARD_CENTER_IMAGE;
|
|
70
|
-
},
|
|
71
|
-
isCardCenteredWithShapes() {
|
|
72
|
-
return (
|
|
73
|
-
this.isCardCenteredAlign &&
|
|
74
|
-
this.viewModel.role === 'shapes-section' &&
|
|
75
|
-
!this.context.isTemplate &&
|
|
76
|
-
!this.context.isBrandSite
|
|
77
|
-
);
|
|
78
|
-
},
|
|
79
|
-
isAlternateRow() {
|
|
80
|
-
return this.viewModel.displayStyle === ALTERNATE_IMAGE;
|
|
81
|
-
},
|
|
82
|
-
|
|
83
|
-
hasBackground(): boolean {
|
|
84
|
-
if (!this.viewModel.backgroundStyle.backgroundColor) {
|
|
85
|
-
return false;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
return !isHexTransparent(this.viewModel.backgroundStyle.backgroundColor);
|
|
89
|
-
},
|
|
90
|
-
|
|
91
|
-
hasNoPadding() {
|
|
92
|
-
if (this.context.isBrandPageOrIsBrandContact) {
|
|
93
|
-
return !this.hasBackground;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
return this.viewModel.areImagesFullWidth;
|
|
97
|
-
},
|
|
98
|
-
|
|
99
|
-
hasBrandSitePadding() {
|
|
100
|
-
return this.context.isBrandSite && !this.viewModel.areImagesFullWidth;
|
|
101
|
-
},
|
|
102
|
-
|
|
103
|
-
hasRoundedCorners() {
|
|
104
|
-
if (this.context.isBrandPageOrIsBrandContact) {
|
|
105
|
-
return !this.viewModel.areImagesFullWidth;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
return !this.hasNoPadding;
|
|
109
|
-
},
|
|
110
|
-
|
|
111
|
-
shouldDisplayOnFullWidth() {
|
|
112
|
-
return !this.context.isMobile;
|
|
113
|
-
},
|
|
114
|
-
},
|
|
115
|
-
methods: {
|
|
116
|
-
renderText(paragraph): string {
|
|
117
|
-
if (!paragraph) {
|
|
118
|
-
return '';
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
return getRenderText(paragraph);
|
|
122
|
-
},
|
|
123
|
-
},
|
|
124
|
-
});
|