@designcrowd/library.brand-page 6.0.18 → 6.0.19-ast-btns-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-CIrk6Brm.js → CreatedOnBrandCrowd-de-de-BI4rJV_V.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-en-us-CvXk0moH.js → CreatedOnBrandCrowd-en-us-Crf-sBeO.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-es-es-BhtZbjjU.js → CreatedOnBrandCrowd-es-es-DE_kK1yb.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-fr-fr-B6TD57O-.js → CreatedOnBrandCrowd-fr-ca-BXhEu1vY.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-fr-ca-B6TD57O-.js → CreatedOnBrandCrowd-fr-fr-BXhEu1vY.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-pt-pt-Bto0xOtS.js → CreatedOnBrandCrowd-pt-br-DG1azcKI.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-pt-br-Bto0xOtS.js → CreatedOnBrandCrowd-pt-pt-DG1azcKI.js} +1 -1
- package/lib/src/{CreatedOnDcom-de-de-2h2W3y5z.js → CreatedOnDcom-de-de-BFL99-ya.js} +1 -1
- package/lib/src/{CreatedOnDcom-en-us-D6Jgk6yv.js → CreatedOnDcom-en-us-DqWMpFgs.js} +1 -1
- package/lib/src/{CreatedOnDcom-es-es-sBCqYQIm.js → CreatedOnDcom-es-es-Ds0zIzXx.js} +1 -1
- package/lib/src/{CreatedOnDcom-fr-ca-C8hg5hTU.js → CreatedOnDcom-fr-ca-X-GSmpwv.js} +1 -1
- package/lib/src/{CreatedOnDcom-fr-fr-_DP1Umyh.js → CreatedOnDcom-fr-fr-Cm1eyNiD.js} +1 -1
- package/lib/src/{CreatedOnDcom-pt-br-BdwYAy5p.js → CreatedOnDcom-pt-br-BUOePaaJ.js} +1 -1
- package/lib/src/{CreatedOnDcom-pt-pt-Bm1NHVaH.js → CreatedOnDcom-pt-pt-CJSZsybQ.js} +1 -1
- package/lib/src/brand-page/components/collapsible/Collapsible.mixin.d.ts +11 -0
- package/lib/src/brand-page/components/collapsible/Collapsible.mixin.js +10 -0
- package/lib/src/brand-page/components/contact-form/ContactForm.mixin.d.ts +1 -0
- package/lib/src/brand-page/components/contact-form/ContactForm.mixin.js +7 -0
- package/lib/src/brand-page/components/mailing-list/MailingList.mixin.js +5 -0
- package/lib/src/brand-page/components/payment/Payment.mixin.js +5 -0
- package/lib/src/brand-page/models/index.d.ts +1 -0
- package/lib/src/brand-page/models/payment.model.d.ts +2 -0
- package/lib/src/brand-page/utils/button.util.d.ts +5 -0
- package/lib/src/brand-page/utils/button.util.js +13 -0
- package/lib/src/brand-page/utils/migration/migration-19.d.ts +2 -0
- package/lib/src/brand-page/utils/migration/migration-19.js +48 -0
- package/lib/src/brand-page/utils/migration.util.js +9 -0
- package/lib/src/brand-page/utils/view-model.util.js +1 -0
- package/lib/src/brand-page-maker/constants/config-settings-constant.js +41 -1
- package/lib/src/brand-page-maker/default-getters/contact-form-background-color.default-getter.d.ts +8 -0
- package/lib/src/brand-page-maker/default-getters/contact-form-background-color.default-getter.js +16 -0
- package/lib/src/brand-page-maker/default-getters/index.d.ts +1 -0
- package/lib/src/brand-page-maker/default-getters/index.js +1 -0
- package/lib/src/brand-page-maker/models/button-styles-config.js +15 -3
- package/lib/src/brand-page-maker/models/content-settings-configs.d.ts +1 -1
- package/lib/src/brand-page-maker/models/content-settings.js +3 -0
- package/lib/src/css/library.brand-page-brandCrowd.min.css +96 -68
- package/lib/src/css/library.brand-page-brandPage.min.css +96 -68
- package/lib/src/css/library.brand-page-designCom.min.css +96 -68
- package/lib/src/css/library.brand-page-preview.min.css +96 -68
- package/lib/src/index.mjs +1 -1
- package/lib/src/{lib-CPTMajMv.js → lib-CfENvLvt.js} +18121 -17791
- package/lib/src/metadata-builder/builders/section-rules/banner-section.rules.js +6 -0
- package/lib/src/metadata-builder/parsers/section-tool-arguments.d.ts +1 -1
- package/lib/src/shared/content-settings/components/content-settings-item/ContentSettingsItemField.mixin.js +5 -0
- package/package.json +2 -2
- package/src/brand-page/components/button/ButtonStyleWrapper.vue +112 -44
- package/src/brand-page/components/button/ButtonStyleWrapper.vue.test.ts +167 -0
- package/src/brand-page/components/collapsible/Collapsible.mixin.ts +11 -0
- package/src/brand-page/components/contact-form/ContactForm.mixin.ts +10 -0
- package/src/brand-page/components/contact-form/ContactForm.vue +94 -39
- package/src/brand-page/components/mailing-list/MailingList.mixin.ts +6 -0
- package/src/brand-page/components/mailing-list/MailingList.vue +18 -10
- package/src/brand-page/components/payment/Payment.mixin.ts +6 -0
- package/src/brand-page/components/payment/Payment.vue +43 -24
- package/src/brand-page/components/payment/RequestPaymentStripe.vue +26 -22
- package/src/brand-page/components/shop/Shop.vue +15 -6
- package/src/brand-page/models/index.ts +1 -0
- package/src/brand-page/models/payment.model.ts +2 -0
- package/src/brand-page/utils/__snapshots__/migration.util.test.ts.snap +3 -3
- package/src/brand-page/utils/button.util.ts +17 -0
- package/src/brand-page/utils/migration/migration-19.test.ts +120 -0
- package/src/brand-page/utils/migration/migration-19.ts +67 -0
- package/src/brand-page/utils/migration.util.ts +10 -0
- package/src/brand-page/utils/view-model.util.ts +1 -0
- package/src/brand-page-maker/constants/config-settings-constant.ts +44 -0
- package/src/brand-page-maker/default-getters/contact-form-background-color.default-getter.ts +23 -0
- package/src/brand-page-maker/default-getters/index.ts +1 -0
- package/src/brand-page-maker/models/button-styles-config.ts +15 -3
- package/src/brand-page-maker/models/content-settings-configs.ts +1 -1
- package/src/brand-page-maker/models/content-settings.ts +3 -0
- package/src/metadata-builder/builders/section-rules/banner-section.rules.ts +6 -0
- package/src/metadata-builder/parsers/section-tool-arguments.ts +7 -1
- package/src/metadata-builder/sanitizers/__tests__/section-args-validator.test.ts +13 -0
- package/src/shared/content-settings/components/content-settings-item/ContentSettingsItemField.mixin.ts +6 -0
- package/src/shared/style-settings/components/StyleSettings.vue +1 -0
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { describe, test, expect } from 'vitest';
|
|
2
|
+
import { migration19 } from './migration-19';
|
|
3
|
+
import type { MigrationData } from '../migration.util';
|
|
4
|
+
import { BRAND_PAGE_TYPES } from '../../models';
|
|
5
|
+
|
|
6
|
+
const BUTTON_FILL = 'rgb(255, 222, 89)';
|
|
7
|
+
|
|
8
|
+
const createMigrationData = (brandPageModel: any): MigrationData => ({
|
|
9
|
+
brandPageModel,
|
|
10
|
+
useOldLogoRenderSize: false,
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
const modelWith = (
|
|
14
|
+
contents: any[],
|
|
15
|
+
buttonFill: string | undefined = BUTTON_FILL,
|
|
16
|
+
brandPageType: string = BRAND_PAGE_TYPES.default,
|
|
17
|
+
) => ({
|
|
18
|
+
brandPageType,
|
|
19
|
+
styles: { buttonStyles: { style: { backgroundColor: buttonFill } } },
|
|
20
|
+
pages: [{ contents }],
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
describe('migration19', () => {
|
|
24
|
+
test('seeds backgroundColor from the button fill for each container-backed block when unset', async () => {
|
|
25
|
+
const model = modelWith([
|
|
26
|
+
{ type: 'contact-form' },
|
|
27
|
+
{ type: 'mailing-list' },
|
|
28
|
+
{ type: 'request-payment' },
|
|
29
|
+
{ type: 'support-me' },
|
|
30
|
+
]);
|
|
31
|
+
|
|
32
|
+
const result = await migration19(createMigrationData(model));
|
|
33
|
+
|
|
34
|
+
(result.brandPageModel as any).pages[0].contents.forEach((c: any) => {
|
|
35
|
+
expect(c.backgroundStyle.backgroundColor).toBe(BUTTON_FILL);
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
test('does not override a backgroundColor that is already set', async () => {
|
|
40
|
+
const model = modelWith([
|
|
41
|
+
{
|
|
42
|
+
type: 'mailing-list',
|
|
43
|
+
backgroundStyle: { backgroundColor: 'rgb(1, 2, 3)' },
|
|
44
|
+
},
|
|
45
|
+
]);
|
|
46
|
+
|
|
47
|
+
const result = await migration19(createMigrationData(model));
|
|
48
|
+
|
|
49
|
+
expect(
|
|
50
|
+
(result.brandPageModel as any).pages[0].contents[0].backgroundStyle
|
|
51
|
+
.backgroundColor,
|
|
52
|
+
).toBe('rgb(1, 2, 3)');
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
test('does NOT seed contact-form on brand-site (its own backgroundStyle already applies there)', async () => {
|
|
56
|
+
const model = modelWith(
|
|
57
|
+
[{ type: 'contact-form' }],
|
|
58
|
+
BUTTON_FILL,
|
|
59
|
+
BRAND_PAGE_TYPES.brandSite,
|
|
60
|
+
);
|
|
61
|
+
|
|
62
|
+
const result = await migration19(createMigrationData(model));
|
|
63
|
+
|
|
64
|
+
expect(
|
|
65
|
+
(result.brandPageModel as any).pages[0].contents[0].backgroundStyle,
|
|
66
|
+
).toBeUndefined();
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
test('still seeds mailing-list on brand-site (button-fill container on every type)', async () => {
|
|
70
|
+
const model = modelWith(
|
|
71
|
+
[{ type: 'mailing-list' }],
|
|
72
|
+
BUTTON_FILL,
|
|
73
|
+
BRAND_PAGE_TYPES.brandSite,
|
|
74
|
+
);
|
|
75
|
+
|
|
76
|
+
const result = await migration19(createMigrationData(model));
|
|
77
|
+
|
|
78
|
+
expect(
|
|
79
|
+
(result.brandPageModel as any).pages[0].contents[0].backgroundStyle
|
|
80
|
+
.backgroundColor,
|
|
81
|
+
).toBe(BUTTON_FILL);
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
test('leaves out-of-scope content types untouched', async () => {
|
|
85
|
+
const model = modelWith([{ type: 'banner-section' }, { type: 'text' }]);
|
|
86
|
+
|
|
87
|
+
const result = await migration19(createMigrationData(model));
|
|
88
|
+
|
|
89
|
+
(result.brandPageModel as any).pages[0].contents.forEach((c: any) => {
|
|
90
|
+
expect(c.backgroundStyle).toBeUndefined();
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
test('is a no-op when the button fill colour is undefined', async () => {
|
|
95
|
+
const model = {
|
|
96
|
+
styles: { buttonStyles: { style: {} } },
|
|
97
|
+
pages: [{ contents: [{ type: 'mailing-list' }] }],
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
const result = await migration19(createMigrationData(model));
|
|
101
|
+
|
|
102
|
+
expect(
|
|
103
|
+
(result.brandPageModel as any).pages[0].contents[0].backgroundStyle,
|
|
104
|
+
).toBeUndefined();
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
test('preserves other backgroundStyle keys when seeding', async () => {
|
|
108
|
+
const model = modelWith([
|
|
109
|
+
{ type: 'mailing-list', backgroundStyle: { opacity: '0.5' } },
|
|
110
|
+
]);
|
|
111
|
+
|
|
112
|
+
const result = await migration19(createMigrationData(model));
|
|
113
|
+
|
|
114
|
+
const bg = (result.brandPageModel as any).pages[0].contents[0]
|
|
115
|
+
.backgroundStyle;
|
|
116
|
+
|
|
117
|
+
expect(bg.backgroundColor).toBe(BUTTON_FILL);
|
|
118
|
+
expect(bg.opacity).toBe('0.5');
|
|
119
|
+
});
|
|
120
|
+
});
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import type { MigrationData } from '../migration.util';
|
|
2
|
+
import { BRAND_PAGE_TYPES } from '../../models';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* BP-5800 — decouple the section container background from the global button fill.
|
|
6
|
+
*
|
|
7
|
+
* These blocks' outer container historically took its background from the button
|
|
8
|
+
* fill colour (`containerStyle = { ...buttonStyles }`). They now own a
|
|
9
|
+
* `backgroundStyle`; seed its `backgroundColor` from the current button fill so
|
|
10
|
+
* existing sites render identically while the colour becomes independently editable.
|
|
11
|
+
*
|
|
12
|
+
* runAlways + idempotent: only seeds when the colour is unset, so it never overrides
|
|
13
|
+
* a colour the user has set.
|
|
14
|
+
*/
|
|
15
|
+
const CONTAINER_BACKGROUND_TYPES = new Set<string>([
|
|
16
|
+
'contact-form',
|
|
17
|
+
'mailing-list',
|
|
18
|
+
'request-payment',
|
|
19
|
+
'support-me',
|
|
20
|
+
]);
|
|
21
|
+
|
|
22
|
+
type WithBackgroundStyle = {
|
|
23
|
+
backgroundStyle?: { backgroundColor?: string };
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export const migration19 = async (
|
|
27
|
+
migrationResult: MigrationData,
|
|
28
|
+
): Promise<MigrationData> => {
|
|
29
|
+
const { brandPageModel } = migrationResult;
|
|
30
|
+
const buttonFill =
|
|
31
|
+
brandPageModel.styles?.buttonStyles?.style?.backgroundColor;
|
|
32
|
+
|
|
33
|
+
if (buttonFill === undefined) {
|
|
34
|
+
return migrationResult;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const isBrandSite =
|
|
38
|
+
brandPageModel.brandPageType === BRAND_PAGE_TYPES.brandSite;
|
|
39
|
+
|
|
40
|
+
brandPageModel.pages.forEach((page) => {
|
|
41
|
+
page.contents.forEach((content) => {
|
|
42
|
+
if (!CONTAINER_BACKGROUND_TYPES.has(content.type)) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// contact-form already paints its own backgroundStyle on brand-site (default
|
|
47
|
+
// transparent); only its BP/BC container takes the button fill. mailing-list /
|
|
48
|
+
// payment use the button-fill container on every type, so they always seed.
|
|
49
|
+
if (content.type === 'contact-form' && isBrandSite) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const block = content as WithBackgroundStyle;
|
|
54
|
+
|
|
55
|
+
if (block.backgroundStyle?.backgroundColor !== undefined) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
block.backgroundStyle = {
|
|
60
|
+
...block.backgroundStyle,
|
|
61
|
+
backgroundColor: buttonFill,
|
|
62
|
+
};
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
return migrationResult;
|
|
67
|
+
};
|
|
@@ -21,6 +21,7 @@ import { migration15 } from './migration/migration-15';
|
|
|
21
21
|
import { migration16 } from './migration/migration-16';
|
|
22
22
|
import { migration17 } from './migration/migration-17';
|
|
23
23
|
import { migration18 } from './migration/migration-18';
|
|
24
|
+
import { migration19 } from './migration/migration-19';
|
|
24
25
|
|
|
25
26
|
export interface MigrationData {
|
|
26
27
|
brandPageModel: BrandPageModel;
|
|
@@ -167,6 +168,15 @@ const MIGRATION_TABLE = [
|
|
|
167
168
|
description:
|
|
168
169
|
'BP-5603: backfill stable item ids on all nested items (gallery/section/testimonial/text items, section + footer social links) — the item id is now non-nullable',
|
|
169
170
|
},
|
|
171
|
+
{
|
|
172
|
+
version: 19,
|
|
173
|
+
migrateFn: migration19,
|
|
174
|
+
// runAlways: re-apply on every load so already-published sites pick up the seed
|
|
175
|
+
// without a version bump. Idempotent — only seeds backgroundColor when unset.
|
|
176
|
+
runAlways: true,
|
|
177
|
+
description:
|
|
178
|
+
'BP-5800: seed own container backgroundStyle from the button fill colour for contact-form, mailing-list, request-payment and support-me so the container background is independent of the site button (existing sites render unchanged)',
|
|
179
|
+
},
|
|
170
180
|
] as MigrationTableItem[];
|
|
171
181
|
|
|
172
182
|
export const GetLatestModelVersion = () =>
|
|
@@ -139,6 +139,7 @@ import {
|
|
|
139
139
|
personalisationOverrideVisibility,
|
|
140
140
|
} from '../assessors';
|
|
141
141
|
import {
|
|
142
|
+
contactFormBackgroundColorDefaultGetter,
|
|
142
143
|
logoBackgroundColorDefaultGetter,
|
|
143
144
|
paymentFillColorFieldDefaultGetter,
|
|
144
145
|
paymentTextAndBorderColorFieldDefaultGetter,
|
|
@@ -716,6 +717,13 @@ const testimonialReplaceImageSettings =
|
|
|
716
717
|
mediaType: MEDIA_TYPES.image,
|
|
717
718
|
});
|
|
718
719
|
|
|
720
|
+
// Transparent bg is disallowed on the single-page side (brand-page /
|
|
721
|
+
// brand-contact) so the added background colour stays a solid backdrop for the
|
|
722
|
+
// decorative button styles (BP-5800); brand-site sections keep transparent.
|
|
723
|
+
const disableTransparentOffBrandSite = (
|
|
724
|
+
brandPageType: BrandPageType,
|
|
725
|
+
): boolean => brandPageType !== BRAND_PAGE_TYPES.brandSite;
|
|
726
|
+
|
|
719
727
|
export const LOGO_SETTINGS_CONFIG = (): ContentSettingsConfig<
|
|
720
728
|
Omit<
|
|
721
729
|
LogoContent,
|
|
@@ -1824,6 +1832,17 @@ export const MAILING_LIST_CONTENT_SETTINGS_CONFIG =
|
|
|
1824
1832
|
titleStyle: DEFAULT_TITLE_STYLE_SETTINGS_FILED_WITH_TITLE(),
|
|
1825
1833
|
buttonTextStyle: DEFAULT_BUTTON_TEXT_STYLE_FIELD(),
|
|
1826
1834
|
...PADDING_CONTROL_FIELDS(SETTINGS_STYLE_FIELD_GROUP_IDS.style),
|
|
1835
|
+
backgroundStyle: {
|
|
1836
|
+
type: 'color',
|
|
1837
|
+
groupId: SETTINGS_STYLE_FIELD_GROUP_IDS.style,
|
|
1838
|
+
defaultValue: {},
|
|
1839
|
+
isInline: true,
|
|
1840
|
+
showToggle: false,
|
|
1841
|
+
title: contentSettingsTr(`backgroundColorTitle`),
|
|
1842
|
+
disableTransparent: disableTransparentOffBrandSite,
|
|
1843
|
+
valueConvertor: backgroundColorConvertor,
|
|
1844
|
+
defaultGetter: paymentFillColorFieldDefaultGetter,
|
|
1845
|
+
},
|
|
1827
1846
|
},
|
|
1828
1847
|
isEnabled: true,
|
|
1829
1848
|
isLocked: false,
|
|
@@ -2009,6 +2028,17 @@ export const REQUEST_PAYMENT_CONTENT_SETTINGS_CONFIG =
|
|
|
2009
2028
|
label: contentSettingsTr(`buttonTextStyleLabel`),
|
|
2010
2029
|
},
|
|
2011
2030
|
...PADDING_CONTROL_FIELDS(REQUEST_PAYMENT_GROUPS.style),
|
|
2031
|
+
backgroundStyle: {
|
|
2032
|
+
type: 'color',
|
|
2033
|
+
groupId: REQUEST_PAYMENT_GROUPS.style,
|
|
2034
|
+
defaultValue: {},
|
|
2035
|
+
isInline: true,
|
|
2036
|
+
showToggle: false,
|
|
2037
|
+
title: contentSettingsTr(`backgroundColorTitle`),
|
|
2038
|
+
disableTransparent: disableTransparentOffBrandSite,
|
|
2039
|
+
valueConvertor: backgroundColorConvertor,
|
|
2040
|
+
defaultGetter: paymentFillColorFieldDefaultGetter,
|
|
2041
|
+
},
|
|
2012
2042
|
},
|
|
2013
2043
|
isEnabled: (features) => features.canAddRequestPaymentContents,
|
|
2014
2044
|
isLocked: false,
|
|
@@ -2077,6 +2107,17 @@ export const SUPPORT_ME_CONTENT_SETTINGS_CONFIG =
|
|
|
2077
2107
|
},
|
|
2078
2108
|
buttonTextStyle: DEFAULT_BUTTON_TEXT_STYLE_FIELD(),
|
|
2079
2109
|
...PADDING_CONTROL_FIELDS(SETTINGS_STYLE_FIELD_GROUP_IDS.style),
|
|
2110
|
+
backgroundStyle: {
|
|
2111
|
+
type: 'color',
|
|
2112
|
+
groupId: SETTINGS_STYLE_FIELD_GROUP_IDS.style,
|
|
2113
|
+
defaultValue: {},
|
|
2114
|
+
isInline: true,
|
|
2115
|
+
showToggle: false,
|
|
2116
|
+
title: contentSettingsTr(`backgroundColorTitle`),
|
|
2117
|
+
disableTransparent: disableTransparentOffBrandSite,
|
|
2118
|
+
valueConvertor: backgroundColorConvertor,
|
|
2119
|
+
defaultGetter: paymentFillColorFieldDefaultGetter,
|
|
2120
|
+
},
|
|
2080
2121
|
},
|
|
2081
2122
|
isEnabled: (features) => features.canAddRequestPaymentContents,
|
|
2082
2123
|
isLocked: false,
|
|
@@ -2231,7 +2272,9 @@ export const CONTACT_FORM_SETTINGS_CONFIG =
|
|
|
2231
2272
|
isInline: true,
|
|
2232
2273
|
showToggle: false,
|
|
2233
2274
|
title: contentSettingsTr(`backgroundColorTitle`),
|
|
2275
|
+
disableTransparent: disableTransparentOffBrandSite,
|
|
2234
2276
|
valueConvertor: backgroundColorConvertor,
|
|
2277
|
+
defaultGetter: contactFormBackgroundColorDefaultGetter,
|
|
2235
2278
|
},
|
|
2236
2279
|
},
|
|
2237
2280
|
isEnabled: true,
|
|
@@ -3142,6 +3185,7 @@ export const SHOP_SECTION_SETTINGS_CONFIG = (): ContentSettingsConfig<
|
|
|
3142
3185
|
isInline: true,
|
|
3143
3186
|
showToggle: false,
|
|
3144
3187
|
title: contentSettingsTr(`backgroundColorTitle`),
|
|
3188
|
+
disableTransparent: disableTransparentOffBrandSite,
|
|
3145
3189
|
valueConvertor: backgroundColorConvertor,
|
|
3146
3190
|
},
|
|
3147
3191
|
},
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { RGBAtoHex } from '@utils/helpers';
|
|
2
|
+
import { BRAND_PAGE_TYPES } from '@brand-page';
|
|
3
|
+
import type { DefaultGetter } from '../models';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Contact-form "Background color" default (BP-5800). On brand-page/brand-contact the
|
|
7
|
+
* collapsible container takes the button fill, so default the picker to it. On
|
|
8
|
+
* brand-site the field is the section background behind the card (its own "Card color"),
|
|
9
|
+
* which stays transparent — so no default there.
|
|
10
|
+
*/
|
|
11
|
+
export const contactFormBackgroundColorDefaultGetter: DefaultGetter<
|
|
12
|
+
BrandPageCssStyle
|
|
13
|
+
> = (brandPage): BrandPageCssStyle => {
|
|
14
|
+
if (brandPage.brandPageType === BRAND_PAGE_TYPES.brandSite) {
|
|
15
|
+
return {};
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
return {
|
|
19
|
+
backgroundColor: RGBAtoHex(
|
|
20
|
+
brandPage.styles.buttonStyles.style.backgroundColor,
|
|
21
|
+
),
|
|
22
|
+
};
|
|
23
|
+
};
|
|
@@ -2,3 +2,4 @@ export * from './text-color.default-getter';
|
|
|
2
2
|
export * from './payment-fill-color.default-getter';
|
|
3
3
|
export * from './payment-text-and-border-color.default-getter';
|
|
4
4
|
export * from './logo-background-fill.default-getter';
|
|
5
|
+
export * from './contact-form-background-color.default-getter';
|
|
@@ -379,7 +379,11 @@ export const availableButtonStyleConfigs: ButtonStyleConfig[] = [
|
|
|
379
379
|
iconName: 'button-brushstroke',
|
|
380
380
|
iconViewBox: '0 0 60 20',
|
|
381
381
|
options: ['buttonFillColor', 'buttonIconColor'],
|
|
382
|
-
brandPageType: [
|
|
382
|
+
brandPageType: [
|
|
383
|
+
BRAND_PAGE_TYPES.default,
|
|
384
|
+
BRAND_PAGE_TYPES.brandContact,
|
|
385
|
+
BRAND_PAGE_TYPES.brandSite,
|
|
386
|
+
],
|
|
383
387
|
},
|
|
384
388
|
{
|
|
385
389
|
id: 'BUTTON_STYLE_20',
|
|
@@ -396,7 +400,11 @@ export const availableButtonStyleConfigs: ButtonStyleConfig[] = [
|
|
|
396
400
|
iconName: 'button-arrow',
|
|
397
401
|
iconViewBox: '0 0 60 20',
|
|
398
402
|
options: ['buttonFillColor', 'buttonIconColor'],
|
|
399
|
-
brandPageType: [
|
|
403
|
+
brandPageType: [
|
|
404
|
+
BRAND_PAGE_TYPES.default,
|
|
405
|
+
BRAND_PAGE_TYPES.brandContact,
|
|
406
|
+
BRAND_PAGE_TYPES.brandSite,
|
|
407
|
+
],
|
|
400
408
|
},
|
|
401
409
|
{
|
|
402
410
|
id: 'BUTTON_STYLE_21',
|
|
@@ -413,6 +421,10 @@ export const availableButtonStyleConfigs: ButtonStyleConfig[] = [
|
|
|
413
421
|
iconName: 'button-paper',
|
|
414
422
|
iconViewBox: '0 0 60 20',
|
|
415
423
|
options: ['buttonFillColor', 'buttonIconColor'],
|
|
416
|
-
brandPageType: [
|
|
424
|
+
brandPageType: [
|
|
425
|
+
BRAND_PAGE_TYPES.default,
|
|
426
|
+
BRAND_PAGE_TYPES.brandContact,
|
|
427
|
+
BRAND_PAGE_TYPES.brandSite,
|
|
428
|
+
],
|
|
417
429
|
},
|
|
418
430
|
];
|
|
@@ -137,7 +137,7 @@ export interface ContentSettingsField<TContent> {
|
|
|
137
137
|
| ((brandPageType: BrandPageType) => VariantDisplayModes);
|
|
138
138
|
replaceImageSettings?: ContentReplaceImageSettings<TContent>;
|
|
139
139
|
showToggle?: boolean;
|
|
140
|
-
disableTransparent?: boolean;
|
|
140
|
+
disableTransparent?: boolean | ((brandPageType: BrandPageType) => boolean);
|
|
141
141
|
valueConvertor?: ValueConvertor<any, any>;
|
|
142
142
|
canReplace?: boolean;
|
|
143
143
|
placeholderAssessor?: PlaceholderTypeAssessor<TContent>;
|
|
@@ -319,6 +319,7 @@ export const createInitialMailingListContent = (
|
|
|
319
319
|
textStyleType: TEXT_STYLE_TYPES.buttons,
|
|
320
320
|
textAlign: 'center',
|
|
321
321
|
},
|
|
322
|
+
backgroundStyle: {},
|
|
322
323
|
};
|
|
323
324
|
};
|
|
324
325
|
|
|
@@ -364,6 +365,7 @@ export const createInitialRequestPaymentContent = (
|
|
|
364
365
|
textStyleType: TEXT_STYLE_TYPES.buttons,
|
|
365
366
|
textAlign: 'center',
|
|
366
367
|
},
|
|
368
|
+
backgroundStyle: {},
|
|
367
369
|
};
|
|
368
370
|
};
|
|
369
371
|
|
|
@@ -461,6 +463,7 @@ export const createInitialSupportMeContent = (
|
|
|
461
463
|
textStyleType: TEXT_STYLE_TYPES.buttons,
|
|
462
464
|
textAlign: 'center',
|
|
463
465
|
},
|
|
466
|
+
backgroundStyle: {},
|
|
464
467
|
};
|
|
465
468
|
};
|
|
466
469
|
|
|
@@ -31,6 +31,12 @@ const CHECKS: SectionCheck[] = [
|
|
|
31
31
|
'left-aligned-full-image',
|
|
32
32
|
'center-card-aligned-image',
|
|
33
33
|
'left-card-aligned-image',
|
|
34
|
+
'top-card-aligned-image',
|
|
35
|
+
'bottom-card-aligned-image',
|
|
36
|
+
'middle-card-aligned-image',
|
|
37
|
+
'top-aligned-full-image',
|
|
38
|
+
'bottom-aligned-full-image',
|
|
39
|
+
'middle-aligned-full-image',
|
|
34
40
|
],
|
|
35
41
|
'banner-section',
|
|
36
42
|
),
|
|
@@ -363,7 +363,13 @@ export interface BannerSectionArguments {
|
|
|
363
363
|
| 'right-aligned-full-image'
|
|
364
364
|
| 'left-aligned-full-image'
|
|
365
365
|
| 'center-card-aligned-image'
|
|
366
|
-
| 'left-card-aligned-image'
|
|
366
|
+
| 'left-card-aligned-image'
|
|
367
|
+
| 'top-card-aligned-image'
|
|
368
|
+
| 'bottom-card-aligned-image'
|
|
369
|
+
| 'middle-card-aligned-image'
|
|
370
|
+
| 'top-aligned-full-image'
|
|
371
|
+
| 'bottom-aligned-full-image'
|
|
372
|
+
| 'middle-aligned-full-image';
|
|
367
373
|
title_style?: TextStyleArguments;
|
|
368
374
|
description_style?: TextStyleArguments;
|
|
369
375
|
button_text_style?: ButtonTextStyleArguments;
|
|
@@ -148,6 +148,19 @@ describe('field enum validation', () => {
|
|
|
148
148
|
expect(errors).toHaveLength(0);
|
|
149
149
|
});
|
|
150
150
|
|
|
151
|
+
it.each([
|
|
152
|
+
'top-card-aligned-image',
|
|
153
|
+
'bottom-card-aligned-image',
|
|
154
|
+
'middle-card-aligned-image',
|
|
155
|
+
'top-aligned-full-image',
|
|
156
|
+
'bottom-aligned-full-image',
|
|
157
|
+
'middle-aligned-full-image',
|
|
158
|
+
])('passes on new stacked banner display_style %s (BP-5724)', (style) => {
|
|
159
|
+
const errors = validateBannerSection({ display_style: style } as any, {});
|
|
160
|
+
|
|
161
|
+
expect(errors).toHaveLength(0);
|
|
162
|
+
});
|
|
163
|
+
|
|
151
164
|
it('validates icon_style for social-links', () => {
|
|
152
165
|
const errors = validateSocialLinks(
|
|
153
166
|
{ icon_style: 'not-a-real-style' } as any,
|
|
@@ -212,6 +212,12 @@ export default defineComponent({
|
|
|
212
212
|
return this.field.showToggle;
|
|
213
213
|
},
|
|
214
214
|
disableTransparent(): boolean {
|
|
215
|
+
// Supports a function of brandPageType (like variant/min/maxLength) so a
|
|
216
|
+
// field can disable transparent only on some website types.
|
|
217
|
+
if (typeof this.field.disableTransparent === 'function') {
|
|
218
|
+
return this.field.disableTransparent(this.brandPageType);
|
|
219
|
+
}
|
|
220
|
+
|
|
215
221
|
return this.field.disableTransparent || false;
|
|
216
222
|
},
|
|
217
223
|
plainTextValue(): string {
|
|
@@ -165,6 +165,7 @@
|
|
|
165
165
|
<button
|
|
166
166
|
v-for="(buttonStyleConfig, index) in availableButtonStyleConfigs"
|
|
167
167
|
:key="index"
|
|
168
|
+
:data-test-button-style="buttonStyleConfig.id"
|
|
168
169
|
class="c-button-style tw-cursor-pointer tw-border-0 tw-bg-white tw-px-3 tw-rounded tw-transition-all tw-duration-300 tw-transform hover:tw-bg-grayscale-200 tw-h-14"
|
|
169
170
|
:class="{
|
|
170
171
|
'c-button-style--selected !tw-shadow-[0_0_0_2px] !tw-shadow-info-500':
|