@designcrowd/library.brand-page 5.16.10 → 5.16.11-contact-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.
Files changed (123) hide show
  1. package/lib/src/{CreatedOnBrandCrowd-de-de-Br0lVuG3.js → CreatedOnBrandCrowd-de-de-D79Mwrx5.js} +1 -1
  2. package/lib/src/{CreatedOnBrandCrowd-en-us-BUh01IwB.js → CreatedOnBrandCrowd-en-us-CtyUXDxl.js} +1 -1
  3. package/lib/src/{CreatedOnBrandCrowd-es-es-CpsF5FnB.js → CreatedOnBrandCrowd-es-es-CGhK163V.js} +1 -1
  4. package/lib/src/{CreatedOnBrandCrowd-fr-fr-Cf9afSIR.js → CreatedOnBrandCrowd-fr-ca-sSzV7xsY.js} +1 -1
  5. package/lib/src/{CreatedOnBrandCrowd-fr-ca-Cf9afSIR.js → CreatedOnBrandCrowd-fr-fr-sSzV7xsY.js} +1 -1
  6. package/lib/src/{CreatedOnBrandCrowd-pt-pt-CFdOEKvD.js → CreatedOnBrandCrowd-pt-br-Bx8PU5VO.js} +1 -1
  7. package/lib/src/{CreatedOnBrandCrowd-pt-br-CFdOEKvD.js → CreatedOnBrandCrowd-pt-pt-Bx8PU5VO.js} +1 -1
  8. package/lib/src/{CreatedOnDcom-de-de-cmu5K1ho.js → CreatedOnDcom-de-de-CrAZimT2.js} +1 -1
  9. package/lib/src/{CreatedOnDcom-en-us-B268amgO.js → CreatedOnDcom-en-us-DgjW71Ea.js} +1 -1
  10. package/lib/src/{CreatedOnDcom-es-es-CfGG58vu.js → CreatedOnDcom-es-es-BBjjpycu.js} +1 -1
  11. package/lib/src/{CreatedOnDcom-fr-ca-Bjl75MMT.js → CreatedOnDcom-fr-ca-85Eax8i4.js} +1 -1
  12. package/lib/src/{CreatedOnDcom-fr-fr-kklHfB6q.js → CreatedOnDcom-fr-fr-jiyAEqxK.js} +1 -1
  13. package/lib/src/{CreatedOnDcom-pt-br-D_kwlo71.js → CreatedOnDcom-pt-br-DnKsyaNG.js} +1 -1
  14. package/lib/src/{CreatedOnDcom-pt-pt-XwJDiVHY.js → CreatedOnDcom-pt-pt-DyCaX6iL.js} +1 -1
  15. package/lib/src/brand-page/clients/brand-page.client.d.ts +2 -0
  16. package/lib/src/brand-page/clients/brand-page.client.js +1 -1
  17. package/lib/src/brand-page/components/contact-form/ContactForm.mixin.js +6 -1
  18. package/lib/src/brand-page/components/page/Page.mixin.js +19 -15
  19. package/lib/src/brand-page/components/page/Page.stories.js +2 -2
  20. package/lib/src/brand-page/models/index.d.ts +4 -0
  21. package/lib/src/brand-page/models/index.js +5 -0
  22. package/lib/src/brand-page/utils/migration/migration-09.d.ts +2 -0
  23. package/lib/src/brand-page/utils/migration/migration-09.js +34 -0
  24. package/lib/src/brand-page/utils/migration.util.js +6 -0
  25. package/lib/src/brand-page/utils/validation.util.js +15 -10
  26. package/lib/src/brand-page/utils/view-model.util.d.ts +2 -1
  27. package/lib/src/brand-page/utils/view-model.util.js +27 -2
  28. package/lib/src/brand-page/view-models.d.ts +17 -2
  29. package/lib/src/brand-page-maker/components/admin-background-settings/AdminBackgroundSettings.mixin.d.ts +7 -2
  30. package/lib/src/brand-page-maker/components/preview/Preview.stories.js +2 -2
  31. package/lib/src/brand-page-maker/constants/config-settings-constant.js +39 -18
  32. package/lib/src/brand-page-maker/models/content-settings.js +21 -0
  33. package/lib/src/bundled-translations-B0_1x7FR.js +163 -0
  34. package/lib/src/bundled-translations.de-DE-DI_6-gFc.js +163 -0
  35. package/lib/src/bundled-translations.es-ES-pnVLlL9X.js +163 -0
  36. package/lib/src/bundled-translations.fr-CA-Bu6ZL2ix.js +163 -0
  37. package/lib/src/bundled-translations.fr-FR-DTEQ7K4e.js +163 -0
  38. package/lib/src/bundled-translations.pt-BR-Cr5hOHkN.js +163 -0
  39. package/lib/src/bundled-translations.pt-PT-75HRywbu.js +163 -0
  40. package/lib/src/bundles/bundled-translations.de-DE.json +23 -3
  41. package/lib/src/bundles/bundled-translations.es-ES.json +23 -3
  42. package/lib/src/bundles/bundled-translations.fr-CA.json +23 -3
  43. package/lib/src/bundles/bundled-translations.fr-FR.json +23 -3
  44. package/lib/src/bundles/bundled-translations.json +23 -3
  45. package/lib/src/bundles/bundled-translations.pt-BR.json +23 -3
  46. package/lib/src/bundles/bundled-translations.pt-PT.json +23 -3
  47. package/lib/src/css/library.brand-page-brandCrowd.min.css +18 -18
  48. package/lib/src/css/library.brand-page-brandPage.min.css +18 -18
  49. package/lib/src/css/library.brand-page-designCom.min.css +18 -18
  50. package/lib/src/css/library.brand-page-preview.min.css +18 -18
  51. package/lib/src/index.mjs +1 -1
  52. package/lib/src/{lib-l_4XUq5L.js → lib-DR2sH6pk.js} +17106 -16841
  53. package/lib/src/shared/background-settings/components/background-shapes/BackgroundShapeSettings.mixin.d.ts +7 -2
  54. package/lib/src/shared/background-settings/store/background-settings-store.d.ts +3 -0
  55. package/lib/src/shared/background-settings/store/background-settings-store.js +43 -2
  56. package/lib/src/shared/content-settings/components/form-fields-field/FormFieldsField.mixin.d.ts +34 -1
  57. package/lib/src/shared/content-settings/components/form-fields-field/FormFieldsField.mixin.js +41 -1
  58. package/lib/src/shared/style-settings/components/StyleSettings.mixin.d.ts +2 -0
  59. package/package.json +1 -1
  60. package/src/brand-page/clients/brand-page.client.ts +3 -1
  61. package/src/brand-page/components/contact-form/ContactForm.mixin.ts +6 -1
  62. package/src/brand-page/components/page/Page.mixin.ts +23 -15
  63. package/src/brand-page/components/page/Page.stories.ts +2 -1
  64. package/src/brand-page/components/page/Page.vue +17 -1
  65. package/src/brand-page/models/index.ts +5 -0
  66. package/src/brand-page/utils/__snapshots__/migration.util.test.ts.snap +6 -3
  67. package/src/brand-page/utils/__snapshots__/migration2.util.test.ts.snap +1 -0
  68. package/src/brand-page/utils/__snapshots__/model.util.test.ts.snap +2 -0
  69. package/src/brand-page/utils/migration/migration-09.ts +43 -0
  70. package/src/brand-page/utils/migration.util.ts +6 -0
  71. package/src/brand-page/utils/validation.util.ts +15 -10
  72. package/src/brand-page/utils/view-model.util.ts +42 -2
  73. package/src/brand-page/view-models.ts +23 -1
  74. package/src/brand-page-maker/components/preview/Preview.stories.ts +2 -1
  75. package/src/brand-page-maker/constants/config-settings-constant.ts +40 -18
  76. package/src/brand-page-maker/models/content-settings.ts +21 -0
  77. package/src/bundles/bundled-translations.de-DE.json +23 -3
  78. package/src/bundles/bundled-translations.es-ES.json +23 -3
  79. package/src/bundles/bundled-translations.fr-CA.json +23 -3
  80. package/src/bundles/bundled-translations.fr-FR.json +23 -3
  81. package/src/bundles/bundled-translations.json +23 -3
  82. package/src/bundles/bundled-translations.pt-BR.json +23 -3
  83. package/src/bundles/bundled-translations.pt-PT.json +23 -3
  84. package/src/shared/background-settings/components/BackgroundSettings.vue +25 -8
  85. package/src/shared/background-settings/components/ReplaceImageSettingsForBackgroundSettings.vue +13 -1
  86. package/src/shared/background-settings/components/i18n/background-settings.de-DE.json +3 -1
  87. package/src/shared/background-settings/components/i18n/background-settings.es-ES.json +3 -1
  88. package/src/shared/background-settings/components/i18n/background-settings.fr-CA.json +3 -1
  89. package/src/shared/background-settings/components/i18n/background-settings.fr-FR.json +3 -1
  90. package/src/shared/background-settings/components/i18n/background-settings.json +3 -1
  91. package/src/shared/background-settings/components/i18n/background-settings.pt-BR.json +3 -1
  92. package/src/shared/background-settings/components/i18n/background-settings.pt-PT.json +3 -1
  93. package/src/shared/background-settings/store/background-settings-store.ts +60 -2
  94. package/src/shared/common/i18n/error.de-DE.json +9 -1
  95. package/src/shared/common/i18n/error.es-ES.json +9 -1
  96. package/src/shared/common/i18n/error.fr-CA.json +9 -1
  97. package/src/shared/common/i18n/error.fr-FR.json +9 -1
  98. package/src/shared/common/i18n/error.json +9 -1
  99. package/src/shared/common/i18n/error.pt-BR.json +9 -1
  100. package/src/shared/common/i18n/error.pt-PT.json +9 -1
  101. package/src/shared/content-settings/components/content-settings/i18n/content-settings.de-DE.json +2 -0
  102. package/src/shared/content-settings/components/content-settings/i18n/content-settings.es-ES.json +2 -0
  103. package/src/shared/content-settings/components/content-settings/i18n/content-settings.fr-CA.json +2 -0
  104. package/src/shared/content-settings/components/content-settings/i18n/content-settings.fr-FR.json +2 -0
  105. package/src/shared/content-settings/components/content-settings/i18n/content-settings.json +2 -0
  106. package/src/shared/content-settings/components/content-settings/i18n/content-settings.pt-BR.json +2 -0
  107. package/src/shared/content-settings/components/content-settings/i18n/content-settings.pt-PT.json +2 -0
  108. package/src/shared/content-settings/components/form-fields-field/FormFieldsField.mixin.ts +45 -1
  109. package/src/shared/content-settings/components/form-fields-field/FormFieldsField.vue +107 -32
  110. package/src/shared/content-settings/components/form-fields-field/i18n/form-fields.de-DE.json +10 -1
  111. package/src/shared/content-settings/components/form-fields-field/i18n/form-fields.es-ES.json +10 -1
  112. package/src/shared/content-settings/components/form-fields-field/i18n/form-fields.fr-CA.json +10 -1
  113. package/src/shared/content-settings/components/form-fields-field/i18n/form-fields.fr-FR.json +10 -1
  114. package/src/shared/content-settings/components/form-fields-field/i18n/form-fields.json +10 -1
  115. package/src/shared/content-settings/components/form-fields-field/i18n/form-fields.pt-BR.json +10 -1
  116. package/src/shared/content-settings/components/form-fields-field/i18n/form-fields.pt-PT.json +10 -1
  117. package/lib/src/bundled-translations-Dw3XtNmX.js +0 -163
  118. package/lib/src/bundled-translations.de-DE-B82Ik9M7.js +0 -163
  119. package/lib/src/bundled-translations.es-ES-cf3pdNuN.js +0 -163
  120. package/lib/src/bundled-translations.fr-CA-DP44EcAZ.js +0 -163
  121. package/lib/src/bundled-translations.fr-FR-V0Zt25kg.js +0 -163
  122. package/lib/src/bundled-translations.pt-BR-Brv6rCss.js +0 -163
  123. package/lib/src/bundled-translations.pt-PT-BTgscCTG.js +0 -163
@@ -1,5 +1,5 @@
1
1
  import { createElementBlock as e, openBlock as l, createStaticVNode as a } from "vue";
2
- import { _ as t } from "./lib-l_4XUq5L.js";
2
+ import { _ as t } from "./lib-DR2sH6pk.js";
3
3
  const i = {}, h = {
4
4
  width: "275",
5
5
  height: "36",
@@ -1,5 +1,5 @@
1
1
  import { createElementBlock as e, openBlock as l, createStaticVNode as a } from "vue";
2
- import { _ as t } from "./lib-l_4XUq5L.js";
2
+ import { _ as t } from "./lib-DR2sH6pk.js";
3
3
  const i = {}, h = {
4
4
  width: "251",
5
5
  height: "36",
@@ -1,5 +1,5 @@
1
1
  import { createElementBlock as e, openBlock as l, createStaticVNode as a } from "vue";
2
- import { _ as t } from "./lib-l_4XUq5L.js";
2
+ import { _ as t } from "./lib-DR2sH6pk.js";
3
3
  const i = {}, h = {
4
4
  width: "250",
5
5
  height: "36",
@@ -1,5 +1,5 @@
1
1
  import { createElementBlock as e, openBlock as l, createStaticVNode as a } from "vue";
2
- import { _ as t } from "./lib-l_4XUq5L.js";
2
+ import { _ as t } from "./lib-DR2sH6pk.js";
3
3
  const i = {}, h = {
4
4
  width: "237",
5
5
  height: "36",
@@ -1,5 +1,5 @@
1
1
  import { createElementBlock as e, openBlock as l, createStaticVNode as a } from "vue";
2
- import { _ as t } from "./lib-l_4XUq5L.js";
2
+ import { _ as t } from "./lib-DR2sH6pk.js";
3
3
  const i = {}, h = {
4
4
  width: "237",
5
5
  height: "36",
@@ -1,5 +1,5 @@
1
1
  import { createElementBlock as e, openBlock as l, createStaticVNode as a } from "vue";
2
- import { _ as t } from "./lib-l_4XUq5L.js";
2
+ import { _ as t } from "./lib-DR2sH6pk.js";
3
3
  const i = {}, h = {
4
4
  width: "263",
5
5
  height: "36",
@@ -1,5 +1,5 @@
1
1
  import { createElementBlock as e, openBlock as l, createStaticVNode as a } from "vue";
2
- import { _ as t } from "./lib-l_4XUq5L.js";
2
+ import { _ as t } from "./lib-DR2sH6pk.js";
3
3
  const i = {}, h = {
4
4
  width: "263",
5
5
  height: "36",
@@ -1,5 +1,5 @@
1
1
  import { createElementBlock as H, openBlock as V, createStaticVNode as t } from "vue";
2
- import { _ as e } from "./lib-l_4XUq5L.js";
2
+ import { _ as e } from "./lib-DR2sH6pk.js";
3
3
  const M = {}, Z = {
4
4
  width: "242",
5
5
  height: "36",
@@ -1,5 +1,5 @@
1
1
  import { createElementBlock as H, openBlock as V, createStaticVNode as t } from "vue";
2
- import { _ as e } from "./lib-l_4XUq5L.js";
2
+ import { _ as e } from "./lib-DR2sH6pk.js";
3
3
  const i = {}, M = {
4
4
  width: "231",
5
5
  height: "36",
@@ -1,5 +1,5 @@
1
1
  import { createElementBlock as H, openBlock as V, createStaticVNode as t } from "vue";
2
- import { _ as e } from "./lib-l_4XUq5L.js";
2
+ import { _ as e } from "./lib-DR2sH6pk.js";
3
3
  const M = {}, Z = {
4
4
  width: "230",
5
5
  height: "36",
@@ -1,5 +1,5 @@
1
1
  import { createElementBlock as H, openBlock as V, createStaticVNode as t } from "vue";
2
- import { _ as e } from "./lib-l_4XUq5L.js";
2
+ import { _ as e } from "./lib-DR2sH6pk.js";
3
3
  const i = {}, l = {
4
4
  width: "216",
5
5
  height: "36",
@@ -1,5 +1,5 @@
1
1
  import { createElementBlock as H, openBlock as V, createStaticVNode as t } from "vue";
2
- import { _ as e } from "./lib-l_4XUq5L.js";
2
+ import { _ as e } from "./lib-DR2sH6pk.js";
3
3
  const i = {}, l = {
4
4
  width: "216",
5
5
  height: "36",
@@ -1,5 +1,5 @@
1
1
  import { createElementBlock as H, openBlock as V, createStaticVNode as t } from "vue";
2
- import { _ as M } from "./lib-l_4XUq5L.js";
2
+ import { _ as M } from "./lib-DR2sH6pk.js";
3
3
  const Z = {}, e = {
4
4
  width: "232",
5
5
  height: "36",
@@ -1,5 +1,5 @@
1
1
  import { createElementBlock as H, openBlock as V, createStaticVNode as t } from "vue";
2
- import { _ as M } from "./lib-l_4XUq5L.js";
2
+ import { _ as M } from "./lib-DR2sH6pk.js";
3
3
  const Z = {}, e = {
4
4
  width: "232",
5
5
  height: "36",
@@ -5,6 +5,8 @@ export interface FormResult {
5
5
  }
6
6
  export interface ContactFormField {
7
7
  id: string;
8
+ name: string;
9
+ type: string;
8
10
  value: string;
9
11
  }
10
12
  export interface CartForShopRequest {
@@ -33,7 +33,7 @@ const submitContactForm = async (brandPageToken, contentBlockId, values) => {
33
33
  const csrfToken = csrfUtil.getCsrfTokenFromMetaHeader();
34
34
  const formBody = {
35
35
  contentBlockId,
36
- ...values.reduce((b, i) => ({ ...b, [i.id]: i.value }), {}),
36
+ fields: values,
37
37
  };
38
38
  await axios.post(`/api/contact/${brandPageToken}`, formBody, {
39
39
  headers: {
@@ -146,7 +146,12 @@ export default defineComponent({
146
146
  let result;
147
147
  this.isSubmitting = true;
148
148
  try {
149
- result = await brandPageClient.submitContactForm(this.context.brandPageToken, this.viewModel.id, this.values.map((v) => ({ id: v.field.id, value: v.value })));
149
+ result = await brandPageClient.submitContactForm(this.context.brandPageToken, this.viewModel.id, this.values.map((v) => ({
150
+ id: v.field.id,
151
+ name: v.field.name,
152
+ type: v.field.type,
153
+ value: v.value,
154
+ })));
150
155
  }
151
156
  finally {
152
157
  this.isSubmitting = false;
@@ -79,15 +79,18 @@ export default defineComponent({
79
79
  },
80
80
  backgroundShapes() {
81
81
  const backgroundShapes = [
82
- ...(this.viewModel?.styles?.backgroundStyles?.backgroundShapes || []),
82
+ ...(this.viewModel?.styles?.backgroundStylesViewModel
83
+ ?.backgroundShapes || []),
83
84
  ];
84
85
  // TODO: create style viewmodel object to include backgroundImageContent attribute only on viewmodel
85
86
  // p.s backgroundImageUrl can be url or SVG content string
86
- if (this.viewModel.styles?.backgroundStyles?.backgroundImageUrl) {
87
+ if (this.viewModel.styles?.backgroundStylesViewModel?.backgroundImageUrl) {
87
88
  backgroundShapes.splice(0, 0, {
88
- name: this.viewModel.styles.backgroundStyles.backgroundImageUrl,
89
+ name: this.viewModel.styles.backgroundStylesViewModel
90
+ .backgroundImageUrl,
89
91
  style: {
90
- ...this.viewModel.styles.backgroundStyles.backgroundShapeStyle,
92
+ ...this.viewModel.styles.backgroundStylesViewModel
93
+ .backgroundShapeStyle,
91
94
  width: `100%`,
92
95
  height: `100%`,
93
96
  },
@@ -97,10 +100,11 @@ export default defineComponent({
97
100
  },
98
101
  rootElementStyles() {
99
102
  let styles = {};
100
- if (!this.viewModel?.styles?.backgroundStyles?.backgroundImageUrl &&
101
- this.viewModel?.styles?.backgroundStyles?.style) {
103
+ if (!this.viewModel?.styles?.backgroundStylesViewModel
104
+ ?.backgroundImageUrl &&
105
+ this.viewModel?.styles?.backgroundStylesViewModel?.style) {
102
106
  styles = {
103
- ...this.viewModel?.styles?.backgroundStyles?.style,
107
+ ...this.viewModel?.styles?.backgroundStylesViewModel?.style,
104
108
  };
105
109
  }
106
110
  Object.assign(styles, this.viewModel?.styles?.textStyles?.style);
@@ -117,26 +121,26 @@ export default defineComponent({
117
121
  },
118
122
  rootBackgroundStyles() {
119
123
  const styles = {
120
- ...(this.viewModel?.styles?.backgroundStyles?.style || {}),
124
+ ...(this.viewModel?.styles?.backgroundStylesViewModel?.style || {}),
121
125
  };
122
126
  delete styles.backgroundAttachment;
123
- if (this.viewModel.styles?.backgroundStyles?.backgroundImageUrl &&
124
- (this.viewModel.styles.backgroundStyles.backgroundImageUrl.endsWith(`.svg`) ||
125
- !this.viewModel.styles?.backgroundStyles?.backgroundImageUrl.startsWith('http'))) {
127
+ if (this.viewModel.styles?.backgroundStylesViewModel?.backgroundImageUrl &&
128
+ (this.viewModel.styles.backgroundStylesViewModel.backgroundImageUrl.endsWith(`.svg`) ||
129
+ !this.viewModel.styles?.backgroundStylesViewModel?.backgroundImageUrl.startsWith('http'))) {
126
130
  // Any backgroundImageUrl that handles svg file, svg markup is handled as BackgroundShape object
127
131
  delete styles.backgroundImage;
128
132
  }
129
- else if (this.viewModel?.styles?.backgroundStyles?.backgroundImageUrl) {
133
+ else if (this.viewModel?.styles?.backgroundStylesViewModel?.backgroundImageUrl) {
130
134
  // if background is a gradient
131
- if (this.viewModel?.styles?.backgroundStyles?.style?.background?.startsWith('linear-gradient')) {
135
+ if (this.viewModel?.styles?.backgroundStylesViewModel?.style?.background?.startsWith('linear-gradient')) {
132
136
  // combine image and gradient into the `background` property
133
- styles.backgroundImage = `url(${this.viewModel?.styles?.backgroundStyles?.backgroundImageUrl}), ${this.viewModel?.styles?.backgroundStyles?.style?.background}`;
137
+ styles.backgroundImage = `url(${this.viewModel?.styles?.backgroundStylesViewModel?.backgroundImageUrl}), ${this.viewModel?.styles?.backgroundStylesViewModel?.style?.background}`;
134
138
  delete styles.background;
135
139
  }
136
140
  else {
137
141
  // background is a solid color
138
142
  styles.backgroundColor = styles.background;
139
- styles.backgroundImage = `url(${this.viewModel?.styles?.backgroundStyles?.backgroundImageUrl})`;
143
+ styles.backgroundImage = `url(${this.viewModel?.styles?.backgroundStylesViewModel?.backgroundImageUrl})`;
140
144
  delete styles.background;
141
145
  }
142
146
  }
@@ -1,6 +1,6 @@
1
1
  import { defineComponent } from 'vue';
2
2
  import Page from './Page.vue';
3
- import { mapToPageFooterViewModel, mapToPageHeaderViewModel, mapToViewModel, } from '../../utils';
3
+ import { mapToPageFooterViewModel, mapToPageHeaderViewModel, mapToPageStyleViewModel, mapToViewModel, } from '../../utils';
4
4
  import { BRAND_PAGE_TYPES, BrandPageModel, SENSITIVE_CONTENT_TYPES, VIEWPORTS, } from '../../models';
5
5
  export default {
6
6
  title: 'Components/BrandPage/Page',
@@ -17,7 +17,7 @@ const pages = brandPageModel.pages.map((p) => ({
17
17
  }));
18
18
  const viewModel = {
19
19
  showBrandCrowdLogo: true,
20
- styles: brandPageModel.styles,
20
+ styles: mapToPageStyleViewModel(brandPageModel.styles, {}),
21
21
  headerViewModelDesktop: mapToPageHeaderViewModel(brandPageModel.pageHeaderDesktop, brandPageModel.styles, pages),
22
22
  headerViewModelMobile: mapToPageHeaderViewModel(brandPageModel.pageHeaderMobile, brandPageModel.styles, pages),
23
23
  footerViewModelDesktop: mapToPageFooterViewModel(brandPageModel.pageFooterDesktop, brandPageModel.styles),
@@ -32,6 +32,7 @@ export declare class BackgroundStyles {
32
32
  backgroundImageUrl: string;
33
33
  backgroundShapes: BackgroundShape[];
34
34
  personalisationRole?: PersonalisationRole;
35
+ media?: AbstractMedia;
35
36
  constructor(option?: Partial<BackgroundStyles>);
36
37
  }
37
38
  export declare const GALLERY_TYPES: {
@@ -199,6 +200,9 @@ export declare const FORM_FIELD_IDS: {
199
200
  readonly emailAddress: "emailAddress";
200
201
  readonly phoneNumber: "phoneNumber";
201
202
  readonly message: "message";
203
+ readonly customField1: "customField1";
204
+ readonly customField2: "customField2";
205
+ readonly customField3: "customField3";
202
206
  };
203
207
  export declare const BUTTON_LINK_TYPE: {
204
208
  readonly url: "url";
@@ -47,6 +47,7 @@ export class BackgroundStyles {
47
47
  backgroundImageUrl;
48
48
  backgroundShapes;
49
49
  personalisationRole;
50
+ media;
50
51
  constructor(option = {}) {
51
52
  this.backgroundImageUrl = option.backgroundImageUrl || '';
52
53
  this.backgroundShapes = (option.backgroundShapes ||
@@ -59,6 +60,7 @@ export class BackgroundStyles {
59
60
  background: '',
60
61
  };
61
62
  this.personalisationRole = option.personalisationRole;
63
+ this.media = option.media || undefined;
62
64
  }
63
65
  }
64
66
  export const GALLERY_TYPES = {
@@ -129,6 +131,9 @@ export const FORM_FIELD_IDS = {
129
131
  emailAddress: 'emailAddress',
130
132
  phoneNumber: 'phoneNumber',
131
133
  message: 'message',
134
+ customField1: 'customField1',
135
+ customField2: 'customField2',
136
+ customField3: 'customField3',
132
137
  };
133
138
  export const BUTTON_LINK_TYPE = {
134
139
  url: 'url',
@@ -0,0 +1,2 @@
1
+ import type { MigrationData } from '../migration.util';
2
+ export declare const migration09: (migrationResult: MigrationData) => Promise<MigrationData>;
@@ -0,0 +1,34 @@
1
+ import { FORM_FIELD_IDS } from '../..';
2
+ import { isContact } from '../model.util';
3
+ export const migration09 = async (migrationResult) => {
4
+ const { brandPageModel } = migrationResult;
5
+ brandPageModel.pages.forEach((page) => {
6
+ page.contents.forEach((content) => {
7
+ if (isContact(content)) {
8
+ const contactForm = content;
9
+ contactForm.fields.push({
10
+ id: FORM_FIELD_IDS.customField1,
11
+ name: 'Custom Field',
12
+ enabled: false,
13
+ required: false,
14
+ type: 'text',
15
+ });
16
+ contactForm.fields.push({
17
+ id: FORM_FIELD_IDS.customField2,
18
+ name: 'Custom Field',
19
+ enabled: false,
20
+ required: false,
21
+ type: 'text',
22
+ });
23
+ contactForm.fields.push({
24
+ id: FORM_FIELD_IDS.customField3,
25
+ name: 'Custom Field',
26
+ enabled: false,
27
+ required: false,
28
+ type: 'text',
29
+ });
30
+ }
31
+ });
32
+ });
33
+ return migrationResult;
34
+ };
@@ -11,6 +11,7 @@ import { migration05_1 } from './migration/migration-05_1';
11
11
  import { migration05_2 } from './migration/migration-05_2';
12
12
  import { migration07 } from './migration/migration-07';
13
13
  import { migration08 } from './migration/migration-08';
14
+ import { migration09 } from './migration/migration-09';
14
15
  const MIGRATION_TABLE = [
15
16
  {
16
17
  version: 1,
@@ -68,6 +69,11 @@ const MIGRATION_TABLE = [
68
69
  migrateFn: migration08,
69
70
  description: 'Migrating logo content sizes for brandPage and brandContact',
70
71
  },
72
+ {
73
+ version: 9,
74
+ migrateFn: migration09,
75
+ description: 'Migrating contact form with additional 3 custom fields',
76
+ },
71
77
  ];
72
78
  export const GetLatestModelVersion = () => Math.max(...MIGRATION_TABLE.map((x) => x.version));
73
79
  export const migrateBrandPageModel = async (brandPageModel, options) => {
@@ -1,19 +1,20 @@
1
1
  import { isEmail } from '../../utils/validator.util';
2
+ import { errorTr } from '../../composables/useTranslate';
2
3
  const MAX_EMAIL_LENGTH = 320;
3
4
  const MAX_PHONE_LENGTH = 50;
4
5
  const MAX_NAME_LENGTH = 250;
5
- const MAX_MESSAGE_LENGTH = 600;
6
+ const MAX_MESSAGE_LENGTH = 1000;
6
7
  export const getEmailValidationError = (email, isRequired) => {
7
8
  if (email.trim() === '') {
8
9
  if (isRequired) {
9
- return 'Please enter your email address.';
10
+ return errorTr('contactFormEmailFieldRequired');
10
11
  }
11
12
  }
12
13
  else if (!isEmail(email)) {
13
- return 'The email address you entered is invalid.';
14
+ return errorTr('contactFormEmailFieldInvalid');
14
15
  }
15
16
  else if (email.length >= MAX_EMAIL_LENGTH) {
16
- return 'The email address you entered is too long.';
17
+ return errorTr('contactFormEmailFieldTooLong');
17
18
  }
18
19
  else {
19
20
  return undefined;
@@ -21,25 +22,29 @@ export const getEmailValidationError = (email, isRequired) => {
21
22
  };
22
23
  export const getPhoneValidationError = (phone, isRequired) => {
23
24
  if (phone.trim() === '' && isRequired) {
24
- return 'Please enter your phone number.';
25
+ return errorTr('contactFormPhoneFieldRequired');
25
26
  }
26
27
  else if (phone.length > MAX_PHONE_LENGTH) {
27
- return 'The phone number you entered is too long.';
28
+ return errorTr('contactFormPhoneFieldTooLong');
28
29
  }
29
30
  };
30
31
  export const getNameValidationError = (name, isRequired) => {
31
32
  if (name.trim() === '' && isRequired) {
32
- return 'Please enter your name.';
33
+ return errorTr('contactFormFieldRequired');
33
34
  }
34
35
  else if (name.length > MAX_NAME_LENGTH) {
35
- return 'The name you entered is too long.';
36
+ return errorTr('contactFormFieldTooLong', {
37
+ MAX_LENGTH: MAX_NAME_LENGTH,
38
+ });
36
39
  }
37
40
  };
38
41
  export const getMessageValidationError = (message, isRequired) => {
39
42
  if (message.trim() === '' && isRequired) {
40
- return 'Please enter your message.';
43
+ return errorTr('contactFormFieldRequired');
41
44
  }
42
45
  else if (message.length > MAX_MESSAGE_LENGTH) {
43
- return `The message you entered is too long. The maximum length is ${MAX_MESSAGE_LENGTH}`;
46
+ return errorTr('contactFormFieldTooLong', {
47
+ MAX_LENGTH: MAX_MESSAGE_LENGTH,
48
+ });
44
49
  }
45
50
  };
@@ -1,5 +1,5 @@
1
1
  import type { ImageContent, ProfileContent, TextContent, PageStyles, Content, BrandPageModel, ImageGalleryContent, GalleryStyles, BannerSectionContent, ImagesSectionContent, BrandPageType, PageHeaderDesktop, PageFooterDesktop, PageFooterMobile, PageHeaderMobile, LogoImageModel, LogoTemplateImageModel, BookingSectionContent } from '../models';
2
- import type { ImageViewModel, LogoViewModel, ProfileViewModel, TextViewModel, ContentViewModel, BrandPageViewModel, ImageGalleryViewModel, PageViewModel, BannerSectionViewModel, PageHeaderViewModel, PageFooterViewModel, TextImageSectionViewModel, BookingSectionViewModel } from '../view-models';
2
+ import type { ImageViewModel, LogoViewModel, ProfileViewModel, TextViewModel, ContentViewModel, BrandPageViewModel, ImageGalleryViewModel, PageViewModel, BannerSectionViewModel, PageHeaderViewModel, PageFooterViewModel, TextImageSectionViewModel, BookingSectionViewModel, PageStylesViewModel } from '../view-models';
3
3
  export declare const applyViewModelTextStyles: <T extends ContentViewModel>(content: T, styles: PageStyles) => T;
4
4
  export declare const mapToImageViewModel: (content: ImageContent) => ImageViewModel;
5
5
  export declare const mapToImageGalleryViewModel: (content: ImageGalleryContent, globalStyles: GalleryStyles) => ImageGalleryViewModel;
@@ -8,6 +8,7 @@ export declare const mapToTextViewModel: (content: TextContent, styles: PageStyl
8
8
  export declare const mapToBannerSectionViewModel: (content: BannerSectionContent, styles: PageStyles, options: ViewModelMappingOptions) => BannerSectionViewModel;
9
9
  export declare const mapToImagesSectionViewModel: (content: ImagesSectionContent, styles: PageStyles, brandPageType: BrandPageType) => TextImageSectionViewModel;
10
10
  export declare const mapToBookingSectionViewModel: (content: BookingSectionContent, styles: PageStyles) => BookingSectionViewModel;
11
+ export declare const mapToPageStyleViewModel: (pageStyles: PageStyles, options: ViewModelMappingOptions) => PageStylesViewModel;
11
12
  export declare const mapToPageHeaderViewModel: (pageHeader: PageHeaderDesktop | PageHeaderMobile, pageStyles: PageStyles, pages: PageViewModel[], useOldLogoRenderSize?: boolean) => PageHeaderViewModel;
12
13
  export declare const mapToPageFooterViewModel: (pageFooter: PageFooterDesktop | PageFooterMobile, pageStyles: PageStyles, useOldLogoRenderSize?: boolean) => PageFooterViewModel;
13
14
  export declare const mapToViewModel: (styles: PageStyles, brandPageType: BrandPageType, options: ViewModelMappingOptions) => (content: Content) => ContentViewModel | undefined;
@@ -604,6 +604,15 @@ export const mapToBookingSectionViewModel = (content, styles) => {
604
604
  isFullWidth: true,
605
605
  }, styles);
606
606
  };
607
+ export const mapToPageStyleViewModel = (pageStyles, options) => {
608
+ return {
609
+ backgroundStylesViewModel: mapBackgroundStylesToViewModel(pageStyles.backgroundStyles, options),
610
+ buttonStyles: pageStyles.buttonStyles,
611
+ logoStyles: pageStyles.logoStyles,
612
+ textStyles: pageStyles.textStyles,
613
+ galleryStyles: pageStyles.galleryStyles,
614
+ };
615
+ };
607
616
  export const mapToPageHeaderViewModel = (pageHeader, pageStyles, pages, useOldLogoRenderSize = false) => {
608
617
  const viewport = pageHeader.viewport;
609
618
  const logoContent = {
@@ -749,6 +758,22 @@ export const mapToViewModel = (styles, brandPageType, options) => (content) => {
749
758
  assertUnreachable();
750
759
  }
751
760
  };
761
+ const mapBackgroundStylesToViewModel = (backgroundStyles, options) => {
762
+ // TODO(jyao): These need to be mapped to a view model eventually
763
+ return {
764
+ style: backgroundStyles.style,
765
+ backgroundShapeStyle: backgroundStyles.backgroundShapeStyle,
766
+ backgroundImageUrl: backgroundStyles.backgroundImageUrl,
767
+ backgroundShapes: backgroundStyles.backgroundShapes,
768
+ personalisationRole: backgroundStyles.personalisationRole,
769
+ mediaViewModel: backgroundStyles.media
770
+ ? mapMediaToContentViewModel({
771
+ media: backgroundStyles.media,
772
+ options,
773
+ })
774
+ : undefined,
775
+ };
776
+ };
752
777
  export const getBrandPageViewModelFromBrandPageModel = (model, brandPageToken, showBrandCrowdLogo = true, options) => {
753
778
  const pages = model.pages.map((p) => {
754
779
  const contents = p.contents
@@ -765,7 +790,7 @@ export const getBrandPageViewModelFromBrandPageModel = (model, brandPageToken, s
765
790
  brandPageToken,
766
791
  pages,
767
792
  showBrandCrowdLogo,
768
- styles: model.styles,
793
+ styles: mapToPageStyleViewModel(model.styles, options),
769
794
  headerViewModelDesktop: mapToPageHeaderViewModel(model.pageHeaderDesktop, model.styles, pages, options.useOldLogoRenderSize),
770
795
  headerViewModelMobile: mapToPageHeaderViewModel(model.pageHeaderMobile, model.styles, pages, options.useOldLogoRenderSize),
771
796
  footerViewModelDesktop: mapToPageFooterViewModel(model.pageFooterDesktop, model.styles, options.useOldLogoRenderSize),
@@ -850,7 +875,7 @@ export const getCriticalResourceURLs = (viewModel) => {
850
875
  }
851
876
  }
852
877
  // shapes
853
- const bgShapeFullBg = viewModel.styles?.backgroundStyles.backgroundImageUrl;
878
+ const bgShapeFullBg = viewModel.styles?.backgroundStylesViewModel.backgroundImageUrl;
854
879
  if (typeof bgShapeFullBg !== 'undefined' && isValidSvgUrl(bgShapeFullBg)) {
855
880
  shapes.push(String(bgShapeFullBg));
856
881
  }
@@ -1,4 +1,4 @@
1
- import type { PageStyles, ButtonWithModalContent, ProfileContent, TextContent, VideoContent, ImageContent, ContentType, ButtonStyles, LogoStyles, MapContent, ImageGalleryContent, GalleryStyles, MailingListContent, RequestPaymentContent, ShopContent, SupportMeContent, ContactFormContent, BannerSectionContent, BrandPageType, SocialLinksContent, TestimonialSectionContent, AboutSectionContent, DividerSectionContent, ShapesSectionContent, ButtonLinkType, PageHeaderMobile, PageHeaderDesktop, PageFooterMobile, PageFooterDesktop, TextMediaItem, TextShapeItem, TextStyleDeclaration, AspectRatio, LogoImageModel, LogoTemplateImageModel, CookieOptions, BookingSectionContent, MediaTypes } from './models';
1
+ import type { ButtonWithModalContent, ProfileContent, TextContent, VideoContent, ImageContent, ContentType, ButtonStyles, LogoStyles, MapContent, ImageGalleryContent, GalleryStyles, MailingListContent, RequestPaymentContent, ShopContent, SupportMeContent, ContactFormContent, BannerSectionContent, BrandPageType, SocialLinksContent, TestimonialSectionContent, AboutSectionContent, DividerSectionContent, ShapesSectionContent, ButtonLinkType, PageHeaderMobile, PageHeaderDesktop, PageFooterMobile, PageFooterDesktop, TextMediaItem, TextShapeItem, TextStyleDeclaration, AspectRatio, LogoImageModel, LogoTemplateImageModel, CookieOptions, BookingSectionContent, MediaTypes, TextStyles, BackgroundStyle, BackgroundShape, PersonalisationRole } from './models';
2
2
  import type { ImagesSectionContentDisplayStyle } from './constants';
3
3
  export type ViewModelType = 'button' | 'image' | 'image-gallery' | 'logo' | 'map' | 'mailing-list' | 'profile' | 'support-me' | 'request-payment' | 'text' | 'video' | 'contact-form' | 'banner-section' | 'images-section' | 'about-section' | 'divider-section' | 'testimonial-section' | 'social-links' | 'shapes-section' | 'shop-section' | 'booking-section';
4
4
  export interface ContentViewModel {
@@ -134,10 +134,25 @@ export interface PageHeaderViewModel extends Omit<PageHeaderDesktop | PageHeader
134
134
  export interface PageFooterViewModel extends Omit<PageFooterDesktop | PageFooterMobile, 'logoImage' | 'logoImageStyle' | 'isLogoOptional' | 'viewport' | 'isLogoVisible' | 'logoTemplateImage' | 'logoImageHeight' | 'logoImageWidth'> {
135
135
  logo: LogoViewModel;
136
136
  }
137
+ export interface BackgroundStylesViewModel {
138
+ style: BackgroundStyle;
139
+ backgroundShapeStyle: BackgroundStyle;
140
+ backgroundImageUrl: string;
141
+ backgroundShapes: BackgroundShape[];
142
+ personalisationRole?: PersonalisationRole;
143
+ mediaViewModel?: MediaViewModel;
144
+ }
145
+ export interface PageStylesViewModel {
146
+ backgroundStylesViewModel: BackgroundStylesViewModel;
147
+ buttonStyles: ButtonStyles;
148
+ logoStyles: LogoStyles;
149
+ textStyles: TextStyles;
150
+ galleryStyles: GalleryStyles;
151
+ }
137
152
  export interface BrandPageViewModel {
138
153
  brandPageToken?: string;
139
154
  showBrandCrowdLogo: boolean;
140
- styles: PageStyles;
155
+ styles: PageStylesViewModel;
141
156
  pages: PageViewModel[];
142
157
  brandPageType: BrandPageType;
143
158
  headerViewModelDesktop: PageHeaderViewModel;
@@ -48,7 +48,6 @@ declare const _default: import("vue").DefineComponent<{}, {
48
48
  aspectRatio?: string | undefined;
49
49
  width?: string | undefined;
50
50
  height?: string | undefined;
51
- textAlign?: string | undefined;
52
51
  backgroundAttachment?: string | undefined;
53
52
  background?: string | undefined;
54
53
  backgroundImage?: string | undefined;
@@ -80,6 +79,7 @@ declare const _default: import("vue").DefineComponent<{}, {
80
79
  overflowWrap?: string | undefined;
81
80
  paddingTop?: string | undefined;
82
81
  position?: string | undefined;
82
+ textAlign?: string | undefined;
83
83
  textDecoration?: string | undefined;
84
84
  top?: string | undefined;
85
85
  transform?: string | undefined;
@@ -92,7 +92,6 @@ declare const _default: import("vue").DefineComponent<{}, {
92
92
  aspectRatio?: string | undefined;
93
93
  width?: string | undefined;
94
94
  height?: string | undefined;
95
- textAlign?: string | undefined;
96
95
  backgroundAttachment?: string | undefined;
97
96
  background?: string | undefined;
98
97
  backgroundImage?: string | undefined;
@@ -124,6 +123,7 @@ declare const _default: import("vue").DefineComponent<{}, {
124
123
  overflowWrap?: string | undefined;
125
124
  paddingTop?: string | undefined;
126
125
  position?: string | undefined;
126
+ textAlign?: string | undefined;
127
127
  textDecoration?: string | undefined;
128
128
  top?: string | undefined;
129
129
  transform?: string | undefined;
@@ -181,6 +181,9 @@ declare const _default: import("vue").DefineComponent<{}, {
181
181
  };
182
182
  }[];
183
183
  personalisationRole?: "website" | "email" | "phone" | "profile" | "about" | "information" | "media" | undefined;
184
+ media?: {
185
+ type: import("../../../brand-page").MediaTypes;
186
+ } | undefined;
184
187
  }>;
185
188
  uiStore: import("pinia").Store<"ui", import("../../../lib").UIRootState, {
186
189
  endpoints: () => import("../../../lib").Endpoints;
@@ -255,6 +258,8 @@ declare const _default: import("vue").DefineComponent<{}, {
255
258
  setBackgroundMode(payload: {
256
259
  backgroundMode: "images" | "edit";
257
260
  }): void;
261
+ setBackgroundMedia(payload: import("src/shared/my-uploads/models").MediaBaseSelectedPayload): void;
262
+ removeBackgroundVideo(): void;
258
263
  }>;
259
264
  }, {
260
265
  isColorMatch: {};
@@ -3,7 +3,7 @@ import Preview from './Preview.vue';
3
3
  import { brandPageData } from '../../../brand-page/__fixtures__/brand-page-sample-data';
4
4
  import { PageStyles, BRAND_PAGE_TYPES, PageHeaderDesktop, PageHeaderMobile, PageFooterDesktop, PageFooterMobile, SENSITIVE_CONTENT_TYPES, } from '../../../brand-page';
5
5
  import { setupStoryPinia } from '../brand-page-maker/__fixtures__/store-fixture';
6
- import { mapToPageFooterViewModel, mapToPageHeaderViewModel, mapToViewModel, } from '../../../brand-page/utils';
6
+ import { mapToPageFooterViewModel, mapToPageHeaderViewModel, mapToPageStyleViewModel, mapToViewModel, } from '../../../brand-page/utils';
7
7
  export default {
8
8
  title: 'Components/BrandPageMaker/Preview',
9
9
  component: Preview,
@@ -21,7 +21,7 @@ const pages = [
21
21
  ];
22
22
  const viewModel = {
23
23
  showBrandCrowdLogo: true,
24
- styles: pageStyles,
24
+ styles: mapToPageStyleViewModel(pageStyles, {}),
25
25
  headerViewModelDesktop: mapToPageHeaderViewModel(new PageHeaderDesktop(), pageStyles, pages),
26
26
  headerViewModelMobile: mapToPageHeaderViewModel(new PageHeaderMobile(), pageStyles, pages),
27
27
  footerViewModelDesktop: mapToPageFooterViewModel(new PageFooterDesktop(), pageStyles),