@designcrowd/library.brand-page 6.0.18 → 6.0.19-ast-btns

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 (75) hide show
  1. package/lib/src/{CreatedOnBrandCrowd-de-de-CIrk6Brm.js → CreatedOnBrandCrowd-de-de-BrIpxgMF.js} +1 -1
  2. package/lib/src/{CreatedOnBrandCrowd-en-us-CvXk0moH.js → CreatedOnBrandCrowd-en-us-DQDv2DBf.js} +1 -1
  3. package/lib/src/{CreatedOnBrandCrowd-es-es-BhtZbjjU.js → CreatedOnBrandCrowd-es-es-BadaUjK1.js} +1 -1
  4. package/lib/src/{CreatedOnBrandCrowd-fr-fr-B6TD57O-.js → CreatedOnBrandCrowd-fr-ca-DbrUAAGP.js} +1 -1
  5. package/lib/src/{CreatedOnBrandCrowd-fr-ca-B6TD57O-.js → CreatedOnBrandCrowd-fr-fr-DbrUAAGP.js} +1 -1
  6. package/lib/src/{CreatedOnBrandCrowd-pt-pt-Bto0xOtS.js → CreatedOnBrandCrowd-pt-br-Cy41WPcW.js} +1 -1
  7. package/lib/src/{CreatedOnBrandCrowd-pt-br-Bto0xOtS.js → CreatedOnBrandCrowd-pt-pt-Cy41WPcW.js} +1 -1
  8. package/lib/src/{CreatedOnDcom-de-de-2h2W3y5z.js → CreatedOnDcom-de-de-D6UvcWQ5.js} +1 -1
  9. package/lib/src/{CreatedOnDcom-en-us-D6Jgk6yv.js → CreatedOnDcom-en-us-DKUOQjj3.js} +1 -1
  10. package/lib/src/{CreatedOnDcom-es-es-sBCqYQIm.js → CreatedOnDcom-es-es-CftpM7Vk.js} +1 -1
  11. package/lib/src/{CreatedOnDcom-fr-ca-C8hg5hTU.js → CreatedOnDcom-fr-ca-DcCQzJDA.js} +1 -1
  12. package/lib/src/{CreatedOnDcom-fr-fr-_DP1Umyh.js → CreatedOnDcom-fr-fr-Bodcymjw.js} +1 -1
  13. package/lib/src/{CreatedOnDcom-pt-br-BdwYAy5p.js → CreatedOnDcom-pt-br-B1OmeM4X.js} +1 -1
  14. package/lib/src/{CreatedOnDcom-pt-pt-Bm1NHVaH.js → CreatedOnDcom-pt-pt-CGx-k757.js} +1 -1
  15. package/lib/src/brand-page/components/button/decorative-button-styles.d.ts +5 -0
  16. package/lib/src/brand-page/components/button/decorative-button-styles.js +13 -0
  17. package/lib/src/brand-page/components/button/paper-button-mask.d.ts +1 -0
  18. package/lib/src/brand-page/components/button/paper-button-mask.js +8 -0
  19. package/lib/src/brand-page/components/collapsible/Collapsible.mixin.d.ts +11 -0
  20. package/lib/src/brand-page/components/collapsible/Collapsible.mixin.js +10 -0
  21. package/lib/src/brand-page/components/contact-form/ContactForm.mixin.d.ts +1 -0
  22. package/lib/src/brand-page/components/contact-form/ContactForm.mixin.js +7 -0
  23. package/lib/src/brand-page/components/mailing-list/MailingList.mixin.js +5 -0
  24. package/lib/src/brand-page/components/payment/Payment.mixin.js +5 -0
  25. package/lib/src/brand-page/models/index.d.ts +1 -0
  26. package/lib/src/brand-page/models/payment.model.d.ts +2 -0
  27. package/lib/src/brand-page/utils/migration/migration-19.d.ts +2 -0
  28. package/lib/src/brand-page/utils/migration/migration-19.js +48 -0
  29. package/lib/src/brand-page/utils/migration.util.js +9 -0
  30. package/lib/src/brand-page/utils/view-model.util.js +1 -0
  31. package/lib/src/brand-page-maker/constants/config-settings-constant.js +32 -1
  32. package/lib/src/brand-page-maker/default-getters/contact-form-background-color.default-getter.d.ts +8 -0
  33. package/lib/src/brand-page-maker/default-getters/contact-form-background-color.default-getter.js +16 -0
  34. package/lib/src/brand-page-maker/default-getters/index.d.ts +1 -0
  35. package/lib/src/brand-page-maker/default-getters/index.js +1 -0
  36. package/lib/src/brand-page-maker/models/button-styles-config.js +15 -3
  37. package/lib/src/brand-page-maker/models/content-settings.js +3 -0
  38. package/lib/src/css/library.brand-page-brandCrowd.min.css +72 -69
  39. package/lib/src/css/library.brand-page-brandPage.min.css +72 -69
  40. package/lib/src/css/library.brand-page-designCom.min.css +72 -69
  41. package/lib/src/css/library.brand-page-preview.min.css +72 -69
  42. package/lib/src/index.mjs +1 -1
  43. package/lib/src/{lib-CPTMajMv.js → lib-ce4Vsuiu.js} +30228 -30028
  44. package/lib/src/metadata-builder/builders/section-rules/banner-section.rules.js +6 -0
  45. package/lib/src/metadata-builder/parsers/section-tool-arguments.d.ts +1 -1
  46. package/package.json +1 -1
  47. package/src/brand-page/components/button/ButtonStyleWrapper.vue +92 -41
  48. package/src/brand-page/components/button/ButtonStyleWrapper.vue.test.ts +164 -0
  49. package/src/brand-page/components/button/decorative-button-styles.ts +16 -0
  50. package/src/brand-page/components/button/paper-button-mask.ts +8 -0
  51. package/src/brand-page/components/collapsible/Collapsible.mixin.ts +11 -0
  52. package/src/brand-page/components/contact-form/ContactForm.mixin.ts +10 -0
  53. package/src/brand-page/components/contact-form/ContactForm.vue +88 -39
  54. package/src/brand-page/components/mailing-list/MailingList.mixin.ts +6 -0
  55. package/src/brand-page/components/mailing-list/MailingList.vue +18 -10
  56. package/src/brand-page/components/payment/Payment.mixin.ts +6 -0
  57. package/src/brand-page/components/payment/Payment.vue +43 -24
  58. package/src/brand-page/components/payment/RequestPaymentStripe.vue +26 -22
  59. package/src/brand-page/components/shop/Shop.vue +15 -6
  60. package/src/brand-page/models/index.ts +1 -0
  61. package/src/brand-page/models/payment.model.ts +2 -0
  62. package/src/brand-page/utils/__snapshots__/migration.util.test.ts.snap +3 -3
  63. package/src/brand-page/utils/migration/migration-19.test.ts +120 -0
  64. package/src/brand-page/utils/migration/migration-19.ts +67 -0
  65. package/src/brand-page/utils/migration.util.ts +10 -0
  66. package/src/brand-page/utils/view-model.util.ts +1 -0
  67. package/src/brand-page-maker/constants/config-settings-constant.ts +32 -0
  68. package/src/brand-page-maker/default-getters/contact-form-background-color.default-getter.ts +23 -0
  69. package/src/brand-page-maker/default-getters/index.ts +1 -0
  70. package/src/brand-page-maker/models/button-styles-config.ts +15 -3
  71. package/src/brand-page-maker/models/content-settings.ts +3 -0
  72. package/src/metadata-builder/builders/section-rules/banner-section.rules.ts +6 -0
  73. package/src/metadata-builder/parsers/section-tool-arguments.ts +7 -1
  74. package/src/metadata-builder/sanitizers/__tests__/section-args-validator.test.ts +13 -0
  75. package/src/shared/style-settings/components/StyleSettings.vue +1 -0
@@ -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 = () =>
@@ -887,6 +887,7 @@ const mapToShopViewModel = (
887
887
  styles: PageStyles,
888
888
  ): ShopViewModel => {
889
889
  const buttonStyles = new ButtonStyles({
890
+ selectedButtonStyleId: styles.buttonStyles.selectedButtonStyleId,
890
891
  style: {
891
892
  ...styles.buttonStyles.style,
892
893
  },
@@ -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,
@@ -1824,6 +1825,16 @@ export const MAILING_LIST_CONTENT_SETTINGS_CONFIG =
1824
1825
  titleStyle: DEFAULT_TITLE_STYLE_SETTINGS_FILED_WITH_TITLE(),
1825
1826
  buttonTextStyle: DEFAULT_BUTTON_TEXT_STYLE_FIELD(),
1826
1827
  ...PADDING_CONTROL_FIELDS(SETTINGS_STYLE_FIELD_GROUP_IDS.style),
1828
+ backgroundStyle: {
1829
+ type: 'color',
1830
+ groupId: SETTINGS_STYLE_FIELD_GROUP_IDS.style,
1831
+ defaultValue: {},
1832
+ isInline: true,
1833
+ showToggle: false,
1834
+ title: contentSettingsTr(`backgroundColorTitle`),
1835
+ valueConvertor: backgroundColorConvertor,
1836
+ defaultGetter: paymentFillColorFieldDefaultGetter,
1837
+ },
1827
1838
  },
1828
1839
  isEnabled: true,
1829
1840
  isLocked: false,
@@ -2009,6 +2020,16 @@ export const REQUEST_PAYMENT_CONTENT_SETTINGS_CONFIG =
2009
2020
  label: contentSettingsTr(`buttonTextStyleLabel`),
2010
2021
  },
2011
2022
  ...PADDING_CONTROL_FIELDS(REQUEST_PAYMENT_GROUPS.style),
2023
+ backgroundStyle: {
2024
+ type: 'color',
2025
+ groupId: REQUEST_PAYMENT_GROUPS.style,
2026
+ defaultValue: {},
2027
+ isInline: true,
2028
+ showToggle: false,
2029
+ title: contentSettingsTr(`backgroundColorTitle`),
2030
+ valueConvertor: backgroundColorConvertor,
2031
+ defaultGetter: paymentFillColorFieldDefaultGetter,
2032
+ },
2012
2033
  },
2013
2034
  isEnabled: (features) => features.canAddRequestPaymentContents,
2014
2035
  isLocked: false,
@@ -2077,6 +2098,16 @@ export const SUPPORT_ME_CONTENT_SETTINGS_CONFIG =
2077
2098
  },
2078
2099
  buttonTextStyle: DEFAULT_BUTTON_TEXT_STYLE_FIELD(),
2079
2100
  ...PADDING_CONTROL_FIELDS(SETTINGS_STYLE_FIELD_GROUP_IDS.style),
2101
+ backgroundStyle: {
2102
+ type: 'color',
2103
+ groupId: SETTINGS_STYLE_FIELD_GROUP_IDS.style,
2104
+ defaultValue: {},
2105
+ isInline: true,
2106
+ showToggle: false,
2107
+ title: contentSettingsTr(`backgroundColorTitle`),
2108
+ valueConvertor: backgroundColorConvertor,
2109
+ defaultGetter: paymentFillColorFieldDefaultGetter,
2110
+ },
2080
2111
  },
2081
2112
  isEnabled: (features) => features.canAddRequestPaymentContents,
2082
2113
  isLocked: false,
@@ -2232,6 +2263,7 @@ export const CONTACT_FORM_SETTINGS_CONFIG =
2232
2263
  showToggle: false,
2233
2264
  title: contentSettingsTr(`backgroundColorTitle`),
2234
2265
  valueConvertor: backgroundColorConvertor,
2266
+ defaultGetter: contactFormBackgroundColorDefaultGetter,
2235
2267
  },
2236
2268
  },
2237
2269
  isEnabled: true,
@@ -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: [BRAND_PAGE_TYPES.default, BRAND_PAGE_TYPES.brandContact],
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: [BRAND_PAGE_TYPES.default, BRAND_PAGE_TYPES.brandContact],
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: [BRAND_PAGE_TYPES.default, BRAND_PAGE_TYPES.brandContact],
424
+ brandPageType: [
425
+ BRAND_PAGE_TYPES.default,
426
+ BRAND_PAGE_TYPES.brandContact,
427
+ BRAND_PAGE_TYPES.brandSite,
428
+ ],
417
429
  },
418
430
  ];
@@ -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,
@@ -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':