@designcrowd/library.brand-page 5.16.1 → 5.16.2-background-1
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-9kxFnALO.js → CreatedOnBrandCrowd-de-de-DNU1Er-B.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-en-us-CWslFY7X.js → CreatedOnBrandCrowd-en-us-_rEZobcJ.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-es-es-BdD_K4aQ.js → CreatedOnBrandCrowd-es-es-Z8MVwPkv.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-fr-fr-Q3dPY1zl.js → CreatedOnBrandCrowd-fr-ca-DD-ahmng.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-fr-ca-Q3dPY1zl.js → CreatedOnBrandCrowd-fr-fr-DD-ahmng.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-pt-pt-BsFzAVhi.js → CreatedOnBrandCrowd-pt-br-IBuHKnVv.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-pt-br-BsFzAVhi.js → CreatedOnBrandCrowd-pt-pt-IBuHKnVv.js} +1 -1
- package/lib/src/{CreatedOnDcom-de-de-CX6_qrAv.js → CreatedOnDcom-de-de-3Og8TFZa.js} +1 -1
- package/lib/src/{CreatedOnDcom-en-us-P25UZVxL.js → CreatedOnDcom-en-us-C4Fb7TIR.js} +1 -1
- package/lib/src/{CreatedOnDcom-es-es-D-LD9NyM.js → CreatedOnDcom-es-es-DE5IMJv7.js} +1 -1
- package/lib/src/{CreatedOnDcom-fr-ca-Bmxjy1F4.js → CreatedOnDcom-fr-ca-Cz86k5KW.js} +1 -1
- package/lib/src/{CreatedOnDcom-fr-fr-zsdWYsNh.js → CreatedOnDcom-fr-fr-DdQ9z_Rb.js} +1 -1
- package/lib/src/{CreatedOnDcom-pt-br-DNO5fakC.js → CreatedOnDcom-pt-br-DItYjheI.js} +1 -1
- package/lib/src/{CreatedOnDcom-pt-pt-pCwx4bH9.js → CreatedOnDcom-pt-pt-C0YW3Q40.js} +1 -1
- package/lib/src/brand-page/components/page/Page.mixin.js +20 -15
- package/lib/src/brand-page/components/page/Page.stories.js +2 -2
- package/lib/src/brand-page/models/index.d.ts +1 -0
- package/lib/src/brand-page/models/index.js +2 -0
- package/lib/src/brand-page/utils/view-model.util.d.ts +2 -1
- package/lib/src/brand-page/utils/view-model.util.js +27 -2
- package/lib/src/brand-page/view-models.d.ts +17 -2
- package/lib/src/brand-page-maker/components/admin-background-settings/AdminBackgroundSettings.mixin.d.ts +7 -2
- package/lib/src/brand-page-maker/components/preview/Preview.stories.js +2 -2
- package/lib/src/brand-page-maker/stores/video/video-store.js +1 -1
- package/lib/src/bundled-translations-DEk3SiLd.js +161 -0
- package/lib/src/bundles/bundled-translations.json +3 -1
- package/lib/src/css/library.brand-page-brandCrowd.min.css +24 -21
- package/lib/src/css/library.brand-page-brandPage.min.css +24 -21
- package/lib/src/css/library.brand-page-designCom.min.css +24 -21
- package/lib/src/css/library.brand-page-preview.min.css +24 -21
- package/lib/src/index.mjs +1 -1
- package/lib/src/{lib-BxoUR-Hp.js → lib-C_Vr2Dov.js} +13327 -13248
- package/lib/src/shared/background-settings/components/background-shapes/BackgroundShapeSettings.mixin.d.ts +7 -2
- package/lib/src/shared/background-settings/store/background-settings-store.d.ts +3 -0
- package/lib/src/shared/background-settings/store/background-settings-store.js +34 -2
- package/lib/src/shared/content-settings/components/image-field/ImageField.mixin.js +3 -1
- package/lib/src/shared/style-settings/components/StyleSettings.mixin.d.ts +2 -0
- package/package.json +1 -1
- package/src/brand-page/components/media/Shape.vue +1 -1
- package/src/brand-page/components/page/Page.mixin.ts +24 -15
- package/src/brand-page/components/page/Page.stories.ts +2 -1
- package/src/brand-page/components/page/Page.vue +17 -1
- package/src/brand-page/models/index.ts +3 -0
- package/src/brand-page/utils/__snapshots__/migration.util.test.ts.snap +3 -0
- package/src/brand-page/utils/__snapshots__/migration2.util.test.ts.snap +1 -0
- package/src/brand-page/utils/__snapshots__/model.util.test.ts.snap +2 -0
- package/src/brand-page/utils/view-model.util.ts +42 -2
- package/src/brand-page/view-models.ts +23 -1
- package/src/brand-page-maker/components/preview/Preview.stories.ts +2 -1
- package/src/brand-page-maker/stores/video/video-store.ts +1 -1
- package/src/bundles/bundled-translations.json +3 -1
- package/src/shared/background-settings/components/BackgroundSettings.vue +28 -8
- package/src/shared/background-settings/components/ReplaceImageSettingsForBackgroundSettings.vue +9 -0
- package/src/shared/background-settings/components/i18n/background-settings.json +3 -1
- package/src/shared/background-settings/store/background-settings-store.ts +51 -2
- package/src/shared/content-settings/components/image-field/ImageField.mixin.ts +4 -1
- package/src/shared/content-settings/components/replace-image-base-settings/ReplaceImageBaseSettings.vue +3 -0
- package/src/shared/video-library/VideoLibrary.vue +1 -1
- package/lib/src/bundled-translations-D9iHE5G9.js +0 -161
|
@@ -16,7 +16,6 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
16
16
|
aspectRatio?: string | undefined;
|
|
17
17
|
width?: string | undefined;
|
|
18
18
|
height?: string | undefined;
|
|
19
|
-
textAlign?: string | undefined;
|
|
20
19
|
backgroundAttachment?: string | undefined;
|
|
21
20
|
background?: string | undefined;
|
|
22
21
|
backgroundImage?: string | undefined;
|
|
@@ -48,6 +47,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
48
47
|
overflowWrap?: string | undefined;
|
|
49
48
|
paddingTop?: string | undefined;
|
|
50
49
|
position?: string | undefined;
|
|
50
|
+
textAlign?: string | undefined;
|
|
51
51
|
textDecoration?: string | undefined;
|
|
52
52
|
top?: string | undefined;
|
|
53
53
|
transform?: string | undefined;
|
|
@@ -60,7 +60,6 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
60
60
|
aspectRatio?: string | undefined;
|
|
61
61
|
width?: string | undefined;
|
|
62
62
|
height?: string | undefined;
|
|
63
|
-
textAlign?: string | undefined;
|
|
64
63
|
backgroundAttachment?: string | undefined;
|
|
65
64
|
background?: string | undefined;
|
|
66
65
|
backgroundImage?: string | undefined;
|
|
@@ -92,6 +91,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
92
91
|
overflowWrap?: string | undefined;
|
|
93
92
|
paddingTop?: string | undefined;
|
|
94
93
|
position?: string | undefined;
|
|
94
|
+
textAlign?: string | undefined;
|
|
95
95
|
textDecoration?: string | undefined;
|
|
96
96
|
top?: string | undefined;
|
|
97
97
|
transform?: string | undefined;
|
|
@@ -149,6 +149,9 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
149
149
|
};
|
|
150
150
|
}[];
|
|
151
151
|
personalisationRole?: "website" | "email" | "phone" | "profile" | "about" | "information" | "media" | undefined;
|
|
152
|
+
media?: {
|
|
153
|
+
type: import("../../../../brand-page").MediaTypes;
|
|
154
|
+
} | undefined;
|
|
152
155
|
}>;
|
|
153
156
|
userStore: import("pinia").Store<"brandPageMakerUser", import("../../../../brand-page-maker/stores").UserState, {}, {
|
|
154
157
|
setEmailAddress(payload: string): void;
|
|
@@ -194,6 +197,8 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
194
197
|
setBackgroundMode(payload: {
|
|
195
198
|
backgroundMode: "images" | "edit";
|
|
196
199
|
}): void;
|
|
200
|
+
setBackgroundMedia(payload: import("../../../my-uploads/models").MediaBaseSelectedPayload): void;
|
|
201
|
+
removeBackgroundVideo(): void;
|
|
197
202
|
}>;
|
|
198
203
|
}, {}, {
|
|
199
204
|
color(): string;
|
|
@@ -2,6 +2,7 @@ import type { BackgroundShape, BackgroundStyle, BackgroundStyles, Personalisatio
|
|
|
2
2
|
import { type BrandPageSettingsMode } from '../../../brand-page-maker/stores/brandpage-maker/brandpage-maker-store';
|
|
3
3
|
import type { SetBackgroundShapeSettingsPayload, SetLogoColorsPayload, SetRecommendedLogoColorsPayload } from '../background-settings-models';
|
|
4
4
|
import type { BackgroundSetStatePayload, BackgroundSettingsTabId } from '../models';
|
|
5
|
+
import type { MediaBaseSelectedPayload } from '../../my-uploads/models';
|
|
5
6
|
export interface BackgroundSettingsState {
|
|
6
7
|
backgroundStyles: BackgroundStyles;
|
|
7
8
|
logoColors: string[];
|
|
@@ -45,4 +46,6 @@ export declare const useUiBackgroundSettingsStore: import("pinia").StoreDefiniti
|
|
|
45
46
|
setBackgroundMode(payload: {
|
|
46
47
|
backgroundMode: BrandPageSettingsMode;
|
|
47
48
|
}): void;
|
|
49
|
+
setBackgroundMedia(payload: MediaBaseSelectedPayload): void;
|
|
50
|
+
removeBackgroundVideo(): void;
|
|
48
51
|
}>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { PageStyles } from '../../../brand-page';
|
|
1
|
+
import { GettyVideoMedia, PageStyles } from '../../../brand-page';
|
|
2
2
|
import { BRANDPAGE_SETTINGS_MODES, } from '../../../brand-page-maker/stores/brandpage-maker/brandpage-maker-store';
|
|
3
3
|
import { backgroundSettingsTabId } from '../models';
|
|
4
4
|
import { defineStore } from 'pinia';
|
|
5
|
-
import { useUiStore } from '../../../brand-page-maker/stores';
|
|
5
|
+
import { useUiStore, useVideoStore } from '../../../brand-page-maker/stores';
|
|
6
6
|
export const useUiBackgroundSettingsStore = defineStore('uiBackgroundSettings', {
|
|
7
7
|
state: () => ({
|
|
8
8
|
backgroundStyles: {
|
|
@@ -10,6 +10,7 @@ export const useUiBackgroundSettingsStore = defineStore('uiBackgroundSettings',
|
|
|
10
10
|
backgroundShapeStyle: {},
|
|
11
11
|
backgroundShapes: [],
|
|
12
12
|
backgroundImageUrl: '',
|
|
13
|
+
media: undefined,
|
|
13
14
|
},
|
|
14
15
|
logoColors: [],
|
|
15
16
|
recommendedLogoColors: [],
|
|
@@ -130,5 +131,36 @@ export const useUiBackgroundSettingsStore = defineStore('uiBackgroundSettings',
|
|
|
130
131
|
setBackgroundMode(payload) {
|
|
131
132
|
this.backgroundMode = payload.backgroundMode;
|
|
132
133
|
},
|
|
134
|
+
setBackgroundMedia(payload) {
|
|
135
|
+
console.log('Here in the background settings store', payload);
|
|
136
|
+
if (payload.type === 'getty-video') {
|
|
137
|
+
const gettyMedia = payload;
|
|
138
|
+
const videoStore = useVideoStore();
|
|
139
|
+
videoStore.setVideoUrlsWithToken(gettyMedia.token, gettyMedia.videoSrc, gettyMedia.imageSrc, gettyMedia.assetId);
|
|
140
|
+
this.backgroundStyles.media = new GettyVideoMedia({
|
|
141
|
+
gettyToken: gettyMedia.token,
|
|
142
|
+
gettyAssetId: gettyMedia.assetId,
|
|
143
|
+
mimeType: gettyMedia.mimeType,
|
|
144
|
+
settings: {
|
|
145
|
+
autoPlay: gettyMedia.autoPlay,
|
|
146
|
+
},
|
|
147
|
+
});
|
|
148
|
+
// Clear any existing background image/shape
|
|
149
|
+
this.backgroundStyles.backgroundImageUrl = '';
|
|
150
|
+
// Default background style for videos
|
|
151
|
+
this.setBackgroundStyle({
|
|
152
|
+
backgroundStyle: {
|
|
153
|
+
backgroundRepeat: 'no-repeat',
|
|
154
|
+
backgroundPosition: 'center center',
|
|
155
|
+
backgroundSize: 'cover',
|
|
156
|
+
},
|
|
157
|
+
});
|
|
158
|
+
this.onBackgroundChanged();
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
removeBackgroundVideo() {
|
|
162
|
+
this.backgroundStyles.media = undefined;
|
|
163
|
+
this.onBackgroundChanged();
|
|
164
|
+
},
|
|
133
165
|
},
|
|
134
166
|
});
|
|
@@ -850,6 +850,8 @@ declare const _default: import("vue").DefineComponent<{}, {
|
|
|
850
850
|
setBackgroundMode(payload: {
|
|
851
851
|
backgroundMode: "images" | "edit";
|
|
852
852
|
}): void;
|
|
853
|
+
setBackgroundMedia(payload: import("../../my-uploads/models").MediaBaseSelectedPayload): void;
|
|
854
|
+
removeBackgroundVideo(): void;
|
|
853
855
|
}>;
|
|
854
856
|
eventTracker: {
|
|
855
857
|
sendExperimentStartedEvent: (abTestKey: string, abTestValue: string) => void;
|
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
>
|
|
7
7
|
<object :style="objectStyle" :data="objectUrl" />
|
|
8
8
|
<!-- Div overlay over object element so that clicks are registered on current dom rather than iframe in side object -->
|
|
9
|
-
<div :style="objectStyle" class="tw-absolute" />
|
|
9
|
+
<div :style="objectStyle" class="tw-absolute tw-pointer-events-none" />
|
|
10
10
|
</div>
|
|
11
11
|
</div>
|
|
12
12
|
</template>
|
|
@@ -99,16 +99,21 @@ export default defineComponent({
|
|
|
99
99
|
|
|
100
100
|
backgroundShapes(): BackgroundShape[] {
|
|
101
101
|
const backgroundShapes: BackgroundShape[] = [
|
|
102
|
-
...(this.viewModel?.styles?.
|
|
102
|
+
...(this.viewModel?.styles?.backgroundStylesViewModel
|
|
103
|
+
?.backgroundShapes || []),
|
|
103
104
|
];
|
|
104
105
|
|
|
105
106
|
// TODO: create style viewmodel object to include backgroundImageContent attribute only on viewmodel
|
|
106
107
|
// p.s backgroundImageUrl can be url or SVG content string
|
|
107
|
-
if (
|
|
108
|
+
if (
|
|
109
|
+
this.viewModel.styles?.backgroundStylesViewModel?.backgroundImageUrl
|
|
110
|
+
) {
|
|
108
111
|
backgroundShapes.splice(0, 0, {
|
|
109
|
-
name: this.viewModel.styles.
|
|
112
|
+
name: this.viewModel.styles.backgroundStylesViewModel
|
|
113
|
+
.backgroundImageUrl,
|
|
110
114
|
style: {
|
|
111
|
-
...this.viewModel.styles.
|
|
115
|
+
...this.viewModel.styles.backgroundStylesViewModel
|
|
116
|
+
.backgroundShapeStyle,
|
|
112
117
|
width: `100%`,
|
|
113
118
|
height: `100%`,
|
|
114
119
|
},
|
|
@@ -122,11 +127,12 @@ export default defineComponent({
|
|
|
122
127
|
let styles: BrandPageCssStyle = {};
|
|
123
128
|
|
|
124
129
|
if (
|
|
125
|
-
!this.viewModel?.styles?.
|
|
126
|
-
|
|
130
|
+
!this.viewModel?.styles?.backgroundStylesViewModel
|
|
131
|
+
?.backgroundImageUrl &&
|
|
132
|
+
this.viewModel?.styles?.backgroundStylesViewModel?.style
|
|
127
133
|
) {
|
|
128
134
|
styles = {
|
|
129
|
-
...this.viewModel?.styles?.
|
|
135
|
+
...this.viewModel?.styles?.backgroundStylesViewModel?.style,
|
|
130
136
|
};
|
|
131
137
|
}
|
|
132
138
|
|
|
@@ -149,38 +155,41 @@ export default defineComponent({
|
|
|
149
155
|
},
|
|
150
156
|
|
|
151
157
|
rootBackgroundStyles(): BrandPageCssStyle {
|
|
158
|
+
console.log('vm styles ', this.viewModel.styles);
|
|
152
159
|
const styles: BrandPageCssStyle = {
|
|
153
|
-
...(this.viewModel?.styles?.
|
|
160
|
+
...(this.viewModel?.styles?.backgroundStylesViewModel?.style || {}),
|
|
154
161
|
};
|
|
155
162
|
|
|
156
163
|
delete styles.backgroundAttachment;
|
|
157
164
|
|
|
158
165
|
if (
|
|
159
|
-
this.viewModel.styles?.
|
|
160
|
-
(this.viewModel.styles.
|
|
166
|
+
this.viewModel.styles?.backgroundStylesViewModel?.backgroundImageUrl &&
|
|
167
|
+
(this.viewModel.styles.backgroundStylesViewModel.backgroundImageUrl.endsWith(
|
|
161
168
|
`.svg`,
|
|
162
169
|
) ||
|
|
163
|
-
!this.viewModel.styles?.
|
|
170
|
+
!this.viewModel.styles?.backgroundStylesViewModel?.backgroundImageUrl.startsWith(
|
|
164
171
|
'http',
|
|
165
172
|
))
|
|
166
173
|
) {
|
|
167
174
|
// Any backgroundImageUrl that handles svg file, svg markup is handled as BackgroundShape object
|
|
168
175
|
delete styles.backgroundImage;
|
|
169
|
-
} else if (
|
|
176
|
+
} else if (
|
|
177
|
+
this.viewModel?.styles?.backgroundStylesViewModel?.backgroundImageUrl
|
|
178
|
+
) {
|
|
170
179
|
// if background is a gradient
|
|
171
180
|
if (
|
|
172
|
-
this.viewModel?.styles?.
|
|
181
|
+
this.viewModel?.styles?.backgroundStylesViewModel?.style?.background?.startsWith(
|
|
173
182
|
'linear-gradient',
|
|
174
183
|
)
|
|
175
184
|
) {
|
|
176
185
|
// combine image and gradient into the `background` property
|
|
177
|
-
styles.backgroundImage = `url(${this.viewModel?.styles?.
|
|
186
|
+
styles.backgroundImage = `url(${this.viewModel?.styles?.backgroundStylesViewModel?.backgroundImageUrl}), ${this.viewModel?.styles?.backgroundStylesViewModel?.style?.background}`;
|
|
178
187
|
|
|
179
188
|
delete styles.background;
|
|
180
189
|
} else {
|
|
181
190
|
// background is a solid color
|
|
182
191
|
styles.backgroundColor = styles.background;
|
|
183
|
-
styles.backgroundImage = `url(${this.viewModel?.styles?.
|
|
192
|
+
styles.backgroundImage = `url(${this.viewModel?.styles?.backgroundStylesViewModel?.backgroundImageUrl})`;
|
|
184
193
|
|
|
185
194
|
delete styles.background;
|
|
186
195
|
}
|
|
@@ -4,6 +4,7 @@ import type { ContentViewModel, BrandPageViewModel } from '../../view-models';
|
|
|
4
4
|
import {
|
|
5
5
|
mapToPageFooterViewModel,
|
|
6
6
|
mapToPageHeaderViewModel,
|
|
7
|
+
mapToPageStyleViewModel,
|
|
7
8
|
mapToViewModel,
|
|
8
9
|
} from '../../utils';
|
|
9
10
|
import {
|
|
@@ -41,7 +42,7 @@ const pages = brandPageModel.pages.map((p) => ({
|
|
|
41
42
|
|
|
42
43
|
const viewModel: BrandPageViewModel = {
|
|
43
44
|
showBrandCrowdLogo: true,
|
|
44
|
-
styles: brandPageModel.styles,
|
|
45
|
+
styles: mapToPageStyleViewModel(brandPageModel.styles, {}),
|
|
45
46
|
headerViewModelDesktop: mapToPageHeaderViewModel(
|
|
46
47
|
brandPageModel.pageHeaderDesktop,
|
|
47
48
|
brandPageModel.styles,
|
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div
|
|
2
|
+
<div
|
|
3
|
+
class="brand-page-root-background"
|
|
4
|
+
:style="rootbackgroundStylesViewModel"
|
|
5
|
+
/>
|
|
6
|
+
{{ console.log('This is the styles: ', viewModel) }}
|
|
7
|
+
<Media
|
|
8
|
+
v-if="viewModel.styles?.backgroundStylesViewModel?.mediaViewModel"
|
|
9
|
+
:media="viewModel.styles.backgroundStylesViewModel.mediaViewModel"
|
|
10
|
+
:context="context"
|
|
11
|
+
:img-classes="{
|
|
12
|
+
'tw-w-full tw-h-full tw-object-cover tw-fixed tw-left-0 tw-top-0 tw-z-0': true,
|
|
13
|
+
}"
|
|
14
|
+
:media-type="viewModel.styles.backgroundStylesViewModel.mediaViewModel.type"
|
|
15
|
+
content-index="0"
|
|
16
|
+
/>
|
|
3
17
|
<div
|
|
4
18
|
class="brand-page-root"
|
|
5
19
|
:style="rootElementStyles"
|
|
@@ -266,6 +280,7 @@ import PageFooter from '../page-footer/PageFooter.vue';
|
|
|
266
280
|
import NavigationSideMenu from '../navigation/navigation-side-menu/NavigationSideMenu.vue';
|
|
267
281
|
import BrandSiteNavigationLayout from './BrandSiteNavigationLayout.vue';
|
|
268
282
|
import MediaQuery from '../media-query';
|
|
283
|
+
import Media from '../media/Media.vue';
|
|
269
284
|
|
|
270
285
|
export default {
|
|
271
286
|
components: {
|
|
@@ -278,6 +293,7 @@ export default {
|
|
|
278
293
|
PageHeader,
|
|
279
294
|
PageFooter,
|
|
280
295
|
BrandSiteNavigationLayout,
|
|
296
|
+
Media,
|
|
281
297
|
},
|
|
282
298
|
mixins: [PageMixin],
|
|
283
299
|
setup(props) {
|
|
@@ -29,6 +29,7 @@ import { EMPTY_LOGO_IMAGE_MODEL, LogoStyles } from './logo.model';
|
|
|
29
29
|
import type { LogoImageModel, LogoTemplateImageModel } from './logo.model';
|
|
30
30
|
import cloneDeep from 'lodash.clonedeep';
|
|
31
31
|
import type { BrandPagePaymentConfig } from './payment.model';
|
|
32
|
+
import type { MediaViewModel } from '../view-models';
|
|
32
33
|
|
|
33
34
|
export * from './brand-page-context.model';
|
|
34
35
|
export * from './payment.model';
|
|
@@ -83,6 +84,7 @@ export class BackgroundStyles {
|
|
|
83
84
|
public backgroundImageUrl: string;
|
|
84
85
|
public backgroundShapes: BackgroundShape[];
|
|
85
86
|
public personalisationRole?: PersonalisationRole;
|
|
87
|
+
public media?: AbstractMedia;
|
|
86
88
|
|
|
87
89
|
constructor(option: Partial<BackgroundStyles> = {}) {
|
|
88
90
|
this.backgroundImageUrl = option.backgroundImageUrl || '';
|
|
@@ -96,6 +98,7 @@ export class BackgroundStyles {
|
|
|
96
98
|
background: '',
|
|
97
99
|
};
|
|
98
100
|
this.personalisationRole = option.personalisationRole;
|
|
101
|
+
this.media = option.media || undefined;
|
|
99
102
|
}
|
|
100
103
|
}
|
|
101
104
|
|
|
@@ -327,6 +327,7 @@ exports[`migration.util > Banner Contents - text Align and Font Family should no
|
|
|
327
327
|
"background": "",
|
|
328
328
|
},
|
|
329
329
|
"backgroundShapes": [],
|
|
330
|
+
"media": undefined,
|
|
330
331
|
"personalisationRole": undefined,
|
|
331
332
|
"style": {
|
|
332
333
|
"background": "logo-background-color",
|
|
@@ -744,6 +745,7 @@ exports[`migration.util > migrateBrandPageModel should return brand page model w
|
|
|
744
745
|
"background": "",
|
|
745
746
|
},
|
|
746
747
|
"backgroundShapes": [],
|
|
748
|
+
"media": undefined,
|
|
747
749
|
"personalisationRole": undefined,
|
|
748
750
|
"style": {
|
|
749
751
|
"background": "logo-background-color",
|
|
@@ -1168,6 +1170,7 @@ exports[`migration.util > migrateBrandPageModel should return brand page model w
|
|
|
1168
1170
|
"background": "",
|
|
1169
1171
|
},
|
|
1170
1172
|
"backgroundShapes": [],
|
|
1173
|
+
"media": undefined,
|
|
1171
1174
|
"personalisationRole": undefined,
|
|
1172
1175
|
"style": {
|
|
1173
1176
|
"background": "logo-background-color",
|
|
@@ -365,6 +365,7 @@ exports[`migration02.ts > migration02 should return converted letterspacing 1`]
|
|
|
365
365
|
"background": "",
|
|
366
366
|
},
|
|
367
367
|
"backgroundShapes": [],
|
|
368
|
+
"media": undefined,
|
|
368
369
|
"personalisationRole": undefined,
|
|
369
370
|
"style": {
|
|
370
371
|
"background": "logo-background-color",
|
|
@@ -339,6 +339,7 @@ BrandPageModel {
|
|
|
339
339
|
"background": "",
|
|
340
340
|
},
|
|
341
341
|
"backgroundShapes": [],
|
|
342
|
+
"media": undefined,
|
|
342
343
|
"personalisationRole": undefined,
|
|
343
344
|
"style": {
|
|
344
345
|
"background": "#0000ff",
|
|
@@ -795,6 +796,7 @@ BrandPageModel {
|
|
|
795
796
|
"background": "",
|
|
796
797
|
},
|
|
797
798
|
"backgroundShapes": [],
|
|
799
|
+
"media": undefined,
|
|
798
800
|
"personalisationRole": undefined,
|
|
799
801
|
"style": {
|
|
800
802
|
"background": "#0000ff",
|
|
@@ -40,6 +40,7 @@ import type {
|
|
|
40
40
|
TextShapeItem,
|
|
41
41
|
GettyVideoMedia,
|
|
42
42
|
AbstractMedia,
|
|
43
|
+
BackgroundStyles,
|
|
43
44
|
} from '../models';
|
|
44
45
|
import { ButtonStyles, SENSITIVE_CONTENT_TYPES, VIEWPORTS } from '../models';
|
|
45
46
|
import {
|
|
@@ -78,6 +79,8 @@ import type {
|
|
|
78
79
|
ShopViewModel,
|
|
79
80
|
BookingSectionViewModel,
|
|
80
81
|
GettyVideoViewModel,
|
|
82
|
+
PageStylesViewModel,
|
|
83
|
+
BackgroundStylesViewModel,
|
|
81
84
|
} from '../view-models';
|
|
82
85
|
import { isHexTransparent, setRgbAlpha } from './color.util';
|
|
83
86
|
import type { ContentTextStylePropertyKey } from '../constants';
|
|
@@ -985,6 +988,22 @@ export const mapToBookingSectionViewModel = (
|
|
|
985
988
|
);
|
|
986
989
|
};
|
|
987
990
|
|
|
991
|
+
export const mapToPageStyleViewModel = (
|
|
992
|
+
pageStyles: PageStyles,
|
|
993
|
+
options: ViewModelMappingOptions,
|
|
994
|
+
): PageStylesViewModel => {
|
|
995
|
+
return {
|
|
996
|
+
backgroundStylesViewModel: mapBackgroundStylesToViewModel(
|
|
997
|
+
pageStyles.backgroundStyles,
|
|
998
|
+
options,
|
|
999
|
+
),
|
|
1000
|
+
buttonStyles: pageStyles.buttonStyles,
|
|
1001
|
+
logoStyles: pageStyles.logoStyles,
|
|
1002
|
+
textStyles: pageStyles.textStyles,
|
|
1003
|
+
galleryStyles: pageStyles.galleryStyles,
|
|
1004
|
+
};
|
|
1005
|
+
};
|
|
1006
|
+
|
|
988
1007
|
export const mapToPageHeaderViewModel = (
|
|
989
1008
|
pageHeader: PageHeaderDesktop | PageHeaderMobile,
|
|
990
1009
|
pageStyles: PageStyles,
|
|
@@ -1284,6 +1303,26 @@ interface ViewModelMappingOptions {
|
|
|
1284
1303
|
) => void;
|
|
1285
1304
|
}
|
|
1286
1305
|
|
|
1306
|
+
const mapBackgroundStylesToViewModel = (
|
|
1307
|
+
backgroundStyles: BackgroundStyles,
|
|
1308
|
+
options: ViewModelMappingOptions,
|
|
1309
|
+
): BackgroundStylesViewModel => {
|
|
1310
|
+
// TODO(jyao): These need to be mapped to a view model eventually
|
|
1311
|
+
return {
|
|
1312
|
+
style: backgroundStyles.style,
|
|
1313
|
+
backgroundShapeStyle: backgroundStyles.backgroundShapeStyle,
|
|
1314
|
+
backgroundImageUrl: backgroundStyles.backgroundImageUrl,
|
|
1315
|
+
backgroundShapes: backgroundStyles.backgroundShapes,
|
|
1316
|
+
personalisationRole: backgroundStyles.personalisationRole,
|
|
1317
|
+
mediaViewModel: backgroundStyles.media
|
|
1318
|
+
? mapMediaToContentViewModel({
|
|
1319
|
+
media: backgroundStyles.media,
|
|
1320
|
+
options,
|
|
1321
|
+
})
|
|
1322
|
+
: undefined,
|
|
1323
|
+
};
|
|
1324
|
+
};
|
|
1325
|
+
|
|
1287
1326
|
export const getBrandPageViewModelFromBrandPageModel = (
|
|
1288
1327
|
model: BrandPageModel,
|
|
1289
1328
|
brandPageToken: string | undefined,
|
|
@@ -1313,7 +1352,7 @@ export const getBrandPageViewModelFromBrandPageModel = (
|
|
|
1313
1352
|
brandPageToken,
|
|
1314
1353
|
pages,
|
|
1315
1354
|
showBrandCrowdLogo,
|
|
1316
|
-
styles: model.styles,
|
|
1355
|
+
styles: mapToPageStyleViewModel(model.styles, options),
|
|
1317
1356
|
headerViewModelDesktop: mapToPageHeaderViewModel(
|
|
1318
1357
|
model.pageHeaderDesktop,
|
|
1319
1358
|
model.styles,
|
|
@@ -1460,7 +1499,8 @@ export const getCriticalResourceURLs = (
|
|
|
1460
1499
|
}
|
|
1461
1500
|
|
|
1462
1501
|
// shapes
|
|
1463
|
-
const bgShapeFullBg =
|
|
1502
|
+
const bgShapeFullBg =
|
|
1503
|
+
viewModel.styles?.backgroundStylesViewModel.backgroundImageUrl;
|
|
1464
1504
|
|
|
1465
1505
|
if (typeof bgShapeFullBg !== 'undefined' && isValidSvgUrl(bgShapeFullBg)) {
|
|
1466
1506
|
shapes.push(String(bgShapeFullBg));
|
|
@@ -39,6 +39,10 @@ import type {
|
|
|
39
39
|
SensitiveContent,
|
|
40
40
|
BookingSectionContent,
|
|
41
41
|
MediaTypes,
|
|
42
|
+
TextStyles,
|
|
43
|
+
BackgroundStyle,
|
|
44
|
+
BackgroundShape,
|
|
45
|
+
PersonalisationRole,
|
|
42
46
|
} from './models';
|
|
43
47
|
import type { ImagesSectionContentDisplayStyle } from './constants';
|
|
44
48
|
|
|
@@ -280,10 +284,28 @@ export interface PageFooterViewModel
|
|
|
280
284
|
logo: LogoViewModel;
|
|
281
285
|
}
|
|
282
286
|
|
|
287
|
+
export interface BackgroundStylesViewModel {
|
|
288
|
+
style: BackgroundStyle;
|
|
289
|
+
backgroundShapeStyle: BackgroundStyle;
|
|
290
|
+
backgroundImageUrl: string;
|
|
291
|
+
backgroundShapes: BackgroundShape[];
|
|
292
|
+
personalisationRole?: PersonalisationRole;
|
|
293
|
+
mediaViewModel?: MediaViewModel;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
// Note(jyao): View model for page styles, we will need to create new view model mapping for each style here in future
|
|
297
|
+
export interface PageStylesViewModel {
|
|
298
|
+
backgroundStylesViewModel: BackgroundStylesViewModel;
|
|
299
|
+
buttonStyles: ButtonStyles; // TODO(jyao): Convert to view model
|
|
300
|
+
logoStyles: LogoStyles; // TODO(jyao): Convert to view model
|
|
301
|
+
textStyles: TextStyles; // TODO(jyao): Convert to view model
|
|
302
|
+
galleryStyles: GalleryStyles; // TODO(jyao): Convert to view model
|
|
303
|
+
}
|
|
304
|
+
|
|
283
305
|
export interface BrandPageViewModel {
|
|
284
306
|
brandPageToken?: string;
|
|
285
307
|
showBrandCrowdLogo: boolean;
|
|
286
|
-
styles:
|
|
308
|
+
styles: PageStylesViewModel;
|
|
287
309
|
pages: PageViewModel[];
|
|
288
310
|
brandPageType: BrandPageType;
|
|
289
311
|
headerViewModelDesktop: PageHeaderViewModel;
|
|
@@ -17,6 +17,7 @@ import { setupStoryPinia } from '../brand-page-maker/__fixtures__/store-fixture'
|
|
|
17
17
|
import {
|
|
18
18
|
mapToPageFooterViewModel,
|
|
19
19
|
mapToPageHeaderViewModel,
|
|
20
|
+
mapToPageStyleViewModel,
|
|
20
21
|
mapToViewModel,
|
|
21
22
|
} from '../../../brand-page/utils';
|
|
22
23
|
|
|
@@ -46,7 +47,7 @@ const pages = [
|
|
|
46
47
|
|
|
47
48
|
const viewModel: BrandPageViewModel = {
|
|
48
49
|
showBrandCrowdLogo: true,
|
|
49
|
-
styles: pageStyles,
|
|
50
|
+
styles: mapToPageStyleViewModel(pageStyles, {}),
|
|
50
51
|
headerViewModelDesktop: mapToPageHeaderViewModel(
|
|
51
52
|
new PageHeaderDesktop(),
|
|
52
53
|
pageStyles,
|
|
@@ -19,7 +19,7 @@ export interface videoStoreState {
|
|
|
19
19
|
export const useVideoStore = defineStore('video', {
|
|
20
20
|
state: (): videoStoreState => ({
|
|
21
21
|
videoUrls: {},
|
|
22
|
-
gettyImagesKeyPrefix: '',
|
|
22
|
+
gettyImagesKeyPrefix: 'uat2/getty-videos',
|
|
23
23
|
shouldPlayVideos: true,
|
|
24
24
|
}),
|
|
25
25
|
actions: {
|
|
@@ -297,7 +297,9 @@
|
|
|
297
297
|
"addMedia": "Add Media",
|
|
298
298
|
"addImage": "Add Image",
|
|
299
299
|
"replaceImage": "Replace Image",
|
|
300
|
-
"image": "Image"
|
|
300
|
+
"image": "Image",
|
|
301
|
+
"media": "Media",
|
|
302
|
+
"replaceMedia": "Replace Media"
|
|
301
303
|
},
|
|
302
304
|
"colorPicker": {
|
|
303
305
|
"newColor": "New Color",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
{{ backgroundSettingsTr(`addMedia`) }}
|
|
16
16
|
</h4>
|
|
17
17
|
|
|
18
|
-
<CollapsiblePanel :title="backgroundSettingsTr('
|
|
18
|
+
<CollapsiblePanel :title="backgroundSettingsTr('media')">
|
|
19
19
|
<ImageField
|
|
20
20
|
id="background-image"
|
|
21
21
|
name="backgroundImage"
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
placeholder="Add background image"
|
|
25
25
|
media-type="Content"
|
|
26
26
|
@on-intent-image-replace="onIntentImageReplace"
|
|
27
|
-
@update:model-value="
|
|
27
|
+
@update:model-value="onBackgroundMediaDeleted"
|
|
28
28
|
/>
|
|
29
29
|
</CollapsiblePanel>
|
|
30
30
|
<div
|
|
@@ -101,6 +101,7 @@ import {
|
|
|
101
101
|
useBrandPageMakerStore,
|
|
102
102
|
useBrandPageMakerUserStore,
|
|
103
103
|
useUiStore,
|
|
104
|
+
useVideoStore,
|
|
104
105
|
} from '../../../brand-page-maker/stores';
|
|
105
106
|
import { useUiBackgroundSettingsStore } from '../store';
|
|
106
107
|
import SideBarSettingsHeader from '../../common/SideBarSettingsHeader.vue';
|
|
@@ -109,7 +110,11 @@ import PersonalisationRoleField from '../../content-settings/components/personal
|
|
|
109
110
|
import { computed, onMounted, reactive } from 'vue';
|
|
110
111
|
import type { UserMediaItem } from '../../my-uploads/models';
|
|
111
112
|
import type { UpdateItemValuePayload } from '../../content-settings/models';
|
|
112
|
-
import {
|
|
113
|
+
import {
|
|
114
|
+
type GettyVideoMedia,
|
|
115
|
+
MEDIA_TYPES,
|
|
116
|
+
type PersonalisationRole,
|
|
117
|
+
} from '../../../brand-page';
|
|
113
118
|
import { backgroundSettingsTr } from '../../../composables/useTranslate';
|
|
114
119
|
import ReplaceImageSettingsForBackgroundSettings from './ReplaceImageSettingsForBackgroundSettings.vue';
|
|
115
120
|
|
|
@@ -122,6 +127,8 @@ const uiStore = useUiStore();
|
|
|
122
127
|
const backgroundStyles = computed(
|
|
123
128
|
() => backgroundSettingsStore.backgroundStyles,
|
|
124
129
|
);
|
|
130
|
+
|
|
131
|
+
console.log('this is the background styles: ', backgroundStyles.value);
|
|
125
132
|
const recommendedLogoColors = computed(
|
|
126
133
|
() => backgroundSettingsStore.recommendedLogoColors,
|
|
127
134
|
);
|
|
@@ -167,12 +174,19 @@ const personalisationRole = computed(() => {
|
|
|
167
174
|
// This hides the shape in the image field as there will be a future thumbnail for shapes
|
|
168
175
|
const imageFieldValue = computed(() => {
|
|
169
176
|
const backgroundImageUrl = backgroundStyles.value.backgroundImageUrl || '';
|
|
177
|
+
const media = backgroundStyles.value.media as GettyVideoMedia;
|
|
170
178
|
|
|
171
179
|
// If the background image is an SVG (shape), return empty string to hide it in the image field
|
|
172
180
|
if (backgroundImageUrl.endsWith('.svg')) {
|
|
173
181
|
return '';
|
|
174
182
|
}
|
|
175
183
|
|
|
184
|
+
if (media && media.type === 'getty-video') {
|
|
185
|
+
const videoStore = useVideoStore();
|
|
186
|
+
const videoUrls = videoStore.getVideoUrlsForToken(media.gettyToken);
|
|
187
|
+
return videoUrls?.previewImageUrl || ''; // Show the video thumbnail
|
|
188
|
+
}
|
|
189
|
+
|
|
176
190
|
return backgroundImageUrl;
|
|
177
191
|
});
|
|
178
192
|
|
|
@@ -227,16 +241,22 @@ const onBackgroundImageSelected = (image: UserMediaItem) => {
|
|
|
227
241
|
});
|
|
228
242
|
};
|
|
229
243
|
|
|
230
|
-
const
|
|
244
|
+
const onBackgroundMediaDeleted = (payload: {
|
|
231
245
|
id: string;
|
|
232
246
|
name: string;
|
|
233
247
|
value: string;
|
|
234
248
|
}) => {
|
|
249
|
+
console.log('Here deleting');
|
|
235
250
|
if (payload.value === '') {
|
|
236
251
|
backgroundSettingsStore.setBackgroundImageUrl({
|
|
237
252
|
backgroundImageUrl: '',
|
|
238
253
|
});
|
|
239
254
|
}
|
|
255
|
+
|
|
256
|
+
if (backgroundStyles.value?.media) {
|
|
257
|
+
console.log('Removing background video');
|
|
258
|
+
backgroundSettingsStore.removeBackgroundVideo();
|
|
259
|
+
}
|
|
240
260
|
};
|
|
241
261
|
|
|
242
262
|
const selectShapeTab = (tab: string) => {
|
|
@@ -265,10 +285,10 @@ const onIntentImageReplace = (payload: {
|
|
|
265
285
|
errorMessage: '',
|
|
266
286
|
isRequired: false,
|
|
267
287
|
replaceImageSettings: {
|
|
268
|
-
tabs: ['MY_UPLOADS', 'IMAGE_LIBRARY'],
|
|
269
|
-
buttonTitleAdd: backgroundSettingsTr(`
|
|
270
|
-
titleAdd: backgroundSettingsTr(`
|
|
271
|
-
titleReplace: backgroundSettingsTr(`
|
|
288
|
+
tabs: ['MY_UPLOADS', 'IMAGE_LIBRARY', 'VIDEO_LIBRARY'],
|
|
289
|
+
buttonTitleAdd: backgroundSettingsTr(`addMedia`),
|
|
290
|
+
titleAdd: backgroundSettingsTr(`addMedia`),
|
|
291
|
+
titleReplace: backgroundSettingsTr(`replaceMedia`),
|
|
272
292
|
contentMediaFieldName: payload.value ? 'backgroundImage' : '',
|
|
273
293
|
openByDefault: false,
|
|
274
294
|
mediaType: data.mediaType,
|