@designcrowd/library.brand-page 5.10.20 → 5.10.30

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 (95) hide show
  1. package/lib/src/brand-page/models/index.d.ts +5 -0
  2. package/lib/src/brand-page/models/index.js +4 -0
  3. package/lib/src/brand-page/utils/style.util.d.ts +8 -1
  4. package/lib/src/brand-page/utils/style.util.js +58 -5
  5. package/lib/src/brand-page-maker/components/brand-page-maker/__fixtures__/brand-page-examples.js +1 -1
  6. package/lib/src/brand-page-maker/components/brand-page-maker/__fixtures__/content-settings-items.fixture.js +1 -0
  7. package/lib/src/brand-page-maker/components/brand-page-maker/__fixtures__/page-content-items.d.ts +1 -1
  8. package/lib/src/brand-page-maker/components/brand-page-maker/__fixtures__/page-content-items.js +2 -1
  9. package/lib/src/brand-page-maker/components/brandpage-maker-page/BrandPageMakerPage.mixin.d.ts +33 -0
  10. package/lib/src/brand-page-maker/components/brandpage-maker-page/BrandPageMakerPage.mixin.js +35 -1
  11. package/lib/src/brand-page-maker/components/template-preview/TemplatePreview.mixin.d.ts +1 -0
  12. package/lib/src/brand-page-maker/components/template-preview/TemplatePreview.mixin.js +17 -0
  13. package/lib/src/brand-page-maker/composables/rich-text-editor/bubbleMenu.d.ts +19 -0
  14. package/lib/src/brand-page-maker/composables/rich-text-editor/bubbleMenu.js +31 -0
  15. package/lib/src/brand-page-maker/composables/rich-text-editor/extensions/AutoLink.d.ts +2 -0
  16. package/lib/src/brand-page-maker/composables/rich-text-editor/extensions/AutoLink.js +161 -0
  17. package/lib/src/brand-page-maker/composables/rich-text-editor/extensions/MaxLength.js +3 -3
  18. package/lib/src/brand-page-maker/composables/rich-text-editor/font.d.ts +1 -1
  19. package/lib/src/brand-page-maker/composables/rich-text-editor/font.js +0 -1
  20. package/lib/src/brand-page-maker/composables/rich-text-editor/formatting.d.ts +1 -1
  21. package/lib/src/brand-page-maker/composables/rich-text-editor/formatting.js +0 -1
  22. package/lib/src/brand-page-maker/composables/rich-text-editor/hyperlink.d.ts +19 -0
  23. package/lib/src/brand-page-maker/composables/rich-text-editor/hyperlink.js +87 -0
  24. package/lib/src/brand-page-maker/composables/rich-text-editor/spacing.d.ts +1 -1
  25. package/lib/src/brand-page-maker/composables/rich-text-editor/spacing.js +0 -1
  26. package/lib/src/brand-page-maker/composables/rich-text-editor/textAlign.d.ts +1 -1
  27. package/lib/src/brand-page-maker/composables/rich-text-editor/textAlign.js +0 -1
  28. package/lib/src/brand-page-maker/composables/rich-text-editor/useRichTextEditor.d.ts +24 -3
  29. package/lib/src/brand-page-maker/composables/rich-text-editor/useRichTextEditor.js +214 -33
  30. package/lib/src/brand-page-maker/models/button-group.model.d.ts +2 -0
  31. package/lib/src/brand-page-maker/utils/rich-text-editor.util.d.ts +19 -2
  32. package/lib/src/brand-page-maker/utils/rich-text-editor.util.js +340 -8
  33. package/lib/src/{bundled-translations.de-DE-O4sKkzBX.js → bundled-translations.de-DE-DjQFwukR.js} +1 -1
  34. package/lib/src/{bundled-translations.es-ES-C4lGaf08.js → bundled-translations.es-ES--EbGRI7e.js} +1 -1
  35. package/lib/src/bundled-translations.fr-FR-BS3Kia5y.js +117 -0
  36. package/lib/src/{bundled-translations.fr-FR-CIy8KjAV.js → bundled-translations.fr-FR-VtC2JYUC.js} +1 -1
  37. package/lib/src/{bundled-translations.pt-PT-C8EcSdyX.js → bundled-translations.pt-PT-l9cEldEo.js} +1 -1
  38. package/lib/src/bundles/bundled-translations.fr-FR.json +2 -2
  39. package/lib/src/css/library.brand-page-brandCrowd.min.css +96 -70
  40. package/lib/src/css/library.brand-page-brandPage.min.css +96 -70
  41. package/lib/src/css/library.brand-page-designCom.min.css +96 -70
  42. package/lib/src/css/library.brand-page-preview.min.css +96 -70
  43. package/lib/src/index.d.ts +1 -0
  44. package/lib/src/index.mjs +29673 -27225
  45. package/lib/src/lib.js +1 -0
  46. package/lib/src/mockServiceWorker.js +91 -54
  47. package/lib/src/shared/content-settings/components/color-field/ColorField.mixin.d.ts +11 -0
  48. package/lib/src/shared/content-settings/components/color-field/ColorField.mixin.js +5 -0
  49. package/lib/src/shared/content-settings/components/page-dropdown-field/PageDropdownField.mixin.d.ts +11 -1
  50. package/lib/src/shared/content-settings/components/page-dropdown-field/PageDropdownField.mixin.js +4 -0
  51. package/lib/src/shared/content-settings/components/url-field/UrlField.mixin.d.ts +2 -0
  52. package/lib/src/shared/content-settings/components/url-field/UrlField.mixin.js +12 -7
  53. package/lib/src/shared/page-settings/components/page-settings-section-styles/PageSettingsSectionStyles.mixin.d.ts +2 -0
  54. package/package.json +6 -3
  55. package/src/brand-page/components/banner-section/BannerSection.vue +6 -0
  56. package/src/brand-page/components/text/Text.vue +2 -0
  57. package/src/brand-page/components/text-wrapper/TextWrapper.vue +31 -11
  58. package/src/brand-page/models/index.ts +6 -0
  59. package/src/brand-page/utils/style.util.ts +105 -5
  60. package/src/brand-page-maker/components/brand-page-maker/__fixtures__/brand-page-examples.ts +1 -1
  61. package/src/brand-page-maker/components/brand-page-maker/__fixtures__/content-settings-items.fixture.ts +1 -0
  62. package/src/brand-page-maker/components/brand-page-maker/__fixtures__/page-content-items.ts +2 -0
  63. package/src/brand-page-maker/components/brandpage-maker-page/BrandPageMakerPage.mixin.ts +44 -1
  64. package/src/brand-page-maker/components/brandpage-maker-page/BrandPageMakerPage.vue +1 -0
  65. package/src/brand-page-maker/components/brandpage-settings/i18n/brand-page-settings.fr-FR.json +1 -1
  66. package/src/brand-page-maker/components/google-analytics/i18n/google-analytics.fr-FR.json +1 -1
  67. package/src/brand-page-maker/components/rich-text-editor/RichTextEditor.vue +539 -50
  68. package/src/brand-page-maker/components/template-preview/TemplatePreview.mixin.ts +22 -0
  69. package/src/brand-page-maker/components/template-preview/TemplatePreview.vue +1 -1
  70. package/src/brand-page-maker/composables/rich-text-editor/bubbleMenu.ts +42 -0
  71. package/src/brand-page-maker/composables/rich-text-editor/extensions/AutoLink.ts +227 -0
  72. package/src/brand-page-maker/composables/rich-text-editor/extensions/MaxLength.test.ts +1 -1
  73. package/src/brand-page-maker/composables/rich-text-editor/extensions/MaxLength.ts +4 -15
  74. package/src/brand-page-maker/composables/rich-text-editor/font.ts +1 -1
  75. package/src/brand-page-maker/composables/rich-text-editor/formatting.ts +1 -1
  76. package/src/brand-page-maker/composables/rich-text-editor/hyperlink.ts +114 -0
  77. package/src/brand-page-maker/composables/rich-text-editor/spacing.ts +1 -1
  78. package/src/brand-page-maker/composables/rich-text-editor/textAlign.ts +1 -1
  79. package/src/brand-page-maker/composables/rich-text-editor/useRichTextEditor.ts +299 -41
  80. package/src/brand-page-maker/models/button-group.model.ts +2 -0
  81. package/src/brand-page-maker/stores/brandpage-maker/__snapshots__/brandpage-maker-store.test.ts.snap +1 -0
  82. package/src/brand-page-maker/utils/rich-text-editor.util.test.ts +418 -0
  83. package/src/brand-page-maker/utils/rich-text-editor.util.ts +470 -25
  84. package/src/bundles/bundled-translations.fr-FR.json +2 -2
  85. package/src/lib.ts +1 -0
  86. package/src/shared/content-settings/components/color-field/ColorField.mixin.ts +5 -0
  87. package/src/shared/content-settings/components/color-field/ColorField.vue +1 -1
  88. package/src/shared/content-settings/components/page-dropdown-field/PageDropdownField.mixin.ts +4 -0
  89. package/src/shared/content-settings/components/page-dropdown-field/PageDropdownField.vue +2 -2
  90. package/src/shared/content-settings/components/text-field/TextField.vue +1 -1
  91. package/src/shared/content-settings/components/text-items-field/TextItemsField.vue +2 -2
  92. package/src/shared/content-settings/components/textarea-field/TextareaField.vue +3 -3
  93. package/src/shared/content-settings/components/url-field/UrlField.mixin.ts +15 -10
  94. package/src/shared/content-settings/components/url-field/UrlField.vue +1 -0
  95. package/lib/src/bundled-translations.fr-FR-CTnDppmf.js +0 -117
@@ -27,6 +27,7 @@ import {
27
27
  getNewColorBasedOnTargetColorTheme,
28
28
  } from './color.util';
29
29
  import chroma from 'chroma-js';
30
+ import { hasRTEContent } from '../../brand-page-maker/utils';
30
31
 
31
32
  const MIN_LUM_RATIO = 0.3;
32
33
 
@@ -56,7 +57,7 @@ const parseFabricColorToCssStyle = (fabricColor: any): ThemeColor => {
56
57
  * @param colorData { rgb: 'rgb(0,255,0)', gradient: 'linear-gradient(180deg, rgb(0,0,0), rgb(255,0,0), 100%)'}
57
58
  * @returns string - rgb() or linear-gradient()
58
59
  */
59
- const getColorValueForCorrectCssProperty = (
60
+ export const getColorValueForCorrectCssProperty = (
60
61
  k: string,
61
62
  colorData: ThemeColor,
62
63
  ): string => {
@@ -100,8 +101,9 @@ export const colorMatchCssKeyValue = (
100
101
  }
101
102
 
102
103
  if (
103
- cssValue.match(new RegExp(STYLE_THEME_KEYS.LogoTextColor, 'g')) ||
104
- cssValue.match(new RegExp(STYLE_THEME_KEYS.LogoTextMultiColor, 'g'))
104
+ (cssValue.match(new RegExp(STYLE_THEME_KEYS.LogoTextColor, 'g')) ||
105
+ cssValue.match(new RegExp(STYLE_THEME_KEYS.LogoTextMultiColor, 'g'))) &&
106
+ !hasRTEContent(cssValue)
105
107
  ) {
106
108
  cssValue = getColorValueForCorrectCssProperty(
107
109
  cssKey,
@@ -110,8 +112,11 @@ export const colorMatchCssKeyValue = (
110
112
 
111
113
  return { cssValue, isModified: true };
112
114
  } else if (
113
- cssValue.match(new RegExp(STYLE_THEME_KEYS.LogoBackgroundColor, 'g')) ||
114
- cssValue.match(new RegExp(STYLE_THEME_KEYS.LogoBackgroundMultiColor, 'g'))
115
+ (cssValue.match(new RegExp(STYLE_THEME_KEYS.LogoBackgroundColor, 'g')) ||
116
+ cssValue.match(
117
+ new RegExp(STYLE_THEME_KEYS.LogoBackgroundMultiColor, 'g'),
118
+ )) &&
119
+ !hasRTEContent(cssValue)
115
120
  ) {
116
121
  cssValue = getColorValueForCorrectCssProperty(
117
122
  cssKey,
@@ -367,6 +372,9 @@ const CONTENT_STYLE_PROP_NAME_SUFFIX = [
367
372
  'Replacements',
368
373
  ];
369
374
 
375
+ const RTE_ALLOWED_SECTION_TYPES = ['text', 'banner-section'];
376
+ const RTE_ALLOWED_FIELDS = ['title', 'description', 'text', 'textItems'];
377
+
370
378
  export const applyLogoThemeToContents = (
371
379
  logoTheme: LogoTheme,
372
380
  pages: PageModel[],
@@ -397,6 +405,22 @@ export const applyLogoThemeToContents = (
397
405
  isModified = isModified || isApplied;
398
406
  }
399
407
 
408
+ const rteContentKeys = RTE_ALLOWED_SECTION_TYPES.includes(content.type)
409
+ ? Object.keys(content).filter((k) => RTE_ALLOWED_FIELDS.includes(k))
410
+ : [];
411
+
412
+ for (const key of rteContentKeys) {
413
+ const { newRTEContent, isApplied } =
414
+ applyLogoThemeToBrandPageRTEContentColorsRecursive(
415
+ newContent[key],
416
+ logoTheme,
417
+ isModified,
418
+ );
419
+
420
+ newContent[key] = newRTEContent;
421
+ isModified = isModified || isApplied;
422
+ }
423
+
400
424
  return newContent;
401
425
  });
402
426
 
@@ -406,6 +430,82 @@ export const applyLogoThemeToContents = (
406
430
  return { pages: newPages, isModified };
407
431
  };
408
432
 
433
+ type RteContent = Record<string, string | any>;
434
+
435
+ const applyLogoThemeToBrandPageRTEContentColorsRecursive = (
436
+ content: string | RteContent | RteContent[],
437
+ logoTheme: LogoTheme,
438
+ isModified: boolean,
439
+ ): {
440
+ isApplied: boolean;
441
+ newRTEContent: RteContent | RteContent[] | string;
442
+ } => {
443
+ let isApplied = false;
444
+ let newRTEContent: RteContent | RteContent[] | string = {};
445
+
446
+ if (typeof content === 'string' && hasRTEContent(content)) {
447
+ newRTEContent = replaceRTEContentColors(content, logoTheme);
448
+ isApplied = true;
449
+ } else if (Array.isArray(content)) {
450
+ newRTEContent = content.map((item) => {
451
+ const { newRTEContent: recursiveContent, isApplied: recursiveIsApplied } =
452
+ applyLogoThemeToBrandPageRTEContentColorsRecursive(
453
+ item,
454
+ logoTheme,
455
+ isModified,
456
+ );
457
+
458
+ isApplied = recursiveIsApplied;
459
+
460
+ return recursiveContent;
461
+ });
462
+ } else if (typeof content === 'object') {
463
+ for (const [key, value] of Object.entries(content)) {
464
+ if (
465
+ RTE_ALLOWED_FIELDS.includes(key) &&
466
+ typeof value === 'string' &&
467
+ hasRTEContent(value)
468
+ ) {
469
+ newRTEContent[key] = replaceRTEContentColors(value, logoTheme);
470
+ isApplied = true;
471
+ } else {
472
+ newRTEContent[key] = value;
473
+ }
474
+ }
475
+ } else {
476
+ newRTEContent = content;
477
+ isApplied = false;
478
+ }
479
+
480
+ return { isApplied, newRTEContent };
481
+ };
482
+
483
+ const replaceRTEContentColors = (
484
+ content: string,
485
+ logoTheme: LogoTheme,
486
+ ): string => {
487
+ return content
488
+ .replace(
489
+ new RegExp(`var\\(--${STYLE_THEME_KEYS.LogoTextColor}\\)`, 'g'),
490
+ logoTheme.logoTextColor.rgb,
491
+ )
492
+ .replace(
493
+ new RegExp(`var\\(--${STYLE_THEME_KEYS.LogoBackgroundColor}\\)`, 'g'),
494
+ logoTheme.logoBackgroundColor.rgb,
495
+ )
496
+ .replace(
497
+ new RegExp(`var\\(--${STYLE_THEME_KEYS.LogoTextMultiColor}\\)`, 'g'),
498
+ logoTheme.logoTextColor.rgb,
499
+ )
500
+ .replace(
501
+ new RegExp(
502
+ `var\\(--${STYLE_THEME_KEYS.LogoBackgroundMultiColor}\\)`,
503
+ 'g',
504
+ ),
505
+ logoTheme.logoBackgroundColor.rgb,
506
+ );
507
+ };
508
+
409
509
  export const applyLogoThemeToBrandPageStyles = (
410
510
  logoTheme: LogoTheme,
411
511
  pageStyles: PageStyles,
@@ -210,7 +210,7 @@ export const BRAND_SITE: BrandPageData = {
210
210
  color: 'logo-text-color',
211
211
  fontSize: '1.5rem',
212
212
  textAlign: 'center',
213
- fontFamily: 'Nunito',
213
+ fontFamily: 'Exo 2',
214
214
  lineHeight: '2rem',
215
215
  },
216
216
  colorReplacements: [
@@ -64,6 +64,7 @@ export const textContent: TextContent = {
64
64
  textSize: {},
65
65
  textStyle: {
66
66
  textAlign: DEFAULT_TEXT_ALIGN,
67
+ fontSize: '2em',
67
68
  },
68
69
  textAlignment: {},
69
70
  textColor: {},
@@ -13,11 +13,13 @@ import {
13
13
  pinterestLink,
14
14
  twitchLink,
15
15
  tiktokLink,
16
+ textContent,
16
17
  } from './content-settings-items.fixture';
17
18
 
18
19
  export const brandPageContentsSampleData = [
19
20
  logoContent,
20
21
  profileContent,
22
+ textContent,
21
23
  generalLink,
22
24
  websiteLink,
23
25
  emailLink,
@@ -32,6 +32,7 @@ import type { DebounceHandle } from 'lodash.debounce';
32
32
  import { transformToRTE } from '../../../brand-page-maker/utils';
33
33
  import { useExternalRichTextEditor } from '../../../brand-page-maker/composables/rich-text-editor/useRichTextEditor';
34
34
  import { useUiStyleSettingsStore } from '../../../shared/style-settings/store';
35
+ import { STYLE_THEME_KEYS } from '../../../brand-page/constants';
35
36
 
36
37
  export default defineComponent({
37
38
  mixins: [PageMixin],
@@ -70,6 +71,7 @@ export default defineComponent({
70
71
  () => brandPageMakerUserStore.features.canUseRichTextEditor,
71
72
  ),
72
73
  isAdmin: computed(() => brandPageMakerUserStore.isAdmin),
74
+ logoTheme: computed(() => uiStore.logoTheme),
73
75
  contentSettingsStore,
74
76
  brandPageMakerStore,
75
77
  brandPageContainerStore,
@@ -141,6 +143,35 @@ export default defineComponent({
141
143
  return this.isContentSelected ? item.id === this.selectedItemId : false;
142
144
  };
143
145
  },
146
+ styleHtml(): string {
147
+ if (!this.logoTheme) {
148
+ return '';
149
+ }
150
+
151
+ // Generate CSS variables for logo theme colors
152
+ const cssVariables = Object.entries(STYLE_THEME_KEYS)
153
+ .map(([key, value]) => {
154
+ const themeColor = key.includes('Background')
155
+ ? this.logoTheme.logoBackgroundColor
156
+ : this.logoTheme.logoTextColor;
157
+
158
+ if (themeColor?.rgb) {
159
+ return `--${value}: ${themeColor.rgb};`;
160
+ }
161
+
162
+ return '';
163
+ })
164
+ .filter(Boolean)
165
+ .join('\n ');
166
+
167
+ return cssVariables
168
+ ? `<style>
169
+ :root {
170
+ ${cssVariables}
171
+ }
172
+ </style>`
173
+ : '';
174
+ },
144
175
  },
145
176
  mounted() {
146
177
  this.dispatchViewPortChangeEvent();
@@ -255,11 +286,23 @@ export default defineComponent({
255
286
  (item.type === 'banner-section' || item.type === 'text') &&
256
287
  this.canUseRichTextEditor
257
288
  ) {
289
+ let selectedItem = item;
290
+
291
+ if (this.isAdmin) {
292
+ const currentItem = this.items.find(
293
+ (i: { id: string }) => i.id === item.id,
294
+ );
295
+
296
+ if (currentItem) {
297
+ selectedItem = currentItem.settings.content;
298
+ }
299
+ }
300
+
258
301
  transformToRTE(
259
302
  this.pageSettingsStore,
260
303
  this.externalEditor,
261
304
  this.styleSettingsStore,
262
- item as Content,
305
+ selectedItem as Content,
263
306
  );
264
307
  }
265
308
 
@@ -128,6 +128,7 @@
128
128
  :is-enabled="viewModel.cookieOptions.isCookiePreviewEnabled"
129
129
  :on-accept="() => {}"
130
130
  />
131
+ <div v-html="styleHtml" />
131
132
  </template>
132
133
  <script>
133
134
  import BrandPageMakerPageMixin from './BrandPageMakerPage.mixin';
@@ -6,7 +6,7 @@
6
6
  "cookieCollection" : "Collection de cookies",
7
7
  "faviconDescription" : "Un favicon est une petite icône placée à côté du titre de votre site dans l'onglet du navigateur.",
8
8
  "socialShareTitle" : "Partage sur les réseaux sociaux",
9
- "paymentProvidersTitle" : "Fournisseurs de paiement",
9
+ "paymentProvidersTitle" : "Prestataires de paiement",
10
10
  "paymentProvidersDescription" : "Activez ou inscrivez-vous auprès d'un fournisseur pris en charge. Commencez à collecter des dons et des paiements, ou vendez des produits, des services et bien plus encore !",
11
11
  "paymentProvidersAddProviderLabel" : "Ajouter des prestataires de paiement"
12
12
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "googleAnalytics" : {
3
- "analyticsIntegrations" : "Intégrations analytiques",
3
+ "analyticsIntegrations" : "Intégrations aux outils d'analyse",
4
4
  "googleAnalyticsLabel" : "Google Analytics : GA4",
5
5
  "googleAnalyticsInfo" : "Ajoutez votre identifiant de mesure Google Analytics : GA4 pour suivre vos visiteurs avec GA4, utilisez le format G-XXXXXXXXX ou AW-XXXXXXXXX"
6
6
  }